pisper 0.6.3 → 0.6.4

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 (146) hide show
  1. package/README.en.md +0 -6
  2. package/README.md +0 -6
  3. package/bin/pisper.mjs +7 -15
  4. package/lib/install.mjs +9 -49
  5. package/lib/npm-platform.mjs +0 -12
  6. package/package.json +8 -9
  7. package/web/.vite/manifest.json +713 -737
  8. package/web/assets/AppDialog-BOGrPFbo.js +1 -0
  9. package/web/assets/{AppOverlays-CR5iJcP5.js → AppOverlays-D1vfPPIC.js} +1 -1
  10. package/web/assets/AppSelect-BCexz4Ty.js +1 -0
  11. package/web/assets/{AppShortcuts-BachmLQ3.js → AppShortcuts-Dd4gu7qz.js} +1 -1
  12. package/web/assets/{AssetsPage-BltehMID.js → AssetsPage-BPhPo5eU.js} +1 -1
  13. package/web/assets/ChannelsPage-Cu4v-GU2.js +1 -0
  14. package/web/assets/ChatAppearancePage-BLRQ7aH6.js +2 -0
  15. package/web/assets/ChatHistoryPage-BYqJFbY5.js +1 -0
  16. package/web/assets/ChatPage-tqAIj2Go.js +554 -0
  17. package/web/assets/ConfigPage-Z-BQwP2X.js +1 -0
  18. package/web/assets/{DecisionsPage-DOhLbIaD.js → DecisionsPage-Db6MIGD2.js} +1 -1
  19. package/web/assets/{DesktopWindowControls-KmgemDO8.js → DesktopWindowControls-CBYGv94u.js} +1 -1
  20. package/web/assets/{FloatingWidgets-Bs7ec6lW.js → FloatingWidgets-dzsQIxAO.js} +1 -1
  21. package/web/assets/{GitDiffViewer-xm2LnN9r.js → GitDiffViewer-m5aLB7Li.js} +1 -1
  22. package/web/assets/MarkdownMessage-CA9ODRKk.js +2 -0
  23. package/web/assets/McpPage-rerFxjYZ.js +1 -0
  24. package/web/assets/MemoryPage-cukfU824.js +1 -0
  25. package/web/assets/MobileContextScreen-W8V4H3Xv.js +2 -0
  26. package/web/assets/MobileNavigation-CEVgs1Ke.js +1 -0
  27. package/web/assets/MobileShellContext-D8qX-BlM.js +1 -0
  28. package/web/assets/{PageHeader-C_bfu8Ir.js → PageHeader-DIs9bESb.js} +1 -1
  29. package/web/assets/{PluginsPage-BPx5ERHL.js → PluginsPage-09Um3mY4.js} +1 -1
  30. package/web/assets/QueryClientProvider-CHJtxoX1.js +1 -0
  31. package/web/assets/{QuickPromptIdeas-Bs-udcSZ.js → QuickPromptIdeas-DGIL0nN7.js} +1 -1
  32. package/web/assets/SchedulesPage-C75QUeB5.js +1 -0
  33. package/web/assets/SessionContextPanel-oaKXyi7k.js +1 -0
  34. package/web/assets/{SessionFilesPane-BIRQ_hHi.js → SessionFilesPane-DPijesqH.js} +2 -2
  35. package/web/assets/{SidebarMoreTools-BDqt5VTG.js → SidebarMoreTools-D1nDS3i0.js} +1 -1
  36. package/web/assets/SidebarRecentSessions-a7z2ZvDv.js +2 -0
  37. package/web/assets/{SidebarSettingsButton-B4_vEBS5.js → SidebarSettingsButton-CRdV0Vft.js} +1 -1
  38. package/web/assets/{SidebarUpdateStatus-DD8f4Fxv.js → SidebarUpdateStatus-DgNJBwgT.js} +1 -1
  39. package/web/assets/SkillsPage-DLirgTyX.js +1 -0
  40. package/web/assets/TerminalPanel-CJPy4Qhs.js +18 -0
  41. package/web/assets/{ThemeToggleButton-CXXbLtcY.js → ThemeToggleButton-C5QA5Kf2.js} +1 -1
  42. package/web/assets/{WebDesktopPet-DWFspeZE.js → WebDesktopPet-DgyHLE9y.js} +1 -1
  43. package/web/assets/{WorkbenchSidebarToggle-AgjfcT29.js → WorkbenchSidebarToggle-CcO1Al5A.js} +1 -1
  44. package/web/assets/WorkflowsPage-DrKHzJvb.js +1 -0
  45. package/web/assets/WorkspacePicker-B3liZkwe.js +1 -0
  46. package/web/assets/{api-Dzobr-o_.js → api-YI8_cHpR.js} +1 -1
  47. package/web/assets/{app-primitives-BBXY6U2S.js → app-primitives-SxfoFmHc.js} +1 -1
  48. package/web/assets/app-update-Bg6w1SOW.js +32 -0
  49. package/web/assets/arrow-up-DST6-qVQ.js +1 -0
  50. package/web/assets/catalog-BPCnu3F8.js +1 -0
  51. package/web/assets/channels-messages-DgWnmzUo.js +1 -0
  52. package/web/assets/chat-api-CqF-FICX.js +1 -0
  53. package/web/assets/{client-store-DPMvgPNS.js → client-store-BP_3-plw.js} +1 -1
  54. package/web/assets/{component-api-Nwo2yGZI.js → component-api-CN9Tcn5p.js} +1 -1
  55. package/web/assets/config-search-DOIJENN1.js +1 -0
  56. package/web/assets/dist-B7rNRXig.js +1 -0
  57. package/web/assets/dist-C3P9WH0T.js +1 -0
  58. package/web/assets/dist-CXiO_DNx.js +1 -0
  59. package/web/assets/dist-D8Wfxh48.js +1 -0
  60. package/web/assets/{dropdown-menu-DmL4pJTo.js → dropdown-menu-pKRdLJUe.js} +1 -1
  61. package/web/assets/{events-Bwv6HmwM.js → events-KqdUtjsm.js} +1 -1
  62. package/web/assets/{floating-widgets-store-DIy4GSy4.js → floating-widgets-store-Pjm1AdvO.js} +2 -2
  63. package/web/assets/folder-DPM8D8cf.js +1 -0
  64. package/web/assets/house-BNrzTkx9.js +1 -0
  65. package/web/assets/{http-DphgzWtw.js → http-Be2GB6DH.js} +1 -1
  66. package/web/assets/i18n-8nTnthu6.js +1 -0
  67. package/web/assets/{index-iBrSU61i.js → index-AF29hfx9.js} +2 -2
  68. package/web/assets/index-BAmsg90v.css +2 -0
  69. package/web/assets/monitor-ORxecA9m.js +1 -0
  70. package/web/assets/mount-app-WW5hteuX.js +9 -0
  71. package/web/assets/panels-top-left-BlZftvhg.js +1 -0
  72. package/web/assets/pick-system-directory-BnIFt85A.js +1 -0
  73. package/web/assets/{popover-BBuzaBfd.js → popover-CQqAaq-c.js} +1 -1
  74. package/web/assets/public-c36e4881.js +1 -0
  75. package/web/assets/public-components-C4ndcOCF.js +1 -0
  76. package/web/assets/{runtime-capabilities-store-DaWPY5y-.js → runtime-capabilities-store-CiL3ZPEo.js} +1 -1
  77. package/web/assets/scale-D0LcHVmf.js +1 -0
  78. package/web/assets/{session-change-summary-api-DFgTzTci.js → session-change-summary-api--7cl4LDn.js} +1 -1
  79. package/web/assets/session-context-store-DJnHgWwb.js +1 -0
  80. package/web/assets/session-list-DkNhT87s.js +1 -0
  81. package/web/assets/settings-navigation-CI7Yt4Or.js +1 -0
  82. package/web/assets/{shortcuts-BO-h6OmP.js → shortcuts-C_Cph88H.js} +1 -1
  83. package/web/assets/side-chat-context-Dn8w9ut8.js +3 -0
  84. package/web/assets/{sidebar-CfWEKOIK.js → sidebar-C3YJQV72.js} +1 -1
  85. package/web/assets/{speech-session-DKjw0mV_.js → speech-session-CoUr4n9Q.js} +1 -1
  86. package/web/assets/{startup-queries-CAQZvUIR.js → startup-queries-ByepQfGF.js} +1 -1
  87. package/web/assets/tabs-B60r4YwO.js +1 -0
  88. package/web/assets/{ui-store-2wpnH8Kf.js → ui-store-BGs-dEVz.js} +1 -1
  89. package/web/assets/{use-i18n-BSZKFkMb.js → use-i18n-a84Zp9dV.js} +1 -1
  90. package/web/assets/{useCustomUiComponents-BH86kuaq.js → useCustomUiComponents-BaQ_fwbr.js} +1 -1
  91. package/web/assets/useQuery-D3P5wO_Z.js +1 -0
  92. package/web/assets/web-preview-B7L-G6kp.js +1 -0
  93. package/web/assets/web-preview-events-C4AW4-It.js +1 -0
  94. package/web/index.html +2 -2
  95. package/web/assets/AppSelect-D149YYg1.js +0 -1
  96. package/web/assets/ChannelsPage-Tuw_qicj.js +0 -1
  97. package/web/assets/ChatAppearancePage-DME3PgDr.js +0 -2
  98. package/web/assets/ChatDockView-DoGtrBpY.js +0 -2
  99. package/web/assets/ChatHistoryPage-DTXS6i3n.js +0 -1
  100. package/web/assets/ChatPage-ibc_7olm.js +0 -4
  101. package/web/assets/ConfigPage-CI6one5Y.js +0 -1
  102. package/web/assets/MarkdownMessage-H1336cMr.js +0 -2
  103. package/web/assets/McpPage-Ck-7aLuZ.js +0 -1
  104. package/web/assets/MemoryPage-BEdNJ3ot.js +0 -1
  105. package/web/assets/MobileContextScreen-Dasny2J9.js +0 -2
  106. package/web/assets/MobileThreePane-DEKMHPfN.js +0 -1
  107. package/web/assets/SchedulesPage-W4Mg7frl.js +0 -1
  108. package/web/assets/SessionContextPanel-lu9F9AJg.js +0 -1
  109. package/web/assets/SidebarRecentSessions-1G_huYu9.js +0 -1
  110. package/web/assets/SkillsPage-CpRRosmo.js +0 -1
  111. package/web/assets/TerminalPanel-DVKC4htc.js +0 -18
  112. package/web/assets/Threads-B8ij_QtI.js +0 -1
  113. package/web/assets/WorkflowsPage-bhQlHSzS.js +0 -1
  114. package/web/assets/app-update-DppJNspd.js +0 -32
  115. package/web/assets/arrow-right-DqLOhpA2.js +0 -1
  116. package/web/assets/catalog-D4eaIju4.js +0 -1
  117. package/web/assets/channels-messages-CeRKS_DE.js +0 -1
  118. package/web/assets/chat-api-DfnvubiW.js +0 -1
  119. package/web/assets/chevron-left-BAtyp3_6.js +0 -1
  120. package/web/assets/config-search-CwVhh2uc.js +0 -1
  121. package/web/assets/dist-DAs5KRGl.js +0 -1
  122. package/web/assets/dist-swnK7PHk.js +0 -1
  123. package/web/assets/i18n-7QvbQzOQ.js +0 -1
  124. package/web/assets/index-CdASiNlI.css +0 -2
  125. package/web/assets/local-path-reveal-DWhkyox-.js +0 -1
  126. package/web/assets/mobile-shell-layout-CMpTmYRX.js +0 -1
  127. package/web/assets/mount-app-n_05p6iW.js +0 -9
  128. package/web/assets/panel-left-C_lYsiIA.js +0 -1
  129. package/web/assets/panel-right-BSUtqUd8.js +0 -1
  130. package/web/assets/pick-system-directory-R1F5WyaB.js +0 -1
  131. package/web/assets/pin-Dc2zE4cS.js +0 -1
  132. package/web/assets/public-BcTP7F3I.js +0 -1
  133. package/web/assets/public-components-Ck5BYo6M.js +0 -1
  134. package/web/assets/session-list-CMaoK_ZX.js +0 -1
  135. package/web/assets/session-streaming-state-llCTupbI.js +0 -3
  136. package/web/assets/side-chat-context-Dr2QLUJA.js +0 -1
  137. package/web/assets/tabs-DQYVDdOp.js +0 -1
  138. package/web/assets/use-animation-visibility-_Xe7jeUy.js +0 -1
  139. package/web/assets/useQuery-DdcpUQhO.js +0 -1
  140. package/web/assets/vendor-dockview-Bf3Gg83W.js +0 -1
  141. package/web/assets/vendor-dockview-D5adAaCg.css +0 -1
  142. package/web/assets/web-preview-BPNd1LUd.js +0 -1
  143. package/web/assets/web-preview-CQbpHjt1.js +0 -1
  144. package/web/assets/web-preview-events-o845ErdA.js +0 -1
  145. package/web/assets/web-preview-panel-DVQxVfig.js +0 -552
  146. package/web/assets/workflow-Bg94dy8I.js +0 -1
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-BSZKFkMb.js";import{i}from"./dist-Cfh4kzCK.js";import{o as a,s as o}from"./dist-B_a0oV4U.js";import{a as s,c,i as l,l as u,n as d,o as f,r as p,s as m,t as h}from"./dist-BdkTa5R3.js";import{t as g}from"./AppSelect-D149YYg1.js";import{t as _}from"./utils-C8uzG5AZ.js";import{t as v}from"./createLucideIcon-Cd-3GVxJ.js";import{t as ee}from"./chevron-down-CxtxIjiP.js";import{t as y}from"./circle-check-iEdCm3Pw.js";import{t as b}from"./earth-Ddy13fHh.js";import{t as x}from"./external-link-CEQqPcqc.js";import{n as S,t as C}from"./shield-alert-CvFOTe9h.js";import{t as w}from"./file-code-corner-BnE1ljT0.js";import{t as T}from"./folder-open-FIShC5Qk.js";import{t as E}from"./image-BY_c3FYU.js";import{t as D}from"./loader-circle-BOwQzHB-.js";import{t as te}from"./plug-BsIeHRwC.js";import{t as O}from"./refresh-cw-TbWxTY4K.js";import{t as k}from"./search-D0mqDaf_.js";import{t as A}from"./server-BgNvmqwJ.js";import{t as ne}from"./trash-2-CNrPOoPR.js";import{t as j}from"./triangle-alert-CE1q54ci.js";import{t as M}from"./api-Dzobr-o_.js";import{t as N}from"./button-CQA36izu.js";import{a as P,i as F,o as I,r as L,s as R,t as z}from"./dialog-D-ER2p-D.js";import{c as re,i as B,l as ie,r as ae,s as oe}from"./app-primitives-BBXY6U2S.js";import{n as V,t as H}from"./pick-system-directory-R1F5WyaB.js";import{t as se}from"./usePagePrimaryAction-CWPC0C_f.js";import{i as ce,t as le}from"./runtime-capabilities-store-DaWPY5y-.js";import{a as ue,i as U,n as de,o as fe,r as pe,t as me}from"./tool-labels-DJzY62Yr.js";var W=e(t(),1),G=n(),he=Object.defineProperty,K=(e,t)=>he(e,`name`,{value:t,configurable:!0}),[q,ge]=o(`AlertDialog`,[u]),J=u(),Y=K(e=>{let{__scopeAlertDialog:t,...n}=e,r=J(t);return(0,G.jsx)(h,{...r,...n,modal:!0})},`AlertDialog`);W.forwardRef(K(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=J(n);return(0,G.jsx)(c,{...i,...r,ref:t})},`AlertDialogTrigger`));var _e=K(e=>{let{__scopeAlertDialog:t,...n}=e,r=J(t);return(0,G.jsx)(f,{...r,...n})},`AlertDialogPortal`),ve=W.forwardRef(K(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=J(n);return(0,G.jsx)(s,{...i,...r,ref:t})},`AlertDialogOverlay`)),[ye,be]=q(`AlertDialogContent`),xe=W.forwardRef(K(function(e,t){let{__scopeAlertDialog:n,children:r,...o}=e,s=J(n),c=W.useRef(null),l=i(t,c),u=W.useRef(null);return(0,G.jsx)(ye,{scope:n,cancelRef:u,children:(0,G.jsx)(p,{role:`alertdialog`,...s,...o,ref:l,onOpenAutoFocus:a(o.onOpenAutoFocus,e=>{e.preventDefault(),u.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:r})})},`AlertDialogContent`)),Se=W.forwardRef(K(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=J(n);return(0,G.jsx)(m,{...i,...r,ref:t})},`AlertDialogTitle`)),Ce=W.forwardRef(K(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=J(n);return(0,G.jsx)(l,{...i,...r,ref:t})},`AlertDialogDescription`)),we=W.forwardRef(K(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=J(n);return(0,G.jsx)(d,{...i,...r,ref:t})},`AlertDialogAction`)),Te=`AlertDialogCancel`,Ee=W.forwardRef(K(function(e,t){let{__scopeAlertDialog:n,...r}=e,{cancelRef:a}=be(Te,n),o=J(n),s=i(t,a);return(0,G.jsx)(d,{...o,...r,ref:s})},`AlertDialogCancel`)),De=Y,Oe=_e,ke=ve,Ae=xe,je=we,Me=Ee,Ne=Se,Pe=Ce,X=v(`package-plus`,[[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`path`,{d:`M16 17h6`,key:`1ook5g`}],[`path`,{d:`M19 14v6`,key:`1ckrd5`}],[`path`,{d:`M21 10.535V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l1.675-.955`,key:`28k6lz`}],[`path`,{d:`M3.29 7 12 12l8.71-5`,key:`19ckod`}],[`path`,{d:`m7.5 4.27 8.997 5.148`,key:`9yrvtv`}]]);function Fe({...e}){return(0,G.jsx)(De,{"data-slot":`alert-dialog`,...e})}function Ie({...e}){return(0,G.jsx)(Oe,{"data-slot":`alert-dialog-portal`,...e})}function Le({className:e,...t}){return(0,G.jsx)(ke,{"data-slot":`alert-dialog-overlay`,className:_(`fixed inset-0 z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function Re({className:e,size:t=`default`,...n}){return(0,G.jsxs)(Ie,{children:[(0,G.jsx)(Le,{}),(0,G.jsx)(Ae,{"data-slot":`alert-dialog-content`,"data-size":t,className:_(`group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid max-h-[calc(100vh-2rem)] supports-[height:100dvh]:max-h-[calc(100dvh-2rem)] w-full -translate-x-1/2 -translate-y-1/2 gap-4 overflow-y-auto overscroll-contain rounded-xl bg-popover p-4 text-popover-foreground ring-1 ring-[var(--stroke-soft)] duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...n})]})}function ze({className:e,...t}){return(0,G.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:_(`grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]`,e),...t})}function Be({className:e,...t}){return(0,G.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:_(`-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-[var(--surface-subtle)] p-4 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end`,e),...t})}function Ve({className:e,...t}){return(0,G.jsx)(Ne,{"data-slot":`alert-dialog-title`,className:_(`font-heading text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2`,e),...t})}function He({className:e,...t}){return(0,G.jsx)(Pe,{"data-slot":`alert-dialog-description`,className:_(`text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function Ue({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,G.jsx)(N,{variant:t,size:n,asChild:!0,children:(0,G.jsx)(je,{"data-slot":`alert-dialog-action`,className:_(e),...r})})}function We({className:e,variant:t=`outline`,size:n=`default`,...r}){return(0,G.jsx)(N,{variant:t,size:n,asChild:!0,children:(0,G.jsx)(Me,{"data-slot":`alert-dialog-cancel`,className:_(e),...r})})}function Ge(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function Ke({open:e,onOpenChange:t,onInstalled:n}){let{t:i}=r(),[a,o]=(0,W.useState)(``),[s,c]=(0,W.useState)(null),[l,u]=(0,W.useState)(!1),[d,f]=(0,W.useState)(``);return(0,W.useEffect)(()=>{e||(o(``),c(null),u(!1),f(``))},[e]),(0,G.jsx)(z,{open:e,onOpenChange:e=>!l&&t(e),children:(0,G.jsxs)(L,{className:`z-[220] sm:max-w-xl`,overlayClassName:`z-[220]`,children:[(0,G.jsxs)(I,{children:[(0,G.jsxs)(R,{className:`flex items-center gap-2`,children:[(0,G.jsx)(X,{size:17}),i(`plugins:pluginsPage.installLocalPlugin`)]}),(0,G.jsx)(F,{children:i(`plugins:pluginsPage.installLocalPluginDescription`)})]}),(0,G.jsxs)(`div`,{className:`grid gap-3`,children:[(0,G.jsxs)(`label`,{className:`grid gap-1.5 text-xs font-semibold text-[var(--text-soft)]`,children:[i(`plugins:pluginsPage.pluginDirectory`),(0,G.jsxs)(`span`,{className:`flex min-w-0 gap-2`,children:[(0,G.jsx)(`input`,{className:`h-10 min-w-0 flex-1 rounded-md border border-[var(--stroke)] bg-[var(--solid)] px-3 text-[13px] text-[var(--text)] outline-none focus:border-[var(--star-border)]`,value:a,disabled:l,placeholder:i(`plugins:pluginsPage.pluginDirectoryPlaceholder`),onChange:e=>{o(e.target.value),c(null)}}),H()&&(0,G.jsx)(N,{type:`button`,variant:`ghost`,size:`icon`,className:`size-10 shrink-0`,title:i(`plugins:pluginsPage.chooseDirectory`),onClick:async()=>{f(``);try{let e=await V(a);e&&(o(e),c(null))}catch(e){f(e instanceof Error?e.message:String(e))}},children:(0,G.jsx)(T,{size:16})})]})]}),s&&(0,G.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-[var(--stroke)] bg-[var(--surface-muted)] p-3`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,G.jsx)(`span`,{className:`grid size-9 shrink-0 place-items-center rounded-md bg-[var(--success-soft)] text-[var(--success)]`,children:(0,G.jsx)(y,{size:17})}),(0,G.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`strong`,{className:`block truncate text-[13px] text-[var(--text)]`,children:s.plugin.name}),(0,G.jsxs)(`small`,{className:`block truncate text-[12px] text-[var(--text-muted)]`,children:[s.plugin.id,` · v`,s.plugin.version,` · `,s.fileCount,` `,i(`plugins:pluginsPage.files`),` · `,Ge(s.byteCount)]})]})]}),(0,G.jsx)(`div`,{className:`grid gap-1.5`,children:s.plugin.capabilities.map(e=>(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3 border-t border-[var(--stroke-soft)] pt-2 text-xs`,children:[(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`strong`,{className:`block text-[var(--text)]`,children:e.label}),(0,G.jsx)(`small`,{className:`text-[var(--text-muted)]`,children:e.description})]}),(0,G.jsx)(`code`,{className:`shrink-0 text-[11px] text-[var(--text-soft)]`,children:e.name})]},e.name))}),(0,G.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md bg-[var(--warning-soft)] p-2.5 text-xs leading-5 text-[var(--warning-strong)]`,children:[(0,G.jsx)(j,{className:`mt-0.5 shrink-0`,size:15}),(0,G.jsx)(`span`,{children:i(`plugins:pluginsPage.localPluginSecurityWarning`)})]})]}),d&&(0,G.jsxs)(B,{className:`m-0`,children:[(0,G.jsx)(j,{size:14}),(0,G.jsx)(`span`,{children:d})]})]}),(0,G.jsxs)(P,{children:[(0,G.jsx)(N,{type:`button`,variant:`outline`,size:`lg`,className:`bg-surface-subtle`,disabled:l,onClick:()=>t(!1),children:i(`common:ui.cancel`)}),(0,G.jsxs)(N,{type:`button`,size:`lg`,disabled:l||!s&&!a.trim(),onClick:s?async()=>{if(!(!s||l)){u(!0),f(``);try{await M(`/api/plugins/install`,{method:`POST`,body:JSON.stringify({inspectionId:s.inspectionId})}),await n(),t(!1)}catch(e){f(e instanceof Error?e.message:String(e))}finally{u(!1)}}}:async()=>{if(!(!a.trim()||l)){u(!0),f(``);try{c(await M(`/api/plugins/inspect`,{method:`POST`,body:JSON.stringify({path:a.trim()})}))}catch(e){c(null),f(e instanceof Error?e.message:String(e))}finally{u(!1)}}},children:[l?(0,G.jsx)(D,{className:`animate-spin`,size:15}):s?(0,G.jsx)(X,{size:15}):(0,G.jsx)(y,{size:15}),i(l?`plugins:pluginsPage.processing`:s?`plugins:pluginsPage.installPlugin`:`plugins:pluginsPage.inspectPlugin`)]})]})]})})}var qe=[`tool`,`prompt`,`skill`];function Je(e){let t=Array.isArray(e.resourceTypes)?e.resourceTypes.filter(e=>qe.includes(e)):[];return t.length?t:[`tool`]}function Ye(e,t){return{tool:t(`plugins:pluginsPage.extensionType.tool`),prompt:t(`plugins:pluginsPage.extensionType.prompt`),skill:t(`plugins:pluginsPage.extensionType.skill`)}[e]}var Xe=[`all`,`builtin`,`local`],Ze={read:S,ls:T,grep:k,find:k,edit:w,write:w,bash:A,web_search:b,browser_automation:b,generate_visual:E};function Z(e,t){return t(e===`builtin`?`plugins:pluginsPage.builtIn`:e===`local`?`plugins:pluginsPage.local`:`plugins:pluginsPage.all`)}function Qe(e){return e.flatMap(e=>e.managedExternally?[]:e.capabilities.filter(e=>e.enabled).map(e=>e.name))}function $e(e){return e.filter(e=>!e.managedExternally||e.source===`pi`).flatMap(e=>e.capabilities.map(t=>({...t,pluginId:e.id,pluginName:e.name,pluginDescription:e.description,pluginVersion:e.version,pluginSource:e.source,pluginBuiltIn:e.builtIn,pluginPermissions:e.permissions||[],pluginSystemAccess:!!e.systemAccess})))}function et(e){return e.find(e=>e.source===`pi`&&e.name===`Computer Use`)?.enabled!==!1}function tt(e){return Object.fromEntries(e.filter(e=>e.source===`pi`&&e.name!==`Computer Use`&&!!e.packageSource).map(e=>[e.packageSource,e.enabled!==!1]))}function nt(e,t){return[...e].sort().join(`\0`)===[...t].sort().join(`\0`)}function Q(e,t){return U({id:e.name,name:e.label},t)}function $(e,t){return e.pluginSource===`pi`?e.pluginName:de(e.pluginName,t)}function rt({value:e,testing:t,onChange:n,onTest:i}){let{t:a}=r();return(0,G.jsxs)(`div`,{className:`plugin-tool-config [&_label]:grid [&_label]:gap-[5px] [&_label]:text-[var(--text-muted)] [&_label]:text-[11px] [&_label]:font-[600] [&_select]:w-full [&_select]:h-[34px] [&_select]:[border:1px_solid_var(--stroke)] [&_select]:rounded-[var(--r-xs)] [&_select]:bg-[var(--solid)] [&_select]:p-[0_8px] [&_select]:text-[var(--text)] [&_select]:text-[12px] [&_input]:w-full [&_input]:h-[34px] [&_input]:[border:1px_solid_var(--stroke)] [&_input]:rounded-[var(--r-xs)] [&_input]:bg-[var(--solid)] [&_input]:p-[0_8px] [&_input]:text-[var(--text)] [&_input]:text-[12px] grid gap-[9px] [border-top:1px_solid_var(--stroke)] [padding-top:10px]`,children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-3`,children:[(0,G.jsxs)(`label`,{children:[a(`plugins:pluginsPage.defaultLanguage`),(0,G.jsxs)(g,{value:e.language,onChange:t=>n({...e,language:t.target.value}),children:[(0,G.jsx)(`option`,{value:`auto`,children:a(`plugins:pluginsPage.auto`)}),(0,G.jsx)(`option`,{value:`zh-CN`,children:a(`plugins:pluginsPage.simplifiedChinese`)}),(0,G.jsx)(`option`,{value:`en-US`,children:a(`plugins:pluginsPage.english`)})]})]}),(0,G.jsxs)(`label`,{children:[a(`plugins:pluginsPage.safeSearch`),(0,G.jsxs)(g,{value:e.safeSearch,onChange:t=>n({...e,safeSearch:Number(t.target.value)}),children:[(0,G.jsx)(`option`,{value:0,children:a(`plugins:pluginsPage.off`)}),(0,G.jsx)(`option`,{value:1,children:a(`plugins:pluginsPage.moderate`)}),(0,G.jsx)(`option`,{value:2,children:a(`plugins:pluginsPage.strict`)})]})]}),(0,G.jsxs)(`label`,{children:[a(`plugins:pluginsPage.resultCount`),(0,G.jsx)(`input`,{type:`number`,min:`1`,max:`12`,value:e.maxResults,onChange:t=>n({...e,maxResults:Number(t.target.value)})})]})]}),(0,G.jsxs)(N,{type:`button`,variant:`outline`,size:`lg`,className:`justify-self-end bg-surface-subtle`,disabled:t,onClick:i,children:[t?(0,G.jsx)(O,{className:`animate-spin`,size:14}):(0,G.jsx)(b,{size:14}),a(t?`plugins:pluginsPage.testing`:`plugins:pluginsPage.testConnection`)]})]})}function it({query:e,notify:t,requestText:n,requestConfirm:i}){let{t:a}=r(),[o,s]=(0,W.useState)(``),[c,l]=(0,W.useState)(null),[u,d]=(0,W.useState)([]),[f,p]=(0,W.useState)(!1),[m,h]=(0,W.useState)(``),[g,_]=(0,W.useState)(``),v=(0,W.useCallback)(async(e=``)=>{p(!0),_(``);try{let[t,n]=await Promise.all([M(`/api/extensions/market?name=${encodeURIComponent(e)}`),M(`/api/extensions`)]);l(t),d(n.packages||[])}catch(e){_(e instanceof Error?e.message:String(e))}finally{p(!1)}},[]);(0,W.useEffect)(()=>{v(``)},[v]);let ee=(c?.packages||[]).filter(t=>`${t.name} ${t.description}`.toLowerCase().includes(e.trim().toLowerCase())),y=async e=>{if(await i?.({title:a(`plugins:pluginsPage.installExtension`),message:a(`plugins:pluginsPage.extensionSecurityWarning`,{name:e}),confirmLabel:a(`plugins:pluginsPage.installExtension`),tone:`danger`})!==!1){h(e);try{let n=/^(?:[.~\\/]|[A-Za-z]:[\\/])/.test(e)||/^(?:npm:|https?:\/\/|git\+)/i.test(e)?e:`npm:${e}`,r=await M(`/api/extensions/install`,{method:`POST`,body:JSON.stringify({source:n})});d(r.packages||[]),t(a(`plugins:pluginsPage.extensionInstalled`),`success`)}catch(e){t(e instanceof Error?e.message:String(e),`error`)}finally{h(``)}}},b=async()=>{let e=await n?.({title:a(`plugins:pluginsPage.installExtension`),message:a(`plugins:pluginsPage.extensionSourceHelp`),inputLabel:a(`plugins:pluginsPage.extensionSource`),placeholder:`npm:@scope/package or https://github.com/…`,maxLength:2e3});e?.trim()&&await y(e.trim())},S=async e=>{if(await i?.({title:a(`plugins:pluginsPage.uninstallExtension`),message:a(`plugins:pluginsPage.uninstallExtensionDescription`,{name:e.name}),confirmLabel:a(`plugins:pluginsPage.uninstallExtension`),tone:`danger`})!==!1){h(e.source);try{await M(`/api/extensions`,{method:`DELETE`,body:JSON.stringify({source:e.source,scope:e.scope})}),await v(o),t(a(`plugins:pluginsPage.extensionUninstalled`),`success`)}catch(e){t(e instanceof Error?e.message:String(e),`error`)}finally{h(``)}}},C=qe.map(e=>({type:e,items:u.filter(t=>Je(t).includes(e))})).filter(e=>e.items.length>0);return(0,G.jsxs)(`section`,{className:`plugin-market grid gap-[10px] border-t border-[var(--stroke)] pt-[14px]`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-[10px]`,children:[(0,G.jsx)(`h2`,{className:`m-0 text-[14px] font-[650]`,children:a(`plugins:pluginsPage.extensionMarket`)}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsxs)(N,{type:`button`,variant:`outline`,size:`lg`,onClick:b,disabled:!!m,children:[(0,G.jsx)(X,{size:14}),a(`plugins:pluginsPage.installExtension`)]}),(0,G.jsxs)(`a`,{className:`inline-flex h-[34px] items-center gap-1 rounded-[var(--r-xs)] border border-[var(--stroke)] px-2 text-[12px] text-[var(--text-soft)] no-underline hover:bg-[var(--surface-hover)]`,href:`https://pi.dev/packages`,target:`_blank`,rel:`noreferrer`,children:[(0,G.jsx)(x,{size:13}),a(`plugins:pluginsPage.openPackageCatalog`)]})]})]}),(0,G.jsxs)(`form`,{className:`flex min-w-0 gap-2`,onSubmit:e=>{e.preventDefault(),v(o)},children:[(0,G.jsx)(`input`,{className:`h-[34px] min-w-0 flex-1 rounded-[var(--r-xs)] border border-[var(--stroke)] bg-[var(--solid)] px-2 text-[12px] text-[var(--text)]`,value:o,onChange:e=>s(e.target.value),placeholder:a(`plugins:pluginsPage.searchPackageCatalog`),"aria-label":a(`plugins:pluginsPage.searchPackageCatalog`)}),(0,G.jsxs)(N,{type:`submit`,variant:`outline`,size:`lg`,disabled:f,children:[f?(0,G.jsx)(O,{className:`animate-spin`,size:14}):(0,G.jsx)(k,{size:14}),a(`plugins:pluginsPage.search`)]})]}),g&&(0,G.jsx)(`p`,{className:`m-0 text-[12px] text-[var(--danger)]`,children:g}),C.length>0&&(0,G.jsxs)(`div`,{className:`grid gap-2`,children:[(0,G.jsx)(`h3`,{className:`m-0 text-[12px] font-[650] text-[var(--text-secondary)]`,children:a(`plugins:pluginsPage.installedExtensions`)}),C.map(e=>(0,G.jsxs)(`section`,{className:`grid gap-1`,children:[(0,G.jsx)(`h4`,{className:`m-0 text-[11px] font-[650] text-[var(--text-muted)]`,children:Ye(e.type,a)}),e.items.map(t=>(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-2 border-t border-[var(--stroke-soft)] py-2`,children:[(0,G.jsxs)(`span`,{className:`min-w-0`,children:[(0,G.jsx)(`strong`,{className:`block overflow-hidden text-ellipsis whitespace-nowrap text-[12px]`,children:t.name}),(0,G.jsxs)(`small`,{className:`block overflow-hidden text-ellipsis whitespace-nowrap text-[11px] text-[var(--text-muted)]`,children:[t.source,` · v`,t.version]})]}),(0,G.jsxs)(N,{type:`button`,variant:`ghost`,size:`sm`,disabled:!!m,onClick:()=>void S(t),children:[m===t.source?(0,G.jsx)(D,{className:`animate-spin`,size:13}):(0,G.jsx)(ne,{size:13}),a(`plugins:pluginsPage.uninstallExtension`)]})]},`${e.type}:${t.scope}:${t.source}`))]},e.type))]}),(0,G.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(230px,1fr))] gap-2`,children:ee.slice(0,12).map(e=>{let t=u.some(t=>t.name===e.name||t.source===`npm:${e.name}`);return(0,G.jsxs)(`article`,{className:`grid min-w-0 gap-2 rounded-[var(--r-xs)] border border-[var(--stroke)] bg-[var(--solid)] p-2`,children:[(0,G.jsx)(`strong`,{className:`overflow-hidden text-ellipsis whitespace-nowrap text-[12px]`,title:e.name,children:e.name}),(0,G.jsx)(`p`,{className:`m-0 line-clamp-3 min-h-[45px] text-[11px] leading-[1.45] text-[var(--text-secondary)]`,children:e.description}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsx)(`small`,{className:`text-[10px] text-[var(--text-muted)]`,children:e.published}),(0,G.jsxs)(N,{type:`button`,size:`sm`,disabled:t||!!m,onClick:()=>void y(e.name),children:[m===e.name&&(0,G.jsx)(D,{className:`animate-spin`,size:13}),a(t?`plugins:pluginsPage.installed`:`plugins:pluginsPage.installExtension`)]})]})]},e.name)})})]})}function at({query:e=``,notify:t,registerPrimaryAction:n,requestText:i,requestConfirm:a}){let{t:o}=r(),s=le(e=>e.capabilities),c=ce(s,`plugins`),l=c?Xe:Xe.slice(0,2),[u,d]=(0,W.useState)(null),[f,p]=(0,W.useState)([]),[m,h]=(0,W.useState)(``),[g,_]=(0,W.useState)(`all`),[v,y]=(0,W.useState)({provider:`bing`,language:`auto`,safeSearch:1,maxResults:8}),[b,x]=(0,W.useState)(!1),[S,w]=(0,W.useState)(!1),[T,E]=(0,W.useState)(!1),[k,A]=(0,W.useState)(null),[P,F]=(0,W.useState)(!1),[I,L]=(0,W.useState)(``),R=(0,W.useCallback)(e=>{d(e),p(e.plugins),y(e.webSearch)},[]),z=(0,W.useCallback)(async()=>{L(``);try{R(await M(`/api/plugins`))}catch(e){L(e instanceof Error?e.message:String(e))}},[R]);(0,W.useEffect)(()=>{z()},[z]);let V=(0,W.useMemo)(()=>$e(f),[f]),H=(0,W.useMemo)(()=>Qe(f),[f]),U=u?!nt(H,u.enabledTools)||et(f)!==u.computerUseEnabled||JSON.stringify(tt(f))!==JSON.stringify(u.piExtensions)||JSON.stringify(v)!==JSON.stringify(u.webSearch):!1,de=(0,W.useCallback)(async()=>{if(!b){if(!u||!U){u&&t(o(`plugins:pluginsPage.noPluginPolicyChanges`));return}x(!0),L(``);try{let e=await M(`/api/plugins`,{method:`PUT`,body:JSON.stringify({enabledTools:H,webSearch:v,computerUseEnabled:et(f),piExtensions:tt(f)})});R(e),t(o(`plugins:pluginsPage.pluginPolicySavedAgentRuntimeUpdated`))}catch(e){L(e instanceof Error?e.message:String(e))}finally{x(!1)}}},[R,u,U,f,H,t,b,o,v]);se(n,de);let he=async()=>{w(!0),L(``);try{let e=await M(`/api/plugins/web-search/test`,{method:`POST`,body:JSON.stringify(v)});t(o(`plugins:pluginsPage.bingSearchIsAvailableAndReturnedCountResults`,{count:e.count}))}catch(e){let n=e instanceof Error?e.message:String(e);L(n),t(n,`error`)}finally{w(!1)}},K=(e,t,n)=>{p(r=>r.map(r=>{if(r.id!==e)return r;let i=r.source===`pi`&&r.managedExternally;return{...r,enabled:n||r.capabilities.some(e=>e.enabled),capabilities:r.capabilities.map(e=>i||e.name===t?{...e,enabled:n}:e)}}))},q=()=>!U||(L(o(`plugins:pluginsPage.saveBeforePluginChanges`)),!1),ge=async()=>{if(!(!k||P)){F(!0),L(``);try{R(await M(`/api/plugins/${encodeURIComponent(k.pluginId)}`,{method:`DELETE`})),t(o(`plugins:pluginsPage.pluginUninstalled`,{name:k.pluginName})),h(``),A(null)}catch(e){L(e instanceof Error?e.message:String(e))}finally{F(!1)}}};if(!u)return(0,G.jsxs)(ae,{children:[(0,G.jsx)(O,{className:`animate-spin`,size:24}),(0,G.jsx)(`h2`,{children:o(`plugins:pluginsPage.loadingToolPlugins`)}),I&&(0,G.jsxs)(B,{children:[(0,G.jsx)(j,{size:13}),I]})]});let J=e.trim().toLowerCase(),Y=V.filter(e=>g!==`all`&&e.pluginSource!==g?!1:[Q(e,o),e.name,e.description,$(e,o),e.pluginId].join(` `).toLowerCase().includes(J));return(0,G.jsxs)(`div`,{className:`plugins-page flex min-h-[100%] flex-col gap-[12px] max-[900px]:h-auto h-full min-h-0 overflow-y-auto [scrollbar-gutter:stable]`,children:[(0,G.jsxs)(`div`,{className:`plugin-toolbar max-[650px]:items-stretch max-[650px]:flex-col flex items-center justify-between gap-[12px]`,children:[(0,G.jsx)(re,{options:l.map(e=>Z(e,o)),value:Z(g,o),onChange:e=>_(l.find(t=>Z(t,o)===e)||`all`)}),(0,G.jsx)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:c&&(0,G.jsxs)(N,{type:`button`,variant:`outline`,size:`lg`,className:`bg-surface-subtle`,onClick:()=>q()&&E(!0),children:[(0,G.jsx)(X,{size:15}),o(`plugins:pluginsPage.installPlugin`)]})})]}),(0,G.jsxs)(`div`,{className:`plugin-catalog-heading [&_>_span]:flex [&_>_span]:items-center [&_>_span]:gap-[7px] [&_strong]:text-[13px] [&_small]:text-[var(--text-secondary)] [&_small]:text-[12px] [&_small]:[font-variant-numeric:tabular-nums] max-[650px]:items-start flex items-center justify-between gap-[12px] [padding:2px]`,children:[(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`strong`,{children:o(`plugins:pluginsPage.toolCatalog`)}),(0,G.jsx)(`small`,{children:Y.length})]}),(0,G.jsxs)(`span`,{className:`plugin-catalog-summary text-[var(--text-secondary)] text-[12px] [font-variant-numeric:tabular-nums] [&_>_i]:w-[7px] [&_>_i]:h-[7px] [&_>_i]:rounded-[50%] [&_>_i]:bg-[var(--status-green)] max-[650px]:flex-wrap max-[650px]:justify-end`,children:[(0,G.jsx)(`i`,{}),V.filter(e=>e.enabled).length,`/`,V.length,` `,o(`plugins:pluginsPage.enabled2`),U&&(0,G.jsx)(ie,{tone:`amber`,children:o(`plugins:pluginsPage.unsaved`)})]})]}),Y.length?(0,G.jsx)(`div`,{className:`plugin-tool-grid max-[650px]:grid-cols-[minmax(0,1fr)] grid grid-cols-[repeat(auto-fill,minmax(310px,1fr))] [align-items:start] gap-[10px] [padding-bottom:4px]`,children:Y.map(e=>{let t=m===e.name,n=Ze[e.name]||te;return(0,G.jsxs)(`article`,{className:`plugin-tool-card [&[data-open]]:border-[var(--stroke-hover)] [&[data-open]]:shadow-[var(--sh-1)] min-w-0 overflow-hidden [border:1px_solid_var(--stroke)] rounded-[var(--r-sm)] bg-[var(--solid)]`,"data-open":t||void 0,children:[(0,G.jsxs)(`div`,{className:`plugin-tool-card-head hover:bg-[var(--surface-hover)] [.plugin-tool-card[data-open]_>_&]:bg-[var(--surface-hover)] max-[650px]:grid-cols-[minmax(0,1fr)_auto] max-[650px]:[padding-inline:8px] grid min-h-[56px] grid-cols-[minmax(0,1fr)_auto] items-center gap-[10px] [padding:7px_10px]`,children:[(0,G.jsxs)(`button`,{type:`button`,className:`grid min-w-0 h-full grid-cols-[32px_minmax(0,1fr)] items-center gap-[9px] border-0 bg-transparent p-0 text-inherit text-left`,"aria-expanded":t,onClick:()=>h(t=>t===e.name?``:e.name),children:[(0,G.jsx)(`span`,{className:`grid w-[32px] h-[32px] place-items-center rounded-[var(--r-xs)] bg-[var(--surface-muted)] text-[var(--text-soft)]`,children:(0,G.jsx)(n,{size:15})}),(0,G.jsxs)(`span`,{className:`plugin-tool-title [&_strong]:overflow-hidden [&_strong]:text-ellipsis [&_strong]:whitespace-nowrap [&_small]:overflow-hidden [&_small]:text-ellipsis [&_small]:whitespace-nowrap [&_strong]:text-[13px] [&_small]:text-[var(--text-muted)] [&_small]:text-[11px] flex min-w-0 flex-col gap-[2px]`,children:[(0,G.jsx)(`strong`,{title:Q(e,o),children:Q(e,o)}),(0,G.jsx)(`small`,{children:$(e,o)})]})]}),(0,G.jsxs)(`span`,{className:`plugin-tool-trailing [&_>_i]:w-[7px] [&_>_i]:h-[7px] [&_>_i]:rounded-[50%] [&_>_i]:bg-[var(--status-muted)] [&_>_i[data-enabled]]:bg-[var(--status-green)] max-[650px]:gap-[5px] inline-flex items-center gap-[7px]`,children:[(0,G.jsx)(`i`,{"data-enabled":e.enabled||void 0}),!e.pluginBuiltIn&&(0,G.jsx)(ie,{tone:`amber`,children:o(`plugins:pluginsPage.local`)}),(0,G.jsx)(oe,{value:e.enabled,onChange:t=>K(e.pluginId,e.name,t),ariaLabel:Q(e,o)}),(0,G.jsx)(`button`,{type:`button`,className:`plugin-tool-chevron hover:bg-[var(--surface-muted)] hover:text-[var(--text)] [&_svg]:[transition:transform_var(--d1)_var(--ease-out)] [&[aria-expanded='true']_svg]:[transform:rotate(180deg)] grid w-[24px] h-[24px] place-items-center border-0 rounded-[var(--r-xs)] bg-transparent text-[var(--text-muted)]`,"aria-label":o(`plugins:pluginsPage.toggleToolDetails`,{name:Q(e,o)}),"aria-expanded":t,onClick:()=>h(t=>t===e.name?``:e.name),children:(0,G.jsx)(ee,{size:14})})]})]}),t&&(0,G.jsxs)(`div`,{className:`plugin-tool-details [&_>_p]:m-0 [&_>_p]:text-[var(--text-soft)] [&_>_p]:text-[12px] [&_>_p]:leading-[1.55] [&_>_code]:[overflow-wrap:anywhere] [&_>_code]:text-[var(--text)] [&_>_code]:text-[11px] [&_dl]:grid [&_dl]:grid-cols-[78px_minmax(0,1fr)] [&_dl]:gap-[6px_10px] [&_dl]:m-0 [&_dl_div]:[display:contents] [&_dt]:text-[var(--text-muted)] [&_dt]:text-[11px] [&_dd]:min-w-0 [&_dd]:m-0 [&_dd]:[overflow-wrap:anywhere] [&_dd]:text-[var(--text-soft)] [&_dd]:text-[12px] max-[650px]:[&_dl]:grid-cols-[68px_minmax(0,1fr)] grid gap-[9px] [border-top:1px_solid_var(--stroke)] bg-[var(--surface-subtle)] [padding:11px_13px_13px]`,children:[(0,G.jsx)(`p`,{children:pe({id:e.name,description:e.description},o)}),(0,G.jsx)(`code`,{children:e.name}),(0,G.jsxs)(`dl`,{children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:o(`plugins:pluginsPage.source`)}),(0,G.jsxs)(`dd`,{children:[$(e,o),!e.pluginBuiltIn&&` · v${e.pluginVersion}`]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:o(`plugins:pluginsPage.riskLevel`)}),(0,G.jsx)(`dd`,{className:me(e.risk)?`text-[var(--danger)]`:``,children:ue(e.risk,o)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:o(`plugins:pluginsPage.pathScope`)}),(0,G.jsx)(`dd`,{children:fe({id:e.name,scope:e.scope},o)})]}),!e.pluginBuiltIn&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:o(`plugins:pluginsPage.executionMode`)}),(0,G.jsx)(`dd`,{children:o(`plugins:pluginsPage.fullAccessOnly`)})]})]}),!e.pluginBuiltIn&&(0,G.jsxs)(`div`,{className:`plugin-tool-warning [&_svg]:flex-none [&_svg]:mt-[1px] flex items-start gap-[7px] rounded-[var(--r-xs)] bg-[var(--warning-soft)] [padding:8px] text-[var(--warning-strong)] text-[11px] leading-[1.5]`,children:[(0,G.jsx)(C,{size:14}),(0,G.jsx)(`span`,{children:o(`plugins:pluginsPage.localPluginSecurityWarning`)})]}),e.name===`web_search`&&(0,G.jsx)(rt,{value:v,testing:S,onChange:y,onTest:he}),!e.pluginBuiltIn&&(0,G.jsxs)(N,{type:`button`,variant:`destructive`,size:`lg`,className:`[justify-self:end]`,onClick:()=>q()&&A(e),children:[(0,G.jsx)(ne,{size:14}),o(`plugins:pluginsPage.uninstallPlugin`)]})]})]},e.name)})}):(0,G.jsx)(`div`,{className:`plugin-empty [&.compact]:min-h-[90px] grid min-h-[180px] place-items-center text-[var(--text-secondary)] text-[12px]`,children:o(`plugins:pluginsPage.noMatchingTools`)}),(0,G.jsx)(it,{query:e,notify:t,requestText:i,requestConfirm:a}),c&&(0,G.jsx)(Ke,{open:T,onOpenChange:E,onInstalled:z}),(0,G.jsx)(Fe,{open:!!k,onOpenChange:e=>!e&&!P&&A(null),children:(0,G.jsxs)(Re,{className:`z-[220]`,children:[(0,G.jsxs)(ze,{children:[(0,G.jsx)(Ve,{children:o(`plugins:pluginsPage.uninstallPlugin`)}),(0,G.jsx)(He,{children:o(`plugins:pluginsPage.uninstallPluginDescription`,{name:k?.pluginName||``})})]}),(0,G.jsxs)(Be,{children:[(0,G.jsx)(We,{disabled:P,children:o(`common:ui.cancel`)}),(0,G.jsxs)(Ue,{variant:`destructive`,disabled:P,onClick:ge,children:[P&&(0,G.jsx)(D,{className:`animate-spin`,size:14}),o(`plugins:pluginsPage.uninstallPlugin`)]})]})]})}),I&&(0,G.jsxs)(B,{className:`fixed z-[21] [right:24px] [bottom:24px] max-w-[360px] shadow-[0_12px_28px_-18px_var(--floating-shadow)]`,children:[(0,G.jsx)(j,{size:13}),I]})]})}export{at as PluginsPage};
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-a84Zp9dV.js";import{i}from"./dist-Cfh4kzCK.js";import{o as a,s as o}from"./dist-B_a0oV4U.js";import{a as s,c,i as l,l as u,n as d,o as f,r as p,s as m,t as h}from"./dist-BdkTa5R3.js";import{t as g}from"./AppSelect-BCexz4Ty.js";import{t as _}from"./utils-C8uzG5AZ.js";import{t as v}from"./createLucideIcon-Cd-3GVxJ.js";import{t as ee}from"./chevron-down-CxtxIjiP.js";import{t as y}from"./circle-check-iEdCm3Pw.js";import{t as b}from"./earth-Ddy13fHh.js";import{t as x}from"./external-link-CEQqPcqc.js";import{n as S,t as C}from"./shield-alert-CvFOTe9h.js";import{t as w}from"./file-code-corner-BnE1ljT0.js";import{t as T}from"./folder-open-FIShC5Qk.js";import{t as E}from"./image-BY_c3FYU.js";import{t as D}from"./loader-circle-BOwQzHB-.js";import{t as te}from"./plug-BsIeHRwC.js";import{t as O}from"./refresh-cw-TbWxTY4K.js";import{t as k}from"./search-D0mqDaf_.js";import{t as A}from"./server-BgNvmqwJ.js";import{t as ne}from"./trash-2-CNrPOoPR.js";import{t as j}from"./triangle-alert-CE1q54ci.js";import{t as M}from"./api-YI8_cHpR.js";import{t as N}from"./button-CQA36izu.js";import{a as P,i as F,o as I,r as L,s as R,t as z}from"./dialog-D-ER2p-D.js";import{c as re,i as B,l as ie,r as ae,s as oe}from"./app-primitives-SxfoFmHc.js";import{i as se,t as ce}from"./runtime-capabilities-store-CiL3ZPEo.js";import{t as le}from"./usePagePrimaryAction-CWPC0C_f.js";import{a as ue,i as V,n as H,o as de,r as fe,t as pe}from"./tool-labels-DJzY62Yr.js";import{n as U,t as me}from"./pick-system-directory-BnIFt85A.js";var W=e(t(),1),G=n(),he=Object.defineProperty,K=(e,t)=>he(e,`name`,{value:t,configurable:!0}),[q,ge]=o(`AlertDialog`,[u]),J=u(),Y=K(e=>{let{__scopeAlertDialog:t,...n}=e,r=J(t);return(0,G.jsx)(h,{...r,...n,modal:!0})},`AlertDialog`);W.forwardRef(K(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=J(n);return(0,G.jsx)(c,{...i,...r,ref:t})},`AlertDialogTrigger`));var _e=K(e=>{let{__scopeAlertDialog:t,...n}=e,r=J(t);return(0,G.jsx)(f,{...r,...n})},`AlertDialogPortal`),ve=W.forwardRef(K(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=J(n);return(0,G.jsx)(s,{...i,...r,ref:t})},`AlertDialogOverlay`)),[ye,be]=q(`AlertDialogContent`),xe=W.forwardRef(K(function(e,t){let{__scopeAlertDialog:n,children:r,...o}=e,s=J(n),c=W.useRef(null),l=i(t,c),u=W.useRef(null);return(0,G.jsx)(ye,{scope:n,cancelRef:u,children:(0,G.jsx)(p,{role:`alertdialog`,...s,...o,ref:l,onOpenAutoFocus:a(o.onOpenAutoFocus,e=>{e.preventDefault(),u.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:r})})},`AlertDialogContent`)),Se=W.forwardRef(K(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=J(n);return(0,G.jsx)(m,{...i,...r,ref:t})},`AlertDialogTitle`)),Ce=W.forwardRef(K(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=J(n);return(0,G.jsx)(l,{...i,...r,ref:t})},`AlertDialogDescription`)),we=W.forwardRef(K(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=J(n);return(0,G.jsx)(d,{...i,...r,ref:t})},`AlertDialogAction`)),Te=`AlertDialogCancel`,Ee=W.forwardRef(K(function(e,t){let{__scopeAlertDialog:n,...r}=e,{cancelRef:a}=be(Te,n),o=J(n),s=i(t,a);return(0,G.jsx)(d,{...o,...r,ref:s})},`AlertDialogCancel`)),De=Y,Oe=_e,ke=ve,Ae=xe,je=we,Me=Ee,Ne=Se,Pe=Ce,X=v(`package-plus`,[[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`path`,{d:`M16 17h6`,key:`1ook5g`}],[`path`,{d:`M19 14v6`,key:`1ckrd5`}],[`path`,{d:`M21 10.535V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l1.675-.955`,key:`28k6lz`}],[`path`,{d:`M3.29 7 12 12l8.71-5`,key:`19ckod`}],[`path`,{d:`m7.5 4.27 8.997 5.148`,key:`9yrvtv`}]]);function Fe({...e}){return(0,G.jsx)(De,{"data-slot":`alert-dialog`,...e})}function Ie({...e}){return(0,G.jsx)(Oe,{"data-slot":`alert-dialog-portal`,...e})}function Le({className:e,...t}){return(0,G.jsx)(ke,{"data-slot":`alert-dialog-overlay`,className:_(`fixed inset-0 z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function Re({className:e,size:t=`default`,...n}){return(0,G.jsxs)(Ie,{children:[(0,G.jsx)(Le,{}),(0,G.jsx)(Ae,{"data-slot":`alert-dialog-content`,"data-size":t,className:_(`group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid max-h-[calc(100vh-2rem)] supports-[height:100dvh]:max-h-[calc(100dvh-2rem)] w-full -translate-x-1/2 -translate-y-1/2 gap-4 overflow-y-auto overscroll-contain rounded-xl bg-popover p-4 text-popover-foreground ring-1 ring-[var(--stroke-soft)] duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...n})]})}function ze({className:e,...t}){return(0,G.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:_(`grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]`,e),...t})}function Be({className:e,...t}){return(0,G.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:_(`-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-[var(--surface-subtle)] p-4 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end`,e),...t})}function Ve({className:e,...t}){return(0,G.jsx)(Ne,{"data-slot":`alert-dialog-title`,className:_(`font-heading text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2`,e),...t})}function He({className:e,...t}){return(0,G.jsx)(Pe,{"data-slot":`alert-dialog-description`,className:_(`text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function Ue({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,G.jsx)(N,{variant:t,size:n,asChild:!0,children:(0,G.jsx)(je,{"data-slot":`alert-dialog-action`,className:_(e),...r})})}function We({className:e,variant:t=`outline`,size:n=`default`,...r}){return(0,G.jsx)(N,{variant:t,size:n,asChild:!0,children:(0,G.jsx)(Me,{"data-slot":`alert-dialog-cancel`,className:_(e),...r})})}function Ge(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function Ke({open:e,onOpenChange:t,onInstalled:n}){let{t:i}=r(),[a,o]=(0,W.useState)(``),[s,c]=(0,W.useState)(null),[l,u]=(0,W.useState)(!1),[d,f]=(0,W.useState)(``);return(0,W.useEffect)(()=>{e||(o(``),c(null),u(!1),f(``))},[e]),(0,G.jsx)(z,{open:e,onOpenChange:e=>!l&&t(e),children:(0,G.jsxs)(L,{className:`z-[220] sm:max-w-xl`,overlayClassName:`z-[220]`,children:[(0,G.jsxs)(I,{children:[(0,G.jsxs)(R,{className:`flex items-center gap-2`,children:[(0,G.jsx)(X,{size:17}),i(`plugins:pluginsPage.installLocalPlugin`)]}),(0,G.jsx)(F,{children:i(`plugins:pluginsPage.installLocalPluginDescription`)})]}),(0,G.jsxs)(`div`,{className:`grid gap-3`,children:[(0,G.jsxs)(`label`,{className:`grid gap-1.5 text-xs font-semibold text-[var(--text-soft)]`,children:[i(`plugins:pluginsPage.pluginDirectory`),(0,G.jsxs)(`span`,{className:`flex min-w-0 gap-2`,children:[(0,G.jsx)(`input`,{className:`h-10 min-w-0 flex-1 rounded-md border border-[var(--stroke)] bg-[var(--solid)] px-3 text-[13px] text-[var(--text)] outline-none focus:border-[var(--star-border)]`,value:a,disabled:l,placeholder:i(`plugins:pluginsPage.pluginDirectoryPlaceholder`),onChange:e=>{o(e.target.value),c(null)}}),me()&&(0,G.jsx)(N,{type:`button`,variant:`ghost`,size:`icon`,className:`size-10 shrink-0`,title:i(`plugins:pluginsPage.chooseDirectory`),onClick:async()=>{f(``);try{let e=await U(a);e&&(o(e),c(null))}catch(e){f(e instanceof Error?e.message:String(e))}},children:(0,G.jsx)(T,{size:16})})]})]}),s&&(0,G.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-[var(--stroke)] bg-[var(--surface-muted)] p-3`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,G.jsx)(`span`,{className:`grid size-9 shrink-0 place-items-center rounded-md bg-[var(--success-soft)] text-[var(--success)]`,children:(0,G.jsx)(y,{size:17})}),(0,G.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`strong`,{className:`block truncate text-[13px] text-[var(--text)]`,children:s.plugin.name}),(0,G.jsxs)(`small`,{className:`block truncate text-[12px] text-[var(--text-muted)]`,children:[s.plugin.id,` · v`,s.plugin.version,` · `,s.fileCount,` `,i(`plugins:pluginsPage.files`),` · `,Ge(s.byteCount)]})]})]}),(0,G.jsx)(`div`,{className:`grid gap-1.5`,children:s.plugin.capabilities.map(e=>(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3 border-t border-[var(--stroke-soft)] pt-2 text-xs`,children:[(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`strong`,{className:`block text-[var(--text)]`,children:e.label}),(0,G.jsx)(`small`,{className:`text-[var(--text-muted)]`,children:e.description})]}),(0,G.jsx)(`code`,{className:`shrink-0 text-[11px] text-[var(--text-soft)]`,children:e.name})]},e.name))}),(0,G.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md bg-[var(--warning-soft)] p-2.5 text-xs leading-5 text-[var(--warning-strong)]`,children:[(0,G.jsx)(j,{className:`mt-0.5 shrink-0`,size:15}),(0,G.jsx)(`span`,{children:i(`plugins:pluginsPage.localPluginSecurityWarning`)})]})]}),d&&(0,G.jsxs)(B,{className:`m-0`,children:[(0,G.jsx)(j,{size:14}),(0,G.jsx)(`span`,{children:d})]})]}),(0,G.jsxs)(P,{children:[(0,G.jsx)(N,{type:`button`,variant:`outline`,size:`lg`,className:`bg-surface-subtle`,disabled:l,onClick:()=>t(!1),children:i(`common:ui.cancel`)}),(0,G.jsxs)(N,{type:`button`,size:`lg`,disabled:l||!s&&!a.trim(),onClick:s?async()=>{if(!(!s||l)){u(!0),f(``);try{await M(`/api/plugins/install`,{method:`POST`,body:JSON.stringify({inspectionId:s.inspectionId})}),await n(),t(!1)}catch(e){f(e instanceof Error?e.message:String(e))}finally{u(!1)}}}:async()=>{if(!(!a.trim()||l)){u(!0),f(``);try{c(await M(`/api/plugins/inspect`,{method:`POST`,body:JSON.stringify({path:a.trim()})}))}catch(e){c(null),f(e instanceof Error?e.message:String(e))}finally{u(!1)}}},children:[l?(0,G.jsx)(D,{className:`animate-spin`,size:15}):s?(0,G.jsx)(X,{size:15}):(0,G.jsx)(y,{size:15}),i(l?`plugins:pluginsPage.processing`:s?`plugins:pluginsPage.installPlugin`:`plugins:pluginsPage.inspectPlugin`)]})]})]})})}var qe=[`tool`,`prompt`,`skill`];function Je(e){let t=Array.isArray(e.resourceTypes)?e.resourceTypes.filter(e=>qe.includes(e)):[];return t.length?t:[`tool`]}function Ye(e,t){return{tool:t(`plugins:pluginsPage.extensionType.tool`),prompt:t(`plugins:pluginsPage.extensionType.prompt`),skill:t(`plugins:pluginsPage.extensionType.skill`)}[e]}var Xe=[`all`,`builtin`,`local`],Ze={read:S,ls:T,grep:k,find:k,edit:w,write:w,bash:A,web_search:b,browser_automation:b,generate_visual:E};function Z(e,t){return t(e===`builtin`?`plugins:pluginsPage.builtIn`:e===`local`?`plugins:pluginsPage.local`:`plugins:pluginsPage.all`)}function Qe(e){return e.flatMap(e=>e.managedExternally?[]:e.capabilities.filter(e=>e.enabled).map(e=>e.name))}function $e(e){return e.filter(e=>!e.managedExternally||e.source===`pi`).flatMap(e=>e.capabilities.map(t=>({...t,pluginId:e.id,pluginName:e.name,pluginDescription:e.description,pluginVersion:e.version,pluginSource:e.source,pluginBuiltIn:e.builtIn,pluginPermissions:e.permissions||[],pluginSystemAccess:!!e.systemAccess})))}function et(e){return e.find(e=>e.source===`pi`&&e.name===`Computer Use`)?.enabled!==!1}function tt(e){return Object.fromEntries(e.filter(e=>e.source===`pi`&&e.name!==`Computer Use`&&!!e.packageSource).map(e=>[e.packageSource,e.enabled!==!1]))}function nt(e,t){return[...e].sort().join(`\0`)===[...t].sort().join(`\0`)}function Q(e,t){return V({id:e.name,name:e.label},t)}function $(e,t){return e.pluginSource===`pi`?e.pluginName:H(e.pluginName,t)}function rt({value:e,testing:t,onChange:n,onTest:i}){let{t:a}=r();return(0,G.jsxs)(`div`,{className:`plugin-tool-config [&_label]:grid [&_label]:gap-[5px] [&_label]:text-[var(--text-muted)] [&_label]:text-[11px] [&_label]:font-[600] [&_select]:w-full [&_select]:h-[34px] [&_select]:[border:1px_solid_var(--stroke)] [&_select]:rounded-[var(--r-xs)] [&_select]:bg-[var(--solid)] [&_select]:p-[0_8px] [&_select]:text-[var(--text)] [&_select]:text-[12px] [&_input]:w-full [&_input]:h-[34px] [&_input]:[border:1px_solid_var(--stroke)] [&_input]:rounded-[var(--r-xs)] [&_input]:bg-[var(--solid)] [&_input]:p-[0_8px] [&_input]:text-[var(--text)] [&_input]:text-[12px] grid gap-[9px] [border-top:1px_solid_var(--stroke)] [padding-top:10px]`,children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-3`,children:[(0,G.jsxs)(`label`,{children:[a(`plugins:pluginsPage.defaultLanguage`),(0,G.jsxs)(g,{value:e.language,onChange:t=>n({...e,language:t.target.value}),children:[(0,G.jsx)(`option`,{value:`auto`,children:a(`plugins:pluginsPage.auto`)}),(0,G.jsx)(`option`,{value:`zh-CN`,children:a(`plugins:pluginsPage.simplifiedChinese`)}),(0,G.jsx)(`option`,{value:`en-US`,children:a(`plugins:pluginsPage.english`)})]})]}),(0,G.jsxs)(`label`,{children:[a(`plugins:pluginsPage.safeSearch`),(0,G.jsxs)(g,{value:e.safeSearch,onChange:t=>n({...e,safeSearch:Number(t.target.value)}),children:[(0,G.jsx)(`option`,{value:0,children:a(`plugins:pluginsPage.off`)}),(0,G.jsx)(`option`,{value:1,children:a(`plugins:pluginsPage.moderate`)}),(0,G.jsx)(`option`,{value:2,children:a(`plugins:pluginsPage.strict`)})]})]}),(0,G.jsxs)(`label`,{children:[a(`plugins:pluginsPage.resultCount`),(0,G.jsx)(`input`,{type:`number`,min:`1`,max:`12`,value:e.maxResults,onChange:t=>n({...e,maxResults:Number(t.target.value)})})]})]}),(0,G.jsxs)(N,{type:`button`,variant:`outline`,size:`lg`,className:`justify-self-end bg-surface-subtle`,disabled:t,onClick:i,children:[t?(0,G.jsx)(O,{className:`animate-spin`,size:14}):(0,G.jsx)(b,{size:14}),a(t?`plugins:pluginsPage.testing`:`plugins:pluginsPage.testConnection`)]})]})}function it({query:e,notify:t,requestText:n,requestConfirm:i}){let{t:a}=r(),[o,s]=(0,W.useState)(``),[c,l]=(0,W.useState)(null),[u,d]=(0,W.useState)([]),[f,p]=(0,W.useState)(!1),[m,h]=(0,W.useState)(``),[g,_]=(0,W.useState)(``),v=(0,W.useCallback)(async(e=``)=>{p(!0),_(``);try{let[t,n]=await Promise.all([M(`/api/extensions/market?name=${encodeURIComponent(e)}`),M(`/api/extensions`)]);l(t),d(n.packages||[])}catch(e){_(e instanceof Error?e.message:String(e))}finally{p(!1)}},[]);(0,W.useEffect)(()=>{v(``)},[v]);let ee=(c?.packages||[]).filter(t=>`${t.name} ${t.description}`.toLowerCase().includes(e.trim().toLowerCase())),y=async e=>{if(await i?.({title:a(`plugins:pluginsPage.installExtension`),message:a(`plugins:pluginsPage.extensionSecurityWarning`,{name:e}),confirmLabel:a(`plugins:pluginsPage.installExtension`),tone:`danger`})!==!1){h(e);try{let n=/^(?:[.~\\/]|[A-Za-z]:[\\/])/.test(e)||/^(?:npm:|https?:\/\/|git\+)/i.test(e)?e:`npm:${e}`,r=await M(`/api/extensions/install`,{method:`POST`,body:JSON.stringify({source:n})});d(r.packages||[]),t(a(`plugins:pluginsPage.extensionInstalled`),`success`)}catch(e){t(e instanceof Error?e.message:String(e),`error`)}finally{h(``)}}},b=async()=>{let e=await n?.({title:a(`plugins:pluginsPage.installExtension`),message:a(`plugins:pluginsPage.extensionSourceHelp`),inputLabel:a(`plugins:pluginsPage.extensionSource`),placeholder:`npm:@scope/package or https://github.com/…`,maxLength:2e3});e?.trim()&&await y(e.trim())},S=async e=>{if(await i?.({title:a(`plugins:pluginsPage.uninstallExtension`),message:a(`plugins:pluginsPage.uninstallExtensionDescription`,{name:e.name}),confirmLabel:a(`plugins:pluginsPage.uninstallExtension`),tone:`danger`})!==!1){h(e.source);try{await M(`/api/extensions`,{method:`DELETE`,body:JSON.stringify({source:e.source,scope:e.scope})}),await v(o),t(a(`plugins:pluginsPage.extensionUninstalled`),`success`)}catch(e){t(e instanceof Error?e.message:String(e),`error`)}finally{h(``)}}},C=qe.map(e=>({type:e,items:u.filter(t=>Je(t).includes(e))})).filter(e=>e.items.length>0);return(0,G.jsxs)(`section`,{className:`plugin-market grid gap-[10px] border-t border-[var(--stroke)] pt-[14px]`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-[10px]`,children:[(0,G.jsx)(`h2`,{className:`m-0 text-[14px] font-[650]`,children:a(`plugins:pluginsPage.extensionMarket`)}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsxs)(N,{type:`button`,variant:`outline`,size:`lg`,onClick:b,disabled:!!m,children:[(0,G.jsx)(X,{size:14}),a(`plugins:pluginsPage.installExtension`)]}),(0,G.jsxs)(`a`,{className:`inline-flex h-[34px] items-center gap-1 rounded-[var(--r-xs)] border border-[var(--stroke)] px-2 text-[12px] text-[var(--text-soft)] no-underline hover:bg-[var(--surface-hover)]`,href:`https://pi.dev/packages`,target:`_blank`,rel:`noreferrer`,children:[(0,G.jsx)(x,{size:13}),a(`plugins:pluginsPage.openPackageCatalog`)]})]})]}),(0,G.jsxs)(`form`,{className:`flex min-w-0 gap-2`,onSubmit:e=>{e.preventDefault(),v(o)},children:[(0,G.jsx)(`input`,{className:`h-[34px] min-w-0 flex-1 rounded-[var(--r-xs)] border border-[var(--stroke)] bg-[var(--solid)] px-2 text-[12px] text-[var(--text)]`,value:o,onChange:e=>s(e.target.value),placeholder:a(`plugins:pluginsPage.searchPackageCatalog`),"aria-label":a(`plugins:pluginsPage.searchPackageCatalog`)}),(0,G.jsxs)(N,{type:`submit`,variant:`outline`,size:`lg`,disabled:f,children:[f?(0,G.jsx)(O,{className:`animate-spin`,size:14}):(0,G.jsx)(k,{size:14}),a(`plugins:pluginsPage.search`)]})]}),g&&(0,G.jsx)(`p`,{className:`m-0 text-[12px] text-[var(--danger)]`,children:g}),C.length>0&&(0,G.jsxs)(`div`,{className:`grid gap-2`,children:[(0,G.jsx)(`h3`,{className:`m-0 text-[12px] font-[650] text-[var(--text-secondary)]`,children:a(`plugins:pluginsPage.installedExtensions`)}),C.map(e=>(0,G.jsxs)(`section`,{className:`grid gap-1`,children:[(0,G.jsx)(`h4`,{className:`m-0 text-[11px] font-[650] text-[var(--text-muted)]`,children:Ye(e.type,a)}),e.items.map(t=>(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-2 border-t border-[var(--stroke-soft)] py-2`,children:[(0,G.jsxs)(`span`,{className:`min-w-0`,children:[(0,G.jsx)(`strong`,{className:`block overflow-hidden text-ellipsis whitespace-nowrap text-[12px]`,children:t.name}),(0,G.jsxs)(`small`,{className:`block overflow-hidden text-ellipsis whitespace-nowrap text-[11px] text-[var(--text-muted)]`,children:[t.source,` · v`,t.version]})]}),(0,G.jsxs)(N,{type:`button`,variant:`ghost`,size:`sm`,disabled:!!m,onClick:()=>void S(t),children:[m===t.source?(0,G.jsx)(D,{className:`animate-spin`,size:13}):(0,G.jsx)(ne,{size:13}),a(`plugins:pluginsPage.uninstallExtension`)]})]},`${e.type}:${t.scope}:${t.source}`))]},e.type))]}),(0,G.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(230px,1fr))] gap-2`,children:ee.slice(0,12).map(e=>{let t=u.some(t=>t.name===e.name||t.source===`npm:${e.name}`);return(0,G.jsxs)(`article`,{className:`grid min-w-0 gap-2 rounded-[var(--r-xs)] border border-[var(--stroke)] bg-[var(--solid)] p-2`,children:[(0,G.jsx)(`strong`,{className:`overflow-hidden text-ellipsis whitespace-nowrap text-[12px]`,title:e.name,children:e.name}),(0,G.jsx)(`p`,{className:`m-0 line-clamp-3 min-h-[45px] text-[11px] leading-[1.45] text-[var(--text-secondary)]`,children:e.description}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsx)(`small`,{className:`text-[10px] text-[var(--text-muted)]`,children:e.published}),(0,G.jsxs)(N,{type:`button`,size:`sm`,disabled:t||!!m,onClick:()=>void y(e.name),children:[m===e.name&&(0,G.jsx)(D,{className:`animate-spin`,size:13}),a(t?`plugins:pluginsPage.installed`:`plugins:pluginsPage.installExtension`)]})]})]},e.name)})})]})}function at({query:e=``,notify:t,registerPrimaryAction:n,requestText:i,requestConfirm:a}){let{t:o}=r(),s=ce(e=>e.capabilities),c=se(s,`plugins`),l=c?Xe:Xe.slice(0,2),[u,d]=(0,W.useState)(null),[f,p]=(0,W.useState)([]),[m,h]=(0,W.useState)(``),[g,_]=(0,W.useState)(`all`),[v,y]=(0,W.useState)({provider:`bing`,language:`auto`,safeSearch:1,maxResults:8}),[b,x]=(0,W.useState)(!1),[S,w]=(0,W.useState)(!1),[T,E]=(0,W.useState)(!1),[k,A]=(0,W.useState)(null),[P,F]=(0,W.useState)(!1),[I,L]=(0,W.useState)(``),R=(0,W.useCallback)(e=>{d(e),p(e.plugins),y(e.webSearch)},[]),z=(0,W.useCallback)(async()=>{L(``);try{R(await M(`/api/plugins`))}catch(e){L(e instanceof Error?e.message:String(e))}},[R]);(0,W.useEffect)(()=>{z()},[z]);let V=(0,W.useMemo)(()=>$e(f),[f]),H=(0,W.useMemo)(()=>Qe(f),[f]),U=u?!nt(H,u.enabledTools)||et(f)!==u.computerUseEnabled||JSON.stringify(tt(f))!==JSON.stringify(u.piExtensions)||JSON.stringify(v)!==JSON.stringify(u.webSearch):!1,me=(0,W.useCallback)(async()=>{if(!b){if(!u||!U){u&&t(o(`plugins:pluginsPage.noPluginPolicyChanges`));return}x(!0),L(``);try{let e=await M(`/api/plugins`,{method:`PUT`,body:JSON.stringify({enabledTools:H,webSearch:v,computerUseEnabled:et(f),piExtensions:tt(f)})});R(e),t(o(`plugins:pluginsPage.pluginPolicySavedAgentRuntimeUpdated`))}catch(e){L(e instanceof Error?e.message:String(e))}finally{x(!1)}}},[R,u,U,f,H,t,b,o,v]);le(n,me);let he=async()=>{w(!0),L(``);try{let e=await M(`/api/plugins/web-search/test`,{method:`POST`,body:JSON.stringify(v)});t(o(`plugins:pluginsPage.bingSearchIsAvailableAndReturnedCountResults`,{count:e.count}))}catch(e){let n=e instanceof Error?e.message:String(e);L(n),t(n,`error`)}finally{w(!1)}},K=(e,t,n)=>{p(r=>r.map(r=>{if(r.id!==e)return r;let i=r.source===`pi`&&r.managedExternally;return{...r,enabled:n||r.capabilities.some(e=>e.enabled),capabilities:r.capabilities.map(e=>i||e.name===t?{...e,enabled:n}:e)}}))},q=()=>!U||(L(o(`plugins:pluginsPage.saveBeforePluginChanges`)),!1),ge=async()=>{if(!(!k||P)){F(!0),L(``);try{R(await M(`/api/plugins/${encodeURIComponent(k.pluginId)}`,{method:`DELETE`})),t(o(`plugins:pluginsPage.pluginUninstalled`,{name:k.pluginName})),h(``),A(null)}catch(e){L(e instanceof Error?e.message:String(e))}finally{F(!1)}}};if(!u)return(0,G.jsxs)(ae,{children:[(0,G.jsx)(O,{className:`animate-spin`,size:24}),(0,G.jsx)(`h2`,{children:o(`plugins:pluginsPage.loadingToolPlugins`)}),I&&(0,G.jsxs)(B,{children:[(0,G.jsx)(j,{size:13}),I]})]});let J=e.trim().toLowerCase(),Y=V.filter(e=>g!==`all`&&e.pluginSource!==g?!1:[Q(e,o),e.name,e.description,$(e,o),e.pluginId].join(` `).toLowerCase().includes(J));return(0,G.jsxs)(`div`,{className:`plugins-page flex min-h-[100%] flex-col gap-[12px] max-[900px]:h-auto h-full min-h-0 overflow-y-auto [scrollbar-gutter:stable]`,children:[(0,G.jsxs)(`div`,{className:`plugin-toolbar max-[650px]:items-stretch max-[650px]:flex-col flex items-center justify-between gap-[12px]`,children:[(0,G.jsx)(re,{options:l.map(e=>Z(e,o)),value:Z(g,o),onChange:e=>_(l.find(t=>Z(t,o)===e)||`all`)}),(0,G.jsx)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:c&&(0,G.jsxs)(N,{type:`button`,variant:`outline`,size:`lg`,className:`bg-surface-subtle`,onClick:()=>q()&&E(!0),children:[(0,G.jsx)(X,{size:15}),o(`plugins:pluginsPage.installPlugin`)]})})]}),(0,G.jsxs)(`div`,{className:`plugin-catalog-heading [&_>_span]:flex [&_>_span]:items-center [&_>_span]:gap-[7px] [&_strong]:text-[13px] [&_small]:text-[var(--text-secondary)] [&_small]:text-[12px] [&_small]:[font-variant-numeric:tabular-nums] max-[650px]:items-start flex items-center justify-between gap-[12px] [padding:2px]`,children:[(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`strong`,{children:o(`plugins:pluginsPage.toolCatalog`)}),(0,G.jsx)(`small`,{children:Y.length})]}),(0,G.jsxs)(`span`,{className:`plugin-catalog-summary text-[var(--text-secondary)] text-[12px] [font-variant-numeric:tabular-nums] [&_>_i]:w-[7px] [&_>_i]:h-[7px] [&_>_i]:rounded-[50%] [&_>_i]:bg-[var(--status-green)] max-[650px]:flex-wrap max-[650px]:justify-end`,children:[(0,G.jsx)(`i`,{}),V.filter(e=>e.enabled).length,`/`,V.length,` `,o(`plugins:pluginsPage.enabled2`),U&&(0,G.jsx)(ie,{tone:`amber`,children:o(`plugins:pluginsPage.unsaved`)})]})]}),Y.length?(0,G.jsx)(`div`,{className:`plugin-tool-grid max-[650px]:grid-cols-[minmax(0,1fr)] grid grid-cols-[repeat(auto-fill,minmax(310px,1fr))] [align-items:start] gap-[10px] [padding-bottom:4px]`,children:Y.map(e=>{let t=m===e.name,n=Ze[e.name]||te;return(0,G.jsxs)(`article`,{className:`plugin-tool-card [&[data-open]]:border-[var(--stroke-hover)] [&[data-open]]:shadow-[var(--sh-1)] min-w-0 overflow-hidden [border:1px_solid_var(--stroke)] rounded-[var(--r-sm)] bg-[var(--solid)]`,"data-open":t||void 0,children:[(0,G.jsxs)(`div`,{className:`plugin-tool-card-head hover:bg-[var(--surface-hover)] [.plugin-tool-card[data-open]_>_&]:bg-[var(--surface-hover)] max-[650px]:grid-cols-[minmax(0,1fr)_auto] max-[650px]:[padding-inline:8px] grid min-h-[56px] grid-cols-[minmax(0,1fr)_auto] items-center gap-[10px] [padding:7px_10px]`,children:[(0,G.jsxs)(`button`,{type:`button`,className:`grid min-w-0 h-full grid-cols-[32px_minmax(0,1fr)] items-center gap-[9px] border-0 bg-transparent p-0 text-inherit text-left`,"aria-expanded":t,onClick:()=>h(t=>t===e.name?``:e.name),children:[(0,G.jsx)(`span`,{className:`grid w-[32px] h-[32px] place-items-center rounded-[var(--r-xs)] bg-[var(--surface-muted)] text-[var(--text-soft)]`,children:(0,G.jsx)(n,{size:15})}),(0,G.jsxs)(`span`,{className:`plugin-tool-title [&_strong]:overflow-hidden [&_strong]:text-ellipsis [&_strong]:whitespace-nowrap [&_small]:overflow-hidden [&_small]:text-ellipsis [&_small]:whitespace-nowrap [&_strong]:text-[13px] [&_small]:text-[var(--text-muted)] [&_small]:text-[11px] flex min-w-0 flex-col gap-[2px]`,children:[(0,G.jsx)(`strong`,{title:Q(e,o),children:Q(e,o)}),(0,G.jsx)(`small`,{children:$(e,o)})]})]}),(0,G.jsxs)(`span`,{className:`plugin-tool-trailing [&_>_i]:w-[7px] [&_>_i]:h-[7px] [&_>_i]:rounded-[50%] [&_>_i]:bg-[var(--status-muted)] [&_>_i[data-enabled]]:bg-[var(--status-green)] max-[650px]:gap-[5px] inline-flex items-center gap-[7px]`,children:[(0,G.jsx)(`i`,{"data-enabled":e.enabled||void 0}),!e.pluginBuiltIn&&(0,G.jsx)(ie,{tone:`amber`,children:o(`plugins:pluginsPage.local`)}),(0,G.jsx)(oe,{value:e.enabled,onChange:t=>K(e.pluginId,e.name,t),ariaLabel:Q(e,o)}),(0,G.jsx)(`button`,{type:`button`,className:`plugin-tool-chevron hover:bg-[var(--surface-muted)] hover:text-[var(--text)] [&_svg]:[transition:transform_var(--d1)_var(--ease-out)] [&[aria-expanded='true']_svg]:[transform:rotate(180deg)] grid w-[24px] h-[24px] place-items-center border-0 rounded-[var(--r-xs)] bg-transparent text-[var(--text-muted)]`,"aria-label":o(`plugins:pluginsPage.toggleToolDetails`,{name:Q(e,o)}),"aria-expanded":t,onClick:()=>h(t=>t===e.name?``:e.name),children:(0,G.jsx)(ee,{size:14})})]})]}),t&&(0,G.jsxs)(`div`,{className:`plugin-tool-details [&_>_p]:m-0 [&_>_p]:text-[var(--text-soft)] [&_>_p]:text-[12px] [&_>_p]:leading-[1.55] [&_>_code]:[overflow-wrap:anywhere] [&_>_code]:text-[var(--text)] [&_>_code]:text-[11px] [&_dl]:grid [&_dl]:grid-cols-[78px_minmax(0,1fr)] [&_dl]:gap-[6px_10px] [&_dl]:m-0 [&_dl_div]:[display:contents] [&_dt]:text-[var(--text-muted)] [&_dt]:text-[11px] [&_dd]:min-w-0 [&_dd]:m-0 [&_dd]:[overflow-wrap:anywhere] [&_dd]:text-[var(--text-soft)] [&_dd]:text-[12px] max-[650px]:[&_dl]:grid-cols-[68px_minmax(0,1fr)] grid gap-[9px] [border-top:1px_solid_var(--stroke)] bg-[var(--surface-subtle)] [padding:11px_13px_13px]`,children:[(0,G.jsx)(`p`,{children:fe({id:e.name,description:e.description},o)}),(0,G.jsx)(`code`,{children:e.name}),(0,G.jsxs)(`dl`,{children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:o(`plugins:pluginsPage.source`)}),(0,G.jsxs)(`dd`,{children:[$(e,o),!e.pluginBuiltIn&&` · v${e.pluginVersion}`]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:o(`plugins:pluginsPage.riskLevel`)}),(0,G.jsx)(`dd`,{className:pe(e.risk)?`text-[var(--danger)]`:``,children:ue(e.risk,o)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:o(`plugins:pluginsPage.pathScope`)}),(0,G.jsx)(`dd`,{children:de({id:e.name,scope:e.scope},o)})]}),!e.pluginBuiltIn&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:o(`plugins:pluginsPage.executionMode`)}),(0,G.jsx)(`dd`,{children:o(`plugins:pluginsPage.fullAccessOnly`)})]})]}),!e.pluginBuiltIn&&(0,G.jsxs)(`div`,{className:`plugin-tool-warning [&_svg]:flex-none [&_svg]:mt-[1px] flex items-start gap-[7px] rounded-[var(--r-xs)] bg-[var(--warning-soft)] [padding:8px] text-[var(--warning-strong)] text-[11px] leading-[1.5]`,children:[(0,G.jsx)(C,{size:14}),(0,G.jsx)(`span`,{children:o(`plugins:pluginsPage.localPluginSecurityWarning`)})]}),e.name===`web_search`&&(0,G.jsx)(rt,{value:v,testing:S,onChange:y,onTest:he}),!e.pluginBuiltIn&&(0,G.jsxs)(N,{type:`button`,variant:`destructive`,size:`lg`,className:`[justify-self:end]`,onClick:()=>q()&&A(e),children:[(0,G.jsx)(ne,{size:14}),o(`plugins:pluginsPage.uninstallPlugin`)]})]})]},e.name)})}):(0,G.jsx)(`div`,{className:`plugin-empty [&.compact]:min-h-[90px] grid min-h-[180px] place-items-center text-[var(--text-secondary)] text-[12px]`,children:o(`plugins:pluginsPage.noMatchingTools`)}),(0,G.jsx)(it,{query:e,notify:t,requestText:i,requestConfirm:a}),c&&(0,G.jsx)(Ke,{open:T,onOpenChange:E,onInstalled:z}),(0,G.jsx)(Fe,{open:!!k,onOpenChange:e=>!e&&!P&&A(null),children:(0,G.jsxs)(Re,{className:`z-[220]`,children:[(0,G.jsxs)(ze,{children:[(0,G.jsx)(Ve,{children:o(`plugins:pluginsPage.uninstallPlugin`)}),(0,G.jsx)(He,{children:o(`plugins:pluginsPage.uninstallPluginDescription`,{name:k?.pluginName||``})})]}),(0,G.jsxs)(Be,{children:[(0,G.jsx)(We,{disabled:P,children:o(`common:ui.cancel`)}),(0,G.jsxs)(Ue,{variant:`destructive`,disabled:P,onClick:ge,children:[P&&(0,G.jsx)(D,{className:`animate-spin`,size:14}),o(`plugins:pluginsPage.uninstallPlugin`)]})]})]})}),I&&(0,G.jsxs)(B,{className:`fixed z-[21] [right:24px] [bottom:24px] max-w-[360px] shadow-[0_12px_28px_-18px_var(--floating-shadow)]`,children:[(0,G.jsx)(j,{size:13}),I]})]})}export{at as PluginsPage};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";var r=e(t(),1),i=n(),a=r.createContext(void 0),o=e=>{let t=r.useContext(a);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},s=({client:e,children:t})=>(r.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,i.jsx)(a.Provider,{value:e,children:t}));export{o as n,s as t};
@@ -1 +1 @@
1
- import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-BSZKFkMb.js";import{t as n}from"./createLucideIcon-Cd-3GVxJ.js";import{t as r}from"./code-xml-BrUXrBax.js";import{t as i}from"./file-text-N9JICX6E.js";import{t as a}from"./flask-conical-DhW5v7Zz.js";import{t as o}from"./list-checks-B5Jl4aiO.js";import{t as s}from"./wand-sparkles-DdQneChm.js";var c=n(`bug`,[[`path`,{d:`M12 20v-9`,key:`1qisl0`}],[`path`,{d:`M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z`,key:`uouzyp`}],[`path`,{d:`M14.12 3.88 16 2`,key:`qol33r`}],[`path`,{d:`M21 21a4 4 0 0 0-3.81-4`,key:`1b0z45`}],[`path`,{d:`M21 5a4 4 0 0 1-3.55 3.97`,key:`5cxbf6`}],[`path`,{d:`M22 13h-4`,key:`1jl80f`}],[`path`,{d:`M3 21a4 4 0 0 1 3.81-4`,key:`1fjd4g`}],[`path`,{d:`M3 5a4 4 0 0 0 3.55 3.97`,key:`1d7oge`}],[`path`,{d:`M6 13H2`,key:`82j7cp`}],[`path`,{d:`m8 2 1.88 1.88`,key:`fmnt4t`}],[`path`,{d:`M9 7.13V6a3 3 0 1 1 6 0v1.13`,key:`1vgav8`}]]),l=n(`layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),u=n(`search-check`,[[`path`,{d:`m8 11 2 2 4-4`,key:`1sed1v`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]),d=e();function f(e,t){return[{icon:r,label:e(`chat:focusSession.explainCode`),prompt:e(`chat:focusSession.explainHowThisCodeWorks`)},{icon:a,label:e(`chat:focusSession.writeTests`),prompt:e(`chat:focusSession.writeUnitTestsForTheFollowingCode`)},{icon:s,label:e(`chat:focusSession.refactor`),prompt:e(`chat:focusSession.refactorThisCodeAndExplainTheImprovements`)},{icon:c,label:e(`chat:focusSession.findABug`),prompt:e(`chat:focusSession.helpMeLocateAndFixThisBug`)},{icon:i,label:e(`chat:focusSession.summarize`),prompt:e(`chat:focusSession.summarizeContentAndExtractKeyPoints`)},...t?[{icon:o,label:e(`chat:focusSession.makeAPlan`),prompt:e(`chat:focusSession.makeAClearActionablePlanForThisGoal`)}]:[],{icon:l,label:e(`chat:focusSession.organizeInformation`),prompt:e(`chat:focusSession.organizeThisInformationIntoAClearStructure`)},{icon:u,label:e(`chat:focusSession.findIssues`),prompt:e(`chat:focusSession.reviewThisContentAndSuggestImprovements`)}]}function p({plansAvailable:e,onPromptSelect:n}){let{t:r}=t();return(0,d.jsxs)(`section`,{"aria-label":r(`chat:focusSession.promptIdeas`),className:`pt-3 text-center text-xs text-muted-foreground`,children:[(0,d.jsx)(`p`,{className:`mb-2`,children:r(`chat:focusSession.promptIdeas`)}),(0,d.jsx)(`div`,{className:`welcome-chips mx-auto flex max-w-[560px] flex-wrap justify-center gap-2 pt-2`,children:f(r,e).map(e=>(0,d.jsxs)(`button`,{type:`button`,"data-target-cursor":!0,onClick:()=>n(e.prompt),className:`inline-flex min-h-9 items-center gap-2 rounded-lg border border-border/70 bg-card px-3 text-xs font-medium text-foreground transition-colors hover:bg-muted hover:text-foreground`,children:[(0,d.jsx)(e.icon,{size:14,className:`text-foreground`}),e.label]},e.label))})]})}export{p as default};
1
+ import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-a84Zp9dV.js";import{t as n}from"./createLucideIcon-Cd-3GVxJ.js";import{t as r}from"./code-xml-BrUXrBax.js";import{t as i}from"./file-text-N9JICX6E.js";import{t as a}from"./flask-conical-DhW5v7Zz.js";import{t as o}from"./list-checks-B5Jl4aiO.js";import{t as s}from"./wand-sparkles-DdQneChm.js";var c=n(`bug`,[[`path`,{d:`M12 20v-9`,key:`1qisl0`}],[`path`,{d:`M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z`,key:`uouzyp`}],[`path`,{d:`M14.12 3.88 16 2`,key:`qol33r`}],[`path`,{d:`M21 21a4 4 0 0 0-3.81-4`,key:`1b0z45`}],[`path`,{d:`M21 5a4 4 0 0 1-3.55 3.97`,key:`5cxbf6`}],[`path`,{d:`M22 13h-4`,key:`1jl80f`}],[`path`,{d:`M3 21a4 4 0 0 1 3.81-4`,key:`1fjd4g`}],[`path`,{d:`M3 5a4 4 0 0 0 3.55 3.97`,key:`1d7oge`}],[`path`,{d:`M6 13H2`,key:`82j7cp`}],[`path`,{d:`m8 2 1.88 1.88`,key:`fmnt4t`}],[`path`,{d:`M9 7.13V6a3 3 0 1 1 6 0v1.13`,key:`1vgav8`}]]),l=n(`layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),u=n(`search-check`,[[`path`,{d:`m8 11 2 2 4-4`,key:`1sed1v`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]),d=e();function f(e,t){return[{icon:r,label:e(`chat:focusSession.explainCode`),prompt:e(`chat:focusSession.explainHowThisCodeWorks`)},{icon:a,label:e(`chat:focusSession.writeTests`),prompt:e(`chat:focusSession.writeUnitTestsForTheFollowingCode`)},{icon:s,label:e(`chat:focusSession.refactor`),prompt:e(`chat:focusSession.refactorThisCodeAndExplainTheImprovements`)},{icon:c,label:e(`chat:focusSession.findABug`),prompt:e(`chat:focusSession.helpMeLocateAndFixThisBug`)},{icon:i,label:e(`chat:focusSession.summarize`),prompt:e(`chat:focusSession.summarizeContentAndExtractKeyPoints`)},...t?[{icon:o,label:e(`chat:focusSession.makeAPlan`),prompt:e(`chat:focusSession.makeAClearActionablePlanForThisGoal`)}]:[],{icon:l,label:e(`chat:focusSession.organizeInformation`),prompt:e(`chat:focusSession.organizeThisInformationIntoAClearStructure`)},{icon:u,label:e(`chat:focusSession.findIssues`),prompt:e(`chat:focusSession.reviewThisContentAndSuggestImprovements`)}]}function p({plansAvailable:e,onPromptSelect:n}){let{t:r}=t();return(0,d.jsxs)(`section`,{"aria-label":r(`chat:focusSession.promptIdeas`),className:`pt-3 text-center text-xs text-muted-foreground`,children:[(0,d.jsx)(`p`,{className:`mb-2`,children:r(`chat:focusSession.promptIdeas`)}),(0,d.jsx)(`div`,{className:`welcome-chips mx-auto flex max-w-[560px] flex-wrap justify-center gap-2 pt-2`,children:f(r,e).map(e=>(0,d.jsxs)(`button`,{type:`button`,"data-target-cursor":!0,onClick:()=>n(e.prompt),className:`inline-flex min-h-9 items-center gap-2 rounded-full border border-border bg-background px-3 text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,children:[(0,d.jsx)(e.icon,{size:14,className:`text-muted-foreground`}),e.label]},e.label))})]})}export{p as default};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-a84Zp9dV.js";import{t as i}from"./AppSelect-BCexz4Ty.js";import{t as a}from"./bell-BjONAtgH.js";import{t as o}from"./bot-B3TaBp_T.js";import{t as s}from"./circle-check-iEdCm3Pw.js";import{t as c}from"./folder-open-FIShC5Qk.js";import{t as l}from"./message-circle-D-XrK6Ft.js";import{t as u}from"./play-DNDjDNGn.js";import{t as d}from"./plus-fQbSqB1n.js";import{t as f}from"./refresh-cw-TbWxTY4K.js";import{t as p}from"./send-Cj-W03w_.js";import{t as m}from"./trash-2-CNrPOoPR.js";import{t as h}from"./triangle-alert-CE1q54ci.js";import{t as g}from"./x-07u4-129.js";import{t as _}from"./api-YI8_cHpR.js";import{t as v}from"./button-CQA36izu.js";import{WorkspacePicker as y}from"./WorkspacePicker-B3liZkwe.js";import{t as b}from"./field-3bN8nouy.js";import{r as x}from"./format-BRFKAYMT.js";import{i as S,l as C,n as w,o as T,r as E,s as D,t as O}from"./app-primitives-SxfoFmHc.js";import{t as k}from"./StarOrbit-BAAjh-hY.js";import{t as A}from"./usePagePrimaryAction-CWPC0C_f.js";import{n as j,t as M}from"./pick-system-directory-BnIFt85A.js";var N=e(t(),1),P=n(),F={browser:{name:`通知`,Icon:a},feishu:{name:`飞书`,Icon:o},weixin:{name:`微信`,Icon:l},qq:{name:`QQ`,Icon:l},telegram:{name:`Telegram`,Icon:p}},ee={interval:`每隔一段时间`,daily:`每天`,weekly:`每周`,monthly:`每月`},te={minutes:`分钟`,hours:`小时`,days:`天`},ne=[...new Set([`Asia/Hong_Kong`,`UTC`,...typeof Intl.supportedValuesOf==`function`?Intl.supportedValuesOf(`timeZone`):[]])],I=[`full-access`];function L(e){return e(`schedules:schedulesPage.fullAccessHelp`)}function re(e,t){return t(e===`daily`?`schedules:schedulesPage.daily`:e===`weekly`?`schedules:schedulesPage.weekly`:e===`monthly`?`schedules:schedulesPage.monthly`:`schedules:schedulesPage.atIntervals`)}function ie(e,t){return t(e===`hours`?`schedules:schedulesPage.hours`:e===`days`?`schedules:schedulesPage.days`:`schedules:schedulesPage.minutes`)}function R(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 z({value:e,onChange:t}){let{t:n}=r();return(0,P.jsxs)(b,{variant:`control`,children:[n(`schedules:schedulesPage.executionMode`),(0,P.jsx)(i,{value:e,onChange:e=>t(e.target.value),children:I.map(e=>(0,P.jsx)(`option`,{value:e,children:n(`schedules:schedulesPage.fullAccess`)},e))}),(0,P.jsx)(`small`,{children:L(n)})]})}function B(e){return Object.fromEntries((e?.inputs||[]).map(e=>[e.name,e.defaultValue??``]))}function V(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 H({targetType:e,prompt:t,workflowId:n,workflowInputs:a,workflows:o,onChange:s}){let{t:c}=r(),l=o.find(e=>e.id===n);return(0,P.jsxs)(`div`,{className:`grid gap-[10px]`,children:[(0,P.jsxs)(b,{variant:`control`,children:[c(`schedules:schedulesPage.executionTarget`),(0,P.jsxs)(i,{value:e,onChange:e=>{let t=e.target.value,r=o[0];s(t===`workflow`?{targetType:t,workflowId:n||r?.id||``,workflowInputs:n?a:B(r)}:{targetType:t})},children:[(0,P.jsx)(`option`,{value:`prompt`,children:`Prompt`}),(0,P.jsx)(`option`,{value:`workflow`,children:c(`schedules:schedulesPage.workflow`)})]})]}),e===`prompt`?(0,P.jsxs)(b,{variant:`control`,children:[`Prompt`,(0,P.jsx)(`textarea`,{value:t,onChange:e=>s({prompt:e.target.value}),placeholder:c(`schedules:schedulesPage.describeTheWorkTheAgentShouldCompleteEachTime`)})]}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(b,{variant:`control`,children:[c(`schedules:schedulesPage.workflow`),(0,P.jsxs)(i,{value:n,onChange:e=>{let t=o.find(t=>t.id===e.target.value);s({workflowId:e.target.value,workflowInputs:B(t)})},children:[(0,P.jsx)(`option`,{value:``,children:c(`schedules:schedulesPage.selectPublishedWorkflow`)}),o.map(e=>(0,P.jsxs)(`option`,{value:e.id,children:[e.name,` · v`,e.revision]},e.id))]}),(0,P.jsx)(`small`,{children:l?.description||(o.length?c(`schedules:schedulesPage.workflowUsesItsOwnRuntimeSettings`):c(`schedules:schedulesPage.noPublishedWorkflows`))})]}),l?.inputs.length?(0,P.jsxs)(`div`,{className:`grid gap-[8px]`,children:[(0,P.jsxs)(`div`,{className:`schedule-workflow-inputs-heading [&_strong]:text-[12px] [&_small]:text-[var(--text-muted)] [&_small]:text-[11px] [&_small]:text-right max-[650px]:items-start max-[650px]:flex-col max-[650px]:gap-[2px] max-[650px]:[&_small]:text-left flex [align-items:baseline] justify-between gap-[12px]`,children:[(0,P.jsx)(`strong`,{children:c(`schedules:schedulesPage.workflowInputs`)}),(0,P.jsx)(`small`,{children:c(`schedules:schedulesPage.workflowInputsHelp`)})]}),(0,P.jsx)(`div`,{className:`schedule-workflow-inputs [&_input[type='checkbox']]:w-[16px] [&_input[type='checkbox']]:h-[16px] [&_input[type='checkbox']]:[justify-self:end] max-[650px]:grid-cols-[1fr] grid grid-cols-[repeat(2,minmax(0,1fr))] gap-[8px]`,children:l.inputs.map(e=>(0,P.jsxs)(b,{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,P.jsx)(`input`,{type:`checkbox`,checked:!!a[e.name],onChange:t=>s({workflowInputs:{...a,[e.name]:t.target.checked}})}):(0,P.jsx)(`input`,{type:e.type===`number`?`number`:`text`,required:e.required,value:String(a[e.name]??``),onChange:t=>s({workflowInputs:{...a,[e.name]:t.target.value}})}),e.description&&(0,P.jsx)(`small`,{children:e.description})]},e.id))})]}):null]})]})}function U({value:e,onChange:t}){let{t:n}=r(),[i,a]=(0,N.useState)(``),[o,s]=(0,N.useState)(!1),l=async()=>{if(a(``),!M()){s(!0);return}try{let n=await j(e);n&&t(n)}catch(e){a(e instanceof Error?e.message:String(e))}};return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(b,{variant:`control`,children:[n(`schedules:schedulesPage.workingDirectory`),(0,P.jsxs)(`span`,{className:`schedule-workspace-input [&_input]:min-w-0 [&_input]:font-[ui-monospace,_SFMono-Regular,_Consolas,_'Liberation_Mono',_monospace] grid grid-cols-[minmax(0,1fr)_auto] gap-[6px]`,children:[(0,P.jsx)(`input`,{value:e,onChange:e=>t(e.target.value),placeholder:n(`schedules:schedulesPage.enterTheProjectSAbsolutePath`)}),(0,P.jsxs)(v,{type:`button`,variant:`outline`,size:`lg`,className:`bg-surface-subtle`,onClick:()=>void l(),children:[(0,P.jsx)(c,{size:13}),n(`schedules:schedulesPage.browseDirectories`)]})]}),(0,P.jsx)(`small`,{children:n(`schedules:schedulesPage.theScheduledAgentWillRunInThisDirectory`)})]}),i&&(0,P.jsxs)(S,{children:[(0,P.jsx)(h,{size:13}),i]}),(0,P.jsx)(y,{open:o,initialPath:e,description:n(`common:workspacePicker.selectWorkspaceForSchedule`),onOpenChange:s,onSelect:e=>t(e)})]})}function W(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 G(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 K({notify:e,registerPrimaryAction:t,openNotificationSettings:n,requestConfirm:a}){let{t:o,language:c}=r(),[l,d]=(0,N.useState)({tasks:[],runs:[],notificationTargets:{browser:{enabled:!1},feishu:{enabled:!1},weixin:{enabled:!1},qq:{enabled:!1},telegram:{enabled:!1}},workflows:[],defaultCwd:``}),[p,g]=(0,N.useState)(``),[y,j]=(0,N.useState)(null),[M,I]=(0,N.useState)(!0),[L,B]=(0,N.useState)(!1),[K,Y]=(0,N.useState)(``),[ae,oe]=(0,N.useState)(!1);A(t,()=>oe(!0));let X=(0,N.useCallback)(async()=>{try{let e=await _(`/api/schedules`);d(e),g(t=>e.tasks.some(e=>e.id===t)?t:e.tasks[0]?.id||``)}catch(e){Y(e instanceof Error?e.message:String(e))}finally{I(!1)}},[]);(0,N.useEffect)(()=>{X()},[X]),(0,N.useEffect)(()=>{let e=window.setInterval(X,l.tasks.some(e=>e.lastStatus===`running`)?2e3:1e4);return()=>window.clearInterval(e)},[l.tasks,X]);let Z=l.tasks.find(e=>e.id===p),Q=l.workflows||[];(0,N.useEffect)(()=>{j(e=>Z?e?.id===Z.id?e:W(Z):null)},[Z]);let se=(0,N.useMemo)(()=>l.runs.filter(e=>e.taskId===p).sort((e,t)=>new Date(t.startedAt).getTime()-new Date(e.startedAt).getTime()).slice(0,20),[l.runs,p]),$=e=>j(t=>t&&{...t,...e}),ce=e=>{y&&$({notifications:y.notifications.includes(e)?y.notifications.filter(t=>t!==e):[...y.notifications,e]})};return M?(0,P.jsxs)(E,{children:[(0,P.jsx)(f,{className:`animate-spin`,size:23}),(0,P.jsx)(`h2`,{children:o(`schedules:schedulesPage.loadingScheduledTasks`)})]}):(0,P.jsxs)(P.Fragment,{children:[K&&(0,P.jsxs)(S,{children:[(0,P.jsx)(h,{size:13}),K]}),(0,P.jsxs)(`div`,{className:`split-list-detail grid min-h-[100%] min-w-0 grid-cols-[minmax(0,310px)_minmax(0,1fr)] gap-[12px] overflow-x-hidden max-[900px]:grid-cols-1 max-[650px]:gap-[8px]`,children:[(0,P.jsxs)(O,{className:`selection-list [.config-layout_>_&]:max-h-[calc(100dvh_-_280px)] [.config-layout_>_&]:overflow-y-auto max-[900px]:max-h-[300px] min-h-0 overflow-auto`,children:[(0,P.jsx)(T,{title:o(`schedules:schedulesPage.taskQueue`)}),l.tasks.length?l.tasks.map(e=>(0,P.jsx)(`div`,{className:`schedule-list-item hover:bg-[var(--accent-soft)] [&.active]:bg-[var(--accent-soft)] [&_>_button]:grid [&_>_button]:min-w-0 [&_>_button]:min-h-[68px] [&_>_button]:grid-cols-[minmax(0,1fr)_auto] [&_>_button]:items-center [&_>_button]:gap-[8px] [&_>_button]:border-0 [&_>_button]:bg-transparent [&_>_button]:p-[6px_2px] [&_>_button]:text-left [&_>_button_>_span]:flex [&_>_button_>_span]:min-w-0 [&_>_button_>_span]:flex-col [&_>_button_>_span]:gap-[5px] [&_strong]:overflow-hidden [&_strong]:text-ellipsis [&_strong]:whitespace-nowrap [&_small]:overflow-hidden [&_small]:text-ellipsis [&_small]:whitespace-nowrap [&_strong]:text-[13px] [&_small]:text-[var(--text-muted)] [&_small]:text-[13px] [&_em]:flex [&_em]:items-center [&_em]:gap-[4px] [&_em]:text-[var(--text-muted)] [&_em]:text-[13px] [&_em]:[font-style:normal] grid grid-cols-[minmax(0,1fr)_auto] items-center gap-[5px] [border-top:1px_solid_var(--stroke-soft)] rounded-[var(--r-sm)] [padding:3px_5px] ${p===e.id?`active`:``}`,children:(0,P.jsxs)(`button`,{onClick:()=>g(e.id),children:[(0,P.jsxs)(`span`,{children:[(0,P.jsxs)(`div`,{className:`schedule-item-head [.schedule-list-item_&]:flex [.schedule-list-item_&]:min-w-0 [.schedule-list-item_&]:items-center [.schedule-list-item_&]:gap-[6px] [.schedule-list-item_&_strong]:flex-1 [.schedule-list-item_&_strong]:min-w-0`,children:[(0,P.jsx)(`strong`,{children:e.name}),(0,P.jsx)(C,{tone:e.enabled?`green`:`gray`,children:e.enabled?o(`schedules:schedulesPage.enabled`):o(`schedules:schedulesPage.pause`)})]}),(0,P.jsx)(`small`,{children:e.targetType===`workflow`?Q.find(t=>t.id===e.workflowId)?.name||o(`schedules:schedulesPage.workflowUnavailable`):e.prompt})]}),(0,P.jsx)(`em`,{children:G(e,c)})]})},e.id)):(0,P.jsxs)(`div`,{className:`channel-route-empty [&_strong]:mt-[9px] [&_strong]:text-[var(--text)] [&_strong]:text-[12px] [&_span]:mt-[4px] [&_span]:text-[13px] [&.compact]:min-h-[110px] [.workflow-assets-panel_&]:min-h-[150px] [.workflow-assets-panel_&]:border-0 [.workflow-assets-panel_&]:bg-transparent grid min-h-[185px] place-content-center justify-items-center text-[var(--text-muted)] text-center`,children:[(0,P.jsx)(k,{size:38}),(0,P.jsx)(`strong`,{children:o(`schedules:schedulesPage.theTimelineIsStillUnlit`)}),(0,P.jsx)(`span`,{children:o(`schedules:schedulesPage.createATaskAndLetItSetOutAutomaticallyAtTheAppointedTime`)})]})]}),Z&&y?(0,P.jsxs)(`div`,{className:`detail-stack flex min-w-0 flex-col gap-[12px] [.mcp-layout_>_&]:min-h-0 max-[1150px]:[.memory-layout_>_&]:[grid-column:1/-1] max-[1150px]:[.memory-layout_>_&]:grid max-[1150px]:[.memory-layout_>_&]:grid-cols-[repeat(2,minmax(0,1fr))] max-[1150px]:[.mcp-layout_>_&]:[grid-column:1/-1] max-[1150px]:[.mcp-layout_>_&]:grid max-[1150px]:[.mcp-layout_>_&]:grid-cols-[repeat(2,minmax(0,1fr))] max-[1150px]:[.skills-layout_>_&]:[grid-column:1/-1] max-[1150px]:[.skills-layout_>_&]:grid max-[1150px]:[.skills-layout_>_&]:grid-cols-[repeat(2,minmax(0,1fr))] max-[650px]:[.memory-layout_>_&]:[grid-column:auto] max-[650px]:[.memory-layout_>_&]:grid-cols-[1fr] max-[650px]:[.mcp-layout_>_&]:[grid-column:auto] max-[650px]:[.mcp-layout_>_&]:grid-cols-[1fr] max-[650px]:[.skills-layout_>_&]:[grid-column:auto] max-[650px]:[.skills-layout_>_&]:grid-cols-[1fr]`,children:[(0,P.jsxs)(O,{children:[(0,P.jsxs)(w,{className:`max-[650px]:flex-wrap max-[650px]:items-start`,children:[(0,P.jsx)(`h2`,{className:`min-w-0 break-words`,children:y.name}),(0,P.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-[5px] max-[650px]:w-full`,children:[(0,P.jsx)(D,{value:y.enabled,onChange:e=>$({enabled:e}),ariaLabel:y.name}),(0,P.jsxs)(v,{size:`lg`,disabled:L||Z.lastStatus===`running`,onClick:async()=>{if(Z){B(!0),Y(``);try{await _(`/api/schedules/${encodeURIComponent(Z.id)}/run`,{method:`POST`,body:`{}`}),await X(),e(o(`schedules:schedulesPage.scheduledTaskStarted`))}catch(e){Y(e instanceof Error?e.message:String(e))}finally{B(!1)}}},children:[Z.lastStatus===`running`?(0,P.jsx)(f,{className:`animate-spin`,size:14}):(0,P.jsx)(u,{size:14}),Z.lastStatus===`running`?o(`schedules:schedulesPage.running`):o(`schedules:schedulesPage.runNow`)]}),(0,P.jsx)(v,{variant:`destructive`,size:`icon`,title:o(`schedules:schedulesPage.deleteTask`),"aria-label":o(`schedules:schedulesPage.deleteTask`),onClick:async()=>{if(Z&&await a({title:o(`schedules:schedulesPage.deleteScheduledTask`),message:o(`schedules:schedulesPage.deleteScheduledTaskNameAndItsRunHistory`,{name:Z.name}),confirmLabel:o(`schedules:schedulesPage.delete`)}))try{await _(`/api/schedules/${encodeURIComponent(Z.id)}`,{method:`DELETE`}),await X(),e(o(`schedules:schedulesPage.scheduledTaskDeleted`))}catch(e){Y(e instanceof Error?e.message:String(e))}},children:(0,P.jsx)(m,{size:14})})]})]}),(0,P.jsx)(H,{targetType:y.targetType,prompt:y.prompt,workflowId:y.workflowId,workflowInputs:y.workflowInputs,workflows:Q,onChange:$}),y.targetType===`prompt`&&(0,P.jsx)(U,{value:y.cwd,onChange:e=>$({cwd:e})}),(0,P.jsxs)(`div`,{className:`form-grid grid gap-[9px] three [.form-grid&]:grid-cols-[repeat(3,minmax(0,1fr))] max-[650px]:[.form-grid&]:grid-cols-[1fr]`,children:[(0,P.jsxs)(b,{variant:`control`,children:[o(`schedules:schedulesPage.frequency`),(0,P.jsx)(i,{value:y.frequency,onChange:e=>$({frequency:e.target.value}),children:Object.keys(ee).map(e=>(0,P.jsx)(`option`,{value:e,children:re(e,o)},e))})]}),y.frequency===`interval`?(0,P.jsxs)(b,{variant:`control`,children:[o(`schedules:schedulesPage.runInterval`),(0,P.jsxs)(`span`,{className:`schedule-interval-input [&_input]:w-full [&_input]:min-w-0 [&_input]:h-full [&_input]:border-0 [&_input]:[outline:0] [&_input]:bg-transparent [&_input]:p-[0_9px] [&_input]:text-[var(--text)] [&_select]:h-full [&_select]:border-0 [&_select]:[border-left:1px_solid_var(--stroke)] [&_select]:[outline:0] [&_select]:bg-[var(--solid)] [&_select]:p-[0_8px] [&_select]:text-[var(--text-tertiary)] [&_select]:text-[12px] [&_[data-slot='select-trigger']]:w-auto [&_[data-slot='select-trigger']]:min-w-[74px] [&_[data-slot='select-trigger']]:[border-left:1px_solid_var(--stroke)] [&_[data-slot='select-trigger']]:rounded-[0] [&_[data-slot='select-trigger']]:bg-[var(--solid)] [&_[data-slot='select-trigger']]:text-[var(--text-tertiary)] grid h-[31px] grid-cols-[minmax(0,1fr)_auto] overflow-hidden [border:1px_solid_var(--stroke)] rounded-[var(--r-xs)] bg-[var(--surface-subtle)]`,children:[(0,P.jsx)(`input`,{type:`number`,min:`1`,value:y.intervalValue,onChange:e=>$({intervalValue:Number(e.target.value)})}),(0,P.jsx)(i,{value:y.intervalUnit,onChange:e=>$({intervalUnit:e.target.value}),children:Object.keys(te).map(e=>(0,P.jsx)(`option`,{value:e,children:ie(e,o)},e))})]})]}):(0,P.jsxs)(b,{variant:`control`,children:[o(`schedules:schedulesPage.time`),(0,P.jsx)(`input`,{type:`time`,value:y.time,onChange:e=>$({time:e.target.value})})]}),(0,P.jsxs)(b,{variant:`control`,children:[o(`schedules:schedulesPage.timeZone`),(0,P.jsx)(i,{value:y.timezone,onChange:e=>$({timezone:e.target.value}),children:ne.map(e=>(0,P.jsx)(`option`,{value:e,children:e},e))})]}),y.targetType===`prompt`&&(0,P.jsx)(z,{value:y.executionMode,onChange:e=>$({executionMode:e})})]}),(0,P.jsxs)(`div`,{className:`schedule-notification-section [&_>_div:first-child]:flex [&_>_div:first-child]:items-center [&_>_div:first-child]:justify-between [&_>_div:first-child]:gap-[8px] [&_>_div:first-child_strong]:text-[13px] [&_>_p]:mt-[4px] [&_>_p]:text-[var(--text-muted)] [&_>_p]:text-[13px] [margin-top:13px] [border-top:1px_solid_var(--stroke-soft)] [padding-top:12px]`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`strong`,{children:o(`schedules:schedulesPage.notificationChannels`)}),(0,P.jsx)(`button`,{type:`button`,className:`text-button hover:text-[var(--text)] border-0 bg-transparent text-[var(--text-soft)] text-[12px] font-[600] [text-decoration:underline] [text-underline-offset:2px]`,onClick:n,children:o(`schedules:schedulesPage.editTemplates`)})]}),(0,P.jsx)(`p`,{children:o(`schedules:schedulesPage.notificationChannelsHelp`)}),(0,P.jsx)(`div`,{className:`schedule-notification-targets [&_>_button]:grid [&_>_button]:min-h-[52px] [&_>_button]:grid-cols-[auto_minmax(0,1fr)_auto] [&_>_button]:items-center [&_>_button]:gap-[7px] [&_>_button]:[border:1px_solid_var(--stroke)] [&_>_button]:rounded-[var(--r-sm)] [&_>_button]:bg-[var(--surface-subtle)] [&_>_button]:p-[7px_8px] [&_>_button]:text-left [&_>_button_>_span]:flex [&_>_button_>_span]:min-w-0 [&_>_button_>_span]:flex-col [&_>_button_>_span]:gap-[3px] [&_strong]:text-[13px] [&_small]:overflow-hidden [&_small]:text-[var(--text-muted)] [&_small]:text-[13px] [&_small]:text-ellipsis [&_small]:whitespace-nowrap [&_>_button_>_svg:last-child]:text-[var(--control-muted)] [&_>_button.selected]:border-[var(--focus)] [&_>_button.selected]:bg-[var(--accent-soft)] [&_>_button.selected]:text-[var(--star-strong)] [&_>_button.selected_>_svg:last-child]:text-[var(--success)] max-[650px]:grid-cols-[1fr] grid grid-cols-[repeat(5,minmax(0,1fr))] gap-[7px] [margin-top:9px]`,children:Object.entries(F).map(([e,t])=>{let n=t.Icon,r=y.notifications.includes(e);return(0,P.jsxs)(`button`,{type:`button`,className:r?`selected`:``,onClick:()=>ce(e),children:[(0,P.jsx)(n,{size:15}),(0,P.jsxs)(`span`,{children:[(0,P.jsx)(`strong`,{children:R(e,o)}),(0,P.jsx)(`small`,{children:l.notificationTargets[e].enabled?o(`schedules:schedulesPage.configured`):o(`schedules:schedulesPage.notConfigured`)})]}),(0,P.jsx)(s,{size:15})]},e)})}),(0,P.jsx)(`div`,{className:`flex items-center gap-[6px] [margin-top:9px]`,children:(0,P.jsx)(`button`,{type:`button`,className:`schedule-notification-chip [&.selected]:border-[var(--control-selected-border)] [&.selected]:bg-[var(--control-selected-bg)] [&.selected]:text-[var(--control-selected-text)] [&.selected]:shadow-[var(--sh-1)] dark:bg-[var(--surface-subtle)] inline-flex h-[32px] items-center gap-[4px] [border:1px_solid_var(--stroke)] rounded-[var(--r-pill)] bg-[var(--surface-subtle)] text-[var(--text-muted)] [padding:0_10px] text-[13px] font-[600] ${y.notifyOn===`failure`?`selected`:``}`,onClick:()=>$({notifyOn:y.notifyOn===`failure`?`always`:`failure`}),children:y.notifyOn===`failure`?o(`schedules:schedulesPage.failuresOnly`):o(`schedules:schedulesPage.completionAndFailure`)})})]}),(0,P.jsxs)(`div`,{className:`form-footer [&_>_span]:text-[var(--text-muted)] [&_>_span]:text-[13px] flex items-center justify-between gap-[10px] [margin-top:10px]`,children:[(0,P.jsx)(`span`,{children:Z.lastRunAt?o(`schedules:schedulesPage.lastRunTime`,{time:x(Z.lastRunAt,c)}):o(`schedules:schedulesPage.nextRunTime`,{time:G(Z,c)})}),(0,P.jsxs)(v,{size:`lg`,disabled:L||!V(y.targetType,y.prompt,y.workflowId,y.workflowInputs,Q),onClick:async()=>{if(!(!Z||!y)){B(!0),Y(``);try{let t=await _(`/api/schedules/${encodeURIComponent(Z.id)}`,{method:`PATCH`,body:JSON.stringify(y)});d(t.state),j(W(t.task)),e(o(`schedules:schedulesPage.scheduledTaskSaved`))}catch(e){Y(e instanceof Error?e.message:String(e))}finally{B(!1)}}},children:[L?(0,P.jsx)(f,{className:`animate-spin`,size:14}):null,o(L?`schedules:schedulesPage.saving`:`schedules:schedulesPage.saveTask`)]})]})]}),(0,P.jsxs)(O,{children:[(0,P.jsx)(T,{title:o(`schedules:schedulesPage.recentRuns`)}),se.length?se.map(e=>(0,P.jsxs)(`div`,{className:`schedule-run-row [&_>_svg]:text-[var(--text-muted)] [&.completed_>_svg]:text-[var(--success)] [&.failed_>_svg]:text-[var(--danger)] [&.running_>_svg]:text-[var(--star-strong)] [&_>_span]:flex [&_>_span]:min-w-0 [&_>_span]:flex-col [&_>_span]:gap-[4px] [&_strong]:[display:-webkit-box] [&_strong]:overflow-hidden [&_strong]:text-[12px] [&_strong]:leading-[1.4] [&_strong]:[-webkit-box-orient:vertical] [&_strong]:[-webkit-line-clamp:2] [&_small]:text-[var(--text-muted)] [&_small]:text-[13px] [&_a]:text-[var(--text-soft)] [&_a]:text-[13px] [&_a]:[text-decoration:underline] [&_a]:[text-underline-offset:2px] [&_>_em]:text-[var(--text-secondary)] [&_>_em]:text-[12px] [&_>_em]:[font-style:normal] [&_>_em]:whitespace-nowrap grid grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-[9px] [border-top:1px_solid_var(--stroke-soft)] [padding:10px_2px] ${e.status}`,children:[e.status===`running`?(0,P.jsx)(f,{className:`animate-spin`,size:15}):e.status===`completed`?(0,P.jsx)(s,{size:15}):(0,P.jsx)(h,{size:15}),(0,P.jsxs)(`span`,{children:[(0,P.jsx)(`strong`,{children:e.status===`running`?o(`schedules:schedulesPage.running2`):e.status===`completed`?e.summary||o(`schedules:schedulesPage.taskCompleted`):e.status===`interrupted`?o(`schedules:schedulesPage.taskInterrupted`):e.error||o(`schedules:schedulesPage.taskFailed`)}),(0,P.jsxs)(`small`,{children:[x(e.startedAt,c),` ·`,` `,e.trigger===`manual`?o(`schedules:schedulesPage.manualRun`):o(`schedules:schedulesPage.scheduledTrigger`),e.durationMs?` · ${o(`schedules:schedulesPage.countSec`,{count:Math.round(e.durationMs/1e3)})}`:``]})]}),(0,P.jsx)(`em`,{children:new Intl.DateTimeFormat(c,{hour:`2-digit`,minute:`2-digit`}).format(new Date(e.startedAt))})]},e.id)):(0,P.jsxs)(`div`,{className:`channel-route-empty [&_strong]:mt-[9px] [&_strong]:text-[var(--text)] [&_strong]:text-[12px] [&_span]:mt-[4px] [&_span]:text-[13px] [&.compact]:min-h-[110px] [.workflow-assets-panel_&]:min-h-[150px] [.workflow-assets-panel_&]:border-0 [.workflow-assets-panel_&]:bg-transparent grid min-h-[185px] place-content-center justify-items-center text-[var(--text-muted)] text-center compact`,children:[(0,P.jsx)(k,{size:32}),(0,P.jsx)(`strong`,{children:o(`schedules:schedulesPage.noRunHistory`)})]})]})]}):(0,P.jsx)(q,{notificationTargets:l.notificationTargets,workflows:Q,defaultCwd:l.defaultCwd,onCreated:t=>{d(t.state),g(t.task.id),e(o(`schedules:schedulesPage.scheduledTaskCreated`))}})]}),ae&&(0,P.jsx)(J,{notificationTargets:l.notificationTargets,workflows:Q,defaultCwd:l.defaultCwd,onClose:()=>oe(!1),onCreated:t=>{oe(!1),d(t.state),g(t.task.id),e(o(`schedules:schedulesPage.scheduledTaskCreated`))}})]})}function q({notificationTargets:e,workflows:t,defaultCwd:n,onCreated:a}){let{t:o}=r(),[s,c]=(0,N.useState)(``),[l,u]=(0,N.useState)(`prompt`),[p,m]=(0,N.useState)(``),[g,y]=(0,N.useState)(``),[x,C]=(0,N.useState)({}),[T,E]=(0,N.useState)(n||``),[D,k]=(0,N.useState)(`daily`),[A,j]=(0,N.useState)(`09:00`),[M,F]=(0,N.useState)(`Asia/Hong_Kong`),[I,L]=(0,N.useState)(1),[R,B]=(0,N.useState)(`hours`),[W,G]=(0,N.useState)(`full-access`),[K,q]=(0,N.useState)(!1),[J,Y]=(0,N.useState)(``);return(0,P.jsxs)(O,{children:[(0,P.jsx)(w,{children:(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`h2`,{children:o(`schedules:schedulesPage.newScheduledTask`)}),(0,P.jsx)(`p`,{children:o(`schedules:schedulesPage.youCanContinueEditingTheRunTimeAndNotificationChannelsAfterCreation`)})]})}),(0,P.jsxs)(b,{variant:`control`,children:[o(`schedules:schedulesPage.taskName`),(0,P.jsx)(`input`,{value:s,onChange:e=>c(e.target.value),placeholder:o(`schedules:schedulesPage.forExampleDailyCodeReview`)})]}),(0,P.jsx)(H,{targetType:l,prompt:p,workflowId:g,workflowInputs:x,workflows:t,onChange:e=>{e.targetType&&u(e.targetType),e.prompt!==void 0&&m(e.prompt),e.workflowId!==void 0&&y(e.workflowId),e.workflowInputs!==void 0&&C(e.workflowInputs)}}),l===`prompt`&&(0,P.jsx)(U,{value:T,onChange:E}),(0,P.jsxs)(`div`,{className:`form-grid grid gap-[9px] three [.form-grid&]:grid-cols-[repeat(3,minmax(0,1fr))] max-[650px]:[.form-grid&]:grid-cols-[1fr]`,children:[(0,P.jsxs)(b,{variant:`control`,children:[o(`schedules:schedulesPage.frequency`),(0,P.jsx)(i,{value:D,onChange:e=>k(e.target.value),children:Object.keys(ee).map(e=>(0,P.jsx)(`option`,{value:e,children:re(e,o)},e))})]}),D===`interval`?(0,P.jsxs)(b,{variant:`control`,children:[o(`schedules:schedulesPage.runInterval`),(0,P.jsxs)(`span`,{className:`schedule-interval-input [&_input]:w-full [&_input]:min-w-0 [&_input]:h-full [&_input]:border-0 [&_input]:[outline:0] [&_input]:bg-transparent [&_input]:p-[0_9px] [&_input]:text-[var(--text)] [&_select]:h-full [&_select]:border-0 [&_select]:[border-left:1px_solid_var(--stroke)] [&_select]:[outline:0] [&_select]:bg-[var(--solid)] [&_select]:p-[0_8px] [&_select]:text-[var(--text-tertiary)] [&_select]:text-[12px] [&_[data-slot='select-trigger']]:w-auto [&_[data-slot='select-trigger']]:min-w-[74px] [&_[data-slot='select-trigger']]:[border-left:1px_solid_var(--stroke)] [&_[data-slot='select-trigger']]:rounded-[0] [&_[data-slot='select-trigger']]:bg-[var(--solid)] [&_[data-slot='select-trigger']]:text-[var(--text-tertiary)] grid h-[31px] grid-cols-[minmax(0,1fr)_auto] overflow-hidden [border:1px_solid_var(--stroke)] rounded-[var(--r-xs)] bg-[var(--surface-subtle)]`,children:[(0,P.jsx)(`input`,{type:`number`,min:`1`,value:I,onChange:e=>L(Number(e.target.value))}),(0,P.jsx)(i,{value:R,onChange:e=>B(e.target.value),children:Object.keys(te).map(e=>(0,P.jsx)(`option`,{value:e,children:ie(e,o)},e))})]})]}):(0,P.jsxs)(b,{variant:`control`,children:[o(`schedules:schedulesPage.time`),(0,P.jsx)(`input`,{type:`time`,value:A,onChange:e=>j(e.target.value)})]}),(0,P.jsxs)(b,{variant:`control`,children:[o(`schedules:schedulesPage.timeZone`),(0,P.jsx)(i,{value:M,onChange:e=>F(e.target.value),children:ne.map(e=>(0,P.jsx)(`option`,{value:e,children:e},e))})]}),l===`prompt`&&(0,P.jsx)(z,{value:W,onChange:G})]}),J&&(0,P.jsxs)(S,{children:[(0,P.jsx)(h,{size:13}),J]}),(0,P.jsxs)(`div`,{className:`form-footer [&_>_span]:text-[var(--text-muted)] [&_>_span]:text-[13px] flex items-center justify-between gap-[10px] [margin-top:10px]`,children:[(0,P.jsx)(`span`,{children:o(`schedules:schedulesPage.enabledAutomaticallyAfterCreation`)}),(0,P.jsxs)(v,{size:`lg`,disabled:K||!s.trim()||!V(l,p,g,x,t),onClick:async()=>{q(!0),Y(``);try{let t=Object.entries(e).filter(([,e])=>e.enabled).map(([e])=>e);a(await _(`/api/schedules`,{method:`POST`,body:JSON.stringify({name:s,targetType:l,prompt:p,workflowId:g,workflowInputs:x,cwd:T,enabled:!0,frequency:D,time:A,timezone:M,intervalValue:I,intervalUnit:R,executionMode:W,notifications:t,notifyOn:`always`})}))}catch(e){Y(e instanceof Error?e.message:String(e))}finally{q(!1)}},children:[K?(0,P.jsx)(f,{className:`animate-spin`,size:14}):(0,P.jsx)(d,{size:14}),o(K?`schedules:schedulesPage.creating`:`schedules:schedulesPage.createTask`)]})]})]})}function J({notificationTargets:e,workflows:t,defaultCwd:n,onClose:i,onCreated:a}){let{t:o}=r(),[s,c]=(0,N.useState)(``),[l,u]=(0,N.useState)(`prompt`),[p,m]=(0,N.useState)(``),[y,x]=(0,N.useState)(``),[C,T]=(0,N.useState)({}),[E,D]=(0,N.useState)(n||``),[O,k]=(0,N.useState)(`full-access`),[A,j]=(0,N.useState)(!1),[M,F]=(0,N.useState)(``);return(0,P.jsx)(`div`,{className:`modal-backdrop max-[650px]:p-[8px] fixed z-[70] inset-0 grid place-items-center overflow-y-auto bg-[var(--modal-overlay)] [backdrop-filter:blur(3px)] [padding:20px] [overscroll-behavior:contain] [animation:fade-in_var(--d1)_var(--ease-out)]`,onMouseDown:e=>e.target===e.currentTarget&&i(),children:(0,P.jsxs)(`form`,{className:`modal !w-[min(430px,100%)] max-h-[calc(100dvh_-_40px)] overflow-y-auto [overscroll-behavior:contain] [border:1px_solid_var(--surface-highlight)] rounded-[var(--r-md)] bg-[var(--solid)] p-[18px] shadow-[0_26px_70px_-25px_var(--shadow-strong)] [animation:modal-in_var(--d2)_var(--ease-out)] max-[650px]:max-h-[calc(100dvh_-_16px)]`,onSubmit:async t=>{t.preventDefault(),j(!0),F(``);try{let t=Object.entries(e).filter(([,e])=>e.enabled).map(([e])=>e);a(await _(`/api/schedules`,{method:`POST`,body:JSON.stringify({name:s,targetType:l,prompt:p,workflowId:y,workflowInputs:C,cwd:E,enabled:!0,frequency:`daily`,time:`09:00`,timezone:`Asia/Hong_Kong`,executionMode:O,notifications:t,notifyOn:`always`})}))}catch(e){F(e instanceof Error?e.message:String(e))}finally{j(!1)}},children:[(0,P.jsxs)(w,{children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`h2`,{children:o(`schedules:schedulesPage.newScheduledTask`)}),(0,P.jsx)(`p`,{children:o(`schedules:schedulesPage.youCanContinueSettingTheRunTimeAndNotificationChannelsAfterCreation`)})]}),(0,P.jsx)(v,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":o(`schedules:schedulesPage.closeDialog`),onClick:i,children:(0,P.jsx)(g,{size:17})})]}),(0,P.jsxs)(b,{variant:`control`,children:[o(`schedules:schedulesPage.taskName`),(0,P.jsx)(`input`,{value:s,onChange:e=>c(e.target.value),placeholder:o(`schedules:schedulesPage.forExampleDailyCodeReview`)})]}),(0,P.jsx)(H,{targetType:l,prompt:p,workflowId:y,workflowInputs:C,workflows:t,onChange:e=>{e.targetType&&u(e.targetType),e.prompt!==void 0&&m(e.prompt),e.workflowId!==void 0&&x(e.workflowId),e.workflowInputs!==void 0&&T(e.workflowInputs)}}),l===`prompt`&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(U,{value:E,onChange:D}),(0,P.jsx)(z,{value:O,onChange:k})]}),M&&(0,P.jsxs)(S,{children:[(0,P.jsx)(h,{size:13}),M]}),(0,P.jsxs)(`div`,{className:`flex justify-end gap-[8px] [margin-top:18px]`,children:[(0,P.jsx)(v,{type:`button`,variant:`outline`,size:`lg`,className:`bg-surface-subtle`,onClick:i,children:o(`schedules:schedulesPage.cancel`)}),(0,P.jsxs)(v,{size:`lg`,disabled:A||!s.trim()||!V(l,p,y,C,t),children:[A?(0,P.jsx)(f,{className:`animate-spin`,size:14}):(0,P.jsx)(d,{size:14}),o(A?`schedules:schedulesPage.creating`:`schedules:schedulesPage.createTask`)]})]})]})})}export{K as SchedulesPage};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-a84Zp9dV.js";import{o as i}from"./vendor-state-GkUciC5H.js";import"./collapsible-C__hRcbA.js";import{a,n as o,r as s,t as c}from"./dropdown-menu-pKRdLJUe.js";import"./tooltip-Bxq7c2mZ.js";import{t as l}from"./utils-C8uzG5AZ.js";import{t as u}from"./createLucideIcon-Cd-3GVxJ.js";import{t as d}from"./arrow-up-DST6-qVQ.js";import{t as f}from"./earth-Ddy13fHh.js";import{t as p}from"./external-link-CEQqPcqc.js";import{a as m,h,i as g,k as _,m as v,o as y,r as b,s as x}from"./side-chat-context-Dn8w9ut8.js";import{t as S}from"./loader-circle-BOwQzHB-.js";import{t as C}from"./message-square-SKjZyY3v.js";import{t as w}from"./plus-fQbSqB1n.js";import{t as T}from"./square-bHHVTT3G.js";import{t as E}from"./x-07u4-129.js";import{t as D}from"./button-CQA36izu.js";import{t as O}from"./SessionFilesPane-DPijesqH.js";import"./input-CvjGYteF.js";import{r as k,s as A}from"./shortcuts-C_Cph88H.js";import{a as j,i as M,n as N,t as P}from"./sheet--Om3LZxh.js";import{t as F}from"./web-preview-B7L-G6kp.js";var I=u(`files`,[[`path`,{d:`M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8`,key:`14sh0y`}],[`path`,{d:`M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z`,key:`1970lx`}],[`path`,{d:`M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1`,key:`l4dndm`}]]),L=e(t(),1);function R(e=`files`){return{pages:[{id:`page-1`,kind:e,draft:``,url:``}],activeId:`page-1`,nextId:2}}function z(e,t){if(t.type===`add`){let n=e.pages.find(e=>e.kind===`side-chat`);if(t.kind===`side-chat`&&n)return{...e,activeId:n.id};if(e.pages.length>=12)return e;let r={id:`page-${e.nextId}`,kind:t.kind,draft:``,url:``};return{pages:[...e.pages,r],activeId:r.id,nextId:e.nextId+1}}let n=e.pages.findIndex(e=>e.id===t.id);if(n<0)return e;if(t.type===`select`)return{...e,activeId:t.id};if(t.type===`close`){let r=e.pages.filter(e=>e.id!==t.id);return r.length?{...e,pages:r,activeId:e.activeId===t.id?r[Math.min(n,r.length-1)].id:e.activeId}:R()}return{...e,pages:e.pages.map(e=>e.id===t.id?t.type===`kind`?{...e,kind:t.kind}:{...e,...t.draft===void 0?{}:{draft:t.draft},...t.url===void 0?{}:{url:t.url}}:e)}}var B=i(e=>({sessions:{},update:(t,n,r)=>e(e=>{let i=Object.prototype.hasOwnProperty.call(e.sessions,t)?e.sessions[t]:R(n),a=Object.entries(e.sessions).filter(([e])=>e!==t).slice(-31);return{sessions:Object.fromEntries([...a,[t,z(i,r)]])}})})),V=n(),H=(0,L.createContext)(null),U=()=>{let e=(0,L.useContext)(H);if(!e)throw Error(`WebPreview components must be used within a WebPreview`);return e},W=({className:e,children:t,defaultUrl:n=``,onUrlChange:r,...i})=>{let[a,o]=(0,L.useState)(n),[s,c]=(0,L.useState)(!1),u=(0,L.useCallback)(e=>{o(e),r?.(e)},[r]),d=(0,L.useMemo)(()=>({consoleOpen:s,setConsoleOpen:c,setUrl:u,url:a}),[s,u,a]);return(0,V.jsx)(H.Provider,{value:d,children:(0,V.jsx)(`div`,{className:l(`flex size-full min-h-0 flex-col rounded-lg border bg-card`,e),...i,children:t})})},G=({className:e,loading:t,src:n,...r})=>{let{url:i}=U();return(0,V.jsxs)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden bg-background`,children:[(0,V.jsx)(`iframe`,{className:l(`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 K({parentId:e,active:t}){let{t:n}=r(),{entry:i,runtime:a,load:o,setDraft:s}=b(e),c=i.session?.id??``,l=(0,L.useMemo)(()=>e=>a.subscribeSessionState(c,e),[a,c]),u=(0,L.useMemo)(()=>()=>a.getSessionState(c),[a,c]),f=(0,L.useSyncExternalStore)(l,u),[p,_]=(0,L.useState)(!1),[v,w]=(0,L.useState)(!1),[E,O]=(0,L.useState)(``),j=(0,L.useRef)(!1),M=(0,L.useRef)(!1),N=(0,L.useRef)(i.draft);N.current=i.draft;let P=(0,L.useRef)(null),F=A(e=>e.bindings),I=g(f,i.session);(0,L.useEffect)(()=>{t&&o(e)},[t,o,e]);let R=async t=>{t.preventDefault();let n=N.current.trim();if(!(!n||j.current||I||i.expired)){j.current=!0,_(!0),O(``);try{let t=await o(e,!i.session);if(!t?.session)return;let r=t.session.id;if(a.getSessionState(r).streaming)return;N.current.trim()===n&&s(e,``),_(!1),await a.send(r,n),await o(e)}catch(e){O(x(e))}finally{j.current=!1,_(!1)}}},z=(0,L.useCallback)(async()=>{if(!(!c||a.getSessionState(c).streaming)){O(``);try{await a.retry(c),await o(e)}catch(e){O(x(e))}}},[o,e,a,c]),B=async()=>{if(!(!c||v)){w(!0);try{O(``),await a.abort(c)}catch(e){O(x(e))}finally{w(!1)}}},H=(0,V.jsxs)(`div`,{className:`grid h-full min-h-36 place-content-center justify-items-center gap-3 px-3 text-center text-sm text-muted-foreground`,children:[(0,V.jsx)(C,{size:22,"aria-hidden":`true`}),(0,V.jsx)(`p`,{className:`max-w-64 leading-relaxed`,children:i.expired?n(`chat:sideChat.expired`):n(`chat:sideChat.empty`)}),i.expired&&(0,V.jsxs)(D,{variant:`outline`,size:`sm`,disabled:i.loading,onClick:async()=>{(await o(e,!0))?.session&&P.current?.focus()},children:[i.loading&&(0,V.jsx)(S,{className:`size-4 animate-spin`}),n(`chat:sideChat.restart`)]})]}),U=E||i.error||f.error;return(0,V.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,V.jsx)(`p`,{className:`shrink-0 border-b border-border/50 px-3 py-2 text-xs leading-relaxed text-muted-foreground`,children:n(`chat:sideChat.retention`)}),c?(0,V.jsx)(y,{sessionId:c,messages:f.messages,transcriptLoadState:f.loaded?`ready`:f.error?`error`:`loading`,emptyState:H,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:I,runStartedAt:f.runStartedAt,lastActivityAt:f.lastActivityAt,runFinishedAt:f.runFinishedAt,runStopped:f.runStopped,runNotice:f.runNotice,error:f.error,cwd:i.session?.cwd,onLoadOlder:()=>a.loadOlderMessages(c),onRetryLastTurn:z}):(0,V.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:H}),(0,V.jsxs)(`form`,{className:`flex shrink-0 flex-col gap-2 border-t border-border/50 p-3`,onSubmit:R,children:[U&&(0,V.jsx)(h,{error:U,onRetry:i.error||!f.loaded?async()=>{await o(e)}:z}),(0,V.jsx)(m,{approvals:f.approvals,onResolve:async(e,t)=>{try{await a.approve(c,e,t)}catch{}}}),(0,V.jsxs)(`div`,{className:`flex min-w-0 items-end gap-2 rounded-xl border border-border/70 bg-muted/40 p-2 focus-within:border-ring/50`,children:[(0,V.jsx)(`textarea`,{ref:P,rows:2,value:i.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-foreground outline-none placeholder:text-muted-foreground`,onChange:t=>s(e,t.target.value),onCompositionStart:()=>{M.current=!0},onCompositionEnd:()=>{M.current=!1},onKeyDown:e=>{!M.current&&!e.nativeEvent.isComposing&&e.nativeEvent.keyCode!==229&&k(e.nativeEvent,F.sendMessage)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())}}),(0,V.jsx)(D,{type:I?`button`:`submit`,size:`icon`,className:`size-9 shrink-0 rounded-full`,"aria-label":n(I?`chat:sideChat.stop`:`chat:sideChat.send`),disabled:I?v:p||i.loading||i.expired||!i.draft.trim(),onClick:I?()=>void B():void 0,children:p||v?(0,V.jsx)(S,{className:`size-4 animate-spin`}):I?(0,V.jsx)(T,{size:13,fill:`currentColor`}):(0,V.jsx)(d,{size:17})})]})]})]})}function q({page:e,onChange:t}){let{t:n}=r(),{draft:i,url:a}=e,[o,s]=(0,L.useState)(!1);return(0,V.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col gap-2 p-3`,"aria-label":n(`common:webPreview.title`),children:[(0,V.jsxs)(`form`,{className:`flex gap-2`,onSubmit:e=>{e.preventDefault();let n=F(i,window.location.href);s(!n),n&&t({url:n})},children:[(0,V.jsx)(`input`,{"aria-label":n(`common:webPreview.url`),className:`min-w-0 flex-1 rounded-md border border-[var(--stroke)] bg-[var(--solid)] px-2 text-[length:var(--app-font-size)]`,value:i,onChange:e=>t({draft:e.target.value}),placeholder:n(`common:webPreview.urlPlaceholder`),maxLength:2048}),(0,V.jsx)(D,{type:`submit`,variant:`outline`,size:`sm`,children:n(`chat:sessionContext.openUrl`)})]}),o&&(0,V.jsx)(`p`,{role:`alert`,className:`text-[length:var(--app-small-size)] text-[var(--text-secondary)]`,children:n(`chat:sessionContext.invalidUrl`)}),a?(0,V.jsx)(W,{className:`min-h-0 flex-1 overflow-hidden rounded-md`,defaultUrl:a,children:(0,V.jsx)(G,{src:a,title:n(`common:webPreview.title`)})},a):(0,V.jsxs)(`div`,{className:`grid min-h-0 flex-1 place-content-center justify-items-center gap-2 rounded-md border border-dashed border-[var(--stroke-soft)] text-center text-[length:var(--app-font-size)] text-[var(--text-muted)]`,children:[(0,V.jsx)(f,{size:24,"aria-hidden":`true`}),(0,V.jsx)(`p`,{children:n(`chat:sessionContext.browserEmpty`)})]}),a&&(0,V.jsxs)(D,{type:`button`,variant:`ghost`,size:`sm`,className:`self-start`,onClick:()=>window.open(a,`_blank`,`noopener,noreferrer`),children:[(0,V.jsx)(p,{size:14}),n(`common:webPreview.openExternal`)]}),(0,V.jsx)(`p`,{className:`text-[length:var(--app-small-size)] text-[var(--text-muted)]`,children:n(`common:webPreview.embedNotice`)})]})}function J({panelId:e,compact:t,embedded:n=!1,sessionId:i,tab:l,plan:u,streaming:d,plansAvailable:p,requestConfirm:m,onTabChange:h,onClose:g}){let{t:y}=r(),b=[{id:`files`,icon:I,label:y(`chat:focusSession.fileChanges`)},...p?[{id:`plan`,icon:_,label:y(`chat:sessionContext.plan`)}]:[],{id:`browser`,icon:f,label:y(`common:webPreview.title`)},{id:`side-chat`,icon:C,label:y(`chat:sideChat.title`)}],x=(0,L.useMemo)(()=>R(l),[l]),S=B(e=>Object.prototype.hasOwnProperty.call(e.sessions,i)?e.sessions[i]:void 0)??x,T=(0,L.useRef)(null),D=S.pages.find(e=>e.id===S.activeId)??S.pages[0],k=e=>b.find(t=>t.id===e.kind)??b[0],A=t=>requestAnimationFrame(()=>document.getElementById(`${e}-${t}-tab`)?.focus()),F=e=>{let t=z(S,e);B.getState().update(i,l,e);let n=t.pages.find(e=>e.id===t.activeId);n&&h(n.kind),(e.type===`add`||e.type===`select`||e.type===`close`)&&A(t.activeId),e.type===`close`&&S.pages.length===1&&g()},H=y(`chat:sessionContext.addPage`),U=y(`chat:sessionContext.pageLimit`),W=(0,V.jsxs)(c,{children:[(0,V.jsx)(a,{asChild:!0,children:(0,V.jsx)(`button`,{type:`button`,className:`grid size-7 shrink-0 place-items-center rounded-md text-muted-foreground hover:bg-muted disabled:opacity-40`,disabled:S.pages.length>=12,"aria-label":H,title:S.pages.length>=12?U:H,children:(0,V.jsx)(w,{size:15})})}),(0,V.jsx)(o,{align:`end`,className:`min-w-40`,children:b.map(({id:e,icon:t,label:n})=>(0,V.jsxs)(s,{onSelect:()=>F({type:`add`,kind:e}),children:[(0,V.jsx)(t,{size:14}),n]},e))})]}),G=(0,V.jsxs)(`div`,{"data-session-context-panel":!0,className:`flex h-full min-h-0 min-w-0 flex-col bg-background text-foreground`,children:[(0,V.jsxs)(`header`,{"data-window-drag-region":!0,className:`auxiliary-page-header flex h-12 shrink-0 items-center gap-0.5 border-b border-border/60 px-1.5`,children:[(0,V.jsx)(`div`,{ref:T,className:`flex min-w-0 flex-1 items-center overflow-x-auto`,role:`tablist`,"aria-label":y(`chat:sessionContext.title`),onKeyDown:e=>{if(!(e.target instanceof HTMLElement)||e.target.getAttribute(`role`)!==`tab`)return;if(e.key===`Delete`){e.preventDefault(),F({type:`close`,id:D.id});return}if(![`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key))return;e.preventDefault();let t=S.pages.findIndex(e=>e.id===D.id),n=e.key===`Home`?0:e.key===`End`?S.pages.length-1:(t+(e.key===`ArrowRight`?1:-1)+S.pages.length)%S.pages.length;F({type:`select`,id:S.pages[n].id})},children:S.pages.map(t=>{let{icon:n,label:r}=k(t);return(0,V.jsxs)(`div`,{className:`group flex max-w-40 min-w-20 shrink-0 items-center rounded-md ${t.id===D.id?`bg-muted`:`text-muted-foreground`}`,children:[(0,V.jsxs)(`button`,{id:`${e}-${t.id}-tab`,type:`button`,role:`tab`,"aria-selected":t.id===D.id,"aria-controls":`${e}-${t.id}-content`,tabIndex:t.id===D.id?0:-1,className:`flex h-8 min-w-0 flex-1 items-center gap-1.5 px-2 text-xs`,onClick:()=>F({type:`select`,id:t.id}),children:[(0,V.jsx)(n,{size:13,className:`shrink-0`}),(0,V.jsx)(`span`,{className:`truncate`,children:r})]}),(0,V.jsx)(`button`,{type:`button`,className:`mr-0.5 grid size-5 shrink-0 place-items-center rounded hover:bg-foreground/10`,"aria-label":`${y(`chat:sessionContext.closePage`)} · ${r}`,onClick:()=>F({type:`close`,id:t.id}),children:(0,V.jsx)(E,{size:11})})]},t.id)})}),W]}),S.pages.map(t=>{let n=k(t),r=D.id===t.id;return(0,V.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===`side-chat`?(0,V.jsx)(K,{parentId:i,active:r}):n.id===`browser`?(0,V.jsx)(q,{page:t,onChange:e=>F({type:`browser`,id:t.id,...e})}):r&&(n.id===`files`?(0,V.jsx)(O,{sessionId:i,streaming:d,requestConfirm:m}):(0,V.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-3`,children:u?.items?.length?(0,V.jsx)(v,{plan:u}):(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:y(`chat:sessionContext.planEmpty`)})}))},t.id)})]});return t?(0,V.jsx)(P,{open:!0,onOpenChange:e=>!e&&g(),children:(0,V.jsxs)(N,{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,V.jsx)(M,{className:`sr-only`,children:(0,V.jsx)(j,{children:y(`chat:sessionContext.title`)})}),G]})}):(0,V.jsx)(`aside`,{id:e,tabIndex:n?-1:void 0,className:`h-full min-h-0 w-full overflow-hidden border-l border-border/60`,"aria-label":y(`chat:sessionContext.title`),children:G})}export{J as SessionContextPanel};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/GitDiffViewer-xm2LnN9r.js","assets/rolldown-runtime-B0Z9INg1.js","assets/vendor-react-DwNgTV1j.js","assets/use-i18n-BSZKFkMb.js","assets/i18n-7QvbQzOQ.js","assets/vendor-router-CZg2bCPV.js","assets/index-iBrSU61i.js","assets/index-CdASiNlI.css","assets/storage-BpAqa-YY.js","assets/vendor-state-GkUciC5H.js","assets/file-diff-GxOMJkLj.js","assets/createLucideIcon-Cd-3GVxJ.js","assets/x-07u4-129.js","assets/button-CQA36izu.js","assets/vendor-ui-DvrYggeS.js","assets/dist-Cfh4kzCK.js","assets/utils-C8uzG5AZ.js"])))=>i.map(i=>d[i]);
2
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{p as t}from"./vendor-router-CZg2bCPV.js";import{i as n,r}from"./vendor-react-DwNgTV1j.js";import{t as i}from"./use-i18n-BSZKFkMb.js";import{t as a}from"./check-2vYc6QaP.js";import{t as o}from"./file-diff-GxOMJkLj.js";import{t as s}from"./refresh-cw-TbWxTY4K.js";import{t as c}from"./undo-2-CJE_nRTk.js";import{t as l}from"./button-CQA36izu.js";import{t as u}from"./chat-api-DfnvubiW.js";import{n as d}from"./session-change-summary-api-DFgTzTci.js";var f=e(n(),1),p=r(),m=(0,f.lazy)(()=>t(()=>import(`./GitDiffViewer-xm2LnN9r.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]))),h=100;function g(e){return e instanceof Error?e.message:String(e)}function _({sessionId:e,streaming:t,requestConfirm:n}){let{t:r}=i(),[_,v]=(0,f.useState)(0),[y,b]=(0,f.useState)(null),[x,S]=(0,f.useState)(!0),[C,w]=(0,f.useState)(``),[T,E]=(0,f.useState)(``),[D,O]=(0,f.useState)(``),[k,A]=(0,f.useState)(null),[j,M]=(0,f.useState)(null),[N,P]=(0,f.useState)(null),F=(0,f.useRef)(!1),I=(0,f.useRef)(0),L=(0,f.useRef)(0),R=(0,f.useRef)(!0),z=(0,f.useRef)(!1),B=(0,f.useRef)(t);(0,f.useLayoutEffect)(()=>{B.current=t},[t]),(0,f.useLayoutEffect)(()=>(F.current=!0,()=>{F.current=!1,I.current+=1,L.current+=1}),[]),(0,f.useEffect)(()=>{let t=++I.current;return L.current+=1,M(null),P(null),R.current=!0,S(!0),w(``),u.getSessionFileChanges(e).then(e=>{F.current&&t===I.current&&b(e)},e=>{F.current&&t===I.current&&w(g(e))}).finally(()=>{F.current&&t===I.current&&(R.current=!1,S(!1))}),()=>{I.current+=1}},[_,e,t]);let V=async t=>{if(z.current||R.current)return;let n=++L.current;P(t),E(``);try{let i=await u.getSessionFileChangeDiff(e,t);if(!F.current||n!==L.current)return;if(!i.diff?.trim()){E(r(`chat:focusSession.fileChangesNoSnapshot`));return}M({diff:i.diff,truncated:!!i.diffTruncated})}catch(e){F.current&&n===L.current&&E(g(e))}finally{F.current&&n===L.current&&P(null)}},H=async t=>{if(!F.current||z.current||R.current||B.current||!y||C||!y.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;z.current=!0,A(t),E(``),O(``);let i=++I.current;L.current+=1,M(null),P(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`})||!F.current||B.current||R.current||i!==I.current)return;a=!0;let o=t.kind===`approve`?await u.approveSessionFileChanges(e,t.path):await u.revertSessionFileChanges(e,t.path);if(d(e),!F.current||i!==I.current)return;b(o),t.kind===`approve`?O(t.path?r(`chat:focusSession.fileChangesApproved`):r(`chat:focusSession.fileChangesApproveDone`)):o.reverted?t.path===void 0&&o.files.some(e=>e.pending)?O(r(`chat:focusSession.fileChangesRevertPartial`,{count:o.reverted})):O(r(`chat:focusSession.fileChangesRevertDone`)):O(r(`chat:focusSession.fileChangesRevertUnavailable`))}catch(e){F.current&&i===I.current&&E(g(e))}finally{z.current=!1,F.current&&(A(null),a&&(R.current=!0,S(!0),v(e=>e+1)))}},U=x||t||!!k||!!C||!y,W=y?.summary.pending||0,G=y?.files.filter(e=>e.canRevert&&!e.reverted).length||0,K=T||C;return(0,p.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col gap-3 p-3`,"aria-label":r(`chat:focusSession.fileChanges`),"aria-busy":x||!!k,children:[(0,p.jsxs)(`div`,{className:`flex flex-none flex-wrap items-center justify-between gap-2`,children:[(0,p.jsxs)(`div`,{className:`min-w-0`,children:[(0,p.jsx)(`p`,{className:`text-[length:var(--app-font-size)] font-medium`,children:r(`chat:focusSession.fileChanges`)}),y&&(0,p.jsxs)(`p`,{className:`text-[length:var(--app-small-size)] text-[var(--text-muted)]`,children:[r(`chat:focusSession.fileChangesCount`,{count:y.summary.files}),` · `,`+`,y.summary.added,` −`,y.summary.removed,W>0&&` · ${r(`chat:focusSession.fileChangesPending`,{count:W})}`]})]}),(0,p.jsxs)(`div`,{className:`ml-auto flex flex-wrap items-center justify-end gap-1.5`,children:[(0,p.jsxs)(l,{type:`button`,variant:`outline`,size:`sm`,className:`min-h-11 sm:min-h-9`,disabled:U||W===0,title:t?r(`chat:focusSession.gitWaitForRunToFinish`):void 0,onClick:()=>void H({kind:`approve`}),children:[k?.kind===`approve`&&!k.path?(0,p.jsx)(s,{className:`animate-spin`,size:14}):(0,p.jsx)(a,{size:14}),r(`chat:focusSession.fileChangesApproveAll`)]}),(0,p.jsxs)(l,{type:`button`,variant:`outline`,size:`sm`,className:`min-h-11 sm:min-h-9`,disabled:U||G===0,title:r(t?`chat:focusSession.gitWaitForRunToFinish`:`chat:focusSession.fileChangesRevertAllDescription`),onClick:()=>void H({kind:`revert`}),children:[k?.kind===`revert`&&!k.path?(0,p.jsx)(s,{className:`animate-spin`,size:14}):(0,p.jsx)(c,{size:14}),r(`chat:focusSession.fileChangesRevertAll`)]}),(0,p.jsx)(l,{type:`button`,variant:`ghost`,size:`icon`,className:`size-11 sm:size-9`,"aria-label":r(`chat:focusSession.gitRefresh`),title:r(`chat:focusSession.gitRefresh`),disabled:x||!!k,onClick:()=>{R.current=!0,S(!0),E(``),v(e=>e+1)},children:(0,p.jsx)(s,{className:x?`animate-spin`:``,size:16})})]})]}),K&&(0,p.jsx)(`p`,{role:`alert`,className:`text-[length:var(--app-small-size)] text-[var(--text-secondary)]`,children:K}),D&&!K&&(0,p.jsx)(`p`,{role:`status`,className:`text-[length:var(--app-small-size)] text-[var(--text-secondary)]`,children:D}),x&&!y?(0,p.jsx)(`p`,{role:`status`,className:`text-[length:var(--app-font-size)] text-[var(--text-muted)]`,children:r(`chat:focusSession.gitLoading`)}):y?.files.length?(0,p.jsxs)(`ul`,{className:`min-h-0 flex-1 space-y-1 overflow-y-auto`,"aria-label":r(`chat:focusSession.fileChanges`),children:[y.files.slice(0,h).map(e=>(0,p.jsxs)(`li`,{className:`flex min-w-0 items-center gap-1 rounded-md bg-[var(--surface-subtle)] px-2 py-1`,children:[(0,p.jsxs)(`button`,{type:`button`,className:`flex min-h-11 min-w-0 flex-1 items-center gap-2 rounded-md text-left text-[length:var(--app-small-size)] outline-none focus-visible:ring-2 focus-visible:ring-[var(--brand-blue)] disabled:opacity-60`,title:e.path,disabled:x||!!k,"aria-busy":N===e.path,onClick:()=>void V(e.path),children:[N===e.path?(0,p.jsx)(s,{size:14,className:`flex-none animate-spin`}):(0,p.jsx)(o,{size:14,className:`flex-none text-[var(--star-strong)]`}),(0,p.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,p.jsx)(`span`,{className:`block truncate`,children:e.path}),(0,p.jsxs)(`span`,{className:`block text-[var(--text-muted)]`,children:[`+`,e.added,` −`,e.removed,e.reverted?` · ${r(`chat:focusSession.fileChangesReverted`)}`:e.approved?` · ${r(`chat:focusSession.fileChangesApproved`)}`:``]})]})]}),(0,p.jsx)(l,{type:`button`,variant:`ghost`,size:`icon`,className:`size-11 sm:size-9`,title:r(`chat:focusSession.fileChangesApproveFile`),"aria-label":`${r(`chat:focusSession.fileChangesApproveFile`)} ${e.path}`,disabled:U||!e.pending||e.approved||e.reverted,onClick:()=>void H({kind:`approve`,path:e.path}),children:(0,p.jsx)(a,{size:14})}),(0,p.jsx)(l,{type:`button`,variant:`ghost`,size:`icon`,className:`size-11 sm:size-9`,title:r(`chat:focusSession.fileChangesRevertFile`),"aria-label":`${r(`chat:focusSession.fileChangesRevertFile`)} ${e.path}`,disabled:U||e.reverted||!e.canRevert,onClick:()=>void H({kind:`revert`,path:e.path}),children:(0,p.jsx)(c,{size:14})})]},e.path)),y.files.length>h&&(0,p.jsx)(`li`,{className:`px-2 py-1 text-[length:var(--app-small-size)] text-[var(--text-muted)]`,children:r(`chat:focusSession.gitMoreFiles`,{count:y.files.length-h})})]}):!K&&(0,p.jsx)(`p`,{className:`text-[length:var(--app-font-size)] text-[var(--text-muted)]`,children:r(`chat:focusSession.fileChangesEmpty`)}),j&&(0,p.jsx)(f.Suspense,{fallback:null,children:(0,p.jsx)(m,{diff:j.diff,truncated:j.truncated,onClose:()=>M(null)})})]})}export{_ as t};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/GitDiffViewer-m5aLB7Li.js","assets/rolldown-runtime-B0Z9INg1.js","assets/vendor-react-DwNgTV1j.js","assets/use-i18n-a84Zp9dV.js","assets/i18n-8nTnthu6.js","assets/vendor-router-CZg2bCPV.js","assets/index-AF29hfx9.js","assets/index-BAmsg90v.css","assets/storage-BpAqa-YY.js","assets/vendor-state-GkUciC5H.js","assets/file-diff-GxOMJkLj.js","assets/createLucideIcon-Cd-3GVxJ.js","assets/x-07u4-129.js","assets/button-CQA36izu.js","assets/vendor-ui-DvrYggeS.js","assets/dist-Cfh4kzCK.js","assets/utils-C8uzG5AZ.js"])))=>i.map(i=>d[i]);
2
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{p as t}from"./vendor-router-CZg2bCPV.js";import{i as n,r}from"./vendor-react-DwNgTV1j.js";import{t as i}from"./use-i18n-a84Zp9dV.js";import{t as a}from"./check-2vYc6QaP.js";import{t as o}from"./file-diff-GxOMJkLj.js";import{t as s}from"./refresh-cw-TbWxTY4K.js";import{t as c}from"./undo-2-CJE_nRTk.js";import{t as l}from"./button-CQA36izu.js";import{t as u}from"./chat-api-CqF-FICX.js";import{n as d}from"./session-change-summary-api--7cl4LDn.js";var f=e(n(),1),p=r(),m=(0,f.lazy)(()=>t(()=>import(`./GitDiffViewer-m5aLB7Li.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]))),h=100;function g(e){return e instanceof Error?e.message:String(e)}function _({sessionId:e,streaming:t,requestConfirm:n}){let{t:r}=i(),[_,v]=(0,f.useState)(0),[y,b]=(0,f.useState)(null),[x,S]=(0,f.useState)(!0),[C,w]=(0,f.useState)(``),[T,E]=(0,f.useState)(``),[D,O]=(0,f.useState)(``),[k,A]=(0,f.useState)(null),[j,M]=(0,f.useState)(null),[N,P]=(0,f.useState)(null),F=(0,f.useRef)(!1),I=(0,f.useRef)(0),L=(0,f.useRef)(0),R=(0,f.useRef)(!0),z=(0,f.useRef)(!1),B=(0,f.useRef)(t);(0,f.useLayoutEffect)(()=>{B.current=t},[t]),(0,f.useLayoutEffect)(()=>(F.current=!0,()=>{F.current=!1,I.current+=1,L.current+=1}),[]),(0,f.useEffect)(()=>{let t=++I.current;return L.current+=1,M(null),P(null),R.current=!0,S(!0),w(``),u.getSessionFileChanges(e).then(e=>{F.current&&t===I.current&&b(e)},e=>{F.current&&t===I.current&&w(g(e))}).finally(()=>{F.current&&t===I.current&&(R.current=!1,S(!1))}),()=>{I.current+=1}},[_,e,t]);let V=async t=>{if(z.current||R.current)return;let n=++L.current;P(t),E(``);try{let i=await u.getSessionFileChangeDiff(e,t);if(!F.current||n!==L.current)return;if(!i.diff?.trim()){E(r(`chat:focusSession.fileChangesNoSnapshot`));return}M({diff:i.diff,truncated:!!i.diffTruncated})}catch(e){F.current&&n===L.current&&E(g(e))}finally{F.current&&n===L.current&&P(null)}},H=async t=>{if(!F.current||z.current||R.current||B.current||!y||C||!y.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;z.current=!0,A(t),E(``),O(``);let i=++I.current;L.current+=1,M(null),P(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`})||!F.current||B.current||R.current||i!==I.current)return;a=!0;let o=t.kind===`approve`?await u.approveSessionFileChanges(e,t.path):await u.revertSessionFileChanges(e,t.path);if(d(e),!F.current||i!==I.current)return;b(o),t.kind===`approve`?O(t.path?r(`chat:focusSession.fileChangesApproved`):r(`chat:focusSession.fileChangesApproveDone`)):o.reverted?t.path===void 0&&o.files.some(e=>e.pending)?O(r(`chat:focusSession.fileChangesRevertPartial`,{count:o.reverted})):O(r(`chat:focusSession.fileChangesRevertDone`)):O(r(`chat:focusSession.fileChangesRevertUnavailable`))}catch(e){F.current&&i===I.current&&E(g(e))}finally{z.current=!1,F.current&&(A(null),a&&(R.current=!0,S(!0),v(e=>e+1)))}},U=x||t||!!k||!!C||!y,W=y?.summary.pending||0,G=y?.files.filter(e=>e.canRevert&&!e.reverted).length||0,K=T||C;return(0,p.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col gap-3 p-3`,"aria-label":r(`chat:focusSession.fileChanges`),"aria-busy":x||!!k,children:[(0,p.jsxs)(`div`,{className:`flex flex-none flex-wrap items-center justify-between gap-2`,children:[(0,p.jsxs)(`div`,{className:`min-w-0`,children:[(0,p.jsx)(`p`,{className:`text-[length:var(--app-font-size)] font-medium`,children:r(`chat:focusSession.fileChanges`)}),y&&(0,p.jsxs)(`p`,{className:`text-[length:var(--app-small-size)] text-[var(--text-muted)]`,children:[r(`chat:focusSession.fileChangesCount`,{count:y.summary.files}),` · `,`+`,y.summary.added,` −`,y.summary.removed,W>0&&` · ${r(`chat:focusSession.fileChangesPending`,{count:W})}`]})]}),(0,p.jsxs)(`div`,{className:`ml-auto flex flex-wrap items-center justify-end gap-1.5`,children:[(0,p.jsxs)(l,{type:`button`,variant:`outline`,size:`sm`,className:`min-h-11 sm:min-h-9`,disabled:U||W===0,title:t?r(`chat:focusSession.gitWaitForRunToFinish`):void 0,onClick:()=>void H({kind:`approve`}),children:[k?.kind===`approve`&&!k.path?(0,p.jsx)(s,{className:`animate-spin`,size:14}):(0,p.jsx)(a,{size:14}),r(`chat:focusSession.fileChangesApproveAll`)]}),(0,p.jsxs)(l,{type:`button`,variant:`outline`,size:`sm`,className:`min-h-11 sm:min-h-9`,disabled:U||G===0,title:r(t?`chat:focusSession.gitWaitForRunToFinish`:`chat:focusSession.fileChangesRevertAllDescription`),onClick:()=>void H({kind:`revert`}),children:[k?.kind===`revert`&&!k.path?(0,p.jsx)(s,{className:`animate-spin`,size:14}):(0,p.jsx)(c,{size:14}),r(`chat:focusSession.fileChangesRevertAll`)]}),(0,p.jsx)(l,{type:`button`,variant:`ghost`,size:`icon`,className:`size-11 sm:size-9`,"aria-label":r(`chat:focusSession.gitRefresh`),title:r(`chat:focusSession.gitRefresh`),disabled:x||!!k,onClick:()=>{R.current=!0,S(!0),E(``),v(e=>e+1)},children:(0,p.jsx)(s,{className:x?`animate-spin`:``,size:16})})]})]}),K&&(0,p.jsx)(`p`,{role:`alert`,className:`text-[length:var(--app-small-size)] text-[var(--text-secondary)]`,children:K}),D&&!K&&(0,p.jsx)(`p`,{role:`status`,className:`text-[length:var(--app-small-size)] text-[var(--text-secondary)]`,children:D}),x&&!y?(0,p.jsx)(`p`,{role:`status`,className:`text-[length:var(--app-font-size)] text-[var(--text-muted)]`,children:r(`chat:focusSession.gitLoading`)}):y?.files.length?(0,p.jsxs)(`ul`,{className:`min-h-0 flex-1 space-y-1 overflow-y-auto`,"aria-label":r(`chat:focusSession.fileChanges`),children:[y.files.slice(0,h).map(e=>(0,p.jsxs)(`li`,{className:`flex min-w-0 items-center gap-1 rounded-md bg-[var(--surface-subtle)] px-2 py-1`,children:[(0,p.jsxs)(`button`,{type:`button`,className:`flex min-h-11 min-w-0 flex-1 items-center gap-2 rounded-md text-left text-[length:var(--app-small-size)] outline-none focus-visible:ring-2 focus-visible:ring-[var(--brand-blue)] disabled:opacity-60`,title:e.path,disabled:x||!!k,"aria-busy":N===e.path,onClick:()=>void V(e.path),children:[N===e.path?(0,p.jsx)(s,{size:14,className:`flex-none animate-spin`}):(0,p.jsx)(o,{size:14,className:`flex-none text-[var(--star-strong)]`}),(0,p.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,p.jsx)(`span`,{className:`block truncate`,children:e.path}),(0,p.jsxs)(`span`,{className:`block text-[var(--text-muted)]`,children:[`+`,e.added,` −`,e.removed,e.reverted?` · ${r(`chat:focusSession.fileChangesReverted`)}`:e.approved?` · ${r(`chat:focusSession.fileChangesApproved`)}`:``]})]})]}),(0,p.jsx)(l,{type:`button`,variant:`ghost`,size:`icon`,className:`size-11 sm:size-9`,title:r(`chat:focusSession.fileChangesApproveFile`),"aria-label":`${r(`chat:focusSession.fileChangesApproveFile`)} ${e.path}`,disabled:U||!e.pending||e.approved||e.reverted,onClick:()=>void H({kind:`approve`,path:e.path}),children:(0,p.jsx)(a,{size:14})}),(0,p.jsx)(l,{type:`button`,variant:`ghost`,size:`icon`,className:`size-11 sm:size-9`,title:r(`chat:focusSession.fileChangesRevertFile`),"aria-label":`${r(`chat:focusSession.fileChangesRevertFile`)} ${e.path}`,disabled:U||e.reverted||!e.canRevert,onClick:()=>void H({kind:`revert`,path:e.path}),children:(0,p.jsx)(c,{size:14})})]},e.path)),y.files.length>h&&(0,p.jsx)(`li`,{className:`px-2 py-1 text-[length:var(--app-small-size)] text-[var(--text-muted)]`,children:r(`chat:focusSession.gitMoreFiles`,{count:y.files.length-h})})]}):!K&&(0,p.jsx)(`p`,{className:`text-[length:var(--app-font-size)] text-[var(--text-muted)]`,children:r(`chat:focusSession.fileChangesEmpty`)}),j&&(0,p.jsx)(f.Suspense,{fallback:null,children:(0,p.jsx)(m,{diff:j.diff,truncated:j.truncated,onClose:()=>M(null)})})]})}export{_ as t};
@@ -1 +1 @@
1
- import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-BSZKFkMb.js";import{a as n,n as r,r as i,t as a}from"./dropdown-menu-DmL4pJTo.js";import{t as o}from"./ellipsis-CfGKfbq6.js";import{t as s}from"./button-CQA36izu.js";var c=e();function l({items:e,buttonClassName:l,compact:u=!1,onNavigate:d}){let{t:f}=t();return(0,c.jsxs)(a,{children:[(0,c.jsx)(n,{asChild:!0,children:(0,c.jsxs)(s,{variant:`ghost`,className:l,title:u?f(`navigation:workbench.moreTools`):void 0,children:[(0,c.jsx)(o,{size:16}),(0,c.jsx)(`span`,{className:u?`sr-only`:void 0,children:f(`navigation:workbench.moreTools`)})]})}),(0,c.jsx)(r,{side:`right`,align:`start`,className:`w-48`,children:e.map(([e,t,n])=>(0,c.jsxs)(i,{onSelect:()=>d(e),children:[(0,c.jsx)(n,{size:16}),t]},e))})]})}export{l as default};
1
+ import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-a84Zp9dV.js";import{a as n,n as r,r as i,t as a}from"./dropdown-menu-pKRdLJUe.js";import{t as o}from"./ellipsis-CfGKfbq6.js";import{t as s}from"./button-CQA36izu.js";var c=e();function l({items:e,buttonClassName:l,compact:u=!1,onNavigate:d}){let{t:f}=t();return(0,c.jsxs)(a,{children:[(0,c.jsx)(n,{asChild:!0,children:(0,c.jsxs)(s,{variant:`ghost`,className:l,title:u?f(`navigation:workbench.moreTools`):void 0,children:[(0,c.jsx)(o,{size:16}),(0,c.jsx)(`span`,{className:u?`sr-only`:void 0,children:f(`navigation:workbench.moreTools`)})]})}),(0,c.jsx)(r,{side:`right`,align:`start`,className:`w-48`,children:e.map(([e,t,n])=>(0,c.jsxs)(i,{onSelect:()=>d(e),children:[(0,c.jsx)(n,{size:16}),t]},e))})]})}export{l as default};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/WorkspacePicker-B3liZkwe.js","assets/rolldown-runtime-B0Z9INg1.js","assets/vendor-react-DwNgTV1j.js","assets/use-i18n-a84Zp9dV.js","assets/i18n-8nTnthu6.js","assets/vendor-router-CZg2bCPV.js","assets/index-AF29hfx9.js","assets/index-BAmsg90v.css","assets/storage-BpAqa-YY.js","assets/vendor-state-GkUciC5H.js","assets/dist-Cfh4kzCK.js","assets/dist-B_a0oV4U.js","assets/dist-C3P9WH0T.js","assets/dist-D8Wfxh48.js","assets/utils-C8uzG5AZ.js","assets/vendor-ui-DvrYggeS.js","assets/createLucideIcon-Cd-3GVxJ.js","assets/arrow-up-DST6-qVQ.js","assets/check-2vYc6QaP.js","assets/chevron-right-C3t2Rckj.js","assets/folder-DPM8D8cf.js","assets/house-BNrzTkx9.js","assets/loader-circle-BOwQzHB-.js","assets/refresh-cw-TbWxTY4K.js","assets/triangle-alert-CE1q54ci.js","assets/api-YI8_cHpR.js","assets/http-Be2GB6DH.js","assets/abort-signal-f4JsiYKX.js","assets/button-CQA36izu.js","assets/alert-QoPGoIY6.js","assets/dialog-D-ER2p-D.js","assets/dist-BdkTa5R3.js","assets/es2015-0QT3KgdC.js","assets/x-07u4-129.js","assets/input-CvjGYteF.js"])))=>i.map(i=>d[i]);
2
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{p as t}from"./vendor-router-CZg2bCPV.js";import{t as n}from"./index-AF29hfx9.js";import{i as r,r as i}from"./vendor-react-DwNgTV1j.js";import{t as a}from"./use-i18n-a84Zp9dV.js";import{a as o,i as s,o as c}from"./vendor-state-GkUciC5H.js";import{t as l}from"./storage-BpAqa-YY.js";import{c as u,i as d,o as f,s as p}from"./dist-B_a0oV4U.js";import{a as m,c as h,i as g,l as ee,n as te,r as _,s as v,t as y,u as b}from"./dist-CXiO_DNx.js";import{t as x}from"./utils-C8uzG5AZ.js";import{t as S}from"./createLucideIcon-Cd-3GVxJ.js";import{n as ne,t as re}from"./pin-off-DRR1KEvN.js";import{a as ie,c as ae,d as oe,l as se,u as ce}from"./session-list-DkNhT87s.js";import{t as C}from"./chevron-right-C3t2Rckj.js";import{t as le}from"./circle-alert-DCChabnT.js";import{t as ue}from"./loader-circle-BOwQzHB-.js";import{t as de}from"./message-square-SKjZyY3v.js";import{a as fe}from"./sidebar-C3YJQV72.js";import{t as pe}from"./pencil-U08v_vV9.js";import{t as me}from"./plus-fQbSqB1n.js";import{t as he}from"./rotate-ccw-C0v8V77_.js";import{t as ge}from"./search-D0mqDaf_.js";import{t as w}from"./trash-2-CNrPOoPR.js";import{t as _e}from"./api-YI8_cHpR.js";import{t as ve}from"./button-CQA36izu.js";import{t as ye}from"./useQuery-D3P5wO_Z.js";import{a as be,t as T}from"./startup-queries-ByepQfGF.js";import{n as xe}from"./QueryClientProvider-CHJtxoX1.js";import{i as Se,r as Ce}from"./format-BRFKAYMT.js";import{_ as we,a as Te,m as Ee,o as De,p as Oe,s as ke,t as Ae}from"./events-KqdUtjsm.js";var E=e(r(),1),D=i(),O=Object.defineProperty,k=(e,t)=>O(e,`name`,{value:t,configurable:!0}),A=`ContextMenu`,[je,j]=p(A,[b]),M=b(),[N,P]=je(A),F=k(e=>{let{__scopeContextMenu:t,children:n,onOpenChange:r,open:i,dir:a,modal:o=!0}=e,s=E.useRef(!1),[c,l]=d({prop:i,defaultProp:!1,onChange:r,caller:A}),u=M(t);return(0,D.jsx)(N,{scope:t,open:c,onOpenChange:l,modal:o,hasInteractedRef:s,children:(0,D.jsx)(m,{...u,dir:a,open:c,onOpenChange:l,modal:o,children:n})})},`ContextMenu`),I=`ContextMenuTrigger`,L=E.forwardRef(k(function(e,t){let{__scopeContextMenu:n,disabled:r=!1,...i}=e,a=P(I,n),o=M(n),[s,c]=E.useState({x:0,y:0}),l=E.useMemo(()=>({current:{getBoundingClientRect:k(()=>DOMRect.fromRect({width:0,height:0,...s}),`getBoundingClientRect`)}}),[s]),d=E.useRef(0),p=E.useCallback(()=>window.clearTimeout(d.current),[]),m=k(e=>{a.hasInteractedRef.current=!0,c({x:e.clientX,y:e.clientY}),a.onOpenChange(!0)},`handleOpen`);return E.useEffect(()=>p,[p]),E.useEffect(()=>void(r&&p()),[r,p]),(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(y,{...o,virtualRef:l}),(0,D.jsx)(u.span,{"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,...i,ref:t,style:{WebkitTouchCallout:`none`,...e.style},onContextMenu:r?e.onContextMenu:f(e.onContextMenu,e=>{p(),m(e),e.preventDefault()}),onPointerDown:r?e.onPointerDown:f(e.onPointerDown,W(e=>{p(),a.open&&a.onOpenChange(!1),d.current=window.setTimeout(()=>m(e),700)})),onPointerMove:r?e.onPointerMove:f(e.onPointerMove,W(p)),onPointerCancel:r?e.onPointerCancel:f(e.onPointerCancel,W(p)),onPointerUp:r?e.onPointerUp:f(e.onPointerUp,W(p))})]})},`ContextMenuTrigger`)),R=k(e=>{let{__scopeContextMenu:t,...n}=e,r=M(t);return(0,D.jsx)(g,{...r,...n})},`ContextMenuPortal`),z=`ContextMenuContent`,Me=E.forwardRef(k(function(e,t){let{__scopeContextMenu:n,...r}=e,i=P(z,n),a=M(n),o=E.useRef(!1);return(0,D.jsx)(te,{...a,...r,ref:t,side:`right`,sideOffset:2,align:`start`,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),!t.defaultPrevented&&o.current&&t.preventDefault(),o.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),!t.defaultPrevented&&!i.modal&&(o.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-context-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-context-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-context-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-context-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`ContextMenuContent`)),Ne=E.forwardRef(k(function(e,t){let{__scopeContextMenu:n,...r}=e,i=M(n);return(0,D.jsx)(_,{...i,...r,ref:t})},`ContextMenuItem`)),B=`ContextMenuSub`,V=k(e=>{let{__scopeContextMenu:t,children:n,onOpenChange:r,open:i,defaultOpen:a}=e,o=M(t),[s,c]=d({prop:i,defaultProp:a??!1,onChange:r,caller:B});return(0,D.jsx)(v,{...o,open:s,onOpenChange:c,children:n})},`ContextMenuSub`),H=E.forwardRef(k(function(e,t){let{__scopeContextMenu:n,...r}=e,i=M(n);return(0,D.jsx)(ee,{...i,...r,ref:t})},`ContextMenuSubTrigger`)),U=E.forwardRef(k(function(e,t){let{__scopeContextMenu:n,...r}=e,i=M(n);return(0,D.jsx)(h,{...i,...r,ref:t,style:{...e.style,"--radix-context-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-context-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-context-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-context-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-context-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`ContextMenuSubContent`));function W(e){return t=>t.pointerType===`mouse`?void 0:e(t)}k(W,`whenTouchOrPen`);var G=F,K=L,Pe=R,Fe=Me,q=Ne,Ie=V,J=H,Le=U,Re=S(`folder-closed`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}],[`path`,{d:`M2 10h20`,key:`1ir3d8`}]]),ze=S(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]);function Y(e=``){let t=e.trim().replace(/\\/g,`/`),n=/^\/+$/u.test(t)?`/`:t.replace(/\/+$/,``);return/^[A-Za-z]:(?:\/|$)/.test(n)?n.toLowerCase():n}function X(e){return Y(e.cwd)||`\0`}function Be(e){let t=new Map;for(let n of e){let e=X(n),r=t.get(e)||{key:e,cwd:n.cwd||``,sessions:[]};r.sessions.push(n),t.set(e,r)}return[...t.values()]}function Ve(e,t,n=``){let r=new Set(e.slice(0,t).map(e=>e.id));return Be(e).map(e=>({...e,sessions:e.sessions.filter((e,t)=>t===0||r.has(e.id)||e.id===n)}))}function Z(e){return Array.isArray(e)?[...new Set(e.filter(e=>typeof e==`string`).map(Y))].filter(e=>e===`\0`||e.length>0&&!e.includes(`\0`)):[]}function He(e,t){return Z([...e,...t])}function Ue(e,t){let n=new Map(t.map((e,t)=>[e,t]));return[...e].sort((e,r)=>(n.get(e.key)??t.length)-(n.get(r.key)??t.length))}function We(e,t){return e.filter(e=>X(e)===t)}function Ge(e,t,n,r){return!e||!n.has(e)&&(!r||t.some(t=>t.id===e))?null:t[0]?.id||``}async function Ke(e,t){let n=[];for(let r of e)try{await t(r),n.push(r)}catch(e){return{deletedIds:n,failedId:r,error:e}}return{deletedIds:n,failedId:null,error:null}}function qe(e){let t=Y(e);return t&&t!==`\0`&&!t.includes(`\0`)?t:null}function Je(e){let t=Object.create(null);if(!e||typeof e!=`object`||Array.isArray(e))return t;for(let[n,r]of Object.entries(e)){let e=qe(n);if(!e||typeof r!=`string`)continue;let i=r.trim();i&&Array.from(i).length<=120&&(t[e]=i)}return t}var Ye=s(()=>n),Q=c()(o((e,t)=>({order:[],names:Je(void 0),rememberWorkspaces:n=>{let r=t().order,i=He(r,n);i.length===r.length&&i.every((e,t)=>e===r[t])||e({order:i})},setWorkspaceName:(n,r)=>{let i=typeof n==`string`?qe(n):null;if(!i||typeof r!=`string`)throw TypeError(`Invalid workspace name`);let a=r.trim();if(Array.from(a).length>120)throw RangeError(`Workspace name is too long`);let o=t().names;if((o[i]||``)===a)return;if(!Ye)throw Error(`Workspace preferences storage is unavailable`);let s=Je(o);a?s[i]=a:delete s[i];try{e({names:s})}catch(t){try{e({names:o})}catch{}throw t}}}),{name:`pisper-workspace-order`,storage:Ye,version:1,partialize:({order:e,names:t})=>({order:e,names:t}),merge:(e,t)=>({...t,order:Z(e&&typeof e==`object`&&`order`in e?e.order:void 0),names:Je(e&&typeof e==`object`&&`names`in e?e.names:void 0)})}));function Xe({...e}){return(0,D.jsx)(G,{"data-slot":`context-menu`,...e})}function Ze({className:e,...t}){return(0,D.jsx)(K,{"data-slot":`context-menu-trigger`,className:x(`select-none`,e),...t})}function Qe({...e}){return(0,D.jsx)(Ie,{"data-slot":`context-menu-sub`,...e})}function $e({className:e,...t}){return(0,D.jsx)(Pe,{children:(0,D.jsx)(Fe,{"data-slot":`context-menu-content`,className:x(`z-[200] max-h-(--radix-context-menu-content-available-height) min-w-36 origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...t})})}function $({className:e,inset:t,variant:n=`default`,...r}){return(0,D.jsx)(q,{"data-slot":`context-menu-item`,"data-inset":t,"data-variant":n,className:x(`group/context-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 focus:*:[svg]:text-accent-foreground data-[variant=destructive]:*:[svg]:text-destructive`,e),...r})}function et({className:e,inset:t,children:n,...r}){return(0,D.jsxs)(J,{"data-slot":`context-menu-sub-trigger`,"data-inset":t,className:x(`flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[n,(0,D.jsx)(C,{className:`ml-auto`})]})}function tt({className:e,...t}){return(0,D.jsx)(Le,{"data-slot":`context-menu-sub-content`,className:x(`z-[200] min-w-32 origin-(--radix-context-menu-content-transform-origin) overflow-hidden rounded-lg border bg-popover p-1 text-popover-foreground shadow-lg duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...t})}var nt=(0,E.lazy)(()=>t(()=>import(`./WorkspacePicker-B3liZkwe.js`).then(e=>({default:e.WorkspacePicker})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34]))),rt=24;function it({label:e,onClick:t,children:n}){return(0,D.jsx)(ve,{type:`button`,variant:`ghost`,className:`opacity-0 group-hover/workspace:opacity-100 group-focus-within/workspace:opacity-100 focus-visible:opacity-100 pointer-coarse:opacity-100 !size-7 !min-h-7 !shrink-0 !p-0 !text-[var(--text-muted)] hover:!bg-[var(--surface-hover)] hover:!text-[var(--text)] max-[650px]:!size-11 max-[650px]:!min-h-11`,title:e,"aria-label":e,onClick:t,children:n})}function at({navigate:e,requestText:t,requestConfirm:r,notify:i}){let{t:o,language:s}=a(),c=xe(),{isMobile:u,setOpenMobile:d}=fe(),[f,p]=(0,E.useState)(!0),[m,h]=(0,E.useState)(``),[g,ee]=(0,E.useState)(!1),[te,_]=(0,E.useState)(()=>new Set),v=Q(e=>e.order),y=Q(e=>e.rememberWorkspaces),b=Q(e=>e.names),x=Q(e=>e.setWorkspaceName),[S,O]=(0,E.useState)(()=>n.getItem(l.activeSession)||``),[k,A]=(0,E.useState)(``),[je,j]=(0,E.useState)(``),[M,N]=(0,E.useState)(!1),[P,F]=(0,E.useState)(``),{data:I}=ye({...be(`sessions`),refetchInterval:2e3});(0,E.useEffect)(()=>we(window,({deletedIds:e})=>{let t=new Set(e);c.setQueryData([`sessions`],e=>e&&{...e,sessions:e.sessions.filter(e=>!t.has(e.id))})}),[c]);let L=(0,E.useMemo)(()=>ie(I?.sessions||[]),[I]),R=(0,E.useMemo)(()=>{let e=m.trim().toLocaleLowerCase(s);return e?L.filter(t=>`${t.name||``} ${t.cwd||``} ${b[X(t)]||``}`.toLocaleLowerCase(s).includes(e)):L.filter(e=>!e.archived)},[s,m,L,b]),z=(0,E.useMemo)(()=>Be(L),[L]);(0,E.useEffect)(()=>{y(z.map(e=>e.key))},[z,y]);let Me=(0,E.useMemo)(()=>Ue(Ve(R,rt,S),v),[R,v,S]),Ne=(0,E.useMemo)(()=>new Map(z.map(e=>[e.key,e.sessions.length])),[z]),B=z.find(e=>e.key===k)||null,V=L.find(e=>e.id===je)||null,H=e=>e.cwd?b[e.key]||Se(e.cwd,s):o(`navigation:appSidebar.noWorkspace`);(0,E.useEffect)(()=>{let e=()=>{T(`sessions`,!0).catch(()=>{})},t=()=>{document.visibilityState===`visible`&&e()},r=e=>{let t=e.detail;O(t?.id||n.getItem(l.activeSession)||``)};return document.addEventListener(`visibilitychange`,t),window.addEventListener(Te,r),window.addEventListener(Ae,r),()=>{document.removeEventListener(`visibilitychange`,t),window.removeEventListener(Te,r),window.removeEventListener(Ae,r)}},[]);let U=t=>{O(t),Ee(t),e(`chat`),u&&d(!1)},W=t=>{Oe(t)&&(h(``),p(!0),_(e=>{let n=new Set(e);return n.delete(X({id:``,cwd:t})),n}),e(`chat`),u&&d(!1))},G=async(e,t=L)=>{let r=await Ke(e.map(e=>e.id),e=>_e(`/api/sessions/${encodeURIComponent(e)}`,{method:`DELETE`}));ke(r.deletedIds.length?{deletedIds:r.deletedIds}:void 0);let i=null;try{i=(await T(`sessions`,!0)).sessions}catch{}let a=new Set(r.deletedIds),o=i??t.filter(e=>!a.has(e.id)),s=Ge(n.getItem(l.activeSession)||S,o,a,i!==null);return s!==null&&(O(s),s?Ee(s):(n.removeItem(l.activeSession),De(``))),{...r,sessions:o,verified:i!==null}},K=async e=>{if(P)return;let t=e.cwd?`${H(e)} · ${e.cwd}`:H(e);F(e.key);try{let n=(await T(`sessions`,!0)).sessions,a=We(n,e.key);if(!a.length){i(o(`navigation:appSidebar.projectNoChats`,{project:t}),`info`);return}if(!await r({title:o(`navigation:appSidebar.deleteProject`),message:o(`navigation:appSidebar.deleteProjectConfirm`,{project:t,count:a.length}),confirmLabel:o(`navigation:appSidebar.deleteProjectAction`)}))return;let s=await G(a,n);if(!s.verified){i(o(`navigation:appSidebar.projectDeleteUnverified`,{project:t,deleted:s.deletedIds.length}),`error`);return}let c=We(s.sessions,e.key).length;if(s.failedId!==null||c){i(o(`navigation:appSidebar.projectDeletePartial`,{project:t,deleted:s.deletedIds.length,remaining:c}),`error`);return}i(o(`navigation:appSidebar.projectDeleted`,{project:t}))}catch(e){i(e instanceof ae?o(`chat:chatHistoryPage.sessionUpdateFailed`):e instanceof Error?e.message:String(e),`error`)}finally{F(``)}},Pe=async e=>{if(P)return;let t=e.name||o(`navigation:appSidebar.untitledChat`);if(await r({title:o(`chat:chatHistoryPage.deleteChat`),message:o(`chat:chatHistoryPage.deleteChatNameThisAlsoRemovesLocalChatHistory`,{name:t}),confirmLabel:o(`chat:chatHistoryPage.delete`)})){F(e.id);try{let t=await G([e]);if(t.failedId!==null)throw t.error??Error(o(`navigation:appSidebar.chatDeleteFailed`));i(o(`chat:chatHistoryPage.chatDeleted`))}catch(e){i(e instanceof Error?e.message:String(e),`error`)}finally{F(``)}}},Fe=async e=>{let n=await t({title:o(`chat:chatHistoryPage.renameChat`),inputLabel:o(`chat:chatHistoryPage.chatTitle`),value:e.name,confirmLabel:o(`chat:chatHistoryPage.save`)});if(n!==null&&n!==e.name)try{let t=await _e(`/api/sessions/${encodeURIComponent(e.id)}`,{method:`PATCH`,body:JSON.stringify({name:n})});ke({id:e.id,name:t.name}),T(`sessions`,!0).catch(()=>{}),i(o(`chat:chatHistoryPage.chatTitleUpdated`))}catch(e){i(e instanceof Error?e.message:String(e),`error`)}},q=(e,t)=>{try{x(e.cwd,t),i(o(`navigation:appSidebar.projectNameUpdated`))}catch{i(o(`navigation:appSidebar.projectNameSaveFailed`),`error`)}},Ie=async e=>{if(!e.cwd)return;let n=H(e),r=await t({title:o(`navigation:appSidebar.renameProject`),message:o(`navigation:appSidebar.renameProjectDescription`),inputLabel:o(`navigation:appSidebar.projectName`),value:n,maxLength:120,confirmLabel:o(`chat:chatHistoryPage.save`)});r===null||!r.trim()||r.trim()===n||q(e,r.trim())},J=async(e,t,n)=>{if(!P)try{let r=await se(e.id,t);c.setQueryData([`sessions`],e=>e&&{...e,sessions:e.sessions.map(e=>e.id===r.id?{...e,...r}:e)}),i(n)}catch(e){i(e instanceof Error?e.message:String(e),`error`)}},Le=e=>{_(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},Y=(e=``,t=``)=>{A(e),j(t)},Z=(e,t=``,n=``)=>{e.pointerType!==`mouse`&&Y(t,n)},He=t=>{e(t),u&&d(!1)};return(0,D.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col px-2 pt-3`,"aria-label":o(`navigation:appSidebar.recentChats`),children:[(0,D.jsxs)(`div`,{className:`mb-1 flex h-8 shrink-0 items-center gap-1 px-1.5`,children:[(0,D.jsxs)(`button`,{className:`mr-auto flex min-w-0 items-center gap-1 rounded-md px-1 py-1 text-xs text-muted-foreground hover:text-foreground`,"aria-controls":`sidebar-recent-sessions`,"aria-expanded":f,onClick:()=>p(e=>!e),children:[(0,D.jsx)(`span`,{children:o(`navigation:workbench.projects`)}),(0,D.jsx)(C,{className:f?`rotate-90`:``,size:12})]}),(0,D.jsx)(ve,{variant:`ghost`,size:`icon-sm`,className:`size-6 text-muted-foreground`,title:o(`navigation:workbench.filterSessions`),"aria-label":o(`navigation:workbench.filterSessions`),"aria-expanded":g,onClick:()=>ee(e=>!e),children:(0,D.jsx)(ge,{size:13})}),(0,D.jsx)(ve,{variant:`ghost`,size:`icon-sm`,className:`size-6 text-muted-foreground`,title:o(`navigation:appSidebar.newProject`),"aria-label":o(`navigation:appSidebar.newProject`),"aria-haspopup":`dialog`,"aria-expanded":M,onClick:()=>N(!0),children:(0,D.jsx)(ze,{size:14})}),(0,D.jsx)(`button`,{className:`rounded-md px-1 py-1 text-[11px] text-muted-foreground hover:text-foreground`,"aria-label":o(`navigation:appSidebar.viewAllCountChats`,{count:L.length}),onClick:()=>He(`chatHistory`),children:o(`navigation:appSidebar.viewAll`)})]}),(g||m)&&(0,D.jsxs)(`label`,{className:`mx-2 mb-2 flex h-8 shrink-0 items-center gap-2 rounded-lg border border-border px-2 text-muted-foreground focus-within:ring-1 focus-within:ring-ring`,children:[(0,D.jsx)(ge,{size:13,"aria-hidden":`true`}),(0,D.jsx)(`input`,{className:`min-w-0 flex-1 border-0 bg-transparent text-xs outline-none`,value:m,onChange:e=>h(e.target.value),placeholder:o(`navigation:appSidebar.searchChats`),"aria-label":o(`navigation:appSidebar.searchChats`)})]}),f&&(0,D.jsxs)(Xe,{onOpenChange:e=>{e||(A(``),j(``))},children:[(0,D.jsx)(Ze,{asChild:!0,children:(0,D.jsxs)(`div`,{className:`flex flex-1 min-h-0 flex-col gap-[2px] [padding-bottom:2px] overflow-y-auto [animation:page-in_var(--d1)_var(--ease-out)]`,id:`sidebar-recent-sessions`,onPointerDownCapture:e=>Z(e),onContextMenuCapture:()=>Y(),children:[Me.map(e=>{let t=te.has(e.key),n=H(e);return(0,D.jsxs)(`div`,{className:`nav-workspace-group [.nav-workspace-group_+_&]:mt-[3px]`,children:[(0,D.jsxs)(`div`,{className:`group/workspace flex min-w-0 items-center gap-[2px]`,onContextMenu:()=>A(e.key),onPointerDown:t=>Z(t,e.key),children:[(0,D.jsxs)(`button`,{className:`flex h-8 min-w-0 flex-1 items-center gap-1.5 rounded-lg px-2 text-left text-sm text-foreground hover:bg-sidebar-accent [&_span]:min-w-0 [&_span]:flex-1 [&_span]:truncate [&_small]:hidden [&_.is-open]:rotate-90`,"aria-expanded":!t,onClick:()=>Le(e.key),title:e.cwd||n,children:[(0,D.jsx)(C,{className:t?``:`is-open`,size:13}),(0,D.jsx)(Re,{size:13}),(0,D.jsx)(`span`,{children:n}),(0,D.jsx)(`small`,{children:Ne.get(e.key)||e.sessions.length})]}),e.cwd&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(it,{label:o(`navigation:appSidebar.renameProjectNamed`,{project:n}),onClick:()=>void Ie(e),children:(0,D.jsx)(pe,{size:14,"aria-hidden":`true`})}),(0,D.jsx)(it,{label:o(`navigation:appSidebar.newChatInWorkspace`,{workspace:e.cwd}),onClick:()=>W(e.cwd),children:(0,D.jsx)(me,{size:14})})]})]}),!t&&e.sessions.map(e=>(0,D.jsxs)(`button`,{className:`flex h-8 w-full items-center gap-1 rounded-lg pl-8 pr-2.5 text-left text-sm font-normal text-muted-foreground hover:bg-sidebar-accent hover:text-foreground ${e.id===S?`active-session bg-sidebar-accent text-foreground`:``}`,"aria-current":e.id===S?`page`:void 0,title:`${e.name||o(`navigation:appSidebar.untitledChat`)} · ${Ce(e.modified,s)}`,onClick:()=>U(e.id),onContextMenu:()=>j(e.id),onPointerDown:t=>Z(t,``,e.id),children:[e.streaming&&(0,D.jsx)(ue,{className:`mr-1 size-3.5 shrink-0 animate-spin text-foreground`,"aria-label":o(`navigation:appSidebar.running`)}),e.pinned&&(0,D.jsx)(ce,{className:`mr-1 size-3 shrink-0`,"aria-label":o(`navigation:appSidebar.pinned`)}),e.needsAttention&&(0,D.jsx)(le,{className:`mr-1 size-3 shrink-0`,"aria-label":o(`navigation:appSidebar.needsAttention`)}),e.unread&&(0,D.jsx)(`span`,{className:`mr-1 size-1.5 shrink-0 rounded-full bg-[var(--brand-blue)]`,"aria-label":o(`navigation:appSidebar.unread`)}),(0,D.jsx)(`span`,{className:`min-w-0 flex-1 select-none truncate`,children:e.name||o(`navigation:appSidebar.untitledChat`)}),(0,D.jsx)(`time`,{className:`shrink-0 text-xs text-muted-foreground/70`,dateTime:e.modified,children:Ce(e.modified,s)}),e.archived&&(0,D.jsx)(`span`,{className:`ml-auto text-[11px] font-normal text-muted-foreground`,children:o(`navigation:appSidebar.archived`)})]},e.id))]},e.key)}),!R.length&&(0,D.jsx)(`span`,{className:`[padding:8px] text-[var(--text-muted)] text-xs font-normal`,children:m.trim()?o(`navigation:appSidebar.noMatchingChats`):L.length?o(`navigation:appSidebar.noActiveChats`):o(`navigation:appSidebar.noChatHistoryYet`)})]})}),(0,D.jsx)($e,{className:`w-[220px]`,children:V?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)($,{onSelect:()=>U(V.id),children:[(0,D.jsx)(de,{size:13}),o(`navigation:appSidebar.openSession`)]}),(0,D.jsxs)($,{onSelect:()=>void Fe(V),children:[(0,D.jsx)(pe,{size:13}),o(`chat:chatHistoryPage.renameChat`)]}),(0,D.jsxs)($,{onSelect:()=>void J(V,{pinned:!V.pinned},V.pinned?o(`navigation:appSidebar.unpinned`):o(`navigation:appSidebar.pinned`)),children:[V.pinned?(0,D.jsx)(re,{size:13}):(0,D.jsx)(ce,{size:13}),V.pinned?o(`navigation:appSidebar.unpin`):o(`navigation:appSidebar.pin`)]}),(0,D.jsxs)($,{onSelect:()=>void J(V,{archived:!V.archived},V.archived?o(`navigation:appSidebar.restored`):o(`navigation:appSidebar.movedToArchive`)),children:[V.archived?(0,D.jsx)(ne,{size:13}):(0,D.jsx)(oe,{size:13}),V.archived?o(`navigation:appSidebar.restore`):o(`navigation:appSidebar.archive`)]}),V.unread&&(0,D.jsx)($,{onSelect:()=>void J(V,{read:!0},o(`navigation:appSidebar.markedRead`)),children:o(`navigation:appSidebar.markRead`)}),(0,D.jsxs)($,{variant:`destructive`,disabled:!!P,onSelect:()=>void Pe(V),children:[(0,D.jsx)(w,{size:13}),o(`chat:chatHistoryPage.delete`)]})]}):B?(0,D.jsxs)(D.Fragment,{children:[B.cwd&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)($,{onSelect:()=>W(B.cwd),children:[(0,D.jsx)(me,{size:13}),o(`navigation:appSidebar.newChat`)]}),(0,D.jsxs)($,{onSelect:()=>void Ie(B),children:[(0,D.jsx)(pe,{size:13}),o(`navigation:appSidebar.renameProject`)]}),b[B.key]&&(0,D.jsxs)($,{onSelect:()=>q(B,``),children:[(0,D.jsx)(he,{size:13}),o(`navigation:appSidebar.resetProjectName`)]})]}),(0,D.jsxs)($,{variant:`destructive`,disabled:!!P||!B.sessions.length,onSelect:()=>void K(B),children:[(0,D.jsx)(w,{size:13}),o(`navigation:appSidebar.deleteProject`)]})]}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)($,{onSelect:()=>N(!0),children:[(0,D.jsx)(ze,{size:13}),o(`navigation:appSidebar.newProject`)]}),(0,D.jsxs)(Qe,{children:[(0,D.jsxs)(et,{disabled:!z.length||!!P,children:[(0,D.jsx)(w,{size:13}),o(`navigation:appSidebar.deleteProject`)]}),(0,D.jsx)(tt,{className:`max-h-[70vh] max-w-[280px] overflow-y-auto`,children:z.map(e=>(0,D.jsx)($,{onSelect:()=>void K(e),children:(0,D.jsx)(`span`,{className:`truncate`,title:e.cwd||H(e),children:H(e)})},e.key))})]})]})})]}),M&&(0,D.jsx)(E.Suspense,{fallback:null,children:(0,D.jsx)(nt,{open:!0,description:o(`navigation:appSidebar.newProjectPickerDescription`),onOpenChange:N,onSelect:e=>{N(!1),W(e)}})})]})}export{at as SidebarRecentSessions};
@@ -1 +1 @@
1
- import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-BSZKFkMb.js";import{t as n}from"./utils-C8uzG5AZ.js";import{t as r}from"./settings-QX0oWnVK.js";import{t as i}from"./button-CQA36izu.js";var a=e();function o({onOpen:e,active:o=!1,compact:s=!1}){let{t:c}=t();return(0,a.jsxs)(i,{variant:`ghost`,onClick:e,"aria-current":o?`true`:void 0,title:s?c(`navigation:navigation.settings`):void 0,className:n(`h-11 w-full justify-start gap-2.5 rounded-lg px-2.5 text-sm font-normal text-foreground transition-colors hover:bg-sidebar-accent`,o&&`bg-sidebar-accent`,s&&`justify-center px-0`),children:[(0,a.jsx)(r,{className:`size-4`,"aria-hidden":`true`}),(0,a.jsx)(`span`,{className:s?`sr-only`:void 0,children:c(`navigation:navigation.settings`)})]})}export{o as SidebarSettingsButton};
1
+ import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-a84Zp9dV.js";import{t as n}from"./utils-C8uzG5AZ.js";import{t as r}from"./settings-QX0oWnVK.js";import{t as i}from"./button-CQA36izu.js";var a=e();function o({onOpen:e,active:o=!1,compact:s=!1}){let{t:c}=t();return(0,a.jsxs)(i,{variant:`ghost`,onClick:e,"aria-current":o?`true`:void 0,title:s?c(`navigation:navigation.settings`):void 0,className:n(`h-11 w-full justify-start gap-2.5 rounded-lg px-2.5 text-sm font-normal text-foreground transition-colors hover:bg-sidebar-accent`,o&&`bg-sidebar-accent`,s&&`justify-center px-0`),children:[(0,a.jsx)(r,{className:`size-4`,"aria-hidden":`true`}),(0,a.jsx)(`span`,{className:s?`sr-only`:void 0,children:c(`navigation:navigation.settings`)})]})}export{o as SidebarSettingsButton};
@@ -1 +1 @@
1
- import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-BSZKFkMb.js";import{t as n}from"./download-BCfIiuaL.js";import{t as r}from"./external-link-CEQqPcqc.js";import{t as i}from"./refresh-cw-TbWxTY4K.js";import{t as a}from"./rocket-BgLSjoHY.js";var o=e();function s({update:e,collapsed:s,onOpen:c}){let{t:l}=t(),u=e?.status||{state:`idle`},d=!!(e?.info?.desktop||e?.info?.mobile);if(![`available`,`downloading`,`downloaded`].includes(u.state))return null;let f=u.state===`downloading`,p=u.state===`downloaded`,m=l(p?`navigation:appSidebar.readyToRestart`:f?`navigation:appSidebar.downloading`:d?`navigation:appSidebar.updateAvailable`:`navigation:appSidebar.sourceUpdatesAvailable`),h=f?`${Math.round(u.percent||0)}%`:d&&u.availableVersion?`v${u.availableVersion}`:u.behindBy?l(`navigation:appSidebar.countCommitsBehindBranch`,{branch:u.branch||`main`,count:u.behindBy}):u.availableCommit?u.availableCommit.slice(0,7):l(`navigation:appSidebar.viewUpdateDetails`),g=p?a:f?i:d?n:r;return(0,o.jsxs)(`button`,{type:`button`,className:`flex min-h-11 w-full items-center rounded-[var(--r-sm)] border border-[var(--stroke)] bg-[var(--accent-soft)] text-[var(--text)] transition-colors hover:bg-sidebar-accent ${s?`justify-center px-0`:`gap-2.5 px-3 text-left`}`,title:`${m} · ${h}`,"aria-label":`${m} · ${h}`,onClick:c,children:[(0,o.jsx)(g,{className:f?`animate-spin shrink-0`:`shrink-0`,size:16}),!s&&(0,o.jsxs)(`span`,{className:`min-w-0`,children:[(0,o.jsx)(`strong`,{className:`block truncate text-[12px]`,children:m}),(0,o.jsx)(`small`,{className:`mt-0.5 block truncate text-[11px] text-[var(--text-muted)]`,children:h})]})]})}export{s as default};
1
+ import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-a84Zp9dV.js";import{t as n}from"./download-BCfIiuaL.js";import{t as r}from"./external-link-CEQqPcqc.js";import{t as i}from"./refresh-cw-TbWxTY4K.js";import{t as a}from"./rocket-BgLSjoHY.js";var o=e();function s({update:e,collapsed:s,onOpen:c}){let{t:l}=t(),u=e?.status||{state:`idle`},d=!!(e?.info?.desktop||e?.info?.mobile);if(![`available`,`downloading`,`downloaded`].includes(u.state))return null;let f=u.state===`downloading`,p=u.state===`downloaded`,m=l(p?`navigation:appSidebar.readyToRestart`:f?`navigation:appSidebar.downloading`:d?`navigation:appSidebar.updateAvailable`:`navigation:appSidebar.sourceUpdatesAvailable`),h=f?`${Math.round(u.percent||0)}%`:d&&u.availableVersion?`v${u.availableVersion}`:u.behindBy?l(`navigation:appSidebar.countCommitsBehindBranch`,{branch:u.branch||`main`,count:u.behindBy}):u.availableCommit?u.availableCommit.slice(0,7):l(`navigation:appSidebar.viewUpdateDetails`),g=p?a:f?i:d?n:r;return(0,o.jsxs)(`button`,{type:`button`,className:`flex min-h-11 w-full items-center rounded-[var(--r-sm)] border border-[var(--stroke)] bg-[var(--accent-soft)] text-[var(--text)] transition-colors hover:bg-sidebar-accent ${s?`justify-center px-0`:`gap-2.5 px-3 text-left`}`,title:`${m} · ${h}`,"aria-label":`${m} · ${h}`,onClick:c,children:[(0,o.jsx)(g,{className:f?`animate-spin shrink-0`:`shrink-0`,size:16}),!s&&(0,o.jsxs)(`span`,{className:`min-w-0`,children:[(0,o.jsx)(`strong`,{className:`block truncate text-[12px]`,children:m}),(0,o.jsx)(`small`,{className:`mt-0.5 block truncate text-[11px] text-[var(--text-muted)]`,children:h})]})]})}export{s as default};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-a84Zp9dV.js";import{t as i}from"./createLucideIcon-Cd-3GVxJ.js";import{t as a}from"./file-code-corner-BnE1ljT0.js";import{t as o}from"./image-BY_c3FYU.js";import{t as s}from"./refresh-cw-TbWxTY4K.js";import{t as c}from"./save-CHBB52P8.js";import{t as l}from"./sparkles-S_eeuqn9.js";import{t as u}from"./trash-2-CNrPOoPR.js";import{t as d}from"./wrench-6pg6_bqI.js";import{t as f}from"./api-YI8_cHpR.js";import{t as p}from"./button-CQA36izu.js";import{c as m,l as h,n as g,o as _,r as v,s as y,t as b}from"./app-primitives-SxfoFmHc.js";import{t as x}from"./usePagePrimaryAction-CWPC0C_f.js";var S=i(`package`,[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]),C=e(t(),1),w=n(),T=[`all`,`global`,`project`,`design`,`code`,`docs`,`privileged`];function E(e,t=``){return t?`${e}${e.includes(`?`)?`&`:`?`}sessionId=${encodeURIComponent(t)}`:e}function D(e,t){return t(e===`global`?`skills:skillsPage.global`:e===`project`?`skills:skillsPage.project`:e===`design`?`skills:skillsPage.design`:e===`code`?`skills:skillsPage.code`:e===`docs`?`skills:skillsPage.documents`:e===`privileged`?`skills:skillsPage.highPrivilege`:`skills:skillsPage.all`)}function O(e){let t=`${e?.name||``} ${e?.description||``}`.toLowerCase();return/image|visual|design|figma|svg|图片|视觉|设计/.test(t)?o:/doc|pdf|文档|说明/.test(t)?a:/install|package|market|安装|包/.test(t)?S:/code|test|plugin|skill|代码|测试|插件|技能/.test(t)?d:l}function k(e,t){if(t===`all`)return!0;if(t===`global`)return e.sourceInfo?.scope!==`project`;if(t===`project`)return e.sourceInfo?.scope===`project`;let n=`${e.name} ${e.description} ${(e.allowedTools||[]).join(` `)}`.toLowerCase();return t===`design`?/image|visual|design|figma|svg|图片|视觉|设计/.test(n):t===`code`?/code|test|plugin|代码|测试|插件/.test(n):t===`docs`?/doc|pdf|文档|说明/.test(n):t!==`privileged`||(e.allowedTools||[]).some(e=>[`bash`,`write`,`edit`].includes(e))}function A({notify:e,query:t=``,activeSessionId:n=``,registerPrimaryAction:i,requestText:a,requestConfirm:o}){let{t:l}=r(),[d,A]=(0,C.useState)(null),[j,M]=(0,C.useState)(``),[N,P]=(0,C.useState)(`all`),[F,I]=(0,C.useState)(!1),[L,R]=(0,C.useState)(!0),[,z]=(0,C.useState)(``),B=(0,C.useCallback)(async()=>{z(``);try{let e=await f(E(`/api/skills`,n));return A(e),M(t=>e.skills.some(e=>e.id===t)?t:e.skills[0]?.id||``),e}catch(e){return z(e instanceof Error?e.message:String(e)),null}finally{R(!1)}},[n]);(0,C.useEffect)(()=>{B()},[B]);let V=(0,C.useCallback)(async()=>{let t=await a?.({title:l(`skills:skillsPage.importGlobalSkill`),message:l(`skills:skillsPage.globalSkillSourceHelp`),inputLabel:l(`skills:skillsPage.skillSource`),placeholder:`E:\\path\\to\\skill, npm:@scope/package, or https://github.com/...`,maxLength:2e3,confirmLabel:l(`skills:skillsPage.continue`)});if(t?.trim()&&await o?.({title:l(`skills:skillsPage.importGlobalSkill`),message:l(`skills:skillsPage.skillsProvideInstructionsToTheAgentAndMayIncludeExecutableScriptsConfirmThatYouTrustTheSource`),confirmLabel:l(`skills:skillsPage.import`),tone:`danger`})!==!1){I(!0),z(``);try{let r=await f(E(`/api/skills/install`,n),{method:`POST`,body:JSON.stringify({source:t})});A(r),M(r.installed?.[0]?.id||r.skills[0]?.id||``),e(l(`skills:skillsPage.skillInstalledAndLoadedIntoTheAgentRuntime`),`success`)}catch(t){let n=t instanceof Error?t.message:String(t);z(n),e(n,`error`)}finally{I(!1)}}},[n,e,o,a,l]);if(x(i,V),L&&!d)return(0,w.jsx)(`div`,{className:`skills-page flex min-h-[100%] flex-col gap-[12px]`,children:(0,w.jsxs)(v,{children:[(0,w.jsx)(s,{className:`animate-spin`,size:23}),(0,w.jsx)(`h2`,{children:l(`skills:skillsPage.loadingSkills`)}),(0,w.jsx)(`p`,{children:l(`skills:skillsPage.scanningSkillDirectoriesAndConfiguredPackages`)})]})});let H=d?.skills||[],U=H.filter(e=>k(e,N)&&`${e.name} ${e.description}`.toLowerCase().includes(t.toLowerCase())),W=H.filter(e=>e.sourceInfo?.scope!==`project`),G=H.filter(e=>e.sourceInfo?.scope===`project`),K=U.filter(e=>e.sourceInfo?.scope!==`project`),q=U.filter(e=>e.sourceInfo?.scope===`project`),J=H.find(e=>e.id===j)||U[0]||H[0]||null,Y=(d?.packages||[]).map(e=>({source:e.source,description:e.scope===`project`?l(`skills:skillsPage.projectScopedConfiguration`):l(`skills:skillsPage.userScopedConfiguration`),status:e.installed?l(`skills:skillsPage.locallyReady`):l(`skills:skillsPage.notMaterialized`),tone:e.installed?`green`:`gray`})).filter(e=>`${e.source} ${e.description}`.toLowerCase().includes(t.toLowerCase())),X=async(e,t)=>{if(e){I(!0),z(``);try{let r=await f(E(`/api/skills/${encodeURIComponent(e.id)}`,n),{method:`PATCH`,body:JSON.stringify(t)});A(e=>{if(!e)return e;let t=e.skills.map(e=>e.id===r.id?r:e);return{...e,skills:t,counts:{...e.counts,enabled:t.filter(e=>e.enabled).length,modelInvocable:t.filter(e=>e.enabled&&e.modelInvocationEnabled).length}}})}catch(e){z(e instanceof Error?e.message:String(e))}finally{I(!1)}}},Z=async()=>{I(!0),z(``);try{A(await f(E(`/api/skills/reload`,n),{method:`POST`,body:`{}`})),e(l(`skills:skillsPage.skillSettingsSavedAndReloaded`),`success`)}catch(e){z(e instanceof Error?e.message:String(e))}finally{I(!1)}},Q=async()=>{if(J?.removable&&await o?.({title:l(`skills:skillsPage.uninstallSkill`),message:l(`skills:skillsPage.thisRemovesTheSkillDirectoryInstalledByPisperItDoesNotUninstallTheOriginalNpmOrGitPackage`),confirmLabel:l(`skills:skillsPage.uninstall`),tone:`danger`})!==!1){I(!0),z(``);try{await f(E(`/api/skills/${encodeURIComponent(J.id)}`,n),{method:`DELETE`});let t=await B();M(t?.skills[0]?.id||``),e(l(`skills:skillsPage.skillUninstalled`),`success`)}catch(t){let n=t instanceof Error?t.message:String(t);z(n),e(n,`error`)}finally{I(!1)}}},$=(e,t,n,r,i=``)=>(0,w.jsxs)(`section`,{className:`skill-scope [.skill-scope_+_&]:[border-top:1px_solid_var(--stroke)] [.skill-scope_+_&]:pt-[14px]`,children:[(0,w.jsxs)(`div`,{className:`skill-scope-head [&_>_div]:min-w-0 [&_small]:block [&_small]:overflow-hidden [&_small]:text-[var(--text-muted)] [&_small]:font-[ui-monospace,_SFMono-Regular,_Consolas,_'Liberation_Mono',_monospace] [&_small]:text-[11px] [&_small]:text-ellipsis [&_small]:whitespace-nowrap [&_>_span]:min-w-[24px] [&_>_span]:text-[var(--text-secondary)] [&_>_span]:text-[12px] [&_>_span]:font-[600] [&_>_span]:text-right flex min-w-0 items-start justify-between gap-[10px]`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(_,{title:e}),i&&(0,w.jsx)(`small`,{title:i,children:i})]}),(0,w.jsx)(`span`,{children:t.length})]}),t.length?t.map(e=>{let t=O(e);return(0,w.jsxs)(`div`,{className:`skill-row grid w-full grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-[9px] border-0 [border-top:1px_solid_var(--stroke-soft)] bg-transparent p-[10px_8px] text-left hover:rounded-[var(--r-sm)] hover:bg-[var(--accent-soft)] [&.selected]:rounded-[var(--r-sm)] [&.selected]:bg-[var(--accent-soft)] [&_>_span:nth-child(2)]:flex [&_>_span:nth-child(2)]:flex-col [&_>_span:nth-child(2)]:gap-[3px] [&_strong]:text-[13px] [&_small]:text-[var(--text-muted)] [&_small]:text-[13px] grid-cols-[minmax(0,1fr)_auto] [padding-block:4px] ${J?.id===e.id?`selected`:``}`,children:[(0,w.jsxs)(`button`,{className:`skill-row-main [&_>_span:nth-child(2)]:flex [&_>_span:nth-child(2)]:min-w-0 [&_>_span:nth-child(2)]:flex-col [&_>_span:nth-child(2)]:gap-[3px] grid min-w-0 grid-cols-[auto_minmax(0,1fr)] items-center gap-[9px] border-0 bg-transparent [padding:6px_4px] text-left`,onClick:()=>M(e.id),children:[(0,w.jsx)(`span`,{className:`list-icon [.chat-resource-list_&]:grid [.chat-resource-list_&]:w-[28px] [.chat-resource-list_&]:h-[28px] [.chat-resource-list_&]:place-items-center [.chat-resource-list_&]:rounded-[var(--r-sm)] [.chat-resource-list_&]:bg-[var(--surface-subtle)] [.chat-resource-list_&]:text-[var(--star-strong)] [.session-workflow-summary_&]:grid [.session-workflow-summary_&]:w-[28px] [.session-workflow-summary_&]:h-[28px] [.session-workflow-summary_&]:place-items-center [.session-workflow-summary_&]:rounded-[var(--r-sm)] [.session-workflow-summary_&]:bg-[var(--surface-subtle)] [.session-workflow-summary_&]:text-[var(--star-strong)] grid w-[27px] h-[27px] place-items-center rounded-[var(--r-sm)] bg-[var(--accent-soft)] text-[var(--star-strong)] [.workflow-template-gallery_&]:grid [.workflow-template-gallery_&]:w-[32px] [.workflow-template-gallery_&]:h-[32px] [.workflow-template-gallery_&]:place-items-center [.workflow-template-gallery_&]:rounded-[var(--r-sm)] [.workflow-template-gallery_&]:bg-[var(--surface-subtle)] [.workflow-template-gallery_&]:text-[var(--star-strong)]`,children:(0,w.jsx)(t,{size:15})}),(0,w.jsxs)(`span`,{children:[(0,w.jsx)(`strong`,{children:e.name}),(0,w.jsx)(`small`,{className:`line-clamp-2`,title:e.description,children:e.description})]})]}),(0,w.jsx)(y,{value:e.enabled,disabled:F,ariaLabel:l(`skills:skillsPage.toggleSkillName`,{name:e.name}),onChange:t=>void X(e,{enabled:t})})]},e.id)}):(0,w.jsx)(`p`,{className:`muted-copy m-[8px_0_14px] text-[var(--text-secondary)] text-[12px] leading-[1.55] skills-empty-copy !m-[8px_2px_4px]`,children:n.length?l(`skills:skillsPage.noSkillsMatchTheCurrentFilter`):r})]});return(0,w.jsxs)(`div`,{className:`skills-page flex min-h-[100%] flex-col gap-[12px]`,children:[(0,w.jsx)(m,{options:T.map(e=>D(e,l)),value:D(N,l),onChange:e=>P(T.find(t=>D(t,l)===e)||`all`)}),(0,w.jsxs)(`div`,{className:`skills-layout max-[1150px]:grid-cols-[repeat(2,minmax(0,1fr))] max-[650px]:grid-cols-[1fr] grid min-h-0 flex-1 grid-cols-[minmax(240px,.85fr)_minmax(290px,1.05fr)_minmax(280px,1fr)] gap-[12px]`,children:[(0,w.jsxs)(b,{className:`flex flex-col gap-[16px]`,children:[N!==`project`&&$(l(`skills:skillsPage.globalSkills`),K,W,l(`skills:skillsPage.noGlobalSkills`),d?.locations?.global||`~/.pisper/agent/skills`),N!==`global`&&$(l(`skills:skillsPage.projectSkills`),q,G,l(`skills:skillsPage.noProjectSkills`),d?.locations?.project||(d?.cwd?`${d.cwd.replace(/[\\/]$/,``)}/.pisper/skills`:``))]}),(0,w.jsxs)(b,{children:[(0,w.jsxs)(g,{children:[(0,w.jsx)(_,{title:l(`skills:skillsPage.configuredSkillPackages`)}),(0,w.jsx)(`span`,{className:`text-[var(--text-secondary)] text-[12px] font-[600]`,children:l(`skills:skillsPage.countSkillPackages`,{count:Y.length})})]}),Y.length?Y.map(e=>(0,w.jsxs)(`div`,{className:`market-row [&_>_span:nth-child(2)]:flex [&_>_span:nth-child(2)]:flex-col [&_>_span:nth-child(2)]:gap-[3px] [&_strong]:text-[13px] [&_small]:text-[var(--text-muted)] [&_small]:text-[13px] [&_strong]:overflow-hidden [&_strong]:text-ellipsis [&_strong]:whitespace-nowrap grid min-h-[48px] grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-[8px] [border-top:1px_solid_var(--stroke-soft)] [padding:6px_2px]`,children:[(0,w.jsx)(`span`,{className:`list-icon [.chat-resource-list_&]:grid [.chat-resource-list_&]:w-[28px] [.chat-resource-list_&]:h-[28px] [.chat-resource-list_&]:place-items-center [.chat-resource-list_&]:rounded-[var(--r-sm)] [.chat-resource-list_&]:bg-[var(--surface-subtle)] [.chat-resource-list_&]:text-[var(--star-strong)] [.session-workflow-summary_&]:grid [.session-workflow-summary_&]:w-[28px] [.session-workflow-summary_&]:h-[28px] [.session-workflow-summary_&]:place-items-center [.session-workflow-summary_&]:rounded-[var(--r-sm)] [.session-workflow-summary_&]:bg-[var(--surface-subtle)] [.session-workflow-summary_&]:text-[var(--star-strong)] grid w-[27px] h-[27px] place-items-center rounded-[var(--r-sm)] bg-[var(--accent-soft)] text-[var(--star-strong)] [.workflow-template-gallery_&]:grid [.workflow-template-gallery_&]:w-[32px] [.workflow-template-gallery_&]:h-[32px] [.workflow-template-gallery_&]:place-items-center [.workflow-template-gallery_&]:rounded-[var(--r-sm)] [.workflow-template-gallery_&]:bg-[var(--surface-subtle)] [.workflow-template-gallery_&]:text-[var(--star-strong)]`,children:(0,w.jsx)(S,{size:15})}),(0,w.jsxs)(`span`,{children:[(0,w.jsx)(`strong`,{title:e.source,children:e.source}),(0,w.jsx)(`small`,{children:e.description})]}),(0,w.jsx)(h,{tone:e.tone,children:e.status})]},e.source)):(0,w.jsx)(`p`,{className:`muted-copy m-[8px_0_14px] text-[var(--text-secondary)] text-[12px] leading-[1.55] skills-empty-copy !m-[8px_2px_4px]`,children:l(`skills:skillsPage.noSkillPackagesAreConfiguredYetAfterYouInstallASkillItsSourceWillAppearHere`)})]}),(0,w.jsxs)(`div`,{className:`detail-stack flex min-w-0 flex-col gap-[12px] [.mcp-layout_>_&]:min-h-0 max-[1150px]:[.memory-layout_>_&]:[grid-column:1/-1] max-[1150px]:[.memory-layout_>_&]:grid max-[1150px]:[.memory-layout_>_&]:grid-cols-[repeat(2,minmax(0,1fr))] max-[1150px]:[.mcp-layout_>_&]:[grid-column:1/-1] max-[1150px]:[.mcp-layout_>_&]:grid max-[1150px]:[.mcp-layout_>_&]:grid-cols-[repeat(2,minmax(0,1fr))] max-[1150px]:[.skills-layout_>_&]:[grid-column:1/-1] max-[1150px]:[.skills-layout_>_&]:grid max-[1150px]:[.skills-layout_>_&]:grid-cols-[repeat(2,minmax(0,1fr))] max-[650px]:[.memory-layout_>_&]:[grid-column:auto] max-[650px]:[.memory-layout_>_&]:grid-cols-[1fr] max-[650px]:[.mcp-layout_>_&]:[grid-column:auto] max-[650px]:[.mcp-layout_>_&]:grid-cols-[1fr] max-[650px]:[.skills-layout_>_&]:[grid-column:auto] max-[650px]:[.skills-layout_>_&]:grid-cols-[1fr]`,children:[(0,w.jsxs)(b,{children:[(0,w.jsx)(_,{title:l(`skills:skillsPage.selectedSkill`)}),(0,w.jsx)(`h2`,{children:J?.name||l(`skills:skillsPage.noSkillAvailable`)}),(0,w.jsx)(`p`,{className:`muted-copy m-[8px_0_14px] text-[var(--text-secondary)] text-[12px] leading-[1.55]`,children:J?.description||l(`skills:skillsPage.addGlobalOrProjectSkill`)}),[[l(`skills:skillsPage.triggerMode`),J?.modelInvocationEnabled?l(`skills:skillsPage.automaticManual`):l(`skills:skillsPage.manualOnly`)],[l(`skills:skillsPage.permissions`),J?.allowedTools?.length?J.allowedTools.join(`, `):l(`skills:skillsPage.usesChatToolPermissions`)],[l(`skills:skillsPage.scope`),J?.sourceInfo?.scope===`project`?l(`skills:skillsPage.project`):l(`skills:skillsPage.global`)],[l(`skills:skillsPage.version`),J?.version||`latest`],[l(`skills:skillsPage.source`),J?.source||`—`]].map(e=>(0,w.jsxs)(`div`,{className:`key-value [&:first-of-type]:mt-[7px] [&_span]:text-[var(--text-muted)] [&_button]:flex [&_button]:items-center [&_button]:gap-[4px] [&_button]:border-0 [&_button]:bg-transparent [&_button]:text-[var(--text-soft)] [&_button]:text-[12px] [&_strong]:min-w-0 [&_strong]:overflow-hidden [&_strong]:text-[13px] [&_strong]:text-ellipsis [&_strong]:whitespace-nowrap flex min-h-[31px] items-center justify-between gap-[10px] [border-top:1px_solid_var(--stroke-soft)] text-[13px]`,children:[(0,w.jsx)(`span`,{children:e[0]}),(0,w.jsx)(`strong`,{children:e[1]})]},e[0])),(0,w.jsxs)(p,{variant:J?.removable?`destructive`:`default`,size:`lg`,className:`w-full`,disabled:F,onClick:J?.removable?Q:Z,children:[J?.removable?(0,w.jsx)(u,{size:14}):(0,w.jsx)(c,{size:14}),J?.removable?l(`skills:skillsPage.uninstallSkill`):l(`skills:skillsPage.saveSettings`)]})]}),(0,w.jsxs)(b,{children:[(0,w.jsx)(_,{title:l(`skills:skillsPage.triggerConditions`)}),[[l(`skills:skillsPage.allowAutomaticModelInvocation`),!!J?.modelInvocationEnabled,!1,e=>void X(J,{modelInvocationEnabled:e})],[l(`skills:skillsPage.supportManualSkillCommand`),!!J?.command,!0],[l(`skills:skillsPage.projectScopedSkill`),J?.sourceInfo?.scope===`project`,!0],[l(`skills:skillsPage.declaresRequiredTools`),!!J?.allowedTools?.length,!0]].map(([e,t,n,r])=>(0,w.jsxs)(`label`,{className:`check-row [&_input]:[accent-color:var(--star-strong)] flex items-center gap-[7px] [border-top:1px_solid_var(--stroke-soft)] [padding:8px_2px] text-[12px]`,children:[(0,w.jsx)(`input`,{type:`checkbox`,checked:t,disabled:!J||F||n,onChange:e=>r?.(e.target.checked)}),(0,w.jsx)(`span`,{children:e})]},e))]})]})]})]})}export{A as SkillsPage};