pisper 0.6.9 → 0.6.10

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.
Files changed (180) hide show
  1. package/lib/npm-platform.mjs +0 -1
  2. package/lib/platform.mjs +2 -1
  3. package/package.json +6 -7
  4. package/web/.vite/manifest.json +943 -844
  5. package/web/assets/{AppDialog-DJZWnxzH.js → AppDialog-1E6olv_T.js} +1 -1
  6. package/web/assets/{AppOverlays-DICzFYsW.js → AppOverlays-BV_gIt77.js} +1 -1
  7. package/web/assets/AppSelect-BGVBQRP1.js +1 -0
  8. package/web/assets/AssetsPage-6HTR2IpQ.js +1 -0
  9. package/web/assets/{BoardPage-DKjz8Sj_.js → BoardPage-CL2e-8j4.js} +3 -3
  10. package/web/assets/BrandLogo-k3CvJjd4.js +1 -0
  11. package/web/assets/ChannelsPage-CmczBcSA.js +1 -0
  12. package/web/assets/{ChatAppearancePage-6Mq1uFuU.js → ChatAppearancePage-DMAnYGNb.js} +1 -1
  13. package/web/assets/{ChatHistoryPage-j-_vMM-M.js → ChatHistoryPage-DedOh6aO.js} +1 -1
  14. package/web/assets/ChatPage-b16p3qWl.js +553 -0
  15. package/web/assets/ConfigPage-BYB0rL_V.js +5 -0
  16. package/web/assets/{DesktopWindowControls-BOrn8KGA.js → DesktopWindowControls-DAuHMZFO.js} +1 -1
  17. package/web/assets/DispatchOverlay-CEbzXIct.js +1 -0
  18. package/web/assets/{FeaturePage-1MUXz3Y-.js → FeaturePage-BJGDVZ_u.js} +1 -1
  19. package/web/assets/{FileAttachmentPreview-B17OgdVi.js → FileAttachmentPreview-Cw5-ApIr.js} +1 -1
  20. package/web/assets/{FloatingWidgets-CcPNUEFB.js → FloatingWidgets-BQXBxVDd.js} +1 -1
  21. package/web/assets/FocusRuntimeControls-C7b1I2L5.js +1 -0
  22. package/web/assets/{GitDiffViewer-CSl-SGa1.js → GitDiffViewer-BAZTiiDo.js} +1 -1
  23. package/web/assets/{HoldToConfirmButton-CVyju89W.js → HoldToConfirmButton-BxdJ7icc.js} +1 -1
  24. package/web/assets/LaunchConsole-uKHKx4h0.js +2 -0
  25. package/web/assets/{ManageProjectsDialog-DSN8QUPg.js → ManageProjectsDialog-03d7p6Td.js} +1 -1
  26. package/web/assets/{MarkdownMessage-BPZcFjyR.js → MarkdownMessage-B_9d8KI-.js} +1 -1
  27. package/web/assets/McpPage-7NEAc3Rv.js +1 -0
  28. package/web/assets/MemoryPage-_mnn45jY.js +1 -0
  29. package/web/assets/{MobileNavigation-Cc4zcU3a.js → MobileNavigation-IXJN0OuM.js} +1 -1
  30. package/web/assets/{MorePage-B-qsYMAv.js → MorePage-DtqJlHAA.js} +1 -1
  31. package/web/assets/{PageHeader-mUKoAR30.js → PageHeader-6KRCT1j1.js} +1 -1
  32. package/web/assets/{PageState-aWHrkE1D.js → PageState-Cz6vFMXv.js} +1 -1
  33. package/web/assets/{PhoneDrawer-qES4OwMx.js → PhoneDrawer-Cp6X4_ei.js} +1 -1
  34. package/web/assets/{PhoneMenuButton-DEbqHUUP.js → PhoneMenuButton-Cl7FEYYw.js} +1 -1
  35. package/web/assets/{PhoneTopBar-CLPmKZ4Q.js → PhoneTopBar-CR1m9vf3.js} +1 -1
  36. package/web/assets/{PluginsPage-B53DParo.js → PluginsPage-CNddCaYt.js} +1 -1
  37. package/web/assets/{QuickPromptIdeas-gKobqAO3.js → QuickPromptIdeas-C7X4T7kx.js} +1 -1
  38. package/web/assets/{SafeModePrompt-Dlq8rlix.js → SafeModePrompt-jSCZVMGa.js} +1 -1
  39. package/web/assets/SchedulesPage-BRqBCtCf.js +1 -0
  40. package/web/assets/SessionBrowserPane-maCbfzXl.js +2 -0
  41. package/web/assets/SessionContextPanel-BSY6NaRx.js +2 -0
  42. package/web/assets/{SessionHome-CVdMY-bT.js → SessionHome-Wu8JWsto.js} +1 -1
  43. package/web/assets/SessionInspector-BRIFfuiZ.js +1 -0
  44. package/web/assets/{SessionShell-Vv2oGR0M.js → SessionShell-Dp94FUuk.js} +1 -1
  45. package/web/assets/{SettingsSidebar-cG_oKSWN.js → SettingsSidebar-CP1qDAcx.js} +1 -1
  46. package/web/assets/{ShortcutHelpDialog-C5KKKBZd.js → ShortcutHelpDialog-C5f_x4XG.js} +1 -1
  47. package/web/assets/{ShortcutKeys-zuzmq8eW.js → ShortcutKeys-Cx8hNJ62.js} +1 -1
  48. package/web/assets/{SidebarUpdateStatus-BXimwZ77.js → SidebarUpdateStatus-YxE_hT2l.js} +1 -1
  49. package/web/assets/{SkillsPage-AhmayxVl.js → SkillsPage-z6rTYJ8Z.js} +1 -1
  50. package/web/assets/TaskProcessesPane-yhEsHe1N.js +1 -0
  51. package/web/assets/TaskTerminalView-CT6V8AGR.js +18 -0
  52. package/web/assets/{TerminalPanel-wvzi7jBd.js → TerminalPanel-598uzwoB.js} +1 -1
  53. package/web/assets/{WebDesktopPet-qREBG08n.js → WebDesktopPet-D6bkGOwL.js} +1 -1
  54. package/web/assets/WorkflowsPage-DrltlXh1.js +1 -0
  55. package/web/assets/{WorkspacePicker-B68VTV5x.js → WorkspacePicker-DPwlN6KA.js} +1 -1
  56. package/web/assets/{api-DVgYxLec.js → api-45iTnFjN.js} +1 -1
  57. package/web/assets/{app-primitives-Cmdj4cIW.js → app-primitives-Drz_SjnR.js} +1 -1
  58. package/web/assets/{app-update-BEymQxyl.js → app-update-kStNhVOh.js} +1 -1
  59. package/web/assets/{approval-confirm-JevCpyyv.js → approval-confirm-CCo7v8Ln.js} +1 -1
  60. package/web/assets/{badge-Dk1N1mVf.js → badge-CWB3lj2H.js} +1 -1
  61. package/web/assets/{board-launch-CUV0KEKT.js → board-launch-YigjCnZf.js} +1 -1
  62. package/web/assets/board-messages-xFeTO3o6.js +1 -0
  63. package/web/assets/{board-projects-VBEGB9VD.js → board-projects-LnEYyP4h.js} +1 -1
  64. package/web/assets/{button-Bu_vuij9.js → button-CCcCN8tE.js} +1 -1
  65. package/web/assets/{chat-api-CQ9MShHZ.js → chat-api-BBuYjxwz.js} +1 -1
  66. package/web/assets/checkbox-BrEHgFV0.js +1 -0
  67. package/web/assets/client-store-CAhvptv1.js +1 -0
  68. package/web/assets/{collapsible-C__hRcbA.js → collapsible-DMaUQRX4.js} +1 -1
  69. package/web/assets/{config-search-ClE5BFDz.js → config-search-C1YtwJAQ.js} +1 -1
  70. package/web/assets/{dialog-Kx6RCn3A.js → dialog-2cmY5V75.js} +1 -1
  71. package/web/assets/{dist-Cfh4kzCK.js → dist-41X0pdUs.js} +1 -1
  72. package/web/assets/{dist-BdkTa5R3.js → dist-BHkR6BLP.js} +1 -1
  73. package/web/assets/dist-BRjj4UeB.js +1 -0
  74. package/web/assets/dist-BaBySQmo.js +1 -0
  75. package/web/assets/{dist-BlIIpW6W.js → dist-BiRPwy4W.js} +1 -1
  76. package/web/assets/{dist-B_a0oV4U.js → dist-BsRXXcSL.js} +1 -1
  77. package/web/assets/dist-DzGQ7sLi.js +1 -0
  78. package/web/assets/{dist-TksYpDID.js → dist-OB2r6Xsr.js} +1 -1
  79. package/web/assets/dist-V8chnW6-.js +1 -0
  80. package/web/assets/dropdown-menu-CFIFNaKO.js +1 -0
  81. package/web/assets/es2015-DTZdOI9P.js +41 -0
  82. package/web/assets/{events-ulSEiNKt.js → events-n27XPFgs.js} +1 -1
  83. package/web/assets/{field-Bnm9KAi2.js → field-DaxtcBBA.js} +1 -1
  84. package/web/assets/{hosts-B-POTAmu.js → hosts-CmK7Yt82.js} +1 -1
  85. package/web/assets/i18n-DfsxGeh5.js +1 -0
  86. package/web/assets/{index-C4CqzQNY.js → index-BDgCJ4Fs.js} +2 -2
  87. package/web/assets/index-CfTBR7Rs.css +2 -0
  88. package/web/assets/input-CPw-zkYh.js +1 -0
  89. package/web/assets/input-group-CDEyjyK4.js +1 -0
  90. package/web/assets/{label-BzlNatZM.js → label-CVWjEcfV.js} +1 -1
  91. package/web/assets/{launch-defaults-store-7CojCPDE.js → launch-defaults-store-CGeglXDI.js} +1 -1
  92. package/web/assets/model-display-kDwvtxrW.js +1 -0
  93. package/web/assets/mount-app-Bxa7xF8d.js +9 -0
  94. package/web/assets/{permission-rules-api-BQlSNrYK.js → permission-rules-api-BvKOF7rS.js} +1 -1
  95. package/web/assets/{pick-system-directory-BgN7vwKS.js → pick-system-directory-DSupTk88.js} +1 -1
  96. package/web/assets/placements--Zk5njsN.js +2 -0
  97. package/web/assets/{popover-DT3PkPcL.js → popover-BtcdIPRz.js} +1 -1
  98. package/web/assets/{progress-YhljaYNy.js → progress-5odAz3B9.js} +1 -1
  99. package/web/assets/public--8F2_oqP.js +1 -0
  100. package/web/assets/public-CgydVZuV.js +2 -0
  101. package/web/assets/public-components-CeIuV0FY.js +1 -0
  102. package/web/assets/public-diff-DWbitsnS.js +1 -0
  103. package/web/assets/public-launch-DtVwSANs.js +1 -0
  104. package/web/assets/run-activity-CwfO0cui.js +1 -0
  105. package/web/assets/{runtime-capabilities-store--7mKyYAM.js → runtime-capabilities-store-D1FwQXKw.js} +1 -1
  106. package/web/assets/{safe-mode-instance-fnZLVjjd.js → safe-mode-instance-TonxlRrq.js} +1 -1
  107. package/web/assets/safe-mode-sentinel-BG78O0yJ.js +1 -0
  108. package/web/assets/segmented-control-BlM_GKV6.js +1 -0
  109. package/web/assets/select-DD_WO-gs.js +1 -0
  110. package/web/assets/{separator-cVAjxx3U.js → separator-BPh_qxvc.js} +1 -1
  111. package/web/assets/{session-change-summary-api-3216hpjE.js → session-change-summary-api-B9M9m1C0.js} +1 -1
  112. package/web/assets/{session-home-CM2_V5SZ.js → session-home-BDT4lMMJ.js} +1 -1
  113. package/web/assets/{session-organization-api-KZqrJZdA.js → session-organization-api-BgCoIi2X.js} +1 -1
  114. package/web/assets/{session-scope-Bw40iOXx.js → session-scope-t_l7TRH5.js} +1 -1
  115. package/web/assets/{session-tree-actions-oMnZOFG4.js → session-tree-actions-7q68B3e-.js} +1 -1
  116. package/web/assets/{session-tree-summary-PpU7AyqE.js → session-tree-summary-CMgz9Uf-.js} +1 -1
  117. package/web/assets/{sheet-CASx5kBt.js → sheet-BTaIEX4w.js} +1 -1
  118. package/web/assets/{shortcuts-BOeaPAvF.js → shortcuts-BGzXmClx.js} +1 -1
  119. package/web/assets/{side-chat-context-BcCF9VZz.js → side-chat-context-D36twdWd.js} +7 -7
  120. package/web/assets/{sidebar-4xAUV3YP.js → sidebar-BIagLnrN.js} +2 -2
  121. package/web/assets/{sidebar-store-we4gMwQq.js → sidebar-store-DztdHlUn.js} +1 -1
  122. package/web/assets/slider-DTmAZl-R.js +1 -0
  123. package/web/assets/{speech-session-ClA_5hmd.js → speech-session-D0GE-Pym.js} +1 -1
  124. package/web/assets/{startup-queries--JqGB_Cp.js → startup-queries-BAWDaQY5.js} +1 -1
  125. package/web/assets/{switch-DRkmP9uM.js → switch-D_G8wFhs.js} +1 -1
  126. package/web/assets/tabs-DsgBuvJv.js +1 -0
  127. package/web/assets/{tooltip-EomUbN9-.js → tooltip-D4MFbqcG.js} +1 -1
  128. package/web/assets/{use-i18n-D2P6OO3w.js → use-i18n-CVZdp2ZN.js} +1 -1
  129. package/web/assets/use-mobile-DauOEda6.js +1 -0
  130. package/web/assets/{use-studio-actions-CIA2TwfZ.js → use-studio-actions-C4Zh15Vx.js} +2 -2
  131. package/web/assets/{useBoardItems-BU9aonpg.js → useBoardItems-DCo-4he0.js} +1 -1
  132. package/web/assets/{useFleetSystemInfo-BMpdQSqr.js → useFleetSystemInfo-BbQQId7X.js} +1 -1
  133. package/web/assets/{useNow-DAVNVxdo.js → useNow-CxO2FUQY.js} +1 -1
  134. package/web/assets/usePhoneShell-m3H_98m_.js +1 -0
  135. package/web/assets/{useSessionListQuery-DqZ3m8O9.js → useSessionListQuery-CJ-BYuqu.js} +1 -1
  136. package/web/assets/{useSessionRowActions-DTxXBruc.js → useSessionRowActions-D0GKtBhg.js} +1 -1
  137. package/web/assets/{useSidebarModel-DtY4PopW.js → useSidebarModel-b5cdTj9-.js} +1 -1
  138. package/web/assets/{web-preview-tGGVFpDI.js → web-preview-Bdrxyj-l.js} +1 -1
  139. package/web/assets/{web-preview-events-Bl80SpFF.js → web-preview-events-BBbAgfr4.js} +1 -1
  140. package/web/index.html +2 -2
  141. package/web/assets/AppSelect-fH3gqflO.js +0 -1
  142. package/web/assets/AssetsPage-BhrkErwt.js +0 -1
  143. package/web/assets/BrandLogo-C6O8cv-b.js +0 -1
  144. package/web/assets/ChannelsPage-C6A-ClM6.js +0 -1
  145. package/web/assets/ChatPage-B1V00hUs.js +0 -553
  146. package/web/assets/ComposerCommandMenu-BnwvT15Y.js +0 -1
  147. package/web/assets/ConfigPage-DwVhvmWL.js +0 -3
  148. package/web/assets/DispatchOverlay-ByJYJO36.js +0 -1
  149. package/web/assets/LaunchConsole-DRnR4Irg.js +0 -2
  150. package/web/assets/McpPage-DeuJ0HzI.js +0 -1
  151. package/web/assets/MemoryPage-CxFJYVZs.js +0 -1
  152. package/web/assets/SchedulesPage-BUDQGrHe.js +0 -1
  153. package/web/assets/SessionBrowserPane-Bq_U_5i9.js +0 -2
  154. package/web/assets/SessionContextPanel-V4QZj7xu.js +0 -2
  155. package/web/assets/SessionInspector-C14ilfNC.js +0 -1
  156. package/web/assets/TaskProcessesPane-hcChPVpA.js +0 -1
  157. package/web/assets/TaskTerminalView-DcFp0oHH.js +0 -18
  158. package/web/assets/WorkflowsPage-Dg9Mh9ND.js +0 -1
  159. package/web/assets/board-messages-CcVs4aSw.js +0 -1
  160. package/web/assets/checkbox-CG2AnYPm.js +0 -1
  161. package/web/assets/client-store-B-3_7075.js +0 -1
  162. package/web/assets/dist-DAs5KRGl.js +0 -1
  163. package/web/assets/dist-alOyD2Bh.js +0 -1
  164. package/web/assets/dropdown-menu-gZkWDhaR.js +0 -1
  165. package/web/assets/es2015-0QT3KgdC.js +0 -41
  166. package/web/assets/i18n-DPvJ0T4T.js +0 -1
  167. package/web/assets/index-DbL8igcD.css +0 -2
  168. package/web/assets/input-DIwJDpj9.js +0 -1
  169. package/web/assets/mount-app-CxpqEKPV.js +0 -9
  170. package/web/assets/placements-5xDVBdPk.js +0 -2
  171. package/web/assets/public-CyIfRdzo.js +0 -1
  172. package/web/assets/public-DwUlE0fE.js +0 -2
  173. package/web/assets/public-components-Cv7X4fW8.js +0 -1
  174. package/web/assets/public-diff-1bDiNGBB.js +0 -1
  175. package/web/assets/public-launch-D8n5o2kS.js +0 -1
  176. package/web/assets/safe-mode-sentinel-DEJ0ZBB_.js +0 -1
  177. package/web/assets/segmented-control-BOJt5SLj.js +0 -1
  178. package/web/assets/select-JC5m2BRQ.js +0 -1
  179. package/web/assets/tabs-C4VeYYS2.js +0 -1
  180. package/web/assets/usePhoneShell-w7JLYU3H.js +0 -1
@@ -1,2 +0,0 @@
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-D2P6OO3w.js";import{t as i}from"./useQuery-Bg3cTjsY.js";import{o as a}from"./startup-queries--JqGB_Cp.js";import{t as o}from"./runtime-capabilities-store--7mKyYAM.js";import{t as s}from"./createLucideIcon-Cd-3GVxJ.js";import{t as ee}from"./arrow-right-DqLOhpA2.js";import{t as c}from"./arrow-up-DST6-qVQ.js";import{t as l}from"./bot-B3TaBp_T.js";import{t as u}from"./chevron-down-CxtxIjiP.js";import{n as d,r as f,t as te}from"./launch-defaults-store-7CojCPDE.js";import{t as ne}from"./shield-alert-oZqX6MNu.js";import{t as re}from"./shield-B1ruzHd0.js";import{a as ie,i as ae,n as oe,t as se,u as ce}from"./ComposerCommandMenu-BnwvT15Y.js";import{a as p,c as le,o as m,p as h,r as g,s as _,t as v}from"./dropdown-menu-gZkWDhaR.js";import{t as y}from"./utils-C8uzG5AZ.js";import{t as ue}from"./button-Bu_vuij9.js";import{c as de,r as fe,t as pe}from"./shortcuts-BOeaPAvF.js";import{t as me}from"./useSessionListQuery-DqZ3m8O9.js";import{t as he}from"./useBoardItems-BU9aonpg.js";import{a as ge}from"./card-presentation-1oph2b8P.js";import{i as b,n as _e,t as ve}from"./board-launch-CUV0KEKT.js";import{t as ye}from"./public-launch-D8n5o2kS.js";import{t as be}from"./shortcut-aria-jHRmld9z.js";import{t as xe}from"./touch-target-BsyCgjR5.js";import{a as Se,o as x,r as S,t as C}from"./board-projects-VBEGB9VD.js";var Ce=s(`corner-down-left`,[[`path`,{d:`M20 4v7a4 4 0 0 1-4 4H4`,key:`6o5b7l`}],[`path`,{d:`m9 10-5 5 5 5`,key:`1kshq7`}]]),w=s(`list-ordered`,[[`path`,{d:`M11 5h10`,key:`1cz7ny`}],[`path`,{d:`M11 12h10`,key:`1438ji`}],[`path`,{d:`M11 19h10`,key:`11t30w`}],[`path`,{d:`M4 4h1v5`,key:`10yrso`}],[`path`,{d:`M4 9h2`,key:`r1h2o0`}],[`path`,{d:`M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02`,key:`xtkcd5`}]]),T=e(t(),1),we=`data-[fade=both]:[mask-image:linear-gradient(to_right,transparent,var(--foreground)_1.25rem,var(--foreground)_calc(100%-1.25rem),transparent)] data-[fade=end]:[mask-image:linear-gradient(to_right,var(--foreground)_calc(100%-1.25rem),transparent)] data-[fade=start]:[mask-image:linear-gradient(to_left,var(--foreground)_calc(100%-1.25rem),transparent)]`;function Te(e,t=``){let[n,r]=(0,T.useState)();return(0,T.useEffect)(()=>{let t=e.current;if(!t||typeof ResizeObserver!=`function`)return;let n=()=>{let e=t.scrollWidth-t.clientWidth,n=Math.abs(t.scrollLeft),i=e>1&&n>1,a=e>1&&n<e-1;r(i&&a?`both`:i?`start`:a?`end`:void 0)};n();let i=new ResizeObserver(n);i.observe(t);for(let e of Array.from(t.children))i.observe(e);return t.addEventListener(`scroll`,n,{passive:!0}),()=>{i.disconnect(),t.removeEventListener(`scroll`,n)}},[e,t]),n}var E=n();function Ee({value:e,onChange:t,size:n,compact:i=!1,className:a}){let{t:o}=r(),{items:s,capabilities:ee}=he(`today`);if(!ee.sessionQueue)return null;let c=s.filter(e=>e.lane===`running`||e.lane===`queued`),l=s.find(t=>t.id===e);if(!c.length&&!e)return null;let d=l?.title??o(`board:launch.startAfterGone`),f=e?o(`board:launch.startAfterChip`,{title:d}):o(`board:launch.startNowChip`),te=e?o(`board:launch.startAfterShort`,{title:d}):f;return(0,E.jsxs)(v,{children:[(0,E.jsx)(h,{asChild:!0,children:(0,E.jsxs)(b,{size:n,className:y(`min-w-0 max-w-[24ch] shrink`,e?`min-w-[14ch]`:`border-transparent bg-transparent`,a),title:f,"aria-label":`${o(`board:launch.startAfterLabel`)} · ${f}`,"data-launch-start-after":e||`now`,children:[(0,E.jsx)(w,{"aria-hidden":`true`}),(!i||e)&&(0,E.jsx)(`span`,{className:`min-w-0 truncate`,children:te}),(0,E.jsx)(u,{"aria-hidden":`true`})]})}),(0,E.jsxs)(g,{align:`start`,className:`max-h-[min(24rem,var(--radix-dropdown-menu-content-available-height))] w-72 overflow-y-auto`,children:[(0,E.jsx)(p,{children:o(`board:launch.startAfterLabel`)}),(0,E.jsxs)(m,{value:e,onValueChange:t,children:[(0,E.jsx)(_,{value:``,children:o(`board:launch.startNowChip`)}),c.map(e=>(0,E.jsx)(_,{value:e.id,"data-start-after-option":e.id,children:(0,E.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,E.jsx)(`span`,{className:`truncate`,children:e.title}),(0,E.jsx)(`span`,{className:`text-xs text-content-muted`,children:e.lane===`running`?o(`board:launch.startAfterRunning`):o(`board:launch.startAfterQueued`)})]})},e.id))]}),(0,E.jsx)(`p`,{className:`px-2 py-1.5 text-xs leading-relaxed text-content-muted`,children:o(`board:launch.startAfterHint`)})]})]})}function D(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function O(e){return typeof e==`string`?e:``}function k(e){return(Array.isArray(D(e).providers)?D(e).providers:[]).flatMap(e=>{let t=D(e),n=O(t.id);return!n||t.configured!==!0||t.enabled===!1?[]:(Array.isArray(t.models)?t.models:[]).flatMap(e=>{let r=D(e),i=O(r.id);return!i||r.kind!==`chat`?[]:[{key:`${n}/${i}`,label:O(r.name)||i,providerName:O(t.name)||n,thinkingLevels:Array.isArray(r.thinkingLevels)?r.thinkingLevels.filter(e=>typeof e==`string`):[]}]})})}function De(){let e=i(a(`config`)),t=me(),n=Se(e=>e.names),r=x(e=>e.projects),s=o(e=>e.capabilities.features),ee=(0,T.useMemo)(()=>k(e.data),[e.data]),c=e.data?.provider&&e.data?.model?`${e.data.provider}/${e.data.model}`:``,l=t.data?.sessions,u=(0,T.useMemo)(()=>S(l??[],r,n),[l,n,r]),d=(0,T.useMemo)(()=>C(l??[],u),[l,u]);return{models:ee,defaultModel:c,defaultThinkingLevel:O(e.data?.thinkingLevel)||`medium`,projects:u,defaultCwd:d,goalsAvailable:s.goals!==!1,teamAvailable:s.goals!==!1&&s.multiAgent!==!1,loading:e.isPending,error:e.error??null}}var Oe=`board:launch`,ke=`home:new`,Ae=`\0no-project`,je=new Set;function Me(e,t){let n=ae(e).text,r=n.trim()?`${t}\n${n}`:t;ie(e,{text:r});for(let t of je)t.key===e&&t.apply(r)}function Ne(){let{t:e}=r();return(0,T.useMemo)(()=>({thinking:t=>({off:e(`chat:focusSession.thinkingLabel.off`),minimal:e(`chat:focusSession.thinkingLabel.minimal`),low:e(`chat:focusSession.thinkingLabel.low`),medium:e(`chat:focusSession.thinkingLabel.medium`),high:e(`chat:focusSession.thinkingLabel.high`),xhigh:e(`chat:focusSession.thinkingLabel.xhigh`),max:e(`chat:focusSession.thinkingLabel.max`)})[t]||t,execution:{"approval-required":e(`chat:focusSession.approvalRequired`),"workspace-write":e(`chat:focusSession.workspaceWrite`),"full-access":e(`chat:focusSession.fullAccess`)},runMode:{plan:e(`chat:focusSession.planMode`),goal:e(`chat:focusSession.goalMode`),team:e(`chat:focusSession.teamMode`)}}),[e])}function Pe(e){return!e.value||e.selectionStart===0&&e.selectionEnd===0}var A=(0,T.forwardRef)(function({variant:e,autoFocus:t,compactChips:n,touch:i,onDispatched:a,onDetachedFailure:o,onConfigureModels:s,className:me},Se){let{t:x}=r(),S=Ne(),C=De(),w=d(),D=de(e=>e.bindings.sendMessage),O=(0,T.useRef)(null),k=(0,T.useRef)(null),A=e===`composer`?ke:Oe,Fe=e=>Me(A,e),[j,Ie]=(0,T.useState)(()=>ae(A).text),[M,N]=(0,T.useState)(null),[P,Le]=(0,T.useState)(0),[Re,ze]=(0,T.useState)(!1),[F,Be]=(0,T.useState)(``),{items:Ve}=he(`today`),He=F?Ve.find(e=>e.id===F)?.title??x(`board:launch.startAfterGone`):``,I=(0,T.useRef)(!0),L=`launch-input-${e}`,Ue=`launch-error-${e}`;(0,T.useEffect)(()=>{I.current=!0;let e={key:A,apply:e=>Ie(e)};return je.add(e),()=>{I.current=!1,je.delete(e)}},[A]);let R=(0,T.useCallback)(e=>{Ie(e),ie(A,{text:e})},[A]);(0,T.useImperativeHandle)(Se,()=>({focus:()=>O.current?.focus(),focusEnd:()=>{let e=O.current;e&&(e.focus(),e.setSelectionRange(e.value.length,e.value.length),e.scrollTop=e.scrollHeight)},fill:e=>{R(e),O.current?.focus()}}),[R]);let We=C.models.some(e=>e.key===w.model),z=We?w.model:C.defaultModel,B=C.models.find(e=>e.key===z),V=B?.thinkingLevels??[],H=V.includes(w.thinkingLevel)?w.thinkingLevel:``,Ge=H||(V.includes(C.defaultThinkingLevel)?C.defaultThinkingLevel:``),U=Re?`full-access`:w.executionMode||`approval-required`,W=w.runMode===`team`&&!C.teamAvailable||w.runMode===`goal`&&!C.goalsAvailable?`plan`:w.runMode,G=(0,T.useMemo)(()=>{if(!w.cwd||C.projects.some(e=>e.cwd===w.cwd))return C.projects;let e=w.cwd.replace(/[\\/]+$/,``).split(/[\\/]/).pop()||w.cwd;return[{key:w.cwd,cwd:w.cwd,label:e},...C.projects]},[w.cwd,C.projects]),K=(0,T.useMemo)(()=>ge(G),[G]),q=w.projectless,J=q?``:w.cwd||C.defaultCwd||G[0]?.cwd||``,Y=q?void 0:G.find(e=>e.cwd===J),Ke=Y?.label||x(q?`board:launch.noProject`:`board:launch.defaultProject`),qe=!C.loading&&!C.error&&C.models.length===0,Je=e=>{if(G.length<2)return!1;let t=Math.max(0,G.findIndex(e=>e.cwd===J)),n=G[(t+e+G.length)%G.length];return w.rememberLaunch({cwd:n.cwd}),!0},Ye=e=>{ze(e===`full-access`),e!==`full-access`&&w.rememberLaunch({executionMode:e})},Xe=(0,T.useCallback)(()=>ye(J),[J]),Ze=ce({t:x,models:C.models,model:z,onModel:e=>w.rememberLaunch({model:e,thinkingLevel:``}),thinkingLevels:V,thinkingLevel:Ge,thinkingLabel:S.thinking,onThinking:e=>w.rememberLaunch({thinkingLevel:e}),executionModes:te,executionMode:U,executionLabel:e=>S.execution[e]||e,onExecutionMode:e=>Ye(e),runModes:[`plan`,...C.goalsAvailable?[`goal`]:[],...C.teamAvailable?[`team`]:[]],runMode:W,runModeLabel:e=>S.runMode[e]||e,onRunMode:e=>w.rememberLaunch({runMode:e})}),Qe=(0,E.jsx)(se,{placement:e===`composer`?`top`:`bottom`,resourceKey:J,loadCommands:Xe,builtinCommands:Ze,value:j,onChange:R,inputRef:O}),X=e===`composer`,$e=Te(k,X?`${J}|${z}|${U}|${W}`:``),Z=async e=>{let t=j.trim();if(!t){O.current?.focus();return}if(X&&P>0)return;if(qe){N({message:x(`board:launch.noModel`),noModel:!0});return}N(null),R(``),oe(A),O.current?.focus(),Le(e=>e+1),ze(!1),w.rememberLaunch({...q?{projectless:q}:{cwd:J},model:We?z:``,thinkingLevel:H,executionMode:U,runMode:W});let n=F;Be(``);try{let r=await _e({prompt:t,cwd:J,projectless:q,model:We?z:``,thinkingLevel:H,executionMode:Re?`full-access`:w.executionMode,runMode:W,...n?{startAfter:n}:{}});a?.(r,{open:e})}catch(e){Fe(t),I.current&&n&&Be(n);let r=e instanceof ve||e instanceof Error?e.message:``,i=r?x(`board:launch.failedWithReason`,{reason:r}):x(`board:launch.failed`);I.current?N({message:i,noModel:!1}):o?.(i)}finally{I.current&&Le(e=>Math.max(0,e-1))}},et=e=>{if(!(e.nativeEvent.isComposing||e.keyCode===229)){if(X){if(fe(e.nativeEvent,D)){e.preventDefault(),Z(!0);return}}else if(e.key===`Enter`&&!e.shiftKey&&!e.altKey){e.preventDefault(),Z(e.metaKey||e.ctrlKey);return}e.key===`Tab`&&!e.shiftKey&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&Pe(e.currentTarget)&&Je(1)&&e.preventDefault()}},tt=j.split(`
2
- `).length,Q=e===`sheet`,nt=n||Q,$=Q||X?`default`:`sm`,rt=Q?`min-h-11`:$===`sm`?`pointer-coarse:min-h-11`:void 0,it=Q?`min-h-11`:$===`sm`?xe:void 0,at=B?nt?B.label:`${B.label}${Ge?` · ${S.thinking(Ge)}`:``}`:z?z.split(`/`).at(-1)||z:x(`board:launch.defaultModel`),ot=(0,E.jsxs)(v,{children:[(0,E.jsx)(h,{asChild:!0,children:(0,E.jsxs)(b,{size:$,className:y(Q?`max-w-[13ch] min-w-0 shrink`:X&&i?`max-w-[14ch]`:`max-w-[24ch] min-w-0 shrink`,it),title:Y?.cwd||void 0,"aria-label":x(`board:launch.projectLabel`,{project:Y?K.get(Y.key)?`${Y.label} (${K.get(Y.key)})`:Y.label:Ke}),children:[(0,E.jsx)(f,{"aria-hidden":`true`}),(0,E.jsx)(`span`,{className:y(`truncate`,Y?.label&&!Q?`min-w-[8ch] font-mono`:`min-w-0`,Y?.label&&Q&&`font-mono`),children:Ke}),(0,E.jsx)(u,{"aria-hidden":`true`})]})}),(0,E.jsx)(g,{align:`start`,className:`max-h-[min(24rem,var(--radix-dropdown-menu-content-available-height))] w-64 overflow-y-auto`,children:(0,E.jsxs)(m,{value:q?Ae:J,onValueChange:e=>w.rememberLaunch(e===Ae?{projectless:!0}:{cwd:e}),children:[(0,E.jsx)(_,{value:Ae,children:(0,E.jsx)(`span`,{className:`min-w-0 truncate`,children:x(`board:launch.noProject`)})}),(0,E.jsx)(le,{}),(0,E.jsx)(p,{children:x(`board:launch.projects`)}),G.length===0&&(0,E.jsx)(_,{value:``,children:x(`board:launch.defaultProject`)}),G.map(e=>(0,E.jsxs)(_,{value:e.cwd,title:e.cwd,children:[(0,E.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:e.label}),K.get(e.key)&&(0,E.jsx)(`span`,{className:`ml-auto min-w-0 truncate pl-2 font-mono text-xs text-content-muted`,children:K.get(e.key)})]},e.key))]})})]}),st=(0,E.jsxs)(v,{children:[(0,E.jsx)(h,{asChild:!0,children:(0,E.jsxs)(b,{size:$,className:y(Q?`max-w-[13ch] min-w-0`:`min-w-0 max-w-[24ch] shrink`,(X||e===`overlay`||Q)&&`border-transparent bg-transparent`,rt),title:x(`board:launch.modelTitle`,{model:at}),"aria-label":x(`board:launch.modelTitle`,{model:at}),children:[(0,E.jsx)(l,{"aria-hidden":`true`}),(0,E.jsx)(`span`,{className:`min-w-0 truncate`,children:at}),(0,E.jsx)(u,{"aria-hidden":`true`})]})}),(0,E.jsxs)(g,{align:`start`,className:`max-h-96 w-72 overflow-y-auto`,children:[(0,E.jsx)(p,{children:x(`board:launch.model`)}),C.models.length?(0,E.jsx)(m,{value:z,onValueChange:e=>w.rememberLaunch({model:e,thinkingLevel:``}),children:C.models.map(e=>(0,E.jsx)(_,{value:e.key,children:(0,E.jsxs)(`span`,{className:`min-w-0 truncate`,children:[e.providerName,` · `,e.label]})},e.key))}):(0,E.jsx)(`p`,{className:`px-2 py-1.5 text-xs text-content-muted`,children:C.loading?x(`board:launch.loadingModels`):x(`board:launch.noModel`)}),V.length>1&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(le,{}),(0,E.jsx)(p,{children:x(`board:launch.thinking`)}),(0,E.jsxs)(m,{value:H,onValueChange:e=>w.rememberLaunch({thinkingLevel:e}),children:[(0,E.jsx)(_,{value:``,children:x(`board:launch.thinkingDefault`)}),V.map(e=>(0,E.jsx)(_,{value:e,children:S.thinking(e)},e))]})]})]})]}),ct=U===`full-access`?ne:re,lt=W===`plan`?S.execution[U]:`${S.runMode[W]} · ${S.execution[U]}`,ut=(0,E.jsxs)(v,{children:[(0,E.jsx)(h,{asChild:!0,children:(0,E.jsxs)(b,{size:$,className:y(`min-w-0 max-w-[26ch] border-transparent bg-transparent`,Q&&`flex-none`,rt),title:`${x(`chat:focusSession.approvalMode`)} · ${lt}${Re?` · ${x(`board:launch.fullAccessOnce`)}`:``}`,"aria-label":`${x(`chat:focusSession.approvalMode`)} · ${lt}${Re?` · ${x(`board:launch.fullAccessOnce`)}`:``}`,"data-launch-mode":`${W}:${U}`,children:[(0,E.jsx)(ct,{"aria-hidden":`true`}),(0,E.jsx)(`span`,{className:`truncate`,children:nt&&W===`plan`&&U!==`full-access`?``:lt}),(0,E.jsx)(u,{"aria-hidden":`true`})]})}),(0,E.jsxs)(g,{align:`start`,className:`w-64`,children:[(0,E.jsx)(p,{children:x(`chat:focusSession.approvalMode`)}),(0,E.jsx)(m,{value:U,onValueChange:e=>Ye(e),children:te.map(e=>(0,E.jsx)(_,{value:e,children:e===`full-access`?(0,E.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,E.jsx)(`span`,{children:S.execution[e]}),(0,E.jsx)(`span`,{className:`text-xs text-content-muted`,children:x(`board:launch.fullAccessOnce`)})]}):S.execution[e]},e))}),(C.goalsAvailable||C.teamAvailable)&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(le,{}),(0,E.jsx)(p,{children:x(`chat:focusSession.executionMode`)}),(0,E.jsxs)(m,{value:W,onValueChange:e=>w.rememberLaunch({runMode:e}),children:[(0,E.jsx)(_,{value:`plan`,children:S.runMode.plan}),C.goalsAvailable&&(0,E.jsx)(_,{value:`goal`,children:S.runMode.goal}),C.teamAvailable&&(0,E.jsx)(_,{value:`team`,children:S.runMode.team})]})]})]})]}),dt=(0,E.jsx)(Ee,{value:F,onChange:Be,size:$,compact:nt,className:y(rt,Q&&`flex-none`)}),ft=(0,E.jsxs)(`div`,{ref:k,"data-fade":$e,"data-launch-chips":!0,className:y(`flex min-w-0 flex-1 items-center gap-1.5 overflow-x-auto [scrollbar-width:none]`,we),children:[ot,ut,dt]}),pt=X?(0,E.jsx)(ue,{type:`button`,size:`icon`,className:y(`flex-none rounded-full`,i?`size-11`:`size-8 pointer-coarse:size-11`),disabled:P>0,"aria-label":x(`board:home.send`),"aria-keyshortcuts":be(D),title:D?`${x(`board:home.send`)} (${pe(D)})`:void 0,"data-launch-send":!0,onClick:()=>void Z(!1),children:(0,E.jsx)(c,{"aria-hidden":`true`})}):(0,E.jsxs)(ue,{type:`button`,size:`sm`,className:y(`flex-none`,Q&&`min-h-11 px-4`),onClick:()=>void Z(!1),"aria-keyshortcuts":`Enter`,children:[x(`board:launch.dispatch`),!Q&&(0,E.jsx)(Ce,{"aria-hidden":`true`,className:`opacity-70`})]}),mt=M&&(0,E.jsxs)(`p`,{id:Ue,role:`alert`,className:`flex min-w-0 items-center gap-2 text-xs text-st-fail`,children:[(0,E.jsx)(`span`,{className:`min-w-0 truncate`,children:M.message}),M.noModel&&(0,E.jsxs)(ue,{variant:`link`,size:`xs`,className:`h-auto px-0`,onClick:s,children:[x(`board:launch.configureModels`),(0,E.jsx)(ee,{"aria-hidden":`true`})]})]}),ht=P>0&&(0,E.jsx)(`span`,{role:`status`,className:`flex-none text-xs text-content-muted`,children:X?x(`board:home.sending`):x(`board:launch.sending`,{count:P})});return X?(0,E.jsxs)(`section`,{"aria-label":x(`board:home.composerLabel`),"data-launch-console":e,className:y(`flex min-w-0 flex-col rounded-[var(--composer-radius,22px)] border border-control bg-panel shadow-composer transition-[border-color,box-shadow] duration-(--d-fast) has-[textarea:focus-visible]:border-focus has-[textarea:focus-visible]:ring-3 has-[textarea:focus-visible]:ring-focus-ring max-[650px]:rounded-2xl`,me),children:[(0,E.jsx)(`label`,{htmlFor:L,className:`sr-only`,children:x(`board:launch.inputLabel`)}),Qe,(0,E.jsx)(`textarea`,{ref:O,id:L,"data-launch-input":!0,autoFocus:t,rows:Math.min(6,Math.max(2,tt)),value:j,placeholder:i?x(`board:home.placeholderTouch`):D?x(`board:home.placeholder`,{send:pe(D)}):x(`board:home.placeholderUnbound`),"aria-invalid":M?!0:void 0,"aria-describedby":M?Ue:void 0,"aria-keyshortcuts":be(D),onChange:e=>{R(e.target.value),M&&!M.noModel&&N(null)},onKeyDown:et,className:y(`max-h-[220px] min-h-11 w-full min-w-0 resize-none bg-transparent px-4 pt-3 pb-1 text-[length:calc(var(--app-message-font-size)*.9375)] leading-5 text-content outline-none placeholder:text-content-muted max-[650px]:px-3.5`,i&&`text-[length:var(--app-message-font-size)]`)}),mt&&(0,E.jsx)(`div`,{className:`px-4 max-[650px]:px-3.5`,children:mt}),(0,E.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 px-2 pt-1 pb-2`,"data-launch-toolbar":!0,children:[ft,ht,(0,E.jsx)(`span`,{className:`flex min-w-0 shrink items-center`,children:st}),pt]})]}):(0,E.jsxs)(`section`,{"aria-label":x(`board:launch.title`),"data-launch-console":e,className:y(`flex min-w-0 flex-col`,me),children:[(0,E.jsx)(`label`,{htmlFor:L,className:`sr-only`,children:x(`board:launch.inputLabel`)}),Qe,(0,E.jsx)(`textarea`,{ref:O,id:L,"data-launch-input":!0,autoFocus:t,rows:Math.min(8,Math.max(3,tt)),value:j,placeholder:x(Q?`board:launch.placeholderTouch`:`board:launch.placeholder`),"aria-invalid":M?!0:void 0,"aria-describedby":M?Ue:void 0,"aria-keyshortcuts":`Enter Meta+Enter Control+Enter Shift+Enter`,onChange:e=>{R(e.target.value),M&&!M.noModel&&N(null)},onKeyDown:et,className:y(`w-full min-w-0 resize-none bg-transparent text-content caret-st-attn-fill outline-none placeholder:text-content-muted`,Q?`max-h-[40dvh] min-h-[88px] rounded-[var(--r-md)] border border-control bg-panel px-3 py-2.5 text-[16px] leading-6 transition-[border-color,box-shadow] duration-(--d-fast) focus-visible:border-focus focus-visible:ring-3 focus-visible:ring-focus-ring`:`max-h-[240px] min-h-[72px] px-5 pt-1 pb-2 text-[15px] leading-6`)}),mt&&(0,E.jsx)(`div`,{className:Q?`pt-1.5`:`px-5 pb-1`,children:mt}),He&&(0,E.jsx)(`p`,{"data-launch-start-after-note":!0,className:y(`text-xs text-content-muted`,Q?`pt-1.5`:`px-5 pb-1`),children:x(`board:launch.startAfterNote`,{title:He})}),(0,E.jsxs)(`div`,{className:y(`flex min-w-0 items-center gap-1.5`,Q?`pt-2`:`px-3 pb-3`),"data-launch-toolbar":!0,children:[(0,E.jsxs)(`div`,{ref:k,"data-launch-chips":!0,className:`flex min-w-0 flex-[1_1_auto] items-center gap-1.5 overflow-hidden`,children:[ot,ut,dt]}),ht,(0,E.jsx)(`span`,{className:`flex min-w-0 shrink items-center`,children:st}),pt]})]})});export{A as t};
@@ -1 +0,0 @@
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-D2P6OO3w.js";import{S as i,c as a,g as o,m as s,r as c,t as l,u,v as d,y as f}from"./useQuery-Bg3cTjsY.js";import{n as p}from"./mutation-Difliohy.js";import{t as m}from"./queryOptions-Dfvzj6n2.js";import{a as h,l as g}from"./api-DVgYxLec.js";import{t as _}from"./check-2vYc6QaP.js";import{t as v}from"./copy-DHmIFc52.js";import{t as ee}from"./key-round-C29uZbsf.js";import{t as y}from"./plus-fQbSqB1n.js";import{t as b}from"./refresh-cw-TbWxTY4K.js";import{t as x}from"./rotate-ccw-clock-CO6Bw-sF.js";import{t as S}from"./server-BgNvmqwJ.js";import{t as C}from"./trash-2-CNrPOoPR.js";import{t as w}from"./wrench-6pg6_bqI.js";import{t as T}from"./x-07u4-129.js";import{t as E}from"./more-pages-D_PnxLN0.js";import{t as D}from"./switch-DRkmP9uM.js";import{t as O}from"./utils-C8uzG5AZ.js";import{n as k,t as A}from"./button-Bu_vuij9.js";import{s as te}from"./shortcuts-BOeaPAvF.js";import{a as j}from"./format-DMJQzoZ7.js";import{n as M,t as N}from"./PageState-aWHrkE1D.js";import{t as P}from"./alert-firawb0H.js";import{a as F,i as I,l as L,o as R,s as z,t as ne}from"./dialog-Kx6RCn3A.js";import{a as re,i as B,n as V,o as ie,r as ae,s as oe}from"./FeaturePage-1MUXz3Y-.js";import{t as se}from"./textarea-DmATpOqT.js";var ce=class extends i{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),d(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&u(t.mutationKey)!==u(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??p();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){a.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},H=e(t(),1);function le(e,t){let n=c(t);return ue({filters:{...e,status:`pending`}},n).length}function U(e,t){return e.findAll(t.filters).map(e=>t.select?t.select(e):e.state)}function ue(e={},t){let n=c(t).getMutationCache(),r=H.useRef(e),i=H.useRef(null);return i.current===null&&(i.current=U(n,e)),H.useEffect(()=>{r.current=e}),H.useSyncExternalStore(H.useCallback(e=>n.subscribe(()=>{let t=o(i.current,U(n,r.current));i.current!==t&&(i.current=t,a.schedule(e))}),[n]),()=>i.current,()=>i.current)}function de(e,t){let n=c(t),[r]=H.useState(()=>new ce(n,e));H.useEffect(()=>{r.setOptions(e)},[r,e]);let i=H.useSyncExternalStore(H.useCallback(e=>r.subscribe(a.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),o=H.useCallback((e,t)=>{r.mutate(e,t).catch(s)},[r]);if(i.error&&f(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:o,mutateAsync:i.mutate}}function W(e){if(!e||typeof e!=`object`||Array.isArray(e))throw g();return Object.fromEntries(Object.entries(e))}function G(e,t=!1){if(e==null&&!t)return``;if(typeof e!=`string`||t&&!e)throw g();return e}function K(e,t=0){if(e==null)return t;if(typeof e!=`number`||!Number.isFinite(e))throw g();return e}function q(e){if(typeof e!=`boolean`)throw g();return e}function fe(e,t){if(e===void 0)return[];if(!Array.isArray(e))throw g();return e.map(t)}function pe(e){let t=W(e);return{id:G(t.id,!0),name:G(t.name,!0),status:G(t.status),transport:G(t.transport),endpoint:G(t.endpoint),command:G(t.command),workingDirectory:G(t.workingDirectory),enabled:q(t.enabled),error:G(t.error),latencyMs:t.latencyMs==null?null:K(t.latencyMs),lastPingAt:G(t.lastPingAt),auth:G(t.auth),authCount:K(t.authCount)}}function me(e){let t=W(e);return{serviceId:G(t.serviceId,!0),serviceName:G(t.serviceName),name:G(t.name,!0),piName:G(t.piName,!0),description:G(t.description),enabled:q(t.enabled),serviceEnabled:q(t.serviceEnabled),risk:G(t.risk)}}function he(e){let t=W(e);return{id:G(t.id,!0),serviceId:G(t.serviceId,!0),toolName:G(t.toolName),timestamp:G(t.timestamp),status:G(t.status),error:G(t.error),durationMs:K(t.durationMs)}}function J(e){let t=W(e);if(!Array.isArray(t.services))throw g();let n=t.metrics===void 0?{}:W(t.metrics);return{services:t.services.map(pe),tools:fe(t.tools,me),calls:fe(t.calls,he),metrics:{totalServices:K(n.totalServices),onlineServices:K(n.onlineServices),availableTools:K(n.availableTools),restrictedTools:K(n.restrictedTools),errorRate:K(n.errorRate)}}}var Y=e=>`/api/mcp/${encodeURIComponent(e)}`,X={dashboard:e=>h(`/api/mcp?refresh=0`,{signal:e,parse:J}),add:e=>h(`/api/mcp`,{method:`POST`,body:{spec:e},parse:J}),setServerEnabled:(e,t)=>h(Y(e),{method:`PATCH`,body:{enabled:t},parse:J}),setToolEnabled:(e,t,n)=>h(`${Y(e)}/tools/${encodeURIComponent(t)}`,{method:`PATCH`,body:{enabled:n},parse:J}),test:e=>h(`${Y(e)}/test`,{method:`POST`,body:{},parse:J}),remove:async e=>(await h(Y(e),{method:`DELETE`}),X.dashboard())};function ge(e){if(!e||typeof e!=`object`||Array.isArray(e))throw g();return Object.fromEntries(Object.entries(e))}function _e(e){let t=ge(e);if(typeof t.enabled!=`boolean`||typeof t.listening!=`boolean`||typeof t.host!=`string`||typeof t.port!=`number`||!Number.isInteger(t.port)||typeof t.url!=`string`||t.error!==null&&typeof t.error!=`string`)throw g();return{enabled:t.enabled,listening:t.listening,host:t.host,port:t.port,url:t.url,error:t.error}}function ve(e){let t=ge(e);if(typeof t.url!=`string`||!t.url||typeof t.token!=`string`||!t.token)throw g();return{url:t.url,token:t.token}}var Z={status:e=>h(`/api/mcp-host`,{signal:e,parse:_e}),setEnabled:e=>h(`/api/mcp-host`,{method:`PATCH`,body:{enabled:e},parse:_e}),credentials:e=>h(`/api/mcp-host/credentials`,{method:`POST`,body:{},signal:e,parse:ve}),rotateToken:e=>h(`/api/mcp-host/rotate-token`,{method:`POST`,body:{},signal:e,parse:ve})},Q=n(),ye=[`mcp-host`,`status`];function be(e){return JSON.stringify({mcpServers:{pisper:{url:e.url,headers:{Authorization:`Bearer ${e.token}`}}}},null,2)}function xe({notify:e,requestConfirm:t}){let{t:n}=r(),i=c(),[a,o]=(0,H.useState)(!1),[s,u]=(0,H.useState)(!1),[d,f]=(0,H.useState)(!1),[p,m]=(0,H.useState)(null),[h,g]=(0,H.useState)(``),_=(0,H.useRef)(null),y=(0,H.useRef)(null),x=typeof window<`u`&&!!window.__PISPER_MOBILE_APP__,C=l({queryKey:ye,queryFn:({signal:e})=>Z.status(e),enabled:!x&&!a,refetchInterval:15e3});if((0,H.useEffect)(()=>()=>{_.current?.abort()},[]),x)return null;let w=C.data,T=p?be(p):``,E=()=>{_.current?.abort(),_.current=null,m(null),g(``),f(!1)},te=async()=>{_.current?.abort();let e=new AbortController;_.current=e,u(!0),m(null),g(``),f(!0);try{let t=await Z.credentials(e.signal);e.signal.aborted||m(t)}catch(t){e.signal.aborted||g(t instanceof Error?t.message:n(`mcp:hostLoadFailed`))}finally{_.current===e&&(_.current=null,u(!1))}},j=async t=>{o(!0);try{let r=await Z.setEnabled(t);i.setQueryData(ye,r),t||E(),e(r.error||n(t?`mcp:hostEnabledNotice`:`mcp:hostDisabledNotice`),r.error?`error`:`success`)}catch(t){e(t instanceof Error?t.message:n(`mcp:hostUpdateFailed`),`error`)}finally{o(!1)}},M=async()=>{if(t&&!await t({title:n(`mcp:hostRotateTitle`),message:n(`mcp:hostRotateWarning`),confirmLabel:n(`mcp:hostRotate`),tone:`danger`}))return;_.current?.abort();let r=new AbortController;_.current=r,u(!0),g(``),m(null);try{let t=await Z.rotateToken(r.signal);r.signal.aborted||(m(t),e(n(`mcp:hostRotatedNotice`),`success`))}catch(e){r.signal.aborted||g(e instanceof Error?e.message:n(`mcp:hostRotateFailed`))}finally{_.current===r&&(_.current=null,u(!1))}},N=async()=>{try{await navigator.clipboard.writeText(T),e(n(`mcp:hostCopied`),`success`)}catch{y.current?.select(),e(n(`mcp:hostCopyManually`),`error`)}};return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(V,{className:`mcp-host mt-7`,children:(0,Q.jsx)(B,{"data-mcp-host":!0,icon:(0,Q.jsx)(S,{}),name:n(`mcp:hostTitle`),description:n(`mcp:hostDescription`),status:w&&(0,Q.jsxs)(`span`,{className:O(`flex items-center gap-1.5`,!w.listening&&w.enabled&&`font-medium text-st-attn`),children:[!w.listening&&w.enabled&&(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 flex-none rounded-full bg-st-attn-fill`}),w.listening?n(`mcp:hostReady`):w.enabled?n(`mcp:hostUnavailable`):n(`mcp:disabled`)]}),actions:(0,Q.jsx)(D,{checked:!!w?.enabled,disabled:!w||a,"aria-label":n(`mcp:hostEnabled`),title:n(`mcp:hostEnabled`),onCheckedChange:e=>void j(e)}),detail:C.isPending||C.error||w?.error||w?.listening?(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[C.isPending&&(0,Q.jsx)(`p`,{role:`status`,className:`text-xs text-content-muted`,children:n(`mcp:loading`)}),C.error&&(0,Q.jsxs)(P,{className:`flex flex-wrap items-center justify-between gap-2 text-xs text-muted-foreground`,children:[(0,Q.jsx)(`span`,{children:C.error.message}),(0,Q.jsx)(A,{size:`sm`,variant:`ghost`,className:`max-[650px]:h-11`,onClick:()=>void C.refetch(),children:n(`mcp:retry`)})]}),w?.error&&(0,Q.jsx)(P,{role:`status`,className:`text-xs text-muted-foreground`,children:w.error}),w?.listening&&(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:[(0,Q.jsx)(`code`,{className:`max-w-full min-w-0 rounded-xs border border-stroke bg-code px-2 py-0.5 font-mono text-xs break-all text-content`,children:w.url}),(0,Q.jsxs)(A,{size:`sm`,variant:`secondary`,className:`max-[650px]:h-11`,onClick:()=>void te(),children:[(0,Q.jsx)(ee,{"data-icon":`inline-start`}),n(`mcp:hostShowConfig`)]})]})]}):void 0})}),(0,Q.jsx)(ne,{open:d,onOpenChange:e=>!e&&E(),children:(0,Q.jsxs)(I,{className:`min-w-0 grid-cols-[minmax(0,1fr)] sm:max-w-xl`,children:[(0,Q.jsxs)(z,{className:`min-w-0 pr-8 text-left`,children:[(0,Q.jsx)(L,{children:n(`mcp:hostConfigTitle`)}),(0,Q.jsx)(F,{className:`leading-5`,children:n(`mcp:hostConfigDescription`)})]}),s&&(0,Q.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 text-sm text-content-muted`,children:[(0,Q.jsx)(k,{}),n(`mcp:hostLoadingConfig`)]}),h&&(0,Q.jsx)(P,{role:`alert`,className:`text-sm text-muted-foreground`,children:h}),p&&(0,Q.jsx)(se,{ref:y,value:T,readOnly:!0,spellCheck:!1,"aria-label":n(`mcp:hostConfigTitle`),className:`h-52 max-h-[45dvh] resize-y bg-code font-mono text-xs [overflow-wrap:anywhere]`,onFocus:e=>e.currentTarget.select()}),(0,Q.jsxs)(R,{className:`min-w-0 flex-wrap`,children:[(0,Q.jsxs)(A,{variant:`secondary`,disabled:s,onClick:()=>void M(),children:[(0,Q.jsx)(b,{"data-icon":`inline-start`}),n(`mcp:hostRotate`)]}),(0,Q.jsxs)(A,{disabled:!p||s,onClick:()=>void N(),children:[(0,Q.jsx)(v,{"data-icon":`inline-start`}),n(`mcp:hostCopyConfig`)]})]})]})})]})}var $=[`mcp`,`dashboard`],Se=[`mcp`,`change`];function Ce(){return m({queryKey:$,queryFn:({signal:e})=>X.dashboard(e),staleTime:0,retry:!1})}function we(e){return{mutationKey:Se,scope:{id:`mcp-dashboard`},retry:!1,mutationFn:async t=>(await e.cancelQueries({queryKey:$}),t()),onSuccess:t=>e.setQueryData($,t),onSettled:()=>e.invalidateQueries({queryKey:$})}}function Te(){let e=c(),t=le({mutationKey:Se})>0,n=l({...Ce(),enabled:!t,refetchInterval:!t&&1e4}),r=de(we(e));return{data:n.data,loading:n.isPending,error:r.error||n.error,busy:t,change:r.mutateAsync,reload:()=>(r.reset(),n.refetch())}}var Ee=`grid grid-cols-[88px_minmax(0,1fr)] gap-x-3 gap-y-1.5 text-xs [&_dd]:min-w-0 [&_dd]:[overflow-wrap:anywhere] [&_dd]:text-content-soft [&_dt]:text-content-muted [&>div]:contents`;function De(e,t){return e===`online`?[t(`mcp:online`),!1]:e===`connecting`?[t(`mcp:connecting`),!1]:e===`unauthorized`?[t(`mcp:unauthorized`),!0]:e===`disabled`?[t(`mcp:disabled`),!1]:[t(`mcp:offline`),!0]}function Oe(e,t){return e===`high`||e===`高风险`?t(`mcp:highRisk`):e===`medium`||e===`中风险`?t(`mcp:mediumRisk`):e===`low`||e===`低风险`?t(`mcp:lowRisk`):String(e||``)}function ke(e,t){return e.auth===`headers`?t(`mcp:countRequestHeaders`,{count:e.authCount}):e.auth===`environment`?t(`mcp:configuredEnvironmentVariables`):e.auth===`local`?t(`mcp:localProcess`):t(`mcp:none`)}function Ae({notify:e,onBack:t,requestText:n,requestConfirm:i}){let{t:a,language:o}=r(),s=te(`focusSearch`),{data:c,busy:l,loading:u,error:d,change:f,reload:p}=Te(),[m,h]=(0,H.useState)(``),[g,v]=(0,H.useState)(``),ee=(0,H.useCallback)(async()=>{let t=await n?.({title:a(`mcp:addMCPService`),message:a(`mcp:enterAStreamableHTTPURLAStdioCommandOrJSONContainingHeadersEnv`),inputLabel:a(`mcp:serverConfiguration`),placeholder:`https://server.example.com/mcp`,maxLength:12e3,confirmLabel:a(`mcp:continue`)});if(t?.trim()&&await i?.({title:a(`mcp:connectMCPServer`),message:a(`mcp:mcpServersCanExposeToolsThatPerformExternalActionsConnectOnlyToServersYouTrust`),confirmLabel:a(`mcp:connect`),tone:`danger`})!==!1)try{let n=await f(()=>X.add(t));v(n.services.at(-1)?.id||``),e(a(`mcp:mcpServerAdded`),`success`)}catch(t){e(t instanceof Error?t.message:String(t),`error`)}},[f,e,i,n,a]),k=m.trim().toLowerCase(),F=c?.services||[],I=F.filter(e=>`${e.name} ${e.endpoint}`.toLowerCase().includes(k)),L=(c?.tools||[]).filter(e=>`${e.name} ${e.serviceName} ${e.description}`.toLowerCase().includes(k)),R=c?.metrics||{totalServices:0,onlineServices:0,availableTools:0,restrictedTools:0,errorRate:0},z=async(t,n)=>{try{await f(()=>X.setToolEnabled(t.serviceId,t.name,n))}catch(t){e(t instanceof Error?t.message:String(t),`error`)}},ne=async(t,n)=>{try{await f(()=>X.setServerEnabled(t.id,n)),e(a(n?`mcp:mcpServerEnabled`:`mcp:mcpServerDisabled`),`success`)}catch(t){e(t instanceof Error?t.message:String(t),`error`)}},se=async t=>{try{await f(()=>X.test(t.id)),e(a(`mcp:mcpConnectionTestPassed`),`success`)}catch(t){e(t instanceof Error?t.message:String(t),`error`)}},ce=async t=>{if(await i?.({title:a(`mcp:deleteMCPServer`),message:a(`mcp:afterDeletionToolsFromThisServerWillBeRemovedFromSubsequentAgentRuns`),confirmLabel:a(`mcp:delete`),tone:`danger`})!==!1)try{await f(()=>X.remove(t.id)),v(``),e(a(`mcp:mcpServerDeleted`),`success`)}catch(t){e(t instanceof Error?t.message:String(t),`error`)}},le=e=>{let t=(c?.calls||[]).filter(t=>t.serviceId===e.id);return(0,Q.jsxs)(`div`,{className:`mcp-service-detail grid gap-3`,children:[(0,Q.jsx)(`p`,{className:O(`text-xs leading-normal [overflow-wrap:anywhere]`,e.error?`font-mono text-content-secondary`:`text-content-muted`),children:e.error||a(`mcp:thisServerExposesToolsThroughAStandardMCPTransportEnabledToolsAreRegisteredInNewAgentRuntimes`)}),(0,Q.jsx)(`dl`,{className:Ee,children:[[a(`mcp:transport`),e.transport===`stdio`?`stdio`:e.transport===`sse`?`HTTP + SSE`:`Streamable HTTP`,!1],...e.transport===`stdio`?[[a(`mcp:executable`),e.command||`—`,!0],[a(`mcp:workingDirectory`),e.workingDirectory||`—`,!0]]:[[a(`mcp:serverAddress`),e.endpoint||`—`,!0]],[a(`mcp:latency`),e.latencyMs==null?`—`:`${e.latencyMs} ms`,!1],[a(`mcp:lastPing`),e.lastPingAt?j(e.lastPingAt,o):`—`,!1],[a(`mcp:authentication`),ke(e,a),!1]].map(([e,t,n])=>(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{children:e}),(0,Q.jsx)(`dd`,{className:n?`font-mono`:`tabular-nums`,children:t})]},e))}),(0,Q.jsxs)(`section`,{className:`mcp-calls-panel min-w-0`,"aria-label":a(`mcp:recentCalls`),children:[(0,Q.jsxs)(`h3`,{className:`mb-1 text-xs font-medium text-content-muted tabular-nums`,children:[a(`mcp:recentCalls`),t.length>0&&(0,Q.jsxs)(`span`,{children:[` · `,Math.min(t.length,8)]})]}),t.length?(0,Q.jsx)(`ul`,{role:`list`,className:`m-0 list-none divide-y divide-stroke p-0`,children:t.slice(0,8).map(e=>{let t=e.status===`ok`;return(0,Q.jsxs)(`li`,{className:O(`activity-row grid min-h-10 min-w-0 grid-cols-[16px_minmax(0,1fr)_auto] items-center gap-2.5 py-1.5`,t?`completed`:`failed`),children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`grid size-4 place-items-center text-content-muted [&_svg]:size-3.5 [&_svg]:stroke-[2]`,children:t?(0,Q.jsx)(_,{}):(0,Q.jsx)(T,{})}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Q.jsx)(`strong`,{className:`truncate font-mono text-xs font-medium text-content`,children:e.toolName}),(0,Q.jsx)(`small`,{className:`truncate text-xs text-content-muted`,children:t?a(`mcp:callSucceeded`):e.error||a(`mcp:callFailed`)})]}),(0,Q.jsxs)(`span`,{className:`flex flex-col items-end text-xs text-content-muted tabular-nums`,children:[(0,Q.jsxs)(`span`,{className:`text-content-secondary`,children:[e.durationMs,` ms`]}),(0,Q.jsx)(`span`,{children:j(e.timestamp,o)})]})]},e.id)})}):(0,Q.jsxs)(`p`,{className:`flex items-center gap-1.5 py-1 text-xs text-content-muted`,children:[(0,Q.jsx)(x,{className:`size-3.5`,"aria-hidden":`true`}),a(`mcp:noRecentCalls`)]})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[(0,Q.jsxs)(A,{size:`sm`,variant:`ghost`,className:`text-danger hover:bg-danger-soft hover:text-danger max-[650px]:h-11`,disabled:l,onClick:()=>void ce(e),children:[(0,Q.jsx)(C,{"data-icon":`inline-start`}),a(`mcp:delete`)]}),(0,Q.jsxs)(A,{size:`sm`,variant:`secondary`,className:`max-[650px]:h-11`,loading:l,disabled:!e.enabled||l,onClick:()=>void se(e),children:[(0,Q.jsx)(b,{"data-icon":`inline-start`}),a(`mcp:testConnection`)]})]})]})};return(0,Q.jsxs)(ae,{title:a(`navigation:navigation.mcp`),description:a(`mcp:lede`),back:t&&{label:a(`navigation:sidebar.features`),ariaLabel:a(`navigation:shell.backToFeaturesLabel`),onBack:t},toolbar:(0,Q.jsx)(oe,{search:(0,Q.jsx)(re,{id:E,value:m,onValueChange:h,placeholder:a(`navigation:pageHeader.searchServicesOrTools`),shortcut:s,clearLabel:a(`navigation:more.clearSearch`)}),actions:(0,Q.jsxs)(A,{type:`button`,className:`h-9`,"data-mcp-add":!0,disabled:l,onClick:()=>void ee(),children:[(0,Q.jsx)(y,{}),a(`navigation:pageHeader.addService`)]})}),children:[(0,Q.jsx)(xe,{notify:e,requestConfirm:i}),u&&!c&&!d?(0,Q.jsx)(M,{kind:`loading`,title:a(`mcp:loading`)}):!c&&d?(0,Q.jsx)(M,{kind:`error`,title:a(`mcp:loadFailed`),description:d.message,action:(0,Q.jsx)(A,{variant:`secondary`,className:`max-[650px]:h-11`,disabled:l,onClick:()=>void p(),children:a(`mcp:retry`)})}):c&&(0,Q.jsxs)(Q.Fragment,{children:[d&&(0,Q.jsxs)(P,{role:`status`,className:`mt-4 flex min-w-0 items-center justify-between gap-3 text-muted-foreground [overflow-wrap:anywhere]`,children:[(0,Q.jsx)(`span`,{children:d.message}),(0,Q.jsx)(A,{variant:`ghost`,className:`max-[650px]:h-11`,disabled:l,onClick:()=>void p(),children:a(`mcp:retry`)})]}),(0,Q.jsx)(ie,{className:`mcp-services`,title:a(`mcp:services`),count:I.length,meta:F.length>0&&a(`mcp:serviceSummary`,{online:R.onlineServices,total:R.totalServices,rate:R.errorRate}),children:I.length?(0,Q.jsx)(V,{children:I.map(e=>{let[t,n]=De(e.status,a),r=e.transport===`stdio`?e.workingDirectory||e.command:e.endpoint;return(0,Q.jsx)(B,{className:`service-row`,"data-mcp-service":e.id,icon:(0,Q.jsx)(S,{}),name:e.name,description:(0,Q.jsx)(`span`,{className:`font-mono text-xs`,title:r,children:r}),status:(0,Q.jsxs)(`span`,{"data-mcp-status":e.status||`offline`,className:O(`flex items-center gap-1.5`,n&&`font-medium text-st-attn`),children:[n&&(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 flex-none rounded-full bg-st-attn-fill`}),t]}),actions:(0,Q.jsx)(D,{checked:e.enabled,disabled:l,"aria-label":a(`mcp:toggleServiceName`,{name:e.name}),onCheckedChange:t=>void ne(e,t)}),expanded:g===e.id,onExpandedChange:t=>v(t?e.id:``),toggleLabel:a(`mcp:toggleServiceDetails`,{name:e.name}),detail:le(e)},e.id)})}):(0,Q.jsx)(N,{icon:S,title:a(`mcp:noServerConfigured`),description:F.length?void 0:a(`mcp:emptyAddHint`)})}),(0,Q.jsx)(ie,{className:`mcp-tools-panel`,title:a(`mcp:toolCapabilities`),count:L.length,meta:R.restrictedTools>0&&a(`mcp:toolSummary`,{count:R.restrictedTools}),children:L.length?(0,Q.jsx)(V,{children:L.map(e=>(0,Q.jsx)(B,{className:`tool-row`,"data-mcp-tool":e.piName,icon:(0,Q.jsx)(w,{}),name:(0,Q.jsx)(`span`,{className:`font-mono`,children:e.name}),description:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`font-mono`,children:e.serviceName}),e.description&&(0,Q.jsxs)(Q.Fragment,{children:[` · `,e.description]})]}),status:Oe(e.risk,a),actions:(0,Q.jsx)(D,{checked:!!e.enabled,disabled:l||!e.serviceEnabled,"aria-label":a(`mcp:toggleToolName`,{name:e.name}),onCheckedChange:t=>void z(e,t)})},e.piName))}):(0,Q.jsx)(N,{compact:!0,icon:w,title:a(`mcp:noToolsAvailable`)})})]})]})}export{Ae as McpPage};
@@ -1 +0,0 @@
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-D2P6OO3w.js";import{t as i}from"./api-DVgYxLec.js";import{t as a}from"./createLucideIcon-Cd-3GVxJ.js";import{t as o}from"./check-2vYc6QaP.js";import{t as s}from"./file-code-corner-BnE1ljT0.js";import{t as c}from"./info-DATxy0fb.js";import{t as l}from"./pencil-U08v_vV9.js";import{t as u}from"./plus-fQbSqB1n.js";import{t as d}from"./refresh-cw-TbWxTY4K.js";import{t as f}from"./sparkles-S_eeuqn9.js";import{t as p}from"./trash-2-CNrPOoPR.js";import{t as m}from"./x-07u4-129.js";import{t as h}from"./more-pages-D_PnxLN0.js";import{i as ee,n as g,t as te}from"./tooltip-EomUbN9-.js";import{t as ne}from"./utils-C8uzG5AZ.js";import{n as _,t as v}from"./button-Bu_vuij9.js";import{s as y}from"./shortcuts-BOeaPAvF.js";import{n as b,r as x,t as re}from"./PageState-aWHrkE1D.js";import{t as S}from"./input-DIwJDpj9.js";import{a as ie,i as ae,n as oe,o as se,r as ce,s as le,t as ue}from"./FeaturePage-1MUXz3Y-.js";import{t as C}from"./field-Bnm9KAi2.js";import{c as de,i as fe,n as w,t as T}from"./app-primitives-Cmdj4cIW.js";import{t as E}from"./AppSelect-fH3gqflO.js";var pe=a(`zoom-out`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]),D=a(`zoom-in`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`11`,x2:`11`,y1:`8`,y2:`14`,key:`1vmskp`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]),O=e(t(),1);function k(e={}){let{rootMargin:t=`96px 0px`,threshold:n=0}=e,[r,i]=(0,O.useState)(null),[a,o]=(0,O.useState)(()=>!document.hidden),[s,c]=(0,O.useState)(!0),l=(0,O.useCallback)(e=>{i(e)},[]);return(0,O.useEffect)(()=>{let e=()=>o(!document.hidden);return e(),document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]),(0,O.useEffect)(()=>{if(!r||typeof IntersectionObserver>`u`)return;let e=new IntersectionObserver(([e])=>{e&&c(e.isIntersecting)},{rootMargin:t,threshold:n});return e.observe(r),()=>e.disconnect()},[r,t,n]),{ref:l,playing:a&&s}}var A=n(),j={width:600,height:420,cx:300,cy:206},M=24,me=Math.PI*(3-Math.sqrt(5));function he({type:e}){return(0,A.jsx)(`i`,{"aria-hidden":`true`,className:`g-dot g-${e} inline-block size-2 shrink-0 rounded-full ring-1 ring-stroke`,style:{background:N[e]}})}var N={concept:`var(--g-concept)`,file:`var(--g-file)`,risk:`var(--g-risk)`,preference:`var(--g-preference)`,decision:`var(--g-decision)`,fact:`var(--g-fact)`,task:`var(--g-task)`},ge={concept:`var(--g-concept-glow)`,file:`var(--g-file-glow)`,risk:`var(--g-risk-glow)`,preference:`var(--g-preference-glow)`,decision:`var(--g-decision-glow)`,fact:`var(--g-fact-glow)`,task:`var(--g-task-glow)`};function P(e){let t=0;for(let n=0;n<e.length;n+=1)t=t*31+e.charCodeAt(n)>>>0;return t}function _e(e,t){let n=e.slice(0,M);if(!n.length)return[];if(n.length===1)return[{node:n[0],x:j.cx,y:j.cy,twinkle:0}];let r=P(t||`galaxy`)%628/100,i=172/Math.sqrt(n.length);return n.map((e,t)=>{let n=P(e.id),a=t*me+r,o=i*Math.sqrt(t+.55)+n%11-5;return{node:e,x:j.cx+Math.cos(a)*o*1.38,y:j.cy+Math.sin(a)*o*.74,twinkle:n%50/10}})}function F(e,t,n){let r=t.x-e.x,i=t.y-e.y,a=Math.hypot(r,i)||1,o=Math.min(24,a*.16)*(n%2==0?1:-1),s=(e.x+t.x)/2-i/a*o,c=(e.y+t.y)/2+r/a*o;return`M ${e.x.toFixed(1)} ${e.y.toFixed(1)} Q ${s.toFixed(1)} ${c.toFixed(1)} ${t.x.toFixed(1)} ${t.y.toFixed(1)}`}function ve({nodes:e,links:t,spaceId:n,selectedId:i,loading:a,onSelect:o,onAdd:s}){let{t:c}=r(),[l,d]=(0,O.useState)(1),[f,p]=(0,O.useState)(``),m=(0,O.useRef)(null),h=(0,O.useRef)(0),{ref:ee,playing:g}=k(),te=(0,O.useCallback)(e=>{m.current=e,ee(e)},[ee]),ne=g?``:`[&:before]:[animation-play-state:paused]! [&:after]:[animation-play-state:paused]! [&_*]:[animation-play-state:paused]! [&_*:before]:[animation-play-state:paused]! [&_*:after]:[animation-play-state:paused]!`,_=e=>{if(!g)return;let t=m.current;if(!t)return;let n=t.getBoundingClientRect(),r=((e.clientX-n.left)/n.width-.5)*2,i=((e.clientY-n.top)/n.height-.5)*2;cancelAnimationFrame(h.current),h.current=requestAnimationFrame(()=>{t.style.setProperty(`--px`,r.toFixed(3)),t.style.setProperty(`--py`,i.toFixed(3))})},v=()=>{cancelAnimationFrame(h.current),m.current?.style.setProperty(`--px`,`0`),m.current?.style.setProperty(`--py`,`0`)};(0,O.useEffect)(()=>{g||(cancelAnimationFrame(h.current),h.current=0)},[g]),(0,O.useEffect)(()=>{let e=m.current?.querySelector(`svg`);e&&(g?e.unpauseAnimations():e.pauseAnimations())},[g]);let y=(0,O.useMemo)(()=>_e(e,n),[e,n]),b=(0,O.useMemo)(()=>new Map(y.map(e=>[e.node.id,e])),[y]),re=(0,O.useMemo)(()=>{let e=new Set(y.map(e=>e.node.id));return t.filter(t=>e.has(t.sourceId)&&e.has(t.targetId))},[y,t]),S=f||i,ie=new Set(t.flatMap(e=>e.sourceId===S?[e.targetId]:e.targetId===S?[e.sourceId]:[]));return(0,A.jsxs)(T,{className:`graph-panel before:[content:''] before:absolute before:z-[0] before:inset-0 before:pointer-events-none before:bg-[url('/memory-galaxy-background.webp')] before:[background-position:center_48%] before:[background-size:cover] before:bg-no-repeat before:[filter:saturate(.62)_contrast(1.08)] before:[mix-blend-mode:screen] before:opacity-[.42] after:[content:''] after:absolute after:z-[0] after:inset-0 after:pointer-events-none after:[background-image:radial-gradient(var(--galaxy-dot)_.9px,transparent_1.2px),_radial-gradient(var(--galaxy-dot-dim)_.8px,transparent_1.2px),_radial-gradient(var(--galaxy-dot)_1.2px,transparent_1.6px)] after:[background-position:0_0,_37px_53px,_71px_19px] after:[background-size:96px_96px,_152px_152px,_236px_236px] after:[animation:galaxy-field-twinkle_6.4s_ease-in-out_infinite] after:opacity-[.7] before:inset-[-8%] before:[animation:galaxy-background-drift_34s_ease-in-out_infinite_alternate] before:[will-change:transform] after:[animation:galaxy-field-drift_15s_ease-in-out_infinite_alternate] after:[will-change:background-position,opacity] max-[650px]:min-h-[430px] relative min-h-[500px] overflow-hidden [border-color:var(--galaxy-border)] bg-[var(--galaxy-bg)]! [background-image:radial-gradient(ellipse_46%_40%_at_50%_48%,_var(--galaxy-core),_transparent_72%),_radial-gradient(ellipse_62%_48%_at_16%_6%,_var(--galaxy-nebula-a),_transparent_70%),_radial-gradient(ellipse_56%_52%_at_88%_98%,_var(--galaxy-nebula-b),_transparent_72%)] p-0 backdrop-blur-none! galaxy-panel ${ne}`,onPointerMove:_,onPointerLeave:v,children:[(0,A.jsxs)(`div`,{className:`graph-toolbar absolute top-2.5 left-2.5 z-[4] flex gap-0.5 rounded-sm border border-[var(--galaxy-toolbar-border)] bg-[var(--galaxy-toolbar-bg)] p-0.5 text-[var(--galaxy-toolbar-text)] [&_button]:grid [&_button]:size-7 [&_button]:place-items-center [&_button]:rounded-xs [&_button]:transition-colors [&_button]:duration-(--d-fast) [&_button:hover]:bg-[var(--galaxy-toolbar-hover)] max-[650px]:[&_button]:size-11 [&_svg]:size-3.5`,children:[(0,A.jsx)(`button`,{type:`button`,title:c(`memory:memoryPage.addMemory`),"aria-label":c(`memory:memoryPage.addMemory`),onClick:s,children:(0,A.jsx)(u,{})}),(0,A.jsx)(`button`,{type:`button`,title:c(`memory:memoryPage.zoomIn`),"aria-label":c(`memory:memoryPage.zoomIn`),onClick:()=>d(e=>Math.min(1.6,Number((e+.15).toFixed(2)))),children:(0,A.jsx)(D,{})}),(0,A.jsx)(`button`,{type:`button`,title:c(`memory:memoryPage.zoomOut`),"aria-label":c(`memory:memoryPage.zoomOut`),onClick:()=>d(e=>Math.max(.7,Number((e-.15).toFixed(2)))),children:(0,A.jsx)(pe,{})})]}),(0,A.jsxs)(`div`,{className:`galaxy-stage [&_>_svg]:absolute [&_>_svg]:inset-0 [&_>_svg]:w-full [&_>_svg]:h-full [&_>_svg]:overflow-visible [&_>_svg]:z-[1] [&_>_svg]:[transform:translate3d(calc(var(--px,0)_*_9px),calc(var(--py,0)_*_6px),0)] [&_>_svg]:[transition:transform_.9s_var(--ease-out)] absolute z-[1] inset-0 [transform-origin:50%_50%] [transition:transform_var(--d2)_var(--ease-out)] ${S?`has-focus`:``}`,ref:te,style:{transform:`scale(${l})`},children:[(0,A.jsx)(`i`,{className:`galaxy-spiral absolute z-[0] block pointer-events-none [left:9%] [top:13%] w-[82%] h-[74%] rounded-[50%] bg-[conic-gradient(from_-18deg,transparent_0deg,var(--galaxy-nebula-a)_28deg,transparent_68deg,var(--galaxy-nebula-b)_118deg,transparent_170deg,var(--galaxy-nebula-a)_224deg,transparent_278deg,var(--galaxy-nebula-b)_322deg,transparent_360deg)] [filter:blur(13px)] [mask-image:radial-gradient(ellipse,transparent_0%,transparent_15%,var(--g-star-core)_38%,transparent_74%)] [-webkit-mask-image:radial-gradient(ellipse,transparent_0%,transparent_15%,var(--g-star-core)_38%,transparent_74%)] [mix-blend-mode:screen] opacity-[.38] [animation:galaxy-spiral-turn_42s_linear_infinite] [will-change:transform]`,"aria-hidden":`true`}),(0,A.jsx)(`i`,{className:`galaxy-core absolute z-[0] block pointer-events-none before:[content:''] before:absolute before:left-[50%] before:top-[50%] before:w-[46px] before:h-[46px] before:rounded-[50%] before:bg-[radial-gradient(circle,rgba(255,255,255,.82),rgba(191,219,254,.3)_55%,transparent_76%)] before:[filter:blur(6px)] before:[transform:translate(-50%,-50%)] [left:50%] [top:49%] w-[34%] h-[40%] rounded-[50%] bg-[radial-gradient(ellipse,rgba(219,232,255,.3)_0%,rgba(126,156,255,.15)_36%,transparent_70%)] [filter:blur(9px)] [mix-blend-mode:screen] [transform:translate(-50%,-50%)] [animation:galaxy-core-breathe_7.5s_ease-in-out_infinite] [will-change:transform,opacity]`,"aria-hidden":`true`}),(0,A.jsx)(`i`,{className:`galaxy-aurora absolute z-[0] block pointer-events-none w-[46%] h-[31%] rounded-[50%] [filter:blur(21px)] [mix-blend-mode:screen] opacity-[.42] [will-change:transform,opacity] [left:8%] [top:20%] bg-[radial-gradient(ellipse,var(--galaxy-nebula-a),transparent_70%)] [animation:galaxy-aurora-drift_18s_ease-in-out_infinite_alternate]`,"aria-hidden":`true`}),(0,A.jsx)(`i`,{className:`galaxy-aurora absolute z-[0] block pointer-events-none w-[46%] h-[31%] rounded-[50%] [filter:blur(21px)] [mix-blend-mode:screen] opacity-[.42] [will-change:transform,opacity] [right:5%] [bottom:14%] bg-[radial-gradient(ellipse,var(--galaxy-nebula-b),transparent_70%)] [animation:galaxy-aurora-drift_23s_ease-in-out_-9s_infinite_alternate-reverse]`,"aria-hidden":`true`}),(0,A.jsx)(`i`,{className:`galaxy-aurora absolute z-[0] block pointer-events-none w-[46%] h-[31%] rounded-[50%] [filter:blur(21px)] [mix-blend-mode:screen] opacity-[.42] [will-change:transform,opacity] galaxy-aurora-three left-[30%] top-[60%] !w-[40%] !h-[27%] bg-[radial-gradient(ellipse,var(--galaxy-nebula-c),transparent_70%)] [animation:galaxy-aurora-drift_27s_ease-in-out_-14s_infinite_alternate]`,"aria-hidden":`true`}),(0,A.jsxs)(`svg`,{viewBox:`0 0 600 420`,preserveAspectRatio:`none`,"aria-hidden":`true`,children:[(0,A.jsxs)(`g`,{className:`galaxy-orbits [&_ellipse]:[fill:none] [&_ellipse]:[stroke:var(--galaxy-line)] [&_ellipse]:[stroke-width:.72] [&_ellipse]:[stroke-dasharray:3_7] [&_ellipse]:opacity-[.52] [transform-box:fill-box] [transform-origin:center] [animation:galaxy-orbit-drift_90s_linear_infinite]`,children:[(0,A.jsx)(`ellipse`,{cx:`300`,cy:`206`,rx:`205`,ry:`122`,transform:`rotate(-8 300 206)`}),(0,A.jsx)(`ellipse`,{cx:`300`,cy:`206`,rx:`154`,ry:`88`,transform:`rotate(18 300 206)`}),(0,A.jsx)(`ellipse`,{cx:`300`,cy:`206`,rx:`95`,ry:`54`,transform:`rotate(-24 300 206)`})]}),(0,A.jsx)(`defs`,{children:re.map((e,t)=>{let n=b.get(e.sourceId),r=b.get(e.targetId);return!n||!r?null:(0,A.jsxs)(`linearGradient`,{id:`lg-${t}`,gradientUnits:`userSpaceOnUse`,x1:n.x,y1:n.y,x2:r.x,y2:r.y,children:[(0,A.jsx)(`stop`,{offset:`0`,stopColor:N[n.node.type]||`var(--galaxy-line-active)`}),(0,A.jsx)(`stop`,{offset:`1`,stopColor:N[r.node.type]||`var(--galaxy-line-active)`})]},e.id)})}),re.map((e,t)=>{let n=b.get(e.sourceId),r=b.get(e.targetId);if(!n||!r)return null;let i=e.sourceId===S||e.targetId===S,a=F(n,r,P(e.id));return(0,A.jsxs)(`g`,{children:[(0,A.jsx)(`path`,{className:`link-path [.galaxy-stage_>_svg_&]:[fill:none] [.galaxy-stage_>_svg_&]:[stroke-width:1.05] [.galaxy-stage_>_svg_&]:[stroke-dasharray:3_5] [.galaxy-stage_>_svg_&]:opacity-[.5] [.galaxy-stage_>_svg_&]:[animation:galaxy-link-flow_30s_linear_infinite] [.galaxy-stage_>_svg_&]:[transition:opacity_var(--d2)_var(--ease-out)] [.galaxy-stage_>_svg_&.active]:[stroke-width:1.55] [.galaxy-stage_>_svg_&.active]:[stroke-dasharray:none] [.galaxy-stage_>_svg_&.active]:opacity-100 [.galaxy-stage_>_svg_&.active]:[filter:drop-shadow(0_0_3.5px_var(--galaxy-line-active))] [.galaxy-stage.has-focus_&]:opacity-[.14] [.galaxy-stage.has-focus_&.active]:opacity-100 ${i?`active`:``}`,d:a,stroke:`url(#lg-${t})`}),i&&(0,A.jsx)(`circle`,{className:`link-pulse [.galaxy-stage_>_svg_&]:[fill:var(--g-star-core)] [.galaxy-stage_>_svg_&]:[filter:drop-shadow(0_0_4px_var(--galaxy-line-active))] [.galaxy-stage_>_svg_&]:pointer-events-none`,r:`2.1`,children:(0,A.jsx)(`animateMotion`,{dur:`2.8s`,repeatCount:`indefinite`,path:a})})]},e.id)})]}),(0,A.jsx)(`i`,{className:`galaxy-meteor before:[content:''] before:absolute before:top-[50%] before:left-[1px] before:w-[72px] before:h-[1px] before:bg-[linear-gradient(90deg,transparent,var(--galaxy-dot))] before:[transform:translateY(-50%)] absolute [top:14%] [left:80%] w-[2.4px] h-[2.4px] rounded-[50%] bg-[var(--galaxy-label-active)] shadow-[0_0_7px_1px_var(--galaxy-dot)] opacity-0 pointer-events-none [animation:galaxy-meteor_12s_linear_infinite] z-[3]`,"aria-hidden":`true`}),(0,A.jsx)(`i`,{className:`galaxy-meteor before:[content:''] before:absolute before:top-[50%] before:left-[1px] before:w-[72px] before:h-[1px] before:bg-[linear-gradient(90deg,transparent,var(--galaxy-dot))] before:[transform:translateY(-50%)] absolute [top:14%] [left:80%] w-[2.4px] h-[2.4px] rounded-[50%] bg-[var(--galaxy-label-active)] shadow-[0_0_7px_1px_var(--galaxy-dot)] opacity-0 pointer-events-none [animation:galaxy-meteor_12s_linear_infinite] z-[3] meteor-two [.galaxy-meteor&]:top-[63%] [.galaxy-meteor&]:left-[89%] [.galaxy-meteor&]:[animation:galaxy-meteor-b_17s_linear_4.5s_infinite]`,"aria-hidden":`true`}),(0,A.jsx)(`i`,{className:`galaxy-meteor before:[content:''] before:absolute before:top-[50%] before:left-[1px] before:w-[72px] before:h-[1px] before:bg-[linear-gradient(90deg,transparent,var(--galaxy-dot))] before:[transform:translateY(-50%)] absolute [top:14%] [left:80%] w-[2.4px] h-[2.4px] rounded-[50%] bg-[var(--galaxy-label-active)] shadow-[0_0_7px_1px_var(--galaxy-dot)] opacity-0 pointer-events-none [animation:galaxy-meteor_12s_linear_infinite] z-[3] meteor-three [.galaxy-meteor&]:top-[7%] [.galaxy-meteor&]:left-[36%] [.galaxy-meteor&]:[animation:galaxy-meteor-c_23s_linear_11s_infinite]`,"aria-hidden":`true`}),y.map(({node:e,x:t,y:n,twinkle:r},a)=>(0,A.jsxs)(`button`,{className:`galaxy-star focus-visible:rounded-[50%] focus-visible:[outline-color:var(--galaxy-line-active)] before:[content:''] before:absolute before:w-[calc(var(--star-size)_+_26px)] before:h-[calc(var(--star-size)_+_26px)] before:rounded-[50%] before:bg-[radial-gradient(circle,var(--g-star-glow),transparent_68%)] before:[filter:blur(3px)] before:opacity-[.76] before:pointer-events-none [&.active::after]:[content:''] [&.active::after]:absolute [&.active::after]:w-[calc(var(--star-size)_+_31px)] [&.active::after]:h-[calc(var(--star-size)_+_31px)] [&.active::after]:[border:1px_solid_var(--g-star-glow)] [&.active::after]:rounded-[50%] [&.active::after]:pointer-events-none [&.active::after]:[animation:galaxy-star-selection-pulse_2.3s_var(--ease-out)_infinite] [&:hover::before]:opacity-100 [&.active::before]:opacity-100 absolute z-[2] grid w-[52px] h-[52px] min-w-0 min-h-[52px] place-items-center [transform:translate(-50%,-50%)_translate3d(calc(var(--px,0)_*_(9px_+_var(--depth,0)_*_7px)),calc(var(--py,0)_*_(6px_+_var(--depth,0)_*_5px)),0)] border-0 rounded-[50%] bg-transparent p-0 cursor-pointer [transition:transform_.9s_var(--ease-out),opacity_.45s_var(--ease-out),filter_.45s_var(--ease-out)] [animation:galaxy-star-enter_.72s_var(--ease-out)_var(--enter-delay,0ms)_backwards] ${i===e.id?`active`:``} ${S&&e.id!==S&&!ie.has(e.id)?`dimmed [.galaxy-stage.has-focus_.galaxy-star&]:opacity-[.32] [.galaxy-stage.has-focus_.galaxy-star&]:[filter:saturate(.4)_brightness(.82)]`:``}`,"aria-pressed":i===e.id,onClick:()=>o(e.id),onMouseEnter:()=>p(e.id),onMouseLeave:()=>p(``),style:{left:`${t/j.width*100}%`,top:`${n/j.height*100}%`,"--star-size":`${12+Math.round((e.importance||.5)*9)}px`,"--twinkle-delay":`${r}s`,"--enter-delay":`${a*55}ms`,"--depth":P(e.id)%100/100,"--g-star-color":N[e.type],"--g-star-glow":ge[e.type]},title:e.content,children:[i===e.id&&(0,A.jsx)(`i`,{className:`orbit-ring [.galaxy-star_&]:absolute [.galaxy-star_&]:left-[50%] [.galaxy-star_&]:top-[50%] [.galaxy-star_&]:w-[calc(var(--star-size)_+_36px)] [.galaxy-star_&]:h-[calc(var(--star-size)_+_36px)] [.galaxy-star_&]:[border:1px_solid_var(--galaxy-line-active)] [.galaxy-star_&]:rounded-[50%] [.galaxy-star_&]:pointer-events-none [.galaxy-star_&]:[transform:translate(-50%,-50%)_rotate(-22deg)_scaleY(.44)] [.galaxy-star_&]:[animation:galaxy-selected-orbit_6s_linear_infinite] [.galaxy-star_&]:opacity-[.8] [.galaxy-star_&::before]:[content:''] [.galaxy-star_&::before]:absolute [.galaxy-star_&::before]:top-[-2.2px] [.galaxy-star_&::before]:left-[50%] [.galaxy-star_&::before]:w-[4.4px] [.galaxy-star_&::before]:h-[4.4px] [.galaxy-star_&::before]:ml-[-2.2px] [.galaxy-star_&::before]:rounded-[50%] [.galaxy-star_&::before]:bg-[var(--g-star-color)] [.galaxy-star_&::before]:shadow-[0_0_6px_1px_var(--g-star-glow)]`,"aria-hidden":`true`}),i===e.id&&(0,A.jsx)(`i`,{className:`dash-ring [.galaxy-star_&]:absolute [.galaxy-star_&]:left-[50%] [.galaxy-star_&]:top-[50%] [.galaxy-star_&]:w-[calc(var(--star-size)_+_23px)] [.galaxy-star_&]:h-[calc(var(--star-size)_+_23px)] [.galaxy-star_&]:[border:1px_dashed_var(--g-star-glow)] [.galaxy-star_&]:rounded-[50%] [.galaxy-star_&]:opacity-[.9] [.galaxy-star_&]:pointer-events-none [.galaxy-star_&]:[transform:translate(-50%,-50%)] [.galaxy-star_&]:[animation:galaxy-dash-spin_16s_linear_infinite]`,"aria-hidden":`true`}),(0,A.jsxs)(`svg`,{className:`star-core [.galaxy-star_&]:relative [.galaxy-star_&]:block [.galaxy-star_&]:w-[var(--star-size)] [.galaxy-star_&]:h-[var(--star-size)] [.galaxy-star_&]:[transition:transform_var(--d2)_var(--ease-spring)] [.galaxy-star_&]:[animation:galaxy-star-twinkle_3.8s_ease-in-out_var(--twinkle-delay)_infinite] [.galaxy-star_&]:overflow-visible [.galaxy-star_&]:rounded-[0] [.galaxy-star_&]:bg-transparent [.galaxy-star_&]:shadow-[none] [.galaxy-star_&]:[filter:drop-shadow(0_0_3px_var(--g-star-glow))_drop-shadow(0_0_8px_var(--g-star-glow))] [.galaxy-star_&]:origin-[center] [.galaxy-star:hover_&]:[transform:scale(1.28)] [.galaxy-star.active_&]:[transform:scale(1.32)] [.galaxy-star.active_&]:[animation:galaxy-star-twinkle_2.1s_ease-in-out_var(--twinkle-delay)_infinite]`,viewBox:`0 0 32 32`,"aria-hidden":`true`,children:[(0,A.jsx)(`path`,{className:`star-ray [.galaxy-star_.star-core_&]:[fill:var(--g-star-glow)] [.galaxy-star_.star-core_&]:opacity-[.58] [.galaxy-star_.star-core_&]:[transform-box:fill-box] [.galaxy-star_.star-core_&]:origin-[center] [.galaxy-star_.star-core_&]:[transform:scale(1.45)] [.galaxy-star.active_.star-core_&]:opacity-[.88] [.galaxy-star.active_.star-core_&]:[transform:scale(1.82)]`,d:`M16 0 L19.7 12.3 L32 16 L19.7 19.7 L16 32 L12.3 19.7 L0 16 L12.3 12.3 Z`}),(0,A.jsx)(`path`,{className:`star-shape [.galaxy-star_.star-core_&]:[fill:var(--g-star-color)]`,d:`M16 2 L18.8 13.2 L30 16 L18.8 18.8 L16 30 L13.2 18.8 L2 16 L13.2 13.2 Z`}),(0,A.jsx)(`circle`,{className:`star-heart [.galaxy-star_.star-core_&]:[fill:var(--g-star-core)]`,cx:`16`,cy:`16`,r:`3.2`})]}),(0,A.jsx)(`span`,{className:`star-label [.galaxy-stage.has-focus_.galaxy-star.dimmed_&]:opacity-[.3] [.galaxy-stage.has-focus_.galaxy-star.dimmed_&]:[transition:opacity_.45s_var(--ease-out)] [.galaxy-star_&]:absolute [.galaxy-star_&]:top-[calc(50%_+_17px)] [.galaxy-star_&]:left-[50%] [.galaxy-star_&]:max-w-[120px] [.galaxy-star_&]:overflow-hidden [.galaxy-star_&]:text-[var(--galaxy-label)] [.galaxy-star_&]:text-[11px] [.galaxy-star_&]:leading-[1.35] [.galaxy-star_&]:pointer-events-none [.galaxy-star_&]:text-ellipsis [.galaxy-star_&]:[text-shadow:0_1px_7px_var(--galaxy-bg)] [.galaxy-star_&]:[transform:translateX(-50%)] [.galaxy-star_&]:[transition:color_var(--d1)_var(--ease-out)] [.galaxy-star_&]:whitespace-nowrap [.galaxy-star:hover_&]:text-[var(--galaxy-label-active)] [.galaxy-star.active_&]:text-[var(--galaxy-label-active)] [.galaxy-star.active_&]:font-[700]`,children:e.title})]},e.id))]}),!!y.length&&(0,A.jsxs)(`span`,{className:`pointer-events-none absolute right-3 bottom-2.5 z-[3] rounded-xs border border-[var(--galaxy-toolbar-border)] bg-[var(--galaxy-toolbar-bg)] px-2 text-xs leading-5 text-[var(--galaxy-label)] tabular-nums`,children:[`✦`,` `,c(`memory:memoryPage.visibleTotalMemories`,{visible:y.length,total:e.length})]}),!a&&!y.length&&(0,A.jsxs)(`div`,{className:`memory-empty [.galaxy-panel_&]:text-[var(--galaxy-label)] [.galaxy-panel_&]:[--stroke:var(--galaxy-toolbar-border)] [.galaxy-panel_&]:[--control-muted:var(--galaxy-label)] [.galaxy-panel_&]:[--star:var(--g-decision)] [.galaxy-panel_&]:[--text-muted:var(--galaxy-label)] absolute z-[3] inset-0 grid [align-content:center] justify-items-center gap-[8px] text-[var(--text-muted)] text-[12px] pointer-events-none`,children:[(0,A.jsx)(x,{size:44}),(0,A.jsx)(`span`,{children:c(`memory:memoryPage.thisMemorySpaceIsStillUnlitClickInTheTopLeftToPlantTheFirstStar`)})]})]})}var ye=[`concept`,`file`,`risk`,`preference`,`decision`,`fact`,`task`],I=`modal-backdrop fixed inset-0 z-[70] grid place-items-center overflow-y-auto overscroll-contain bg-[var(--modal-overlay)] p-5 max-[650px]:p-2`,L=`modal grid max-h-[calc(100dvh_-_40px)] w-[min(430px,100%)] gap-0.5 overflow-y-auto overscroll-contain rounded-dialog bg-popover p-5 shadow-float max-[650px]:max-h-[calc(100dvh_-_16px)]`,R=`key-value flex min-h-[34px] min-w-0 items-center justify-between gap-4 border-t border-stroke-soft text-sm [&>dt]:shrink-0 [&>dt]:text-content-muted [&>dd]:min-w-0 [&>dd]:truncate [&>dd]:text-right [&>dd]:text-content`;function z(e,t){return t(e===`file`?`memory:memoryPage.fileType`:e===`risk`?`memory:memoryPage.riskType`:e===`preference`?`memory:memoryPage.preferenceType`:e===`decision`?`memory:memoryPage.decisionType`:e===`fact`?`memory:memoryPage.factType`:e===`task`?`memory:memoryPage.taskType`:`memory:memoryPage.conceptType`)}function be(e,t=`zh-CN`){if(!e)return`—`;let n=new Date(e);return Number.isNaN(n.getTime())?e:new Intl.DateTimeFormat(t,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(n)}function B(e,t=e=>e){return e?.kind===`global`?t(`memory:memoryPage.globalMemorySpace`):e?.name||``}function V(e){return e instanceof Error?e.message:String(e)}function xe({notify:e,onBack:t,requestConfirm:n}){let a=y(`focusSearch`),[x,C]=(0,O.useState)(``),{t:w,language:T}=r(),[E,pe]=(0,O.useState)({spaces:[],nodes:[],links:[],candidates:[],selectedSpaceId:``}),[D,k]=(0,O.useState)(``),[j,M]=(0,O.useState)(``),[me,N]=(0,O.useState)(``),[ge,P]=(0,O.useState)(`galaxy`),_e=(0,O.useRef)(null),F=(0,O.useRef)(0),[I,L]=(0,O.useState)(!0),[xe,we]=(0,O.useState)(!1),[Te,H]=(0,O.useState)(``),[Ee,U]=(0,O.useState)(null),[De,Oe]=(0,O.useState)(null),[W,ke]=(0,O.useState)(``),[G,Ae]=(0,O.useState)(null),[je,K]=(0,O.useState)(``),[Me,Ne]=(0,O.useState)(`load`),[Pe,Fe]=(0,O.useState)(!0),q=(0,O.useRef)(null),J=(0,O.useRef)(0),Ie=(0,O.useRef)(0),Le=(0,O.useRef)(0),Re=(0,O.useRef)(null),Y=(0,O.useRef)(null),ze=(0,O.useRef)(!1),X=(0,O.useRef)(null),Z=(0,O.useRef)(!0),[Be,Ve]=(0,O.useState)(!1),Q=(0,O.useCallback)(async(e=``)=>{let t=++F.current;L(!0),H(``);try{let n=new URLSearchParams;e&&n.set(`spaceId`,e),x.trim()&&n.set(`query`,x.trim());let r=await i(`/api/memory?${n}`);if(t!==F.current)return;pe(r),we(!0),k(r.selectedSpaceId||``),M(e=>r.nodes.some(t=>t.id===e)?e:r.nodes[0]?.id||``)}catch(e){t===F.current&&H(V(e))}finally{t===F.current&&L(!1)}},[x]);(0,O.useEffect)(()=>(Q(D),()=>{F.current+=1}),[Q,D]);let He=(0,O.useCallback)(async()=>{Re.current?.abort();let e=new AbortController;Re.current=e;let t=++Ie.current,n=J.current,r=n===Le.current;Fe(!0),K(``);try{let a=await i(`/api/settings/memory`,{signal:e.signal});if(e.signal.aborted||!Z.current||t!==Ie.current)return;let o=a.autoApproveConfidence;if(typeof o!=`number`||!Number.isInteger(o)||o<0||o>100)throw Error(w(`memory:memoryPage.invalidAutoApproveThreshold`));r&&J.current===n&&(q.current=o,Ae(String(o)))}catch(n){!e.signal.aborted&&Z.current&&t===Ie.current&&(Ne(`load`),K(V(n)))}finally{!e.signal.aborted&&Z.current&&t===Ie.current&&Fe(!1)}},[w]);(0,O.useEffect)(()=>(Z.current=!0,He(),()=>{Z.current=!1,Re.current?.abort(),Y.current?.abort(),X.current=null}),[He]);let Ue=async()=>{if(G===null||!G.trim()||q.current===null)return;let t=Number(G);if(!Number.isFinite(t))return;let n=Math.min(100,Math.max(0,Math.round(t)));if(!Y.current&&!ze.current&&n===q.current){X.current=null,Le.current=J.current,Ae(String(n)),K(``);return}if(X.current={value:n,revision:J.current},Y.current)return;let r=new AbortController;Y.current=r,Ve(!0),K(``);try{for(;X.current&&Z.current&&!r.signal.aborted;){let t=X.current;if(X.current=null,t.value!==q.current||ze.current){try{await i(`/api/settings/memory`,{method:`PATCH`,body:{autoApproveConfidence:t.value},signal:r.signal})}catch(e){if(!Z.current||r.signal.aborted)return;X.current||=t,ze.current=!0,Ne(`save`),K(V(e));return}if(!Z.current||r.signal.aborted)return;q.current=t.value,ze.current=!1}Le.current=t.revision,J.current===t.revision&&(Ae(String(t.value)),X.current||e(w(`memory:memoryPage.autoApproveSaved`)))}}finally{Y.current===r&&(Y.current=null,Z.current&&Ve(!1))}},We=E.nodes.find(e=>e.id===j)||null,Ge=e=>{let t=new Set(E.links.flatMap(t=>t.sourceId===e?[t.targetId]:t.targetId===e?[t.sourceId]:[]));return{count:t.size,files:E.nodes.filter(n=>n.type===`file`&&(t.has(n.id)||n.id===e))}},$=E.spaces.find(e=>e.id===D),Ke=async t=>{if(await n({title:w(`memory:memoryPage.deleteMemory`),message:w(`memory:memoryPage.deleteMemoryName`,{name:t.title}),confirmLabel:w(`memory:memoryPage.delete`)}))try{await i(`/api/memory/nodes/${encodeURIComponent(t.id)}`,{method:`DELETE`}),e(w(`memory:memoryPage.memoryDeleted`)),await Q(D)}catch(e){H(V(e))}},qe=async(t,n)=>{if(!W){ke(t.id),H(``);try{await i(`/api/memory/candidates/${encodeURIComponent(t.id)}/${n}`,{method:`POST`,body:`{}`}),e(w(n===`accept`?`memory:memoryPage.memoryCandidateConfirmed`:`memory:memoryPage.memoryCandidateIgnored`)),await Q(D)}catch(e){H(V(e))}finally{ke(``)}}},Je=async()=>{if(!(W||!E.candidates?.length)){ke(`__all__`),H(``);try{let t=await i(`/api/memory/candidates/reject-all`,{method:`POST`,body:`{}`});e(w(`memory:memoryPage.ignoredCountMemoryDrafts`,{count:t.rejected||0})),await Q(D)}catch(e){H(V(e))}finally{ke(``)}}},Ye=async()=>{if($&&await n({title:w(`memory:memoryPage.deleteMemorySpace`),message:w(`memory:memoryPage.deleteMemorySpaceNameAndAllMemoriesInIt`,{name:B($,w)}),confirmLabel:w(`memory:memoryPage.delete`)}))try{await i(`/api/memory/spaces/${encodeURIComponent($.id)}`,{method:`DELETE`}),k(``),M(``),e(w(`memory:memoryPage.memorySpaceDeleted`))}catch(e){H(V(e))}},Xe=w(`navigation:navigation.memory`),Ze=B($,w),Qe=e=>{M(e),requestAnimationFrame(()=>_e.current?.scrollIntoView({block:`nearest`}))},$e=(e,t)=>{let n=Ge(e.id);return(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[t&&(0,A.jsxs)(`header`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,A.jsx)(`h3`,{className:`text-[15px] leading-6 font-medium break-words text-content`,children:e.title}),(0,A.jsx)(`p`,{className:`text-[13px] leading-normal break-words text-content-secondary`,children:e.content})]}),(0,A.jsxs)(`dl`,{children:[(0,A.jsxs)(`div`,{className:R,children:[(0,A.jsx)(`dt`,{children:w(`memory:memoryPage.memoryType`)}),(0,A.jsxs)(`dd`,{className:`inline-flex items-center justify-end gap-2`,children:[(0,A.jsx)(he,{type:e.type}),z(e.type,w)]})]}),(0,A.jsxs)(`div`,{className:R,children:[(0,A.jsx)(`dt`,{children:w(`memory:memoryPage.source`)}),(0,A.jsx)(`dd`,{children:e.sourceType===`conversation_confirmed`?w(`memory:memoryPage.userConfirmedConversationCandidate`):e.sourceType===`user_confirmed`?w(`memory:memoryPage.explicitUserRequest`):e.sourceType===`agent`?w(`memory:memoryPage.createdByAgent`):w(`memory:memoryPage.addedManually`)})]}),(0,A.jsxs)(`div`,{className:R,children:[(0,A.jsx)(`dt`,{children:w(`memory:memoryPage.authority`)}),(0,A.jsxs)(`dd`,{className:`tabular-nums`,children:[e.authority??0,`/100`]})]}),e.evidence&&(0,A.jsxs)(`div`,{className:R,children:[(0,A.jsx)(`dt`,{children:w(`memory:memoryPage.evidence`)}),(0,A.jsx)(`dd`,{title:e.evidence,children:e.evidence})]}),(0,A.jsxs)(`div`,{className:R,children:[(0,A.jsx)(`dt`,{children:w(`memory:memoryPage.created`)}),(0,A.jsx)(`dd`,{className:`tabular-nums`,children:be(e.createdAt,T)})]}),(0,A.jsxs)(`div`,{className:R,children:[(0,A.jsx)(`dt`,{children:w(`memory:memoryPage.relatedMemories`)}),(0,A.jsx)(`dd`,{className:`tabular-nums`,children:w(`memory:memoryPage.count`,{count:n.count})})]})]}),(0,A.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[(0,A.jsxs)(v,{variant:`ghost`,size:`sm`,className:`text-danger hover:bg-danger-soft hover:text-danger max-[650px]:h-11`,onClick:()=>void Ke(e),children:[(0,A.jsx)(p,{}),w(`memory:memoryPage.delete`)]}),(0,A.jsxs)(v,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,onClick:()=>U(e),children:[(0,A.jsx)(l,{}),w(`memory:memoryPage.edit`)]})]}),(0,A.jsxs)(`section`,{className:`min-w-0`,"aria-label":w(`memory:memoryPage.relatedFiles`),children:[(0,A.jsxs)(`h4`,{className:`mb-1 text-xs font-medium text-content-muted tabular-nums`,children:[w(`memory:memoryPage.relatedFiles`),` · `,n.files.length]}),n.files.length?(0,A.jsx)(`ul`,{className:`divide-y divide-stroke-soft border-t border-stroke-soft`,children:n.files.map(t=>(0,A.jsxs)(`li`,{className:`file-row grid min-h-11 min-w-0 grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-2.5 py-1`,children:[(0,A.jsx)(s,{className:`size-4 text-content-muted`,"aria-hidden":`true`}),(0,A.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,A.jsx)(`strong`,{className:`truncate text-sm font-medium text-content`,children:t.title}),(0,A.jsx)(`small`,{className:`truncate font-mono text-xs text-content-muted`,children:t.sourcePath||t.cwd||w(`memory:memoryPage.localMemory`)})]}),(0,A.jsxs)(`span`,{className:`flex items-center`,children:[t.id!==e.id&&(0,A.jsx)(v,{variant:`ghost`,size:`sm`,className:`max-[650px]:h-11`,onClick:()=>ge===`galaxy`?M(t.id):N(t.id),children:w(`memory:memoryPage.view`)}),(0,A.jsx)(v,{variant:`ghost`,size:`icon-sm`,className:`max-[650px]:size-11`,"aria-label":`${w(`memory:memoryPage.edit`)}: ${t.title}`,onClick:()=>U(t),children:(0,A.jsx)(l,{})}),(0,A.jsx)(v,{variant:`ghost`,size:`icon-sm`,className:`text-content-muted hover:bg-danger-soft hover:text-danger max-[650px]:size-11`,"aria-label":`${w(`memory:memoryPage.delete`)}: ${t.title}`,onClick:()=>void Ke(t),children:(0,A.jsx)(p,{})})]})]},t.id))}):(0,A.jsx)(`p`,{className:`text-xs text-content-muted`,children:w(`memory:memoryPage.thisMemoryHasNoRelatedFiles`)})]})]})};return(0,A.jsxs)(ce,{title:Xe,description:w(`memory:memoryPage.lede`),back:t&&{label:w(`navigation:sidebar.features`),ariaLabel:w(`navigation:shell.backToFeaturesLabel`),onBack:t},toolbar:(0,A.jsx)(le,{search:(0,A.jsx)(ie,{id:h,value:x,onValueChange:C,placeholder:w(`navigation:pageHeader.searchMemoriesOrFiles`),shortcut:a,clearLabel:w(`navigation:more.clearSearch`)}),actions:(0,A.jsxs)(v,{type:`button`,className:`h-9`,disabled:!xe,onClick:()=>U({spaceId:D||E.selectedSpaceId}),children:[(0,A.jsx)(u,{}),w(`memory:memoryPage.addMemory`)]}),filters:(0,A.jsx)(de,{options:[w(`memory:memoryPage.galaxyView`),w(`memory:memoryPage.listView`)],value:w(ge===`galaxy`?`memory:memoryPage.galaxyView`:`memory:memoryPage.listView`),onChange:e=>P(e===w(`memory:memoryPage.listView`)?`list`:`galaxy`)})}),children:[!xe&&I?(0,A.jsx)(b,{kind:`loading`,title:w(`common:pageTemplate.loading`)}):xe?(0,A.jsxs)(A.Fragment,{children:[Te&&(0,A.jsx)(ue,{children:Te}),(0,A.jsx)(se,{title:w(`memory:memoryPage.memorySpaces`),count:E.spaces.length,actions:(0,A.jsxs)(v,{variant:`ghost`,size:`sm`,onClick:()=>Oe({}),children:[(0,A.jsx)(u,{}),w(`memory:memoryPage.newMemorySpace`)]}),children:(0,A.jsx)(oe,{children:E.spaces.map(e=>{let t=e.id===D;return(0,A.jsx)(ae,{"data-memory-space":e.id,"aria-current":t||void 0,className:ne(`relative`,t&&`after:absolute after:top-3.5 after:bottom-3.5 after:-left-3 after:w-[3px] after:rounded-r-[3px] after:bg-star max-[650px]:after:-left-2.5`),icon:(0,A.jsx)(f,{}),onOpen:()=>{k(e.id),M(``),N(``)},name:B(e,w),status:w(`memory:memoryPage.countMemories`,{count:e.nodeCount}),actions:t&&(0,A.jsxs)(`div`,{className:`memory-space-actions flex items-center gap-1`,children:[(0,A.jsxs)(v,{variant:`ghost`,size:`sm`,onClick:()=>Oe(e),children:[(0,A.jsx)(l,{}),w(`memory:memoryPage.rename`)]}),e.kind!==`global`&&(0,A.jsxs)(v,{variant:`ghost`,size:`sm`,className:`text-danger hover:bg-danger-soft hover:text-danger`,onClick:()=>void Ye(),children:[(0,A.jsx)(p,{}),w(`memory:memoryPage.delete`)]})]})},e.id)})})}),(0,A.jsx)(se,{"data-memory-stars":!0,title:Ze||w(`memory:memoryPage.memorySpaces`),count:E.nodes.length,actions:(0,A.jsx)(v,{variant:`ghost`,size:`icon-sm`,className:`text-content-muted max-[650px]:size-11 pointer-coarse:size-11`,loading:I,disabled:I,"aria-label":w(`memory:memoryPage.refresh`),title:w(`memory:memoryPage.refresh`),onClick:()=>void Q(D),children:(0,A.jsx)(d,{})}),children:ge===`galaxy`?(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[(0,A.jsx)(ve,{nodes:E.nodes,links:E.links,spaceId:D,selectedId:j,loading:I,onSelect:Qe,onAdd:()=>U({spaceId:D})}),(0,A.jsx)(`div`,{role:`group`,"aria-label":w(`memory:memoryPage.memoryMapTypes`),className:`galaxy-legend flex flex-wrap gap-x-4 gap-y-1.5`,children:ye.map(e=>(0,A.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs text-content-secondary`,children:[(0,A.jsx)(he,{type:e}),z(e,w)]},e))}),(0,A.jsx)(`div`,{ref:_e,role:`region`,"data-memory-detail":!0,"aria-label":w(`memory:memoryPage.selectedMemory`),className:`min-w-0 scroll-mb-4 rounded-[var(--r-md)] border border-stroke px-4 py-3`,children:We?$e(We,!0):(0,A.jsx)(`p`,{className:`text-xs leading-normal text-content-muted`,children:w(`memory:memoryPage.selectAMemoryInTheMapToViewItsDetails`)})})]}):E.nodes.length?(0,A.jsx)(oe,{children:E.nodes.map(e=>(0,A.jsx)(ae,{"data-memory-node":e.id,icon:(0,A.jsx)(he,{type:e.type}),name:e.title,nameMeta:z(e.type,w),description:e.content,expanded:me===e.id,onExpandedChange:t=>N(t?e.id:``),toggleLabel:e.title,detail:$e(e,!1)},e.id))}):(0,A.jsx)(re,{title:x.trim()?w(`memory:memoryPage.noMatchingMemories`):w(`memory:memoryPage.noMemoriesInSpace`)})}),(0,A.jsxs)(se,{title:w(`memory:memoryPage.memoryDrafts`),count:E.candidates?.length||0,actions:!!E.candidates?.length&&(0,A.jsxs)(v,{variant:`ghost`,size:`sm`,disabled:!!W,onClick:()=>void Je(),children:[(0,A.jsx)(m,{}),w(`memory:memoryPage.ignoreAll`)]}),children:[Pe&&(0,A.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 py-2 text-xs text-content-muted`,children:[(0,A.jsx)(_,{className:`size-3.5`}),w(`memory:memoryPage.loadingAutoApproveThreshold`)]}),je&&(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 py-2`,children:[(0,A.jsxs)(fe,{className:`my-0`,children:[w(`memory:memoryPage.autoApproveThresholdUnavailable`),` `,je]}),(0,A.jsx)(v,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,disabled:Pe||Be,onClick:()=>void(Me===`save`?Ue():He()),children:w(`memory:memoryPage.retryAutoApproveThreshold`)})]}),G!==null&&(0,A.jsxs)(`div`,{className:`memory-auto-approve-row flex min-h-12 items-center justify-between gap-3 border-t border-stroke py-1.5`,children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-sm font-medium text-content`,children:[(0,A.jsx)(`span`,{children:w(`memory:memoryPage.autoApproveThreshold`)}),(0,A.jsxs)(te,{children:[(0,A.jsx)(ee,{asChild:!0,children:(0,A.jsx)(c,{className:`size-3.5 shrink-0 text-content-muted`})}),(0,A.jsx)(g,{align:`center`,side:`top`,children:w(`memory:memoryPage.autoApproveThresholdHint`)})]})]}),(0,A.jsxs)(`span`,{className:`memory-auto-approve-input flex flex-none items-center gap-1.5 text-xs text-content-muted`,children:[(0,A.jsx)(S,{type:`number`,min:0,max:100,step:5,className:`h-7 w-16 text-right tabular-nums max-[650px]:h-11`,value:G,"aria-busy":Be,"aria-label":w(`memory:memoryPage.autoApproveThreshold`),onChange:e=>{J.current+=1,Ae(e.target.value)},onBlur:()=>void Ue(),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),Ue())}}),`%`,Be&&(0,A.jsx)(_,{className:`size-3.5`})]})]}),E.candidates?.length?(0,A.jsx)(oe,{children:E.candidates.map(e=>(0,A.jsx)(ae,{className:`memory-candidate`,name:e.title,description:e.content,meta:(0,A.jsxs)(`span`,{className:`truncate tabular-nums`,children:[B(E.spaces.find(t=>t.id===e.spaceId),w),` · `,e.sourceType===`agent`?w(`memory:memoryPage.agentProposed`):w(`memory:memoryPage.conversationExtracted`),` · `,w(`memory:memoryPage.confidencePercent`,{value:Math.round((e.confidence||0)*100)})]}),actions:(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(v,{variant:`secondary`,size:`sm`,disabled:!!W,onClick:()=>void qe(e,`accept`),children:[(0,A.jsx)(o,{}),w(`memory:memoryPage.confirm`)]}),(0,A.jsxs)(v,{variant:`ghost`,size:`sm`,disabled:!!W,onClick:()=>void qe(e,`reject`),children:[(0,A.jsx)(m,{}),w(`memory:memoryPage.ignore`)]})]}),detail:(0,A.jsxs)(`div`,{className:`flex flex-col gap-0.5 text-xs leading-[1.5] text-content-muted`,children:[e.topicKey&&(0,A.jsxs)(`span`,{children:[w(`memory:memoryPage.topic`),`:`,(0,A.jsx)(`code`,{className:`font-mono`,children:e.topicKey})]}),e.evidence&&(0,A.jsxs)(`span`,{className:`[overflow-wrap:anywhere]`,children:[w(`memory:memoryPage.evidence`),`:`,e.evidence]}),(0,A.jsxs)(`span`,{className:`tabular-nums`,children:[w(`memory:memoryPage.created`),`:`,be(e.createdAt,T),e.expiresAt?` · ${w(`memory:memoryPage.expires`)}:${be(e.expiresAt,T)}`:``]})]})},e.id))}):(0,A.jsx)(`p`,{className:`border-t border-stroke py-3 text-xs text-content-muted`,children:w(`memory:memoryPage.thereAreNoPendingMemoryCandidates`)})]})]}):(0,A.jsx)(b,{kind:`error`,title:w(`memory:memoryPage.loadFailed`),description:Te,action:(0,A.jsx)(v,{variant:`secondary`,className:`max-[650px]:h-11`,onClick:()=>void Q(D),children:w(`common:pageTemplate.retry`)})}),Ee&&(0,A.jsx)(Se,{spaces:E.spaces,node:Ee.id?Ee:null,initialSpaceId:Ee.spaceId||D,onClose:()=>U(null),onSaved:async t=>{U(null),e(t),await Q(D)}}),De&&(0,A.jsx)(Ce,{space:De.id?De:null,onClose:()=>Oe(null),onSaved:async(t,n)=>{Oe(null),k(t.id),e(n)}})]})}function Se({spaces:e,node:t,initialSpaceId:n,onClose:a,onSaved:o}){let{t:s}=r(),[c,u]=(0,O.useState)({spaceId:t?.spaceId||n||e[0]?.id||``,title:t?.title||``,content:t?.content||``,type:t?.type||`concept`,sourcePath:t?.sourcePath||``,importance:t?.importance??.5}),[d,f]=(0,O.useState)(!1),[p,h]=(0,O.useState)(``);return(0,A.jsx)(`div`,{className:I,onMouseDown:e=>!d&&e.target===e.currentTarget&&a(),children:(0,A.jsxs)(`form`,{role:`dialog`,"aria-modal":`true`,"aria-label":s(t?`memory:memoryPage.editMemory`:`memory:memoryPage.addMemory`),className:L,onSubmit:async e=>{if(e.preventDefault(),!d){f(!0),h(``);try{await i(t?`/api/memory/nodes/${encodeURIComponent(t.id)}`:`/api/memory/nodes`,{method:t?`PATCH`:`POST`,body:JSON.stringify(c)}),await o(s(t?`memory:memoryPage.memoryUpdated`:`memory:memoryPage.memoryCreated`))}catch(e){h(V(e))}finally{f(!1)}}},children:[(0,A.jsxs)(w,{className:`[&_h2]:text-[15px] [&_h2]:font-medium`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h2`,{children:s(t?`memory:memoryPage.editMemory`:`memory:memoryPage.addMemory`)}),(0,A.jsx)(`p`,{children:s(`memory:memoryPage.lightUpIdeasWorthKeepingAsMemoriesYouCanReturnToLater`)})]}),(0,A.jsx)(v,{type:`button`,variant:`ghost`,size:`icon`,className:`-mt-1 -mr-1 max-[650px]:size-11`,"aria-label":s(`memory:memoryPage.closeDialog`),disabled:d,onClick:a,children:(0,A.jsx)(m,{})})]}),(0,A.jsxs)(C,{variant:`control`,children:[s(`memory:memoryPage.memorySpace`),(0,A.jsx)(E,{value:c.spaceId,onChange:e=>u({...c,spaceId:e.target.value}),children:e.map(e=>(0,A.jsx)(`option`,{value:e.id,children:B(e,s)},e.id))})]}),(0,A.jsxs)(C,{variant:`control`,children:[s(`memory:memoryPage.memoryTitle`),(0,A.jsx)(`input`,{value:c.title,onChange:e=>u({...c,title:e.target.value}),placeholder:s(`memory:memoryPage.forExampleProjectUIConstraints`)})]}),(0,A.jsxs)(C,{variant:`control`,children:[s(`memory:memoryPage.memoryContent`),(0,A.jsx)(`textarea`,{value:c.content,onChange:e=>u({...c,content:e.target.value}),placeholder:s(`memory:memoryPage.recordStandaloneReusableMemoryForFutureChats`)})]}),(0,A.jsxs)(`div`,{className:`form-grid grid gap-x-2.5 sm:grid-cols-2`,children:[(0,A.jsxs)(C,{variant:`control`,children:[s(`memory:memoryPage.memoryType`),(0,A.jsx)(E,{value:c.type,onChange:e=>u({...c,type:e.target.value}),children:ye.map(e=>(0,A.jsx)(`option`,{value:e,children:z(e,s)},e))})]}),(0,A.jsxs)(C,{variant:`control`,children:[s(`memory:memoryPage.importance`),(0,A.jsxs)(E,{value:c.importance,onChange:e=>u({...c,importance:Number(e.target.value)}),children:[(0,A.jsx)(`option`,{value:`0.3`,children:s(`memory:memoryPage.normal`)}),(0,A.jsx)(`option`,{value:`0.5`,children:s(`memory:memoryPage.common`)}),(0,A.jsx)(`option`,{value:`0.8`,children:s(`memory:memoryPage.important`)}),(0,A.jsx)(`option`,{value:`1`,children:s(`memory:memoryPage.strict`)})]})]})]}),(0,A.jsxs)(C,{variant:`control`,children:[s(`memory:memoryPage.relatedFilePath`),(0,A.jsx)(`input`,{value:c.sourcePath,onChange:e=>u({...c,sourcePath:e.target.value}),placeholder:s(`memory:memoryPage.optionalForExampleECodeProjectREADMEMd`)})]}),p&&(0,A.jsx)(fe,{children:p}),(0,A.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,A.jsx)(v,{type:`button`,variant:`secondary`,size:`dialogAction`,onClick:a,children:s(`memory:memoryPage.cancel`)}),(0,A.jsxs)(v,{type:`submit`,size:`dialogAction`,disabled:d||!c.spaceId||!c.title.trim()||!c.content.trim(),children:[d?(0,A.jsx)(_,{className:`text-current`}):(0,A.jsx)(l,{}),s(d?`memory:memoryPage.saving`:`memory:memoryPage.save`)]})]})]})})}function Ce({space:e,onClose:t,onSaved:n}){let{t:a}=r(),[o,s]=(0,O.useState)(e?.name||``),[c,l]=(0,O.useState)(!1),[d,f]=(0,O.useState)(``);return(0,A.jsx)(`div`,{className:I,onMouseDown:e=>!c&&e.target===e.currentTarget&&t(),children:(0,A.jsxs)(`form`,{role:`dialog`,"aria-modal":`true`,"aria-label":a(e?`memory:memoryPage.renameMemorySpace`:`memory:memoryPage.newMemorySpace`),className:L,onSubmit:async t=>{if(t.preventDefault(),!c){l(!0),f(``);try{await n(await i(e?`/api/memory/spaces/${encodeURIComponent(e.id)}`:`/api/memory/spaces`,{method:e?`PATCH`:`POST`,body:JSON.stringify({name:o,kind:`custom`})}),a(e?`memory:memoryPage.memorySpaceRenamed`:`memory:memoryPage.memorySpaceCreated`))}catch(e){f(V(e))}finally{l(!1)}}},children:[(0,A.jsxs)(w,{className:`[&_h2]:text-[15px] [&_h2]:font-medium`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`h2`,{children:a(e?`memory:memoryPage.renameMemorySpace`:`memory:memoryPage.newMemorySpace`)}),(0,A.jsx)(`p`,{children:a(`memory:memoryPage.giveEachThemeOrProjectItsOwnMemorySpaceSoDurableMemoriesHaveSomewhereToBelong`)})]}),(0,A.jsx)(v,{type:`button`,variant:`ghost`,size:`icon`,className:`-mt-1 -mr-1 max-[650px]:size-11`,"aria-label":a(`memory:memoryPage.closeDialog`),disabled:c,onClick:t,children:(0,A.jsx)(m,{})})]}),(0,A.jsxs)(C,{variant:`control`,children:[a(`memory:memoryPage.memorySpaceName`),(0,A.jsx)(`input`,{value:o,onChange:e=>s(e.target.value),placeholder:a(`memory:memoryPage.forExampleProductDesignGuidelines`),autoFocus:!0})]}),d&&(0,A.jsx)(fe,{children:d}),(0,A.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,A.jsx)(v,{type:`button`,variant:`secondary`,size:`dialogAction`,onClick:t,children:a(`memory:memoryPage.cancel`)}),(0,A.jsxs)(v,{type:`submit`,size:`dialogAction`,disabled:c||!o.trim(),children:[c?(0,A.jsx)(_,{className:`text-current`}):(0,A.jsx)(u,{}),a(c?`memory:memoryPage.saving`:`memory:memoryPage.save`)]})]})]})})}export{xe as MemoryPage};
@@ -1 +0,0 @@
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-D2P6OO3w.js";import{t as i}from"./api-DVgYxLec.js";import{t as a}from"./bell-BjONAtgH.js";import{t as o}from"./bot-B3TaBp_T.js";import{t as s}from"./calendar-clock-VIxTaqqy.js";import{t as c}from"./circle-check-iEdCm3Pw.js";import{t as l}from"./folder-open-FIShC5Qk.js";import{n as u,t as d}from"./send-QxBfLFo-.js";import{t as f}from"./play-DNDjDNGn.js";import{t as p}from"./plus-fQbSqB1n.js";import{t as m}from"./trash-2-CNrPOoPR.js";import{t as h}from"./triangle-alert-CE1q54ci.js";import{t as g}from"./more-pages-D_PnxLN0.js";import{t as _}from"./utils-C8uzG5AZ.js";import{n as v,t as y}from"./button-Bu_vuij9.js";import{s as b}from"./shortcuts-BOeaPAvF.js";import{a as x}from"./format-DMJQzoZ7.js";import{n as S,t as C}from"./PageState-aWHrkE1D.js";import{a as w,i as T,l as E,s as D,t as O}from"./dialog-Kx6RCn3A.js";import{WorkspacePicker as k}from"./WorkspacePicker-B68VTV5x.js";import{a as A,i as j,n as M,o as N,r as P,s as ee,t as F}from"./FeaturePage-1MUXz3Y-.js";import{t as I}from"./field-Bnm9KAi2.js";import{t as L}from"./StatusGlyph-1KgitlUg.js";import{t as R}from"./pick-system-directory-BgN7vwKS.js";import{i as z,n as B,s as V,t as te}from"./app-primitives-Cmdj4cIW.js";import{t as H}from"./AppSelect-fH3gqflO.js";var U=e(t(),1),W=n(),G={browser:{name:`通知`,Icon:a},feishu:{name:`飞书`,Icon:o},weixin:{name:`微信`,Icon:u},qq:{name:`QQ`,Icon:u},telegram:{name:`Telegram`,Icon:d}},K={interval:`每隔一段时间`,daily:`每天`,weekly:`每周`,monthly:`每月`},q={minutes:`分钟`,hours:`小时`,days:`天`},J=[...new Set([`Asia/Hong_Kong`,`UTC`,...typeof Intl.supportedValuesOf==`function`?Intl.supportedValuesOf(`timeZone`):[]])],Y=[`full-access`],X=`mt-4 border-t border-stroke-soft pt-1`,Z=`form-grid grid gap-x-3 sm:grid-cols-3`,ne=`schedule-interval-input grid grid-cols-[minmax(0,1fr)_minmax(84px,auto)] gap-1.5`,re=`inline-grid h-8 grid-cols-2 rounded-md border border-stroke bg-chrome p-[3px] max-[650px]:h-auto max-[650px]:w-full pointer-coarse:h-auto`,ie=`inline-flex min-w-0 items-center justify-center rounded-sm border border-transparent px-3 text-sm text-content-secondary transition-colors duration-(--d-fast) hover:text-content aria-pressed:border-key-border aria-pressed:bg-key aria-pressed:font-medium aria-pressed:text-content aria-pressed:shadow-key max-[650px]:h-11 pointer-coarse:h-11`;function ae({status:e}){return(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`mt-px grid size-[18px] flex-none place-items-center`,children:(0,W.jsx)(L,{status:e===`running`?`run`:e===`completed`?`done`:`failed`,className:`size-3.5`})})}function oe(e){return e(`schedules:schedulesPage.fullAccessHelp`)}function se(e,t){return t(e===`daily`?`schedules:schedulesPage.daily`:e===`weekly`?`schedules:schedulesPage.weekly`:e===`monthly`?`schedules:schedulesPage.monthly`:`schedules:schedulesPage.atIntervals`)}function ce(e,t){return t(e===`hours`?`schedules:schedulesPage.hours`:e===`days`?`schedules:schedulesPage.days`:`schedules:schedulesPage.minutes`)}function le(e,t){return t(e===`feishu`?`schedules:schedulesPage.feishu`:e===`weixin`?`schedules:schedulesPage.weChat`:e===`qq`?`schedules:schedulesPage.qq`:e===`telegram`?`schedules:schedulesPage.telegram`:`schedules:schedulesPage.browserNotification`)}function Q({value:e,onChange:t}){let{t:n}=r();return(0,W.jsxs)(I,{variant:`control`,children:[n(`schedules:schedulesPage.executionMode`),(0,W.jsx)(H,{value:e,onChange:e=>t(e.target.value),children:Y.map(e=>(0,W.jsx)(`option`,{value:e,children:n(`schedules:schedulesPage.fullAccess`)},e))}),(0,W.jsx)(`small`,{children:oe(n)})]})}function ue(e){return Object.fromEntries((e?.inputs||[]).map(e=>[e.name,e.defaultValue??``]))}function $(e,t,n,r,i){if(e===`prompt`)return!!t.trim();let a=i.find(e=>e.id===n);return a?a.inputs.every(e=>{let t=Object.hasOwn(r,e.name)?r[e.name]:e.defaultValue;return!e.required||t!=null&&t!==``}):!1}function de({targetType:e,prompt:t,workflowId:n,workflowInputs:i,workflows:a,onChange:o}){let{t:s}=r(),c=a.find(e=>e.id===n);return(0,W.jsxs)(`div`,{className:`grid`,children:[(0,W.jsxs)(I,{variant:`control`,children:[s(`schedules:schedulesPage.executionTarget`),(0,W.jsxs)(H,{value:e,onChange:e=>{let t=e.target.value,r=a[0];o(t===`workflow`?{targetType:t,workflowId:n||r?.id||``,workflowInputs:n?i:ue(r)}:{targetType:t})},children:[(0,W.jsx)(`option`,{value:`prompt`,children:`Prompt`}),(0,W.jsx)(`option`,{value:`workflow`,children:s(`schedules:schedulesPage.workflow`)})]})]}),e===`prompt`?(0,W.jsxs)(I,{variant:`control`,children:[`Prompt`,(0,W.jsx)(`textarea`,{value:t,onChange:e=>o({prompt:e.target.value}),placeholder:s(`schedules:schedulesPage.describeTheWorkTheAgentShouldCompleteEachTime`)})]}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(I,{variant:`control`,children:[s(`schedules:schedulesPage.workflow`),(0,W.jsxs)(H,{value:n,onChange:e=>{let t=a.find(t=>t.id===e.target.value);o({workflowId:e.target.value,workflowInputs:ue(t)})},children:[(0,W.jsx)(`option`,{value:``,children:s(`schedules:schedulesPage.selectPublishedWorkflow`)}),a.map(e=>(0,W.jsxs)(`option`,{value:e.id,children:[e.name,` · v`,e.revision]},e.id))]}),(0,W.jsx)(`small`,{children:c?.description||(a.length?s(`schedules:schedulesPage.workflowUsesItsOwnRuntimeSettings`):s(`schedules:schedulesPage.noPublishedWorkflows`))})]}),c?.inputs.length?(0,W.jsxs)(`div`,{className:`grid`,children:[(0,W.jsxs)(`div`,{className:`schedule-workflow-inputs-heading mt-3 flex items-baseline justify-between gap-3 max-[650px]:flex-col max-[650px]:items-start max-[650px]:gap-0.5 [&_small]:text-xs [&_small]:text-content-muted [&_strong]:text-xs [&_strong]:font-medium [&_strong]:text-content-secondary`,children:[(0,W.jsx)(`strong`,{children:s(`schedules:schedulesPage.workflowInputs`)}),(0,W.jsx)(`small`,{children:s(`schedules:schedulesPage.workflowInputsHelp`)})]}),(0,W.jsx)(`div`,{className:`schedule-workflow-inputs grid gap-x-3 sm:grid-cols-2 [&_input[type=checkbox]]:size-4 [&_input[type=checkbox]]:justify-self-end [&_input[type=checkbox]]:accent-star`,children:c.inputs.map(e=>(0,W.jsxs)(I,{variant:`control`,className:e.type===`boolean`?`grid grid-cols-[minmax(0,1fr)_auto] items-center`:void 0,children:[e.label,e.required?` *`:``,e.type===`boolean`?(0,W.jsx)(`input`,{type:`checkbox`,checked:!!i[e.name],onChange:t=>o({workflowInputs:{...i,[e.name]:t.target.checked}})}):(0,W.jsx)(`input`,{type:e.type===`number`?`number`:`text`,required:e.required,value:String(i[e.name]??``),onChange:t=>o({workflowInputs:{...i,[e.name]:t.target.value}})}),e.description&&(0,W.jsx)(`small`,{children:e.description})]},e.id))})]}):null]})]})}function fe({value:e,onChange:t}){let{t:n}=r(),[i,a]=(0,U.useState)(``),[o,s]=(0,U.useState)(!1),c=async()=>{a(``);try{let r=await R(e,n(`common:workspacePicker.selectWorkspaceForSchedule`));r.status===`picked`?t(r.path):r.status===`unavailable`&&s(!0)}catch(e){a(e instanceof Error?e.message:String(e))}};return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(I,{variant:`control`,children:[n(`schedules:schedulesPage.workingDirectory`),(0,W.jsxs)(`span`,{className:`schedule-workspace-input grid grid-cols-[minmax(0,1fr)_auto] gap-1.5 [&_input]:min-w-0 [&_input]:font-mono`,children:[(0,W.jsx)(`input`,{value:e,onChange:e=>t(e.target.value),placeholder:n(`schedules:schedulesPage.enterTheProjectSAbsolutePath`)}),(0,W.jsxs)(y,{type:`button`,variant:`secondary`,className:`h-auto min-h-8.5`,onClick:()=>void c(),children:[(0,W.jsx)(l,{}),n(`schedules:schedulesPage.browseDirectories`)]})]}),(0,W.jsx)(`small`,{children:n(`schedules:schedulesPage.theScheduledAgentWillRunInThisDirectory`)})]}),i&&(0,W.jsxs)(z,{children:[(0,W.jsx)(h,{size:13}),i]}),(0,W.jsx)(k,{open:o,initialPath:e,description:n(`common:workspacePicker.selectWorkspaceForSchedule`),onOpenChange:s,onSelect:e=>t(e)})]})}function pe(e){return{id:e.id,name:e.name,targetType:e.targetType||`prompt`,prompt:e.prompt,workflowId:e.workflowId||``,workflowInputs:e.workflowInputs||{},enabled:e.enabled,frequency:e.frequency,intervalValue:e.intervalValue||1,intervalUnit:e.intervalUnit||`hours`,time:e.time,timezone:e.timezone,dayOfWeek:e.dayOfWeek,dayOfMonth:e.dayOfMonth,cwd:e.cwd,executionMode:e.executionMode||`full-access`,model:e.model,notifications:e.notifications||[],notifyOn:e.notifyOn||`always`}}function me(e,t=`zh-CN`){return!e.enabled||!e.nextRunAt?t===`en-US`?`Paused`:`已暂停`:new Intl.DateTimeFormat(t,{timeZone:e.timezone,dateStyle:`medium`,timeStyle:`short`}).format(new Date(e.nextRunAt))}function he({notify:e,onBack:t,openNotificationSettings:n,requestConfirm:a}){let{t:o,language:c}=r(),l=b(`focusSearch`),[u,d]=(0,U.useState)({tasks:[],runs:[],notificationTargets:{browser:{enabled:!1},feishu:{enabled:!1},weixin:{enabled:!1},qq:{enabled:!1},telegram:{enabled:!1}},workflows:[],defaultCwd:``}),[f,m]=(0,U.useState)(``),[h,_]=(0,U.useState)({}),[v,x]=(0,U.useState)(!0),[w,T]=(0,U.useState)(!1),[E,D]=(0,U.useState)(``),[O,k]=(0,U.useState)(!1),[I,R]=(0,U.useState)(``),[z,B]=(0,U.useState)(!1),[V,te]=(0,U.useState)(``),H=(0,U.useCallback)(async()=>{try{let e=await i(`/api/schedules`);d(e),T(!0),D(``),m(t=>e.tasks.some(e=>e.id===t)?t:``),_(t=>{let n=Object.entries(t).filter(([t])=>e.tasks.some(e=>e.id===t));return n.length===Object.keys(t).length?t:Object.fromEntries(n)})}catch(e){D(e instanceof Error?e.message:String(e))}finally{x(!1)}},[]);(0,U.useEffect)(()=>{H()},[H]),(0,U.useEffect)(()=>{let e=window.setInterval(H,u.tasks.some(e=>e.lastStatus===`running`)?2e3:1e4);return()=>window.clearInterval(e)},[u.tasks,H]);let G=u.tasks.find(e=>e.id===f),K=u.workflows||[],q=G?h[G.id]??pe(G):null,J=(0,U.useMemo)(()=>u.runs.filter(e=>e.taskId===f).sort((e,t)=>new Date(t.startedAt).getTime()-new Date(e.startedAt).getTime()).slice(0,20),[u.runs,f]),Y=e=>K.find(t=>t.id===e.workflowId)?.name||o(`schedules:schedulesPage.workflowUnavailable`),X=V.trim().toLocaleLowerCase(),Z=X?u.tasks.filter(e=>`${e.name} ${e.targetType===`workflow`?Y(e):e.prompt}`.toLocaleLowerCase().includes(X)):u.tasks,ne=u.tasks.filter(e=>e.enabled).length,re=e=>{if(!G)return;let t=pe(G);_(n=>({...n,[t.id]:{...n[t.id]??t,...e}}))},ie=e=>{q&&re({notifications:q.notifications.includes(e)?q.notifications.filter(t=>t!==e):[...q.notifications,e]})},ae=async()=>{if(!(!G||!q)){k(!0),R(``);try{let t=await i(`/api/schedules/${encodeURIComponent(G.id)}`,{method:`PATCH`,body:JSON.stringify(q)});d(t.state),_(e=>Object.fromEntries(Object.entries(e).filter(([e])=>e!==t.task.id))),e(o(`schedules:schedulesPage.scheduledTaskSaved`))}catch(e){R(e instanceof Error?e.message:String(e))}finally{k(!1)}}},oe=async()=>{if(G){k(!0),R(``);try{await i(`/api/schedules/${encodeURIComponent(G.id)}/run`,{method:`POST`,body:`{}`}),await H(),e(o(`schedules:schedulesPage.scheduledTaskStarted`))}catch(e){R(e instanceof Error?e.message:String(e))}finally{k(!1)}}},le=async()=>{if(G&&await a({title:o(`schedules:schedulesPage.deleteScheduledTask`),message:o(`schedules:schedulesPage.deleteScheduledTaskNameAndItsRunHistory`,{name:G.name}),confirmLabel:o(`schedules:schedulesPage.delete`)}))try{await i(`/api/schedules/${encodeURIComponent(G.id)}`,{method:`DELETE`}),await H(),e(o(`schedules:schedulesPage.scheduledTaskDeleted`))}catch(e){R(e instanceof Error?e.message:String(e))}},Q=t=>{d(t.state),m(t.task.id),e(o(`schedules:schedulesPage.scheduledTaskCreated`))},ue=e=>(0,W.jsxs)(`span`,{className:`flex min-w-0 flex-col items-end gap-0.5 max-[650px]:flex-row max-[650px]:items-center max-[650px]:gap-2`,children:[e.lastStatus===`running`?(0,W.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-content-secondary`,children:[(0,W.jsx)(L,{status:`run`,className:`size-3.5`}),o(`schedules:schedulesPage.running`)]}):(0,W.jsx)(`span`,{className:`whitespace-nowrap`,children:e.enabled?o(`schedules:schedulesPage.nextRunTime`,{time:me(e,c)}):o(`schedules:schedulesPage.pause`)}),e.lastStatus===`failed`&&(0,W.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-content-secondary`,children:[(0,W.jsx)(L,{status:`failed`,className:`size-3.5`}),o(`schedules:schedulesPage.lastRunFailed`)]})]}),$=o(`navigation:navigation.schedules`);return(0,W.jsxs)(P,{title:$,description:o(`schedules:schedulesPage.lede`),back:t&&{label:o(`navigation:sidebar.features`),ariaLabel:o(`navigation:shell.backToFeaturesLabel`),onBack:t},toolbar:(0,W.jsx)(ee,{search:(0,W.jsx)(A,{id:g,value:V,onValueChange:te,placeholder:o(`navigation:pageHeader.searchPage`,{page:$}),shortcut:l,clearLabel:o(`navigation:more.clearSearch`)}),actions:(0,W.jsxs)(y,{type:`button`,className:`h-9`,disabled:!w,onClick:()=>B(!0),children:[(0,W.jsx)(p,{}),o(`schedules:schedulesPage.newTask`)]})}),children:[v?(0,W.jsx)(S,{kind:`loading`,title:o(`schedules:schedulesPage.loadingScheduledTasks`)}):E&&!w?(0,W.jsx)(S,{kind:`error`,title:o(`schedules:schedulesPage.loadFailed`),description:E,action:(0,W.jsx)(y,{variant:`secondary`,className:`max-[650px]:h-11`,onClick:()=>{x(!0),H()},children:o(`common:pageTemplate.retry`)})}):(0,W.jsxs)(W.Fragment,{children:[(I||E)&&(0,W.jsx)(F,{children:I||E}),(0,W.jsx)(N,{title:o(`schedules:schedulesPage.tasks`),count:u.tasks.length,meta:u.tasks.length?o(`schedules:schedulesPage.enabledCount`,{count:ne}):void 0,children:Z.length?(0,W.jsx)(M,{children:Z.map(e=>{let t=f===e.id;return(0,W.jsx)(j,{"data-schedule-task":e.id,className:`schedule-list-item`,icon:(0,W.jsx)(s,{}),name:e.name,description:e.targetType===`workflow`?(0,W.jsx)(`span`,{className:`font-mono`,children:Y(e)}):e.prompt,meta:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`span`,{children:se(e.frequency,o)}),(0,W.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,W.jsx)(`span`,{className:`tabular-nums`,children:e.frequency===`interval`?`${e.intervalValue} ${ce(e.intervalUnit,o)}`:e.time}),(0,W.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,W.jsx)(`span`,{className:`truncate`,children:e.timezone})]}),status:ue(e),expanded:t,onExpandedChange:t=>m(t?e.id:``),toggleLabel:o(`schedules:schedulesPage.toggleTaskDetails`,{name:e.name}),detail:t&&q&&G?(0,W.jsx)(ge,{task:G,draft:q,runs:J,saving:O,workflows:K,notificationTargets:u.notificationTargets,language:c,onUpdate:re,onToggleNotification:ie,onRun:oe,onRemove:le,onSave:ae,onEditTemplates:n}):null},e.id)})}):(0,W.jsx)(C,{title:u.tasks.length?o(`schedules:schedulesPage.noMatchingTasks`):o(`schedules:schedulesPage.theTimelineIsStillUnlit`),description:u.tasks.length?void 0:o(`schedules:schedulesPage.createATaskAndLetItSetOutAutomaticallyAtTheAppointedTime`)})}),!u.tasks.length&&(0,W.jsx)(`div`,{className:`mt-7`,"data-schedule-create":!0,children:(0,W.jsx)(_e,{notificationTargets:u.notificationTargets,workflows:K,defaultCwd:u.defaultCwd,onCreated:Q})})]}),z&&(0,W.jsx)(ve,{notificationTargets:u.notificationTargets,workflows:K,defaultCwd:u.defaultCwd,onClose:()=>B(!1),onCreated:e=>{B(!1),Q(e)}})]})}function ge({task:e,draft:t,runs:n,saving:i,workflows:a,notificationTargets:o,language:s,onUpdate:l,onToggleNotification:u,onRun:d,onRemove:p,onSave:h,onEditTemplates:g}){let{t:b}=r(),S=e.lastStatus===`running`;return(0,W.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,W.jsxs)(`label`,{className:`mr-auto inline-flex min-h-8 items-center gap-2.5 text-sm text-content max-[650px]:min-h-11`,children:[(0,W.jsx)(V,{value:t.enabled,onChange:e=>l({enabled:e}),ariaLabel:b(`schedules:schedulesPage.enableTaskName`,{name:t.name})}),t.enabled?b(`schedules:schedulesPage.enabled`):b(`schedules:schedulesPage.pause`)]}),(0,W.jsxs)(y,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,disabled:i||S,onClick:d,children:[S?(0,W.jsx)(v,{}):(0,W.jsx)(f,{}),b(S?`schedules:schedulesPage.running`:`schedules:schedulesPage.runNow`)]}),(0,W.jsx)(y,{variant:`ghost`,size:`icon-sm`,className:`hover:bg-danger-soft hover:text-danger max-[650px]:size-11`,title:b(`schedules:schedulesPage.deleteTask`),"aria-label":b(`schedules:schedulesPage.deleteTask`),onClick:p,children:(0,W.jsx)(m,{})})]}),(0,W.jsx)(de,{targetType:t.targetType,prompt:t.prompt,workflowId:t.workflowId,workflowInputs:t.workflowInputs,workflows:a,onChange:l}),t.targetType===`prompt`&&(0,W.jsx)(fe,{value:t.cwd,onChange:e=>l({cwd:e})}),(0,W.jsx)(`div`,{className:X,children:(0,W.jsxs)(`div`,{className:Z,children:[(0,W.jsxs)(I,{variant:`control`,children:[b(`schedules:schedulesPage.frequency`),(0,W.jsx)(H,{value:t.frequency,onChange:e=>l({frequency:e.target.value}),children:Object.keys(K).map(e=>(0,W.jsx)(`option`,{value:e,children:se(e,b)},e))})]}),t.frequency===`interval`?(0,W.jsxs)(I,{variant:`control`,children:[b(`schedules:schedulesPage.runInterval`),(0,W.jsxs)(`span`,{className:ne,children:[(0,W.jsx)(`input`,{type:`number`,min:`1`,value:t.intervalValue,onChange:e=>l({intervalValue:Number(e.target.value)})}),(0,W.jsx)(H,{value:t.intervalUnit,onChange:e=>l({intervalUnit:e.target.value}),children:Object.keys(q).map(e=>(0,W.jsx)(`option`,{value:e,children:ce(e,b)},e))})]})]}):(0,W.jsxs)(I,{variant:`control`,children:[b(`schedules:schedulesPage.time`),(0,W.jsx)(`input`,{type:`time`,className:`tabular-nums`,value:t.time,onChange:e=>l({time:e.target.value})})]}),(0,W.jsxs)(I,{variant:`control`,children:[b(`schedules:schedulesPage.timeZone`),(0,W.jsx)(H,{value:t.timezone,onChange:e=>l({timezone:e.target.value}),children:J.map(e=>(0,W.jsx)(`option`,{value:e,children:e},e))})]}),t.targetType===`prompt`&&(0,W.jsx)(Q,{value:t.executionMode,onChange:e=>l({executionMode:e})})]})}),(0,W.jsxs)(`div`,{className:_(`schedule-notification-section pt-3`,X),children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,W.jsx)(`strong`,{className:`text-sm font-medium`,children:b(`schedules:schedulesPage.notificationChannels`)}),(0,W.jsx)(`button`,{type:`button`,className:`text-button text-xs font-medium text-content-secondary underline underline-offset-2 hover:text-content max-[650px]:min-h-11`,onClick:g,children:b(`schedules:schedulesPage.editTemplates`)})]}),(0,W.jsx)(`p`,{className:`mt-0.5 text-xs text-content-muted`,children:b(`schedules:schedulesPage.notificationChannelsHelp`)}),(0,W.jsx)(`div`,{className:`schedule-notification-targets mt-2.5 grid grid-cols-[repeat(auto-fill,minmax(132px,1fr))] gap-2`,children:Object.entries(G).map(([e,n])=>{let r=n.Icon,i=t.notifications.includes(e);return(0,W.jsxs)(`button`,{type:`button`,"aria-pressed":i,className:_(`grid min-h-[52px] grid-cols-[16px_minmax(0,1fr)_16px] items-center gap-2 rounded-md border px-2.5 py-2 text-left transition-colors duration-(--d-fast)`,i?`selected border-star-border bg-star-soft text-star-strong`:`border-stroke bg-panel text-content hover:bg-surface-subtle`),onClick:()=>u(e),children:[(0,W.jsx)(r,{className:`size-4`}),(0,W.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,W.jsx)(`strong`,{className:`truncate text-sm font-medium`,children:le(e,b)}),(0,W.jsx)(`small`,{className:`truncate text-xs text-content-muted`,children:o[e].enabled?b(`schedules:schedulesPage.configured`):b(`schedules:schedulesPage.notConfigured`)})]}),(0,W.jsx)(c,{className:_(`size-4`,i?`text-star-strong`:`text-content-faint`)})]},e)})}),(0,W.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-3 gap-y-1.5`,children:[(0,W.jsx)(`span`,{id:`schedule-notify-on-${e.id}`,className:`text-xs text-content-muted`,children:b(`schedules:schedulesPage.notifyWhen`)}),(0,W.jsx)(`div`,{role:`group`,"aria-labelledby":`schedule-notify-on-${e.id}`,className:_(`schedule-notification-chip`,re),children:[`always`,`failure`].map(e=>(0,W.jsx)(`button`,{type:`button`,"aria-pressed":t.notifyOn===e,className:ie,onClick:()=>l({notifyOn:e}),children:b(e===`failure`?`schedules:schedulesPage.failuresOnly`:`schedules:schedulesPage.completionAndFailure`)},e))})]})]}),(0,W.jsxs)(`div`,{className:`form-footer mt-4 flex items-center justify-between gap-2.5 border-t border-stroke-soft pt-3 max-[650px]:flex-wrap`,children:[(0,W.jsx)(`span`,{className:`text-xs text-content-muted tabular-nums`,children:e.lastRunAt?b(`schedules:schedulesPage.lastRunTime`,{time:x(e.lastRunAt,s)}):b(`schedules:schedulesPage.nextRunTime`,{time:me(e,s)})}),(0,W.jsxs)(y,{className:`max-[650px]:h-11 max-[650px]:w-full`,disabled:i||!$(t.targetType,t.prompt,t.workflowId,t.workflowInputs,a),onClick:h,children:[i?(0,W.jsx)(v,{className:`text-current`}):null,b(i?`schedules:schedulesPage.saving`:`schedules:schedulesPage.saveTask`)]})]})]}),(0,W.jsxs)(`section`,{"aria-labelledby":`schedule-runs-${e.id}`,className:`min-w-0`,children:[(0,W.jsxs)(`h3`,{id:`schedule-runs-${e.id}`,className:`mb-1.5 text-[13px] font-medium text-content-muted tabular-nums`,children:[b(`schedules:schedulesPage.recentRuns`),` · `,n.length]}),n.length?(0,W.jsx)(`ul`,{className:`divide-y divide-stroke-soft overflow-hidden rounded-[var(--r-md)] border border-stroke`,children:n.map(e=>(0,W.jsxs)(`li`,{className:`schedule-run-row grid min-h-11 grid-cols-[18px_minmax(0,1fr)_auto] items-start gap-2.5 px-3 py-2.5 ${e.status}`,children:[(0,W.jsx)(ae,{status:e.status}),(0,W.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,W.jsx)(`strong`,{className:`line-clamp-2 text-sm leading-5 font-medium text-content`,children:e.status===`running`?b(`schedules:schedulesPage.running2`):e.status===`completed`?e.summary||b(`schedules:schedulesPage.taskCompleted`):e.status===`interrupted`?b(`schedules:schedulesPage.taskInterrupted`):e.error||b(`schedules:schedulesPage.taskFailed`)}),(0,W.jsxs)(`small`,{className:`text-xs text-content-muted tabular-nums`,children:[x(e.startedAt,s),` ·`,` `,e.trigger===`manual`?b(`schedules:schedulesPage.manualRun`):b(`schedules:schedulesPage.scheduledTrigger`),e.durationMs?` · ${b(`schedules:schedulesPage.countSec`,{count:Math.round(e.durationMs/1e3)})}`:``]})]}),(0,W.jsx)(`em`,{className:`font-mono text-xs leading-5 text-content-secondary not-italic tabular-nums`,children:new Intl.DateTimeFormat(s,{hour:`2-digit`,minute:`2-digit`}).format(new Date(e.startedAt))})]},e.id))}):(0,W.jsx)(C,{compact:!0,title:b(`schedules:schedulesPage.noRunHistory`)})]})]})}function _e({notificationTargets:e,workflows:t,defaultCwd:n,onCreated:a}){let{t:o}=r(),[s,c]=(0,U.useState)(``),[l,u]=(0,U.useState)(`prompt`),[d,f]=(0,U.useState)(``),[m,g]=(0,U.useState)(``),[b,x]=(0,U.useState)({}),[S,C]=(0,U.useState)(n||``),[w,T]=(0,U.useState)(`daily`),[E,D]=(0,U.useState)(`09:00`),[O,k]=(0,U.useState)(`Asia/Hong_Kong`),[A,j]=(0,U.useState)(1),[M,N]=(0,U.useState)(`hours`),[P,ee]=(0,U.useState)(`full-access`),[F,L]=(0,U.useState)(!1),[R,V]=(0,U.useState)(``);return(0,W.jsxs)(te,{className:`p-4 py-4`,children:[(0,W.jsx)(B,{children:(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`h2`,{className:`text-[15px]! font-medium`,children:o(`schedules:schedulesPage.newScheduledTask`)}),(0,W.jsx)(`p`,{children:o(`schedules:schedulesPage.youCanContinueEditingTheRunTimeAndNotificationChannelsAfterCreation`)})]})}),(0,W.jsxs)(I,{variant:`control`,children:[o(`schedules:schedulesPage.taskName`),(0,W.jsx)(`input`,{value:s,onChange:e=>c(e.target.value),placeholder:o(`schedules:schedulesPage.forExampleDailyCodeReview`)})]}),(0,W.jsx)(de,{targetType:l,prompt:d,workflowId:m,workflowInputs:b,workflows:t,onChange:e=>{e.targetType&&u(e.targetType),e.prompt!==void 0&&f(e.prompt),e.workflowId!==void 0&&g(e.workflowId),e.workflowInputs!==void 0&&x(e.workflowInputs)}}),l===`prompt`&&(0,W.jsx)(fe,{value:S,onChange:C}),(0,W.jsxs)(`div`,{className:_(X,Z),children:[(0,W.jsxs)(I,{variant:`control`,children:[o(`schedules:schedulesPage.frequency`),(0,W.jsx)(H,{value:w,onChange:e=>T(e.target.value),children:Object.keys(K).map(e=>(0,W.jsx)(`option`,{value:e,children:se(e,o)},e))})]}),w===`interval`?(0,W.jsxs)(I,{variant:`control`,children:[o(`schedules:schedulesPage.runInterval`),(0,W.jsxs)(`span`,{className:ne,children:[(0,W.jsx)(`input`,{type:`number`,min:`1`,value:A,onChange:e=>j(Number(e.target.value))}),(0,W.jsx)(H,{value:M,onChange:e=>N(e.target.value),children:Object.keys(q).map(e=>(0,W.jsx)(`option`,{value:e,children:ce(e,o)},e))})]})]}):(0,W.jsxs)(I,{variant:`control`,children:[o(`schedules:schedulesPage.time`),(0,W.jsx)(`input`,{type:`time`,className:`tabular-nums`,value:E,onChange:e=>D(e.target.value)})]}),(0,W.jsxs)(I,{variant:`control`,children:[o(`schedules:schedulesPage.timeZone`),(0,W.jsx)(H,{value:O,onChange:e=>k(e.target.value),children:J.map(e=>(0,W.jsx)(`option`,{value:e,children:e},e))})]}),l===`prompt`&&(0,W.jsx)(Q,{value:P,onChange:ee})]}),R&&(0,W.jsxs)(z,{children:[(0,W.jsx)(h,{size:13}),R]}),(0,W.jsxs)(`div`,{className:`form-footer mt-4 flex items-center justify-between gap-2.5 border-t border-stroke-soft pt-3 max-[650px]:flex-wrap`,children:[(0,W.jsx)(`span`,{className:`text-xs text-content-muted`,children:o(`schedules:schedulesPage.enabledAutomaticallyAfterCreation`)}),(0,W.jsxs)(y,{className:`max-[650px]:h-11 max-[650px]:w-full`,disabled:F||!s.trim()||!$(l,d,m,b,t),onClick:async()=>{L(!0),V(``);try{let t=Object.entries(e).filter(([,e])=>e.enabled).map(([e])=>e);a(await i(`/api/schedules`,{method:`POST`,body:JSON.stringify({name:s,targetType:l,prompt:d,workflowId:m,workflowInputs:b,cwd:S,enabled:!0,frequency:w,time:E,timezone:O,intervalValue:A,intervalUnit:M,executionMode:P,notifications:t,notifyOn:`always`})}))}catch(e){V(e instanceof Error?e.message:String(e))}finally{L(!1)}},children:[F?(0,W.jsx)(v,{className:`text-current`}):(0,W.jsx)(p,{}),o(F?`schedules:schedulesPage.creating`:`schedules:schedulesPage.createTask`)]})]})]})}function ve({notificationTargets:e,workflows:t,defaultCwd:n,onClose:a,onCreated:o}){let{t:s}=r(),[c,l]=(0,U.useState)(``),[u,d]=(0,U.useState)(`prompt`),[f,m]=(0,U.useState)(``),[g,_]=(0,U.useState)(``),[b,x]=(0,U.useState)({}),[S,C]=(0,U.useState)(n||``),[k,A]=(0,U.useState)(`full-access`),[j,M]=(0,U.useState)(!1),[N,P]=(0,U.useState)(``);return(0,W.jsx)(O,{open:!0,onOpenChange:e=>!e&&a(),children:(0,W.jsx)(T,{size:`compact`,children:(0,W.jsxs)(`form`,{className:`grid min-w-0`,onSubmit:async t=>{t.preventDefault(),M(!0),P(``);try{let t=Object.entries(e).filter(([,e])=>e.enabled).map(([e])=>e);o(await i(`/api/schedules`,{method:`POST`,body:JSON.stringify({name:c,targetType:u,prompt:f,workflowId:g,workflowInputs:b,cwd:S,enabled:!0,frequency:`daily`,time:`09:00`,timezone:`Asia/Hong_Kong`,executionMode:k,notifications:t,notifyOn:`always`})}))}catch(e){P(e instanceof Error?e.message:String(e))}finally{M(!1)}},children:[(0,W.jsxs)(D,{children:[(0,W.jsx)(E,{children:s(`schedules:schedulesPage.newScheduledTask`)}),(0,W.jsx)(w,{children:s(`schedules:schedulesPage.youCanContinueSettingTheRunTimeAndNotificationChannelsAfterCreation`)})]}),(0,W.jsxs)(I,{variant:`control`,children:[s(`schedules:schedulesPage.taskName`),(0,W.jsx)(`input`,{value:c,onChange:e=>l(e.target.value),placeholder:s(`schedules:schedulesPage.forExampleDailyCodeReview`)})]}),(0,W.jsx)(de,{targetType:u,prompt:f,workflowId:g,workflowInputs:b,workflows:t,onChange:e=>{e.targetType&&d(e.targetType),e.prompt!==void 0&&m(e.prompt),e.workflowId!==void 0&&_(e.workflowId),e.workflowInputs!==void 0&&x(e.workflowInputs)}}),u===`prompt`&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(fe,{value:S,onChange:C}),(0,W.jsx)(Q,{value:k,onChange:A})]}),N&&(0,W.jsxs)(z,{children:[(0,W.jsx)(h,{size:13}),N]}),(0,W.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2 max-[650px]:[&>button]:h-11 max-[650px]:[&>button]:flex-1`,children:[(0,W.jsx)(y,{type:`button`,variant:`secondary`,onClick:a,children:s(`schedules:schedulesPage.cancel`)}),(0,W.jsxs)(y,{type:`submit`,disabled:j||!c.trim()||!$(u,f,g,b,t),children:[j?(0,W.jsx)(v,{className:`text-current`}):(0,W.jsx)(p,{}),s(j?`schedules:schedulesPage.creating`:`schedules:schedulesPage.createTask`)]})]})]})})})}export{he as SchedulesPage};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/GitDiffViewer-CSl-SGa1.js","assets/rolldown-runtime-B0Z9INg1.js","assets/vendor-react-DwNgTV1j.js","assets/use-i18n-D2P6OO3w.js","assets/i18n-DPvJ0T4T.js","assets/vendor-router-CSN_DGvx.js","assets/index-C4CqzQNY.js","assets/index-DbL8igcD.css","assets/storage-BY6wEHPw.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-Bu_vuij9.js","assets/dist-Cfh4kzCK.js","assets/events-ulSEiNKt.js","assets/esm-DCV8yILT.js","assets/TaskTerminalView-DcFp0oHH.js","assets/square-terminal-BVG6cUT1.js","assets/square-bHHVTT3G.js","assets/PageState-aWHrkE1D.js","assets/terminal-context-aIsIJPn8.js","assets/TaskTerminalView-BrP-ENHg.css","assets/TaskProcessesPane-hcChPVpA.js","assets/chevron-right-C3t2Rckj.js","assets/FileAttachmentPreview-B17OgdVi.js","assets/api-DVgYxLec.js","assets/abort-signal-f4JsiYKX.js","assets/download-BCfIiuaL.js","assets/file-Bllajneu.js","assets/refresh-cw-TbWxTY4K.js","assets/tabs-C4VeYYS2.js","assets/dist-B_a0oV4U.js","assets/dist-DAs5KRGl.js","assets/format-DMJQzoZ7.js","assets/dialog-Kx6RCn3A.js","assets/dist-BdkTa5R3.js","assets/es2015-0QT3KgdC.js","assets/MarkdownMessage-BPZcFjyR.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/check-2vYc6QaP.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-D2P6OO3w.js";import{t as a}from"./useQuery-Bg3cTjsY.js";import{t as o}from"./createLucideIcon-Cd-3GVxJ.js";import{t as s}from"./arrow-up-DST6-qVQ.js";import{t as c}from"./check-2vYc6QaP.js";import{t as l}from"./chevron-down-CxtxIjiP.js";import{t as u}from"./chevron-right-C3t2Rckj.js";import{t as d}from"./earth-Ddy13fHh.js";import{t as f}from"./external-link-CEQqPcqc.js";import{i as p}from"./GitDiffViewer-CSl-SGa1.js";import{t as m}from"./file-Bllajneu.js";import{R as h,a as g,i as _,m as v,o as y,r as b,v as x,y as S}from"./side-chat-context-BcCF9VZz.js";import{t as C}from"./git-branch-N7LGjtzt.js";import{t as w}from"./image-BY_c3FYU.js";import{t as T}from"./link-2-mgasYn21.js";import{t as E}from"./list-checks-B5Jl4aiO.js";import{t as D}from"./message-square-SKjZyY3v.js";import{t as O}from"./refresh-cw-TbWxTY4K.js";import{t as k}from"./square-bHHVTT3G.js";import"./collapsible-C__hRcbA.js";import"./tooltip-EomUbN9-.js";import{t as A}from"./utils-C8uzG5AZ.js";import{n as j,t as M}from"./button-Bu_vuij9.js";import{c as N,r as P}from"./shortcuts-BOeaPAvF.js";import{t as F}from"./chat-api-CQ9MShHZ.js";import{n as I,t as L}from"./PageState-aWHrkE1D.js";import{n as R}from"./session-change-summary-api-3216hpjE.js";import{t as z}from"./input-DIwJDpj9.js";import{t as B}from"./web-preview-tGGVFpDI.js";import{o as V}from"./session-tree-summary-PpU7AyqE.js";var H=o(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),U=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`}]]),W=e(n(),1),G=r(),ee={completed:`completed`,in_progress:`running`,blocked:`blocked`,pending:`pending`};function te(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 K({status:e,t}){let n=t(e===`completed`?`chat:planBoard.completed`:e===`in_progress`?`chat:planBoard.inProgress`:e===`blocked`?`chat:planBoard.blocked`:`chat:planBoard.pending`);return(0,G.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 ${ee[String(e)]||`pending`}`,title:n,children:[e===`completed`?(0,G.jsx)(c,{size:12,strokeWidth:2.25}):e===`in_progress`?(0,G.jsx)(j,{className:`size-3.5`}):e===`blocked`?(0,G.jsx)(U,{size:11,strokeWidth:2}):(0,G.jsx)(H,{size:11,strokeWidth:2}),(0,G.jsx)(`span`,{className:`sr-only`,children:n})]})}function q({item:e,current:t,t:n}){return(0,G.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,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-[10px]`,children:[(0,G.jsx)(K,{status:e.blocked?`blocked`:e.status,t:n}),(0,G.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,G.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:n(`chat:planBoard.assignedTo`,{name:e.assignee}),children:[(0,G.jsx)(h,{size:11,className:`flex-none`}),e.assignee]}):e.status!==`completed`&&(0,G.jsx)(`span`,{className:`flex-none text-[12px] text-content-muted`,children:n(`chat:planBoard.unassigned`)})]}),e.blockedBy.length>0&&(0,G.jsxs)(`div`,{className:`inline-flex min-w-0 items-center gap-[5px] pl-[28px] text-[12px] text-content-muted`,children:[(0,G.jsx)(U,{size:11,className:`flex-none`}),(0,G.jsx)(`span`,{className:`truncate`,children:n(`chat:planBoard.waitingFor`,{tasks:e.blockedBy.map(e=>e.title||e.id).join(` · `)})})]})]})}function J({plan:e,header:t,collapsible:n=!1}){let{t:r}=i(),a=(0,W.useRef)(null),[o,s]=(0,W.useState)(!0),c=e?.items||[],u=te(c),d=u.filter(e=>e.status===`completed`).length,f=u.filter(e=>e.status===`in_progress`&&!e.blocked).length,p=u.filter(e=>e.blocked).length,m=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,W.useLayoutEffect)(()=>{if(n&&!o)return;let e=a.current,t=e?.querySelector(`[data-pisper-plan-current="true"]`);if(!e||!t)return;let r=e.getBoundingClientRect(),i=t.getBoundingClientRect();i.top<r.top?e.scrollTop-=r.top-i.top:i.bottom>r.bottom&&(e.scrollTop+=i.bottom-r.bottom)},[n,m,o,u.length]),!c.length)return null;let h=u.find(e=>e.id===m),g=(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(E,{className:`flex-none text-content-muted`,size:15}),(0,G.jsx)(`strong`,{className:`tabular-nums`,children:r(`chat:planBoard.progress`,{completed:d,total:c.length})}),h?(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-content-secondary`,title:h.title,children:h.title}):null,(0,G.jsxs)(`span`,{className:`plan-board-counts inline-flex flex-none items-center gap-[8px] text-content-muted tabular-nums @max-[470px]:hidden`,children:[f>0&&(0,G.jsx)(`span`,{children:r(`chat:planBoard.countInProgress`,{count:f})}),p>0&&(0,G.jsx)(`span`,{className:`blocked text-danger`,children:r(`chat:planBoard.countBlocked`,{count:p})})]}),t,n?(0,G.jsx)(l,{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]}),_=(0,G.jsx)(`ul`,{ref:a,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,G.jsx)(q,{item:e,current:e.id===m,t:r},e.id))});return n?(0,G.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:o,onToggle:e=>s(e.currentTarget.open),children:[(0,G.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":r(`chat:planBoard.toggleAriaLabel`),children:g}),_]}):(0,G.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":r(`chat:planBoard.ariaLabel`),children:[(0,G.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:g}),_]})}var Y=(0,W.memo)(J),X=(0,W.lazy)(()=>t(()=>import(`./GitDiffViewer-CSl-SGa1.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 Z({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`?F.getFileDiff(e,t,{signal:r}):F.getSessionFileChangeDiff(e,t,{signal:r})});return d.isPending?(0,G.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 px-3 py-2.5 text-xs text-content-muted`,children:[(0,G.jsx)(j,{className:`size-3.5`}),u(`chat:focusSession.gitLoading`)]}):d.isError?(0,G.jsxs)(`div`,{className:`px-3 py-2.5`,children:[(0,G.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:d.error.message}),(0,G.jsx)(M,{variant:`ghost`,size:`sm`,onClick:()=>void d.refetch(),children:u(`chat:chatMessage.filePreviewRetry`)})]}):(0,G.jsx)(W.Suspense,{fallback:null,children:(0,G.jsx)(X,{position:o,onReading:s,diff:d.data.diff,truncated:d.data.diffTruncated,mode:c,fill:l})})}function ne({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})=>F.getVcsChanges(e,{signal:t})}),l=p(r.reading?.list,e=>o({reading:{...r.reading,list:e}})),d=(0,W.useMemo)(()=>x(c.data?.diff||``,c.data?.files.map(e=>e.path)||[],c.data?.diffTruncated),[c.data]),f=r.expandedFiles.filter(e=>c.data&&!c.data.files.some(t=>t.path===e)),m=c.error?.message||c.data?.error,h=c.data?.files||[];return(0,G.jsxs)(`section`,{"aria-label":s(`chat:workbench.projectChanges`),className:`flex min-h-0 flex-1 flex-col`,children:[(0,G.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,G.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&&!m&&(0,G.jsxs)(`span`,{className:`shrink-0 font-mono text-xs tabular-nums`,children:[(0,G.jsxs)(`span`,{className:`text-success`,children:[`+`,d.added]}),` `,(0,G.jsxs)(`span`,{className:`text-danger`,children:[`−`,d.removed]})]}),(0,G.jsx)(M,{variant:`ghost`,size:`icon`,className:`max-[650px]:size-11`,"aria-label":s(`chat:focusSession.gitRefresh`),disabled:c.isFetching,onClick:()=>void c.refetch(),children:(0,G.jsx)(O,{size:15,className:c.isFetching?`animate-spin`:void 0})})]}),(0,G.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2 border-b border-stroke-soft px-3 py-2.5`,children:[(0,G.jsx)(`p`,{className:`text-xs leading-relaxed text-content-muted`,children:s(`chat:workbench.projectScope`)}),(0,G.jsxs)(`p`,{className:`flex min-w-0 items-center gap-1.5 text-xs`,title:t,children:[c.data?.branch&&(0,G.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,G.jsx)(C,{size:12,className:`shrink-0`,"aria-hidden":`true`}),(0,G.jsx)(`span`,{className:`truncate`,children:c.data.branch})]}),(0,G.jsx)(`span`,{className:`min-w-0 truncate font-mono text-content-muted`,children:t})]}),(0,G.jsxs)(`div`,{className:`flex gap-1`,children:[(0,G.jsx)(M,{variant:`ghost`,size:`sm`,disabled:!h.length||!!m,onClick:()=>o({expandedFiles:h.map(e=>e.path)}),children:s(`chat:workbench.expandAll`)}),(0,G.jsx)(M,{variant:`ghost`,size:`sm`,onClick:()=>o({expandedFiles:[]}),children:s(`chat:workbench.collapseAll`)})]})]}),!c.isFetching&&!m&&f.map(e=>(0,G.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,G.jsx)(I,{kind:`loading`,title:s(`chat:focusSession.gitLoading`)}):m?(0,G.jsx)(`p`,{role:`alert`,className:`p-3 text-sm text-danger`,children:m}):c.data?.isRepo?h.length?(0,G.jsx)(`div`,{ref:l.ref,className:`min-h-0 flex-1 overflow-y-auto`,children:h.map(t=>{let n=r.expandedFiles.includes(t.path);return(0,G.jsxs)(`article`,{className:`border-b border-stroke-soft`,children:[(0,G.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,G.jsx)(u,{size:14,className:`shrink-0 text-content-muted transition-transform duration-(--d-fast) ${n?`rotate-90`:``}`}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs`,children:t.path}),(0,G.jsx)(`span`,{className:`min-w-4 shrink-0 text-center font-mono text-xs font-medium text-content-secondary`,children:t.status}),Object.hasOwn(d.files,t.path)&&(0,G.jsxs)(`span`,{className:`shrink-0 font-mono text-xs tabular-nums`,children:[(0,G.jsxs)(`span`,{className:`text-success`,children:[`+`,d.files[t.path].added]}),` `,(0,G.jsxs)(`span`,{className:`text-danger`,children:[`−`,d.files[t.path].removed]})]})]}),n&&(0,G.jsx)(`p`,{className:`break-all px-3 py-1.5 font-mono text-xs text-content-muted`,children:t.path}),n&&(0,G.jsx)(Z,{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,G.jsx)(L,{compact:!0,title:s(`chat:focusSession.fileChangesEmpty`)}):(0,G.jsx)(L,{compact:!0,title:s(`chat:workbench.notRepository`)})]})}function Q(e){return e instanceof Error?e.message:String(e)}function re({sessionId:e,streaming:t,requestConfirm:n}){let{t:r}=i(),[a,o]=(0,W.useState)(0),[s,c]=(0,W.useState)(0),[l,u]=(0,W.useState)(null),[d,f]=(0,W.useState)(!0),[p,m]=(0,W.useState)(``),[h,g]=(0,W.useState)(``),[_,v]=(0,W.useState)(``),[y,b]=(0,W.useState)(null),[x,S]=(0,W.useState)(null),[C,w]=(0,W.useState)(null),T=(0,W.useRef)(!1),E=(0,W.useRef)(0),D=(0,W.useRef)(0),O=(0,W.useRef)(!0),k=(0,W.useRef)(!1),A=(0,W.useRef)(t);return(0,W.useLayoutEffect)(()=>{A.current=t},[t]),(0,W.useLayoutEffect)(()=>(T.current=!0,()=>{T.current=!1,E.current+=1,D.current+=1}),[]),(0,W.useEffect)(()=>{let t=++E.current;return D.current+=1,S(null),w(null),O.current=!0,f(!0),m(``),F.getSessionFileChanges(e).then(e=>{T.current&&t===E.current&&(u(e),c(e=>e+1))},e=>{T.current&&t===E.current&&m(Q(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 F.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(Q(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 F.approveSessionFileChanges(e,t.path):await F.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(Q(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 ie=(0,W.lazy)(()=>t(()=>import(`./TaskTerminalView-DcFp0oHH.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]))),ae=(0,W.lazy)(()=>t(()=>import(`./TaskProcessesPane-hcChPVpA.js`).then(e=>({default:e.TaskProcessesPane})),__vite__mapDeps([24,1,2,3,4,5,6,7,8,9,25,10,19,20,14,13,15,12,21,22]))),oe=(0,W.lazy)(()=>t(()=>import(`./FileAttachmentPreview-B17OgdVi.js`).then(e=>e.n).then(e=>({default:e.FileAttachmentPreview})),__vite__mapDeps([26,1,2,3,4,5,6,7,8,9,27,28,29,10,30,31,11,32,13,33,15,34,12,14,35,36,37,38,39,40,41,42,43,44,45,46])));function se({sources:e,view:t,onViewChange:n}){let{t:r}=i(),a=p(t.reading?.list,e=>n({reading:{...t.reading,list:e}})),o=(0,W.useContext)(S),[s,c]=(0,W.useState)(``),l=(0,W.useRef)(null),d=e.find(e=>e.id===s),f=e.filter(e=>(!t.filter||e.kind===t.filter)&&e.name.toLocaleLowerCase().includes(t.query.toLocaleLowerCase()));return(0,G.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,"aria-label":r(`chat:workbench.sources`),children:[(0,G.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,G.jsxs)(`h2`,{className:`min-w-0 flex-1 truncate text-xs font-medium tracking-[.02em] text-content-muted`,children:[r(`chat:workbench.sources`),(0,G.jsx)(`span`,{className:`ml-1.5 tabular-nums`,children:e.length})]}),(0,G.jsx)(`span`,{className:`shrink-0 text-xs text-content-muted`,children:r(`chat:workbench.addSource`)}),(0,G.jsx)(`div`,{ref:o?.setSourceActionHost,className:`grid min-h-7 min-w-7 place-items-center`})]}),(0,G.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2 border-b border-stroke-soft px-3 py-2.5`,children:[(0,G.jsx)(`p`,{className:`text-xs leading-relaxed text-content-muted`,children:r(`chat:workbench.sourcesScope`)}),(0,G.jsxs)(`div`,{className:`flex min-w-0 gap-2`,children:[(0,G.jsx)(z,{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,G.jsxs)(`select`,{"aria-label":r(`chat:workbench.sourceType`),className:`h-8.5 max-w-[45%] shrink-0 rounded-sm border border-control bg-panel px-2 text-sm text-content outline-none focus-visible:border-focus focus-visible:ring-3 focus-visible:ring-focus-ring pointer-coarse:h-11`,value:t.filter,onChange:e=>n({filter:e.target.value}),children:[(0,G.jsx)(`option`,{value:``,children:r(`chat:workbench.allTypes`)}),(0,G.jsx)(`option`,{value:`image`,children:r(`chat:workbench.images`)}),(0,G.jsx)(`option`,{value:`text`,children:r(`chat:workbench.text`)}),(0,G.jsx)(`option`,{value:`file`,children:r(`chat:workbench.files`)})]})]})]}),(0,G.jsxs)(`div`,{ref:a.ref,className:`min-h-0 flex-1 overflow-y-auto`,children:[!f.length&&(0,G.jsx)(L,{compact:!0,title:e.length?r(`chat:workbench.noMatches`):r(`chat:workbench.noSources`)}),f.map(e=>{let i=t.selectedSourceId===e.id,a=e.kind===`image`?w:e.method===`path`?T:m;return(0,G.jsxs)(`article`,{className:`border-b border-stroke-soft`,children:[(0,G.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,G.jsx)(u,{size:14,className:`shrink-0 text-content-muted transition-transform duration-(--d-fast) ${i?`rotate-90`:``}`}),(0,G.jsx)(a,{className:`size-3.5 shrink-0 text-content-muted`}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs`,children:e.name||r(`chat:chatMessage.fileAttachment`)})]}),i&&(0,G.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,G.jsx)(`p`,{className:`break-all font-mono text-content-secondary`,children:e.attachment.path||e.attachment.id||r(`chat:workbench.unavailable`)}),(0,G.jsx)(`p`,{className:`font-mono`,children:e.attachment.mimeType||`application/octet-stream`}),(0,G.jsx)(`p`,{children:e.method===`asset`?r(`chat:workbench.registeredAsset`):e.method===`path`?r(`chat:workbench.pathReference`):r(`chat:workbench.invalidReference`)}),(0,G.jsx)(M,{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)})]}),d&&(0,G.jsx)(W.Suspense,{fallback:null,children:(0,G.jsx)(oe,{attachment:d.attachment,onClose:()=>c(``),onRestoreFocus:()=>l.current?.focus(),onDownload:()=>{typeof d.attachment.downloadUrl==`string`&&window.open(d.attachment.downloadUrl,`_blank`,`noopener,noreferrer`)}})})]})}function ce({parentId:e,active:t}){let{t:n}=i(),{entry:r,runtime:a,load:o,setDraft:c}=b(e),l=r.session?.id??``,u=(0,W.useMemo)(()=>e=>a.subscribeSessionState(l,e),[a,l]),d=(0,W.useMemo)(()=>()=>a.getSessionState(l),[a,l]),f=(0,W.useSyncExternalStore)(u,d),[p,m]=(0,W.useState)(!1),[h,x]=(0,W.useState)(!1),[S,C]=(0,W.useState)(``),w=(0,W.useRef)(!1),T=(0,W.useRef)(!1),E=(0,W.useRef)(r.draft);E.current=r.draft;let O=(0,W.useRef)(null),A=N(e=>e.bindings),F=_(f,r.session);(0,W.useEffect)(()=>{t&&o(e)},[t,o,e]);let I=async t=>{t.preventDefault();let n=E.current.trim();if(!(!n||w.current||F||r.expired)){w.current=!0,m(!0),C(``);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&&c(e,``),m(!1),await a.send(i,n),await o(e)}catch(e){C(V(e))}finally{w.current=!1,m(!1)}}},L=(0,W.useCallback)(async()=>{if(!(!l||a.getSessionState(l).streaming)){C(``);try{await a.retry(l),await o(e)}catch(e){C(V(e))}}},[o,e,a,l]),R=async()=>{if(!(!l||h)){x(!0);try{C(``),await a.abort(l)}catch(e){C(V(e))}finally{x(!1)}}},z=(0,G.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,G.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,G.jsx)(D,{className:`size-4`,"aria-hidden":`true`})}),(0,G.jsx)(`p`,{className:`max-w-64 leading-relaxed`,children:r.expired?n(`chat:sideChat.expired`):n(`chat:sideChat.empty`)}),r.expired&&(0,G.jsxs)(M,{variant:`secondary`,size:`sm`,className:`mt-1`,disabled:r.loading,onClick:async()=>{(await o(e,!0))?.session&&O.current?.focus()},children:[r.loading&&(0,G.jsx)(j,{className:`size-3.5 text-current`}),n(`chat:sideChat.restart`)]})]}),B=S||r.error||f.error;return(0,G.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,G.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`)}),l?(0,G.jsx)(y,{sessionId:l,messages:f.messages,transcriptLoadState:f.loaded?`ready`:f.error?`error`:`loading`,emptyState:z,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:F,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(l),onRetryLastTurn:L}):(0,G.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:z}),(0,G.jsxs)(`form`,{className:`flex shrink-0 flex-col gap-2 border-t border-stroke-soft p-3`,onSubmit:I,children:[B&&(0,G.jsx)(v,{error:B,onRetry:r.error||!f.loaded?async()=>{await o(e)}:L}),(0,G.jsx)(g,{approvals:f.approvals,onResolve:async(e,t)=>{try{await a.approve(l,e,t)}catch{}}}),(0,G.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,G.jsx)(`textarea`,{ref:O,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=>c(e,t.target.value),onCompositionStart:()=>{T.current=!0},onCompositionEnd:()=>{T.current=!1},onKeyDown:e=>{!T.current&&!e.nativeEvent.isComposing&&e.nativeEvent.keyCode!==229&&P(e.nativeEvent,A.sendMessage)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())}}),(0,G.jsx)(M,{type:F?`button`:`submit`,size:`icon`,className:`size-8 shrink-0 rounded-full max-[650px]:size-11 pointer-coarse:size-11`,"aria-label":n(F?`chat:sideChat.stop`:`chat:sideChat.send`),disabled:F?h:p||r.loading||r.expired||!r.draft.trim(),onClick:F?()=>void R():void 0,children:p||h?(0,G.jsx)(j,{className:`size-4 text-current`}):F?(0,G.jsx)(k,{size:13,fill:`currentColor`}):(0,G.jsx)(s,{size:17})})]})]})]})}var $=(0,W.createContext)(null),le=()=>{let e=(0,W.useContext)($);if(!e)throw Error(`WebPreview components must be used within a WebPreview`);return e},ue=({className:e,children:t,defaultUrl:n=``,onUrlChange:r,...i})=>{let[a,o]=(0,W.useState)(n),[s,c]=(0,W.useState)(!1),l=(0,W.useCallback)(e=>{o(e),r?.(e)},[r]),u=(0,W.useMemo)(()=>({consoleOpen:s,setConsoleOpen:c,setUrl:l,url:a}),[s,l,a]);return(0,G.jsx)($.Provider,{value:u,children:(0,G.jsx)(`div`,{className:A(`flex size-full min-h-0 flex-col rounded-lg border bg-card`,e),...i,children:t})})},de=({className:e,loading:t,src:n,...r})=>{let{url:i}=le();return(0,G.jsxs)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden bg-background`,children:[(0,G.jsx)(`iframe`,{className:A(`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 fe({page:e,onChange:t}){let{t:n}=i(),{draft:r,url:a}=e,[o,s]=(0,W.useState)(!1);return(0,G.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col gap-2 p-3`,"aria-label":n(`common:webPreview.title`),children:[(0,G.jsxs)(`form`,{className:`flex gap-2`,onSubmit:e=>{e.preventDefault();let n=B(r,window.location.href);s(!n),n&&t({url:n})},children:[(0,G.jsx)(z,{"aria-label":n(`common:webPreview.url`),className:`flex-1 font-mono`,value:r,onChange:e=>t({draft:e.target.value}),placeholder:n(`common:webPreview.urlPlaceholder`),maxLength:2048}),(0,G.jsx)(M,{type:`submit`,variant:`secondary`,className:`h-8.5 pointer-coarse:h-11`,children:n(`chat:sessionContext.openUrl`)})]}),o&&(0,G.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:n(`chat:sessionContext.invalidUrl`)}),a?(0,G.jsx)(ue,{className:`min-h-0 flex-1 overflow-hidden rounded-md border-stroke`,defaultUrl:a,children:(0,G.jsx)(de,{src:a,title:n(`common:webPreview.title`)})},a):(0,G.jsx)(L,{icon:d,className:`min-h-0 flex-1`,title:n(`chat:sessionContext.browserEmpty`)}),a&&(0,G.jsxs)(M,{type:`button`,variant:`ghost`,size:`sm`,className:`self-start`,onClick:()=>window.open(a,`_blank`,`noopener,noreferrer`),children:[(0,G.jsx)(f,{size:14}),n(`common:webPreview.openExternal`)]}),(0,G.jsx)(`p`,{className:`text-xs text-content-muted`,children:n(`common:webPreview.embedNotice`)})]})}export{ie as a,Z as c,ae as i,Y as l,ce as n,re as o,se as r,ne as s,fe as t};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/GitDiffViewer-CSl-SGa1.js","assets/rolldown-runtime-B0Z9INg1.js","assets/vendor-react-DwNgTV1j.js","assets/use-i18n-D2P6OO3w.js","assets/i18n-DPvJ0T4T.js","assets/vendor-router-CSN_DGvx.js","assets/index-C4CqzQNY.js","assets/index-DbL8igcD.css","assets/storage-BY6wEHPw.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-Bu_vuij9.js","assets/dist-Cfh4kzCK.js","assets/events-ulSEiNKt.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-D2P6OO3w.js";import{i as a}from"./runtime-capabilities-BhAMiYhG.js";import{t as o}from"./runtime-capabilities-store--7mKyYAM.js";import{a as s}from"./permission-rules-api-BQlSNrYK.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-Bq_U_5i9.js";import{t as b}from"./earth-Ddy13fHh.js";import{i as x,o as S}from"./GitDiffViewer-CSl-SGa1.js";import{S as C,U as w,V as T,b as E,x as D,z as O}from"./side-chat-context-BcCF9VZz.js";import{t as k}from"./link-2-mgasYn21.js";import{t as A}from"./message-square-SKjZyY3v.js";import{t as j}from"./plus-fQbSqB1n.js";import{t as M}from"./refresh-cw-TbWxTY4K.js";import{t as N}from"./square-terminal-BVG6cUT1.js";import{t as P}from"./x-07u4-129.js";import{n as F,t as I}from"./button-Bu_vuij9.js";import{s as L}from"./events-ulSEiNKt.js";import{a as ee,n as te,o as ne,t as re}from"./sheet-CASx5kBt.js";import{n as R,t as z}from"./PageState-aWHrkE1D.js";import{t as B}from"./input-DIwJDpj9.js";import{t as V}from"./web-preview-tGGVFpDI.js";import{n as ie}from"./terminal-context-aIsIJPn8.js";var H=e(n(),1),U=r(),W=(0,H.lazy)(()=>t(()=>import(`./GitDiffViewer-CSl-SGa1.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]))),G=100;function ae({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,H.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:T,pendingCount:E,reversibleCount:D,displayedError:k,notice:A,viewDiff:j,runAction:N,refresh:P}=g({sessionId:e,streaming:t,requestConfirm:n}),L=`max-[650px]:size-11 pointer-coarse:size-11`;return(0,U.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,"aria-label":o(`chat:focusSession.fileChanges`),"aria-busy":_||!!v,children:[(0,U.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,U.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,U.jsxs)(`span`,{className:`shrink-0 font-mono text-xs tabular-nums`,children:[(0,U.jsxs)(`span`,{className:`text-success`,children:[`+`,h.summary.added]}),` `,(0,U.jsxs)(`span`,{className:`text-danger`,children:[`−`,h.summary.removed]})]}),(0,U.jsx)(I,{type:`button`,variant:`ghost`,size:`icon`,className:L,"aria-label":o(`chat:focusSession.gitRefresh`),title:o(`chat:focusSession.gitRefresh`),disabled:_||!!v,onClick:P,children:(0,U.jsx)(M,{className:_?`animate-spin`:``,size:15})})]}),(0,U.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2 border-b border-stroke-soft px-3 py-2.5`,children:[h&&(0,U.jsxs)(`p`,{className:`text-xs text-content-secondary tabular-nums`,children:[o(`chat:focusSession.fileChangesCount`,{count:h.summary.files}),E>0&&` · ${o(`chat:focusSession.fileChangesPending`,{count:E})}`]}),(0,U.jsx)(`p`,{className:`text-xs leading-relaxed text-content-muted`,children:o(`chat:workbench.taskSnapshotScope`)}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-1`,children:[(0,U.jsxs)(`div`,{className:`flex gap-1`,children:[(0,U.jsxs)(I,{type:`button`,variant:`secondary`,size:`sm`,disabled:T||E===0,title:t?o(`chat:focusSession.gitWaitForRunToFinish`):void 0,onClick:()=>void N({kind:`approve`}),children:[v?.kind===`approve`&&!v.path?(0,U.jsx)(M,{className:`animate-spin`,size:14}):(0,U.jsx)(l,{size:14}),o(`chat:focusSession.fileChangesApproveAll`)]}),(0,U.jsxs)(I,{type:`button`,variant:`secondary`,size:`sm`,disabled:T||D===0,title:o(t?`chat:focusSession.gitWaitForRunToFinish`:`chat:focusSession.fileChangesRevertAllDescription`),onClick:()=>void N({kind:`revert`}),children:[v?.kind===`revert`&&!v.path?(0,U.jsx)(M,{className:`animate-spin`,size:14}):(0,U.jsx)(O,{size:14}),o(`chat:focusSession.fileChangesRevertAll`)]})]}),(0,U.jsxs)(`div`,{className:`flex gap-1`,children:[(0,U.jsx)(I,{variant:`ghost`,size:`sm`,disabled:_||!h?.files.length,onClick:()=>m(h?.files.slice(0,G).map(e=>e.path)||[]),children:o(`chat:workbench.expandAll`)}),(0,U.jsx)(I,{variant:`ghost`,size:`sm`,onClick:()=>m([]),children:o(`chat:workbench.collapseAll`)})]})]})]}),k&&(0,U.jsx)(`p`,{role:`alert`,className:`px-3 pt-2.5 text-xs text-danger`,children:k}),A&&!k&&(0,U.jsx)(`p`,{role:`status`,className:`px-3 pt-2.5 text-xs text-content-secondary`,children:A}),_&&!h?(0,U.jsx)(R,{kind:`loading`,title:o(`chat:focusSession.gitLoading`)}):h?.files.length?(0,U.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,G).map(t=>{let n=p.includes(t.path);return(0,U.jsxs)(`li`,{className:`min-w-0 border-b border-stroke-soft`,children:[(0,U.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,U.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,U.jsx)(u,{size:14,className:`shrink-0 text-content-muted transition-transform duration-(--d-fast) ${n?`rotate-90`:``}`}),C===t.path?(0,U.jsx)(F,{className:`size-3.5`}):(0,U.jsx)(S,{size:14,className:`flex-none text-content-muted`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono`,children:t.path}),(t.reverted||t.approved)&&(0,U.jsx)(`span`,{className:`shrink-0 text-content-muted`,children:t.reverted?o(`chat:focusSession.fileChangesReverted`):o(`chat:focusSession.fileChangesApproved`)}),(0,U.jsxs)(`span`,{className:`shrink-0 font-mono tabular-nums`,children:[(0,U.jsxs)(`span`,{className:`text-success`,children:[`+`,t.added]}),` `,(0,U.jsxs)(`span`,{className:`text-danger`,children:[`−`,t.removed]})]})]}),(0,U.jsx)(I,{type:`button`,variant:`ghost`,size:`icon`,className:L,title:o(`chat:focusSession.fileChangesApproveFile`),"aria-label":`${o(`chat:focusSession.fileChangesApproveFile`)} ${t.path}`,disabled:T||!t.pending||t.approved||t.reverted,onClick:()=>void N({kind:`approve`,path:t.path}),children:(0,U.jsx)(l,{size:14})}),(0,U.jsx)(I,{type:`button`,variant:`ghost`,size:`icon`,className:L,title:o(`chat:focusSession.fileChangesRevertFile`),"aria-label":`${o(`chat:focusSession.fileChangesRevertFile`)} ${t.path}`,disabled:T||t.reverted||!t.canRevert,onClick:()=>void N({kind:`revert`,path:t.path}),children:(0,U.jsx)(O,{size:14})})]}),n&&(0,U.jsxs)(U.Fragment,{children:[(0,U.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,U.jsx)(I,{variant:`ghost`,size:`sm`,className:`m-1.5`,onClick:()=>void j(t.path),children:o(`chat:workbench.fullDiff`)})]})]},t.path)}),h.files.length>G&&(0,U.jsx)(`li`,{className:`px-3 py-2 text-xs text-content-muted tabular-nums`,children:o(`chat:focusSession.gitMoreFiles`,{count:h.files.length-G})})]}):!k&&(0,U.jsx)(z,{compact:!0,title:o(`chat:focusSession.fileChangesEmpty`)}),y&&(0,U.jsx)(H.Suspense,{fallback:null,children:(0,U.jsx)(W,{diff:y.diff,truncated:y.truncated,onClose:()=>b(null)})})]})}function oe({tools:e,onSelect:t,onOpenUrl:n}){let{t:r}=i(),[a,o]=(0,H.useState)(``),[s,c]=(0,H.useState)(!1);return(0,U.jsxs)(`section`,{className:`@container/new-tab flex min-h-0 flex-1 flex-col overflow-y-auto bg-panel p-4`,children:[(0,U.jsx)(`h2`,{className:`mb-3 text-sm font-medium text-content`,children:r(`chat:workbench.newTab`)}),(0,U.jsxs)(`form`,{className:`mb-4 flex gap-2`,onSubmit:e=>{e.preventDefault();let t=V(a,window.location.href);c(!t),t&&n(t)},children:[(0,U.jsx)(B,{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,U.jsx)(I,{type:`submit`,variant:`secondary`,className:`h-8.5 pointer-coarse:h-11`,children:r(`chat:sessionContext.openUrl`)})]}),s&&(0,U.jsx)(`p`,{role:`alert`,className:`mb-3 text-xs text-danger`,children:r(`chat:sessionContext.invalidUrl`)}),(0,U.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,U.jsxs)(I,{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,U.jsx)(r,{className:`size-4 shrink-0`}),(0,U.jsx)(`span`,{className:`truncate`,children:n})]},e))})]})}function K({panelId:e,compact:t,embedded:n=!1,active:r=!0,sessionId:l,cwd:u=``,sources:f=[],tab:g,plan:x,streaming:O,plansAvailable:M,requestConfirm:F,onTabChange:R,onClose:B,onBack:V}){let{t:W}=i(),G=ie(),K=o(e=>e.capabilities),q=[{id:`terminal`,icon:N,label:W(`terminal:workspace.terminal`)},{id:`processes`,icon:s,label:W(`terminal:workspace.processes`)},{id:`changes`,icon:S,label:W(`chat:workbench.projectChanges`)},{id:`sources`,icon:k,label:W(`chat:workbench.sources`)},{id:`files`,icon:w,label:W(`chat:workbench.taskSnapshots`)},...M?[{id:`plan`,icon:T,label:W(`chat:sessionContext.plan`)}]:[],{id:`browser`,icon:b,label:W(`common:webPreview.title`)},{id:`side-chat`,icon:A,label:W(`chat:sideChat.title`)}],se=(0,H.useMemo)(()=>D(g),[g]),J=E(e=>Object.prototype.hasOwnProperty.call(e.sessions,l)?e.sessions[l]:void 0)??se,ce=(0,H.useRef)(null),Y=J.pages.find(e=>e.id===J.activeId)??J.pages[0],X=e=>e.kind===`new`?{id:`new`,icon:j,label:W(`chat:workbench.newTab`)}:q.find(t=>t.id===e.kind)??q[0],le=t=>requestAnimationFrame(()=>document.getElementById(`${e}-${t}-tab`)?.focus()),ue=(0,H.useEffectEvent)(()=>{r&&document.getElementById(`${e}-${J.activeId}-tab`)?.focus()});(0,H.useEffect)(()=>{let e=requestAnimationFrame(()=>ue());return()=>cancelAnimationFrame(e)},[e,J.activeId]);let Z=e=>{if(e.type===`view`&&!E.getState().sessions[l])return;[`add`,`open`,`select`,`close`,`kind`].includes(e.type)&&window.dispatchEvent(new Event(L));let t=C(J,e);E.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`)&&le(t.activeId),e.type===`close`&&J.pages.length===1&&B()},Q=W(`chat:sessionContext.addPage`),de=W(`chat:sessionContext.pageLimit`),fe=(0,U.jsx)(I,{variant:`ghost`,size:`icon`,className:`max-[650px]:size-11`,disabled:J.pages.length>=12,"aria-label":Q,title:J.pages.length>=12?de:Q,onClick:()=>Z({type:`add`,kind:`new`}),children:(0,U.jsx)(j,{size:16})}),$=(0,U.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,U.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:[V&&(0,U.jsx)(I,{variant:`ghost`,size:`icon`,className:`max-[650px]:size-11`,"aria-label":W(`chat:workbench.backToConversation`),title:W(`chat:workbench.backToConversation`),onClick:V,children:(0,U.jsx)(c,{size:16})}),(0,U.jsx)(`div`,{ref:ce,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":W(`chat:sessionContext.title`),onKeyDown:e=>{if(!(e.target instanceof HTMLElement)||e.target.getAttribute(`role`)!==`tab`)return;if(e.key===`Delete`){e.preventDefault(),Z({type:`close`,id:Y.id});return}if(![`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key))return;e.preventDefault();let t=J.pages.findIndex(e=>e.id===Y.id),n=e.key===`Home`?0:e.key===`End`?J.pages.length-1:(t+(e.key===`ArrowRight`?1:-1)+J.pages.length)%J.pages.length;Z({type:`select`,id:J.pages[n].id})},children:J.pages.map(t=>{let{icon:n,label:r}=X(t);return(0,U.jsxs)(`div`,{className:`relative flex max-w-40 min-w-20 shrink-0 items-center rounded-sm transition-colors duration-(--d-fast) ${t.id===Y.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,U.jsxs)(`button`,{id:`${e}-${t.id}-tab`,type:`button`,role:`tab`,"aria-selected":t.id===Y.id,"aria-controls":`${e}-${t.id}-content`,tabIndex:t.id===Y.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:()=>Z({type:`select`,id:t.id}),children:[(0,U.jsx)(n,{size:14,className:`shrink-0`}),(0,U.jsx)(`span`,{className:`truncate`,children:r})]}),(0,U.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":`${W(`chat:sessionContext.closePage`)} · ${r}`,onClick:()=>Z({type:`close`,id:t.id}),children:(0,U.jsx)(P,{size:12})})]},t.id)})}),fe]}),J.pages.map(t=>{let n=X(t),r=Y.id===t.id;return(0,U.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,U.jsx)(oe,{tools:q.map(e=>({...e,disabled:e.id===`terminal`||e.id===`processes`?!G||!a(K,`terminal`):e.id===`changes`&&!a(K,`vcs`)})),onOpenUrl:e=>{Z({type:`open`,kind:`browser`,replaceId:t.id}),E.getState().update(l,`browser`,{type:`browser`,id:t.id,url:e,draft:e})},onSelect:e=>Z({type:`open`,kind:e,replaceId:t.id})}):n.id===`changes`?r&&(0,U.jsx)(v,{sessionId:l,cwd:u,streaming:O,view:t.view,onViewChange:e=>Z({type:`view`,id:t.id,patch:e})}):n.id===`sources`?r&&(0,U.jsx)(_,{sources:f,view:t.view,onViewChange:e=>Z({type:`view`,id:t.id,patch:e})}):n.id===`terminal`?r&&(0,U.jsx)(d,{sessionId:l,cwd:u,terminalId:t.resourceId||void 0,onCreated:e=>E.getState().update(l,g,{type:`resource`,id:t.id,resourceId:e})}):n.id===`processes`?r&&(0,U.jsx)(p,{view:t.view,onViewChange:e=>Z({type:`view`,id:t.id,patch:e}),sessionId:l,onOpenTerminal:e=>Z({type:`open`,kind:`terminal`,resourceId:e})}):n.id===`side-chat`?(0,U.jsx)(h,{parentId:l,active:r}):n.id===`browser`?(0,U.jsx)(y,{page:t,onChange:e=>Z({type:`browser`,id:t.id,...e})}):r&&(n.id===`files`?(0,U.jsx)(ae,{view:t.view,onViewChange:e=>Z({type:`view`,id:t.id,patch:e}),sessionId:l,streaming:O,requestConfirm:F}):(0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-3`,children:x?.items?.length?(0,U.jsx)(m,{plan:x}):(0,U.jsx)(z,{compact:!0,title:W(`chat:sessionContext.planEmpty`)})}))},t.id)})]});return t?(0,U.jsx)(re,{open:!0,onOpenChange:e=>!e&&B(),children:(0,U.jsxs)(te,{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,U.jsx)(ee,{className:`sr-only`,children:(0,U.jsx)(ne,{children:W(`chat:sessionContext.title`)})}),$]})}):(0,U.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":W(`chat:sessionContext.title`),children:$})}export{K as SessionContextPanel};
@@ -1 +0,0 @@
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-D2P6OO3w.js";import{t as i}from"./useQuery-Bg3cTjsY.js";import{i as a}from"./runtime-capabilities-BhAMiYhG.js";import{t as o}from"./runtime-capabilities-store--7mKyYAM.js";import{t as s}from"./createLucideIcon-Cd-3GVxJ.js";import{i as c}from"./permission-rules-api-BQlSNrYK.js";import{t as l}from"./check-2vYc6QaP.js";import{a as u,c as d,i as f,l as p,n as m,o as h,r as g,t as _}from"./SessionBrowserPane-Bq_U_5i9.js";import{t as v}from"./earth-Ddy13fHh.js";import{t as y}from"./ellipsis-CfGKfbq6.js";import{o as b}from"./GitDiffViewer-CSl-SGa1.js";import{U as ee,V as x,b as S,c as C,s as te,v as w,z as T}from"./side-chat-context-BcCF9VZz.js";import{t as E}from"./git-branch-N7LGjtzt.js";import{t as ne}from"./message-square-SKjZyY3v.js";import{t as re}from"./plus-fQbSqB1n.js";import{t as D}from"./refresh-cw-TbWxTY4K.js";import{t as ie}from"./square-terminal-BVG6cUT1.js";import{t as ae}from"./x-07u4-129.js";import{c as oe,i as O,p as se,r as k,t as A}from"./dropdown-menu-gZkWDhaR.js";import{i as ce,n as le,t as ue}from"./popover-DT3PkPcL.js";import{t as de}from"./segmented-control-BOJt5SLj.js";import{t as j}from"./utils-C8uzG5AZ.js";import{t as M}from"./button-Bu_vuij9.js";import{t as fe}from"./chat-api-CQ9MShHZ.js";import{a as N,r as P}from"./format-DMJQzoZ7.js";import{n as pe,t as F}from"./PageState-aWHrkE1D.js";import{t as me}from"./session-change-summary-api-3216hpjE.js";import{i as I,n as L,r as R}from"./MarkdownMessage-BPZcFjyR.js";import{t as he}from"./route-context-DvWDul4T.js";import{t as ge}from"./StatusGlyph-1KgitlUg.js";import"./web-preview-tGGVFpDI.js";import{n as _e}from"./terminal-context-aIsIJPn8.js";var ve=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`}]]),ye=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`}]]),z=e(t(),1),B=n(),V={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 be(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 H(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 U({title:e,children:t}){return(0,B.jsxs)(`section`,{className:`grid min-w-0 gap-2`,"aria-label":e,children:[(0,B.jsx)(`h3`,{className:`text-xs font-semibold text-content-secondary`,children:e}),t]})}function W({status:e,name:t,detail:n,t:r}){let i=V[String(e)]??{kind:`queued`,color:`text-st-queue`};return(0,B.jsxs)(`li`,{className:`flex min-w-0 items-start gap-2 py-1.5 text-xs`,children:[(0,B.jsx)(ge,{status:i.kind,className:`mt-px size-3.5 ${i.color}`}),(0,B.jsxs)(`span`,{className:`grid min-w-0 flex-1 gap-0.5`,children:[(0,B.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,B.jsx)(`strong`,{className:`min-w-0 truncate font-medium text-content`,children:t}),(0,B.jsx)(`span`,{className:`flex-none text-content-muted`,children:be(e,r)})]}),n&&(0,B.jsx)(`span`,{className:`min-w-0 break-words text-content-muted`,children:n})]})]})}function G(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 xe({plan:e,goal:t,team:n,activity:i}){let{t:a}=r(),o=Array.isArray(n?.tasks)?n.tasks:[],s=G(i),c=!!(t?.id&&String(t.objective||``).trim()),l=!!e?.items?.length;if(!c&&!l&&!o.length&&!s.length)return(0,B.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-3`,children:(0,B.jsx)(F,{compact:!0,icon:x,title:a(`chat:sessionContext.planEmpty`)})});let u=Number(t?.mode===`team`?t?.teamTokenBudget:t?.tokenBudget)||0;return(0,B.jsxs)(`div`,{className:`grid min-h-0 flex-1 content-start gap-5 overflow-y-auto p-3`,"data-inspector-plan":!0,children:[c&&t&&(0,B.jsx)(U,{title:a(`board:inspector.goal`),children:(0,B.jsxs)(`div`,{className:`grid gap-1.5 rounded-md border border-stroke-soft bg-surface-subtle p-3 text-xs`,children:[(0,B.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-content`,children:String(t.objective)}),(0,B.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-2 text-content-muted tabular-nums`,children:[(0,B.jsx)(`span`,{children:H(t,a)}),(0,B.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,B.jsx)(`span`,{children:u>0?a(`chat:focusSession.usedBudgetTokensUsed`,{used:P(t.tokensUsed),budget:P(u)}):a(`chat:focusSession.usedUnlimitedGoalTokens`,{used:P(t.tokensUsed)})})]})]})}),l&&(0,B.jsx)(U,{title:a(`board:inspector.plan`),children:(0,B.jsx)(p,{plan:e})}),o.length>0&&(0,B.jsx)(U,{title:a(`board:inspector.team`),children:(0,B.jsx)(`ul`,{className:`divide-y divide-stroke-soft`,children:o.map((e,t)=>(0,B.jsx)(W,{status:e.status,name:e.taskName||a(`chat:agentRunActivity.subagent`),detail:e.error||e.output||``,t:a},e.id||`${e.taskName}-${t}`))})}),s.length>0&&(0,B.jsx)(U,{title:a(`board:inspector.subAgents`),children:(0,B.jsx)(`ul`,{className:`divide-y divide-stroke-soft`,children:s.map((e,t)=>(0,B.jsx)(W,{status:e.status,name:String(e.taskName||``).trim()||a(`chat:agentRunActivity.subagent`),detail:String(e.error||e.message||``).trim(),t:a},String(e.id||t)))})})]})}var K=100;function q(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 Se={modified:`M`,created:`A`,deleted:`D`,renamed:`R`,other:`·`},Ce={modified:`text-content-secondary`,created:`text-st-done`,deleted:`text-st-fail`,renamed:`text-content-secondary`,other:`text-content-muted`};function J(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 Y(e,t){return/^(?:[a-zA-Z]:[\\/]|\/|\\\\)/.test(t)?t:`${e.replace(/[\\/]+$/,``)}/${t}`}function we(e,t){window.dispatchEvent(new CustomEvent(he,{detail:{message:e,tone:t}}))}function X({added:e,removed:t}){return e===null||t===null?null:(0,B.jsxs)(`span`,{className:`flex-none font-mono text-xs tabular-nums`,children:[(0,B.jsxs)(`span`,{className:`text-success`,children:[`+`,e]}),` `,(0,B.jsxs)(`span`,{className:`text-danger`,children:[`−`,t]})]})}function Te({status:e,children:t}){let{t:n}=r();return(0,B.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,B.jsx)(`span`,{className:`flex min-w-0 flex-1 items-center gap-1.5 truncate`,children:e}),(0,B.jsxs)(A,{children:[(0,B.jsx)(se,{asChild:!0,children:(0,B.jsx)(M,{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,B.jsx)(y,{"aria-hidden":`true`})})}),(0,B.jsx)(k,{align:`end`,side:`top`,className:`min-w-48`,children:t})]})]})}function Ee({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,B.jsxs)(`span`,{className:j(`w-3.5 flex-none text-center font-mono text-xs font-semibold`,Ce[e]),title:n,children:[(0,B.jsx)(`span`,{"aria-hidden":`true`,children:Se[e]}),(0,B.jsx)(`span`,{className:`sr-only`,children:n})]})}function Z({files:e,selected:t,label:n,onSelect:r}){let i=(0,z.useRef)(null);return(0,B.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,K).map(e=>{let n=e.path===t,{directory:i,name:a}=J(e.path);return(0,B.jsx)(`li`,{className:`px-1`,children:(0,B.jsxs)(`button`,{type:`button`,title:e.path,"aria-label":[e.path,Se[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:j(`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,B.jsx)(Ee,{status:e.status}),(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-1 font-mono`,children:[(0,B.jsx)(`span`,{className:`min-w-0 truncate text-content-muted`,children:i}),(0,B.jsx)(`span`,{className:`flex-none text-content`,children:a})]}),e.note&&(0,B.jsx)(`span`,{className:`flex-none text-content-muted`,children:e.note}),(0,B.jsx)(X,{added:e.added,removed:e.removed})]})},e.path)}),e.length>K&&(0,B.jsx)(`li`,{className:`px-3 py-1.5 text-xs text-content-muted tabular-nums`,children:(0,B.jsx)(De,{count:e.length-K})})]})}function De({count:e}){let{t}=r();return(0,B.jsx)(B.Fragment,{children:t(`chat:focusSession.gitMoreFiles`,{count:e})})}var Oe=600;function ke({sessionId:e,file:t,scope:n,revision:i,view:a,onViewChange:o,footer:s}){let{t:l}=r(),u=c(e=>e.diffMode),f=c(e=>e.setDiffMode),p=(0,z.useRef)(null),[m,h]=(0,z.useState)(0);(0,z.useLayoutEffect)(()=>{let e=p.current;if(!e)return;let t=()=>h(e.clientWidth);t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);let g=m===0||m>=Oe,_=g?u:`unified`,v=g?void 0:l(`board:changes.splitTooNarrow`);return(0,B.jsxs)(`section`,{ref:p,className:`flex min-h-0 flex-1 flex-col`,"aria-label":t.path,"data-change-detail":t.path,children:[(0,B.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,B.jsx)(Ee,{status:t.status}),(0,B.jsx)(`strong`,{className:`min-w-0 flex-1 truncate font-mono text-xs font-semibold text-content`,title:t.path,children:t.path}),(0,B.jsx)(X,{added:t.added,removed:t.removed}),(0,B.jsx)(de,{size:`sm`,"aria-label":l(`board:changes.diffView`),title:v,"aria-description":v,value:_,onValueChange:f,options:[{value:`unified`,label:l(`board:changes.unified`)},{value:`split`,label:l(`board:changes.split`),disabled:!g}]})]}),(0,B.jsx)(d,{sessionId:e,path:t.path,scope:n,revision:i,mode:_,fill:!0,position:a?.reading?.[t.path],onReading:e=>o?.({reading:{...a?.reading,[t.path]:e}})},`${n}:${t.path}`),(0,B.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 Ae({cwd:e,path:t}){let{t:n}=r();if(!window.pisperDesktop||!e)return null;let i=Y(e,t);return(0,B.jsxs)(M,{type:`button`,variant:`ghost`,size:`sm`,className:`max-[650px]:h-11`,onClick:async()=>{try{await R(i,I),we(n(`common:markdownMessage.revealLocalPathOk`,{path:t}),`info`)}catch(e){we(e instanceof L&&e.reason===`unavailable`?n(`common:markdownMessage.revealLocalPathUnavailable`):e instanceof L&&e.reason===`timeout`?n(`common:markdownMessage.revealLocalPathTimeout`):n(`common:markdownMessage.revealLocalPathFailed`,{path:t}),`error`)}},children:[(0,B.jsx)(ve,{"aria-hidden":`true`}),n(`chat:chatMessage.fileActionReveal`)]})}function Q(e){return{path:e.path,status:e.status===`created`?`created`:e.status===`deleted`?`deleted`:`modified`,added:e.added,removed:e.removed}}function $(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 je({sessionId:e,cwd:t,streaming:n,view:i,onViewChange:a,requestConfirm:o}){let{t:s,language:c}=r(),{changes:u,loading:d,running:f,snapshotRevision:p,writesDisabled:m,pendingCount:g,reversibleCount:_,displayedError:v,notice:y,runAction:b,refresh:ee}=h({sessionId:e,streaming:n,requestConfirm:o}),x=u?.files??[],S=i?.expandedFiles?.[0],C=x.find(e=>e.path===S)??x[0],te=e=>a?.({expandedFiles:[e]}),w=(e,t)=>f?.kind===e&&f.path===t,E=n?s(`chat:focusSession.gitWaitForRunToFinish`):void 0;return(0,B.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,B.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,B.jsxs)(`p`,{className:`flex min-w-0 flex-1 items-center gap-2 text-xs text-content-secondary`,children:[(0,B.jsx)(`span`,{className:`min-w-0 truncate`,children:s(`board:changes.sessionSummary`,{count:u?.summary.files??0})}),u&&u.summary.files>0&&(0,B.jsx)(X,{added:u.summary.added,removed:u.summary.removed})]})}),v&&(0,B.jsx)(`p`,{role:`alert`,className:`shrink-0 px-3 pt-2 text-xs text-st-fail`,children:v}),y&&!v&&(0,B.jsx)(`p`,{role:`status`,className:`shrink-0 px-3 pt-2 text-xs text-content-secondary`,children:y}),d&&!u?(0,B.jsx)(pe,{kind:`loading`,title:s(`chat:focusSession.gitLoading`)}):x.length?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Z,{files:x.map(e=>({...Q(e),note:e.reverted?s(`chat:focusSession.fileChangesReverted`):e.approved?s(`chat:focusSession.fileChangesApproved`):$(e.formatChange,s)})),selected:C?.path??``,label:s(`board:changes.files`),onSelect:te}),C&&(0,B.jsx)(ke,{sessionId:e,file:Q(C),scope:`task`,revision:p,view:i,onViewChange:a,footer:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`span`,{className:j(`mr-auto flex min-w-0 items-center gap-1.5 truncate`,C.approved?`text-st-done`:`text-content-muted`),"data-change-state":C.reverted?`reverted`:C.approved?`approved`:`pending`,children:[C.approved&&!C.reverted&&(0,B.jsx)(l,{className:`size-3.5 flex-none`,"aria-hidden":`true`}),C.reverted?s(`board:changes.revertedAt`,{time:N(C.changedAt,c)}):C.approved?s(`board:changes.approvedAt`,{time:N(C.changedAt,c)}):s(`board:changes.pendingAt`,{time:N(C.changedAt,c)})]}),C.pending&&!C.approved&&!C.reverted&&(0,B.jsxs)(M,{type:`button`,variant:`ghost`,size:`sm`,disabled:m,title:E,onClick:()=>void b({kind:`approve`,path:C.path}),children:[w(`approve`,C.path)?(0,B.jsx)(D,{className:`animate-spin`}):(0,B.jsx)(l,{}),s(`chat:focusSession.fileChangesApproveFile`)]}),(0,B.jsxs)(M,{type:`button`,variant:`ghost`,size:`sm`,disabled:m||C.reverted||!C.canRevert,title:E,onClick:()=>void b({kind:`revert`,path:C.path}),children:[w(`revert`,C.path)?(0,B.jsx)(D,{className:`animate-spin`}):(0,B.jsx)(T,{}),s(`board:changes.revertFile`)]}),(0,B.jsx)(Ae,{cwd:t,path:C.path})]})})]}):!v&&(0,B.jsx)(F,{compact:!0,title:s(`chat:focusSession.fileChangesEmpty`)}),(0,B.jsxs)(Te,{status:f?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(D,{className:`size-3.5 flex-none animate-spin`,"aria-hidden":`true`}),f.kind===`approve`?s(`chat:focusSession.fileChangesApproveAll`):s(`board:changes.revertAll`)]}):g>0?s(`board:changes.pending`,{count:g}):null,children:[g>0&&(0,B.jsxs)(O,{disabled:m,title:E,onSelect:()=>void b({kind:`approve`}),children:[(0,B.jsx)(l,{}),s(`chat:focusSession.fileChangesApproveAll`)]}),(u?.summary.files??0)>0&&(0,B.jsxs)(O,{disabled:m||_===0,title:E??s(`chat:focusSession.fileChangesRevertAllDescription`),onSelect:()=>void b({kind:`revert`}),children:[(0,B.jsx)(T,{}),s(`board:changes.revertAll`)]}),(g>0||(u?.summary.files??0)>0)&&(0,B.jsx)(oe,{}),(0,B.jsxs)(O,{disabled:d||!!f,onSelect:ee,children:[(0,B.jsx)(D,{}),s(`chat:focusSession.gitRefresh`)]})]})]})}function Me({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})=>fe.getVcsChanges(e,{signal:t})}),l=(0,z.useMemo)(()=>w(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:q(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,B.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,B.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,B.jsxs)(`p`,{className:`flex min-w-0 flex-1 items-center gap-2 text-xs text-content-secondary`,children:[(0,B.jsx)(`span`,{className:`min-w-0 truncate`,children:s(`board:changes.workspaceSummary`,{count:d.length})}),c.data?.isRepo&&!u&&d.length>0&&(0,B.jsx)(X,{added:l.added,removed:l.removed})]}),c.data?.branch&&(0,B.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,B.jsx)(E,{size:12,className:`flex-none`,"aria-hidden":`true`}),(0,B.jsx)(`span`,{className:`truncate`,children:c.data.branch})]})]}),c.isPending?(0,B.jsx)(pe,{kind:`loading`,title:s(`chat:focusSession.gitLoading`)}):u?(0,B.jsx)(`p`,{role:`alert`,className:`p-3 text-xs text-st-fail`,children:u}):c.data?.isRepo?d.length?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Z,{files:d,selected:p?.path??``,label:s(`board:changes.files`),onSelect:e=>o?.({expandedFiles:[e]})}),p&&(0,B.jsx)(ke,{sessionId:e,file:p,scope:`project`,revision:c.dataUpdatedAt,view:a,onViewChange:o,footer:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`mr-auto min-w-0 truncate font-mono text-content-muted`,title:t,children:t}),(0,B.jsx)(Ae,{cwd:t,path:p.path})]})})]}):(0,B.jsx)(F,{compact:!0,title:s(`chat:focusSession.fileChangesEmpty`)}):(0,B.jsx)(F,{compact:!0,title:s(`chat:workbench.notRepository`)}),(0,B.jsx)(Te,{status:c.isFetching?(0,B.jsx)(D,{className:`size-3.5 flex-none animate-spin`,"aria-hidden":`true`}):null,children:(0,B.jsxs)(O,{disabled:c.isFetching,onSelect:()=>void c.refetch(),children:[(0,B.jsx)(D,{}),s(`chat:focusSession.gitRefresh`)]})})]})}function Ne({sessionId:e,cwd:t,streaming:n,scope:i,onScopeChange:a,vcsAvailable:o,view:s,onViewChange:c,requestConfirm:l}){let{t:u}=r();return(0,B.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,"data-inspector-changes":i,children:[(0,B.jsx)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-stroke-soft px-3 py-2`,children:(0,B.jsx)(de,{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,B.jsx)(Me,{sessionId:e,cwd:t,streaming:n,view:s,onViewChange:c}):(0,B.jsx)(je,{sessionId:e,cwd:t,streaming:n,view:s,onViewChange:c,requestConfirm:l}):(0,B.jsx)(`p`,{role:`status`,className:`p-4 text-sm text-content-muted`,children:u(`chat:focusSession.gitLoading`)})]})}var Pe=[];function Fe(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 Ie({panelId:e,sessionId:t,cwd:n,streaming:s,plan:l,goal:d,team:p,activity:h,planTab:y,sources:w,mode:T,requestConfirm:E,onClose:D,onOpenComponents:oe,componentTabs:O,autoFocus:se=!1}){let{t:k}=r(),A=T===`sheet`,fe=_e(),N=o(e=>e.capabilities),P=!!fe&&a(N,`terminal`),pe=a(N,`vcs`),I=c(e=>e.tab),L=c(e=>e.setTab),R=c(e=>e.terminalView),he=c(e=>e.setTerminalView),ge=c(e=>e.changesView),ve=c(e=>e.setChangesView),V=S(e=>e.sessions[t]?.pages)??Pe,be=V.some(e=>e.kind===`side-chat`),H=I===`side-chat`&&!be||I===`plan`&&!y?`changes`:I,U=Fe(H,R,ge),W=U?V.find(e=>e.kind===U):void 0,G=!A&&O?O.tabs(n):[],[K,q]=(0,z.useState)(null),[Se,Ce]=(0,z.useState)(!1),J=G.some(e=>e.id===K)?K:null;(0,z.useEffect)(()=>q(null),[I]);let Y=(0,z.useRef)(null);(0,z.useEffect)(()=>{Y.current?.querySelector(`[role="tab"][aria-selected="true"]`)?.scrollIntoView?.({block:`nearest`,inline:`nearest`})},[H,J]);let we=(0,z.useRef)(se);(0,z.useEffect)(()=>{if(!we.current)return;let e=requestAnimationFrame(()=>Y.current?.querySelector(`[role="tab"][aria-selected="true"]`)?.focus({preventScroll:!0}));return()=>cancelAnimationFrame(e)},[]),(0,z.useEffect)(()=>{if(!U||W||(U===`terminal`||U===`processes`)&&!P)return;let e=S.getState(),n=e.sessions[t]?.contentOpen??!1;e.update(t,U,{type:`add`,kind:U}),n||e.update(t,U,{type:`workspace`,contentOpen:!1})},[U,W,t,P]);let X=i({queryKey:[`session-change-summary`,t,s],queryFn:()=>me(t),staleTime:1e4}),Te=X.data?.status===`known`?X.data.changedFiles??0:0,Ee=[{id:`changes`,icon:b,label:Te>0?k(`board:inspector.changesCount`,{count:Te}):k(`board:inspector.changes`)},{id:`terminal`,icon:ie,label:k(`board:inspector.terminal`)},{id:`files`,icon:ee,label:k(`board:inspector.files`)},{id:`preview`,icon:v,label:k(`board:inspector.preview`)},...y?[{id:`plan`,icon:x,label:k(`board:inspector.plan`)}]:[],...be?[{id:`side-chat`,icon:ne,label:k(`board:inspector.sideChat`)}]:[]],Z=e=>{W&&S.getState().update(t,W.kind,{type:`view`,id:W.id,patch:e})},De=()=>{let n=V.find(e=>e.kind===`side-chat`);if(n&&S.getState().update(t,`side-chat`,{type:`close`,id:n.id}),L(`changes`),A){D();return}requestAnimationFrame(()=>document.getElementById(`${e}-changes-tab`)?.focus())},Oe=t=>`${e}-component-${t}-tab`,ke=e=>{q(null),L(e)},Ae=t=>{if(![`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(t.key))return;t.preventDefault();let n=[...Ee.map(t=>({fixed:t.id,id:`${e}-${t.id}-tab`})),...G.map(e=>({component:e.id,id:Oe(e.id)}))],r=n.findIndex(e=>J?e.component===J:e.fixed===H),i=n[t.key===`Home`?0:t.key===`End`?n.length-1:(r+(t.key===`ArrowRight`?1:-1)+n.length)%n.length];i.component?q(i.component):i.fixed&&ke(i.fixed),requestAnimationFrame(()=>document.getElementById(i.id)?.focus())},Q=(0,B.jsx)(`p`,{role:`status`,className:`p-4 text-sm text-content-muted`,children:k(`chat:focusSession.gitLoading`)}),$;if(J&&O)$=O.render(J,{sessionId:t,cwd:n});else if(H===`changes`)$=(0,B.jsx)(Ne,{sessionId:t,cwd:n,streaming:s,scope:ge,onScopeChange:ve,vcsAvailable:pe,view:W?.view,onViewChange:W?Z:void 0,requestConfirm:E});else if(H===`terminal`)$=P?(0,B.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,B.jsx)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-stroke-soft px-3 py-2`,children:(0,B.jsx)(de,{size:`sm`,"aria-label":k(`board:inspector.terminalScope`),value:R,onValueChange:he,options:[{value:`terminal`,label:k(`board:inspector.terminal`)},{value:`processes`,label:k(`board:inspector.processes`)}]})}),(0,B.jsx)(z.Suspense,{fallback:Q,children:W?R===`processes`?(0,B.jsx)(f,{sessionId:t,view:W.view,onViewChange:Z,onOpenTerminal:e=>{let n=S.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,B.jsx)(u,{sessionId:t,cwd:n,terminalId:W.resourceId||void 0,onCreated:e=>S.getState().update(t,`terminal`,{type:`resource`,id:W.id,resourceId:e})},W.id):Q})]}):(0,B.jsx)(F,{icon:ie,className:`m-4`,title:k(`board:inspector.terminalUnavailable`)});else if(H===`files`)$=W?(0,B.jsx)(g,{sources:w,view:W.view,onViewChange:Z}):Q;else if(H===`preview`){let e=s?te([...h]):null;$=W?(0,B.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,"data-inspector-preview":!0,children:[e&&(0,B.jsx)(`div`,{className:`max-h-[50%] shrink-0 overflow-y-auto border-b border-stroke-soft p-2`,children:(0,B.jsx)(C,{target:e,fallbackImage:e.previewImage,streaming:s})}),(0,B.jsx)(_,{page:W,onChange:e=>S.getState().update(t,`browser`,{type:`browser`,id:W.id,...e})})]}):Q}else $=H===`plan`?(0,B.jsx)(xe,{plan:l,goal:d,team:p,activity:h}):(0,B.jsx)(m,{parentId:t,active:!0});return(0,B.jsxs)(`section`,{id:e,"aria-label":k(`board:inspector.label`),"data-session-inspector":T,"data-inspector-tab":H,"data-inspector-component":J??void 0,className:`flex h-full min-h-0 w-full min-w-0 flex-col bg-panel text-content`,children:[(0,B.jsxs)(`header`,{className:j(`flex shrink-0 items-center gap-1 border-b border-stroke-soft pr-1.5 pl-2`,A?`h-[52px]`:T===`aside`?`h-[52px] [[data-custom-titlebar]_&]:h-11 [[data-custom-titlebar]_&]:pointer-coarse:h-[52px]`:`h-11 pointer-coarse:h-[52px]`),children:[(0,B.jsxs)(`div`,{ref:Y,role:`tablist`,"aria-label":k(`board:inspector.tabs`),className:`flex min-w-0 flex-1 items-center gap-0.5 overflow-x-auto [scrollbar-width:none]`,onKeyDown:Ae,children:[Ee.map(({id:t,icon:n,label:r})=>{let i=!J&&t===H;return(0,B.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:j(`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`,A?`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:()=>ke(t),children:[!A&&(0,B.jsx)(n,{className:`size-3.5`,"aria-hidden":`true`}),r]},t)}),!J&&H===`side-chat`&&(0,B.jsx)(M,{type:`button`,variant:`ghost`,size:`icon-sm`,className:j(A&&`size-11`),"aria-label":k(`board:inspector.closeTab`,{tab:k(`board:inspector.sideChat`)}),onClick:De,children:(0,B.jsx)(ae,{"aria-hidden":`true`})}),!A&&(0,B.jsx)(`span`,{"aria-hidden":`true`,className:`mx-1 h-4 w-px flex-none bg-stroke`}),G.map(({id:t,label:n})=>{let r=t===J;return(0,B.jsx)(`button`,{id:Oe(t),type:`button`,role:`tab`,"aria-selected":r,"aria-controls":`${e}-body`,tabIndex:r?0:-1,"data-inspector-component-tab":t,className:j(`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:()=>q(t),children:(0,B.jsx)(`span`,{className:`truncate`,children:n})},t)})]}),!A&&(0,B.jsxs)(ue,{open:Se,onOpenChange:Ce,children:[(0,B.jsx)(ce,{asChild:!0,children:(0,B.jsx)(M,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`flex-none`,"aria-label":k(`board:inspector.add`),title:k(`board:inspector.add`),"data-inspector-component-add":!0,children:(0,B.jsx)(re,{"aria-hidden":`true`})})}),(0,B.jsxs)(le,{align:`end`,className:`w-64 text-xs`,children:[O?.addMenu?O.addMenu({cwd:n,onAdded:e=>{q(e),Ce(!1)}}):(0,B.jsx)(`p`,{className:`text-content-secondary`,children:k(`board:inspector.addHint`)}),oe&&(0,B.jsx)(M,{type:`button`,variant:`secondary`,size:`sm`,className:`self-start`,onClick:oe,children:k(`board:inspector.openComponents`)})]})]}),(0,B.jsx)(M,{type:`button`,variant:`ghost`,size:`icon-sm`,className:j(`flex-none`,A&&`size-11`),"aria-label":k(`board:inspector.close`),title:k(`board:inspector.close`),"aria-controls":e,onClick:D,children:T===`aside`?(0,B.jsx)(ye,{"aria-hidden":`true`}):(0,B.jsx)(ae,{"aria-hidden":`true`})})]}),(0,B.jsx)(`div`,{id:`${e}-body`,role:`tabpanel`,"aria-labelledby":J?Oe(J):`${e}-${H}-tab`,className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:$})]})}export{Ie as SessionInspector};
@@ -1 +0,0 @@
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-D2P6OO3w.js";import{t as i}from"./chevron-right-C3t2Rckj.js";import{t as a}from"./square-terminal-BVG6cUT1.js";import{t as o}from"./square-bHHVTT3G.js";import{n as s,t as c}from"./button-Bu_vuij9.js";import{n as l}from"./PageState-aWHrkE1D.js";import{n as u,r as d}from"./terminal-context-aIsIJPn8.js";var f=e(t(),1),p=n();function m({record:e,follow:t,initialTop:n,onFollow:i,onScroll:a}){let{t:o}=r(),s=(0,f.useRef)(null),c=(0,f.useRef)(n);return(0,f.useLayoutEffect)(()=>{s.current&&(s.current.scrollTop=c.current)},[]),(0,f.useLayoutEffect)(()=>{t&&s.current&&(s.current.scrollTop=s.current.scrollHeight)},[e.output,t]),(0,p.jsxs)(`div`,{className:`border-t border-stroke-soft bg-code px-3 py-2.5`,children:[(0,p.jsxs)(`label`,{className:`mb-2 flex min-h-6 items-center gap-2 text-xs text-content-muted pointer-coarse:min-h-11`,children:[(0,p.jsx)(`input`,{type:`checkbox`,className:`size-3.5 accent-star`,checked:t,onChange:e=>i(e.target.checked)}),o(`terminal:workspace.follow`)]}),e.truncated&&(0,p.jsx)(`p`,{className:`mb-2 text-xs text-content-muted`,children:o(`terminal:workspace.truncated`)}),(0,p.jsx)(`pre`,{ref:s,tabIndex:0,onWheel:e=>{e.deltaY<0&&i(!1)},onScroll:e=>{let t=e.currentTarget;t.scrollTop+t.clientHeight<t.scrollHeight-4&&i(!1),a(t.scrollTop)},className:`max-h-80 overflow-auto whitespace-pre-wrap break-all font-mono text-xs leading-relaxed text-content-soft focus-visible:-outline-offset-2`,children:e.output||o(`terminal:workspace.noOutput`)})]})}function h({sessionId:e,onOpenTerminal:t,view:n,onViewChange:h}){let{t:g}=r(),_=u(),v=d(e),y=n.filter||`all`,b=new Set(n.expandedProcesses),[x,S]=(0,f.useState)(``);if(!_)return(0,p.jsx)(l,{kind:`empty`,title:g(`terminal:workspace.unavailable`),description:g(`terminal:workspace.nativeOnly`)});let C={starting:g(`terminal:workspace.starting`),running:g(`terminal:workspace.running`),stopping:g(`terminal:workspace.stopping`),exited:g(`terminal:workspace.exited`),error:g(`terminal:workspace.error`)},w=v.filter(e=>y===`all`||e.status===y),T=`max-[650px]:size-11`;return(0,p.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col`,children:[(0,p.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-b border-stroke-soft px-3 py-2`,children:[(0,p.jsx)(`span`,{className:`min-w-0 flex-1 text-xs text-content-muted`,children:g(`terminal:workspace.ownedProcesses`)}),(0,p.jsxs)(`select`,{"aria-label":g(`terminal:workspace.filter`),value:y,onChange:e=>h({filter:e.target.value}),className:`h-8 rounded-sm border border-control bg-panel px-2 text-sm text-content outline-none focus-visible:border-focus focus-visible:ring-3 focus-visible:ring-focus-ring pointer-coarse:h-11`,children:[(0,p.jsx)(`option`,{value:`all`,children:g(`terminal:workspace.all`)}),Object.entries(C).map(([e,t])=>(0,p.jsx)(`option`,{value:e,children:t},e))]})]}),x&&(0,p.jsx)(`p`,{role:`alert`,className:`p-3 text-sm text-danger`,children:x}),(0,p.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:w.length?w.map(e=>(0,p.jsxs)(`article`,{className:`border-b border-stroke-soft`,children:[(0,p.jsxs)(`div`,{className:`flex min-h-11 min-w-0 items-center gap-2 py-1 pr-1.5 pl-1.5 ${b.has(e.id)?`bg-surface-subtle`:``}`,children:[(0,p.jsx)(c,{variant:`ghost`,size:`icon`,className:T,"aria-expanded":b.has(e.id),"aria-label":g(`terminal:workspace.logs`),onClick:()=>h({expandedProcesses:b.has(e.id)?n.expandedProcesses.filter(t=>t!==e.id):[...n.expandedProcesses,e.id]}),children:(0,p.jsx)(i,{className:`text-content-muted transition-transform duration-(--d-fast) ${b.has(e.id)?`rotate-90`:``}`})}),e.status===`running`||e.status===`starting`?(0,p.jsx)(s,{className:`size-3.5`}):(0,p.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 shrink-0 rounded-[2px] ${e.status===`error`?`bg-danger`:`bg-content-faint`}`}),(0,p.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,p.jsx)(`strong`,{className:`block truncate font-mono text-sm font-medium`,children:e.profileId}),(0,p.jsx)(`span`,{className:`block truncate font-mono text-xs text-content-muted`,title:e.cwd,children:e.cwd})]}),(0,p.jsx)(`span`,{className:`shrink-0 text-xs ${e.status===`error`?`text-danger`:`text-content-muted`}`,children:C[e.status]||g(`terminal:workspace.unknown`)}),(0,p.jsx)(c,{variant:`ghost`,size:`icon`,className:T,"aria-label":g(`terminal:workspace.open`),onClick:()=>t(e.id),children:(0,p.jsx)(a,{})}),e.status!==`exited`&&(0,p.jsx)(c,{variant:`ghost`,size:`icon`,className:`${T} hover:text-danger`,disabled:e.status===`stopping`,"aria-label":g(`terminal:workspace.stop`),onClick:()=>{S(``),_.registry.stop(e.id).catch(e=>S(String(e)))},children:(0,p.jsx)(o,{className:`size-3.5`})})]}),e.error&&(0,p.jsx)(`p`,{className:`px-3 pb-2 text-xs text-danger`,children:e.error}),b.has(e.id)&&(0,p.jsx)(m,{record:e,follow:n.processFollow[e.id]!==!1,initialTop:n.processScroll[e.id]||0,onFollow:t=>h({processFollow:{...n.processFollow,[e.id]:t}}),onScroll:t=>h({processScroll:{...n.processScroll,[e.id]:t}})})]},e.id)):(0,p.jsx)(l,{kind:`empty`,title:v.length?g(`terminal:workspace.noMatch`):g(`terminal:workspace.noProcesses`)})})]})}export{h as TaskProcessesPane};