pisper 0.6.29 → 0.6.30
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/package.json +5 -5
- package/web/.vite/manifest.json +635 -635
- package/web/assets/{AppDialog-CX0n4qav.js → AppDialog-CkcKXNVx.js} +1 -1
- package/web/assets/{AppOverlays-J_rOhlw3.js → AppOverlays-8_a8G80q.js} +1 -1
- package/web/assets/{AssetsPage-BuAZJf2M.js → AssetsPage-CZ7QjoFZ.js} +1 -1
- package/web/assets/{BoardPage-BT684h8Y.js → BoardPage-UwrtEMkO.js} +3 -3
- package/web/assets/{ChannelsPage-CznKEDyh.js → ChannelsPage-v1or6g85.js} +1 -1
- package/web/assets/{ChatAppearancePage-BrZ30LfD.js → ChatAppearancePage-BWiw5pd9.js} +1 -1
- package/web/assets/{ChatHistoryPage-BEJbiMs3.js → ChatHistoryPage-BDFnmYkk.js} +1 -1
- package/web/assets/{ChatPage-CCL8A95i.js → ChatPage-DzQO0hD7.js} +3 -3
- package/web/assets/{ConfigPage-_YQZcZlC.js → ConfigPage-CfXNpwBp.js} +2 -2
- package/web/assets/{DesktopWindowControls-C-LzcrLu.js → DesktopWindowControls-Cz8Wg_hN.js} +1 -1
- package/web/assets/{FeaturePage-C4fMefC-.js → FeaturePage-CoalHN81.js} +1 -1
- package/web/assets/{FileAttachmentPreview-DCdc0GFC.js → FileAttachmentPreview-1U8-b6EF.js} +1 -1
- package/web/assets/{FloatingWidgets-C5PMwmK1.js → FloatingWidgets-g5sPCtIK.js} +1 -1
- package/web/assets/{FocusRuntimeControls-D6Rj2AHK.js → FocusRuntimeControls-DtXWdr8l.js} +1 -1
- package/web/assets/{GitDiffViewer-D2QUzasQ.js → GitDiffViewer-Dc46yAUc.js} +1 -1
- package/web/assets/{ManageProjectsDialog-CCg0vZ07.js → ManageProjectsDialog-5QL6Rsyx.js} +1 -1
- package/web/assets/{MarkdownMessage-DbPFHAG0.js → MarkdownMessage-BYQ5qUjo.js} +1 -1
- package/web/assets/{McpPage-DAg9VlnU.js → McpPage-CMMyexGW.js} +1 -1
- package/web/assets/{MemoryEvolution-CVF6CYuV.js → MemoryEvolution-DPD3_wye.js} +1 -1
- package/web/assets/{MemoryPage-C4C8Efhi.js → MemoryPage-Ba_yfJPT.js} +2 -2
- package/web/assets/{MobileNavigation-EsJOtmUl.js → MobileNavigation-CWfgl4Om.js} +1 -1
- package/web/assets/{MorePage-BslKLMFa.js → MorePage-D7Ez-MdJ.js} +1 -1
- package/web/assets/{NewFolderDialog-Bb4T0UPO.js → NewFolderDialog-CvV_ioYA.js} +1 -1
- package/web/assets/{PageHeader-DjJ0Ab6e.js → PageHeader-DeZrNdHv.js} +1 -1
- package/web/assets/{PhoneDrawer-Cu2FDUc1.js → PhoneDrawer-DrKWtKrk.js} +1 -1
- package/web/assets/{PhoneMenuButton-C8pYulkt.js → PhoneMenuButton-CKS9DzOB.js} +1 -1
- package/web/assets/{PhoneTopBar-CvMWkksM.js → PhoneTopBar-l-4k9nw_.js} +1 -1
- package/web/assets/{PluginsPage-DxjMMa05.js → PluginsPage-BsBzoPyO.js} +1 -1
- package/web/assets/{SafeModePrompt-DG64bady.js → SafeModePrompt-BBqKG3rI.js} +1 -1
- package/web/assets/{SchedulesPage-Bd0sjkiZ.js → SchedulesPage-C9VdDHsU.js} +1 -1
- package/web/assets/{SessionBrowserPane-CigWhKGU.js → SessionBrowserPane-Dsf4QuHa.js} +2 -2
- package/web/assets/{SessionContextPanel-HfjETMcF.js → SessionContextPanel-D_DlmWUB.js} +2 -2
- package/web/assets/{SessionHome-DtzbkF19.js → SessionHome-xbtukAlf.js} +1 -1
- package/web/assets/{SessionInspector-BZyFstFl.js → SessionInspector-iJDqtJQH.js} +1 -1
- package/web/assets/{SessionShell-BCIVsKr9.js → SessionShell-CgbIeUd0.js} +1 -1
- package/web/assets/{SettingsSidebar-F20r1qhh.js → SettingsSidebar-l2Fq0Fjv.js} +1 -1
- package/web/assets/{ShortcutHelpDialog-BSiv5k3S.js → ShortcutHelpDialog-C9Cg-rDI.js} +1 -1
- package/web/assets/{ShortcutKeys-BWYkyL77.js → ShortcutKeys-COCK3Z1P.js} +1 -1
- package/web/assets/{SidebarUpdateStatus-BA3cyY6N.js → SidebarUpdateStatus-Db5HG75S.js} +1 -1
- package/web/assets/{SkillsPage-C6cF2A7j.js → SkillsPage-bUxTQh3g.js} +1 -1
- package/web/assets/{TaskProcessesPane-B6O5Mirv.js → TaskProcessesPane-CepFj3M9.js} +1 -1
- package/web/assets/{TaskTerminalView-IR5bGXk7.js → TaskTerminalView-B3uXJaXz.js} +1 -1
- package/web/assets/{TerminalPanel-BAl1Ytmx.js → TerminalPanel-WjT3RQwU.js} +1 -1
- package/web/assets/{WebDesktopPet-CLjE98zM.js → WebDesktopPet-C0tCcQDc.js} +1 -1
- package/web/assets/{WorkflowsPage-5kMzkdP5.js → WorkflowsPage-CjYNxv4V.js} +1 -1
- package/web/assets/{WorkspacePicker-Dy3QRSbL.js → WorkspacePicker-B5zEAngW.js} +1 -1
- package/web/assets/{api-BhPOJ07B.js → api-CHqbIMkc.js} +1 -1
- package/web/assets/{app-update-DK-2lnli.js → app-update-K5RbjYD1.js} +1 -1
- package/web/assets/{approval-confirm-BiKVYJXn.js → approval-confirm-By4nwBEC.js} +1 -1
- package/web/assets/{board-projects-BmfKMy9W.js → board-projects-Cn6F0I5D.js} +1 -1
- package/web/assets/{bots-store-sXgxSYjm.js → bots-store-Cf4rK-qw.js} +1 -1
- package/web/assets/{chat-api-CdqM-TFw.js → chat-api-H18lBlnu.js} +1 -1
- package/web/assets/{client-store-CkmBBzE5.js → client-store-DtL9pe9n.js} +1 -1
- package/web/assets/{config-search-DTHZrqfb.js → config-search-CYSyHqnu.js} +1 -1
- package/web/assets/{desktop-hosts-BzI81G6K.js → desktop-hosts-Coceul_o.js} +1 -1
- package/web/assets/{dialog-BVAtioHy.js → dialog-C_ew2HiI.js} +1 -1
- package/web/assets/{event-stream-B9eeQcgA.js → event-stream-CJDJ_f9g.js} +1 -1
- package/web/assets/{events-CcKmvwE6.js → events-S66w92oA.js} +1 -1
- package/web/assets/{focus-session-composer-bits-BuYWKdXR.js → focus-session-composer-bits-CVCWWebM.js} +1 -1
- package/web/assets/{folder-paths-D8nYAh7q.js → folder-paths-CptXLCCu.js} +1 -1
- package/web/assets/{hosts-BRNTbndS.js → hosts-DPhLIJU_.js} +1 -1
- package/web/assets/{http-CXQuFoDX.js → http-Clt0jbV2.js} +1 -1
- package/web/assets/{http-response-scdqC11Q.js → http-response-C_f1S2cS.js} +1 -1
- package/web/assets/{i18n-D5XUOwJ3.js → i18n-Zs9wBTpa.js} +1 -1
- package/web/assets/{index-at6jiRd2.js → index-BpFQSLJJ.js} +2 -2
- package/web/assets/{machine-messages-BhLpbeyp.js → machine-messages-0-CA3CIF.js} +1 -1
- package/web/assets/{machines-api-c4gyvYeB.js → machines-api-C6W1eWgQ.js} +1 -1
- package/web/assets/{memory-api-BZLLcIF1.js → memory-api-BdiBvhoi.js} +1 -1
- package/web/assets/{mount-app-713eDAlJ.js → mount-app-Cx_t3TyS.js} +3 -3
- package/web/assets/{permission-rules-api-BoggV-So.js → permission-rules-api-B3tMaJim.js} +1 -1
- package/web/assets/{pick-system-directory-COxOQmRm.js → pick-system-directory-nvVGfFRB.js} +1 -1
- package/web/assets/{placements-CWg24KPB.js → placements-DQgsRjpv.js} +2 -2
- package/web/assets/{popover-BKEwGK6p.js → popover-CXY-wqxd.js} +1 -1
- package/web/assets/{public-Ds92tfxs.js → public-BFJhCijs.js} +2 -2
- package/web/assets/{public-DyoA5qbn.js → public-Cy9CZkvX.js} +2 -2
- package/web/assets/{public-CFmAK4C5.js → public-DftK6qxa.js} +1 -1
- package/web/assets/{public-components-CiFLJxlo.js → public-components-Dy2rT6tl.js} +1 -1
- package/web/assets/public-diff-DpqhuEMa.js +1 -0
- package/web/assets/public-events-DeehiuZW.js +1 -0
- package/web/assets/{public-flags-wwqdZl3u.js → public-flags-C0MjuPsC.js} +1 -1
- package/web/assets/{public-folder-dialog-MYvmKYka.js → public-folder-dialog-B_ho2Tuq.js} +1 -1
- package/web/assets/{public-greeting-DFC9u9sY.js → public-greeting-CuNs0758.js} +1 -1
- package/web/assets/{public-_SuCE3iR.js → public-ha8Otx14.js} +1 -1
- package/web/assets/{public-session-qSMh175y.js → public-session-B9nhW7qH.js} +1 -1
- package/web/assets/{public-sidebar-WFoUZVnB.js → public-sidebar-CWBvWdYQ.js} +1 -1
- package/web/assets/{runtime-capabilities-store-D0EC-a9c.js → runtime-capabilities-store-DoZOSQiv.js} +1 -1
- package/web/assets/{safe-mode-instance-Ct43-TDv.js → safe-mode-instance-B9F0Xu3o.js} +1 -1
- package/web/assets/safe-mode-sentinel-Bk2p-CVG.js +1 -0
- package/web/assets/{session-change-summary-api-CyghX14t.js → session-change-summary-api-BbviMo7L.js} +1 -1
- package/web/assets/{session-home-DY7RkKbH.js → session-home-D75yfsOZ.js} +1 -1
- package/web/assets/{session-inspector-store-BocK0l86.js → session-inspector-store-D8oaLlKH.js} +1 -1
- package/web/assets/{session-organization-api-CGRK7VMP.js → session-organization-api-DyiM7H-D.js} +1 -1
- package/web/assets/{session-scope-DDZF_AQ6.js → session-scope-D4AVO880.js} +1 -1
- package/web/assets/{session-tree-actions-g769G3qz.js → session-tree-actions-BiZreN0W.js} +1 -1
- package/web/assets/{session-tree-summary-CqrRroey.js → session-tree-summary-DZk4xiEt.js} +1 -1
- package/web/assets/{shortcuts-BsrTXPiU.js → shortcuts-1-ySiY-G.js} +1 -1
- package/web/assets/{side-chat-context-DNQ3tThq.js → side-chat-context-BXN0j7F9.js} +4 -4
- package/web/assets/{sidebar-R690QKPw.js → sidebar-6NqiNUCV.js} +1 -1
- package/web/assets/{sidebar-store-QvX0w7hQ.js → sidebar-store-CRSu48Er.js} +1 -1
- package/web/assets/{speech-session-DnBIZldd.js → speech-session-LPLnrut8.js} +1 -1
- package/web/assets/{startup-queries-BpV9-ykp.js → startup-queries-D4Xgj-oO.js} +1 -1
- package/web/assets/{use-i18n-AM3jlRYR.js → use-i18n-D6tl7SDi.js} +1 -1
- package/web/assets/{use-open-bot-BDco631W.js → use-open-bot-DFkiPFzc.js} +1 -1
- package/web/assets/{use-studio-actions-C7W6Soh6.js → use-studio-actions-DUeKLKcG.js} +1 -1
- package/web/assets/{useCatalogProjects-DCT51aGo.js → useCatalogProjects-Cv6RLD5k.js} +1 -1
- package/web/assets/{useMachines-BJtbuUVt.js → useMachines-5sQYc73a.js} +1 -1
- package/web/assets/{useNewProjectPicker-B85EuCYh.js → useNewProjectPicker-B058VLdC.js} +2 -2
- package/web/assets/{useNow-BUhFR4QI.js → useNow-v0wgDYcL.js} +1 -1
- package/web/assets/{usePhoneShell-CK9XBtgf.js → usePhoneShell-CcoVb1v0.js} +1 -1
- package/web/assets/{useSessionListQuery-B4Xmcfwa.js → useSessionListQuery-BaBpkejJ.js} +1 -1
- package/web/assets/{useSessionRowActions-BMestf2F.js → useSessionRowActions-B-TF8WrJ.js} +1 -1
- package/web/assets/{useSidebarModel-BDfzya9Z.js → useSidebarModel-B5Mjqu8a.js} +1 -1
- package/web/assets/{workspace-order-store-C_t43Zgq.js → workspace-order-store-DTeP4wAO.js} +1 -1
- package/web/index.html +1 -1
- package/web/assets/public-diff-ByaSqbeU.js +0 -1
- package/web/assets/public-events-BZoQRupR.js +0 -1
- package/web/assets/safe-mode-sentinel-BKPGGJEL.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/GitDiffViewer-
|
|
2
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{h as t}from"./vendor-router-CSN_DGvx.js";import{i as n,r}from"./vendor-react-DwNgTV1j.js";import{t as i}from"./use-i18n-AM3jlRYR.js";import{t as a}from"./useQuery-DfOU-27z.js";import{t as o}from"./createLucideIcon-Cd-3GVxJ.js";import{t as s}from"./arrow-left-B8oVrQ2S.js";import{t as c}from"./arrow-right-DqLOhpA2.js";import{t as l}from"./arrow-up-DST6-qVQ.js";import{t as u}from"./check-2vYc6QaP.js";import{t as d}from"./chevron-down-CxtxIjiP.js";import{t as f}from"./chevron-right-C3t2Rckj.js";import{t as p}from"./earth-Ddy13fHh.js";import{t as m}from"./external-link-CEQqPcqc.js";import{i as h}from"./GitDiffViewer-D2QUzasQ.js";import{t as g}from"./file-Bllajneu.js";import{E as _,a as v,h as y,i as b,m as x,o as S,r as C,u as w}from"./side-chat-context-DNQ3tThq.js";import{t as T}from"./git-branch-N7LGjtzt.js";import{t as E}from"./image-BY_c3FYU.js";import{t as D}from"./link-2-mgasYn21.js";import{t as O}from"./loader-circle-BOwQzHB-.js";import{t as k}from"./message-square-SKjZyY3v.js";import{t as A}from"./pause-CYWpPg1R.js";import{t as j}from"./refresh-cw-TbWxTY4K.js";import{t as ee}from"./square-bHHVTT3G.js";import"./tooltip-D4MFbqcG.js";import{t as M}from"./utils-C8uzG5AZ.js";import{n as N,t as P}from"./button-CCcCN8tE.js";import{c as te,r as F}from"./shortcuts-BsrTXPiU.js";import{t as I}from"./chat-api-CdqM-TFw.js";import{t as L}from"./input-CPw-zkYh.js";import{n as R}from"./session-change-summary-api-CyghX14t.js";import{n as ne,t as z}from"./PageState-Cz6vFMXv.js";import{t as re}from"./AppSelect-DQYKUW5E.js";import{t as ie}from"./session-web-preview-guvsmkWE.js";import"./collapsible-Dcoy-qnz.js";import{o as B}from"./session-tree-summary-CqrRroey.js";import{n as ae,r as V,t as H}from"./web-preview-C7DdG9JP.js";import{n as U}from"./useNativeBrowser-C0j3zafh.js";var W=o(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),G=o(`list-checks`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]),K=o(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),q=o(`rotate-cw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]),J=e(n(),1),Y=r(),oe={completed:`completed`,in_progress:`running`,paused:`pending`,blocked:`blocked`,pending:`pending`};function se(e){let t=new Map(e.map(e=>[String(e.id||``),e])),n=e=>e?.status===`completed`;return e.map(e=>{let r=String(e.id||``),i=(Array.isArray(e.dependsOn)?e.dependsOn:[]).map(e=>t.get(String(e))).filter(e=>!!e&&!n(e)),a=e.status!==`completed`&&(e.status===`blocked`||i.length>0);return{...e,id:r,blocked:a,blockedBy:i}})}function ce({status:e,t}){let n=t(e===`completed`?`chat:planBoard.completed`:e===`in_progress`?`chat:planBoard.inProgress`:e===`paused`?`chat:planBoard.paused`:e===`blocked`?`chat:planBoard.blocked`:`chat:planBoard.pending`);return(0,Y.jsxs)(`span`,{className:`plan-board-status grid size-[18px] flex-none place-items-center rounded-xs text-content-muted [&.completed]:bg-success-soft [&.completed]:text-success [&.running]:text-accent-fg [&.blocked]:bg-danger-soft [&.blocked]:text-danger ${oe[String(e)]||`pending`}`,title:n,children:[e===`completed`?(0,Y.jsx)(u,{size:12,strokeWidth:2.25}):e===`in_progress`?(0,Y.jsx)(N,{className:`size-3.5`}):e===`paused`?(0,Y.jsx)(A,{size:11,strokeWidth:2}):e===`blocked`?(0,Y.jsx)(K,{size:11,strokeWidth:2}):(0,Y.jsx)(W,{size:11,strokeWidth:2}),(0,Y.jsx)(`span`,{className:`sr-only`,children:n})]})}function le({item:e,current:t,running:n,t:r}){return(0,Y.jsxs)(`li`,{className:`plan-board-row flex min-w-0 flex-col gap-[2px] rounded-sm px-[6px] py-[6px] aria-[current=step]:bg-surface-subtle ${e.blocked?`blocked`:``}`,"aria-current":t?`step`:void 0,"data-pisper-plan-current":t?`true`:void 0,"data-pisper-plan-id":e.id,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-[10px]`,children:[(0,Y.jsx)(ce,{status:e.blocked?`blocked`:e.status===`in_progress`&&!n?`paused`:e.status,t:r}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] ${e.status===`completed`?`text-content-muted`:`text-foreground`}`,title:e.title,children:e.title}),e.assignee?(0,Y.jsxs)(`span`,{className:`inline-flex max-w-[40%] flex-none items-center gap-[4px] truncate rounded-xs border border-stroke px-[6px] font-mono text-[12px] leading-[18px] text-content-secondary`,title:r(`chat:planBoard.assignedTo`,{name:e.assignee}),children:[(0,Y.jsx)(_,{size:11,className:`flex-none`}),e.assignee]}):e.status!==`completed`&&(0,Y.jsx)(`span`,{className:`flex-none text-[12px] text-content-muted`,children:r(`chat:planBoard.unassigned`)})]}),e.blockedBy.length>0&&(0,Y.jsxs)(`div`,{className:`inline-flex min-w-0 items-center gap-[5px] pl-[28px] text-[12px] text-content-muted`,children:[(0,Y.jsx)(K,{size:11,className:`flex-none`}),(0,Y.jsx)(`span`,{className:`truncate`,children:r(`chat:planBoard.waitingFor`,{tasks:e.blockedBy.map(e=>e.title||e.id).join(` · `)})})]})]})}function ue({plan:e,running:t,header:n,collapsible:r=!1}){let{t:a}=i(),o=(0,J.useRef)(null),[s,c]=(0,J.useState)(!0),l=e?.items||[],u=se(l),f=u.filter(e=>e.status===`completed`).length,p=u.filter(e=>e.status===`in_progress`&&!e.blocked).length,m=u.filter(e=>e.blocked).length,h=u.find(e=>e.status===`in_progress`&&!e.blocked)?.id??u.find(e=>e.blocked)?.id??u.find(e=>e.status===`pending`)?.id??u.at(-1)?.id;if((0,J.useLayoutEffect)(()=>{if(r&&!s)return;let e=o.current,t=e?.querySelector(`[data-pisper-plan-current="true"]`);if(!e||!t)return;let n=e.getBoundingClientRect(),i=t.getBoundingClientRect();i.top<n.top?e.scrollTop-=n.top-i.top:i.bottom>n.bottom&&(e.scrollTop+=i.bottom-n.bottom)},[r,h,s,u.length]),!l.length)return null;let g=u.find(e=>e.id===h),_=(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(G,{className:`flex-none text-content-muted`,size:15}),(0,Y.jsx)(`strong`,{className:`tabular-nums`,children:a(`chat:planBoard.progress`,{completed:f,total:l.length})}),g?(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-content-secondary`,title:g.title,children:g.title}):null,(0,Y.jsxs)(`span`,{className:`plan-board-counts inline-flex flex-none items-center gap-[8px] text-content-muted tabular-nums @max-[470px]:hidden`,children:[p>0&&(0,Y.jsx)(`span`,{children:a(t?`chat:planBoard.countInProgress`:`chat:planBoard.countPaused`,{count:p})}),m>0&&(0,Y.jsx)(`span`,{className:`blocked text-danger`,children:a(`chat:planBoard.countBlocked`,{count:m})})]}),n,r?(0,Y.jsx)(d,{className:`plan-board-chevron flex-none text-content-muted transition-transform duration-(--d-fast) ease-precise [.plan-board-collapsible[open]_&]:rotate-180`,size:15}):null]}),v=(0,Y.jsx)(`ul`,{ref:o,className:`plan-board-list [.plan-board-collapsible_>_&]:border-t [.plan-board-collapsible_>_&]:border-stroke-soft [.plan-board-collapsible_>_&]:p-[6px_8px_8px] m-0 flex list-none flex-col gap-[1px] pt-[6px]${u.length>4?` is-scrollable [.session-plan-popover_.plan-board-list&]:[block-size:min(250px,38dvh)] [.plan-board-list&]:[block-size:min(220px,34dvh)] [.plan-board-list&]:overflow-y-auto [.plan-board-list&]:[overscroll-behavior:contain] [.plan-board-list&]:pr-[4px] [.plan-board-list&]:[scrollbar-gutter:stable] [.plan-board-list&:focus-visible]:outline-2 [.plan-board-list&:focus-visible]:outline-focus [.plan-board-list&:focus-visible]:outline-offset-2`:``}`,tabIndex:u.length>4?0:void 0,children:u.map(e=>(0,Y.jsx)(le,{running:t,item:e,current:e.id===h,t:a},e.id))});return r?(0,Y.jsxs)(`details`,{className:`plan-board plan-board-collapsible m-[0_auto] flex w-[min(900px,100%)] flex-col overflow-hidden rounded-md border border-stroke bg-panel !p-0 [.session-plan-popover_&]:w-full [.session-plan-popover_&]:border-0 [.session-plan-popover_&]:bg-transparent`,open:s,onToggle:e=>c(e.currentTarget.open),children:[(0,Y.jsx)(`summary`,{className:`plan-board-summary flex min-w-0 items-center gap-[8px] border-b border-stroke-soft pb-[8px] text-[13px] text-content-secondary [&_strong]:flex-none [&_strong]:font-medium [&_strong]:text-foreground [.plan-board-collapsible_>_&]:min-h-[34px] [.plan-board-collapsible_>_&]:cursor-pointer [.plan-board-collapsible_>_&]:list-none [.plan-board-collapsible_>_&]:border-0 [.plan-board-collapsible_>_&]:p-[6px_12px] max-[650px]:[.plan-board-collapsible_>_&]:min-h-11 [.plan-board-collapsible_>_&::-webkit-details-marker]:hidden [.plan-board-collapsible_>_&:hover]:bg-surface-subtle [.plan-board-collapsible_>_&:focus-visible]:outline-2 [.plan-board-collapsible_>_&:focus-visible]:-outline-offset-2 [.plan-board-collapsible_>_&:focus-visible]:outline-focus`,"aria-label":a(`chat:planBoard.toggleAriaLabel`),children:_}),v]}):(0,Y.jsxs)(`section`,{className:`plan-board m-[0_auto] flex w-[min(900px,100%)] flex-col rounded-md border border-stroke bg-panel p-[10px_12px] [.session-plan-popover_&]:w-full [.session-plan-popover_&]:border-0 [.session-plan-popover_&]:bg-transparent [.session-plan-popover_&]:p-0`,"aria-label":a(`chat:planBoard.ariaLabel`),children:[(0,Y.jsx)(`div`,{className:`plan-board-summary flex min-w-0 items-center gap-[8px] border-b border-stroke-soft pb-[8px] text-[13px] text-content-secondary [&_strong]:flex-none [&_strong]:font-medium [&_strong]:text-foreground [.plan-board-collapsible_>_&]:min-h-[34px] [.plan-board-collapsible_>_&]:cursor-pointer [.plan-board-collapsible_>_&]:list-none [.plan-board-collapsible_>_&]:border-0 [.plan-board-collapsible_>_&]:p-[6px_12px] max-[650px]:[.plan-board-collapsible_>_&]:min-h-11 [.plan-board-collapsible_>_&::-webkit-details-marker]:hidden [.plan-board-collapsible_>_&:hover]:bg-surface-subtle [.plan-board-collapsible_>_&:focus-visible]:outline-2 [.plan-board-collapsible_>_&:focus-visible]:-outline-offset-2 [.plan-board-collapsible_>_&:focus-visible]:outline-focus`,children:_}),v]})}var de=(0,J.memo)(ue),fe=(0,J.lazy)(()=>t(()=>import(`./GitDiffViewer-D2QUzasQ.js`).then(e=>e.n).then(e=>({default:e.InlineGitDiff})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17])));function X({sessionId:e,path:t,scope:n,revision:r=0,position:o,onReading:s,mode:c,fill:l=!1}){let{t:u}=i(),d=a({queryKey:[`task-file-diff`,e,n,t,r],queryFn:({signal:r})=>n===`project`?I.getFileDiff(e,t,{signal:r}):I.getSessionFileChangeDiff(e,t,{signal:r})});return d.isPending?(0,Y.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 px-3 py-2.5 text-xs text-content-muted`,children:[(0,Y.jsx)(N,{className:`size-3.5`}),u(`chat:focusSession.gitLoading`)]}):d.isError?(0,Y.jsxs)(`div`,{className:`px-3 py-2.5`,children:[(0,Y.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:d.error.message}),(0,Y.jsx)(P,{variant:`ghost`,size:`sm`,onClick:()=>void d.refetch(),children:u(`chat:chatMessage.filePreviewRetry`)})]}):(0,Y.jsx)(J.Suspense,{fallback:null,children:(0,Y.jsx)(fe,{position:o,onReading:s,diff:d.data.diff,truncated:d.data.diffTruncated,mode:c,fill:l})})}function pe({sessionId:e,cwd:t,streaming:n,view:r,onViewChange:o}){let{t:s}=i(),c=a({queryKey:[`task-project-changes`,e,t,n],queryFn:({signal:t})=>I.getVcsChanges(e,{signal:t})}),l=h(r.reading?.list,e=>o({reading:{...r.reading,list:e}})),u=(0,J.useMemo)(()=>x(c.data?.diff||``,c.data?.files.map(e=>e.path)||[],c.data?.diffTruncated),[c.data]),d=r.expandedFiles.filter(e=>c.data&&!c.data.files.some(t=>t.path===e)),p=c.error?.message||c.data?.error,m=c.data?.files||[];return(0,Y.jsxs)(`section`,{"aria-label":s(`chat:workbench.projectChanges`),className:`flex min-h-0 flex-1 flex-col`,children:[(0,Y.jsxs)(`header`,{className:`flex min-h-10 min-w-0 shrink-0 items-center gap-2 border-b border-stroke-soft pr-1.5 pl-3`,children:[(0,Y.jsx)(`h2`,{className:`min-w-0 flex-1 truncate text-xs font-medium tracking-[.02em] text-content-muted`,children:s(`chat:workbench.projectChanges`)}),c.data?.isRepo&&!p&&(0,Y.jsxs)(`span`,{className:`shrink-0 font-mono text-xs tabular-nums`,children:[(0,Y.jsxs)(`span`,{className:`text-success`,children:[`+`,u.added]}),` `,(0,Y.jsxs)(`span`,{className:`text-danger`,children:[`−`,u.removed]})]}),(0,Y.jsx)(P,{variant:`ghost`,size:`icon`,className:`max-[650px]:size-11`,"aria-label":s(`chat:focusSession.gitRefresh`),disabled:c.isFetching,onClick:()=>void c.refetch(),children:(0,Y.jsx)(j,{size:15,className:c.isFetching?`animate-spin`:void 0})})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2 border-b border-stroke-soft px-3 py-2.5`,children:[(0,Y.jsx)(`p`,{className:`text-xs leading-relaxed text-content-muted`,children:s(`chat:workbench.projectScope`)}),(0,Y.jsxs)(`p`,{className:`flex min-w-0 items-center gap-1.5 text-xs`,title:t,children:[c.data?.branch&&(0,Y.jsxs)(`span`,{className:`inline-flex h-5.5 max-w-[45%] shrink-0 items-center gap-1 rounded-xs border border-stroke px-1.5 font-mono text-content-secondary`,children:[(0,Y.jsx)(T,{size:12,className:`shrink-0`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`truncate`,children:c.data.branch})]}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate font-mono text-content-muted`,children:t})]}),(0,Y.jsxs)(`div`,{className:`flex gap-1`,children:[(0,Y.jsx)(P,{variant:`ghost`,size:`sm`,disabled:!m.length||!!p,onClick:()=>o({expandedFiles:m.map(e=>e.path)}),children:s(`chat:workbench.expandAll`)}),(0,Y.jsx)(P,{variant:`ghost`,size:`sm`,onClick:()=>o({expandedFiles:[]}),children:s(`chat:workbench.collapseAll`)})]})]}),!c.isFetching&&!p&&d.map(e=>(0,Y.jsx)(`p`,{role:`status`,className:`break-all px-3 pt-2 text-xs text-content-muted`,children:s(`chat:workbench.fileNoLongerChanged`,{path:e})},e)),c.isPending?(0,Y.jsx)(ne,{kind:`loading`,title:s(`chat:focusSession.gitLoading`)}):p?(0,Y.jsx)(`p`,{role:`alert`,className:`p-3 text-sm text-danger`,children:p}):c.data?.isRepo?m.length?(0,Y.jsx)(`div`,{ref:l.ref,className:`min-h-0 flex-1 overflow-y-auto`,children:m.map(t=>{let n=r.expandedFiles.includes(t.path);return(0,Y.jsxs)(`article`,{className:`border-b border-stroke-soft`,children:[(0,Y.jsxs)(`button`,{"aria-expanded":n,title:t.path,className:`flex min-h-9 w-full min-w-0 items-center gap-2 pr-3 pl-2 text-left text-sm hover:bg-surface-subtle focus-visible:-outline-offset-2 max-[650px]:min-h-11 pointer-coarse:min-h-11 ${n?`bg-surface-subtle`:``}`,onClick:()=>o({expandedFiles:n?r.expandedFiles.filter(e=>e!==t.path):[...r.expandedFiles,t.path]}),children:[(0,Y.jsx)(f,{size:14,className:`shrink-0 text-content-muted transition-transform duration-(--d-fast) ${n?`rotate-90`:``}`}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs`,children:t.path}),(0,Y.jsx)(`span`,{className:`min-w-4 shrink-0 text-center font-mono text-xs font-medium text-content-secondary`,children:t.status}),Object.hasOwn(u.files,t.path)&&(0,Y.jsxs)(`span`,{className:`shrink-0 font-mono text-xs tabular-nums`,children:[(0,Y.jsxs)(`span`,{className:`text-success`,children:[`+`,u.files[t.path].added]}),` `,(0,Y.jsxs)(`span`,{className:`text-danger`,children:[`−`,u.files[t.path].removed]})]})]}),n&&(0,Y.jsx)(`p`,{className:`break-all px-3 py-1.5 font-mono text-xs text-content-muted`,children:t.path}),n&&(0,Y.jsx)(X,{sessionId:e,path:t.path,scope:`project`,position:r.reading?.[t.path],onReading:e=>o({reading:{...r.reading,[t.path]:e}}),revision:c.dataUpdatedAt})]},t.path)})}):(0,Y.jsx)(z,{compact:!0,title:s(`chat:focusSession.fileChangesEmpty`)}):(0,Y.jsx)(z,{compact:!0,title:s(`chat:workbench.notRepository`)})]})}function Z(e){return e instanceof Error?e.message:String(e)}function me({sessionId:e,streaming:t,requestConfirm:n}){let{t:r}=i(),[a,o]=(0,J.useState)(0),[s,c]=(0,J.useState)(0),[l,u]=(0,J.useState)(null),[d,f]=(0,J.useState)(!0),[p,m]=(0,J.useState)(``),[h,g]=(0,J.useState)(``),[_,v]=(0,J.useState)(``),[y,b]=(0,J.useState)(null),[x,S]=(0,J.useState)(null),[C,w]=(0,J.useState)(null),T=(0,J.useRef)(!1),E=(0,J.useRef)(0),D=(0,J.useRef)(0),O=(0,J.useRef)(!0),k=(0,J.useRef)(!1),A=(0,J.useRef)(t);return(0,J.useLayoutEffect)(()=>{A.current=t},[t]),(0,J.useLayoutEffect)(()=>(T.current=!0,()=>{T.current=!1,E.current+=1,D.current+=1}),[]),(0,J.useEffect)(()=>{let t=++E.current;return D.current+=1,S(null),w(null),O.current=!0,f(!0),m(``),I.getSessionFileChanges(e).then(e=>{T.current&&t===E.current&&(u(e),c(e=>e+1))},e=>{T.current&&t===E.current&&m(Z(e))}).finally(()=>{T.current&&t===E.current&&(O.current=!1,f(!1))}),()=>{E.current+=1}},[a,e,t]),{changes:l,loading:d,error:p,actionError:h,notice:_,running:y,diff:x,setDiff:S,diffLoading:C,snapshotRevision:s,writesDisabled:d||t||!!y||!!p||!l,pendingCount:l?.summary.pending||0,reversibleCount:l?.files.filter(e=>e.canRevert&&!e.reverted).length||0,displayedError:h||p,viewDiff:async t=>{if(k.current||O.current)return;let n=++D.current;w(t),g(``);try{let i=await I.getSessionFileChangeDiff(e,t);if(!T.current||n!==D.current)return;if(!i.diff?.trim()){g(r(`chat:focusSession.fileChangesNoSnapshot`));return}S({diff:i.diff,truncated:!!i.diffTruncated})}catch(e){T.current&&n===D.current&&g(Z(e))}finally{T.current&&n===D.current&&w(null)}},runAction:async t=>{if(!T.current||k.current||O.current||A.current||!l||p||!l.files.filter(e=>t.kind===`approve`?e.pending&&!e.approved&&!e.reverted:e.canRevert&&!e.reverted).some(e=>t.path===void 0||e.path===t.path))return;k.current=!0,b(t),g(``),v(``);let i=++E.current;D.current+=1,S(null),w(null);let a=!1;try{if(t.kind===`revert`&&!await n({title:t.path?r(`chat:focusSession.fileChangesRevertFile`):r(`chat:focusSession.fileChangesRevertAll`),message:t.path?r(`chat:focusSession.fileChangesRevertFileDescription`,{path:t.path}):r(`chat:focusSession.fileChangesRevertAllDescription`),confirmLabel:r(`chat:focusSession.fileChangesConfirmRevert`),tone:`danger`})||!T.current||A.current||O.current||i!==E.current)return;a=!0;let o=t.kind===`approve`?await I.approveSessionFileChanges(e,t.path):await I.revertSessionFileChanges(e,t.path);if(R(e),!T.current||i!==E.current)return;u(o),t.kind===`approve`?v(t.path?r(`chat:focusSession.fileChangesApproved`):r(`chat:focusSession.fileChangesApproveDone`)):o.reverted?t.path===void 0&&o.files.some(e=>e.pending)?v(r(`chat:focusSession.fileChangesRevertPartial`,{count:o.reverted})):v(r(`chat:focusSession.fileChangesRevertDone`)):v(r(`chat:focusSession.fileChangesRevertUnavailable`))}catch(e){T.current&&i===E.current&&g(Z(e))}finally{k.current=!1,T.current&&(b(null),a&&(O.current=!0,f(!0),o(e=>e+1)))}},refresh:()=>{O.current=!0,f(!0),g(``),o(e=>e+1)}}}var he=(0,J.lazy)(()=>t(()=>import(`./TaskTerminalView-IR5bGXk7.js`).then(e=>({default:e.TaskTerminalView})),__vite__mapDeps([18,1,2,3,4,5,6,7,8,9,19,10,20,14,13,15,12,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37]))),ge=(0,J.lazy)(()=>t(()=>import(`./TaskProcessesPane-B6O5Mirv.js`).then(e=>({default:e.TaskProcessesPane})),__vite__mapDeps([38,1,2,3,4,5,6,7,8,9,39,10,19,20,40,25,15,29,34,12,13,14,21,22,23,24,26,27,28,30,31,32,33,35,36]))),_e=(0,J.lazy)(()=>t(()=>import(`./FileAttachmentPreview-DCdc0GFC.js`).then(e=>e.n).then(e=>({default:e.FileAttachmentPreview})),__vite__mapDeps([41,1,2,3,4,5,6,7,8,9,42,43,44,45,46,47,10,48,49,11,50,13,29,15,31,51,12,14,52,53,54,32,55,56,57,58,59,25,60,61])));function Q({sources:e,view:t,onViewChange:n}){let{t:r}=i(),a=h(t.reading?.list,e=>n({reading:{...t.reading,list:e}})),o=(0,J.useContext)(y),[s,c]=(0,J.useState)(``),l=(0,J.useRef)(null),u=e.find(e=>e.id===s),d=e.filter(e=>(!t.filter||e.kind===t.filter)&&e.name.toLocaleLowerCase().includes(t.query.toLocaleLowerCase()));return(0,Y.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,"aria-label":r(`chat:workbench.sources`),children:[(0,Y.jsxs)(`header`,{className:`flex min-h-10 min-w-0 shrink-0 items-center gap-2 border-b border-stroke-soft pr-1.5 pl-3`,children:[(0,Y.jsxs)(`h2`,{className:`min-w-0 flex-1 truncate text-xs font-medium tracking-[.02em] text-content-muted`,children:[r(`chat:workbench.sources`),(0,Y.jsx)(`span`,{className:`ml-1.5 tabular-nums`,children:e.length})]}),(0,Y.jsx)(`span`,{className:`shrink-0 text-xs text-content-muted`,children:r(`chat:workbench.addSource`)}),(0,Y.jsx)(`div`,{ref:o?.setSourceActionHost,className:`grid min-h-7 min-w-7 place-items-center`})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2 border-b border-stroke-soft px-3 py-2.5`,children:[(0,Y.jsx)(`p`,{className:`text-xs leading-relaxed text-content-muted`,children:r(`chat:workbench.sourcesScope`)}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 gap-2`,children:[(0,Y.jsx)(L,{className:`min-w-0 flex-1`,"aria-label":r(`chat:workbench.searchSources`),placeholder:r(`chat:workbench.searchSources`),value:t.query,onChange:e=>n({query:e.target.value})}),(0,Y.jsxs)(re,{"aria-label":r(`chat:workbench.sourceType`),className:`w-auto max-w-[45%] shrink-0`,value:t.filter,onChange:e=>n({filter:e.target.value}),children:[(0,Y.jsx)(`option`,{value:``,children:r(`chat:workbench.allTypes`)}),(0,Y.jsx)(`option`,{value:`image`,children:r(`chat:workbench.images`)}),(0,Y.jsx)(`option`,{value:`text`,children:r(`chat:workbench.text`)}),(0,Y.jsx)(`option`,{value:`file`,children:r(`chat:workbench.files`)})]})]})]}),(0,Y.jsxs)(`div`,{ref:a.ref,className:`min-h-0 flex-1 overflow-y-auto`,children:[!d.length&&(0,Y.jsx)(z,{compact:!0,title:e.length?r(`chat:workbench.noMatches`):r(`chat:workbench.noSources`)}),d.map(e=>{let i=t.selectedSourceId===e.id,a=e.kind===`image`?E:e.method===`path`?D:g;return(0,Y.jsxs)(`article`,{className:`border-b border-stroke-soft`,children:[(0,Y.jsxs)(`button`,{className:`flex min-h-9 w-full min-w-0 items-center gap-2 px-2 text-left hover:bg-surface-subtle focus-visible:-outline-offset-2 max-[650px]:min-h-11 pointer-coarse:min-h-11 ${i?`bg-surface-subtle`:``}`,"aria-expanded":i,onClick:()=>n({selectedSourceId:i?``:e.id}),children:[(0,Y.jsx)(f,{size:14,className:`shrink-0 text-content-muted transition-transform duration-(--d-fast) ${i?`rotate-90`:``}`}),(0,Y.jsx)(a,{className:`size-3.5 shrink-0 text-content-muted`}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs`,children:e.name||r(`chat:chatMessage.fileAttachment`)})]}),i&&(0,Y.jsxs)(`div`,{className:`space-y-1.5 border-t border-stroke-soft bg-code py-2.5 pr-3 pl-8 text-xs text-content-muted`,children:[(0,Y.jsx)(`p`,{className:`break-all font-mono text-content-secondary`,children:e.attachment.path||e.attachment.id||r(`chat:workbench.unavailable`)}),(0,Y.jsx)(`p`,{className:`font-mono`,children:e.attachment.mimeType||`application/octet-stream`}),(0,Y.jsx)(`p`,{children:e.method===`asset`?r(`chat:workbench.registeredAsset`):e.method===`path`?r(`chat:workbench.pathReference`):r(`chat:workbench.invalidReference`)}),(0,Y.jsx)(P,{variant:`secondary`,size:`sm`,className:`mt-1`,disabled:!e.available,onClick:t=>{l.current=t.currentTarget,c(e.id)},children:r(`chat:chatMessage.fileActionPreview`)})]})]},e.id)})]}),u&&(0,Y.jsx)(J.Suspense,{fallback:null,children:(0,Y.jsx)(_e,{attachment:u.attachment,onClose:()=>c(``),onRestoreFocus:()=>l.current?.focus(),onDownload:()=>{typeof u.attachment.downloadUrl==`string`&&window.open(u.attachment.downloadUrl,`_blank`,`noopener,noreferrer`)}})})]})}function ve({parentId:e,active:t}){let{t:n}=i(),{entry:r,runtime:a,load:o,setDraft:s}=C(e),c=r.session?.id??``,u=(0,J.useMemo)(()=>e=>a.subscribeSessionState(c,e),[a,c]),d=(0,J.useMemo)(()=>()=>a.getSessionState(c),[a,c]),f=(0,J.useSyncExternalStore)(u,d),[p,m]=(0,J.useState)(!1),[h,g]=(0,J.useState)(!1),[_,y]=(0,J.useState)(``),x=(0,J.useRef)(!1),T=(0,J.useRef)(!1),E=(0,J.useRef)(r.draft);E.current=r.draft;let D=(0,J.useRef)(null),O=te(e=>e.bindings),A=b(f,r.session);(0,J.useEffect)(()=>{t&&o(e)},[t,o,e]);let j=async t=>{t.preventDefault();let n=E.current.trim();if(!(!n||x.current||A||r.expired)){x.current=!0,m(!0),y(``);try{let t=await o(e,!r.session);if(!t?.session)return;let i=t.session.id;if(a.getSessionState(i).streaming)return;E.current.trim()===n&&s(e,``),m(!1),await a.send(i,n),await o(e)}catch(e){y(B(e))}finally{x.current=!1,m(!1)}}},M=(0,J.useCallback)(async()=>{if(!(!c||a.getSessionState(c).streaming)){y(``);try{await a.retry(c),await o(e)}catch(e){y(B(e))}}},[o,e,a,c]),I=async()=>{if(!(!c||h)){g(!0);try{y(``),await a.abort(c)}catch(e){y(B(e))}finally{g(!1)}}},L=(0,Y.jsxs)(`div`,{className:`grid h-full min-h-36 place-content-center justify-items-center gap-2 px-3 text-center text-xs text-content-muted`,children:[(0,Y.jsx)(`span`,{className:`mb-1 grid size-8 place-items-center rounded-md bg-key text-content-secondary shadow-key ring-1 ring-key-border`,children:(0,Y.jsx)(k,{className:`size-4`,"aria-hidden":`true`})}),(0,Y.jsx)(`p`,{className:`max-w-64 leading-relaxed`,children:r.expired?n(`chat:sideChat.expired`):n(`chat:sideChat.empty`)}),r.expired&&(0,Y.jsxs)(P,{variant:`secondary`,size:`sm`,className:`mt-1`,disabled:r.loading,onClick:async()=>{(await o(e,!0))?.session&&D.current?.focus()},children:[r.loading&&(0,Y.jsx)(N,{className:`size-3.5 text-current`}),n(`chat:sideChat.restart`)]})]}),R=_||r.error||f.error;return(0,Y.jsxs)(`section`,{"data-side-chat-parent":e,"aria-label":n(`chat:sideChat.title`),className:`flex h-full min-h-0 min-w-0 flex-1 flex-col [container-type:inline-size]`,children:[(0,Y.jsx)(`p`,{className:`shrink-0 border-b border-stroke-soft px-3 py-2 text-xs leading-relaxed text-content-muted`,children:n(`chat:sideChat.retention`)}),c?(0,Y.jsx)(S,{sessionId:c,messages:f.messages,transcriptLoadState:f.loaded?`ready`:f.error?`error`:`loading`,emptyState:L,messageStart:f.messageStart,hasOlder:f.hasOlder,loadingOlder:f.loadingOlder,olderError:f.olderError,activityFeed:f.activityFeed,tools:f.tools,thinkingText:f.thinkingText,currentActivity:f.currentActivity,compaction:f.compaction,streaming:A,runStartedAt:f.runStartedAt,lastActivityAt:f.lastActivityAt,runFinishedAt:f.runFinishedAt,runStopped:f.runStopped,runNotice:f.runNotice,error:f.error,cwd:r.session?.cwd,onLoadOlder:()=>a.loadOlderMessages(c),onRetryLastTurn:M}):(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:L}),(0,Y.jsxs)(`form`,{className:`flex shrink-0 flex-col gap-2 border-t border-stroke-soft p-3`,onSubmit:j,children:[R&&(0,Y.jsx)(w,{error:R,onRetry:r.error||!f.loaded?async()=>{await o(e)}:M}),(0,Y.jsx)(v,{approvals:f.approvals,onResolve:async(e,t)=>{try{await a.approve(c,e,t)}catch{}}}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-end gap-2 rounded-[var(--composer-radius,22px)] border border-control bg-panel py-2 pr-2 pl-3 shadow-composer transition-[border-color,box-shadow] duration-(--d-fast) focus-within:border-focus focus-within:ring-3 focus-within:ring-focus-ring`,children:[(0,Y.jsx)(`textarea`,{ref:D,rows:2,value:r.draft,"aria-label":n(`chat:sideChat.message`),placeholder:n(`chat:sideChat.placeholder`),className:`max-h-40 min-h-14 min-w-0 flex-1 resize-y border-0 bg-transparent px-1 py-1 text-sm leading-relaxed text-content caret-focus outline-none placeholder:text-content-muted`,onChange:t=>s(e,t.target.value),onCompositionStart:()=>{T.current=!0},onCompositionEnd:()=>{T.current=!1},onKeyDown:e=>{!T.current&&!e.nativeEvent.isComposing&&e.nativeEvent.keyCode!==229&&F(e.nativeEvent,O.sendMessage)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())}}),(0,Y.jsx)(P,{type:A?`button`:`submit`,size:`icon`,className:`size-8 shrink-0 rounded-full max-[650px]:size-11 pointer-coarse:size-11`,"aria-label":n(A?`chat:sideChat.stop`:`chat:sideChat.send`),disabled:A?h:p||r.loading||r.expired||!r.draft.trim(),onClick:A?()=>void I():void 0,children:p||h?(0,Y.jsx)(N,{className:`size-4 text-current`}):A?(0,Y.jsx)(ee,{size:13,fill:`currentColor`}):(0,Y.jsx)(l,{size:17})})]})]})]})}var $=(0,J.createContext)(null),ye=()=>{let e=(0,J.useContext)($);if(!e)throw Error(`WebPreview components must be used within a WebPreview`);return e},be=({className:e,children:t,defaultUrl:n=``,onUrlChange:r,...i})=>{let[a,o]=(0,J.useState)(n),[s,c]=(0,J.useState)(!1),l=(0,J.useCallback)(e=>{o(e),r?.(e)},[r]),u=(0,J.useMemo)(()=>({consoleOpen:s,setConsoleOpen:c,setUrl:l,url:a}),[s,l,a]);return(0,Y.jsx)($.Provider,{value:u,children:(0,Y.jsx)(`div`,{className:M(`flex size-full min-h-0 flex-col rounded-lg border bg-card`,e),...i,children:t})})},xe=({className:e,loading:t,src:n,...r})=>{let{url:i}=ye();return(0,Y.jsxs)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden bg-background`,children:[(0,Y.jsx)(`iframe`,{className:M(`block size-full border-0 bg-background`,e),loading:`lazy`,sandbox:`allow-scripts allow-same-origin allow-forms allow-popups allow-presentation`,src:(n??i)||void 0,title:`Preview`,...r}),t]})};function Se({sessionId:e,page:t,onChange:n,onClosed:r}){let{t:a}=i(),{draft:o,url:l}=t,[u,d]=(0,J.useState)(!1),f=U({enabled:!!window.pisperDesktop?.browser,url:l,popupId:t.resourceId,keepAlive:t.agent,onNavigated:e=>{e!==l&&n(o===l?{url:e,draft:e}:{url:e})},onTitle:e=>n({title:e}),onNewWindow:(t,n)=>ie(e,t,n),onClosed:r});return(0,Y.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col gap-2 p-3`,"aria-label":a(`common:webPreview.title`),children:[(0,Y.jsxs)(`form`,{className:`flex gap-2`,onSubmit:e=>{e.preventDefault();let t=V(o,window.location.href);d(!t),t&&n({url:t})},children:[f.active&&(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center`,children:[(0,Y.jsx)(P,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":a(`common:webPreview.back`),title:a(`common:webPreview.back`),onClick:()=>f.act(`back`),children:(0,Y.jsx)(s,{size:14})}),(0,Y.jsx)(P,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":a(`common:webPreview.forward`),title:a(`common:webPreview.forward`),onClick:()=>f.act(`forward`),children:(0,Y.jsx)(c,{size:14})}),(0,Y.jsx)(P,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":a(`common:webPreview.reload`),title:a(`common:webPreview.reload`),"aria-busy":f.loading,onClick:()=>f.act(`reload`),children:f.loading?(0,Y.jsx)(O,{size:14,className:`animate-spin`}):(0,Y.jsx)(q,{size:14})})]}),(0,Y.jsx)(L,{"aria-label":a(`common:webPreview.url`),className:`flex-1 font-mono`,value:o,onChange:e=>n({draft:e.target.value}),placeholder:a(`common:webPreview.urlPlaceholder`),maxLength:2048}),(0,Y.jsx)(P,{type:`submit`,variant:`secondary`,children:a(`chat:sessionContext.openUrl`)})]}),u&&(0,Y.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:a(`chat:sessionContext.invalidUrl`)}),f.active?(0,Y.jsx)(`div`,{ref:f.slotRef,role:`group`,"aria-label":a(`common:webPreview.title`),"aria-busy":f.loading,"data-native-browser-slot":!0,className:`min-h-0 flex-1 overflow-hidden rounded-md border border-stroke bg-background`}):l?(0,Y.jsx)(be,{className:`min-h-0 flex-1 overflow-hidden rounded-md border-stroke`,defaultUrl:l,children:(0,Y.jsx)(xe,{src:l,title:a(`common:webPreview.title`),...ae(l)?{sandbox:H}:{}})},l):(0,Y.jsx)(z,{icon:p,className:`min-h-0 flex-1`,title:a(`chat:sessionContext.browserEmpty`)}),l&&(0,Y.jsxs)(P,{type:`button`,variant:`ghost`,size:`sm`,className:`self-start`,onClick:()=>window.open(l,`_blank`,`noopener,noreferrer`),children:[(0,Y.jsx)(m,{size:14}),a(`common:webPreview.openExternal`)]}),!f.active&&(0,Y.jsx)(`p`,{className:`text-xs text-content-muted`,children:a(`common:webPreview.embedNotice`)})]})}export{he as a,X as c,ge as i,de as l,ve as n,me as o,Q as r,pe as s,Se as t};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/GitDiffViewer-Dc46yAUc.js","assets/rolldown-runtime-B0Z9INg1.js","assets/vendor-react-DwNgTV1j.js","assets/use-i18n-D6tl7SDi.js","assets/i18n-Zs9wBTpa.js","assets/vendor-router-CSN_DGvx.js","assets/index-BpFQSLJJ.js","assets/index-BnQCk-QI.css","assets/storage-DtvZ_lEu.js","assets/vendor-state-GkUciC5H.js","assets/createLucideIcon-Cd-3GVxJ.js","assets/x-07u4-129.js","assets/utils-C8uzG5AZ.js","assets/vendor-ui-DvrYggeS.js","assets/button-CCcCN8tE.js","assets/dist-41X0pdUs.js","assets/events-S66w92oA.js","assets/esm-DCV8yILT.js","assets/TaskTerminalView-B3uXJaXz.js","assets/square-terminal-BVG6cUT1.js","assets/square-bHHVTT3G.js","assets/PageState-Cz6vFMXv.js","assets/AppSelect-DQYKUW5E.js","assets/use-mobile-C2tPBAza.js","assets/select-Bbk9bmXO.js","assets/check-2vYc6QaP.js","assets/chevron-down-CxtxIjiP.js","assets/chevron-up-D_ZcXjqr.js","assets/chevrons-up-down-C2sEPdAh.js","assets/dist-BsRXXcSL.js","assets/dist-BiRPwy4W.js","assets/dist-DzGQ7sLi.js","assets/es2015-DTZdOI9P.js","assets/dist-BRjj4UeB.js","assets/dist-OB2r6Xsr.js","assets/dist-BS3ekNDj.js","assets/terminal-context-aIsIJPn8.js","assets/TaskTerminalView-BrP-ENHg.css","assets/TaskProcessesPane-CepFj3M9.js","assets/chevron-right-C3t2Rckj.js","assets/checkbox-BrEHgFV0.js","assets/FileAttachmentPreview-1U8-b6EF.js","assets/api-CHqbIMkc.js","assets/abort-signal-f4JsiYKX.js","assets/http-response-C_f1S2cS.js","assets/event-stream-CJDJ_f9g.js","assets/http-Clt0jbV2.js","assets/download-BCfIiuaL.js","assets/file-Bllajneu.js","assets/refresh-cw-TbWxTY4K.js","assets/tabs-DsgBuvJv.js","assets/dist-BaBySQmo.js","assets/format-DMJQzoZ7.js","assets/dialog-C_ew2HiI.js","assets/dist-BHkR6BLP.js","assets/MarkdownMessage-BYQ5qUjo.js","assets/vendor-markdown-plugins-CT5L3KA9.js","assets/vendor-shiki-runtime-DM7fm4Bl.js","assets/vendor-markdown-plugins-DEcVZfaU.css","assets/vendor-markdown-CT6Z4fh8.js","assets/copy-DHmIFc52.js","assets/route-context-DvWDul4T.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{h as t}from"./vendor-router-CSN_DGvx.js";import{i as n,r}from"./vendor-react-DwNgTV1j.js";import{t as i}from"./use-i18n-D6tl7SDi.js";import{t as a}from"./useQuery-DfOU-27z.js";import{t as o}from"./createLucideIcon-Cd-3GVxJ.js";import{t as s}from"./arrow-left-B8oVrQ2S.js";import{t as c}from"./arrow-right-DqLOhpA2.js";import{t as l}from"./arrow-up-DST6-qVQ.js";import{t as u}from"./check-2vYc6QaP.js";import{t as d}from"./chevron-down-CxtxIjiP.js";import{t as f}from"./chevron-right-C3t2Rckj.js";import{t as p}from"./earth-Ddy13fHh.js";import{t as m}from"./external-link-CEQqPcqc.js";import{i as h}from"./GitDiffViewer-Dc46yAUc.js";import{t as g}from"./file-Bllajneu.js";import{E as _,a as v,h as y,i as b,m as x,o as S,r as C,u as w}from"./side-chat-context-BXN0j7F9.js";import{t as T}from"./git-branch-N7LGjtzt.js";import{t as E}from"./image-BY_c3FYU.js";import{t as D}from"./link-2-mgasYn21.js";import{t as O}from"./loader-circle-BOwQzHB-.js";import{t as k}from"./message-square-SKjZyY3v.js";import{t as A}from"./pause-CYWpPg1R.js";import{t as j}from"./refresh-cw-TbWxTY4K.js";import{t as ee}from"./square-bHHVTT3G.js";import"./tooltip-D4MFbqcG.js";import{t as M}from"./utils-C8uzG5AZ.js";import{n as N,t as P}from"./button-CCcCN8tE.js";import{c as te,r as F}from"./shortcuts-1-ySiY-G.js";import{t as I}from"./chat-api-H18lBlnu.js";import{t as L}from"./input-CPw-zkYh.js";import{n as R}from"./session-change-summary-api-BbviMo7L.js";import{n as ne,t as z}from"./PageState-Cz6vFMXv.js";import{t as re}from"./AppSelect-DQYKUW5E.js";import{t as ie}from"./session-web-preview-guvsmkWE.js";import"./collapsible-Dcoy-qnz.js";import{o as B}from"./session-tree-summary-DZk4xiEt.js";import{n as ae,r as V,t as H}from"./web-preview-C7DdG9JP.js";import{n as U}from"./useNativeBrowser-C0j3zafh.js";var W=o(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),G=o(`list-checks`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]),K=o(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),q=o(`rotate-cw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]),J=e(n(),1),Y=r(),oe={completed:`completed`,in_progress:`running`,paused:`pending`,blocked:`blocked`,pending:`pending`};function se(e){let t=new Map(e.map(e=>[String(e.id||``),e])),n=e=>e?.status===`completed`;return e.map(e=>{let r=String(e.id||``),i=(Array.isArray(e.dependsOn)?e.dependsOn:[]).map(e=>t.get(String(e))).filter(e=>!!e&&!n(e)),a=e.status!==`completed`&&(e.status===`blocked`||i.length>0);return{...e,id:r,blocked:a,blockedBy:i}})}function ce({status:e,t}){let n=t(e===`completed`?`chat:planBoard.completed`:e===`in_progress`?`chat:planBoard.inProgress`:e===`paused`?`chat:planBoard.paused`:e===`blocked`?`chat:planBoard.blocked`:`chat:planBoard.pending`);return(0,Y.jsxs)(`span`,{className:`plan-board-status grid size-[18px] flex-none place-items-center rounded-xs text-content-muted [&.completed]:bg-success-soft [&.completed]:text-success [&.running]:text-accent-fg [&.blocked]:bg-danger-soft [&.blocked]:text-danger ${oe[String(e)]||`pending`}`,title:n,children:[e===`completed`?(0,Y.jsx)(u,{size:12,strokeWidth:2.25}):e===`in_progress`?(0,Y.jsx)(N,{className:`size-3.5`}):e===`paused`?(0,Y.jsx)(A,{size:11,strokeWidth:2}):e===`blocked`?(0,Y.jsx)(K,{size:11,strokeWidth:2}):(0,Y.jsx)(W,{size:11,strokeWidth:2}),(0,Y.jsx)(`span`,{className:`sr-only`,children:n})]})}function le({item:e,current:t,running:n,t:r}){return(0,Y.jsxs)(`li`,{className:`plan-board-row flex min-w-0 flex-col gap-[2px] rounded-sm px-[6px] py-[6px] aria-[current=step]:bg-surface-subtle ${e.blocked?`blocked`:``}`,"aria-current":t?`step`:void 0,"data-pisper-plan-current":t?`true`:void 0,"data-pisper-plan-id":e.id,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-[10px]`,children:[(0,Y.jsx)(ce,{status:e.blocked?`blocked`:e.status===`in_progress`&&!n?`paused`:e.status,t:r}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] ${e.status===`completed`?`text-content-muted`:`text-foreground`}`,title:e.title,children:e.title}),e.assignee?(0,Y.jsxs)(`span`,{className:`inline-flex max-w-[40%] flex-none items-center gap-[4px] truncate rounded-xs border border-stroke px-[6px] font-mono text-[12px] leading-[18px] text-content-secondary`,title:r(`chat:planBoard.assignedTo`,{name:e.assignee}),children:[(0,Y.jsx)(_,{size:11,className:`flex-none`}),e.assignee]}):e.status!==`completed`&&(0,Y.jsx)(`span`,{className:`flex-none text-[12px] text-content-muted`,children:r(`chat:planBoard.unassigned`)})]}),e.blockedBy.length>0&&(0,Y.jsxs)(`div`,{className:`inline-flex min-w-0 items-center gap-[5px] pl-[28px] text-[12px] text-content-muted`,children:[(0,Y.jsx)(K,{size:11,className:`flex-none`}),(0,Y.jsx)(`span`,{className:`truncate`,children:r(`chat:planBoard.waitingFor`,{tasks:e.blockedBy.map(e=>e.title||e.id).join(` · `)})})]})]})}function ue({plan:e,running:t,header:n,collapsible:r=!1}){let{t:a}=i(),o=(0,J.useRef)(null),[s,c]=(0,J.useState)(!0),l=e?.items||[],u=se(l),f=u.filter(e=>e.status===`completed`).length,p=u.filter(e=>e.status===`in_progress`&&!e.blocked).length,m=u.filter(e=>e.blocked).length,h=u.find(e=>e.status===`in_progress`&&!e.blocked)?.id??u.find(e=>e.blocked)?.id??u.find(e=>e.status===`pending`)?.id??u.at(-1)?.id;if((0,J.useLayoutEffect)(()=>{if(r&&!s)return;let e=o.current,t=e?.querySelector(`[data-pisper-plan-current="true"]`);if(!e||!t)return;let n=e.getBoundingClientRect(),i=t.getBoundingClientRect();i.top<n.top?e.scrollTop-=n.top-i.top:i.bottom>n.bottom&&(e.scrollTop+=i.bottom-n.bottom)},[r,h,s,u.length]),!l.length)return null;let g=u.find(e=>e.id===h),_=(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(G,{className:`flex-none text-content-muted`,size:15}),(0,Y.jsx)(`strong`,{className:`tabular-nums`,children:a(`chat:planBoard.progress`,{completed:f,total:l.length})}),g?(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-content-secondary`,title:g.title,children:g.title}):null,(0,Y.jsxs)(`span`,{className:`plan-board-counts inline-flex flex-none items-center gap-[8px] text-content-muted tabular-nums @max-[470px]:hidden`,children:[p>0&&(0,Y.jsx)(`span`,{children:a(t?`chat:planBoard.countInProgress`:`chat:planBoard.countPaused`,{count:p})}),m>0&&(0,Y.jsx)(`span`,{className:`blocked text-danger`,children:a(`chat:planBoard.countBlocked`,{count:m})})]}),n,r?(0,Y.jsx)(d,{className:`plan-board-chevron flex-none text-content-muted transition-transform duration-(--d-fast) ease-precise [.plan-board-collapsible[open]_&]:rotate-180`,size:15}):null]}),v=(0,Y.jsx)(`ul`,{ref:o,className:`plan-board-list [.plan-board-collapsible_>_&]:border-t [.plan-board-collapsible_>_&]:border-stroke-soft [.plan-board-collapsible_>_&]:p-[6px_8px_8px] m-0 flex list-none flex-col gap-[1px] pt-[6px]${u.length>4?` is-scrollable [.session-plan-popover_.plan-board-list&]:[block-size:min(250px,38dvh)] [.plan-board-list&]:[block-size:min(220px,34dvh)] [.plan-board-list&]:overflow-y-auto [.plan-board-list&]:[overscroll-behavior:contain] [.plan-board-list&]:pr-[4px] [.plan-board-list&]:[scrollbar-gutter:stable] [.plan-board-list&:focus-visible]:outline-2 [.plan-board-list&:focus-visible]:outline-focus [.plan-board-list&:focus-visible]:outline-offset-2`:``}`,tabIndex:u.length>4?0:void 0,children:u.map(e=>(0,Y.jsx)(le,{running:t,item:e,current:e.id===h,t:a},e.id))});return r?(0,Y.jsxs)(`details`,{className:`plan-board plan-board-collapsible m-[0_auto] flex w-[min(900px,100%)] flex-col overflow-hidden rounded-md border border-stroke bg-panel !p-0 [.session-plan-popover_&]:w-full [.session-plan-popover_&]:border-0 [.session-plan-popover_&]:bg-transparent`,open:s,onToggle:e=>c(e.currentTarget.open),children:[(0,Y.jsx)(`summary`,{className:`plan-board-summary flex min-w-0 items-center gap-[8px] border-b border-stroke-soft pb-[8px] text-[13px] text-content-secondary [&_strong]:flex-none [&_strong]:font-medium [&_strong]:text-foreground [.plan-board-collapsible_>_&]:min-h-[34px] [.plan-board-collapsible_>_&]:cursor-pointer [.plan-board-collapsible_>_&]:list-none [.plan-board-collapsible_>_&]:border-0 [.plan-board-collapsible_>_&]:p-[6px_12px] max-[650px]:[.plan-board-collapsible_>_&]:min-h-11 [.plan-board-collapsible_>_&::-webkit-details-marker]:hidden [.plan-board-collapsible_>_&:hover]:bg-surface-subtle [.plan-board-collapsible_>_&:focus-visible]:outline-2 [.plan-board-collapsible_>_&:focus-visible]:-outline-offset-2 [.plan-board-collapsible_>_&:focus-visible]:outline-focus`,"aria-label":a(`chat:planBoard.toggleAriaLabel`),children:_}),v]}):(0,Y.jsxs)(`section`,{className:`plan-board m-[0_auto] flex w-[min(900px,100%)] flex-col rounded-md border border-stroke bg-panel p-[10px_12px] [.session-plan-popover_&]:w-full [.session-plan-popover_&]:border-0 [.session-plan-popover_&]:bg-transparent [.session-plan-popover_&]:p-0`,"aria-label":a(`chat:planBoard.ariaLabel`),children:[(0,Y.jsx)(`div`,{className:`plan-board-summary flex min-w-0 items-center gap-[8px] border-b border-stroke-soft pb-[8px] text-[13px] text-content-secondary [&_strong]:flex-none [&_strong]:font-medium [&_strong]:text-foreground [.plan-board-collapsible_>_&]:min-h-[34px] [.plan-board-collapsible_>_&]:cursor-pointer [.plan-board-collapsible_>_&]:list-none [.plan-board-collapsible_>_&]:border-0 [.plan-board-collapsible_>_&]:p-[6px_12px] max-[650px]:[.plan-board-collapsible_>_&]:min-h-11 [.plan-board-collapsible_>_&::-webkit-details-marker]:hidden [.plan-board-collapsible_>_&:hover]:bg-surface-subtle [.plan-board-collapsible_>_&:focus-visible]:outline-2 [.plan-board-collapsible_>_&:focus-visible]:-outline-offset-2 [.plan-board-collapsible_>_&:focus-visible]:outline-focus`,children:_}),v]})}var de=(0,J.memo)(ue),fe=(0,J.lazy)(()=>t(()=>import(`./GitDiffViewer-Dc46yAUc.js`).then(e=>e.n).then(e=>({default:e.InlineGitDiff})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17])));function X({sessionId:e,path:t,scope:n,revision:r=0,position:o,onReading:s,mode:c,fill:l=!1}){let{t:u}=i(),d=a({queryKey:[`task-file-diff`,e,n,t,r],queryFn:({signal:r})=>n===`project`?I.getFileDiff(e,t,{signal:r}):I.getSessionFileChangeDiff(e,t,{signal:r})});return d.isPending?(0,Y.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 px-3 py-2.5 text-xs text-content-muted`,children:[(0,Y.jsx)(N,{className:`size-3.5`}),u(`chat:focusSession.gitLoading`)]}):d.isError?(0,Y.jsxs)(`div`,{className:`px-3 py-2.5`,children:[(0,Y.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:d.error.message}),(0,Y.jsx)(P,{variant:`ghost`,size:`sm`,onClick:()=>void d.refetch(),children:u(`chat:chatMessage.filePreviewRetry`)})]}):(0,Y.jsx)(J.Suspense,{fallback:null,children:(0,Y.jsx)(fe,{position:o,onReading:s,diff:d.data.diff,truncated:d.data.diffTruncated,mode:c,fill:l})})}function pe({sessionId:e,cwd:t,streaming:n,view:r,onViewChange:o}){let{t:s}=i(),c=a({queryKey:[`task-project-changes`,e,t,n],queryFn:({signal:t})=>I.getVcsChanges(e,{signal:t})}),l=h(r.reading?.list,e=>o({reading:{...r.reading,list:e}})),u=(0,J.useMemo)(()=>x(c.data?.diff||``,c.data?.files.map(e=>e.path)||[],c.data?.diffTruncated),[c.data]),d=r.expandedFiles.filter(e=>c.data&&!c.data.files.some(t=>t.path===e)),p=c.error?.message||c.data?.error,m=c.data?.files||[];return(0,Y.jsxs)(`section`,{"aria-label":s(`chat:workbench.projectChanges`),className:`flex min-h-0 flex-1 flex-col`,children:[(0,Y.jsxs)(`header`,{className:`flex min-h-10 min-w-0 shrink-0 items-center gap-2 border-b border-stroke-soft pr-1.5 pl-3`,children:[(0,Y.jsx)(`h2`,{className:`min-w-0 flex-1 truncate text-xs font-medium tracking-[.02em] text-content-muted`,children:s(`chat:workbench.projectChanges`)}),c.data?.isRepo&&!p&&(0,Y.jsxs)(`span`,{className:`shrink-0 font-mono text-xs tabular-nums`,children:[(0,Y.jsxs)(`span`,{className:`text-success`,children:[`+`,u.added]}),` `,(0,Y.jsxs)(`span`,{className:`text-danger`,children:[`−`,u.removed]})]}),(0,Y.jsx)(P,{variant:`ghost`,size:`icon`,className:`max-[650px]:size-11`,"aria-label":s(`chat:focusSession.gitRefresh`),disabled:c.isFetching,onClick:()=>void c.refetch(),children:(0,Y.jsx)(j,{size:15,className:c.isFetching?`animate-spin`:void 0})})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2 border-b border-stroke-soft px-3 py-2.5`,children:[(0,Y.jsx)(`p`,{className:`text-xs leading-relaxed text-content-muted`,children:s(`chat:workbench.projectScope`)}),(0,Y.jsxs)(`p`,{className:`flex min-w-0 items-center gap-1.5 text-xs`,title:t,children:[c.data?.branch&&(0,Y.jsxs)(`span`,{className:`inline-flex h-5.5 max-w-[45%] shrink-0 items-center gap-1 rounded-xs border border-stroke px-1.5 font-mono text-content-secondary`,children:[(0,Y.jsx)(T,{size:12,className:`shrink-0`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`truncate`,children:c.data.branch})]}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate font-mono text-content-muted`,children:t})]}),(0,Y.jsxs)(`div`,{className:`flex gap-1`,children:[(0,Y.jsx)(P,{variant:`ghost`,size:`sm`,disabled:!m.length||!!p,onClick:()=>o({expandedFiles:m.map(e=>e.path)}),children:s(`chat:workbench.expandAll`)}),(0,Y.jsx)(P,{variant:`ghost`,size:`sm`,onClick:()=>o({expandedFiles:[]}),children:s(`chat:workbench.collapseAll`)})]})]}),!c.isFetching&&!p&&d.map(e=>(0,Y.jsx)(`p`,{role:`status`,className:`break-all px-3 pt-2 text-xs text-content-muted`,children:s(`chat:workbench.fileNoLongerChanged`,{path:e})},e)),c.isPending?(0,Y.jsx)(ne,{kind:`loading`,title:s(`chat:focusSession.gitLoading`)}):p?(0,Y.jsx)(`p`,{role:`alert`,className:`p-3 text-sm text-danger`,children:p}):c.data?.isRepo?m.length?(0,Y.jsx)(`div`,{ref:l.ref,className:`min-h-0 flex-1 overflow-y-auto`,children:m.map(t=>{let n=r.expandedFiles.includes(t.path);return(0,Y.jsxs)(`article`,{className:`border-b border-stroke-soft`,children:[(0,Y.jsxs)(`button`,{"aria-expanded":n,title:t.path,className:`flex min-h-9 w-full min-w-0 items-center gap-2 pr-3 pl-2 text-left text-sm hover:bg-surface-subtle focus-visible:-outline-offset-2 max-[650px]:min-h-11 pointer-coarse:min-h-11 ${n?`bg-surface-subtle`:``}`,onClick:()=>o({expandedFiles:n?r.expandedFiles.filter(e=>e!==t.path):[...r.expandedFiles,t.path]}),children:[(0,Y.jsx)(f,{size:14,className:`shrink-0 text-content-muted transition-transform duration-(--d-fast) ${n?`rotate-90`:``}`}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs`,children:t.path}),(0,Y.jsx)(`span`,{className:`min-w-4 shrink-0 text-center font-mono text-xs font-medium text-content-secondary`,children:t.status}),Object.hasOwn(u.files,t.path)&&(0,Y.jsxs)(`span`,{className:`shrink-0 font-mono text-xs tabular-nums`,children:[(0,Y.jsxs)(`span`,{className:`text-success`,children:[`+`,u.files[t.path].added]}),` `,(0,Y.jsxs)(`span`,{className:`text-danger`,children:[`−`,u.files[t.path].removed]})]})]}),n&&(0,Y.jsx)(`p`,{className:`break-all px-3 py-1.5 font-mono text-xs text-content-muted`,children:t.path}),n&&(0,Y.jsx)(X,{sessionId:e,path:t.path,scope:`project`,position:r.reading?.[t.path],onReading:e=>o({reading:{...r.reading,[t.path]:e}}),revision:c.dataUpdatedAt})]},t.path)})}):(0,Y.jsx)(z,{compact:!0,title:s(`chat:focusSession.fileChangesEmpty`)}):(0,Y.jsx)(z,{compact:!0,title:s(`chat:workbench.notRepository`)})]})}function Z(e){return e instanceof Error?e.message:String(e)}function me({sessionId:e,streaming:t,requestConfirm:n}){let{t:r}=i(),[a,o]=(0,J.useState)(0),[s,c]=(0,J.useState)(0),[l,u]=(0,J.useState)(null),[d,f]=(0,J.useState)(!0),[p,m]=(0,J.useState)(``),[h,g]=(0,J.useState)(``),[_,v]=(0,J.useState)(``),[y,b]=(0,J.useState)(null),[x,S]=(0,J.useState)(null),[C,w]=(0,J.useState)(null),T=(0,J.useRef)(!1),E=(0,J.useRef)(0),D=(0,J.useRef)(0),O=(0,J.useRef)(!0),k=(0,J.useRef)(!1),A=(0,J.useRef)(t);return(0,J.useLayoutEffect)(()=>{A.current=t},[t]),(0,J.useLayoutEffect)(()=>(T.current=!0,()=>{T.current=!1,E.current+=1,D.current+=1}),[]),(0,J.useEffect)(()=>{let t=++E.current;return D.current+=1,S(null),w(null),O.current=!0,f(!0),m(``),I.getSessionFileChanges(e).then(e=>{T.current&&t===E.current&&(u(e),c(e=>e+1))},e=>{T.current&&t===E.current&&m(Z(e))}).finally(()=>{T.current&&t===E.current&&(O.current=!1,f(!1))}),()=>{E.current+=1}},[a,e,t]),{changes:l,loading:d,error:p,actionError:h,notice:_,running:y,diff:x,setDiff:S,diffLoading:C,snapshotRevision:s,writesDisabled:d||t||!!y||!!p||!l,pendingCount:l?.summary.pending||0,reversibleCount:l?.files.filter(e=>e.canRevert&&!e.reverted).length||0,displayedError:h||p,viewDiff:async t=>{if(k.current||O.current)return;let n=++D.current;w(t),g(``);try{let i=await I.getSessionFileChangeDiff(e,t);if(!T.current||n!==D.current)return;if(!i.diff?.trim()){g(r(`chat:focusSession.fileChangesNoSnapshot`));return}S({diff:i.diff,truncated:!!i.diffTruncated})}catch(e){T.current&&n===D.current&&g(Z(e))}finally{T.current&&n===D.current&&w(null)}},runAction:async t=>{if(!T.current||k.current||O.current||A.current||!l||p||!l.files.filter(e=>t.kind===`approve`?e.pending&&!e.approved&&!e.reverted:e.canRevert&&!e.reverted).some(e=>t.path===void 0||e.path===t.path))return;k.current=!0,b(t),g(``),v(``);let i=++E.current;D.current+=1,S(null),w(null);let a=!1;try{if(t.kind===`revert`&&!await n({title:t.path?r(`chat:focusSession.fileChangesRevertFile`):r(`chat:focusSession.fileChangesRevertAll`),message:t.path?r(`chat:focusSession.fileChangesRevertFileDescription`,{path:t.path}):r(`chat:focusSession.fileChangesRevertAllDescription`),confirmLabel:r(`chat:focusSession.fileChangesConfirmRevert`),tone:`danger`})||!T.current||A.current||O.current||i!==E.current)return;a=!0;let o=t.kind===`approve`?await I.approveSessionFileChanges(e,t.path):await I.revertSessionFileChanges(e,t.path);if(R(e),!T.current||i!==E.current)return;u(o),t.kind===`approve`?v(t.path?r(`chat:focusSession.fileChangesApproved`):r(`chat:focusSession.fileChangesApproveDone`)):o.reverted?t.path===void 0&&o.files.some(e=>e.pending)?v(r(`chat:focusSession.fileChangesRevertPartial`,{count:o.reverted})):v(r(`chat:focusSession.fileChangesRevertDone`)):v(r(`chat:focusSession.fileChangesRevertUnavailable`))}catch(e){T.current&&i===E.current&&g(Z(e))}finally{k.current=!1,T.current&&(b(null),a&&(O.current=!0,f(!0),o(e=>e+1)))}},refresh:()=>{O.current=!0,f(!0),g(``),o(e=>e+1)}}}var he=(0,J.lazy)(()=>t(()=>import(`./TaskTerminalView-B3uXJaXz.js`).then(e=>({default:e.TaskTerminalView})),__vite__mapDeps([18,1,2,3,4,5,6,7,8,9,19,10,20,14,13,15,12,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37]))),ge=(0,J.lazy)(()=>t(()=>import(`./TaskProcessesPane-CepFj3M9.js`).then(e=>({default:e.TaskProcessesPane})),__vite__mapDeps([38,1,2,3,4,5,6,7,8,9,39,10,19,20,40,25,15,29,34,12,13,14,21,22,23,24,26,27,28,30,31,32,33,35,36]))),_e=(0,J.lazy)(()=>t(()=>import(`./FileAttachmentPreview-1U8-b6EF.js`).then(e=>e.n).then(e=>({default:e.FileAttachmentPreview})),__vite__mapDeps([41,1,2,3,4,5,6,7,8,9,42,43,44,45,46,47,10,48,49,11,50,13,29,15,31,51,12,14,52,53,54,32,55,56,57,58,59,25,60,61])));function Q({sources:e,view:t,onViewChange:n}){let{t:r}=i(),a=h(t.reading?.list,e=>n({reading:{...t.reading,list:e}})),o=(0,J.useContext)(y),[s,c]=(0,J.useState)(``),l=(0,J.useRef)(null),u=e.find(e=>e.id===s),d=e.filter(e=>(!t.filter||e.kind===t.filter)&&e.name.toLocaleLowerCase().includes(t.query.toLocaleLowerCase()));return(0,Y.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,"aria-label":r(`chat:workbench.sources`),children:[(0,Y.jsxs)(`header`,{className:`flex min-h-10 min-w-0 shrink-0 items-center gap-2 border-b border-stroke-soft pr-1.5 pl-3`,children:[(0,Y.jsxs)(`h2`,{className:`min-w-0 flex-1 truncate text-xs font-medium tracking-[.02em] text-content-muted`,children:[r(`chat:workbench.sources`),(0,Y.jsx)(`span`,{className:`ml-1.5 tabular-nums`,children:e.length})]}),(0,Y.jsx)(`span`,{className:`shrink-0 text-xs text-content-muted`,children:r(`chat:workbench.addSource`)}),(0,Y.jsx)(`div`,{ref:o?.setSourceActionHost,className:`grid min-h-7 min-w-7 place-items-center`})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2 border-b border-stroke-soft px-3 py-2.5`,children:[(0,Y.jsx)(`p`,{className:`text-xs leading-relaxed text-content-muted`,children:r(`chat:workbench.sourcesScope`)}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 gap-2`,children:[(0,Y.jsx)(L,{className:`min-w-0 flex-1`,"aria-label":r(`chat:workbench.searchSources`),placeholder:r(`chat:workbench.searchSources`),value:t.query,onChange:e=>n({query:e.target.value})}),(0,Y.jsxs)(re,{"aria-label":r(`chat:workbench.sourceType`),className:`w-auto max-w-[45%] shrink-0`,value:t.filter,onChange:e=>n({filter:e.target.value}),children:[(0,Y.jsx)(`option`,{value:``,children:r(`chat:workbench.allTypes`)}),(0,Y.jsx)(`option`,{value:`image`,children:r(`chat:workbench.images`)}),(0,Y.jsx)(`option`,{value:`text`,children:r(`chat:workbench.text`)}),(0,Y.jsx)(`option`,{value:`file`,children:r(`chat:workbench.files`)})]})]})]}),(0,Y.jsxs)(`div`,{ref:a.ref,className:`min-h-0 flex-1 overflow-y-auto`,children:[!d.length&&(0,Y.jsx)(z,{compact:!0,title:e.length?r(`chat:workbench.noMatches`):r(`chat:workbench.noSources`)}),d.map(e=>{let i=t.selectedSourceId===e.id,a=e.kind===`image`?E:e.method===`path`?D:g;return(0,Y.jsxs)(`article`,{className:`border-b border-stroke-soft`,children:[(0,Y.jsxs)(`button`,{className:`flex min-h-9 w-full min-w-0 items-center gap-2 px-2 text-left hover:bg-surface-subtle focus-visible:-outline-offset-2 max-[650px]:min-h-11 pointer-coarse:min-h-11 ${i?`bg-surface-subtle`:``}`,"aria-expanded":i,onClick:()=>n({selectedSourceId:i?``:e.id}),children:[(0,Y.jsx)(f,{size:14,className:`shrink-0 text-content-muted transition-transform duration-(--d-fast) ${i?`rotate-90`:``}`}),(0,Y.jsx)(a,{className:`size-3.5 shrink-0 text-content-muted`}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs`,children:e.name||r(`chat:chatMessage.fileAttachment`)})]}),i&&(0,Y.jsxs)(`div`,{className:`space-y-1.5 border-t border-stroke-soft bg-code py-2.5 pr-3 pl-8 text-xs text-content-muted`,children:[(0,Y.jsx)(`p`,{className:`break-all font-mono text-content-secondary`,children:e.attachment.path||e.attachment.id||r(`chat:workbench.unavailable`)}),(0,Y.jsx)(`p`,{className:`font-mono`,children:e.attachment.mimeType||`application/octet-stream`}),(0,Y.jsx)(`p`,{children:e.method===`asset`?r(`chat:workbench.registeredAsset`):e.method===`path`?r(`chat:workbench.pathReference`):r(`chat:workbench.invalidReference`)}),(0,Y.jsx)(P,{variant:`secondary`,size:`sm`,className:`mt-1`,disabled:!e.available,onClick:t=>{l.current=t.currentTarget,c(e.id)},children:r(`chat:chatMessage.fileActionPreview`)})]})]},e.id)})]}),u&&(0,Y.jsx)(J.Suspense,{fallback:null,children:(0,Y.jsx)(_e,{attachment:u.attachment,onClose:()=>c(``),onRestoreFocus:()=>l.current?.focus(),onDownload:()=>{typeof u.attachment.downloadUrl==`string`&&window.open(u.attachment.downloadUrl,`_blank`,`noopener,noreferrer`)}})})]})}function ve({parentId:e,active:t}){let{t:n}=i(),{entry:r,runtime:a,load:o,setDraft:s}=C(e),c=r.session?.id??``,u=(0,J.useMemo)(()=>e=>a.subscribeSessionState(c,e),[a,c]),d=(0,J.useMemo)(()=>()=>a.getSessionState(c),[a,c]),f=(0,J.useSyncExternalStore)(u,d),[p,m]=(0,J.useState)(!1),[h,g]=(0,J.useState)(!1),[_,y]=(0,J.useState)(``),x=(0,J.useRef)(!1),T=(0,J.useRef)(!1),E=(0,J.useRef)(r.draft);E.current=r.draft;let D=(0,J.useRef)(null),O=te(e=>e.bindings),A=b(f,r.session);(0,J.useEffect)(()=>{t&&o(e)},[t,o,e]);let j=async t=>{t.preventDefault();let n=E.current.trim();if(!(!n||x.current||A||r.expired)){x.current=!0,m(!0),y(``);try{let t=await o(e,!r.session);if(!t?.session)return;let i=t.session.id;if(a.getSessionState(i).streaming)return;E.current.trim()===n&&s(e,``),m(!1),await a.send(i,n),await o(e)}catch(e){y(B(e))}finally{x.current=!1,m(!1)}}},M=(0,J.useCallback)(async()=>{if(!(!c||a.getSessionState(c).streaming)){y(``);try{await a.retry(c),await o(e)}catch(e){y(B(e))}}},[o,e,a,c]),I=async()=>{if(!(!c||h)){g(!0);try{y(``),await a.abort(c)}catch(e){y(B(e))}finally{g(!1)}}},L=(0,Y.jsxs)(`div`,{className:`grid h-full min-h-36 place-content-center justify-items-center gap-2 px-3 text-center text-xs text-content-muted`,children:[(0,Y.jsx)(`span`,{className:`mb-1 grid size-8 place-items-center rounded-md bg-key text-content-secondary shadow-key ring-1 ring-key-border`,children:(0,Y.jsx)(k,{className:`size-4`,"aria-hidden":`true`})}),(0,Y.jsx)(`p`,{className:`max-w-64 leading-relaxed`,children:r.expired?n(`chat:sideChat.expired`):n(`chat:sideChat.empty`)}),r.expired&&(0,Y.jsxs)(P,{variant:`secondary`,size:`sm`,className:`mt-1`,disabled:r.loading,onClick:async()=>{(await o(e,!0))?.session&&D.current?.focus()},children:[r.loading&&(0,Y.jsx)(N,{className:`size-3.5 text-current`}),n(`chat:sideChat.restart`)]})]}),R=_||r.error||f.error;return(0,Y.jsxs)(`section`,{"data-side-chat-parent":e,"aria-label":n(`chat:sideChat.title`),className:`flex h-full min-h-0 min-w-0 flex-1 flex-col [container-type:inline-size]`,children:[(0,Y.jsx)(`p`,{className:`shrink-0 border-b border-stroke-soft px-3 py-2 text-xs leading-relaxed text-content-muted`,children:n(`chat:sideChat.retention`)}),c?(0,Y.jsx)(S,{sessionId:c,messages:f.messages,transcriptLoadState:f.loaded?`ready`:f.error?`error`:`loading`,emptyState:L,messageStart:f.messageStart,hasOlder:f.hasOlder,loadingOlder:f.loadingOlder,olderError:f.olderError,activityFeed:f.activityFeed,tools:f.tools,thinkingText:f.thinkingText,currentActivity:f.currentActivity,compaction:f.compaction,streaming:A,runStartedAt:f.runStartedAt,lastActivityAt:f.lastActivityAt,runFinishedAt:f.runFinishedAt,runStopped:f.runStopped,runNotice:f.runNotice,error:f.error,cwd:r.session?.cwd,onLoadOlder:()=>a.loadOlderMessages(c),onRetryLastTurn:M}):(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:L}),(0,Y.jsxs)(`form`,{className:`flex shrink-0 flex-col gap-2 border-t border-stroke-soft p-3`,onSubmit:j,children:[R&&(0,Y.jsx)(w,{error:R,onRetry:r.error||!f.loaded?async()=>{await o(e)}:M}),(0,Y.jsx)(v,{approvals:f.approvals,onResolve:async(e,t)=>{try{await a.approve(c,e,t)}catch{}}}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-end gap-2 rounded-[var(--composer-radius,22px)] border border-control bg-panel py-2 pr-2 pl-3 shadow-composer transition-[border-color,box-shadow] duration-(--d-fast) focus-within:border-focus focus-within:ring-3 focus-within:ring-focus-ring`,children:[(0,Y.jsx)(`textarea`,{ref:D,rows:2,value:r.draft,"aria-label":n(`chat:sideChat.message`),placeholder:n(`chat:sideChat.placeholder`),className:`max-h-40 min-h-14 min-w-0 flex-1 resize-y border-0 bg-transparent px-1 py-1 text-sm leading-relaxed text-content caret-focus outline-none placeholder:text-content-muted`,onChange:t=>s(e,t.target.value),onCompositionStart:()=>{T.current=!0},onCompositionEnd:()=>{T.current=!1},onKeyDown:e=>{!T.current&&!e.nativeEvent.isComposing&&e.nativeEvent.keyCode!==229&&F(e.nativeEvent,O.sendMessage)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())}}),(0,Y.jsx)(P,{type:A?`button`:`submit`,size:`icon`,className:`size-8 shrink-0 rounded-full max-[650px]:size-11 pointer-coarse:size-11`,"aria-label":n(A?`chat:sideChat.stop`:`chat:sideChat.send`),disabled:A?h:p||r.loading||r.expired||!r.draft.trim(),onClick:A?()=>void I():void 0,children:p||h?(0,Y.jsx)(N,{className:`size-4 text-current`}):A?(0,Y.jsx)(ee,{size:13,fill:`currentColor`}):(0,Y.jsx)(l,{size:17})})]})]})]})}var $=(0,J.createContext)(null),ye=()=>{let e=(0,J.useContext)($);if(!e)throw Error(`WebPreview components must be used within a WebPreview`);return e},be=({className:e,children:t,defaultUrl:n=``,onUrlChange:r,...i})=>{let[a,o]=(0,J.useState)(n),[s,c]=(0,J.useState)(!1),l=(0,J.useCallback)(e=>{o(e),r?.(e)},[r]),u=(0,J.useMemo)(()=>({consoleOpen:s,setConsoleOpen:c,setUrl:l,url:a}),[s,l,a]);return(0,Y.jsx)($.Provider,{value:u,children:(0,Y.jsx)(`div`,{className:M(`flex size-full min-h-0 flex-col rounded-lg border bg-card`,e),...i,children:t})})},xe=({className:e,loading:t,src:n,...r})=>{let{url:i}=ye();return(0,Y.jsxs)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden bg-background`,children:[(0,Y.jsx)(`iframe`,{className:M(`block size-full border-0 bg-background`,e),loading:`lazy`,sandbox:`allow-scripts allow-same-origin allow-forms allow-popups allow-presentation`,src:(n??i)||void 0,title:`Preview`,...r}),t]})};function Se({sessionId:e,page:t,onChange:n,onClosed:r}){let{t:a}=i(),{draft:o,url:l}=t,[u,d]=(0,J.useState)(!1),f=U({enabled:!!window.pisperDesktop?.browser,url:l,popupId:t.resourceId,keepAlive:t.agent,onNavigated:e=>{e!==l&&n(o===l?{url:e,draft:e}:{url:e})},onTitle:e=>n({title:e}),onNewWindow:(t,n)=>ie(e,t,n),onClosed:r});return(0,Y.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col gap-2 p-3`,"aria-label":a(`common:webPreview.title`),children:[(0,Y.jsxs)(`form`,{className:`flex gap-2`,onSubmit:e=>{e.preventDefault();let t=V(o,window.location.href);d(!t),t&&n({url:t})},children:[f.active&&(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center`,children:[(0,Y.jsx)(P,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":a(`common:webPreview.back`),title:a(`common:webPreview.back`),onClick:()=>f.act(`back`),children:(0,Y.jsx)(s,{size:14})}),(0,Y.jsx)(P,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":a(`common:webPreview.forward`),title:a(`common:webPreview.forward`),onClick:()=>f.act(`forward`),children:(0,Y.jsx)(c,{size:14})}),(0,Y.jsx)(P,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":a(`common:webPreview.reload`),title:a(`common:webPreview.reload`),"aria-busy":f.loading,onClick:()=>f.act(`reload`),children:f.loading?(0,Y.jsx)(O,{size:14,className:`animate-spin`}):(0,Y.jsx)(q,{size:14})})]}),(0,Y.jsx)(L,{"aria-label":a(`common:webPreview.url`),className:`flex-1 font-mono`,value:o,onChange:e=>n({draft:e.target.value}),placeholder:a(`common:webPreview.urlPlaceholder`),maxLength:2048}),(0,Y.jsx)(P,{type:`submit`,variant:`secondary`,children:a(`chat:sessionContext.openUrl`)})]}),u&&(0,Y.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:a(`chat:sessionContext.invalidUrl`)}),f.active?(0,Y.jsx)(`div`,{ref:f.slotRef,role:`group`,"aria-label":a(`common:webPreview.title`),"aria-busy":f.loading,"data-native-browser-slot":!0,className:`min-h-0 flex-1 overflow-hidden rounded-md border border-stroke bg-background`}):l?(0,Y.jsx)(be,{className:`min-h-0 flex-1 overflow-hidden rounded-md border-stroke`,defaultUrl:l,children:(0,Y.jsx)(xe,{src:l,title:a(`common:webPreview.title`),...ae(l)?{sandbox:H}:{}})},l):(0,Y.jsx)(z,{icon:p,className:`min-h-0 flex-1`,title:a(`chat:sessionContext.browserEmpty`)}),l&&(0,Y.jsxs)(P,{type:`button`,variant:`ghost`,size:`sm`,className:`self-start`,onClick:()=>window.open(l,`_blank`,`noopener,noreferrer`),children:[(0,Y.jsx)(m,{size:14}),a(`common:webPreview.openExternal`)]}),!f.active&&(0,Y.jsx)(`p`,{className:`text-xs text-content-muted`,children:a(`common:webPreview.embedNotice`)})]})}export{he as a,X as c,ge as i,de as l,ve as n,me as o,Q as r,pe as s,Se as t};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/GitDiffViewer-
|
|
2
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{h as t}from"./vendor-router-CSN_DGvx.js";import{i as n,r}from"./vendor-react-DwNgTV1j.js";import{t as i}from"./use-i18n-AM3jlRYR.js";import{i as a}from"./runtime-capabilities-B7qveLBm.js";import{t as o}from"./runtime-capabilities-store-D0EC-a9c.js";import{r as s}from"./permission-rules-api-BoggV-So.js";import{t as c}from"./arrow-left-B8oVrQ2S.js";import{t as l}from"./check-2vYc6QaP.js";import{t as u}from"./chevron-right-C3t2Rckj.js";import{a as d,c as f,i as p,l as m,n as h,o as g,r as _,s as v,t as y}from"./SessionBrowserPane-CigWhKGU.js";import{t as b}from"./earth-Ddy13fHh.js";import{i as x,o as S}from"./GitDiffViewer-D2QUzasQ.js";import{k as C}from"./side-chat-context-DNQ3tThq.js";import{n as w,t as T}from"./undo-2-C-xQ0UVT.js";import{t as E}from"./link-2-mgasYn21.js";import{t as D}from"./message-square-SKjZyY3v.js";import{t as O}from"./plus-fQbSqB1n.js";import{t as k}from"./refresh-cw-TbWxTY4K.js";import{t as A}from"./square-terminal-BVG6cUT1.js";import{t as j}from"./x-07u4-129.js";import{n as M,t as N}from"./button-CCcCN8tE.js";import{s as P}from"./events-CcKmvwE6.js";import{a as F,n as I,o as L,t as ee}from"./sheet-BTaIEX4w.js";import{t as R}from"./input-CPw-zkYh.js";import{n as z,t as B}from"./PageState-Cz6vFMXv.js";import{a as te,o as ne,r as V}from"./session-web-preview-guvsmkWE.js";import"./public-CFmAK4C5.js";import{n as re}from"./terminal-context-aIsIJPn8.js";import{r as H}from"./web-preview-C7DdG9JP.js";var U=e(n(),1),W=r(),G=(0,U.lazy)(()=>t(()=>import(`./GitDiffViewer-D2QUzasQ.js`).then(e=>e.n).then(e=>({default:e.GitDiffDialog})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]))),K=100;function ie({sessionId:e,streaming:t,requestConfirm:n,view:r,onViewChange:a}){let{t:o}=i(),s=x(r?.reading?.list,e=>a?.({reading:{...r?.reading,list:e}})),[c,d]=(0,U.useState)([]),p=r?.expandedFiles||c,m=e=>a?a({expandedFiles:e}):d(e),{changes:h,loading:_,running:v,diff:y,setDiff:b,diffLoading:C,snapshotRevision:w,writesDisabled:E,pendingCount:D,reversibleCount:O,displayedError:A,notice:j,viewDiff:P,runAction:F,refresh:I}=g({sessionId:e,streaming:t,requestConfirm:n}),L=`max-[650px]:size-11 pointer-coarse:size-11`;return(0,W.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,"aria-label":o(`chat:focusSession.fileChanges`),"aria-busy":_||!!v,children:[(0,W.jsxs)(`header`,{className:`flex min-h-10 min-w-0 shrink-0 items-center gap-2 border-b border-stroke-soft pr-1.5 pl-3`,children:[(0,W.jsx)(`h2`,{className:`min-w-0 flex-1 truncate text-xs font-medium tracking-[.02em] text-content-muted`,children:o(`chat:focusSession.fileChanges`)}),h&&(0,W.jsxs)(`span`,{className:`shrink-0 font-mono text-xs tabular-nums`,children:[(0,W.jsxs)(`span`,{className:`text-success`,children:[`+`,h.summary.added]}),` `,(0,W.jsxs)(`span`,{className:`text-danger`,children:[`−`,h.summary.removed]})]}),(0,W.jsx)(N,{type:`button`,variant:`ghost`,size:`icon`,className:L,"aria-label":o(`chat:focusSession.gitRefresh`),title:o(`chat:focusSession.gitRefresh`),disabled:_||!!v,onClick:I,children:(0,W.jsx)(k,{className:_?`animate-spin`:``,size:15})})]}),(0,W.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2 border-b border-stroke-soft px-3 py-2.5`,children:[h&&(0,W.jsxs)(`p`,{className:`text-xs text-content-secondary tabular-nums`,children:[o(`chat:focusSession.fileChangesCount`,{count:h.summary.files}),D>0&&` · ${o(`chat:focusSession.fileChangesPending`,{count:D})}`]}),(0,W.jsx)(`p`,{className:`text-xs leading-relaxed text-content-muted`,children:o(`chat:workbench.taskSnapshotScope`)}),(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-1`,children:[(0,W.jsxs)(`div`,{className:`flex gap-1`,children:[(0,W.jsxs)(N,{type:`button`,variant:`secondary`,size:`sm`,disabled:E||D===0,title:t?o(`chat:focusSession.gitWaitForRunToFinish`):void 0,onClick:()=>void F({kind:`approve`}),children:[v?.kind===`approve`&&!v.path?(0,W.jsx)(k,{className:`animate-spin`,size:14}):(0,W.jsx)(l,{size:14}),o(`chat:focusSession.fileChangesApproveAll`)]}),(0,W.jsxs)(N,{type:`button`,variant:`secondary`,size:`sm`,disabled:E||O===0,title:o(t?`chat:focusSession.gitWaitForRunToFinish`:`chat:focusSession.fileChangesRevertAllDescription`),onClick:()=>void F({kind:`revert`}),children:[v?.kind===`revert`&&!v.path?(0,W.jsx)(k,{className:`animate-spin`,size:14}):(0,W.jsx)(T,{size:14}),o(`chat:focusSession.fileChangesRevertAll`)]})]}),(0,W.jsxs)(`div`,{className:`flex gap-1`,children:[(0,W.jsx)(N,{variant:`ghost`,size:`sm`,disabled:_||!h?.files.length,onClick:()=>m(h?.files.slice(0,K).map(e=>e.path)||[]),children:o(`chat:workbench.expandAll`)}),(0,W.jsx)(N,{variant:`ghost`,size:`sm`,onClick:()=>m([]),children:o(`chat:workbench.collapseAll`)})]})]})]}),A&&(0,W.jsx)(`p`,{role:`alert`,className:`px-3 pt-2.5 text-xs text-danger`,children:A}),j&&!A&&(0,W.jsx)(`p`,{role:`status`,className:`px-3 pt-2.5 text-xs text-content-secondary`,children:j}),_&&!h?(0,W.jsx)(z,{kind:`loading`,title:o(`chat:focusSession.gitLoading`)}):h?.files.length?(0,W.jsxs)(`ul`,{ref:s.ref,className:`min-h-0 flex-1 overflow-y-auto`,"aria-label":o(`chat:focusSession.fileChanges`),children:[h.files.slice(0,K).map(t=>{let n=p.includes(t.path);return(0,W.jsxs)(`li`,{className:`min-w-0 border-b border-stroke-soft`,children:[(0,W.jsxs)(`div`,{className:`flex min-w-0 items-center gap-0.5 pr-1.5 hover:bg-surface-subtle ${n?`bg-surface-subtle`:``}`,children:[(0,W.jsxs)(`button`,{type:`button`,className:`flex min-h-9 min-w-0 flex-1 items-center gap-2 pl-2 text-left text-xs focus-visible:-outline-offset-2 disabled:opacity-60 max-[650px]:min-h-11 pointer-coarse:min-h-11`,title:t.path,disabled:_||!!v,"aria-busy":C===t.path,"aria-expanded":n,onClick:()=>m(n?p.filter(e=>e!==t.path):[...p,t.path]),children:[(0,W.jsx)(u,{size:14,className:`shrink-0 text-content-muted transition-transform duration-(--d-fast) ${n?`rotate-90`:``}`}),C===t.path?(0,W.jsx)(M,{className:`size-3.5`}):(0,W.jsx)(S,{size:14,className:`flex-none text-content-muted`}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono`,children:t.path}),(t.reverted||t.approved)&&(0,W.jsx)(`span`,{className:`shrink-0 text-content-muted`,children:t.reverted?o(`chat:focusSession.fileChangesReverted`):o(`chat:focusSession.fileChangesApproved`)}),(0,W.jsxs)(`span`,{className:`shrink-0 font-mono tabular-nums`,children:[(0,W.jsxs)(`span`,{className:`text-success`,children:[`+`,t.added]}),` `,(0,W.jsxs)(`span`,{className:`text-danger`,children:[`−`,t.removed]})]})]}),(0,W.jsx)(N,{type:`button`,variant:`ghost`,size:`icon`,className:L,title:o(`chat:focusSession.fileChangesApproveFile`),"aria-label":`${o(`chat:focusSession.fileChangesApproveFile`)} ${t.path}`,disabled:E||!t.pending||t.approved||t.reverted,onClick:()=>void F({kind:`approve`,path:t.path}),children:(0,W.jsx)(l,{size:14})}),(0,W.jsx)(N,{type:`button`,variant:`ghost`,size:`icon`,className:L,title:o(`chat:focusSession.fileChangesRevertFile`),"aria-label":`${o(`chat:focusSession.fileChangesRevertFile`)} ${t.path}`,disabled:E||t.reverted||!t.canRevert,onClick:()=>void F({kind:`revert`,path:t.path}),children:(0,W.jsx)(T,{size:14})})]}),n&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(f,{sessionId:e,path:t.path,scope:`task`,position:r?.reading?.[t.path],onReading:e=>a?.({reading:{...r?.reading,[t.path]:e}}),revision:w}),(0,W.jsx)(N,{variant:`ghost`,size:`sm`,className:`m-1.5`,onClick:()=>void P(t.path),children:o(`chat:workbench.fullDiff`)})]})]},t.path)}),h.files.length>K&&(0,W.jsx)(`li`,{className:`px-3 py-2 text-xs text-content-muted tabular-nums`,children:o(`chat:focusSession.gitMoreFiles`,{count:h.files.length-K})})]}):!A&&(0,W.jsx)(B,{compact:!0,title:o(`chat:focusSession.fileChangesEmpty`)}),y&&(0,W.jsx)(U.Suspense,{fallback:null,children:(0,W.jsx)(G,{diff:y.diff,truncated:y.truncated,onClose:()=>b(null)})})]})}function ae({tools:e,onSelect:t,onOpenUrl:n}){let{t:r}=i(),[a,o]=(0,U.useState)(``),[s,c]=(0,U.useState)(!1);return(0,W.jsxs)(`section`,{className:`@container/new-tab flex min-h-0 flex-1 flex-col overflow-y-auto bg-panel p-4`,children:[(0,W.jsx)(`h2`,{className:`mb-3 text-sm font-medium text-content`,children:r(`chat:workbench.newTab`)}),(0,W.jsxs)(`form`,{className:`mb-4 flex gap-2`,onSubmit:e=>{e.preventDefault();let t=H(a,window.location.href);c(!t),t&&n(t)},children:[(0,W.jsx)(R,{className:`font-mono`,"aria-label":r(`common:webPreview.url`),placeholder:r(`common:webPreview.urlPlaceholder`),value:a,maxLength:2048,onChange:e=>o(e.target.value)}),(0,W.jsx)(N,{type:`submit`,variant:`secondary`,children:r(`chat:sessionContext.openUrl`)})]}),s&&(0,W.jsx)(`p`,{role:`alert`,className:`mb-3 text-xs text-danger`,children:r(`chat:sessionContext.invalidUrl`)}),(0,W.jsx)(`div`,{className:`grid grid-cols-1 gap-1.5 @min-[420px]/new-tab:grid-cols-2`,children:e.map(({id:e,label:n,icon:r,disabled:i})=>(0,W.jsxs)(N,{disabled:i,variant:`ghost`,className:`h-10 min-w-0 justify-start gap-2.5 border-stroke bg-panel px-3 font-normal text-content max-[650px]:h-11 pointer-coarse:h-11 [&_svg]:text-content-muted`,onClick:()=>t(e),children:[(0,W.jsx)(r,{className:`size-4 shrink-0`}),(0,W.jsx)(`span`,{className:`truncate`,children:n})]},e))})]})}function q({panelId:e,compact:t,embedded:n=!1,active:r=!0,sessionId:l,cwd:u=``,sources:f=[],tab:g,plan:x,streaming:T,plansAvailable:k,requestConfirm:M,onTabChange:R,onClose:z,onBack:H}){let{t:G}=i(),K=re(),q=o(e=>e.capabilities),J=[{id:`terminal`,icon:A,label:G(`terminal:workspace.terminal`)},{id:`processes`,icon:s,label:G(`terminal:workspace.processes`)},{id:`changes`,icon:S,label:G(`chat:workbench.projectChanges`)},{id:`sources`,icon:E,label:G(`chat:workbench.sources`)},{id:`files`,icon:C,label:G(`chat:workbench.taskSnapshots`)},...k?[{id:`plan`,icon:w,label:G(`chat:sessionContext.plan`)}]:[],{id:`browser`,icon:b,label:G(`common:webPreview.title`)},{id:`side-chat`,icon:D,label:G(`chat:sideChat.title`)}],oe=(0,U.useMemo)(()=>te(g),[g]),Y=V(e=>Object.prototype.hasOwnProperty.call(e.sessions,l)?e.sessions[l]:void 0)??oe,se=(0,U.useRef)(null),X=Y.pages.find(e=>e.id===Y.activeId)??Y.pages[0],Z=e=>e.kind===`new`?{id:`new`,icon:O,label:G(`chat:workbench.newTab`)}:J.find(t=>t.id===e.kind)??J[0],ce=t=>requestAnimationFrame(()=>document.getElementById(`${e}-${t}-tab`)?.focus()),le=(0,U.useEffectEvent)(()=>{r&&document.getElementById(`${e}-${Y.activeId}-tab`)?.focus()});(0,U.useEffect)(()=>{let e=requestAnimationFrame(()=>le());return()=>cancelAnimationFrame(e)},[e,Y.activeId]);let Q=e=>{if(e.type===`view`&&!V.getState().sessions[l])return;[`add`,`open`,`select`,`close`,`kind`].includes(e.type)&&window.dispatchEvent(new Event(P));let t=ne(Y,e);V.getState().update(l,g,e);let n=t.pages.find(e=>e.id===t.activeId);n&&R(n.kind),(e.type===`add`||e.type===`select`||e.type===`close`)&&ce(t.activeId),e.type===`close`&&Y.pages.length===1&&z()},$=G(`chat:sessionContext.addPage`),ue=G(`chat:sessionContext.pageLimit`),de=(0,W.jsx)(N,{variant:`ghost`,size:`icon`,className:`max-[650px]:size-11`,disabled:Y.pages.length>=12,"aria-label":$,title:Y.pages.length>=12?ue:$,onClick:()=>Q({type:`add`,kind:`new`}),children:(0,W.jsx)(O,{size:16})}),fe=(0,W.jsxs)(`div`,{"data-session-context-panel":!0,className:`flex h-full min-h-0 min-w-0 flex-col bg-panel text-content`,children:[(0,W.jsxs)(`header`,{"data-window-drag-region":!0,className:`auxiliary-page-header flex h-12 shrink-0 items-center gap-1 border-b border-stroke-soft px-2`,children:[H&&(0,W.jsx)(N,{variant:`ghost`,size:`icon`,className:`max-[650px]:size-11`,"aria-label":G(`chat:workbench.backToConversation`),title:G(`chat:workbench.backToConversation`),onClick:H,children:(0,W.jsx)(c,{size:16})}),(0,W.jsx)(`div`,{ref:se,className:`flex min-w-0 flex-1 items-center gap-0.5 overflow-x-auto px-px py-1 [scrollbar-width:none]`,role:`tablist`,"aria-label":G(`chat:sessionContext.title`),onKeyDown:e=>{if(!(e.target instanceof HTMLElement)||e.target.getAttribute(`role`)!==`tab`)return;if(e.key===`Delete`){e.preventDefault(),Q({type:`close`,id:X.id});return}if(![`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key))return;e.preventDefault();let t=Y.pages.findIndex(e=>e.id===X.id),n=e.key===`Home`?0:e.key===`End`?Y.pages.length-1:(t+(e.key===`ArrowRight`?1:-1)+Y.pages.length)%Y.pages.length;Q({type:`select`,id:Y.pages[n].id})},children:Y.pages.map(t=>{let{icon:n,label:r}=Z(t);return(0,W.jsxs)(`div`,{className:`relative flex max-w-40 min-w-20 shrink-0 items-center rounded-sm transition-colors duration-(--d-fast) ${t.id===X.id?`bg-key font-medium text-content shadow-key ring-1 ring-key-border after:absolute after:inset-x-2 after:bottom-0 after:h-0.5 after:rounded-full after:bg-star`:`text-content-muted hover:bg-surface-hover hover:text-content`}`,children:[(0,W.jsxs)(`button`,{id:`${e}-${t.id}-tab`,type:`button`,role:`tab`,"aria-selected":t.id===X.id,"aria-controls":`${e}-${t.id}-content`,tabIndex:t.id===X.id?0:-1,className:`flex h-7 min-w-0 flex-1 items-center gap-1.5 rounded-sm pl-2 text-sm focus-visible:outline-offset-0 max-[650px]:h-11`,onClick:()=>Q({type:`select`,id:t.id}),children:[(0,W.jsx)(n,{size:14,className:`shrink-0`}),(0,W.jsx)(`span`,{className:`truncate`,children:r})]}),(0,W.jsx)(`button`,{type:`button`,className:`mx-0.5 grid size-5 shrink-0 place-items-center rounded-xs text-content-muted hover:bg-surface-hover hover:text-content focus-visible:outline-offset-0 max-[650px]:size-11`,"aria-label":`${G(`chat:sessionContext.closePage`)} · ${r}`,onClick:()=>Q({type:`close`,id:t.id}),children:(0,W.jsx)(j,{size:12})})]},t.id)})}),de]}),Y.pages.map(t=>{let n=Z(t),r=X.id===t.id;return(0,W.jsx)(`div`,{id:`${e}-${t.id}-content`,role:`tabpanel`,"aria-labelledby":`${e}-${t.id}-tab`,className:r?`flex min-h-0 flex-1 flex-col`:`hidden`,hidden:!r,children:n.id===`new`?r&&(0,W.jsx)(ae,{tools:J.map(e=>({...e,disabled:e.id===`terminal`||e.id===`processes`?!K||!a(q,`terminal`):e.id===`changes`&&!a(q,`vcs`)})),onOpenUrl:e=>{Q({type:`open`,kind:`browser`,replaceId:t.id}),V.getState().update(l,`browser`,{type:`browser`,id:t.id,url:e,draft:e})},onSelect:e=>Q({type:`open`,kind:e,replaceId:t.id})}):n.id===`changes`?r&&(0,W.jsx)(v,{sessionId:l,cwd:u,streaming:T,view:t.view,onViewChange:e=>Q({type:`view`,id:t.id,patch:e})}):n.id===`sources`?r&&(0,W.jsx)(_,{sources:f,view:t.view,onViewChange:e=>Q({type:`view`,id:t.id,patch:e})}):n.id===`terminal`?r&&(0,W.jsx)(d,{sessionId:l,cwd:u,terminalId:t.resourceId||void 0,onCreated:e=>V.getState().update(l,g,{type:`resource`,id:t.id,resourceId:e})}):n.id===`processes`?r&&(0,W.jsx)(p,{view:t.view,onViewChange:e=>Q({type:`view`,id:t.id,patch:e}),sessionId:l,onOpenTerminal:e=>Q({type:`open`,kind:`terminal`,resourceId:e})}):n.id===`side-chat`?(0,W.jsx)(h,{parentId:l,active:r}):n.id===`browser`?(0,W.jsx)(y,{sessionId:l,page:t,onChange:e=>Q({type:`browser`,id:t.id,...e}),onClosed:()=>Q({type:`close`,id:t.id})}):r&&(n.id===`files`?(0,W.jsx)(ie,{view:t.view,onViewChange:e=>Q({type:`view`,id:t.id,patch:e}),sessionId:l,streaming:T,requestConfirm:M}):(0,W.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-3`,children:x?.items?.length?(0,W.jsx)(m,{plan:x,running:T}):(0,W.jsx)(B,{compact:!0,title:G(`chat:sessionContext.planEmpty`)})}))},t.id)})]});return t?(0,W.jsx)(ee,{open:!0,onOpenChange:e=>!e&&z(),children:(0,W.jsxs)(I,{id:e,side:`right`,showCloseButton:!1,className:`gap-0 overflow-hidden p-0`,style:{top:`var(--pisper-safe-area-top)`,right:`var(--pisper-safe-area-right)`,bottom:`var(--pisper-safe-area-bottom)`,height:`auto`,width:`min(calc(100vw - var(--pisper-safe-area-left) - var(--pisper-safe-area-right)), 420px)`,maxWidth:`none`},children:[(0,W.jsx)(F,{className:`sr-only`,children:(0,W.jsx)(L,{children:G(`chat:sessionContext.title`)})}),fe]})}):(0,W.jsx)(`aside`,{id:e,tabIndex:n?-1:void 0,className:`h-full min-h-0 w-full overflow-hidden border-l border-stroke bg-panel`,"aria-label":G(`chat:sessionContext.title`),children:fe})}export{q as SessionContextPanel};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/GitDiffViewer-Dc46yAUc.js","assets/rolldown-runtime-B0Z9INg1.js","assets/vendor-react-DwNgTV1j.js","assets/use-i18n-D6tl7SDi.js","assets/i18n-Zs9wBTpa.js","assets/vendor-router-CSN_DGvx.js","assets/index-BpFQSLJJ.js","assets/index-BnQCk-QI.css","assets/storage-DtvZ_lEu.js","assets/vendor-state-GkUciC5H.js","assets/createLucideIcon-Cd-3GVxJ.js","assets/x-07u4-129.js","assets/utils-C8uzG5AZ.js","assets/vendor-ui-DvrYggeS.js","assets/button-CCcCN8tE.js","assets/dist-41X0pdUs.js","assets/events-S66w92oA.js","assets/esm-DCV8yILT.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{h as t}from"./vendor-router-CSN_DGvx.js";import{i as n,r}from"./vendor-react-DwNgTV1j.js";import{t as i}from"./use-i18n-D6tl7SDi.js";import{i as a}from"./runtime-capabilities-B7qveLBm.js";import{t as o}from"./runtime-capabilities-store-DoZOSQiv.js";import{r as s}from"./permission-rules-api-B3tMaJim.js";import{t as c}from"./arrow-left-B8oVrQ2S.js";import{t as l}from"./check-2vYc6QaP.js";import{t as u}from"./chevron-right-C3t2Rckj.js";import{a as d,c as f,i as p,l as m,n as h,o as g,r as _,s as v,t as y}from"./SessionBrowserPane-Dsf4QuHa.js";import{t as b}from"./earth-Ddy13fHh.js";import{i as x,o as S}from"./GitDiffViewer-Dc46yAUc.js";import{k as C}from"./side-chat-context-BXN0j7F9.js";import{n as w,t as T}from"./undo-2-C-xQ0UVT.js";import{t as E}from"./link-2-mgasYn21.js";import{t as D}from"./message-square-SKjZyY3v.js";import{t as O}from"./plus-fQbSqB1n.js";import{t as k}from"./refresh-cw-TbWxTY4K.js";import{t as A}from"./square-terminal-BVG6cUT1.js";import{t as j}from"./x-07u4-129.js";import{n as M,t as N}from"./button-CCcCN8tE.js";import{s as P}from"./events-S66w92oA.js";import{a as F,n as I,o as L,t as ee}from"./sheet-BTaIEX4w.js";import{t as R}from"./input-CPw-zkYh.js";import{n as z,t as B}from"./PageState-Cz6vFMXv.js";import{a as te,o as ne,r as V}from"./session-web-preview-guvsmkWE.js";import"./public-DftK6qxa.js";import{n as re}from"./terminal-context-aIsIJPn8.js";import{r as H}from"./web-preview-C7DdG9JP.js";var U=e(n(),1),W=r(),G=(0,U.lazy)(()=>t(()=>import(`./GitDiffViewer-Dc46yAUc.js`).then(e=>e.n).then(e=>({default:e.GitDiffDialog})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]))),K=100;function ie({sessionId:e,streaming:t,requestConfirm:n,view:r,onViewChange:a}){let{t:o}=i(),s=x(r?.reading?.list,e=>a?.({reading:{...r?.reading,list:e}})),[c,d]=(0,U.useState)([]),p=r?.expandedFiles||c,m=e=>a?a({expandedFiles:e}):d(e),{changes:h,loading:_,running:v,diff:y,setDiff:b,diffLoading:C,snapshotRevision:w,writesDisabled:E,pendingCount:D,reversibleCount:O,displayedError:A,notice:j,viewDiff:P,runAction:F,refresh:I}=g({sessionId:e,streaming:t,requestConfirm:n}),L=`max-[650px]:size-11 pointer-coarse:size-11`;return(0,W.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,"aria-label":o(`chat:focusSession.fileChanges`),"aria-busy":_||!!v,children:[(0,W.jsxs)(`header`,{className:`flex min-h-10 min-w-0 shrink-0 items-center gap-2 border-b border-stroke-soft pr-1.5 pl-3`,children:[(0,W.jsx)(`h2`,{className:`min-w-0 flex-1 truncate text-xs font-medium tracking-[.02em] text-content-muted`,children:o(`chat:focusSession.fileChanges`)}),h&&(0,W.jsxs)(`span`,{className:`shrink-0 font-mono text-xs tabular-nums`,children:[(0,W.jsxs)(`span`,{className:`text-success`,children:[`+`,h.summary.added]}),` `,(0,W.jsxs)(`span`,{className:`text-danger`,children:[`−`,h.summary.removed]})]}),(0,W.jsx)(N,{type:`button`,variant:`ghost`,size:`icon`,className:L,"aria-label":o(`chat:focusSession.gitRefresh`),title:o(`chat:focusSession.gitRefresh`),disabled:_||!!v,onClick:I,children:(0,W.jsx)(k,{className:_?`animate-spin`:``,size:15})})]}),(0,W.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2 border-b border-stroke-soft px-3 py-2.5`,children:[h&&(0,W.jsxs)(`p`,{className:`text-xs text-content-secondary tabular-nums`,children:[o(`chat:focusSession.fileChangesCount`,{count:h.summary.files}),D>0&&` · ${o(`chat:focusSession.fileChangesPending`,{count:D})}`]}),(0,W.jsx)(`p`,{className:`text-xs leading-relaxed text-content-muted`,children:o(`chat:workbench.taskSnapshotScope`)}),(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-1`,children:[(0,W.jsxs)(`div`,{className:`flex gap-1`,children:[(0,W.jsxs)(N,{type:`button`,variant:`secondary`,size:`sm`,disabled:E||D===0,title:t?o(`chat:focusSession.gitWaitForRunToFinish`):void 0,onClick:()=>void F({kind:`approve`}),children:[v?.kind===`approve`&&!v.path?(0,W.jsx)(k,{className:`animate-spin`,size:14}):(0,W.jsx)(l,{size:14}),o(`chat:focusSession.fileChangesApproveAll`)]}),(0,W.jsxs)(N,{type:`button`,variant:`secondary`,size:`sm`,disabled:E||O===0,title:o(t?`chat:focusSession.gitWaitForRunToFinish`:`chat:focusSession.fileChangesRevertAllDescription`),onClick:()=>void F({kind:`revert`}),children:[v?.kind===`revert`&&!v.path?(0,W.jsx)(k,{className:`animate-spin`,size:14}):(0,W.jsx)(T,{size:14}),o(`chat:focusSession.fileChangesRevertAll`)]})]}),(0,W.jsxs)(`div`,{className:`flex gap-1`,children:[(0,W.jsx)(N,{variant:`ghost`,size:`sm`,disabled:_||!h?.files.length,onClick:()=>m(h?.files.slice(0,K).map(e=>e.path)||[]),children:o(`chat:workbench.expandAll`)}),(0,W.jsx)(N,{variant:`ghost`,size:`sm`,onClick:()=>m([]),children:o(`chat:workbench.collapseAll`)})]})]})]}),A&&(0,W.jsx)(`p`,{role:`alert`,className:`px-3 pt-2.5 text-xs text-danger`,children:A}),j&&!A&&(0,W.jsx)(`p`,{role:`status`,className:`px-3 pt-2.5 text-xs text-content-secondary`,children:j}),_&&!h?(0,W.jsx)(z,{kind:`loading`,title:o(`chat:focusSession.gitLoading`)}):h?.files.length?(0,W.jsxs)(`ul`,{ref:s.ref,className:`min-h-0 flex-1 overflow-y-auto`,"aria-label":o(`chat:focusSession.fileChanges`),children:[h.files.slice(0,K).map(t=>{let n=p.includes(t.path);return(0,W.jsxs)(`li`,{className:`min-w-0 border-b border-stroke-soft`,children:[(0,W.jsxs)(`div`,{className:`flex min-w-0 items-center gap-0.5 pr-1.5 hover:bg-surface-subtle ${n?`bg-surface-subtle`:``}`,children:[(0,W.jsxs)(`button`,{type:`button`,className:`flex min-h-9 min-w-0 flex-1 items-center gap-2 pl-2 text-left text-xs focus-visible:-outline-offset-2 disabled:opacity-60 max-[650px]:min-h-11 pointer-coarse:min-h-11`,title:t.path,disabled:_||!!v,"aria-busy":C===t.path,"aria-expanded":n,onClick:()=>m(n?p.filter(e=>e!==t.path):[...p,t.path]),children:[(0,W.jsx)(u,{size:14,className:`shrink-0 text-content-muted transition-transform duration-(--d-fast) ${n?`rotate-90`:``}`}),C===t.path?(0,W.jsx)(M,{className:`size-3.5`}):(0,W.jsx)(S,{size:14,className:`flex-none text-content-muted`}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono`,children:t.path}),(t.reverted||t.approved)&&(0,W.jsx)(`span`,{className:`shrink-0 text-content-muted`,children:t.reverted?o(`chat:focusSession.fileChangesReverted`):o(`chat:focusSession.fileChangesApproved`)}),(0,W.jsxs)(`span`,{className:`shrink-0 font-mono tabular-nums`,children:[(0,W.jsxs)(`span`,{className:`text-success`,children:[`+`,t.added]}),` `,(0,W.jsxs)(`span`,{className:`text-danger`,children:[`−`,t.removed]})]})]}),(0,W.jsx)(N,{type:`button`,variant:`ghost`,size:`icon`,className:L,title:o(`chat:focusSession.fileChangesApproveFile`),"aria-label":`${o(`chat:focusSession.fileChangesApproveFile`)} ${t.path}`,disabled:E||!t.pending||t.approved||t.reverted,onClick:()=>void F({kind:`approve`,path:t.path}),children:(0,W.jsx)(l,{size:14})}),(0,W.jsx)(N,{type:`button`,variant:`ghost`,size:`icon`,className:L,title:o(`chat:focusSession.fileChangesRevertFile`),"aria-label":`${o(`chat:focusSession.fileChangesRevertFile`)} ${t.path}`,disabled:E||t.reverted||!t.canRevert,onClick:()=>void F({kind:`revert`,path:t.path}),children:(0,W.jsx)(T,{size:14})})]}),n&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(f,{sessionId:e,path:t.path,scope:`task`,position:r?.reading?.[t.path],onReading:e=>a?.({reading:{...r?.reading,[t.path]:e}}),revision:w}),(0,W.jsx)(N,{variant:`ghost`,size:`sm`,className:`m-1.5`,onClick:()=>void P(t.path),children:o(`chat:workbench.fullDiff`)})]})]},t.path)}),h.files.length>K&&(0,W.jsx)(`li`,{className:`px-3 py-2 text-xs text-content-muted tabular-nums`,children:o(`chat:focusSession.gitMoreFiles`,{count:h.files.length-K})})]}):!A&&(0,W.jsx)(B,{compact:!0,title:o(`chat:focusSession.fileChangesEmpty`)}),y&&(0,W.jsx)(U.Suspense,{fallback:null,children:(0,W.jsx)(G,{diff:y.diff,truncated:y.truncated,onClose:()=>b(null)})})]})}function ae({tools:e,onSelect:t,onOpenUrl:n}){let{t:r}=i(),[a,o]=(0,U.useState)(``),[s,c]=(0,U.useState)(!1);return(0,W.jsxs)(`section`,{className:`@container/new-tab flex min-h-0 flex-1 flex-col overflow-y-auto bg-panel p-4`,children:[(0,W.jsx)(`h2`,{className:`mb-3 text-sm font-medium text-content`,children:r(`chat:workbench.newTab`)}),(0,W.jsxs)(`form`,{className:`mb-4 flex gap-2`,onSubmit:e=>{e.preventDefault();let t=H(a,window.location.href);c(!t),t&&n(t)},children:[(0,W.jsx)(R,{className:`font-mono`,"aria-label":r(`common:webPreview.url`),placeholder:r(`common:webPreview.urlPlaceholder`),value:a,maxLength:2048,onChange:e=>o(e.target.value)}),(0,W.jsx)(N,{type:`submit`,variant:`secondary`,children:r(`chat:sessionContext.openUrl`)})]}),s&&(0,W.jsx)(`p`,{role:`alert`,className:`mb-3 text-xs text-danger`,children:r(`chat:sessionContext.invalidUrl`)}),(0,W.jsx)(`div`,{className:`grid grid-cols-1 gap-1.5 @min-[420px]/new-tab:grid-cols-2`,children:e.map(({id:e,label:n,icon:r,disabled:i})=>(0,W.jsxs)(N,{disabled:i,variant:`ghost`,className:`h-10 min-w-0 justify-start gap-2.5 border-stroke bg-panel px-3 font-normal text-content max-[650px]:h-11 pointer-coarse:h-11 [&_svg]:text-content-muted`,onClick:()=>t(e),children:[(0,W.jsx)(r,{className:`size-4 shrink-0`}),(0,W.jsx)(`span`,{className:`truncate`,children:n})]},e))})]})}function q({panelId:e,compact:t,embedded:n=!1,active:r=!0,sessionId:l,cwd:u=``,sources:f=[],tab:g,plan:x,streaming:T,plansAvailable:k,requestConfirm:M,onTabChange:R,onClose:z,onBack:H}){let{t:G}=i(),K=re(),q=o(e=>e.capabilities),J=[{id:`terminal`,icon:A,label:G(`terminal:workspace.terminal`)},{id:`processes`,icon:s,label:G(`terminal:workspace.processes`)},{id:`changes`,icon:S,label:G(`chat:workbench.projectChanges`)},{id:`sources`,icon:E,label:G(`chat:workbench.sources`)},{id:`files`,icon:C,label:G(`chat:workbench.taskSnapshots`)},...k?[{id:`plan`,icon:w,label:G(`chat:sessionContext.plan`)}]:[],{id:`browser`,icon:b,label:G(`common:webPreview.title`)},{id:`side-chat`,icon:D,label:G(`chat:sideChat.title`)}],oe=(0,U.useMemo)(()=>te(g),[g]),Y=V(e=>Object.prototype.hasOwnProperty.call(e.sessions,l)?e.sessions[l]:void 0)??oe,se=(0,U.useRef)(null),X=Y.pages.find(e=>e.id===Y.activeId)??Y.pages[0],Z=e=>e.kind===`new`?{id:`new`,icon:O,label:G(`chat:workbench.newTab`)}:J.find(t=>t.id===e.kind)??J[0],ce=t=>requestAnimationFrame(()=>document.getElementById(`${e}-${t}-tab`)?.focus()),le=(0,U.useEffectEvent)(()=>{r&&document.getElementById(`${e}-${Y.activeId}-tab`)?.focus()});(0,U.useEffect)(()=>{let e=requestAnimationFrame(()=>le());return()=>cancelAnimationFrame(e)},[e,Y.activeId]);let Q=e=>{if(e.type===`view`&&!V.getState().sessions[l])return;[`add`,`open`,`select`,`close`,`kind`].includes(e.type)&&window.dispatchEvent(new Event(P));let t=ne(Y,e);V.getState().update(l,g,e);let n=t.pages.find(e=>e.id===t.activeId);n&&R(n.kind),(e.type===`add`||e.type===`select`||e.type===`close`)&&ce(t.activeId),e.type===`close`&&Y.pages.length===1&&z()},$=G(`chat:sessionContext.addPage`),ue=G(`chat:sessionContext.pageLimit`),de=(0,W.jsx)(N,{variant:`ghost`,size:`icon`,className:`max-[650px]:size-11`,disabled:Y.pages.length>=12,"aria-label":$,title:Y.pages.length>=12?ue:$,onClick:()=>Q({type:`add`,kind:`new`}),children:(0,W.jsx)(O,{size:16})}),fe=(0,W.jsxs)(`div`,{"data-session-context-panel":!0,className:`flex h-full min-h-0 min-w-0 flex-col bg-panel text-content`,children:[(0,W.jsxs)(`header`,{"data-window-drag-region":!0,className:`auxiliary-page-header flex h-12 shrink-0 items-center gap-1 border-b border-stroke-soft px-2`,children:[H&&(0,W.jsx)(N,{variant:`ghost`,size:`icon`,className:`max-[650px]:size-11`,"aria-label":G(`chat:workbench.backToConversation`),title:G(`chat:workbench.backToConversation`),onClick:H,children:(0,W.jsx)(c,{size:16})}),(0,W.jsx)(`div`,{ref:se,className:`flex min-w-0 flex-1 items-center gap-0.5 overflow-x-auto px-px py-1 [scrollbar-width:none]`,role:`tablist`,"aria-label":G(`chat:sessionContext.title`),onKeyDown:e=>{if(!(e.target instanceof HTMLElement)||e.target.getAttribute(`role`)!==`tab`)return;if(e.key===`Delete`){e.preventDefault(),Q({type:`close`,id:X.id});return}if(![`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key))return;e.preventDefault();let t=Y.pages.findIndex(e=>e.id===X.id),n=e.key===`Home`?0:e.key===`End`?Y.pages.length-1:(t+(e.key===`ArrowRight`?1:-1)+Y.pages.length)%Y.pages.length;Q({type:`select`,id:Y.pages[n].id})},children:Y.pages.map(t=>{let{icon:n,label:r}=Z(t);return(0,W.jsxs)(`div`,{className:`relative flex max-w-40 min-w-20 shrink-0 items-center rounded-sm transition-colors duration-(--d-fast) ${t.id===X.id?`bg-key font-medium text-content shadow-key ring-1 ring-key-border after:absolute after:inset-x-2 after:bottom-0 after:h-0.5 after:rounded-full after:bg-star`:`text-content-muted hover:bg-surface-hover hover:text-content`}`,children:[(0,W.jsxs)(`button`,{id:`${e}-${t.id}-tab`,type:`button`,role:`tab`,"aria-selected":t.id===X.id,"aria-controls":`${e}-${t.id}-content`,tabIndex:t.id===X.id?0:-1,className:`flex h-7 min-w-0 flex-1 items-center gap-1.5 rounded-sm pl-2 text-sm focus-visible:outline-offset-0 max-[650px]:h-11`,onClick:()=>Q({type:`select`,id:t.id}),children:[(0,W.jsx)(n,{size:14,className:`shrink-0`}),(0,W.jsx)(`span`,{className:`truncate`,children:r})]}),(0,W.jsx)(`button`,{type:`button`,className:`mx-0.5 grid size-5 shrink-0 place-items-center rounded-xs text-content-muted hover:bg-surface-hover hover:text-content focus-visible:outline-offset-0 max-[650px]:size-11`,"aria-label":`${G(`chat:sessionContext.closePage`)} · ${r}`,onClick:()=>Q({type:`close`,id:t.id}),children:(0,W.jsx)(j,{size:12})})]},t.id)})}),de]}),Y.pages.map(t=>{let n=Z(t),r=X.id===t.id;return(0,W.jsx)(`div`,{id:`${e}-${t.id}-content`,role:`tabpanel`,"aria-labelledby":`${e}-${t.id}-tab`,className:r?`flex min-h-0 flex-1 flex-col`:`hidden`,hidden:!r,children:n.id===`new`?r&&(0,W.jsx)(ae,{tools:J.map(e=>({...e,disabled:e.id===`terminal`||e.id===`processes`?!K||!a(q,`terminal`):e.id===`changes`&&!a(q,`vcs`)})),onOpenUrl:e=>{Q({type:`open`,kind:`browser`,replaceId:t.id}),V.getState().update(l,`browser`,{type:`browser`,id:t.id,url:e,draft:e})},onSelect:e=>Q({type:`open`,kind:e,replaceId:t.id})}):n.id===`changes`?r&&(0,W.jsx)(v,{sessionId:l,cwd:u,streaming:T,view:t.view,onViewChange:e=>Q({type:`view`,id:t.id,patch:e})}):n.id===`sources`?r&&(0,W.jsx)(_,{sources:f,view:t.view,onViewChange:e=>Q({type:`view`,id:t.id,patch:e})}):n.id===`terminal`?r&&(0,W.jsx)(d,{sessionId:l,cwd:u,terminalId:t.resourceId||void 0,onCreated:e=>V.getState().update(l,g,{type:`resource`,id:t.id,resourceId:e})}):n.id===`processes`?r&&(0,W.jsx)(p,{view:t.view,onViewChange:e=>Q({type:`view`,id:t.id,patch:e}),sessionId:l,onOpenTerminal:e=>Q({type:`open`,kind:`terminal`,resourceId:e})}):n.id===`side-chat`?(0,W.jsx)(h,{parentId:l,active:r}):n.id===`browser`?(0,W.jsx)(y,{sessionId:l,page:t,onChange:e=>Q({type:`browser`,id:t.id,...e}),onClosed:()=>Q({type:`close`,id:t.id})}):r&&(n.id===`files`?(0,W.jsx)(ie,{view:t.view,onViewChange:e=>Q({type:`view`,id:t.id,patch:e}),sessionId:l,streaming:T,requestConfirm:M}):(0,W.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-3`,children:x?.items?.length?(0,W.jsx)(m,{plan:x,running:T}):(0,W.jsx)(B,{compact:!0,title:G(`chat:sessionContext.planEmpty`)})}))},t.id)})]});return t?(0,W.jsx)(ee,{open:!0,onOpenChange:e=>!e&&z(),children:(0,W.jsxs)(I,{id:e,side:`right`,showCloseButton:!1,className:`gap-0 overflow-hidden p-0`,style:{top:`var(--pisper-safe-area-top)`,right:`var(--pisper-safe-area-right)`,bottom:`var(--pisper-safe-area-bottom)`,height:`auto`,width:`min(calc(100vw - var(--pisper-safe-area-left) - var(--pisper-safe-area-right)), 420px)`,maxWidth:`none`},children:[(0,W.jsx)(F,{className:`sr-only`,children:(0,W.jsx)(L,{children:G(`chat:sessionContext.title`)})}),fe]})}):(0,W.jsx)(`aside`,{id:e,tabIndex:n?-1:void 0,className:`h-full min-h-0 w-full overflow-hidden border-l border-stroke bg-panel`,"aria-label":G(`chat:sessionContext.title`),children:fe})}export{q as SessionContextPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{u as t}from"./vendor-router-CSN_DGvx.js";import{i as n,r}from"./vendor-react-DwNgTV1j.js";import{f as i,t as a}from"./routes-DIeaqWVc.js";import{t as o}from"./use-i18n-
|
|
1
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{u as t}from"./vendor-router-CSN_DGvx.js";import{i as n,r}from"./vendor-react-DwNgTV1j.js";import{f as i,t as a}from"./routes-DIeaqWVc.js";import{t as o}from"./use-i18n-D6tl7SDi.js";import{n as s,t as c}from"./usePhoneShell-CcoVb1v0.js";import{t as l}from"./PhoneMenuButton-CKS9DzOB.js";import{t as u}from"./button-CCcCN8tE.js";import{t as d}from"./useSessionListQuery-BaBpkejJ.js";import"./public-Cy9CZkvX.js";import{n as f}from"./PageState-Cz6vFMXv.js";import{n as p,r as m}from"./session-home-D75yfsOZ.js";var h=e(n(),1),g=r();function _(e){let{t:n}=o(),r=t(),_=c(),v=s(),y=!_||v,[b]=(0,h.useState)(m),x=d(),S=p({lastId:b,data:x.data,failed:x.isError&&!x.isFetching}),C=S.kind===`session`?i(S.id):S.kind===`draft`?i():``;(0,h.useEffect)(()=>{C&&r(C,{replace:!0,state:a})},[r,C]);let w=(0,g.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-panel`,children:[!y&&(0,g.jsx)(`header`,{className:`flex h-14 shrink-0 items-center bg-panel px-1`,children:(0,g.jsx)(l,{})}),(0,g.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center`,children:S.kind===`error`?(0,g.jsx)(f,{kind:`error`,title:n(`board:home.loadFailed`),description:n(`board:home.loadFailedHint`),action:(0,g.jsxs)(`div`,{className:`flex flex-wrap justify-center gap-2`,children:[(0,g.jsx)(u,{variant:`secondary`,className:`pointer-coarse:min-h-11`,onClick:()=>void x.refetch(),children:n(`navigation:more.retry`)}),(0,g.jsx)(u,{variant:`ghost`,className:`pointer-coarse:min-h-11`,onClick:()=>r(i(),{state:a}),children:n(`board:home.startDraft`)})]})}):(0,g.jsx)(f,{kind:`loading`,title:n(`board:home.loading`)})})]});return(0,g.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,"data-session-shell":y?`desktop`:`phone`,"data-session-home":S.kind,children:(0,g.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1`,children:w})})}export{_ as SessionHome};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-AM3jlRYR.js";import{t as i}from"./useQuery-DfOU-27z.js";import{i as a}from"./runtime-capabilities-B7qveLBm.js";import{t as o}from"./runtime-capabilities-store-D0EC-a9c.js";import{t as s}from"./createLucideIcon-Cd-3GVxJ.js";import{r as c}from"./permission-rules-api-BoggV-So.js";import{t as l}from"./bot-B3TaBp_T.js";import{t as u}from"./check-2vYc6QaP.js";import{a as d,c as f,i as p,l as m,n as h,o as g,r as _,t as v}from"./SessionBrowserPane-CigWhKGU.js";import{c as y}from"./focus-session-composer-bits-BuYWKdXR.js";import{t as b}from"./earth-Ddy13fHh.js";import{t as ee}from"./ellipsis-CfGKfbq6.js";import{o as x}from"./GitDiffViewer-D2QUzasQ.js";import{k as te,m as S}from"./side-chat-context-DNQ3tThq.js";import{t as ne}from"./git-branch-N7LGjtzt.js";import{n as re,t as C}from"./undo-2-C-xQ0UVT.js";import{t as w}from"./message-square-SKjZyY3v.js";import{t as ie}from"./plus-fQbSqB1n.js";import{t as T}from"./refresh-cw-TbWxTY4K.js";import{t as ae}from"./square-terminal-BVG6cUT1.js";import{t as E}from"./wrench-6pg6_bqI.js";import{t as oe}from"./x-07u4-129.js";import{c as D,i as O,p as se,r as ce,t as k}from"./dropdown-menu-Ds0gD8S8.js";import{i as le,n as ue,t as de}from"./popover-BKEwGK6p.js";import{t as fe}from"./segmented-control-xkrEOP_d.js";import{t as A}from"./utils-C8uzG5AZ.js";import{t as j}from"./button-CCcCN8tE.js";import{t as pe}from"./chat-api-CdqM-TFw.js";import{a as M,r as N}from"./format-DMJQzoZ7.js";import{t as me}from"./StatusGlyph-1KgitlUg.js";import{s as he}from"./run-activity-CwfO0cui.js";import{t as ge}from"./session-change-summary-api-CyghX14t.js";import{n as P,t as F}from"./PageState-Cz6vFMXv.js";import{i as _e,n as I,r as ve}from"./MarkdownMessage-DbPFHAG0.js";import{t as ye}from"./route-context-DvWDul4T.js";import{i as L,r as R}from"./session-web-preview-guvsmkWE.js";import"./public-CFmAK4C5.js";import{n as be,r as z}from"./terminal-context-aIsIJPn8.js";import{r as B}from"./session-inspector-store-BocK0l86.js";import{o as V}from"./web-preview-C7DdG9JP.js";var H=s(`folder-search`,[[`path`,{d:`M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1`,key:`1bw5m7`}],[`path`,{d:`m21 21-1.9-1.9`,key:`1g2n9r`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}]]),xe=s(`panel-right-close`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m8 9 3 3-3 3`,key:`12hl5m`}]]),U=e(t(),1),W=n(),G=new Set([`queued`,`starting`,`running`]),K=new Set([`starting`,`running`,`stopping`]);function q(e){return typeof e==`string`?e.trim():``}function J(e,t,n){let r=new Map;for(let i of e){if(i?.type!==t)continue;let e=n(i);e&&r.set(String(e.id||r.size),e)}return[...r.values()]}function Y({startedAt:e}){let[t,n]=(0,U.useState)(()=>Date.now());(0,U.useEffect)(()=>{let e=window.setInterval(()=>n(Date.now()),1e3);return()=>window.clearInterval(e)},[]);let r=he(e,null,t);return r?(0,W.jsx)(`span`,{className:`flex-none font-mono text-xs text-content-muted tabular-nums`,children:y(r)}):null}function Se(e,t){let n=t?J(e,`tool`,e=>e).filter(e=>e.status===`running`):[],r=J(e,`agent`,e=>e.agent&&typeof e.agent==`object`?e.agent:null).filter(e=>G.has(String(e.status)));return n.length+r.length}function Ce({sessionId:e,streaming:t,activity:n}){let{t:i}=r(),a=z(e),o=[...t?J(n,`tool`,e=>e).filter(e=>e.status===`running`).map(e=>{let t=e.args||{};return{key:`tool:${String(e.id)}`,icon:(0,W.jsx)(E,{size:14,"aria-hidden":`true`}),name:q(e.name)||i(`board:inspector.runningTool`),detail:q(t.command)||q(t.path)||q(t.file_path),startedAt:q(e.startedAt),status:i(`board:inspector.runningStatus`)}}):[],...J(n,`agent`,e=>e.agent&&typeof e.agent==`object`?e.agent:null).filter(e=>G.has(String(e.status))).map(e=>({key:`agent:${String(e.id)}`,icon:(0,W.jsx)(l,{size:14,"aria-hidden":`true`}),name:q(e.title)||q(e.taskName)||i(`board:inspector.runningAgent`),detail:q(e.message),startedAt:q(e.startedAt),status:e.status===`queued`?i(`board:inspector.runningQueued`):i(`board:inspector.runningStatus`)})),...a.filter(e=>K.has(e.status)).map(e=>({key:`terminal:${e.id}`,icon:(0,W.jsx)(ae,{size:14,"aria-hidden":`true`}),name:e.profileId||i(`board:inspector.terminal`),detail:e.cwd||``,status:e.status===`stopping`?i(`terminal:workspace.stopping`):i(`board:inspector.runningStatus`)}))];return(0,W.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto p-3`,"data-inspector-running":!0,children:[o.length?(0,W.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-px p-0`,children:o.map(e=>(0,W.jsxs)(`li`,{className:`grid min-w-0 grid-cols-[14px_minmax(0,1fr)_auto] items-start gap-2 py-1.5 text-xs`,"data-running-item":e.key.split(`:`)[0],children:[(0,W.jsx)(`span`,{className:`mt-0.5 text-content-secondary`,children:e.icon}),(0,W.jsxs)(`span`,{className:`grid min-w-0 gap-0.5`,children:[(0,W.jsx)(`strong`,{className:`truncate text-[13px] font-medium text-content`,children:e.name}),e.detail&&(0,W.jsx)(`span`,{className:`min-w-0 truncate font-mono text-content-muted`,title:e.detail,children:e.detail})]}),(0,W.jsxs)(`span`,{className:`flex flex-none items-center gap-2`,children:[(0,W.jsx)(`span`,{className:`text-content-muted`,children:e.status}),(0,W.jsx)(Y,{startedAt:e.startedAt})]})]},e.key))}):(0,W.jsx)(F,{compact:!0,title:i(`board:inspector.runningEmpty`)}),(0,W.jsx)(`p`,{className:`mt-3 text-xs leading-relaxed text-content-faint`,children:i(`board:inspector.runningHint`)})]})}var we={running:{kind:`run`,color:`text-st-run`},starting:{kind:`run`,color:`text-st-run`},queued:{kind:`queued`,color:`text-st-queue`},completed:{kind:`done`,color:`text-st-done`},failed:{kind:`failed`,color:`text-st-fail`},interrupted:{kind:`stopped`,color:`text-st-queue`},blocked:{kind:`queued`,color:`text-st-queue`}};function Te(e,t){return t(e===`queued`?`chat:agentRunActivity.teamTaskQueued`:e===`starting`?`chat:agentRunActivity.teamTaskStarting`:e===`running`?`chat:agentRunActivity.teamTaskRunning`:e===`completed`?`chat:agentRunActivity.teamTaskCompleted`:e===`failed`?`chat:agentRunActivity.teamTaskFailed`:e===`interrupted`?`chat:agentRunActivity.teamTaskInterrupted`:e===`blocked`?`chat:agentRunActivity.teamTaskBlocked`:`chat:agentRunActivity.teamTaskStatusUpdated`)}function Ee(e,t){return e.status===`active`?e.mode===`team`?t(`chat:focusSession.runningAsTeam`):t(`chat:focusSession.runningAutonomously`):e.status===`paused`?t(`chat:focusSession.goalPaused`):e.status===`complete`?t(`chat:focusSession.goalComplete`):e.status===`budget_limited`?t(`chat:focusSession.goalReachedItsBudget`):``}function X({title:e,children:t}){return(0,W.jsxs)(`section`,{className:`grid min-w-0 gap-2`,"aria-label":e,children:[(0,W.jsx)(`h3`,{className:`text-xs font-semibold text-content-secondary`,children:e}),t]})}function De({status:e,name:t,detail:n,t:r}){let i=we[String(e)]??{kind:`queued`,color:`text-st-queue`};return(0,W.jsxs)(`li`,{className:`flex min-w-0 items-start gap-2 py-1.5 text-xs`,children:[(0,W.jsx)(me,{status:i.kind,className:`mt-px size-3.5 ${i.color}`}),(0,W.jsxs)(`span`,{className:`grid min-w-0 flex-1 gap-0.5`,children:[(0,W.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,W.jsx)(`strong`,{className:`min-w-0 truncate font-medium text-content`,children:t}),(0,W.jsx)(`span`,{className:`flex-none text-content-muted`,children:Te(e,r)})]}),n&&(0,W.jsx)(`span`,{className:`min-w-0 break-words text-content-muted`,children:n})]})]})}function Oe(e){let t=new Map;for(let n of e){if(n?.type!==`agent`||!n.agent||typeof n.agent!=`object`)continue;let e=n.agent,r=String(e.id||e.taskName||t.size);t.set(r,e)}return[...t.values()]}function ke({plan:e,streaming:t,goal:n,team:i,activity:a}){let{t:o}=r(),s=Array.isArray(i?.tasks)?i.tasks:[],c=Oe(a),l=!!(n?.id&&String(n.objective||``).trim()),u=!!e?.items?.length;if(!l&&!u&&!s.length&&!c.length)return(0,W.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-3`,children:(0,W.jsx)(F,{compact:!0,icon:re,title:o(`chat:sessionContext.planEmpty`)})});let d=Number(n?.mode===`team`?n?.teamTokenBudget:n?.tokenBudget)||0;return(0,W.jsxs)(`div`,{className:`grid min-h-0 flex-1 content-start gap-5 overflow-y-auto p-3`,"data-inspector-plan":!0,children:[l&&n&&(0,W.jsx)(X,{title:o(`board:inspector.goal`),children:(0,W.jsxs)(`div`,{className:`grid gap-1.5 rounded-md border border-stroke-soft bg-surface-subtle p-3 text-xs`,children:[(0,W.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-content`,children:String(n.objective)}),(0,W.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-2 text-content-muted tabular-nums`,children:[(0,W.jsx)(`span`,{children:Ee(n,o)}),(0,W.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,W.jsx)(`span`,{children:d>0?o(`chat:focusSession.usedBudgetTokensUsed`,{used:N(n.tokensUsed),budget:N(d)}):o(`chat:focusSession.usedUnlimitedGoalTokens`,{used:N(n.tokensUsed)})})]})]})}),u&&(0,W.jsx)(X,{title:o(`board:inspector.plan`),children:(0,W.jsx)(m,{plan:e,running:t})}),s.length>0&&(0,W.jsx)(X,{title:o(`board:inspector.team`),children:(0,W.jsx)(`ul`,{className:`divide-y divide-stroke-soft`,children:s.map((e,t)=>(0,W.jsx)(De,{status:e.status,name:e.taskName||o(`chat:agentRunActivity.subagent`),detail:e.error||e.output||``,t:o},e.id||`${e.taskName}-${t}`))})}),c.length>0&&(0,W.jsx)(X,{title:o(`board:inspector.subAgents`),children:(0,W.jsx)(`ul`,{className:`divide-y divide-stroke-soft`,children:c.map((e,t)=>(0,W.jsx)(De,{status:e.status,name:String(e.taskName||``).trim()||o(`chat:agentRunActivity.subagent`),detail:String(e.error||e.message||``).trim(),t:o},String(e.id||t)))})})]})}function Ae({panelId:e,sessionId:t}){let{t:n}=r(),i=R(e=>e.sessions[t]),a=i?.pages,o=a?.filter(e=>e.kind===`browser`)??[],s=(i&&L(i))?.id??``,c=(a?.length??0)>=12,u=(0,U.useRef)(null),[d,f]=(0,U.useState)([]);s&&!d.includes(s)&&f([...d,s]),(0,U.useEffect)(()=>{u.current?.querySelector(`[role="tab"][aria-selected="true"]`)?.closest(`[data-browser-tab]`)?.scrollIntoView?.({block:`nearest`,inline:`nearest`})},[s]);let p=t=>`${e}-browser-${t}-tab`,m=t=>`${e}-browser-${t}-panel`,h=e=>R.getState().update(t,`browser`,{type:`browser-tab`,id:e}),g=(e,t,n=``)=>requestAnimationFrame(()=>document.querySelector(`[id="${e(t)}"] ${n}`.trim())?.focus()),_=()=>{let e=R.getState(),n=e.sessions[t]?.contentOpen??!1;if(e.update(t,`browser`,{type:`add`,kind:`browser`})===`limit`)return;n||e.update(t,`browser`,{type:`workspace`,contentOpen:!1});let r=R.getState().sessions[t],i=r&&L(r);i&&g(m,i.id,`input`)},y=e=>{let n=R.getState();if(o.length===1){n.update(t,`browser`,{type:`browser`,id:e,url:``,draft:``,agent:!1}),n.update(t,`browser`,{type:`resource`,id:e,resourceId:``});return}n.update(t,`browser`,{type:`close`,id:e});let r=R.getState().sessions[t],i=r&&L(r);i&&g(p,i.id)};return(0,W.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,W.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 border-b border-stroke-soft px-3 py-1.5`,children:[(0,W.jsx)(`div`,{ref:u,role:`tablist`,"aria-label":n(`common:webPreview.tabs`),className:`flex min-w-0 items-center gap-0.5 overflow-x-auto [scrollbar-width:none]`,onKeyDown:e=>{if(!(e.target instanceof HTMLElement)||e.target.getAttribute(`role`)!==`tab`)return;if(e.key===`Delete`){e.preventDefault(),s&&y(s);return}if(![`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key))return;e.preventDefault();let t=o.findIndex(e=>e.id===s),n=e.key===`Home`?0:e.key===`End`?o.length-1:(t+(e.key===`ArrowRight`?1:-1)+o.length)%o.length,r=o[n];r&&(h(r.id),g(p,r.id))},children:o.map(e=>{let t=e.id===s,r=e.title||(e.url?V(e.url):n(`common:webPreview.newTab`)),i=o.length>1||!!(e.url||e.resourceId);return(0,W.jsxs)(`div`,{"data-browser-tab":e.id,className:A(`flex min-w-20 flex-[0_1_10rem] items-center rounded-sm text-[13px] transition-colors duration-(--d-fast)`,t?`bg-solid font-medium text-content shadow-edge ring-1 ring-stroke-strong ring-inset`:`text-content-secondary hover:bg-surface-hover hover:text-content`),onAuxClick:t=>{t.button===1&&i&&y(e.id)},children:[(0,W.jsxs)(`button`,{id:p(e.id),type:`button`,role:`tab`,"aria-selected":t,"aria-controls":m(e.id),tabIndex:t?0:-1,title:e.url||r,className:A(`flex h-7 min-w-0 flex-1 items-center rounded-sm pl-2 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus pointer-coarse:h-11`,!i&&`pr-2`),onClick:()=>h(e.id),children:[e.agent&&(0,W.jsx)(l,{size:12,className:`mr-1 flex-none text-focus`,role:`img`,"aria-label":n(`common:webPreview.agentTab`)}),(0,W.jsx)(`span`,{className:`truncate`,children:r})]}),i&&(0,W.jsx)(`button`,{type:`button`,tabIndex:t?0:-1,"aria-label":`${n(`common:webPreview.closeTab`)} · ${r}`,className:`mx-0.5 grid size-5 flex-none place-items-center rounded-xs text-content-muted hover:bg-surface-hover hover:text-content focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus pointer-coarse:size-11`,onClick:()=>y(e.id),children:(0,W.jsx)(oe,{size:12,"aria-hidden":`true`})})]},e.id)})}),(0,W.jsx)(j,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`flex-none pointer-coarse:size-11`,disabled:c,"aria-label":n(`common:webPreview.newTab`),title:n(c?`chat:sessionContext.pageLimit`:`common:webPreview.newTab`),onClick:_,children:(0,W.jsx)(ie,{"aria-hidden":`true`})})]}),o.filter(e=>d.includes(e.id)).map(e=>{let n=e.id===s;return(0,W.jsx)(`div`,{id:m(e.id),role:`tabpanel`,"aria-labelledby":p(e.id),hidden:!n,className:n?`flex min-h-0 flex-1 flex-col`:`hidden`,children:(0,W.jsx)(v,{sessionId:t,page:e,onChange:n=>R.getState().update(t,`browser`,{type:`browser`,id:e.id,...n}),onClosed:()=>y(e.id)})},e.id)})]})}var Z=100;function je(e){let t=e.trim().toUpperCase();return t===`??`||t.includes(`A`)?`created`:t.includes(`D`)?`deleted`:t.includes(`R`)?`renamed`:t.includes(`M`)?`modified`:`other`}var Q={modified:`M`,created:`A`,deleted:`D`,renamed:`R`,other:`·`},Me={modified:`text-content-secondary`,created:`text-st-done`,deleted:`text-st-fail`,renamed:`text-content-secondary`,other:`text-content-muted`};function Ne(e){let t=e.replace(/\\/g,`/`),n=t.lastIndexOf(`/`);return n<0?{directory:``,name:t}:{directory:t.slice(0,n+1),name:t.slice(n+1)}}function $(e,t){return/^(?:[a-zA-Z]:[\\/]|\/|\\\\)/.test(t)?t:`${e.replace(/[\\/]+$/,``)}/${t}`}function Pe(e,t){window.dispatchEvent(new CustomEvent(ye,{detail:{message:e,tone:t}}))}function Fe({added:e,removed:t}){return e===null||t===null?null:(0,W.jsxs)(`span`,{className:`flex-none font-mono text-xs tabular-nums`,children:[(0,W.jsxs)(`span`,{className:`text-success`,children:[`+`,e]}),` `,(0,W.jsxs)(`span`,{className:`text-danger`,children:[`−`,t]})]})}function Ie({status:e,children:t}){let{t:n}=r();return(0,W.jsxs)(`footer`,{className:`mt-auto flex h-10 shrink-0 items-center gap-2 border-t border-stroke-soft pr-1.5 pl-3 text-xs text-content-muted`,"data-changes-footer":!0,children:[(0,W.jsx)(`span`,{className:`flex min-w-0 flex-1 items-center gap-1.5 truncate`,children:e}),(0,W.jsxs)(k,{children:[(0,W.jsx)(se,{asChild:!0,children:(0,W.jsx)(j,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`pointer-coarse:size-11`,"aria-label":n(`board:changes.more`),title:n(`board:changes.more`),"data-changes-more":!0,children:(0,W.jsx)(ee,{"aria-hidden":`true`})})}),(0,W.jsx)(ce,{align:`end`,side:`top`,className:`min-w-48`,children:t})]})]})}function Le({status:e}){let{t}=r(),n=t(e===`created`?`board:changes.statusCreated`:e===`deleted`?`board:changes.statusDeleted`:e===`renamed`?`board:changes.statusRenamed`:`board:changes.statusModified`);return(0,W.jsxs)(`span`,{className:A(`w-3.5 flex-none text-center font-mono text-xs font-semibold`,Me[e]),title:n,children:[(0,W.jsx)(`span`,{"aria-hidden":`true`,children:Q[e]}),(0,W.jsx)(`span`,{className:`sr-only`,children:n})]})}function Re({files:e,selected:t,label:n,onSelect:r}){let i=(0,U.useRef)(null);return(0,W.jsxs)(`ul`,{ref:i,"aria-label":n,className:`max-h-[34%] min-h-11 shrink-0 overflow-y-auto border-b border-stroke-soft py-1`,onKeyDown:e=>{if(![`ArrowDown`,`ArrowUp`,`Home`,`End`].includes(e.key))return;let t=[...i.current?.querySelectorAll(`[data-change-file]`)??[]],n=t.findIndex(e=>e===document.activeElement),a=t[e.key===`Home`?0:e.key===`End`?t.length-1:Math.min(t.length-1,Math.max(0,n+(e.key===`ArrowDown`?1:-1)))];a&&(e.preventDefault(),a.focus(),r(a.dataset.changeFile||``))},"data-change-list":!0,children:[e.slice(0,Z).map(e=>{let n=e.path===t,{directory:i,name:a}=Ne(e.path);return(0,W.jsx)(`li`,{className:`px-1`,children:(0,W.jsxs)(`button`,{type:`button`,title:e.path,"aria-label":[e.path,Q[e.status],e.added!==null&&e.removed!==null?`+${e.added} −${e.removed}`:``,e.note||``].filter(Boolean).join(` `),"aria-current":n?`true`:void 0,"data-change-file":e.path,className:A(`flex h-8 w-full min-w-0 items-center gap-2 rounded-sm px-2 text-left text-xs transition-colors duration-(--d-fast) focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus max-[650px]:h-11 pointer-coarse:h-11`,n?`bg-solid shadow-[inset_0_0_0_1px_var(--stroke-strong)]`:`hover:bg-surface-hover`),onClick:()=>r(e.path),children:[(0,W.jsx)(Le,{status:e.status}),(0,W.jsxs)(`span`,{className:`flex min-w-0 flex-1 font-mono`,children:[(0,W.jsx)(`span`,{className:`min-w-0 truncate text-content-muted`,children:i}),(0,W.jsx)(`span`,{className:`flex-none text-content`,children:a})]}),e.note&&(0,W.jsx)(`span`,{className:`flex-none text-content-muted`,children:e.note}),(0,W.jsx)(Fe,{added:e.added,removed:e.removed})]})},e.path)}),e.length>Z&&(0,W.jsx)(`li`,{className:`px-3 py-1.5 text-xs text-content-muted tabular-nums`,children:(0,W.jsx)(ze,{count:e.length-Z})})]})}function ze({count:e}){let{t}=r();return(0,W.jsx)(W.Fragment,{children:t(`chat:focusSession.gitMoreFiles`,{count:e})})}var Be=600;function Ve({sessionId:e,file:t,scope:n,revision:i,view:a,onViewChange:o,footer:s}){let{t:c}=r(),l=B(e=>e.diffMode),u=B(e=>e.setDiffMode),d=(0,U.useRef)(null),[p,m]=(0,U.useState)(0);(0,U.useLayoutEffect)(()=>{let e=d.current;if(!e)return;let t=()=>m(e.clientWidth);t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);let h=p===0||p>=Be,g=h?l:`unified`,_=h?void 0:c(`board:changes.splitTooNarrow`);return(0,W.jsxs)(`section`,{ref:d,className:`flex min-h-0 flex-1 flex-col`,"aria-label":t.path,"data-change-detail":t.path,children:[(0,W.jsxs)(`header`,{className:`flex min-h-10 shrink-0 items-center gap-2 border-b border-stroke-soft py-1.5 pr-2 pl-3`,children:[(0,W.jsx)(Le,{status:t.status}),(0,W.jsx)(`strong`,{className:`min-w-0 flex-1 truncate font-mono text-xs font-semibold text-content`,title:t.path,children:t.path}),(0,W.jsx)(Fe,{added:t.added,removed:t.removed}),(0,W.jsx)(fe,{size:`sm`,"aria-label":c(`board:changes.diffView`),title:_,"aria-description":_,value:g,onValueChange:u,options:[{value:`unified`,label:c(`board:changes.unified`)},{value:`split`,label:c(`board:changes.split`),disabled:!h}]})]}),(0,W.jsx)(f,{sessionId:e,path:t.path,scope:n,revision:i,mode:g,fill:!0,position:a?.reading?.[t.path],onReading:e=>o?.({reading:{...a?.reading,[t.path]:e}})},`${n}:${t.path}`),(0,W.jsx)(`footer`,{className:`flex min-h-10 shrink-0 flex-wrap items-center gap-1 border-t border-stroke-soft py-1 pr-1.5 pl-3 text-xs`,children:s})]})}function He({cwd:e,path:t}){let{t:n}=r();if(!window.pisperDesktop||!e)return null;let i=$(e,t);return(0,W.jsxs)(j,{type:`button`,variant:`ghost`,size:`sm`,className:`max-[650px]:h-11`,onClick:async()=>{try{await ve(i,_e),Pe(n(`common:markdownMessage.revealLocalPathOk`,{path:t}),`info`)}catch(e){Pe(e instanceof I&&e.reason===`unavailable`?n(`common:markdownMessage.revealLocalPathUnavailable`):e instanceof I&&e.reason===`timeout`?n(`common:markdownMessage.revealLocalPathTimeout`):n(`common:markdownMessage.revealLocalPathFailed`,{path:t}),`error`)}},children:[(0,W.jsx)(H,{"aria-hidden":`true`}),n(`chat:chatMessage.fileActionReveal`)]})}function Ue(e){return{path:e.path,status:e.status===`created`?`created`:e.status===`deleted`?`deleted`:`modified`,added:e.added,removed:e.removed}}function We(e,t){if(!e)return;let n=[];return e.lineEnding&&n.push(t(`chat:focusSession.fileChangesLineEnding`,{from:e.lineEnding[0].toUpperCase(),to:e.lineEnding[1].toUpperCase()})),e.bom?.[1]?n.push(t(`chat:focusSession.fileChangesBomAdded`)):e.bom&&n.push(t(`chat:focusSession.fileChangesBomRemoved`)),t(`chat:focusSession.fileChangesFormatOnly`,{detail:n.join(` · `)})}function Ge({sessionId:e,cwd:t,streaming:n,view:i,onViewChange:a,requestConfirm:o}){let{t:s,language:c}=r(),{changes:l,loading:d,running:f,snapshotRevision:p,writesDisabled:m,pendingCount:h,reversibleCount:_,displayedError:v,notice:y,runAction:b,refresh:ee}=g({sessionId:e,streaming:n,requestConfirm:o}),x=l?.files??[],te=i?.expandedFiles?.[0],S=x.find(e=>e.path===te)??x[0],ne=e=>a?.({expandedFiles:[e]}),re=(e,t)=>f?.kind===e&&f.path===t,w=n?s(`chat:focusSession.gitWaitForRunToFinish`):void 0;return(0,W.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,"aria-label":s(`chat:focusSession.fileChanges`),"aria-busy":d||!!f,"data-changes-scope":`session`,children:[(0,W.jsx)(`header`,{className:`flex min-h-10 shrink-0 items-center gap-1.5 border-b border-stroke-soft py-1 pr-1.5 pl-3`,children:(0,W.jsxs)(`p`,{className:`flex min-w-0 flex-1 items-center gap-2 text-xs text-content-secondary`,children:[(0,W.jsx)(`span`,{className:`min-w-0 truncate`,children:s(`board:changes.sessionSummary`,{count:l?.summary.files??0})}),l&&l.summary.files>0&&(0,W.jsx)(Fe,{added:l.summary.added,removed:l.summary.removed})]})}),v&&(0,W.jsx)(`p`,{role:`alert`,className:`shrink-0 px-3 pt-2 text-xs text-st-fail`,children:v}),y&&!v&&(0,W.jsx)(`p`,{role:`status`,className:`shrink-0 px-3 pt-2 text-xs text-content-secondary`,children:y}),d&&!l?(0,W.jsx)(P,{kind:`loading`,title:s(`chat:focusSession.gitLoading`)}):x.length?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(Re,{files:x.map(e=>({...Ue(e),note:e.reverted?s(`chat:focusSession.fileChangesReverted`):e.approved?s(`chat:focusSession.fileChangesApproved`):We(e.formatChange,s)})),selected:S?.path??``,label:s(`board:changes.files`),onSelect:ne}),S&&(0,W.jsx)(Ve,{sessionId:e,file:Ue(S),scope:`task`,revision:p,view:i,onViewChange:a,footer:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`span`,{className:A(`mr-auto flex min-w-0 items-center gap-1.5 truncate`,S.approved?`text-st-done`:`text-content-muted`),"data-change-state":S.reverted?`reverted`:S.approved?`approved`:`pending`,children:[S.approved&&!S.reverted&&(0,W.jsx)(u,{className:`size-3.5 flex-none`,"aria-hidden":`true`}),S.reverted?s(`board:changes.revertedAt`,{time:M(S.changedAt,c)}):S.approved?s(`board:changes.approvedAt`,{time:M(S.changedAt,c)}):s(`board:changes.pendingAt`,{time:M(S.changedAt,c)})]}),S.pending&&!S.approved&&!S.reverted&&(0,W.jsxs)(j,{type:`button`,variant:`ghost`,size:`sm`,disabled:m,title:w,onClick:()=>void b({kind:`approve`,path:S.path}),children:[re(`approve`,S.path)?(0,W.jsx)(T,{className:`animate-spin`}):(0,W.jsx)(u,{}),s(`chat:focusSession.fileChangesApproveFile`)]}),(0,W.jsxs)(j,{type:`button`,variant:`ghost`,size:`sm`,disabled:m||S.reverted||!S.canRevert,title:w,onClick:()=>void b({kind:`revert`,path:S.path}),children:[re(`revert`,S.path)?(0,W.jsx)(T,{className:`animate-spin`}):(0,W.jsx)(C,{}),s(`board:changes.revertFile`)]}),(0,W.jsx)(He,{cwd:t,path:S.path})]})})]}):!v&&(0,W.jsx)(F,{compact:!0,title:s(`chat:focusSession.fileChangesEmpty`)}),(0,W.jsxs)(Ie,{status:f?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(T,{className:`size-3.5 flex-none animate-spin`,"aria-hidden":`true`}),f.kind===`approve`?s(`chat:focusSession.fileChangesApproveAll`):s(`board:changes.revertAll`)]}):h>0?s(`board:changes.pending`,{count:h}):null,children:[h>0&&(0,W.jsxs)(O,{disabled:m,title:w,onSelect:()=>void b({kind:`approve`}),children:[(0,W.jsx)(u,{}),s(`chat:focusSession.fileChangesApproveAll`)]}),(l?.summary.files??0)>0&&(0,W.jsxs)(O,{disabled:m||_===0,title:w??s(`chat:focusSession.fileChangesRevertAllDescription`),onSelect:()=>void b({kind:`revert`}),children:[(0,W.jsx)(C,{}),s(`board:changes.revertAll`)]}),(h>0||(l?.summary.files??0)>0)&&(0,W.jsx)(D,{}),(0,W.jsxs)(O,{disabled:d||!!f,onSelect:ee,children:[(0,W.jsx)(T,{}),s(`chat:focusSession.gitRefresh`)]})]})]})}function Ke({sessionId:e,cwd:t,streaming:n,view:a,onViewChange:o}){let{t:s}=r(),c=i({queryKey:[`task-project-changes`,e,t,n],queryFn:({signal:t})=>pe.getVcsChanges(e,{signal:t})}),l=(0,U.useMemo)(()=>S(c.data?.diff||``,c.data?.files.map(e=>e.path)||[],c.data?.diffTruncated),[c.data]),u=c.error?.message||c.data?.error,d=(c.data?.files||[]).map(e=>({path:e.path,status:je(e.status),added:Object.hasOwn(l.files,e.path)?l.files[e.path].added:null,removed:Object.hasOwn(l.files,e.path)?l.files[e.path].removed:null})),f=a?.expandedFiles?.[0],p=d.find(e=>e.path===f)??d[0];return(0,W.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,"aria-label":s(`chat:workbench.projectChanges`),"aria-busy":c.isFetching,"data-changes-scope":`workspace`,children:[(0,W.jsxs)(`header`,{className:`flex min-h-10 shrink-0 items-center gap-1.5 border-b border-stroke-soft py-1 pr-1.5 pl-3`,children:[(0,W.jsxs)(`p`,{className:`flex min-w-0 flex-1 items-center gap-2 text-xs text-content-secondary`,children:[(0,W.jsx)(`span`,{className:`min-w-0 truncate`,children:s(`board:changes.workspaceSummary`,{count:d.length})}),c.data?.isRepo&&!u&&d.length>0&&(0,W.jsx)(Fe,{added:l.added,removed:l.removed})]}),c.data?.branch&&(0,W.jsxs)(`span`,{className:`inline-flex h-5.5 max-w-[40%] min-w-0 flex-none items-center gap-1 rounded-xs border border-stroke px-1.5 font-mono text-xs text-content-secondary`,title:t,children:[(0,W.jsx)(ne,{size:12,className:`flex-none`,"aria-hidden":`true`}),(0,W.jsx)(`span`,{className:`truncate`,children:c.data.branch})]})]}),c.isPending?(0,W.jsx)(P,{kind:`loading`,title:s(`chat:focusSession.gitLoading`)}):u?(0,W.jsx)(`p`,{role:`alert`,className:`p-3 text-xs text-st-fail`,children:u}):c.data?.isRepo?d.length?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(Re,{files:d,selected:p?.path??``,label:s(`board:changes.files`),onSelect:e=>o?.({expandedFiles:[e]})}),p&&(0,W.jsx)(Ve,{sessionId:e,file:p,scope:`project`,revision:c.dataUpdatedAt,view:a,onViewChange:o,footer:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`span`,{className:`mr-auto min-w-0 truncate font-mono text-content-muted`,title:t,children:t}),(0,W.jsx)(He,{cwd:t,path:p.path})]})})]}):(0,W.jsx)(F,{compact:!0,title:s(`chat:focusSession.fileChangesEmpty`)}):(0,W.jsx)(F,{compact:!0,title:s(`chat:workbench.notRepository`)}),(0,W.jsx)(Ie,{status:c.isFetching?(0,W.jsx)(T,{className:`size-3.5 flex-none animate-spin`,"aria-hidden":`true`}):null,children:(0,W.jsxs)(O,{disabled:c.isFetching,onSelect:()=>void c.refetch(),children:[(0,W.jsx)(T,{}),s(`chat:focusSession.gitRefresh`)]})})]})}function qe({sessionId:e,cwd:t,streaming:n,scope:i,onScopeChange:a,vcsAvailable:o,view:s,onViewChange:c,requestConfirm:l}){let{t:u}=r();return(0,W.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,"data-inspector-changes":i,children:[(0,W.jsx)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-stroke-soft px-3 py-2`,children:(0,W.jsx)(fe,{size:`sm`,"aria-label":u(`board:inspector.changesScope`),value:i,onValueChange:a,options:[{value:`session`,label:u(`board:inspector.scopeSession`)},{value:`workspace`,label:u(`board:inspector.scopeWorkspace`),disabled:!o}]})}),s?i===`workspace`?(0,W.jsx)(Ke,{sessionId:e,cwd:t,streaming:n,view:s,onViewChange:c}):(0,W.jsx)(Ge,{sessionId:e,cwd:t,streaming:n,view:s,onViewChange:c,requestConfirm:l}):(0,W.jsx)(`p`,{role:`status`,className:`p-4 text-sm text-content-muted`,children:u(`chat:focusSession.gitLoading`)})]})}var Je=new Set([`changes`,`terminal`,`files`]),Ye=[];function Xe(e,t,n){return e===`changes`?n===`workspace`?`changes`:`files`:e===`terminal`?t:e===`files`?`sources`:e===`preview`?`browser`:e===`side-chat`?`side-chat`:null}function Ze({panelId:e,sessionId:t,cwd:n,streaming:s,plan:l,goal:u,team:f,activity:m,planTab:g,sources:v,mode:y,requestConfirm:ee,onClose:S,onOpenComponents:ne,componentTabs:C,autoFocus:T=!1,remoteMachine:E=!1}){let{t:D}=r(),O=y===`sheet`,se=be(),ce=o(e=>e.capabilities),k=!!se&&a(ce,`terminal`),pe=a(ce,`vcs`),M=B(e=>e.tab),N=B(e=>e.setTab),me=B(e=>e.terminalView),he=B(e=>e.setTerminalView),P=B(e=>e.changesView),_e=B(e=>e.setChangesView),I=R(e=>e.sessions[t]?.pages)??Ye,ve=I.some(e=>e.kind===`side-chat`),ye=E?`running`:`changes`,L=M===`side-chat`&&!ve||M===`plan`&&!g||E&&Je.has(M)?ye:M,z=Xe(L,me,P),V=z?I.find(e=>e.kind===z):void 0,H=!O&&C?C.tabs(n):[],[G,K]=(0,U.useState)(null),[q,J]=(0,U.useState)(!1),Y=H.some(e=>e.id===G)?G:null;(0,U.useEffect)(()=>K(null),[M]);let we=(0,U.useRef)(null);(0,U.useEffect)(()=>{we.current?.querySelector(`[role="tab"][aria-selected="true"]`)?.scrollIntoView?.({block:`nearest`,inline:`nearest`})},[L,Y]);let Te=(0,U.useRef)(T);(0,U.useEffect)(()=>{if(!Te.current)return;let e=requestAnimationFrame(()=>we.current?.querySelector(`[role="tab"][aria-selected="true"]`)?.focus({preventScroll:!0}));return()=>cancelAnimationFrame(e)},[]),(0,U.useEffect)(()=>{if(!z||V||(z===`terminal`||z===`processes`)&&!k)return;let e=R.getState(),n=e.sessions[t]?.contentOpen??!1;e.update(t,z,{type:`add`,kind:z}),n||e.update(t,z,{type:`workspace`,contentOpen:!1})},[z,V,t,k]);let Ee=i({queryKey:[`session-change-summary`,t,s],queryFn:()=>ge(t),staleTime:1e4}),X=Ee.data?.status===`known`?Ee.data.changedFiles??0:0,De=Se(m,s),Oe=[...E?[]:[{id:`changes`,icon:x,label:X>0?D(`board:inspector.changesCount`,{count:X}):D(`board:inspector.changes`)},{id:`terminal`,icon:ae,label:D(`board:inspector.terminal`)}],{id:`running`,icon:c,label:De?D(`board:inspector.runningCount`,{count:De}):D(`board:inspector.running`)},...E?[]:[{id:`files`,icon:te,label:D(`board:inspector.files`)}],{id:`preview`,icon:b,label:D(`board:inspector.preview`)},...g?[{id:`plan`,icon:re,label:D(`board:inspector.plan`)}]:[],...ve?[{id:`side-chat`,icon:w,label:D(`board:inspector.sideChat`)}]:[]],Z=e=>{V&&R.getState().update(t,V.kind,{type:`view`,id:V.id,patch:e})},je=()=>{let n=I.find(e=>e.kind===`side-chat`);if(n&&R.getState().update(t,`side-chat`,{type:`close`,id:n.id}),N(`changes`),O){S();return}requestAnimationFrame(()=>document.getElementById(`${e}-changes-tab`)?.focus())},Q=t=>`${e}-component-${t}-tab`,Me=e=>{K(null),N(e)},Ne=t=>{if(![`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(t.key))return;t.preventDefault();let n=[...Oe.map(t=>({fixed:t.id,id:`${e}-${t.id}-tab`})),...H.map(e=>({component:e.id,id:Q(e.id)}))],r=n.findIndex(e=>Y?e.component===Y:e.fixed===L),i=n[t.key===`Home`?0:t.key===`End`?n.length-1:(r+(t.key===`ArrowRight`?1:-1)+n.length)%n.length];i.component?K(i.component):i.fixed&&Me(i.fixed),requestAnimationFrame(()=>document.getElementById(i.id)?.focus())},$=(0,W.jsx)(`p`,{role:`status`,className:`p-4 text-sm text-content-muted`,children:D(`chat:focusSession.gitLoading`)}),Pe;return Pe=Y&&C?C.render(Y,{sessionId:t,cwd:n}):L===`changes`?(0,W.jsx)(qe,{sessionId:t,cwd:n,streaming:s,scope:P,onScopeChange:_e,vcsAvailable:pe,view:V?.view,onViewChange:V?Z:void 0,requestConfirm:ee}):L===`terminal`?k?(0,W.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,W.jsx)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-stroke-soft px-3 py-2`,children:(0,W.jsx)(fe,{size:`sm`,"aria-label":D(`board:inspector.terminalScope`),value:me,onValueChange:he,options:[{value:`terminal`,label:D(`board:inspector.terminal`)},{value:`processes`,label:D(`board:inspector.processes`)}]})}),(0,W.jsx)(U.Suspense,{fallback:$,children:V?me===`processes`?(0,W.jsx)(p,{sessionId:t,view:V.view,onViewChange:Z,onOpenTerminal:e=>{let n=R.getState(),r=n.sessions[t]?.pages.find(e=>e.kind===`terminal`);r?n.update(t,`terminal`,{type:`resource`,id:r.id,resourceId:e}):n.update(t,`terminal`,{type:`open`,kind:`terminal`,resourceId:e}),he(`terminal`)}}):(0,W.jsx)(d,{sessionId:t,cwd:n,terminalId:V.resourceId||void 0,onCreated:e=>R.getState().update(t,`terminal`,{type:`resource`,id:V.id,resourceId:e})},V.id):$})]}):(0,W.jsx)(F,{compact:!0,icon:ae,title:D(`board:inspector.terminalUnavailable`)}):L===`files`?V?(0,W.jsx)(_,{sources:v,view:V.view,onViewChange:Z}):$:L===`preview`?V?(0,W.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,"data-inspector-preview":!0,children:(0,W.jsx)(Ae,{panelId:e,sessionId:t},t)}):$:L===`plan`?(0,W.jsx)(ke,{plan:l,streaming:s,goal:u,team:f,activity:m}):L===`running`?(0,W.jsx)(Ce,{sessionId:t,streaming:s,activity:m}):(0,W.jsx)(h,{parentId:t,active:!0}),(0,W.jsxs)(`section`,{id:e,"aria-label":D(`board:inspector.label`),"data-session-inspector":y,"data-inspector-tab":L,"data-inspector-component":Y??void 0,className:`flex h-full min-h-0 w-full min-w-0 flex-col bg-panel text-content`,children:[(0,W.jsxs)(`header`,{className:A(`flex shrink-0 items-center gap-1 border-b border-stroke-soft pr-1.5 pl-2`,O?`h-[52px]`:y===`aside`?`h-[52px] [[data-custom-titlebar]_&]:h-11 [[data-custom-titlebar]_&]:pointer-coarse:h-[52px]`:`h-11 pointer-coarse:h-[52px]`),children:[(0,W.jsxs)(`div`,{ref:we,role:`tablist`,"aria-label":D(`board:inspector.tabs`),className:`flex min-w-0 flex-1 items-center gap-0.5 overflow-x-auto [scrollbar-width:none]`,onKeyDown:Ne,children:[Oe.map(({id:t,icon:n,label:r})=>{let i=!Y&&t===L;return(0,W.jsxs)(`button`,{id:`${e}-${t}-tab`,type:`button`,role:`tab`,"aria-selected":i,"aria-controls":`${e}-body`,tabIndex:i?0:-1,"data-inspector-tab-id":t,className:A(`flex flex-none items-center gap-1.5 rounded-sm px-2 text-[13px] whitespace-nowrap transition-colors duration-(--d-fast) focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus`,O?`h-11 min-w-11 justify-center px-2.5`:`h-8 pointer-coarse:h-11 pointer-coarse:min-w-11`,i?`bg-solid font-medium text-content shadow-edge ring-1 ring-stroke-strong ring-inset`:`text-content-secondary hover:bg-surface-hover hover:text-content`),onClick:()=>Me(t),children:[!O&&(0,W.jsx)(n,{className:`size-3.5`,"aria-hidden":`true`}),r]},t)}),!Y&&L===`side-chat`&&(0,W.jsx)(j,{type:`button`,variant:`ghost`,size:`icon-sm`,className:A(O&&`size-11`),"aria-label":D(`board:inspector.closeTab`,{tab:D(`board:inspector.sideChat`)}),onClick:je,children:(0,W.jsx)(oe,{"aria-hidden":`true`})}),!O&&(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`mx-1 h-4 w-px flex-none bg-stroke`}),H.map(({id:t,label:n})=>{let r=t===Y;return(0,W.jsx)(`button`,{id:Q(t),type:`button`,role:`tab`,"aria-selected":r,"aria-controls":`${e}-body`,tabIndex:r?0:-1,"data-inspector-component-tab":t,className:A(`flex h-8 max-w-40 flex-none items-center rounded-sm px-2 text-[13px] whitespace-nowrap transition-colors duration-(--d-fast) focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus pointer-coarse:h-11 pointer-coarse:min-w-11`,r?`bg-solid font-medium text-content shadow-edge ring-1 ring-stroke-strong ring-inset`:`text-content-secondary hover:bg-surface-hover hover:text-content`),onClick:()=>K(t),children:(0,W.jsx)(`span`,{className:`truncate`,children:n})},t)})]}),!O&&(0,W.jsxs)(de,{open:q,onOpenChange:J,children:[(0,W.jsx)(le,{asChild:!0,children:(0,W.jsx)(j,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`flex-none`,"aria-label":D(`board:inspector.add`),title:D(`board:inspector.add`),"data-inspector-component-add":!0,children:(0,W.jsx)(ie,{"aria-hidden":`true`})})}),(0,W.jsxs)(ue,{align:`end`,className:`w-64 text-xs`,children:[C?.addMenu?C.addMenu({cwd:n,onAdded:e=>{K(e),J(!1)}}):(0,W.jsx)(`p`,{className:`text-content-secondary`,children:D(`board:inspector.addHint`)}),ne&&(0,W.jsx)(j,{type:`button`,variant:`secondary`,size:`sm`,className:`self-start`,onClick:ne,children:D(`board:inspector.openComponents`)})]})]}),(0,W.jsx)(j,{type:`button`,variant:`ghost`,size:`icon-sm`,className:A(`flex-none`,O&&`size-11`),"aria-label":D(`board:inspector.close`),title:D(`board:inspector.close`),"aria-controls":e,onClick:S,children:y===`aside`?(0,W.jsx)(xe,{"aria-hidden":`true`}):(0,W.jsx)(oe,{"aria-hidden":`true`})})]}),(0,W.jsx)(`div`,{id:`${e}-body`,role:`tabpanel`,"aria-labelledby":Y?Q(Y):`${e}-${L}-tab`,className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:Pe})]})}export{Ze as SessionInspector};
|
|
1
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-D6tl7SDi.js";import{t as i}from"./useQuery-DfOU-27z.js";import{i as a}from"./runtime-capabilities-B7qveLBm.js";import{t as o}from"./runtime-capabilities-store-DoZOSQiv.js";import{t as s}from"./createLucideIcon-Cd-3GVxJ.js";import{r as c}from"./permission-rules-api-B3tMaJim.js";import{t as l}from"./bot-B3TaBp_T.js";import{t as u}from"./check-2vYc6QaP.js";import{a as d,c as f,i as p,l as m,n as h,o as g,r as _,t as v}from"./SessionBrowserPane-Dsf4QuHa.js";import{c as y}from"./focus-session-composer-bits-CVCWWebM.js";import{t as b}from"./earth-Ddy13fHh.js";import{t as ee}from"./ellipsis-CfGKfbq6.js";import{o as x}from"./GitDiffViewer-Dc46yAUc.js";import{k as te,m as S}from"./side-chat-context-BXN0j7F9.js";import{t as ne}from"./git-branch-N7LGjtzt.js";import{n as re,t as C}from"./undo-2-C-xQ0UVT.js";import{t as w}from"./message-square-SKjZyY3v.js";import{t as ie}from"./plus-fQbSqB1n.js";import{t as T}from"./refresh-cw-TbWxTY4K.js";import{t as ae}from"./square-terminal-BVG6cUT1.js";import{t as E}from"./wrench-6pg6_bqI.js";import{t as oe}from"./x-07u4-129.js";import{c as D,i as O,p as se,r as ce,t as k}from"./dropdown-menu-Ds0gD8S8.js";import{i as le,n as ue,t as de}from"./popover-CXY-wqxd.js";import{t as fe}from"./segmented-control-xkrEOP_d.js";import{t as A}from"./utils-C8uzG5AZ.js";import{t as j}from"./button-CCcCN8tE.js";import{t as pe}from"./chat-api-H18lBlnu.js";import{a as M,r as N}from"./format-DMJQzoZ7.js";import{t as me}from"./StatusGlyph-1KgitlUg.js";import{s as he}from"./run-activity-CwfO0cui.js";import{t as ge}from"./session-change-summary-api-BbviMo7L.js";import{n as P,t as F}from"./PageState-Cz6vFMXv.js";import{i as _e,n as I,r as ve}from"./MarkdownMessage-BYQ5qUjo.js";import{t as ye}from"./route-context-DvWDul4T.js";import{i as L,r as R}from"./session-web-preview-guvsmkWE.js";import"./public-DftK6qxa.js";import{n as be,r as z}from"./terminal-context-aIsIJPn8.js";import{r as B}from"./session-inspector-store-D8oaLlKH.js";import{o as V}from"./web-preview-C7DdG9JP.js";var H=s(`folder-search`,[[`path`,{d:`M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1`,key:`1bw5m7`}],[`path`,{d:`m21 21-1.9-1.9`,key:`1g2n9r`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}]]),xe=s(`panel-right-close`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m8 9 3 3-3 3`,key:`12hl5m`}]]),U=e(t(),1),W=n(),G=new Set([`queued`,`starting`,`running`]),K=new Set([`starting`,`running`,`stopping`]);function q(e){return typeof e==`string`?e.trim():``}function J(e,t,n){let r=new Map;for(let i of e){if(i?.type!==t)continue;let e=n(i);e&&r.set(String(e.id||r.size),e)}return[...r.values()]}function Y({startedAt:e}){let[t,n]=(0,U.useState)(()=>Date.now());(0,U.useEffect)(()=>{let e=window.setInterval(()=>n(Date.now()),1e3);return()=>window.clearInterval(e)},[]);let r=he(e,null,t);return r?(0,W.jsx)(`span`,{className:`flex-none font-mono text-xs text-content-muted tabular-nums`,children:y(r)}):null}function Se(e,t){let n=t?J(e,`tool`,e=>e).filter(e=>e.status===`running`):[],r=J(e,`agent`,e=>e.agent&&typeof e.agent==`object`?e.agent:null).filter(e=>G.has(String(e.status)));return n.length+r.length}function Ce({sessionId:e,streaming:t,activity:n}){let{t:i}=r(),a=z(e),o=[...t?J(n,`tool`,e=>e).filter(e=>e.status===`running`).map(e=>{let t=e.args||{};return{key:`tool:${String(e.id)}`,icon:(0,W.jsx)(E,{size:14,"aria-hidden":`true`}),name:q(e.name)||i(`board:inspector.runningTool`),detail:q(t.command)||q(t.path)||q(t.file_path),startedAt:q(e.startedAt),status:i(`board:inspector.runningStatus`)}}):[],...J(n,`agent`,e=>e.agent&&typeof e.agent==`object`?e.agent:null).filter(e=>G.has(String(e.status))).map(e=>({key:`agent:${String(e.id)}`,icon:(0,W.jsx)(l,{size:14,"aria-hidden":`true`}),name:q(e.title)||q(e.taskName)||i(`board:inspector.runningAgent`),detail:q(e.message),startedAt:q(e.startedAt),status:e.status===`queued`?i(`board:inspector.runningQueued`):i(`board:inspector.runningStatus`)})),...a.filter(e=>K.has(e.status)).map(e=>({key:`terminal:${e.id}`,icon:(0,W.jsx)(ae,{size:14,"aria-hidden":`true`}),name:e.profileId||i(`board:inspector.terminal`),detail:e.cwd||``,status:e.status===`stopping`?i(`terminal:workspace.stopping`):i(`board:inspector.runningStatus`)}))];return(0,W.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto p-3`,"data-inspector-running":!0,children:[o.length?(0,W.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-px p-0`,children:o.map(e=>(0,W.jsxs)(`li`,{className:`grid min-w-0 grid-cols-[14px_minmax(0,1fr)_auto] items-start gap-2 py-1.5 text-xs`,"data-running-item":e.key.split(`:`)[0],children:[(0,W.jsx)(`span`,{className:`mt-0.5 text-content-secondary`,children:e.icon}),(0,W.jsxs)(`span`,{className:`grid min-w-0 gap-0.5`,children:[(0,W.jsx)(`strong`,{className:`truncate text-[13px] font-medium text-content`,children:e.name}),e.detail&&(0,W.jsx)(`span`,{className:`min-w-0 truncate font-mono text-content-muted`,title:e.detail,children:e.detail})]}),(0,W.jsxs)(`span`,{className:`flex flex-none items-center gap-2`,children:[(0,W.jsx)(`span`,{className:`text-content-muted`,children:e.status}),(0,W.jsx)(Y,{startedAt:e.startedAt})]})]},e.key))}):(0,W.jsx)(F,{compact:!0,title:i(`board:inspector.runningEmpty`)}),(0,W.jsx)(`p`,{className:`mt-3 text-xs leading-relaxed text-content-faint`,children:i(`board:inspector.runningHint`)})]})}var we={running:{kind:`run`,color:`text-st-run`},starting:{kind:`run`,color:`text-st-run`},queued:{kind:`queued`,color:`text-st-queue`},completed:{kind:`done`,color:`text-st-done`},failed:{kind:`failed`,color:`text-st-fail`},interrupted:{kind:`stopped`,color:`text-st-queue`},blocked:{kind:`queued`,color:`text-st-queue`}};function Te(e,t){return t(e===`queued`?`chat:agentRunActivity.teamTaskQueued`:e===`starting`?`chat:agentRunActivity.teamTaskStarting`:e===`running`?`chat:agentRunActivity.teamTaskRunning`:e===`completed`?`chat:agentRunActivity.teamTaskCompleted`:e===`failed`?`chat:agentRunActivity.teamTaskFailed`:e===`interrupted`?`chat:agentRunActivity.teamTaskInterrupted`:e===`blocked`?`chat:agentRunActivity.teamTaskBlocked`:`chat:agentRunActivity.teamTaskStatusUpdated`)}function Ee(e,t){return e.status===`active`?e.mode===`team`?t(`chat:focusSession.runningAsTeam`):t(`chat:focusSession.runningAutonomously`):e.status===`paused`?t(`chat:focusSession.goalPaused`):e.status===`complete`?t(`chat:focusSession.goalComplete`):e.status===`budget_limited`?t(`chat:focusSession.goalReachedItsBudget`):``}function X({title:e,children:t}){return(0,W.jsxs)(`section`,{className:`grid min-w-0 gap-2`,"aria-label":e,children:[(0,W.jsx)(`h3`,{className:`text-xs font-semibold text-content-secondary`,children:e}),t]})}function De({status:e,name:t,detail:n,t:r}){let i=we[String(e)]??{kind:`queued`,color:`text-st-queue`};return(0,W.jsxs)(`li`,{className:`flex min-w-0 items-start gap-2 py-1.5 text-xs`,children:[(0,W.jsx)(me,{status:i.kind,className:`mt-px size-3.5 ${i.color}`}),(0,W.jsxs)(`span`,{className:`grid min-w-0 flex-1 gap-0.5`,children:[(0,W.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,W.jsx)(`strong`,{className:`min-w-0 truncate font-medium text-content`,children:t}),(0,W.jsx)(`span`,{className:`flex-none text-content-muted`,children:Te(e,r)})]}),n&&(0,W.jsx)(`span`,{className:`min-w-0 break-words text-content-muted`,children:n})]})]})}function Oe(e){let t=new Map;for(let n of e){if(n?.type!==`agent`||!n.agent||typeof n.agent!=`object`)continue;let e=n.agent,r=String(e.id||e.taskName||t.size);t.set(r,e)}return[...t.values()]}function ke({plan:e,streaming:t,goal:n,team:i,activity:a}){let{t:o}=r(),s=Array.isArray(i?.tasks)?i.tasks:[],c=Oe(a),l=!!(n?.id&&String(n.objective||``).trim()),u=!!e?.items?.length;if(!l&&!u&&!s.length&&!c.length)return(0,W.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-3`,children:(0,W.jsx)(F,{compact:!0,icon:re,title:o(`chat:sessionContext.planEmpty`)})});let d=Number(n?.mode===`team`?n?.teamTokenBudget:n?.tokenBudget)||0;return(0,W.jsxs)(`div`,{className:`grid min-h-0 flex-1 content-start gap-5 overflow-y-auto p-3`,"data-inspector-plan":!0,children:[l&&n&&(0,W.jsx)(X,{title:o(`board:inspector.goal`),children:(0,W.jsxs)(`div`,{className:`grid gap-1.5 rounded-md border border-stroke-soft bg-surface-subtle p-3 text-xs`,children:[(0,W.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-content`,children:String(n.objective)}),(0,W.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-2 text-content-muted tabular-nums`,children:[(0,W.jsx)(`span`,{children:Ee(n,o)}),(0,W.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,W.jsx)(`span`,{children:d>0?o(`chat:focusSession.usedBudgetTokensUsed`,{used:N(n.tokensUsed),budget:N(d)}):o(`chat:focusSession.usedUnlimitedGoalTokens`,{used:N(n.tokensUsed)})})]})]})}),u&&(0,W.jsx)(X,{title:o(`board:inspector.plan`),children:(0,W.jsx)(m,{plan:e,running:t})}),s.length>0&&(0,W.jsx)(X,{title:o(`board:inspector.team`),children:(0,W.jsx)(`ul`,{className:`divide-y divide-stroke-soft`,children:s.map((e,t)=>(0,W.jsx)(De,{status:e.status,name:e.taskName||o(`chat:agentRunActivity.subagent`),detail:e.error||e.output||``,t:o},e.id||`${e.taskName}-${t}`))})}),c.length>0&&(0,W.jsx)(X,{title:o(`board:inspector.subAgents`),children:(0,W.jsx)(`ul`,{className:`divide-y divide-stroke-soft`,children:c.map((e,t)=>(0,W.jsx)(De,{status:e.status,name:String(e.taskName||``).trim()||o(`chat:agentRunActivity.subagent`),detail:String(e.error||e.message||``).trim(),t:o},String(e.id||t)))})})]})}function Ae({panelId:e,sessionId:t}){let{t:n}=r(),i=R(e=>e.sessions[t]),a=i?.pages,o=a?.filter(e=>e.kind===`browser`)??[],s=(i&&L(i))?.id??``,c=(a?.length??0)>=12,u=(0,U.useRef)(null),[d,f]=(0,U.useState)([]);s&&!d.includes(s)&&f([...d,s]),(0,U.useEffect)(()=>{u.current?.querySelector(`[role="tab"][aria-selected="true"]`)?.closest(`[data-browser-tab]`)?.scrollIntoView?.({block:`nearest`,inline:`nearest`})},[s]);let p=t=>`${e}-browser-${t}-tab`,m=t=>`${e}-browser-${t}-panel`,h=e=>R.getState().update(t,`browser`,{type:`browser-tab`,id:e}),g=(e,t,n=``)=>requestAnimationFrame(()=>document.querySelector(`[id="${e(t)}"] ${n}`.trim())?.focus()),_=()=>{let e=R.getState(),n=e.sessions[t]?.contentOpen??!1;if(e.update(t,`browser`,{type:`add`,kind:`browser`})===`limit`)return;n||e.update(t,`browser`,{type:`workspace`,contentOpen:!1});let r=R.getState().sessions[t],i=r&&L(r);i&&g(m,i.id,`input`)},y=e=>{let n=R.getState();if(o.length===1){n.update(t,`browser`,{type:`browser`,id:e,url:``,draft:``,agent:!1}),n.update(t,`browser`,{type:`resource`,id:e,resourceId:``});return}n.update(t,`browser`,{type:`close`,id:e});let r=R.getState().sessions[t],i=r&&L(r);i&&g(p,i.id)};return(0,W.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,W.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 border-b border-stroke-soft px-3 py-1.5`,children:[(0,W.jsx)(`div`,{ref:u,role:`tablist`,"aria-label":n(`common:webPreview.tabs`),className:`flex min-w-0 items-center gap-0.5 overflow-x-auto [scrollbar-width:none]`,onKeyDown:e=>{if(!(e.target instanceof HTMLElement)||e.target.getAttribute(`role`)!==`tab`)return;if(e.key===`Delete`){e.preventDefault(),s&&y(s);return}if(![`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key))return;e.preventDefault();let t=o.findIndex(e=>e.id===s),n=e.key===`Home`?0:e.key===`End`?o.length-1:(t+(e.key===`ArrowRight`?1:-1)+o.length)%o.length,r=o[n];r&&(h(r.id),g(p,r.id))},children:o.map(e=>{let t=e.id===s,r=e.title||(e.url?V(e.url):n(`common:webPreview.newTab`)),i=o.length>1||!!(e.url||e.resourceId);return(0,W.jsxs)(`div`,{"data-browser-tab":e.id,className:A(`flex min-w-20 flex-[0_1_10rem] items-center rounded-sm text-[13px] transition-colors duration-(--d-fast)`,t?`bg-solid font-medium text-content shadow-edge ring-1 ring-stroke-strong ring-inset`:`text-content-secondary hover:bg-surface-hover hover:text-content`),onAuxClick:t=>{t.button===1&&i&&y(e.id)},children:[(0,W.jsxs)(`button`,{id:p(e.id),type:`button`,role:`tab`,"aria-selected":t,"aria-controls":m(e.id),tabIndex:t?0:-1,title:e.url||r,className:A(`flex h-7 min-w-0 flex-1 items-center rounded-sm pl-2 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus pointer-coarse:h-11`,!i&&`pr-2`),onClick:()=>h(e.id),children:[e.agent&&(0,W.jsx)(l,{size:12,className:`mr-1 flex-none text-focus`,role:`img`,"aria-label":n(`common:webPreview.agentTab`)}),(0,W.jsx)(`span`,{className:`truncate`,children:r})]}),i&&(0,W.jsx)(`button`,{type:`button`,tabIndex:t?0:-1,"aria-label":`${n(`common:webPreview.closeTab`)} · ${r}`,className:`mx-0.5 grid size-5 flex-none place-items-center rounded-xs text-content-muted hover:bg-surface-hover hover:text-content focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus pointer-coarse:size-11`,onClick:()=>y(e.id),children:(0,W.jsx)(oe,{size:12,"aria-hidden":`true`})})]},e.id)})}),(0,W.jsx)(j,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`flex-none pointer-coarse:size-11`,disabled:c,"aria-label":n(`common:webPreview.newTab`),title:n(c?`chat:sessionContext.pageLimit`:`common:webPreview.newTab`),onClick:_,children:(0,W.jsx)(ie,{"aria-hidden":`true`})})]}),o.filter(e=>d.includes(e.id)).map(e=>{let n=e.id===s;return(0,W.jsx)(`div`,{id:m(e.id),role:`tabpanel`,"aria-labelledby":p(e.id),hidden:!n,className:n?`flex min-h-0 flex-1 flex-col`:`hidden`,children:(0,W.jsx)(v,{sessionId:t,page:e,onChange:n=>R.getState().update(t,`browser`,{type:`browser`,id:e.id,...n}),onClosed:()=>y(e.id)})},e.id)})]})}var Z=100;function je(e){let t=e.trim().toUpperCase();return t===`??`||t.includes(`A`)?`created`:t.includes(`D`)?`deleted`:t.includes(`R`)?`renamed`:t.includes(`M`)?`modified`:`other`}var Q={modified:`M`,created:`A`,deleted:`D`,renamed:`R`,other:`·`},Me={modified:`text-content-secondary`,created:`text-st-done`,deleted:`text-st-fail`,renamed:`text-content-secondary`,other:`text-content-muted`};function Ne(e){let t=e.replace(/\\/g,`/`),n=t.lastIndexOf(`/`);return n<0?{directory:``,name:t}:{directory:t.slice(0,n+1),name:t.slice(n+1)}}function $(e,t){return/^(?:[a-zA-Z]:[\\/]|\/|\\\\)/.test(t)?t:`${e.replace(/[\\/]+$/,``)}/${t}`}function Pe(e,t){window.dispatchEvent(new CustomEvent(ye,{detail:{message:e,tone:t}}))}function Fe({added:e,removed:t}){return e===null||t===null?null:(0,W.jsxs)(`span`,{className:`flex-none font-mono text-xs tabular-nums`,children:[(0,W.jsxs)(`span`,{className:`text-success`,children:[`+`,e]}),` `,(0,W.jsxs)(`span`,{className:`text-danger`,children:[`−`,t]})]})}function Ie({status:e,children:t}){let{t:n}=r();return(0,W.jsxs)(`footer`,{className:`mt-auto flex h-10 shrink-0 items-center gap-2 border-t border-stroke-soft pr-1.5 pl-3 text-xs text-content-muted`,"data-changes-footer":!0,children:[(0,W.jsx)(`span`,{className:`flex min-w-0 flex-1 items-center gap-1.5 truncate`,children:e}),(0,W.jsxs)(k,{children:[(0,W.jsx)(se,{asChild:!0,children:(0,W.jsx)(j,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`pointer-coarse:size-11`,"aria-label":n(`board:changes.more`),title:n(`board:changes.more`),"data-changes-more":!0,children:(0,W.jsx)(ee,{"aria-hidden":`true`})})}),(0,W.jsx)(ce,{align:`end`,side:`top`,className:`min-w-48`,children:t})]})]})}function Le({status:e}){let{t}=r(),n=t(e===`created`?`board:changes.statusCreated`:e===`deleted`?`board:changes.statusDeleted`:e===`renamed`?`board:changes.statusRenamed`:`board:changes.statusModified`);return(0,W.jsxs)(`span`,{className:A(`w-3.5 flex-none text-center font-mono text-xs font-semibold`,Me[e]),title:n,children:[(0,W.jsx)(`span`,{"aria-hidden":`true`,children:Q[e]}),(0,W.jsx)(`span`,{className:`sr-only`,children:n})]})}function Re({files:e,selected:t,label:n,onSelect:r}){let i=(0,U.useRef)(null);return(0,W.jsxs)(`ul`,{ref:i,"aria-label":n,className:`max-h-[34%] min-h-11 shrink-0 overflow-y-auto border-b border-stroke-soft py-1`,onKeyDown:e=>{if(![`ArrowDown`,`ArrowUp`,`Home`,`End`].includes(e.key))return;let t=[...i.current?.querySelectorAll(`[data-change-file]`)??[]],n=t.findIndex(e=>e===document.activeElement),a=t[e.key===`Home`?0:e.key===`End`?t.length-1:Math.min(t.length-1,Math.max(0,n+(e.key===`ArrowDown`?1:-1)))];a&&(e.preventDefault(),a.focus(),r(a.dataset.changeFile||``))},"data-change-list":!0,children:[e.slice(0,Z).map(e=>{let n=e.path===t,{directory:i,name:a}=Ne(e.path);return(0,W.jsx)(`li`,{className:`px-1`,children:(0,W.jsxs)(`button`,{type:`button`,title:e.path,"aria-label":[e.path,Q[e.status],e.added!==null&&e.removed!==null?`+${e.added} −${e.removed}`:``,e.note||``].filter(Boolean).join(` `),"aria-current":n?`true`:void 0,"data-change-file":e.path,className:A(`flex h-8 w-full min-w-0 items-center gap-2 rounded-sm px-2 text-left text-xs transition-colors duration-(--d-fast) focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus max-[650px]:h-11 pointer-coarse:h-11`,n?`bg-solid shadow-[inset_0_0_0_1px_var(--stroke-strong)]`:`hover:bg-surface-hover`),onClick:()=>r(e.path),children:[(0,W.jsx)(Le,{status:e.status}),(0,W.jsxs)(`span`,{className:`flex min-w-0 flex-1 font-mono`,children:[(0,W.jsx)(`span`,{className:`min-w-0 truncate text-content-muted`,children:i}),(0,W.jsx)(`span`,{className:`flex-none text-content`,children:a})]}),e.note&&(0,W.jsx)(`span`,{className:`flex-none text-content-muted`,children:e.note}),(0,W.jsx)(Fe,{added:e.added,removed:e.removed})]})},e.path)}),e.length>Z&&(0,W.jsx)(`li`,{className:`px-3 py-1.5 text-xs text-content-muted tabular-nums`,children:(0,W.jsx)(ze,{count:e.length-Z})})]})}function ze({count:e}){let{t}=r();return(0,W.jsx)(W.Fragment,{children:t(`chat:focusSession.gitMoreFiles`,{count:e})})}var Be=600;function Ve({sessionId:e,file:t,scope:n,revision:i,view:a,onViewChange:o,footer:s}){let{t:c}=r(),l=B(e=>e.diffMode),u=B(e=>e.setDiffMode),d=(0,U.useRef)(null),[p,m]=(0,U.useState)(0);(0,U.useLayoutEffect)(()=>{let e=d.current;if(!e)return;let t=()=>m(e.clientWidth);t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);let h=p===0||p>=Be,g=h?l:`unified`,_=h?void 0:c(`board:changes.splitTooNarrow`);return(0,W.jsxs)(`section`,{ref:d,className:`flex min-h-0 flex-1 flex-col`,"aria-label":t.path,"data-change-detail":t.path,children:[(0,W.jsxs)(`header`,{className:`flex min-h-10 shrink-0 items-center gap-2 border-b border-stroke-soft py-1.5 pr-2 pl-3`,children:[(0,W.jsx)(Le,{status:t.status}),(0,W.jsx)(`strong`,{className:`min-w-0 flex-1 truncate font-mono text-xs font-semibold text-content`,title:t.path,children:t.path}),(0,W.jsx)(Fe,{added:t.added,removed:t.removed}),(0,W.jsx)(fe,{size:`sm`,"aria-label":c(`board:changes.diffView`),title:_,"aria-description":_,value:g,onValueChange:u,options:[{value:`unified`,label:c(`board:changes.unified`)},{value:`split`,label:c(`board:changes.split`),disabled:!h}]})]}),(0,W.jsx)(f,{sessionId:e,path:t.path,scope:n,revision:i,mode:g,fill:!0,position:a?.reading?.[t.path],onReading:e=>o?.({reading:{...a?.reading,[t.path]:e}})},`${n}:${t.path}`),(0,W.jsx)(`footer`,{className:`flex min-h-10 shrink-0 flex-wrap items-center gap-1 border-t border-stroke-soft py-1 pr-1.5 pl-3 text-xs`,children:s})]})}function He({cwd:e,path:t}){let{t:n}=r();if(!window.pisperDesktop||!e)return null;let i=$(e,t);return(0,W.jsxs)(j,{type:`button`,variant:`ghost`,size:`sm`,className:`max-[650px]:h-11`,onClick:async()=>{try{await ve(i,_e),Pe(n(`common:markdownMessage.revealLocalPathOk`,{path:t}),`info`)}catch(e){Pe(e instanceof I&&e.reason===`unavailable`?n(`common:markdownMessage.revealLocalPathUnavailable`):e instanceof I&&e.reason===`timeout`?n(`common:markdownMessage.revealLocalPathTimeout`):n(`common:markdownMessage.revealLocalPathFailed`,{path:t}),`error`)}},children:[(0,W.jsx)(H,{"aria-hidden":`true`}),n(`chat:chatMessage.fileActionReveal`)]})}function Ue(e){return{path:e.path,status:e.status===`created`?`created`:e.status===`deleted`?`deleted`:`modified`,added:e.added,removed:e.removed}}function We(e,t){if(!e)return;let n=[];return e.lineEnding&&n.push(t(`chat:focusSession.fileChangesLineEnding`,{from:e.lineEnding[0].toUpperCase(),to:e.lineEnding[1].toUpperCase()})),e.bom?.[1]?n.push(t(`chat:focusSession.fileChangesBomAdded`)):e.bom&&n.push(t(`chat:focusSession.fileChangesBomRemoved`)),t(`chat:focusSession.fileChangesFormatOnly`,{detail:n.join(` · `)})}function Ge({sessionId:e,cwd:t,streaming:n,view:i,onViewChange:a,requestConfirm:o}){let{t:s,language:c}=r(),{changes:l,loading:d,running:f,snapshotRevision:p,writesDisabled:m,pendingCount:h,reversibleCount:_,displayedError:v,notice:y,runAction:b,refresh:ee}=g({sessionId:e,streaming:n,requestConfirm:o}),x=l?.files??[],te=i?.expandedFiles?.[0],S=x.find(e=>e.path===te)??x[0],ne=e=>a?.({expandedFiles:[e]}),re=(e,t)=>f?.kind===e&&f.path===t,w=n?s(`chat:focusSession.gitWaitForRunToFinish`):void 0;return(0,W.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,"aria-label":s(`chat:focusSession.fileChanges`),"aria-busy":d||!!f,"data-changes-scope":`session`,children:[(0,W.jsx)(`header`,{className:`flex min-h-10 shrink-0 items-center gap-1.5 border-b border-stroke-soft py-1 pr-1.5 pl-3`,children:(0,W.jsxs)(`p`,{className:`flex min-w-0 flex-1 items-center gap-2 text-xs text-content-secondary`,children:[(0,W.jsx)(`span`,{className:`min-w-0 truncate`,children:s(`board:changes.sessionSummary`,{count:l?.summary.files??0})}),l&&l.summary.files>0&&(0,W.jsx)(Fe,{added:l.summary.added,removed:l.summary.removed})]})}),v&&(0,W.jsx)(`p`,{role:`alert`,className:`shrink-0 px-3 pt-2 text-xs text-st-fail`,children:v}),y&&!v&&(0,W.jsx)(`p`,{role:`status`,className:`shrink-0 px-3 pt-2 text-xs text-content-secondary`,children:y}),d&&!l?(0,W.jsx)(P,{kind:`loading`,title:s(`chat:focusSession.gitLoading`)}):x.length?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(Re,{files:x.map(e=>({...Ue(e),note:e.reverted?s(`chat:focusSession.fileChangesReverted`):e.approved?s(`chat:focusSession.fileChangesApproved`):We(e.formatChange,s)})),selected:S?.path??``,label:s(`board:changes.files`),onSelect:ne}),S&&(0,W.jsx)(Ve,{sessionId:e,file:Ue(S),scope:`task`,revision:p,view:i,onViewChange:a,footer:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`span`,{className:A(`mr-auto flex min-w-0 items-center gap-1.5 truncate`,S.approved?`text-st-done`:`text-content-muted`),"data-change-state":S.reverted?`reverted`:S.approved?`approved`:`pending`,children:[S.approved&&!S.reverted&&(0,W.jsx)(u,{className:`size-3.5 flex-none`,"aria-hidden":`true`}),S.reverted?s(`board:changes.revertedAt`,{time:M(S.changedAt,c)}):S.approved?s(`board:changes.approvedAt`,{time:M(S.changedAt,c)}):s(`board:changes.pendingAt`,{time:M(S.changedAt,c)})]}),S.pending&&!S.approved&&!S.reverted&&(0,W.jsxs)(j,{type:`button`,variant:`ghost`,size:`sm`,disabled:m,title:w,onClick:()=>void b({kind:`approve`,path:S.path}),children:[re(`approve`,S.path)?(0,W.jsx)(T,{className:`animate-spin`}):(0,W.jsx)(u,{}),s(`chat:focusSession.fileChangesApproveFile`)]}),(0,W.jsxs)(j,{type:`button`,variant:`ghost`,size:`sm`,disabled:m||S.reverted||!S.canRevert,title:w,onClick:()=>void b({kind:`revert`,path:S.path}),children:[re(`revert`,S.path)?(0,W.jsx)(T,{className:`animate-spin`}):(0,W.jsx)(C,{}),s(`board:changes.revertFile`)]}),(0,W.jsx)(He,{cwd:t,path:S.path})]})})]}):!v&&(0,W.jsx)(F,{compact:!0,title:s(`chat:focusSession.fileChangesEmpty`)}),(0,W.jsxs)(Ie,{status:f?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(T,{className:`size-3.5 flex-none animate-spin`,"aria-hidden":`true`}),f.kind===`approve`?s(`chat:focusSession.fileChangesApproveAll`):s(`board:changes.revertAll`)]}):h>0?s(`board:changes.pending`,{count:h}):null,children:[h>0&&(0,W.jsxs)(O,{disabled:m,title:w,onSelect:()=>void b({kind:`approve`}),children:[(0,W.jsx)(u,{}),s(`chat:focusSession.fileChangesApproveAll`)]}),(l?.summary.files??0)>0&&(0,W.jsxs)(O,{disabled:m||_===0,title:w??s(`chat:focusSession.fileChangesRevertAllDescription`),onSelect:()=>void b({kind:`revert`}),children:[(0,W.jsx)(C,{}),s(`board:changes.revertAll`)]}),(h>0||(l?.summary.files??0)>0)&&(0,W.jsx)(D,{}),(0,W.jsxs)(O,{disabled:d||!!f,onSelect:ee,children:[(0,W.jsx)(T,{}),s(`chat:focusSession.gitRefresh`)]})]})]})}function Ke({sessionId:e,cwd:t,streaming:n,view:a,onViewChange:o}){let{t:s}=r(),c=i({queryKey:[`task-project-changes`,e,t,n],queryFn:({signal:t})=>pe.getVcsChanges(e,{signal:t})}),l=(0,U.useMemo)(()=>S(c.data?.diff||``,c.data?.files.map(e=>e.path)||[],c.data?.diffTruncated),[c.data]),u=c.error?.message||c.data?.error,d=(c.data?.files||[]).map(e=>({path:e.path,status:je(e.status),added:Object.hasOwn(l.files,e.path)?l.files[e.path].added:null,removed:Object.hasOwn(l.files,e.path)?l.files[e.path].removed:null})),f=a?.expandedFiles?.[0],p=d.find(e=>e.path===f)??d[0];return(0,W.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,"aria-label":s(`chat:workbench.projectChanges`),"aria-busy":c.isFetching,"data-changes-scope":`workspace`,children:[(0,W.jsxs)(`header`,{className:`flex min-h-10 shrink-0 items-center gap-1.5 border-b border-stroke-soft py-1 pr-1.5 pl-3`,children:[(0,W.jsxs)(`p`,{className:`flex min-w-0 flex-1 items-center gap-2 text-xs text-content-secondary`,children:[(0,W.jsx)(`span`,{className:`min-w-0 truncate`,children:s(`board:changes.workspaceSummary`,{count:d.length})}),c.data?.isRepo&&!u&&d.length>0&&(0,W.jsx)(Fe,{added:l.added,removed:l.removed})]}),c.data?.branch&&(0,W.jsxs)(`span`,{className:`inline-flex h-5.5 max-w-[40%] min-w-0 flex-none items-center gap-1 rounded-xs border border-stroke px-1.5 font-mono text-xs text-content-secondary`,title:t,children:[(0,W.jsx)(ne,{size:12,className:`flex-none`,"aria-hidden":`true`}),(0,W.jsx)(`span`,{className:`truncate`,children:c.data.branch})]})]}),c.isPending?(0,W.jsx)(P,{kind:`loading`,title:s(`chat:focusSession.gitLoading`)}):u?(0,W.jsx)(`p`,{role:`alert`,className:`p-3 text-xs text-st-fail`,children:u}):c.data?.isRepo?d.length?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(Re,{files:d,selected:p?.path??``,label:s(`board:changes.files`),onSelect:e=>o?.({expandedFiles:[e]})}),p&&(0,W.jsx)(Ve,{sessionId:e,file:p,scope:`project`,revision:c.dataUpdatedAt,view:a,onViewChange:o,footer:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`span`,{className:`mr-auto min-w-0 truncate font-mono text-content-muted`,title:t,children:t}),(0,W.jsx)(He,{cwd:t,path:p.path})]})})]}):(0,W.jsx)(F,{compact:!0,title:s(`chat:focusSession.fileChangesEmpty`)}):(0,W.jsx)(F,{compact:!0,title:s(`chat:workbench.notRepository`)}),(0,W.jsx)(Ie,{status:c.isFetching?(0,W.jsx)(T,{className:`size-3.5 flex-none animate-spin`,"aria-hidden":`true`}):null,children:(0,W.jsxs)(O,{disabled:c.isFetching,onSelect:()=>void c.refetch(),children:[(0,W.jsx)(T,{}),s(`chat:focusSession.gitRefresh`)]})})]})}function qe({sessionId:e,cwd:t,streaming:n,scope:i,onScopeChange:a,vcsAvailable:o,view:s,onViewChange:c,requestConfirm:l}){let{t:u}=r();return(0,W.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,"data-inspector-changes":i,children:[(0,W.jsx)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-stroke-soft px-3 py-2`,children:(0,W.jsx)(fe,{size:`sm`,"aria-label":u(`board:inspector.changesScope`),value:i,onValueChange:a,options:[{value:`session`,label:u(`board:inspector.scopeSession`)},{value:`workspace`,label:u(`board:inspector.scopeWorkspace`),disabled:!o}]})}),s?i===`workspace`?(0,W.jsx)(Ke,{sessionId:e,cwd:t,streaming:n,view:s,onViewChange:c}):(0,W.jsx)(Ge,{sessionId:e,cwd:t,streaming:n,view:s,onViewChange:c,requestConfirm:l}):(0,W.jsx)(`p`,{role:`status`,className:`p-4 text-sm text-content-muted`,children:u(`chat:focusSession.gitLoading`)})]})}var Je=new Set([`changes`,`terminal`,`files`]),Ye=[];function Xe(e,t,n){return e===`changes`?n===`workspace`?`changes`:`files`:e===`terminal`?t:e===`files`?`sources`:e===`preview`?`browser`:e===`side-chat`?`side-chat`:null}function Ze({panelId:e,sessionId:t,cwd:n,streaming:s,plan:l,goal:u,team:f,activity:m,planTab:g,sources:v,mode:y,requestConfirm:ee,onClose:S,onOpenComponents:ne,componentTabs:C,autoFocus:T=!1,remoteMachine:E=!1}){let{t:D}=r(),O=y===`sheet`,se=be(),ce=o(e=>e.capabilities),k=!!se&&a(ce,`terminal`),pe=a(ce,`vcs`),M=B(e=>e.tab),N=B(e=>e.setTab),me=B(e=>e.terminalView),he=B(e=>e.setTerminalView),P=B(e=>e.changesView),_e=B(e=>e.setChangesView),I=R(e=>e.sessions[t]?.pages)??Ye,ve=I.some(e=>e.kind===`side-chat`),ye=E?`running`:`changes`,L=M===`side-chat`&&!ve||M===`plan`&&!g||E&&Je.has(M)?ye:M,z=Xe(L,me,P),V=z?I.find(e=>e.kind===z):void 0,H=!O&&C?C.tabs(n):[],[G,K]=(0,U.useState)(null),[q,J]=(0,U.useState)(!1),Y=H.some(e=>e.id===G)?G:null;(0,U.useEffect)(()=>K(null),[M]);let we=(0,U.useRef)(null);(0,U.useEffect)(()=>{we.current?.querySelector(`[role="tab"][aria-selected="true"]`)?.scrollIntoView?.({block:`nearest`,inline:`nearest`})},[L,Y]);let Te=(0,U.useRef)(T);(0,U.useEffect)(()=>{if(!Te.current)return;let e=requestAnimationFrame(()=>we.current?.querySelector(`[role="tab"][aria-selected="true"]`)?.focus({preventScroll:!0}));return()=>cancelAnimationFrame(e)},[]),(0,U.useEffect)(()=>{if(!z||V||(z===`terminal`||z===`processes`)&&!k)return;let e=R.getState(),n=e.sessions[t]?.contentOpen??!1;e.update(t,z,{type:`add`,kind:z}),n||e.update(t,z,{type:`workspace`,contentOpen:!1})},[z,V,t,k]);let Ee=i({queryKey:[`session-change-summary`,t,s],queryFn:()=>ge(t),staleTime:1e4}),X=Ee.data?.status===`known`?Ee.data.changedFiles??0:0,De=Se(m,s),Oe=[...E?[]:[{id:`changes`,icon:x,label:X>0?D(`board:inspector.changesCount`,{count:X}):D(`board:inspector.changes`)},{id:`terminal`,icon:ae,label:D(`board:inspector.terminal`)}],{id:`running`,icon:c,label:De?D(`board:inspector.runningCount`,{count:De}):D(`board:inspector.running`)},...E?[]:[{id:`files`,icon:te,label:D(`board:inspector.files`)}],{id:`preview`,icon:b,label:D(`board:inspector.preview`)},...g?[{id:`plan`,icon:re,label:D(`board:inspector.plan`)}]:[],...ve?[{id:`side-chat`,icon:w,label:D(`board:inspector.sideChat`)}]:[]],Z=e=>{V&&R.getState().update(t,V.kind,{type:`view`,id:V.id,patch:e})},je=()=>{let n=I.find(e=>e.kind===`side-chat`);if(n&&R.getState().update(t,`side-chat`,{type:`close`,id:n.id}),N(`changes`),O){S();return}requestAnimationFrame(()=>document.getElementById(`${e}-changes-tab`)?.focus())},Q=t=>`${e}-component-${t}-tab`,Me=e=>{K(null),N(e)},Ne=t=>{if(![`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(t.key))return;t.preventDefault();let n=[...Oe.map(t=>({fixed:t.id,id:`${e}-${t.id}-tab`})),...H.map(e=>({component:e.id,id:Q(e.id)}))],r=n.findIndex(e=>Y?e.component===Y:e.fixed===L),i=n[t.key===`Home`?0:t.key===`End`?n.length-1:(r+(t.key===`ArrowRight`?1:-1)+n.length)%n.length];i.component?K(i.component):i.fixed&&Me(i.fixed),requestAnimationFrame(()=>document.getElementById(i.id)?.focus())},$=(0,W.jsx)(`p`,{role:`status`,className:`p-4 text-sm text-content-muted`,children:D(`chat:focusSession.gitLoading`)}),Pe;return Pe=Y&&C?C.render(Y,{sessionId:t,cwd:n}):L===`changes`?(0,W.jsx)(qe,{sessionId:t,cwd:n,streaming:s,scope:P,onScopeChange:_e,vcsAvailable:pe,view:V?.view,onViewChange:V?Z:void 0,requestConfirm:ee}):L===`terminal`?k?(0,W.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,W.jsx)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-stroke-soft px-3 py-2`,children:(0,W.jsx)(fe,{size:`sm`,"aria-label":D(`board:inspector.terminalScope`),value:me,onValueChange:he,options:[{value:`terminal`,label:D(`board:inspector.terminal`)},{value:`processes`,label:D(`board:inspector.processes`)}]})}),(0,W.jsx)(U.Suspense,{fallback:$,children:V?me===`processes`?(0,W.jsx)(p,{sessionId:t,view:V.view,onViewChange:Z,onOpenTerminal:e=>{let n=R.getState(),r=n.sessions[t]?.pages.find(e=>e.kind===`terminal`);r?n.update(t,`terminal`,{type:`resource`,id:r.id,resourceId:e}):n.update(t,`terminal`,{type:`open`,kind:`terminal`,resourceId:e}),he(`terminal`)}}):(0,W.jsx)(d,{sessionId:t,cwd:n,terminalId:V.resourceId||void 0,onCreated:e=>R.getState().update(t,`terminal`,{type:`resource`,id:V.id,resourceId:e})},V.id):$})]}):(0,W.jsx)(F,{compact:!0,icon:ae,title:D(`board:inspector.terminalUnavailable`)}):L===`files`?V?(0,W.jsx)(_,{sources:v,view:V.view,onViewChange:Z}):$:L===`preview`?V?(0,W.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,"data-inspector-preview":!0,children:(0,W.jsx)(Ae,{panelId:e,sessionId:t},t)}):$:L===`plan`?(0,W.jsx)(ke,{plan:l,streaming:s,goal:u,team:f,activity:m}):L===`running`?(0,W.jsx)(Ce,{sessionId:t,streaming:s,activity:m}):(0,W.jsx)(h,{parentId:t,active:!0}),(0,W.jsxs)(`section`,{id:e,"aria-label":D(`board:inspector.label`),"data-session-inspector":y,"data-inspector-tab":L,"data-inspector-component":Y??void 0,className:`flex h-full min-h-0 w-full min-w-0 flex-col bg-panel text-content`,children:[(0,W.jsxs)(`header`,{className:A(`flex shrink-0 items-center gap-1 border-b border-stroke-soft pr-1.5 pl-2`,O?`h-[52px]`:y===`aside`?`h-[52px] [[data-custom-titlebar]_&]:h-11 [[data-custom-titlebar]_&]:pointer-coarse:h-[52px]`:`h-11 pointer-coarse:h-[52px]`),children:[(0,W.jsxs)(`div`,{ref:we,role:`tablist`,"aria-label":D(`board:inspector.tabs`),className:`flex min-w-0 flex-1 items-center gap-0.5 overflow-x-auto [scrollbar-width:none]`,onKeyDown:Ne,children:[Oe.map(({id:t,icon:n,label:r})=>{let i=!Y&&t===L;return(0,W.jsxs)(`button`,{id:`${e}-${t}-tab`,type:`button`,role:`tab`,"aria-selected":i,"aria-controls":`${e}-body`,tabIndex:i?0:-1,"data-inspector-tab-id":t,className:A(`flex flex-none items-center gap-1.5 rounded-sm px-2 text-[13px] whitespace-nowrap transition-colors duration-(--d-fast) focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus`,O?`h-11 min-w-11 justify-center px-2.5`:`h-8 pointer-coarse:h-11 pointer-coarse:min-w-11`,i?`bg-solid font-medium text-content shadow-edge ring-1 ring-stroke-strong ring-inset`:`text-content-secondary hover:bg-surface-hover hover:text-content`),onClick:()=>Me(t),children:[!O&&(0,W.jsx)(n,{className:`size-3.5`,"aria-hidden":`true`}),r]},t)}),!Y&&L===`side-chat`&&(0,W.jsx)(j,{type:`button`,variant:`ghost`,size:`icon-sm`,className:A(O&&`size-11`),"aria-label":D(`board:inspector.closeTab`,{tab:D(`board:inspector.sideChat`)}),onClick:je,children:(0,W.jsx)(oe,{"aria-hidden":`true`})}),!O&&(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`mx-1 h-4 w-px flex-none bg-stroke`}),H.map(({id:t,label:n})=>{let r=t===Y;return(0,W.jsx)(`button`,{id:Q(t),type:`button`,role:`tab`,"aria-selected":r,"aria-controls":`${e}-body`,tabIndex:r?0:-1,"data-inspector-component-tab":t,className:A(`flex h-8 max-w-40 flex-none items-center rounded-sm px-2 text-[13px] whitespace-nowrap transition-colors duration-(--d-fast) focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus pointer-coarse:h-11 pointer-coarse:min-w-11`,r?`bg-solid font-medium text-content shadow-edge ring-1 ring-stroke-strong ring-inset`:`text-content-secondary hover:bg-surface-hover hover:text-content`),onClick:()=>K(t),children:(0,W.jsx)(`span`,{className:`truncate`,children:n})},t)})]}),!O&&(0,W.jsxs)(de,{open:q,onOpenChange:J,children:[(0,W.jsx)(le,{asChild:!0,children:(0,W.jsx)(j,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`flex-none`,"aria-label":D(`board:inspector.add`),title:D(`board:inspector.add`),"data-inspector-component-add":!0,children:(0,W.jsx)(ie,{"aria-hidden":`true`})})}),(0,W.jsxs)(ue,{align:`end`,className:`w-64 text-xs`,children:[C?.addMenu?C.addMenu({cwd:n,onAdded:e=>{K(e),J(!1)}}):(0,W.jsx)(`p`,{className:`text-content-secondary`,children:D(`board:inspector.addHint`)}),ne&&(0,W.jsx)(j,{type:`button`,variant:`secondary`,size:`sm`,className:`self-start`,onClick:ne,children:D(`board:inspector.openComponents`)})]})]}),(0,W.jsx)(j,{type:`button`,variant:`ghost`,size:`icon-sm`,className:A(`flex-none`,O&&`size-11`),"aria-label":D(`board:inspector.close`),title:D(`board:inspector.close`),"aria-controls":e,onClick:S,children:y===`aside`?(0,W.jsx)(xe,{"aria-hidden":`true`}):(0,W.jsx)(oe,{"aria-hidden":`true`})})]}),(0,W.jsx)(`div`,{id:`${e}-body`,role:`tabpanel`,"aria-labelledby":Y?Q(Y):`${e}-${L}-tab`,className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:Pe})]})}export{Ze as SessionInspector};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{f as t,l as n,u as r}from"./vendor-router-CSN_DGvx.js";import{i,r as a}from"./vendor-react-DwNgTV1j.js";import{f as o,r as s}from"./routes-DIeaqWVc.js";import{t as c}from"./use-i18n-
|
|
1
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{f as t,l as n,u as r}from"./vendor-router-CSN_DGvx.js";import{i,r as a}from"./vendor-react-DwNgTV1j.js";import{f as o,r as s}from"./routes-DIeaqWVc.js";import{t as c}from"./use-i18n-D6tl7SDi.js";import{a as l,o as u,s as d,u as f}from"./placements-DQgsRjpv.js";import{t as p}from"./client-store-DtL9pe9n.js";import{t as m}from"./usePhoneShell-CcoVb1v0.js";import{t as h}from"./PhoneMenuButton-CKS9DzOB.js";import{t as g}from"./useSessionListQuery-BaBpkejJ.js";import{t as _}from"./public-Cy9CZkvX.js";import{i as v,t as y}from"./session-home-D75yfsOZ.js";var b=e(i(),1),x=a(),S=`(max-width: 1279px), (max-height: 760px)`,C=`(min-width: 960px) and (min-height: 640px)`;function w(e){let[t,n]=(0,b.useState)(()=>window.matchMedia(e).matches);return(0,b.useEffect)(()=>{let t=window.matchMedia(e),r=()=>n(t.matches);return r(),t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[e]),t}function T({context:e,ChatPage:i}){let a=r(),c=n(),{sessionId:l=``}=t(),u=m(),d=p(e=>e.client===`mobile-app`),f=w(`(min-width: 960px) and (min-height: 640px)`)&&d,C=w(S),T=!u||f,D=(0,b.useRef)(l);D.current=l;let O=(0,b.useRef)(c.state);O.current=c.state;let k=(0,b.useCallback)(e=>{if(!e||e===D.current)return;let t=D.current===`new`;a(o(e),{replace:t,state:t?O.current:void 0})},[a]),A=g(),j=!!(l&&l!==`new`&&A.data?.sessions.some(e=>e.id===l));(0,b.useEffect)(()=>{j&&v(l)},[j,l]);let M=E(e.notify,k),N=e.startNewTask,P=l===`new`,F=e.notify,I=_({onError:e=>F(e,`error`)}),L=P?I:void 0,R=(0,b.useMemo)(()=>({compact:C,overlayOnly:d,onOpenComponents:()=>a(s.components),componentTabs:M,onArchived:e=>{y(e),a(`/`,{replace:!0})},onHome:()=>a(`/`),onNewTask:N,newTaskDraft:L}),[C,d,a,M,N,L]),z=(0,b.useMemo)(()=>({...R,phone:{onNewTask:N}}),[R,N]);return(0,x.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,"data-session-shell":T?`desktop`:`phone`,children:(0,x.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1`,children:(0,x.jsx)(i,{notify:e.notify,navigate:e.navigate,browserNotify:e.browserNotify,pendingAsset:e.pendingAsset,onAssetConsumed:e.onAssetConsumed,requestText:e.requestText,requestConfirm:e.requestConfirm,routeSessionId:l,onRouteSessionChange:k,routeLeading:T?void 0:(0,x.jsx)(h,{}),pageChrome:T?R:z})})})}function E(e,t){let{language:n}=c(),{available:r,placed:i}=f(`session-panel`);return(0,b.useMemo)(()=>{if(r)return{tabs:e=>d(i,e,n),render:(n,{sessionId:r,cwd:a})=>{let o=i.find(e=>e.instance.instanceId===n);return o?(0,x.jsx)(b.Suspense,{fallback:null,children:(0,x.jsx)(u,{placed:o,sessionId:r,cwd:a,notify:e,onOpenSession:t})}):null},addMenu:({cwd:t,onAdded:n})=>(0,x.jsx)(b.Suspense,{fallback:null,children:(0,x.jsx)(l,{cwd:t,notify:e,onAdded:n})})}},[r,n,e,t,i])}export{S as SESSION_COMPACT_QUERY,C as SESSION_TABLET_QUERY,T as SessionShell};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-
|
|
1
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-D6tl7SDi.js";import{t as i}from"./runtime-capabilities-store-DoZOSQiv.js";import{t as a}from"./arrow-left-B8oVrQ2S.js";import{t as o}from"./arrow-right-DqLOhpA2.js";import{r as s}from"./settings-navigation-C6_RpGgI.js";import{t as c}from"./utils-C8uzG5AZ.js";import{t as l}from"./kbd-CAufZTkl.js";import{n as u}from"./shortcuts-1-ySiY-G.js";import{n as d,r as f}from"./back-navigation-CK7X_5Bc.js";var p=e(t(),1);function m(e,t=!0){let n=(0,p.useRef)(e);n.current=e,(0,p.useEffect)(()=>{if(!t)return;let e=new WeakSet,r=t=>{t.key===`Escape`&&d()&&e.add(t)},i=t=>{t.key!==`Escape`||t.defaultPrevented||t.isComposing||t.altKey||t.ctrlKey||t.metaKey||t.shiftKey||e.has(t)||u(t.target)&&!f(t)||(t.preventDefault(),n.current())};return window.addEventListener(`keydown`,r,!0),window.addEventListener(`keydown`,i),()=>{window.removeEventListener(`keydown`,r,!0),window.removeEventListener(`keydown`,i)}},[t])}var h=n(),g=`flex h-8 w-full min-w-0 items-center gap-2.5 rounded-[var(--r-md)] px-2.5 text-left text-[length:var(--app-font-size)] text-content transition-colors duration-(--d-fast) hover:bg-surface-hover focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus pointer-coarse:h-11`;function _({configSection:e,onSelectSection:t,onBack:n,onOpenFeatures:u,search:d,version:f,footer:p}){let{t:_}=r(),v=i(e=>e.capabilities),y=s(_,{capabilities:v});m(n);let b=_(`config:settingsShell.back`);return(0,h.jsxs)(`nav`,{"aria-label":_(`config:settingsShell.settingsNavigation`),"data-settings-sidebar":!0,className:`flex min-h-0 flex-1 flex-col animate-in fade-in duration-(--d-fast) motion-reduce:animate-none`,children:[(0,h.jsxs)(`div`,{"data-window-drag-region":!0,className:`flex h-[52px] flex-none items-center gap-2 pr-3.5 pl-2`,children:[(0,h.jsxs)(`button`,{type:`button`,"data-settings-back":!0,"aria-keyshortcuts":`Escape`,className:`flex h-8 items-center gap-2 rounded-[var(--r-md)] pr-2.5 pl-1.5 text-sm text-content-secondary transition-colors duration-(--d-fast) hover:bg-surface-hover hover:text-content focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus pointer-coarse:h-11`,onClick:n,children:[(0,h.jsx)(a,{className:`size-[18px]`,strokeWidth:1.75,"aria-hidden":`true`}),b]}),(0,h.jsx)(`span`,{className:`flex-1`}),(0,h.jsx)(l,{"aria-hidden":`true`,className:`border-transparent bg-transparent text-content-faint shadow-none pointer-coarse:hidden`,children:`Esc`})]}),(0,h.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-contain px-2 pb-2`,children:[(0,h.jsx)(`h2`,{className:`m-0 px-2.5 pt-2.5 pb-3 text-xl leading-7 font-semibold tracking-[-.01em] text-content`,children:_(`navigation:navigation.settings`)}),d&&(0,h.jsx)(`div`,{className:`relative z-20 mb-2 px-0.5`,children:d}),(0,h.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-px p-0`,children:y.map(n=>{let r=n.section===e;return(0,h.jsx)(`li`,{children:(0,h.jsxs)(`button`,{type:`button`,"data-settings-section":n.section,"aria-current":r?`page`:void 0,className:c(g,r&&`bg-surface-active font-medium hover:bg-surface-active`),onClick:()=>t(n.section),children:[(0,h.jsx)(n.icon,{className:`size-4 flex-none text-content-secondary`,strokeWidth:1.75,"aria-hidden":`true`}),(0,h.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:n.label}),n.section===`about`&&f&&(0,h.jsxs)(`small`,{className:`font-mono text-xs font-normal text-content-muted tabular-nums`,children:[`v`,f]})]})},n.section)})}),(0,h.jsxs)(`button`,{type:`button`,"data-settings-features-link":!0,className:`mt-4 flex min-h-8 w-full items-center gap-1 rounded-[var(--r-md)] px-2.5 py-1 text-left text-xs leading-5 text-content-muted transition-colors duration-(--d-fast) hover:bg-surface-hover hover:text-content-secondary focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus pointer-coarse:min-h-11`,onClick:u,children:[(0,h.jsx)(`span`,{className:`min-w-0 flex-1`,children:_(`config:settingsShell.featuresHint`)}),(0,h.jsx)(o,{className:`size-3.5 flex-none`,"aria-hidden":`true`})]})]}),p&&(0,h.jsx)(`div`,{className:`flex-none p-2`,children:p})]})}export{_ as SettingsSidebar};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-
|
|
1
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-D6tl7SDi.js";import{t as i}from"./settings-QX0oWnVK.js";import{t as a}from"./button-CCcCN8tE.js";import{c as o}from"./shortcuts-1-ySiY-G.js";import{a as s,i as c,l,n as u,o as d,s as f,t as p}from"./dialog-C_ew2HiI.js";import{a as m,i as h,n as g,r as _,t as v}from"./ShortcutKeys-COCK3Z1P.js";var y=e(t(),1),b=n();function x({open:e,onOpenChange:t,onCustomize:n}){let{t:x}=r(),S=m(),C=o(e=>e.bindings),w=o(e=>e.boardBindings),[T]=(0,y.useState)(()=>document.activeElement instanceof HTMLElement?document.activeElement:null),E=(0,y.useRef)(null),[D,O]=(0,y.useState)(!0);return(0,b.jsx)(p,{open:e,onOpenChange:t,children:(0,b.jsxs)(c,{size:`wide`,scrollMode:`body`,className:`max-w-[min(92vw,760px)]`,"data-shortcut-help":!0,onOpenAutoFocus:e=>{E.current&&(e.preventDefault(),E.current.focus({preventScroll:!0}))},onCloseAutoFocus:e=>{T?.isConnected&&(e.preventDefault(),T.focus({preventScroll:!0}))},children:[(0,b.jsxs)(f,{className:`pr-8`,children:[(0,b.jsx)(l,{children:x(`board:shortcuts.shortcutHelp`)}),(0,b.jsx)(s,{children:x(`board:shortcuts.helpDescription`)})]}),(0,b.jsx)(u,{ref:E,tabIndex:0,role:`region`,"aria-label":x(`board:shortcuts.shortcutHelp`),"data-quiet-focus":D||void 0,onKeyDown:e=>{let{key:t,metaKey:n,ctrlKey:r,altKey:i}=e;t===`Escape`||t===`Shift`||n||r||i||O(!1)},onBlur:()=>O(!1),className:`-mx-4 px-4 py-2 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus data-quiet-focus:focus-visible:outline-none`,children:(0,b.jsx)(`div`,{className:`grid gap-x-8 gap-y-5 min-[720px]:grid-cols-2`,children:g.map(e=>(0,b.jsxs)(`section`,{"aria-labelledby":`shortcut-help-${e.id}`,"data-shortcut-help-group":e.id,className:e.id===`board`?`min-[720px]:row-span-2`:void 0,children:[(0,b.jsx)(`h3`,{id:`shortcut-help-${e.id}`,className:`text-[13px] leading-5 font-semibold text-content`,children:S.groups[e.id].title}),(0,b.jsx)(`p`,{className:`mb-1 text-xs text-content-muted`,children:S.groups[e.id].hint}),(0,b.jsx)(`dl`,{className:`divide-y divide-stroke-soft`,children:e.entries.map(e=>(0,b.jsxs)(`div`,{className:`flex min-h-7 min-w-0 items-center justify-between gap-3 py-0.5`,"data-shortcut-help-entry":_(e),children:[(0,b.jsx)(`dt`,{className:`min-w-0 text-[13px] text-content`,children:S.label(e)}),(0,b.jsx)(`dd`,{className:`flex-none`,children:(0,b.jsx)(v,{keys:h(e,C,w),className:`justify-end`})})]},_(e)))})]},e.id))})}),n&&(0,b.jsx)(d,{children:(0,b.jsxs)(a,{variant:`outline`,size:`dialogAction`,onClick:()=>{t(!1),n()},children:[(0,b.jsx)(i,{"aria-hidden":`true`}),x(`board:shortcuts.helpCustomize`)]})})]})})}export{x as ShortcutHelpDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-
|
|
1
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-D6tl7SDi.js";import{t as i}from"./utils-C8uzG5AZ.js";import{n as a,t as o}from"./kbd-CAufZTkl.js";import{t as s}from"./shortcuts-1-ySiY-G.js";var c=e=>({kind:`app`,action:e}),l=e=>({kind:`board`,action:e}),u=(e,...t)=>({kind:`fixed`,id:e,keys:t}),d=[{id:`global`,entries:[c(`commandPalette`),c(`primaryAction`),c(`toggleSidebar`),c(`agentPanel`),c(`openBoard`),c(`openMore`),c(`openSettings`),c(`jumpToAttention`),c(`previousAgent`),c(`nextAgent`),c(`cycleFocusRegion`),c(`toggleTerminal`),c(`shortcutHelp`),c(`focusComposer`),c(`voiceInput`),c(`openSession`),c(`openComponents`)]},{id:`sidebar`,entries:[u(`sidebarMove`,[`↑`],[`↓`]),u(`sidebarOpen`,[`Enter`])]},{id:`board`,entries:[c(`focusSearch`),l(`boardNext`),l(`boardPrevious`),u(`boardMove`,[`↑`],[`↓`]),u(`boardOpen`,[`Enter`]),l(`boardApprove`),l(`boardDeny`),l(`boardRetry`),l(`boardTriage`),u(`boardExitTriage`,[`Esc`]),l(`boardToggleGrouping`)]},{id:`session`,entries:[c(`toggleInspector`),c(`sessionTree`),c(`sideChat`),c(`sendMessage`),c(`steerMessage`),u(`newline`,[`Shift`,`Enter`]),u(`cycleRunMode`,[`Shift`,`Tab`]),u(`stopRun`,[`Esc`])]}];function f(e){return e.kind===`fixed`?`fixed:${e.id}`:e.action}function p(e,t,n){if(e.kind===`fixed`)return e.keys;let r=s(e.kind===`app`?t[e.action]:n[e.action]);return r?[r.split(` + `)]:null}function m(){let{t:e}=r(),t={commandPalette:e(`config:shortcuts.commandPalette`),primaryAction:e(`config:shortcuts.primaryAction`),focusSearch:e(`board:shortcuts.focusSearch`),toggleSidebar:e(`config:shortcuts.toggleSidebar`),toggleTerminal:e(`config:shortcuts.toggleTerminal`),openSettings:e(`config:shortcuts.openSettings`),focusComposer:e(`config:shortcuts.focusComposer`),sendMessage:e(`board:shortcuts.sendMessage`),voiceInput:e(`config:shortcuts.voiceInput`),openBoard:e(`config:shortcuts.openBoard`),openComponents:e(`config:shortcuts.openComponents`),openMore:e(`config:shortcuts.openMore`),jumpToAttention:e(`config:shortcuts.jumpToAttention`),agentPanel:e(`board:shortcuts.agentPanel`),toggleInspector:e(`board:shortcuts.toggleInspector`),previousAgent:e(`board:shortcuts.previousAgent`),nextAgent:e(`board:shortcuts.nextAgent`),steerMessage:e(`board:shortcuts.steerMessage`),shortcutHelp:e(`board:shortcuts.shortcutHelp`),openSession:e(`board:shortcuts.openSession`),sessionTree:e(`board:shortcuts.sessionTree`),sideChat:e(`board:shortcuts.sideChat`),cycleFocusRegion:e(`board:shortcuts.cycleFocusRegion`)},n={boardNext:e(`config:shortcuts.boardNext`),boardPrevious:e(`config:shortcuts.boardPrevious`),boardApprove:e(`config:shortcuts.boardApprove`),boardDeny:e(`config:shortcuts.boardDeny`),boardRetry:e(`config:shortcuts.boardRetry`),boardTriage:e(`config:shortcuts.boardTriage`),boardToggleGrouping:e(`config:shortcuts.boardToggleGrouping`)},i={sidebarMove:e(`board:shortcuts.sidebarMove`),sidebarOpen:e(`board:shortcuts.sidebarOpen`),boardMove:e(`board:shortcuts.boardMove`),boardOpen:e(`board:shortcuts.boardOpen`),boardExitTriage:e(`board:shortcuts.boardExitTriage`),newline:e(`board:shortcuts.newline`),cycleRunMode:e(`board:shortcuts.cycleRunMode`),stopRun:e(`board:shortcuts.stopRun`)};return{actions:t,boardActions:n,groups:{global:{title:e(`board:shortcuts.groupGlobal`),hint:e(`board:shortcuts.globalHint`)},sidebar:{title:e(`board:shortcuts.groupSidebar`),hint:e(`board:shortcuts.sidebarHint`)},board:{title:e(`board:shortcuts.groupBoard`),hint:e(`board:shortcuts.boardHint`)},session:{title:e(`board:shortcuts.groupSession`),hint:e(`board:shortcuts.sessionHint`)}},label:e=>e.kind===`app`?t[e.action]:e.kind===`board`?n[e.action]:i[e.id]}}var h=e(t(),1),g=n();function _({keys:e,className:t}){let{t:n}=r();return e?.length?(0,g.jsx)(`span`,{className:i(`inline-flex min-w-0 flex-wrap items-center gap-1`,t),children:e.map((e,t)=>(0,g.jsxs)(h.Fragment,{children:[t>0&&(0,g.jsx)(`span`,{"aria-hidden":`true`,className:`text-xs text-content-muted`,children:`/`}),(0,g.jsx)(a,{children:e.map(e=>(0,g.jsx)(o,{className:`text-content-secondary`,children:e},e))})]},e.join(`+`)))}):(0,g.jsx)(`span`,{className:i(`text-xs text-content-muted`,t),children:n(`config:shortcuts.disabled`)})}export{m as a,p as i,d as n,f as r,_ as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-
|
|
1
|
+
import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-D6tl7SDi.js";import{t as n}from"./download-BCfIiuaL.js";import{t as r}from"./external-link-CEQqPcqc.js";import{t as i}from"./refresh-cw-TbWxTY4K.js";import{t as a}from"./rocket-BgLSjoHY.js";var o=e();function s({update:e,collapsed:s,onOpen:c}){let{t:l}=t(),u=e?.status||{state:`idle`},d=!!(e?.info?.desktop||e?.info?.mobile);if(![`available`,`downloading`,`downloaded`].includes(u.state))return null;let f=u.state===`downloading`,p=u.state===`downloaded`,m=l(p?`navigation:appSidebar.readyToRestart`:f?`navigation:appSidebar.downloading`:d?`navigation:appSidebar.updateAvailable`:`navigation:appSidebar.sourceUpdatesAvailable`),h=f?`${Math.round(u.percent||0)}%`:d&&u.availableVersion?`v${u.availableVersion}`:u.behindBy?l(`navigation:appSidebar.countCommitsBehindBranch`,{branch:u.branch||`main`,count:u.behindBy}):u.availableCommit?u.availableCommit.slice(0,7):l(`navigation:appSidebar.viewUpdateDetails`),g=p?a:f?i:d?n:r;return(0,o.jsxs)(`button`,{type:`button`,className:`flex min-h-11 w-full items-center rounded-sm border border-star-border bg-star-soft text-content transition-colors duration-[var(--d-fast)] hover:bg-surface-hover ${s?`justify-center px-0`:`gap-2.5 px-3 text-left`}`,title:`${m} · ${h}`,"aria-label":`${m} · ${h}`,onClick:c,children:[(0,o.jsx)(g,{className:`shrink-0 text-accent-fg ${f?`animate-spin`:``}`,size:16}),!s&&(0,o.jsxs)(`span`,{className:`min-w-0`,children:[(0,o.jsx)(`strong`,{className:`block truncate text-xs font-medium`,children:m}),(0,o.jsx)(`small`,{className:`mt-0.5 block truncate text-xs text-content-muted tabular-nums`,children:h})]})]})}export{s as default};
|