pisper 0.6.19 → 0.6.20

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 (118) hide show
  1. package/package.json +5 -5
  2. package/web/.vite/manifest.json +558 -550
  3. package/web/assets/{AppDialog-Bq_kuweh.js → AppDialog-BKTqwx46.js} +1 -1
  4. package/web/assets/{AppOverlays-C6-uz2I7.js → AppOverlays-DEYd3Zud.js} +1 -1
  5. package/web/assets/{AssetsPage-nWK-SI9U.js → AssetsPage-BsIG0e5H.js} +1 -1
  6. package/web/assets/{BoardPage-BdI3hfz8.js → BoardPage-CgbOwsbF.js} +3 -3
  7. package/web/assets/{ChannelsPage-CP8J3G-V.js → ChannelsPage-C9eEdxbz.js} +1 -1
  8. package/web/assets/{ChatAppearancePage-Cr8N98HJ.js → ChatAppearancePage-CBnvknpv.js} +1 -1
  9. package/web/assets/{ChatHistoryPage-9AWN-55B.js → ChatHistoryPage-Bq-_Qawn.js} +1 -1
  10. package/web/assets/ChatPage-Bwn6Qfok.js +553 -0
  11. package/web/assets/{ConfigPage-CU_oPhEG.js → ConfigPage-D44C5I7w.js} +2 -2
  12. package/web/assets/{DesktopWindowControls-CoqP7BM1.js → DesktopWindowControls-DGhN5dWj.js} +1 -1
  13. package/web/assets/{FeaturePage-C6kLKix5.js → FeaturePage-B3PLRtEG.js} +1 -1
  14. package/web/assets/{FileAttachmentPreview-C4qvBJGC.js → FileAttachmentPreview-fSmyWf24.js} +1 -1
  15. package/web/assets/{FloatingWidgets-DSbRqMGT.js → FloatingWidgets-C1_4vp7k.js} +1 -1
  16. package/web/assets/{FocusRuntimeControls-DlBh7Vqg.js → FocusRuntimeControls-DraooZz_.js} +1 -1
  17. package/web/assets/{GitDiffViewer-DGkjG02b.js → GitDiffViewer-XzdYQWbX.js} +1 -1
  18. package/web/assets/{ManageProjectsDialog-BFiDAKW5.js → ManageProjectsDialog-BlXjm1PQ.js} +1 -1
  19. package/web/assets/{MarkdownMessage-BiGbYY8R.js → MarkdownMessage-B-IixrQ3.js} +1 -1
  20. package/web/assets/{McpPage-myrbtgSi.js → McpPage-D0Zmfgbq.js} +1 -1
  21. package/web/assets/{MemoryPage-BhKLCAgT.js → MemoryPage-DgZ7cL70.js} +1 -1
  22. package/web/assets/{MobileNavigation-BrLK8gc5.js → MobileNavigation-BIt1CBum.js} +1 -1
  23. package/web/assets/{MorePage-B6UzpykD.js → MorePage-BZ4iZ1n_.js} +1 -1
  24. package/web/assets/{NewFolderDialog-CdALMU5C.js → NewFolderDialog-W9wLUVXP.js} +1 -1
  25. package/web/assets/{PageHeader-CpubVScP.js → PageHeader-DcCyaFp0.js} +1 -1
  26. package/web/assets/{PhoneDrawer-BapKZhl9.js → PhoneDrawer-B_eKy4tt.js} +1 -1
  27. package/web/assets/{PhoneMenuButton-WhIGM1zy.js → PhoneMenuButton-CBT0H1Cn.js} +1 -1
  28. package/web/assets/{PhoneTopBar-CjMeneXU.js → PhoneTopBar-Czpvw2ML.js} +1 -1
  29. package/web/assets/{PluginsPage-BEpVVSAC.js → PluginsPage-wk5WpJ7Z.js} +1 -1
  30. package/web/assets/{SafeModePrompt-HogcxEdk.js → SafeModePrompt-Dtq5wVfV.js} +1 -1
  31. package/web/assets/{SchedulesPage-ML5Sl4S4.js → SchedulesPage-BtRe2Qht.js} +1 -1
  32. package/web/assets/SessionBrowserPane-D2Z-J6tl.js +2 -0
  33. package/web/assets/{SessionContextPanel-guilbPz7.js → SessionContextPanel-Cg8AW4l1.js} +2 -2
  34. package/web/assets/{SessionHome-BLhLJsZO.js → SessionHome-DIpyJQVn.js} +1 -1
  35. package/web/assets/SessionInspector-DdpBBhNr.js +1 -0
  36. package/web/assets/{SessionShell-CMGzYCcG.js → SessionShell-ocBFDevg.js} +1 -1
  37. package/web/assets/{SettingsSidebar-BKdrNAvp.js → SettingsSidebar-CP5t-q0e.js} +1 -1
  38. package/web/assets/{ShortcutHelpDialog-DgQKobJy.js → ShortcutHelpDialog-BOcP90RU.js} +1 -1
  39. package/web/assets/{ShortcutKeys-B1HCKuqe.js → ShortcutKeys-CBl2x5Yl.js} +1 -1
  40. package/web/assets/{SidebarUpdateStatus-DtpsclSa.js → SidebarUpdateStatus-CqZx7khD.js} +1 -1
  41. package/web/assets/{SkillsPage-JwfOUart.js → SkillsPage-BGyMMq-9.js} +1 -1
  42. package/web/assets/{TaskProcessesPane-CUUFhziU.js → TaskProcessesPane-B43p2Dvr.js} +1 -1
  43. package/web/assets/{TaskTerminalView-BgxdaUIZ.js → TaskTerminalView-BMjmp-4_.js} +1 -1
  44. package/web/assets/{TerminalPanel-B4VMm8q_.js → TerminalPanel-CH2-Yc1F.js} +1 -1
  45. package/web/assets/{WebDesktopPet-C10BvWBl.js → WebDesktopPet-Fy9xj1bh.js} +1 -1
  46. package/web/assets/{WorkflowsPage-iqO_9OJO.js → WorkflowsPage-DvZsyJSV.js} +1 -1
  47. package/web/assets/{WorkspacePicker-C0t_ekAf.js → WorkspacePicker-LbBXFH77.js} +1 -1
  48. package/web/assets/{api-Dg-aNpVe.js → api-m-Yq8n0q.js} +1 -1
  49. package/web/assets/{app-update-8hmqlQl6.js → app-update-DVn3toIR.js} +1 -1
  50. package/web/assets/{approval-confirm-77ZLTNZI.js → approval-confirm-Ch86qdyC.js} +1 -1
  51. package/web/assets/{board-projects-CnDn05fw.js → board-projects-KHcPQYWz.js} +1 -1
  52. package/web/assets/bots-store-BMcWJ2Gm.js +1 -0
  53. package/web/assets/{chat-api-Dy5Hkicx.js → chat-api-DgJdhfOP.js} +1 -1
  54. package/web/assets/{client-store-DF9a8Ka9.js → client-store-BkVlLM-4.js} +1 -1
  55. package/web/assets/{config-search-BA9qWX5h.js → config-search-BqYT_Xre.js} +1 -1
  56. package/web/assets/{dialog-CtFjznlx.js → dialog-5MLAAE-f.js} +1 -1
  57. package/web/assets/{events-D0dbOYFR.js → events-B0F69Vd3.js} +1 -1
  58. package/web/assets/{folder-paths-DEFkIxr2.js → folder-paths-CdOS1VLF.js} +1 -1
  59. package/web/assets/{hosts-BBCDdN-M.js → hosts-CoGHAtF9.js} +1 -1
  60. package/web/assets/i18n-Du-JO3Qx.js +1 -0
  61. package/web/assets/index-BY7X-ZtU.css +2 -0
  62. package/web/assets/{index-DsXdZRdL.js → index-DmohsuQg.js} +2 -2
  63. package/web/assets/{mount-app-BDzqFalE.js → mount-app-Cr5Uq-cP.js} +3 -3
  64. package/web/assets/{permission-rules-api-CPImVuda.js → permission-rules-api-CAxfABVR.js} +1 -1
  65. package/web/assets/{pick-system-directory-B1clvHS6.js → pick-system-directory-ByTVOp-v.js} +1 -1
  66. package/web/assets/{placements-DNdBLaY4.js → placements-CuVM9Xxs.js} +2 -2
  67. package/web/assets/{popover-DN1mndHQ.js → popover-DUWwlhPy.js} +1 -1
  68. package/web/assets/{public-Cec32eBv.js → public-B00uoqCB.js} +2 -2
  69. package/web/assets/{public-CNoWpIiC.js → public-CGbDaxd0.js} +1 -1
  70. package/web/assets/public-CWbnixwI.js +3 -0
  71. package/web/assets/{public-components-BpHOXPbD.js → public-components-DGfACSCk.js} +1 -1
  72. package/web/assets/public-diff-DIMQ2JTm.js +1 -0
  73. package/web/assets/public-events-CxK6EdoY.js +1 -0
  74. package/web/assets/{public-flags-BYEBqRMd.js → public-flags-BRenaSzJ.js} +1 -1
  75. package/web/assets/public-session-BeSwdD6a.js +1 -0
  76. package/web/assets/public-sidebar-CAWnINZG.js +1 -0
  77. package/web/assets/{runtime-capabilities-store-B5Bam7pC.js → runtime-capabilities-store-DWW9jolt.js} +1 -1
  78. package/web/assets/{safe-mode-instance-CJE36ukZ.js → safe-mode-instance-65Kg_IPn.js} +1 -1
  79. package/web/assets/safe-mode-sentinel-CIemi_6b.js +1 -0
  80. package/web/assets/{session-change-summary-api-CTAw_Fpq.js → session-change-summary-api-CbVgbX2o.js} +1 -1
  81. package/web/assets/{session-home-BrU5Pj9S.js → session-home-LwsMdqJu.js} +1 -1
  82. package/web/assets/{session-organization-api-I4CSVACP.js → session-organization-api-BmX-aNPa.js} +1 -1
  83. package/web/assets/{session-scope-7eIXCeDX.js → session-scope-Bz6CeMq0.js} +1 -1
  84. package/web/assets/{session-tree-actions-CnUc7KFV.js → session-tree-actions-BLL1s_Ws.js} +1 -1
  85. package/web/assets/{session-tree-summary-C224W_G6.js → session-tree-summary-BfRtAGwx.js} +1 -1
  86. package/web/assets/{shortcuts-LBxOVau1.js → shortcuts-Cgx6V2jI.js} +1 -1
  87. package/web/assets/side-chat-context-Cm84nqzk.js +7 -0
  88. package/web/assets/{sidebar-rMS3pmrQ.js → sidebar-C0AjfIUc.js} +1 -1
  89. package/web/assets/{sidebar-store-BGW5sD2q.js → sidebar-store-BhEocW8t.js} +1 -1
  90. package/web/assets/{speech-session-DTzw8niM.js → speech-session-BI_qH5Lw.js} +1 -1
  91. package/web/assets/{startup-queries-qM8tclDJ.js → startup-queries-Cevfi-_Z.js} +1 -1
  92. package/web/assets/{use-i18n-BuN5i-jP.js → use-i18n-Cyg5th6Z.js} +1 -1
  93. package/web/assets/{use-open-bot-J8_CcQDt.js → use-open-bot-HoswiH7t.js} +1 -1
  94. package/web/assets/{use-studio-actions-kEfc-Vr2.js → use-studio-actions-CGzcb2Fx.js} +1 -1
  95. package/web/assets/{useCatalogProjects-MO_MVlJu.js → useCatalogProjects-hKlUioWa.js} +1 -1
  96. package/web/assets/{useNewProjectPicker-B5OQ8T-2.js → useNewProjectPicker-C9X_vJdU.js} +2 -2
  97. package/web/assets/{useNow-ChT5op7P.js → useNow-BBVE-LCR.js} +1 -1
  98. package/web/assets/{usePhoneShell-Bkus67DO.js → usePhoneShell-CDP-O4Gc.js} +1 -1
  99. package/web/assets/{useSessionListQuery-DdFrJGiI.js → useSessionListQuery-BpWfS-tU.js} +1 -1
  100. package/web/assets/{useSessionRowActions-CTYVP4el.js → useSessionRowActions-Dd5ulVpS.js} +1 -1
  101. package/web/assets/{useSidebarModel-BdWaL9Nn.js → useSidebarModel-uxFT2LRy.js} +1 -1
  102. package/web/assets/{web-preview-DUIdcsL2.js → web-preview-Bo8YMR-t.js} +1 -1
  103. package/web/assets/{web-preview-events-4X_JU_UG.js → web-preview-events-DIPJR6oR.js} +1 -1
  104. package/web/assets/{workspace-order-store-DlMf7MI6.js → workspace-order-store-DshLVZf8.js} +1 -1
  105. package/web/index.html +2 -2
  106. package/web/assets/ChatPage-Bl94kmVS.js +0 -553
  107. package/web/assets/SessionBrowserPane-DOmbqdHK.js +0 -2
  108. package/web/assets/SessionInspector-DewgkKy9.js +0 -1
  109. package/web/assets/bots-store-DE76fA7-.js +0 -1
  110. package/web/assets/i18n-CyyEaQdX.js +0 -1
  111. package/web/assets/index-C13rJGuY.css +0 -2
  112. package/web/assets/public-CUO7iS84.js +0 -3
  113. package/web/assets/public-diff-A9crjZfM.js +0 -1
  114. package/web/assets/public-events-iJAi2TnD.js +0 -1
  115. package/web/assets/public-session-DM4y_qrY.js +0 -1
  116. package/web/assets/public-sidebar-Ce5o13yN.js +0 -1
  117. package/web/assets/safe-mode-sentinel-AmgPcPSa.js +0 -1
  118. package/web/assets/side-chat-context-hRj7FqXK.js +0 -7
@@ -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-BuN5i-jP.js";import{t as i}from"./api-Dg-aNpVe.js";import{i as a}from"./runtime-capabilities-CHYOF_hE.js";import{t as o}from"./runtime-capabilities-store-B5Bam7pC.js";import{t as s}from"./createLucideIcon-Cd-3GVxJ.js";import{t as c}from"./circle-check-iEdCm3Pw.js";import{t as l}from"./earth-Ddy13fHh.js";import{t as u}from"./external-link-CEQqPcqc.js";import{t as d}from"./eye-uWAPXNzJ.js";import{t as f}from"./file-code-corner-BnE1ljT0.js";import{t as p}from"./folder-open-FIShC5Qk.js";import{t as m}from"./image-BY_c3FYU.js";import{t as h}from"./package-BOmkLaKS.js";import{t as g}from"./plug-BsIeHRwC.js";import{t as _}from"./save-CHBB52P8.js";import{t as v}from"./search-D0mqDaf_.js";import{t as y}from"./server-BgNvmqwJ.js";import{t as ee}from"./shield-alert-oZqX6MNu.js";import{t as te}from"./trash-2-CNrPOoPR.js";import{t as b}from"./triangle-alert-CE1q54ci.js";import{t as x}from"./more-pages-D_PnxLN0.js";import{a as S}from"./dist-41X0pdUs.js";import{o as C,s as w}from"./dist-BsRXXcSL.js";import{a as T,c as ne,i as E,l as D,n as O,o as k,r as re,s as ie,t as ae}from"./dist-BHkR6BLP.js";import{t as A}from"./utils-C8uzG5AZ.js";import{n as oe,t as j}from"./button-CCcCN8tE.js";import{s as se}from"./shortcuts-LBxOVau1.js";import{a as M,i as N,l as P,o as F,s as I,t as L}from"./dialog-CtFjznlx.js";import{t as R}from"./input-CPw-zkYh.js";import{t as ce}from"./pick-system-directory-B1clvHS6.js";import{n as le,t as ue}from"./PageState-Cz6vFMXv.js";import{a as de,i as z,n as B,o as V,r as fe,s as pe,t as H}from"./FeaturePage-C6kLKix5.js";import{t as U}from"./AppSelect-BD6RAaJ5.js";import{c as me,i as he,s as ge}from"./app-primitives-Drz_SjnR.js";import{a as W,i as _e,n as ve,o as ye,r as G,s as be,t as xe}from"./tool-labels-ghvpPFmc.js";var K=s(`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`}]]),q=e(t(),1),J=n(),Y=Object.defineProperty,X=(e,t)=>Y(e,`name`,{value:t,configurable:!0}),[Se,Ce]=w(`AlertDialog`,[D]),Z=D(),we=X(e=>{let{__scopeAlertDialog:t,...n}=e,r=Z(t);return(0,J.jsx)(ae,{...r,...n,modal:!0})},`AlertDialog`);q.forwardRef(X(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Z(n);return(0,J.jsx)(ne,{...i,...r,ref:t})},`AlertDialogTrigger`));var Te=X(e=>{let{__scopeAlertDialog:t,...n}=e,r=Z(t);return(0,J.jsx)(k,{...r,...n})},`AlertDialogPortal`),Q=q.forwardRef(X(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Z(n);return(0,J.jsx)(T,{...i,...r,ref:t})},`AlertDialogOverlay`)),[Ee,$]=Se(`AlertDialogContent`),De=q.forwardRef(X(function(e,t){let{__scopeAlertDialog:n,children:r,...i}=e,a=Z(n),o=q.useRef(null),s=S(t,o),c=q.useRef(null);return(0,J.jsx)(Ee,{scope:n,cancelRef:c,children:(0,J.jsx)(re,{role:`alertdialog`,...a,...i,ref:s,onOpenAutoFocus:C(i.onOpenAutoFocus,e=>{e.preventDefault(),c.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:r})})},`AlertDialogContent`)),Oe=q.forwardRef(X(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Z(n);return(0,J.jsx)(ie,{...i,...r,ref:t})},`AlertDialogTitle`)),ke=q.forwardRef(X(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Z(n);return(0,J.jsx)(E,{...i,...r,ref:t})},`AlertDialogDescription`)),Ae=q.forwardRef(X(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Z(n);return(0,J.jsx)(O,{...i,...r,ref:t})},`AlertDialogAction`)),je=`AlertDialogCancel`,Me=q.forwardRef(X(function(e,t){let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=$(je,n),a=Z(n),o=S(t,i);return(0,J.jsx)(O,{...a,...r,ref:o})},`AlertDialogCancel`)),Ne=we,Pe=Te,Fe=Q,Ie=De,Le=Ae,Re=Me,ze=Oe,Be=ke;function Ve({...e}){return(0,J.jsx)(Ne,{"data-slot":`alert-dialog`,...e})}function He({...e}){return(0,J.jsx)(Pe,{"data-slot":`alert-dialog-portal`,...e})}function Ue({className:e,...t}){return(0,J.jsx)(Fe,{"data-slot":`alert-dialog-overlay`,className:A(`fixed inset-0 z-50 bg-[var(--overlay-scrim)] duration-100 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function We({className:e,size:t=`default`,...n}){return(0,J.jsxs)(He,{children:[(0,J.jsx)(Ue,{}),(0,J.jsx)(Ie,{"data-slot":`alert-dialog-content`,"data-size":t,className:A(`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 shadow-float 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-closed:animate-out data-closed:fade-out-0`,e),...n})]})}function Ge({className:e,...t}){return(0,J.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:A(`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 Ke({className:e,...t}){return(0,J.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:A(`-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t border-stroke bg-surface-subtle px-4 py-3 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 qe({className:e,...t}){return(0,J.jsx)(ze,{"data-slot":`alert-dialog-title`,className:A(`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 Je({className:e,...t}){return(0,J.jsx)(Be,{"data-slot":`alert-dialog-description`,className:A(`text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function Ye({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,J.jsx)(j,{variant:t,size:n,asChild:!0,children:(0,J.jsx)(Le,{"data-slot":`alert-dialog-action`,className:A(e),...r})})}function Xe({className:e,variant:t=`outline`,size:n=`default`,...r}){return(0,J.jsx)(j,{variant:t,size:n,asChild:!0,children:(0,J.jsx)(Re,{"data-slot":`alert-dialog-cancel`,className:A(e),...r})})}function Ze(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function Qe({open:e,onOpenChange:t,onInstalled:n}){let{t:a}=r(),[o,s]=(0,q.useState)(``),[l,u]=(0,q.useState)(null),[d,f]=(0,q.useState)(!1),[m,h]=(0,q.useState)(``);return(0,q.useEffect)(()=>{e||(s(``),u(null),f(!1),h(``))},[e]),(0,J.jsx)(L,{open:e,onOpenChange:e=>!d&&t(e),children:(0,J.jsxs)(N,{className:`z-[220] sm:max-w-xl`,overlayClassName:`z-[220]`,children:[(0,J.jsxs)(I,{children:[(0,J.jsxs)(P,{className:`flex items-center gap-2`,children:[(0,J.jsx)(K,{className:`size-4 text-content-secondary`}),a(`plugins:pluginsPage.installLocalPlugin`)]}),(0,J.jsx)(M,{children:a(`plugins:pluginsPage.installLocalPluginDescription`)})]}),(0,J.jsxs)(`div`,{className:`grid gap-3`,children:[(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-xs font-medium text-content-secondary`,children:[a(`plugins:pluginsPage.pluginDirectory`),(0,J.jsxs)(`span`,{className:`flex min-w-0 gap-2`,children:[(0,J.jsx)(R,{className:`min-w-0 flex-1 font-mono text-xs max-[650px]:h-11`,value:o,disabled:d,placeholder:a(`plugins:pluginsPage.pluginDirectoryPlaceholder`),onChange:e=>{s(e.target.value),u(null)}}),(0,J.jsx)(j,{type:`button`,variant:`secondary`,size:`icon`,className:`size-[34px] shrink-0 max-[650px]:size-11`,title:a(`plugins:pluginsPage.chooseDirectory`),"aria-label":a(`plugins:pluginsPage.chooseDirectory`),onClick:async()=>{h(``);try{let e=await ce(o,a(`plugins:pluginsPage.chooseDirectory`));e.status===`picked`?(s(e.path),u(null)):e.status===`unavailable`&&h(a(`common:workspacePicker.systemPickerUnavailable`))}catch(e){h(e instanceof Error?e.message:String(e))}},children:(0,J.jsx)(p,{})})]})]}),l&&(0,J.jsxs)(`div`,{className:`grid gap-3 overflow-hidden rounded-md border border-stroke bg-surface-subtle p-3`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,J.jsx)(`span`,{className:`grid size-8 shrink-0 place-items-center rounded-sm bg-success-soft text-success`,children:(0,J.jsx)(c,{className:`size-4`})}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`strong`,{className:`block truncate text-sm font-medium text-content`,children:l.plugin.name}),(0,J.jsxs)(`small`,{className:`block truncate font-mono text-xs text-content-muted tabular-nums`,children:[l.plugin.id,` · v`,l.plugin.version,` · `,l.fileCount,` `,a(`plugins:pluginsPage.files`),` · `,Ze(l.byteCount)]})]})]}),(0,J.jsx)(`div`,{className:`grid gap-1.5`,children:l.plugin.capabilities.map(e=>(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-3 border-t border-stroke-soft pt-2 text-xs`,children:[(0,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsx)(`strong`,{className:`block font-medium text-content`,children:e.label}),(0,J.jsx)(`small`,{className:`text-xs text-content-muted`,children:e.description})]}),(0,J.jsx)(`code`,{className:`shrink-0 font-mono text-xs text-content-secondary`,children:e.name})]},e.name))}),(0,J.jsxs)(`div`,{className:`flex items-start gap-2 rounded-sm bg-warning-soft p-2.5 text-xs leading-5 text-warning-strong`,children:[(0,J.jsx)(b,{className:`mt-0.5 shrink-0`,size:15}),(0,J.jsx)(`span`,{children:a(`plugins:pluginsPage.localPluginSecurityWarning`)})]})]}),m&&(0,J.jsxs)(he,{className:`m-0`,children:[(0,J.jsx)(b,{size:14}),(0,J.jsx)(`span`,{children:m})]})]}),(0,J.jsxs)(F,{children:[(0,J.jsx)(j,{type:`button`,variant:`secondary`,size:`dialogAction`,disabled:d,onClick:()=>t(!1),children:a(`common:ui.cancel`)}),(0,J.jsxs)(j,{type:`button`,size:`dialogAction`,disabled:d||!l&&!o.trim(),onClick:l?async()=>{if(!(!l||d)){f(!0),h(``);try{await i(`/api/plugins/install`,{method:`POST`,body:JSON.stringify({inspectionId:l.inspectionId})}),await n(),t(!1)}catch(e){h(e instanceof Error?e.message:String(e))}finally{f(!1)}}}:async()=>{if(!(!o.trim()||d)){f(!0),h(``);try{u(await i(`/api/plugins/inspect`,{method:`POST`,body:JSON.stringify({path:o.trim()})}))}catch(e){u(null),h(e instanceof Error?e.message:String(e))}finally{f(!1)}}},children:[d?(0,J.jsx)(oe,{className:`text-current`}):l?(0,J.jsx)(K,{}):(0,J.jsx)(c,{}),a(d?`plugins:pluginsPage.processing`:l?`plugins:pluginsPage.installPlugin`:`plugins:pluginsPage.inspectPlugin`)]})]})]})})}var $e=[`tool`,`prompt`,`skill`];function et(e){let t=Array.isArray(e.resourceTypes)?e.resourceTypes.filter(e=>$e.includes(e)):[];return t.length?t:[`tool`]}function tt(e,t){return{tool:t(`plugins:pluginsPage.extensionType.tool`),prompt:t(`plugins:pluginsPage.extensionType.prompt`),skill:t(`plugins:pluginsPage.extensionType.skill`)}[e]}var nt=[`all`,`builtin`,`local`],rt={read:d,ls:p,grep:v,find:v,edit:f,write:f,bash:y,web_search:l,browser_automation:l,generate_visual:m};function it(e,t){return t(e===`builtin`?`plugins:pluginsPage.builtIn`:e===`local`?`plugins:pluginsPage.local`:`plugins:pluginsPage.all`)}function at(e){return e.flatMap(e=>e.managedExternally?[]:e.capabilities.filter(e=>e.enabled).map(e=>e.name))}function ot(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 st(e){return e.find(e=>e.source===`pi`&&e.name===`Computer Use`)?.enabled!==!1}function ct(e){return Object.fromEntries(e.filter(e=>e.source===`pi`&&e.name!==`Computer Use`&&!!e.packageSource).map(e=>[e.packageSource,e.enabled!==!1]))}function lt(e,t){return[...e].sort().join(`\0`)===[...t].sort().join(`\0`)}function ut(e,t){return W({id:e.name,name:e.label},t)}function dt(e,t){return e.pluginSource===`pi`?e.pluginName:G(e.pluginName,t)}function ft({value:e,testing:t,onChange:n,onTest:i}){let{t:a}=r();return(0,J.jsxs)(`div`,{className:`plugin-tool-config grid gap-2.5 border-t border-stroke pt-3 [&_label]:grid [&_label]:gap-1.5 [&_label]:text-xs [&_label]:font-medium [&_label]:text-content-secondary`,children:[(0,J.jsxs)(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-3`,children:[(0,J.jsxs)(`label`,{children:[a(`plugins:pluginsPage.defaultLanguage`),(0,J.jsxs)(U,{value:e.language,onChange:t=>n({...e,language:t.target.value}),children:[(0,J.jsx)(`option`,{value:`auto`,children:a(`plugins:pluginsPage.auto`)}),(0,J.jsx)(`option`,{value:`zh-CN`,children:a(`plugins:pluginsPage.simplifiedChinese`)}),(0,J.jsx)(`option`,{value:`en-US`,children:a(`plugins:pluginsPage.english`)})]})]}),(0,J.jsxs)(`label`,{children:[a(`plugins:pluginsPage.safeSearch`),(0,J.jsxs)(U,{value:e.safeSearch,onChange:t=>n({...e,safeSearch:Number(t.target.value)}),children:[(0,J.jsx)(`option`,{value:0,children:a(`plugins:pluginsPage.off`)}),(0,J.jsx)(`option`,{value:1,children:a(`plugins:pluginsPage.moderate`)}),(0,J.jsx)(`option`,{value:2,children:a(`plugins:pluginsPage.strict`)})]})]}),(0,J.jsxs)(`label`,{children:[a(`plugins:pluginsPage.resultCount`),(0,J.jsx)(R,{type:`number`,min:`1`,max:`12`,className:`tabular-nums`,value:e.maxResults,onChange:t=>n({...e,maxResults:Number(t.target.value)})})]})]}),(0,J.jsxs)(j,{type:`button`,variant:`secondary`,className:`justify-self-end max-[650px]:h-11`,loading:t,disabled:t,onClick:i,children:[(0,J.jsx)(l,{}),a(t?`plugins:pluginsPage.testing`:`plugins:pluginsPage.testConnection`)]})]})}function pt({query:e,notify:t,requestText:n,requestConfirm:a}){let{t:o}=r(),[s,c]=(0,q.useState)(``),[l,d]=(0,q.useState)(null),[f,p]=(0,q.useState)([]),[m,g]=(0,q.useState)(!1),[_,y]=(0,q.useState)(``),[ee,b]=(0,q.useState)(``),x=(0,q.useCallback)(async(e=``)=>{g(!0),b(``);try{let[t,n]=await Promise.all([i(`/api/extensions/market?name=${encodeURIComponent(e)}`),i(`/api/extensions`)]);d(t),p(n.packages||[])}catch(e){b(e instanceof Error?e.message:String(e))}finally{g(!1)}},[]);(0,q.useEffect)(()=>{x(``)},[x]);let S=(l?.packages||[]).filter(t=>`${t.name} ${t.description}`.toLowerCase().includes(e.trim().toLowerCase())),C=async e=>{if(await a?.({title:o(`plugins:pluginsPage.installExtension`),message:o(`plugins:pluginsPage.extensionSecurityWarning`,{name:e}),confirmLabel:o(`plugins:pluginsPage.installExtension`),tone:`danger`})!==!1){y(e);try{let n=/^(?:[.~\\/]|[A-Za-z]:[\\/])/.test(e)||/^(?:npm:|https?:\/\/|git\+)/i.test(e)?e:`npm:${e}`,r=await i(`/api/extensions/install`,{method:`POST`,body:JSON.stringify({source:n})});p(r.packages||[]),t(o(`plugins:pluginsPage.extensionInstalled`),`success`)}catch(e){t(e instanceof Error?e.message:String(e),`error`)}finally{y(``)}}},w=async()=>{let e=await n?.({title:o(`plugins:pluginsPage.installExtension`),message:o(`plugins:pluginsPage.extensionSourceHelp`),inputLabel:o(`plugins:pluginsPage.extensionSource`),placeholder:`npm:@scope/package or https://github.com/…`,maxLength:2e3});e?.trim()&&await C(e.trim())},T=async e=>{if(await a?.({title:o(`plugins:pluginsPage.uninstallExtension`),message:o(`plugins:pluginsPage.uninstallExtensionDescription`,{name:e.name}),confirmLabel:o(`plugins:pluginsPage.uninstallExtension`),tone:`danger`})!==!1){y(e.source);try{await i(`/api/extensions`,{method:`DELETE`,body:JSON.stringify({source:e.source,scope:e.scope})}),await x(s),t(o(`plugins:pluginsPage.extensionUninstalled`),`success`)}catch(e){t(e instanceof Error?e.message:String(e),`error`)}finally{y(``)}}},ne=$e.map(e=>({type:e,items:f.filter(t=>et(t).includes(e))})).filter(e=>e.items.length>0);return(0,J.jsxs)(J.Fragment,{children:[ne.map(e=>(0,J.jsx)(V,{className:`plugin-installed-extensions`,title:`${o(`plugins:pluginsPage.installedExtensions`)} · ${tt(e.type,o)}`,count:e.items.length,children:(0,J.jsx)(B,{children:e.items.map(t=>(0,J.jsx)(z,{icon:(0,J.jsx)(h,{}),name:(0,J.jsx)(`span`,{className:`font-mono`,children:t.name}),nameMeta:`v${t.version}`,description:(0,J.jsx)(`span`,{className:`font-mono text-xs`,children:t.source}),actions:(0,J.jsxs)(j,{type:`button`,variant:`ghost`,size:`sm`,className:`text-content-muted hover:bg-danger-soft hover:text-danger`,loading:_===t.source,disabled:!!_,onClick:()=>void T(t),children:[(0,J.jsx)(te,{}),o(`plugins:pluginsPage.uninstallExtension`)]})},`${e.type}:${t.scope}:${t.source}`))})},e.type)),(0,J.jsxs)(V,{className:`plugin-market`,title:o(`plugins:pluginsPage.extensionMarket`),actions:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(j,{asChild:!0,variant:`ghost`,size:`sm`,children:(0,J.jsxs)(`a`,{href:`https://pi.dev/packages`,target:`_blank`,rel:`noreferrer`,children:[(0,J.jsx)(u,{}),o(`plugins:pluginsPage.openPackageCatalog`)]})}),(0,J.jsxs)(j,{type:`button`,variant:`secondary`,size:`sm`,onClick:w,disabled:!!_,children:[(0,J.jsx)(K,{}),o(`plugins:pluginsPage.installExtension`)]})]}),children:[(0,J.jsxs)(`form`,{className:`mb-3 flex min-w-0 gap-2`,onSubmit:e=>{e.preventDefault(),x(s)},children:[(0,J.jsx)(R,{className:`min-w-0 flex-1 max-[650px]:h-11`,value:s,onChange:e=>c(e.target.value),placeholder:o(`plugins:pluginsPage.searchPackageCatalog`),"aria-label":o(`plugins:pluginsPage.searchPackageCatalog`)}),(0,J.jsxs)(j,{type:`submit`,variant:`secondary`,className:`h-[34px] max-[650px]:h-11`,loading:m,disabled:m,children:[(0,J.jsx)(v,{}),o(`plugins:pluginsPage.search`)]})]}),ee&&(0,J.jsx)(H,{className:`mt-0 mb-3`,children:ee}),S.length>0&&(0,J.jsx)(B,{children:S.slice(0,12).map(e=>{let t=f.some(t=>t.name===e.name||t.source===`npm:${e.name}`);return(0,J.jsx)(z,{icon:(0,J.jsx)(h,{}),name:(0,J.jsx)(`span`,{className:`font-mono`,children:e.name}),description:e.description,status:e.published,actions:(0,J.jsx)(j,{type:`button`,variant:`secondary`,size:`sm`,loading:_===e.name,disabled:t||!!_,onClick:()=>void C(e.name),children:o(t?`plugins:pluginsPage.installed`:`plugins:pluginsPage.installExtension`)})},e.name)})})]})]})}function mt({notify:e,onBack:t,requestText:n,requestConfirm:s}){let{t:c}=r(),l=se(`focusSearch`),u=o(e=>e.capabilities),d=a(u,`plugins`),f=d?nt:nt.slice(0,2),[p,m]=(0,q.useState)(``),[h,v]=(0,q.useState)(null),[y,S]=(0,q.useState)([]),[C,w]=(0,q.useState)(``),[T,ne]=(0,q.useState)(`all`),[E,D]=(0,q.useState)({provider:`bing`,language:`auto`,safeSearch:1,maxResults:8}),[O,k]=(0,q.useState)(!1),[re,ie]=(0,q.useState)(!1),[ae,M]=(0,q.useState)(!1),[N,P]=(0,q.useState)(null),[F,I]=(0,q.useState)(!1),[L,R]=(0,q.useState)(``),[ce,H]=(0,q.useState)(!1),U=(0,q.useCallback)(e=>{v(e),S(e.plugins),D(e.webSearch)},[]),W=(0,q.useCallback)(async()=>{R(``);try{U(await i(`/api/plugins`))}catch(e){R(e instanceof Error?e.message:String(e))}},[U]);(0,q.useEffect)(()=>{W()},[W]);let G=(0,q.useMemo)(()=>ot(y),[y]),Y=(0,q.useMemo)(()=>at(y),[y]),X=h?!lt(Y,h.enabledTools)||st(y)!==h.computerUseEnabled||JSON.stringify(ct(y))!==JSON.stringify(h.piExtensions)||JSON.stringify(E)!==JSON.stringify(h.webSearch):!1,Se=(0,q.useCallback)(async()=>{if(!O){if(!h||!X){h&&e(c(`plugins:pluginsPage.noPluginPolicyChanges`));return}k(!0),R(``);try{let t=await i(`/api/plugins`,{method:`PUT`,body:JSON.stringify({enabledTools:Y,webSearch:E,computerUseEnabled:st(y),piExtensions:ct(y)})});U(t),e(c(`plugins:pluginsPage.pluginPolicySavedAgentRuntimeUpdated`))}catch(e){R(e instanceof Error?e.message:String(e))}finally{k(!1)}}},[U,h,X,y,Y,e,O,c,E]),Ce=async()=>{ie(!0),R(``);try{let t=await i(`/api/plugins/web-search/test`,{method:`POST`,body:JSON.stringify(E)});e(c(`plugins:pluginsPage.bingSearchIsAvailableAndReturnedCountResults`,{count:t.count}))}catch(t){let n=t instanceof Error?t.message:String(t);R(n),e(n,`error`)}finally{ie(!1)}},Z=(e,t,n)=>{S(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)}}))},we=()=>!X||(R(c(`plugins:pluginsPage.saveBeforePluginChanges`)),!1),Te=async()=>{if(!(!N||F)){I(!0),R(``);try{U(await i(`/api/plugins/${encodeURIComponent(N.pluginId)}`,{method:`DELETE`})),e(c(`plugins:pluginsPage.pluginUninstalled`,{name:N.pluginName})),w(``),P(null)}catch(e){R(e instanceof Error?e.message:String(e))}finally{I(!1)}}},Q=c(`navigation:navigation.plugins`),Ee=p.trim().toLowerCase(),$=G.filter(e=>T!==`all`&&e.pluginSource!==T?!1:[ut(e,c),e.name,e.description,dt(e,c),e.pluginId].join(` `).toLowerCase().includes(Ee));return(0,J.jsxs)(fe,{title:Q,description:c(`plugins:pluginsPage.lede`),back:t&&{label:c(`navigation:sidebar.features`),ariaLabel:c(`navigation:shell.backToFeaturesLabel`),onBack:t},toolbar:(0,J.jsx)(pe,{search:(0,J.jsx)(de,{id:x,value:p,onValueChange:m,placeholder:c(`navigation:pageHeader.searchPage`,{page:Q}),shortcut:l,clearLabel:c(`navigation:more.clearSearch`)}),actions:(0,J.jsxs)(J.Fragment,{children:[d&&(0,J.jsxs)(j,{type:`button`,variant:`secondary`,className:`h-9`,disabled:!h,onClick:()=>we()&&M(!0),children:[(0,J.jsx)(K,{}),c(`plugins:pluginsPage.installPlugin`)]}),(0,J.jsxs)(j,{type:`button`,className:`h-9`,"data-plugins-save":!0,loading:O,disabled:!h||O,onClick:()=>void Se(),children:[(0,J.jsx)(_,{}),c(`plugins:pluginsPage.savePolicy`)]})]}),filters:(0,J.jsx)(me,{options:f.map(e=>it(e,c)),value:it(T,c),onChange:e=>ne(f.find(t=>it(t,c)===e)||`all`)})}),children:[h?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(V,{className:`plugin-catalog`,title:c(`plugins:pluginsPage.toolCatalog`),count:$.length,meta:(0,J.jsxs)(`span`,{className:`plugin-catalog-summary`,children:[G.filter(e=>e.enabled).length,`/`,G.length,` `,c(`plugins:pluginsPage.enabled2`)]}),actions:X&&(0,J.jsxs)(`span`,{"data-plugins-unsaved":!0,className:`flex items-center gap-1.5 text-xs font-medium text-content-secondary`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`size-1.5 rounded-full bg-content-secondary`}),c(`plugins:pluginsPage.unsaved`)]}),children:$.length?(0,J.jsx)(B,{className:`plugin-tool-grid`,children:$.map(e=>{let t=rt[e.name]||g,n=ut(e,c);return(0,J.jsx)(z,{className:`plugin-tool-card`,"data-plugin-tool":e.name,icon:(0,J.jsx)(t,{}),name:(0,J.jsx)(`span`,{title:n,children:n}),nameMeta:e.name,description:`${dt(e,c)} · ${ye(e.risk,c)}`,status:e.pluginBuiltIn?void 0:c(`plugins:pluginsPage.local`),actions:(0,J.jsx)(ge,{value:e.enabled,onChange:t=>Z(e.pluginId,e.name,t),ariaLabel:n}),expanded:C===e.name,onExpandedChange:t=>w(t?e.name:``),toggleLabel:c(`plugins:pluginsPage.toggleToolDetails`,{name:n}),detail:(0,J.jsxs)(`div`,{className:`plugin-tool-details grid gap-3`,children:[(0,J.jsx)(`p`,{className:`text-sm leading-relaxed text-content-soft`,children:_e({id:e.name,description:e.description},c)}),(0,J.jsxs)(`dl`,{className:`grid grid-cols-[88px_minmax(0,1fr)] gap-x-3 gap-y-1.5 text-xs [&_dd]:min-w-0 [&_dd]:[overflow-wrap:anywhere] [&_dd]:text-content-soft [&_dt]:text-content-muted [&>div]:contents`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{children:c(`plugins:pluginsPage.source`)}),(0,J.jsxs)(`dd`,{className:`tabular-nums`,children:[dt(e,c),!e.pluginBuiltIn&&` · v${e.pluginVersion}`]})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{children:c(`plugins:pluginsPage.riskLevel`)}),(0,J.jsx)(`dd`,{className:A((xe(e.risk)||ve(e.risk))&&`font-medium text-content!`),children:ye(e.risk,c)})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{children:c(`plugins:pluginsPage.pathScope`)}),(0,J.jsx)(`dd`,{children:be({id:e.name,scope:e.scope},c)})]}),!e.pluginBuiltIn&&(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{children:c(`plugins:pluginsPage.executionMode`)}),(0,J.jsx)(`dd`,{children:c(`plugins:pluginsPage.confirmUnlessFullAccess`)})]})]}),!e.pluginBuiltIn&&(0,J.jsxs)(`div`,{className:`plugin-tool-warning flex items-start gap-2 rounded-sm bg-surface-subtle p-2.5 text-xs leading-normal text-content-secondary`,children:[(0,J.jsx)(ee,{className:`mt-px size-3.5 shrink-0`,"aria-hidden":`true`}),(0,J.jsx)(`span`,{children:c(`plugins:pluginsPage.localPluginSecurityWarning`)})]}),e.name===`web_search`&&(0,J.jsx)(ft,{value:E,testing:re,onChange:D,onTest:Ce}),!e.pluginBuiltIn&&(0,J.jsxs)(j,{type:`button`,variant:`ghost`,className:`justify-self-end text-danger hover:bg-danger-soft hover:text-danger max-[650px]:h-11`,onClick:()=>we()&&P(e),children:[(0,J.jsx)(te,{}),c(`plugins:pluginsPage.uninstallPlugin`)]})]})},e.name)})}):(0,J.jsx)(ue,{compact:!0,title:c(`plugins:pluginsPage.noMatchingTools`)})}),(0,J.jsx)(pt,{query:p,notify:e,requestText:n,requestConfirm:s})]}):L?(0,J.jsx)(le,{kind:`error`,title:c(`plugins:pluginsPage.loadFailed`),description:L,action:(0,J.jsx)(j,{variant:`secondary`,className:`max-[650px]:h-11`,loading:ce,disabled:ce,onClick:()=>{H(!0),W().finally(()=>H(!1))},children:c(`common:pageTemplate.retry`)})}):(0,J.jsx)(le,{kind:`loading`,title:c(`plugins:pluginsPage.loadingToolPlugins`)}),d&&(0,J.jsx)(Qe,{open:ae,onOpenChange:M,onInstalled:W}),(0,J.jsx)(Ve,{open:!!N,onOpenChange:e=>!e&&!F&&P(null),children:(0,J.jsxs)(We,{className:`z-[220]`,children:[(0,J.jsxs)(Ge,{children:[(0,J.jsx)(qe,{children:c(`plugins:pluginsPage.uninstallPlugin`)}),(0,J.jsx)(Je,{children:c(`plugins:pluginsPage.uninstallPluginDescription`,{name:N?.pluginName||``})})]}),(0,J.jsxs)(Ke,{children:[(0,J.jsx)(Xe,{disabled:F,children:c(`common:ui.cancel`)}),(0,J.jsxs)(Ye,{variant:`destructive`,disabled:F,onClick:Te,children:[F&&(0,J.jsx)(oe,{className:`text-current`}),c(`plugins:pluginsPage.uninstallPlugin`)]})]})]})}),L&&h&&(0,J.jsxs)(he,{className:`fixed right-6 bottom-6 z-[21] max-w-[360px] border border-danger-border shadow-float`,children:[(0,J.jsx)(b,{size:13}),L]})]})}export{mt 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-Cyg5th6Z.js";import{t as i}from"./api-m-Yq8n0q.js";import{i as a}from"./runtime-capabilities-CHYOF_hE.js";import{t as o}from"./runtime-capabilities-store-DWW9jolt.js";import{t as s}from"./createLucideIcon-Cd-3GVxJ.js";import{t as c}from"./circle-check-iEdCm3Pw.js";import{t as l}from"./earth-Ddy13fHh.js";import{t as u}from"./external-link-CEQqPcqc.js";import{t as d}from"./eye-uWAPXNzJ.js";import{t as f}from"./file-code-corner-BnE1ljT0.js";import{t as p}from"./folder-open-FIShC5Qk.js";import{t as m}from"./image-BY_c3FYU.js";import{t as h}from"./package-BOmkLaKS.js";import{t as g}from"./plug-BsIeHRwC.js";import{t as _}from"./save-CHBB52P8.js";import{t as v}from"./search-D0mqDaf_.js";import{t as y}from"./server-BgNvmqwJ.js";import{t as ee}from"./shield-alert-oZqX6MNu.js";import{t as te}from"./trash-2-CNrPOoPR.js";import{t as b}from"./triangle-alert-CE1q54ci.js";import{t as x}from"./more-pages-D_PnxLN0.js";import{a as S}from"./dist-41X0pdUs.js";import{o as C,s as w}from"./dist-BsRXXcSL.js";import{a as T,c as ne,i as E,l as D,n as O,o as k,r as re,s as ie,t as ae}from"./dist-BHkR6BLP.js";import{t as A}from"./utils-C8uzG5AZ.js";import{n as oe,t as j}from"./button-CCcCN8tE.js";import{s as se}from"./shortcuts-Cgx6V2jI.js";import{a as M,i as N,l as P,o as F,s as I,t as L}from"./dialog-5MLAAE-f.js";import{t as R}from"./input-CPw-zkYh.js";import{t as ce}from"./pick-system-directory-ByTVOp-v.js";import{n as le,t as ue}from"./PageState-Cz6vFMXv.js";import{a as de,i as z,n as B,o as V,r as fe,s as pe,t as H}from"./FeaturePage-B3PLRtEG.js";import{t as U}from"./AppSelect-BD6RAaJ5.js";import{c as me,i as he,s as ge}from"./app-primitives-Drz_SjnR.js";import{a as W,i as _e,n as ve,o as ye,r as G,s as be,t as xe}from"./tool-labels-ghvpPFmc.js";var K=s(`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`}]]),q=e(t(),1),J=n(),Y=Object.defineProperty,X=(e,t)=>Y(e,`name`,{value:t,configurable:!0}),[Se,Ce]=w(`AlertDialog`,[D]),Z=D(),we=X(e=>{let{__scopeAlertDialog:t,...n}=e,r=Z(t);return(0,J.jsx)(ae,{...r,...n,modal:!0})},`AlertDialog`);q.forwardRef(X(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Z(n);return(0,J.jsx)(ne,{...i,...r,ref:t})},`AlertDialogTrigger`));var Te=X(e=>{let{__scopeAlertDialog:t,...n}=e,r=Z(t);return(0,J.jsx)(k,{...r,...n})},`AlertDialogPortal`),Q=q.forwardRef(X(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Z(n);return(0,J.jsx)(T,{...i,...r,ref:t})},`AlertDialogOverlay`)),[Ee,$]=Se(`AlertDialogContent`),De=q.forwardRef(X(function(e,t){let{__scopeAlertDialog:n,children:r,...i}=e,a=Z(n),o=q.useRef(null),s=S(t,o),c=q.useRef(null);return(0,J.jsx)(Ee,{scope:n,cancelRef:c,children:(0,J.jsx)(re,{role:`alertdialog`,...a,...i,ref:s,onOpenAutoFocus:C(i.onOpenAutoFocus,e=>{e.preventDefault(),c.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:r})})},`AlertDialogContent`)),Oe=q.forwardRef(X(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Z(n);return(0,J.jsx)(ie,{...i,...r,ref:t})},`AlertDialogTitle`)),ke=q.forwardRef(X(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Z(n);return(0,J.jsx)(E,{...i,...r,ref:t})},`AlertDialogDescription`)),Ae=q.forwardRef(X(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Z(n);return(0,J.jsx)(O,{...i,...r,ref:t})},`AlertDialogAction`)),je=`AlertDialogCancel`,Me=q.forwardRef(X(function(e,t){let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=$(je,n),a=Z(n),o=S(t,i);return(0,J.jsx)(O,{...a,...r,ref:o})},`AlertDialogCancel`)),Ne=we,Pe=Te,Fe=Q,Ie=De,Le=Ae,Re=Me,ze=Oe,Be=ke;function Ve({...e}){return(0,J.jsx)(Ne,{"data-slot":`alert-dialog`,...e})}function He({...e}){return(0,J.jsx)(Pe,{"data-slot":`alert-dialog-portal`,...e})}function Ue({className:e,...t}){return(0,J.jsx)(Fe,{"data-slot":`alert-dialog-overlay`,className:A(`fixed inset-0 z-50 bg-[var(--overlay-scrim)] duration-100 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function We({className:e,size:t=`default`,...n}){return(0,J.jsxs)(He,{children:[(0,J.jsx)(Ue,{}),(0,J.jsx)(Ie,{"data-slot":`alert-dialog-content`,"data-size":t,className:A(`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 shadow-float 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-closed:animate-out data-closed:fade-out-0`,e),...n})]})}function Ge({className:e,...t}){return(0,J.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:A(`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 Ke({className:e,...t}){return(0,J.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:A(`-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t border-stroke bg-surface-subtle px-4 py-3 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 qe({className:e,...t}){return(0,J.jsx)(ze,{"data-slot":`alert-dialog-title`,className:A(`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 Je({className:e,...t}){return(0,J.jsx)(Be,{"data-slot":`alert-dialog-description`,className:A(`text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function Ye({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,J.jsx)(j,{variant:t,size:n,asChild:!0,children:(0,J.jsx)(Le,{"data-slot":`alert-dialog-action`,className:A(e),...r})})}function Xe({className:e,variant:t=`outline`,size:n=`default`,...r}){return(0,J.jsx)(j,{variant:t,size:n,asChild:!0,children:(0,J.jsx)(Re,{"data-slot":`alert-dialog-cancel`,className:A(e),...r})})}function Ze(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function Qe({open:e,onOpenChange:t,onInstalled:n}){let{t:a}=r(),[o,s]=(0,q.useState)(``),[l,u]=(0,q.useState)(null),[d,f]=(0,q.useState)(!1),[m,h]=(0,q.useState)(``);return(0,q.useEffect)(()=>{e||(s(``),u(null),f(!1),h(``))},[e]),(0,J.jsx)(L,{open:e,onOpenChange:e=>!d&&t(e),children:(0,J.jsxs)(N,{className:`z-[220] sm:max-w-xl`,overlayClassName:`z-[220]`,children:[(0,J.jsxs)(I,{children:[(0,J.jsxs)(P,{className:`flex items-center gap-2`,children:[(0,J.jsx)(K,{className:`size-4 text-content-secondary`}),a(`plugins:pluginsPage.installLocalPlugin`)]}),(0,J.jsx)(M,{children:a(`plugins:pluginsPage.installLocalPluginDescription`)})]}),(0,J.jsxs)(`div`,{className:`grid gap-3`,children:[(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-xs font-medium text-content-secondary`,children:[a(`plugins:pluginsPage.pluginDirectory`),(0,J.jsxs)(`span`,{className:`flex min-w-0 gap-2`,children:[(0,J.jsx)(R,{className:`min-w-0 flex-1 font-mono text-xs max-[650px]:h-11`,value:o,disabled:d,placeholder:a(`plugins:pluginsPage.pluginDirectoryPlaceholder`),onChange:e=>{s(e.target.value),u(null)}}),(0,J.jsx)(j,{type:`button`,variant:`secondary`,size:`icon`,className:`size-[34px] shrink-0 max-[650px]:size-11`,title:a(`plugins:pluginsPage.chooseDirectory`),"aria-label":a(`plugins:pluginsPage.chooseDirectory`),onClick:async()=>{h(``);try{let e=await ce(o,a(`plugins:pluginsPage.chooseDirectory`));e.status===`picked`?(s(e.path),u(null)):e.status===`unavailable`&&h(a(`common:workspacePicker.systemPickerUnavailable`))}catch(e){h(e instanceof Error?e.message:String(e))}},children:(0,J.jsx)(p,{})})]})]}),l&&(0,J.jsxs)(`div`,{className:`grid gap-3 overflow-hidden rounded-md border border-stroke bg-surface-subtle p-3`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,J.jsx)(`span`,{className:`grid size-8 shrink-0 place-items-center rounded-sm bg-success-soft text-success`,children:(0,J.jsx)(c,{className:`size-4`})}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`strong`,{className:`block truncate text-sm font-medium text-content`,children:l.plugin.name}),(0,J.jsxs)(`small`,{className:`block truncate font-mono text-xs text-content-muted tabular-nums`,children:[l.plugin.id,` · v`,l.plugin.version,` · `,l.fileCount,` `,a(`plugins:pluginsPage.files`),` · `,Ze(l.byteCount)]})]})]}),(0,J.jsx)(`div`,{className:`grid gap-1.5`,children:l.plugin.capabilities.map(e=>(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-3 border-t border-stroke-soft pt-2 text-xs`,children:[(0,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsx)(`strong`,{className:`block font-medium text-content`,children:e.label}),(0,J.jsx)(`small`,{className:`text-xs text-content-muted`,children:e.description})]}),(0,J.jsx)(`code`,{className:`shrink-0 font-mono text-xs text-content-secondary`,children:e.name})]},e.name))}),(0,J.jsxs)(`div`,{className:`flex items-start gap-2 rounded-sm bg-warning-soft p-2.5 text-xs leading-5 text-warning-strong`,children:[(0,J.jsx)(b,{className:`mt-0.5 shrink-0`,size:15}),(0,J.jsx)(`span`,{children:a(`plugins:pluginsPage.localPluginSecurityWarning`)})]})]}),m&&(0,J.jsxs)(he,{className:`m-0`,children:[(0,J.jsx)(b,{size:14}),(0,J.jsx)(`span`,{children:m})]})]}),(0,J.jsxs)(F,{children:[(0,J.jsx)(j,{type:`button`,variant:`secondary`,size:`dialogAction`,disabled:d,onClick:()=>t(!1),children:a(`common:ui.cancel`)}),(0,J.jsxs)(j,{type:`button`,size:`dialogAction`,disabled:d||!l&&!o.trim(),onClick:l?async()=>{if(!(!l||d)){f(!0),h(``);try{await i(`/api/plugins/install`,{method:`POST`,body:JSON.stringify({inspectionId:l.inspectionId})}),await n(),t(!1)}catch(e){h(e instanceof Error?e.message:String(e))}finally{f(!1)}}}:async()=>{if(!(!o.trim()||d)){f(!0),h(``);try{u(await i(`/api/plugins/inspect`,{method:`POST`,body:JSON.stringify({path:o.trim()})}))}catch(e){u(null),h(e instanceof Error?e.message:String(e))}finally{f(!1)}}},children:[d?(0,J.jsx)(oe,{className:`text-current`}):l?(0,J.jsx)(K,{}):(0,J.jsx)(c,{}),a(d?`plugins:pluginsPage.processing`:l?`plugins:pluginsPage.installPlugin`:`plugins:pluginsPage.inspectPlugin`)]})]})]})})}var $e=[`tool`,`prompt`,`skill`];function et(e){let t=Array.isArray(e.resourceTypes)?e.resourceTypes.filter(e=>$e.includes(e)):[];return t.length?t:[`tool`]}function tt(e,t){return{tool:t(`plugins:pluginsPage.extensionType.tool`),prompt:t(`plugins:pluginsPage.extensionType.prompt`),skill:t(`plugins:pluginsPage.extensionType.skill`)}[e]}var nt=[`all`,`builtin`,`local`],rt={read:d,ls:p,grep:v,find:v,edit:f,write:f,bash:y,web_search:l,browser_automation:l,generate_visual:m};function it(e,t){return t(e===`builtin`?`plugins:pluginsPage.builtIn`:e===`local`?`plugins:pluginsPage.local`:`plugins:pluginsPage.all`)}function at(e){return e.flatMap(e=>e.managedExternally?[]:e.capabilities.filter(e=>e.enabled).map(e=>e.name))}function ot(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 st(e){return e.find(e=>e.source===`pi`&&e.name===`Computer Use`)?.enabled!==!1}function ct(e){return Object.fromEntries(e.filter(e=>e.source===`pi`&&e.name!==`Computer Use`&&!!e.packageSource).map(e=>[e.packageSource,e.enabled!==!1]))}function lt(e,t){return[...e].sort().join(`\0`)===[...t].sort().join(`\0`)}function ut(e,t){return W({id:e.name,name:e.label},t)}function dt(e,t){return e.pluginSource===`pi`?e.pluginName:G(e.pluginName,t)}function ft({value:e,testing:t,onChange:n,onTest:i}){let{t:a}=r();return(0,J.jsxs)(`div`,{className:`plugin-tool-config grid gap-2.5 border-t border-stroke pt-3 [&_label]:grid [&_label]:gap-1.5 [&_label]:text-xs [&_label]:font-medium [&_label]:text-content-secondary`,children:[(0,J.jsxs)(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-3`,children:[(0,J.jsxs)(`label`,{children:[a(`plugins:pluginsPage.defaultLanguage`),(0,J.jsxs)(U,{value:e.language,onChange:t=>n({...e,language:t.target.value}),children:[(0,J.jsx)(`option`,{value:`auto`,children:a(`plugins:pluginsPage.auto`)}),(0,J.jsx)(`option`,{value:`zh-CN`,children:a(`plugins:pluginsPage.simplifiedChinese`)}),(0,J.jsx)(`option`,{value:`en-US`,children:a(`plugins:pluginsPage.english`)})]})]}),(0,J.jsxs)(`label`,{children:[a(`plugins:pluginsPage.safeSearch`),(0,J.jsxs)(U,{value:e.safeSearch,onChange:t=>n({...e,safeSearch:Number(t.target.value)}),children:[(0,J.jsx)(`option`,{value:0,children:a(`plugins:pluginsPage.off`)}),(0,J.jsx)(`option`,{value:1,children:a(`plugins:pluginsPage.moderate`)}),(0,J.jsx)(`option`,{value:2,children:a(`plugins:pluginsPage.strict`)})]})]}),(0,J.jsxs)(`label`,{children:[a(`plugins:pluginsPage.resultCount`),(0,J.jsx)(R,{type:`number`,min:`1`,max:`12`,className:`tabular-nums`,value:e.maxResults,onChange:t=>n({...e,maxResults:Number(t.target.value)})})]})]}),(0,J.jsxs)(j,{type:`button`,variant:`secondary`,className:`justify-self-end max-[650px]:h-11`,loading:t,disabled:t,onClick:i,children:[(0,J.jsx)(l,{}),a(t?`plugins:pluginsPage.testing`:`plugins:pluginsPage.testConnection`)]})]})}function pt({query:e,notify:t,requestText:n,requestConfirm:a}){let{t:o}=r(),[s,c]=(0,q.useState)(``),[l,d]=(0,q.useState)(null),[f,p]=(0,q.useState)([]),[m,g]=(0,q.useState)(!1),[_,y]=(0,q.useState)(``),[ee,b]=(0,q.useState)(``),x=(0,q.useCallback)(async(e=``)=>{g(!0),b(``);try{let[t,n]=await Promise.all([i(`/api/extensions/market?name=${encodeURIComponent(e)}`),i(`/api/extensions`)]);d(t),p(n.packages||[])}catch(e){b(e instanceof Error?e.message:String(e))}finally{g(!1)}},[]);(0,q.useEffect)(()=>{x(``)},[x]);let S=(l?.packages||[]).filter(t=>`${t.name} ${t.description}`.toLowerCase().includes(e.trim().toLowerCase())),C=async e=>{if(await a?.({title:o(`plugins:pluginsPage.installExtension`),message:o(`plugins:pluginsPage.extensionSecurityWarning`,{name:e}),confirmLabel:o(`plugins:pluginsPage.installExtension`),tone:`danger`})!==!1){y(e);try{let n=/^(?:[.~\\/]|[A-Za-z]:[\\/])/.test(e)||/^(?:npm:|https?:\/\/|git\+)/i.test(e)?e:`npm:${e}`,r=await i(`/api/extensions/install`,{method:`POST`,body:JSON.stringify({source:n})});p(r.packages||[]),t(o(`plugins:pluginsPage.extensionInstalled`),`success`)}catch(e){t(e instanceof Error?e.message:String(e),`error`)}finally{y(``)}}},w=async()=>{let e=await n?.({title:o(`plugins:pluginsPage.installExtension`),message:o(`plugins:pluginsPage.extensionSourceHelp`),inputLabel:o(`plugins:pluginsPage.extensionSource`),placeholder:`npm:@scope/package or https://github.com/…`,maxLength:2e3});e?.trim()&&await C(e.trim())},T=async e=>{if(await a?.({title:o(`plugins:pluginsPage.uninstallExtension`),message:o(`plugins:pluginsPage.uninstallExtensionDescription`,{name:e.name}),confirmLabel:o(`plugins:pluginsPage.uninstallExtension`),tone:`danger`})!==!1){y(e.source);try{await i(`/api/extensions`,{method:`DELETE`,body:JSON.stringify({source:e.source,scope:e.scope})}),await x(s),t(o(`plugins:pluginsPage.extensionUninstalled`),`success`)}catch(e){t(e instanceof Error?e.message:String(e),`error`)}finally{y(``)}}},ne=$e.map(e=>({type:e,items:f.filter(t=>et(t).includes(e))})).filter(e=>e.items.length>0);return(0,J.jsxs)(J.Fragment,{children:[ne.map(e=>(0,J.jsx)(V,{className:`plugin-installed-extensions`,title:`${o(`plugins:pluginsPage.installedExtensions`)} · ${tt(e.type,o)}`,count:e.items.length,children:(0,J.jsx)(B,{children:e.items.map(t=>(0,J.jsx)(z,{icon:(0,J.jsx)(h,{}),name:(0,J.jsx)(`span`,{className:`font-mono`,children:t.name}),nameMeta:`v${t.version}`,description:(0,J.jsx)(`span`,{className:`font-mono text-xs`,children:t.source}),actions:(0,J.jsxs)(j,{type:`button`,variant:`ghost`,size:`sm`,className:`text-content-muted hover:bg-danger-soft hover:text-danger`,loading:_===t.source,disabled:!!_,onClick:()=>void T(t),children:[(0,J.jsx)(te,{}),o(`plugins:pluginsPage.uninstallExtension`)]})},`${e.type}:${t.scope}:${t.source}`))})},e.type)),(0,J.jsxs)(V,{className:`plugin-market`,title:o(`plugins:pluginsPage.extensionMarket`),actions:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(j,{asChild:!0,variant:`ghost`,size:`sm`,children:(0,J.jsxs)(`a`,{href:`https://pi.dev/packages`,target:`_blank`,rel:`noreferrer`,children:[(0,J.jsx)(u,{}),o(`plugins:pluginsPage.openPackageCatalog`)]})}),(0,J.jsxs)(j,{type:`button`,variant:`secondary`,size:`sm`,onClick:w,disabled:!!_,children:[(0,J.jsx)(K,{}),o(`plugins:pluginsPage.installExtension`)]})]}),children:[(0,J.jsxs)(`form`,{className:`mb-3 flex min-w-0 gap-2`,onSubmit:e=>{e.preventDefault(),x(s)},children:[(0,J.jsx)(R,{className:`min-w-0 flex-1 max-[650px]:h-11`,value:s,onChange:e=>c(e.target.value),placeholder:o(`plugins:pluginsPage.searchPackageCatalog`),"aria-label":o(`plugins:pluginsPage.searchPackageCatalog`)}),(0,J.jsxs)(j,{type:`submit`,variant:`secondary`,className:`h-[34px] max-[650px]:h-11`,loading:m,disabled:m,children:[(0,J.jsx)(v,{}),o(`plugins:pluginsPage.search`)]})]}),ee&&(0,J.jsx)(H,{className:`mt-0 mb-3`,children:ee}),S.length>0&&(0,J.jsx)(B,{children:S.slice(0,12).map(e=>{let t=f.some(t=>t.name===e.name||t.source===`npm:${e.name}`);return(0,J.jsx)(z,{icon:(0,J.jsx)(h,{}),name:(0,J.jsx)(`span`,{className:`font-mono`,children:e.name}),description:e.description,status:e.published,actions:(0,J.jsx)(j,{type:`button`,variant:`secondary`,size:`sm`,loading:_===e.name,disabled:t||!!_,onClick:()=>void C(e.name),children:o(t?`plugins:pluginsPage.installed`:`plugins:pluginsPage.installExtension`)})},e.name)})})]})]})}function mt({notify:e,onBack:t,requestText:n,requestConfirm:s}){let{t:c}=r(),l=se(`focusSearch`),u=o(e=>e.capabilities),d=a(u,`plugins`),f=d?nt:nt.slice(0,2),[p,m]=(0,q.useState)(``),[h,v]=(0,q.useState)(null),[y,S]=(0,q.useState)([]),[C,w]=(0,q.useState)(``),[T,ne]=(0,q.useState)(`all`),[E,D]=(0,q.useState)({provider:`bing`,language:`auto`,safeSearch:1,maxResults:8}),[O,k]=(0,q.useState)(!1),[re,ie]=(0,q.useState)(!1),[ae,M]=(0,q.useState)(!1),[N,P]=(0,q.useState)(null),[F,I]=(0,q.useState)(!1),[L,R]=(0,q.useState)(``),[ce,H]=(0,q.useState)(!1),U=(0,q.useCallback)(e=>{v(e),S(e.plugins),D(e.webSearch)},[]),W=(0,q.useCallback)(async()=>{R(``);try{U(await i(`/api/plugins`))}catch(e){R(e instanceof Error?e.message:String(e))}},[U]);(0,q.useEffect)(()=>{W()},[W]);let G=(0,q.useMemo)(()=>ot(y),[y]),Y=(0,q.useMemo)(()=>at(y),[y]),X=h?!lt(Y,h.enabledTools)||st(y)!==h.computerUseEnabled||JSON.stringify(ct(y))!==JSON.stringify(h.piExtensions)||JSON.stringify(E)!==JSON.stringify(h.webSearch):!1,Se=(0,q.useCallback)(async()=>{if(!O){if(!h||!X){h&&e(c(`plugins:pluginsPage.noPluginPolicyChanges`));return}k(!0),R(``);try{let t=await i(`/api/plugins`,{method:`PUT`,body:JSON.stringify({enabledTools:Y,webSearch:E,computerUseEnabled:st(y),piExtensions:ct(y)})});U(t),e(c(`plugins:pluginsPage.pluginPolicySavedAgentRuntimeUpdated`))}catch(e){R(e instanceof Error?e.message:String(e))}finally{k(!1)}}},[U,h,X,y,Y,e,O,c,E]),Ce=async()=>{ie(!0),R(``);try{let t=await i(`/api/plugins/web-search/test`,{method:`POST`,body:JSON.stringify(E)});e(c(`plugins:pluginsPage.bingSearchIsAvailableAndReturnedCountResults`,{count:t.count}))}catch(t){let n=t instanceof Error?t.message:String(t);R(n),e(n,`error`)}finally{ie(!1)}},Z=(e,t,n)=>{S(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)}}))},we=()=>!X||(R(c(`plugins:pluginsPage.saveBeforePluginChanges`)),!1),Te=async()=>{if(!(!N||F)){I(!0),R(``);try{U(await i(`/api/plugins/${encodeURIComponent(N.pluginId)}`,{method:`DELETE`})),e(c(`plugins:pluginsPage.pluginUninstalled`,{name:N.pluginName})),w(``),P(null)}catch(e){R(e instanceof Error?e.message:String(e))}finally{I(!1)}}},Q=c(`navigation:navigation.plugins`),Ee=p.trim().toLowerCase(),$=G.filter(e=>T!==`all`&&e.pluginSource!==T?!1:[ut(e,c),e.name,e.description,dt(e,c),e.pluginId].join(` `).toLowerCase().includes(Ee));return(0,J.jsxs)(fe,{title:Q,description:c(`plugins:pluginsPage.lede`),back:t&&{label:c(`navigation:sidebar.features`),ariaLabel:c(`navigation:shell.backToFeaturesLabel`),onBack:t},toolbar:(0,J.jsx)(pe,{search:(0,J.jsx)(de,{id:x,value:p,onValueChange:m,placeholder:c(`navigation:pageHeader.searchPage`,{page:Q}),shortcut:l,clearLabel:c(`navigation:more.clearSearch`)}),actions:(0,J.jsxs)(J.Fragment,{children:[d&&(0,J.jsxs)(j,{type:`button`,variant:`secondary`,className:`h-9`,disabled:!h,onClick:()=>we()&&M(!0),children:[(0,J.jsx)(K,{}),c(`plugins:pluginsPage.installPlugin`)]}),(0,J.jsxs)(j,{type:`button`,className:`h-9`,"data-plugins-save":!0,loading:O,disabled:!h||O,onClick:()=>void Se(),children:[(0,J.jsx)(_,{}),c(`plugins:pluginsPage.savePolicy`)]})]}),filters:(0,J.jsx)(me,{options:f.map(e=>it(e,c)),value:it(T,c),onChange:e=>ne(f.find(t=>it(t,c)===e)||`all`)})}),children:[h?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(V,{className:`plugin-catalog`,title:c(`plugins:pluginsPage.toolCatalog`),count:$.length,meta:(0,J.jsxs)(`span`,{className:`plugin-catalog-summary`,children:[G.filter(e=>e.enabled).length,`/`,G.length,` `,c(`plugins:pluginsPage.enabled2`)]}),actions:X&&(0,J.jsxs)(`span`,{"data-plugins-unsaved":!0,className:`flex items-center gap-1.5 text-xs font-medium text-content-secondary`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`size-1.5 rounded-full bg-content-secondary`}),c(`plugins:pluginsPage.unsaved`)]}),children:$.length?(0,J.jsx)(B,{className:`plugin-tool-grid`,children:$.map(e=>{let t=rt[e.name]||g,n=ut(e,c);return(0,J.jsx)(z,{className:`plugin-tool-card`,"data-plugin-tool":e.name,icon:(0,J.jsx)(t,{}),name:(0,J.jsx)(`span`,{title:n,children:n}),nameMeta:e.name,description:`${dt(e,c)} · ${ye(e.risk,c)}`,status:e.pluginBuiltIn?void 0:c(`plugins:pluginsPage.local`),actions:(0,J.jsx)(ge,{value:e.enabled,onChange:t=>Z(e.pluginId,e.name,t),ariaLabel:n}),expanded:C===e.name,onExpandedChange:t=>w(t?e.name:``),toggleLabel:c(`plugins:pluginsPage.toggleToolDetails`,{name:n}),detail:(0,J.jsxs)(`div`,{className:`plugin-tool-details grid gap-3`,children:[(0,J.jsx)(`p`,{className:`text-sm leading-relaxed text-content-soft`,children:_e({id:e.name,description:e.description},c)}),(0,J.jsxs)(`dl`,{className:`grid grid-cols-[88px_minmax(0,1fr)] gap-x-3 gap-y-1.5 text-xs [&_dd]:min-w-0 [&_dd]:[overflow-wrap:anywhere] [&_dd]:text-content-soft [&_dt]:text-content-muted [&>div]:contents`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{children:c(`plugins:pluginsPage.source`)}),(0,J.jsxs)(`dd`,{className:`tabular-nums`,children:[dt(e,c),!e.pluginBuiltIn&&` · v${e.pluginVersion}`]})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{children:c(`plugins:pluginsPage.riskLevel`)}),(0,J.jsx)(`dd`,{className:A((xe(e.risk)||ve(e.risk))&&`font-medium text-content!`),children:ye(e.risk,c)})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{children:c(`plugins:pluginsPage.pathScope`)}),(0,J.jsx)(`dd`,{children:be({id:e.name,scope:e.scope},c)})]}),!e.pluginBuiltIn&&(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{children:c(`plugins:pluginsPage.executionMode`)}),(0,J.jsx)(`dd`,{children:c(`plugins:pluginsPage.confirmUnlessFullAccess`)})]})]}),!e.pluginBuiltIn&&(0,J.jsxs)(`div`,{className:`plugin-tool-warning flex items-start gap-2 rounded-sm bg-surface-subtle p-2.5 text-xs leading-normal text-content-secondary`,children:[(0,J.jsx)(ee,{className:`mt-px size-3.5 shrink-0`,"aria-hidden":`true`}),(0,J.jsx)(`span`,{children:c(`plugins:pluginsPage.localPluginSecurityWarning`)})]}),e.name===`web_search`&&(0,J.jsx)(ft,{value:E,testing:re,onChange:D,onTest:Ce}),!e.pluginBuiltIn&&(0,J.jsxs)(j,{type:`button`,variant:`ghost`,className:`justify-self-end text-danger hover:bg-danger-soft hover:text-danger max-[650px]:h-11`,onClick:()=>we()&&P(e),children:[(0,J.jsx)(te,{}),c(`plugins:pluginsPage.uninstallPlugin`)]})]})},e.name)})}):(0,J.jsx)(ue,{compact:!0,title:c(`plugins:pluginsPage.noMatchingTools`)})}),(0,J.jsx)(pt,{query:p,notify:e,requestText:n,requestConfirm:s})]}):L?(0,J.jsx)(le,{kind:`error`,title:c(`plugins:pluginsPage.loadFailed`),description:L,action:(0,J.jsx)(j,{variant:`secondary`,className:`max-[650px]:h-11`,loading:ce,disabled:ce,onClick:()=>{H(!0),W().finally(()=>H(!1))},children:c(`common:pageTemplate.retry`)})}):(0,J.jsx)(le,{kind:`loading`,title:c(`plugins:pluginsPage.loadingToolPlugins`)}),d&&(0,J.jsx)(Qe,{open:ae,onOpenChange:M,onInstalled:W}),(0,J.jsx)(Ve,{open:!!N,onOpenChange:e=>!e&&!F&&P(null),children:(0,J.jsxs)(We,{className:`z-[220]`,children:[(0,J.jsxs)(Ge,{children:[(0,J.jsx)(qe,{children:c(`plugins:pluginsPage.uninstallPlugin`)}),(0,J.jsx)(Je,{children:c(`plugins:pluginsPage.uninstallPluginDescription`,{name:N?.pluginName||``})})]}),(0,J.jsxs)(Ke,{children:[(0,J.jsx)(Xe,{disabled:F,children:c(`common:ui.cancel`)}),(0,J.jsxs)(Ye,{variant:`destructive`,disabled:F,onClick:Te,children:[F&&(0,J.jsx)(oe,{className:`text-current`}),c(`plugins:pluginsPage.uninstallPlugin`)]})]})]})}),L&&h&&(0,J.jsxs)(he,{className:`fixed right-6 bottom-6 z-[21] max-w-[360px] border border-danger-border shadow-float`,children:[(0,J.jsx)(b,{size:13}),L]})]})}export{mt as PluginsPage};
@@ -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-BuN5i-jP.js";import{t as i}from"./button-CCcCN8tE.js";import{a,i as o,l as s,o as c,s as l,t as u}from"./dialog-CtFjznlx.js";import{t as d}from"./safe-mode-instance-CJE36ukZ.js";var f=e(t(),1),p=n();function m({notify:e,disableAll:t}){let{t:n}=r(),m=d(),h=(0,f.useSyncExternalStore)(m.subscribe,m.mode,m.mode),[g,_]=(0,f.useState)(!1);if(h!==`pending`)return null;let v=async()=>{_(!0);try{await t()||e(n(`custom-ui:safeMode.disableFailed`)),m.resolve(`normal`)}catch{e(n(`custom-ui:safeMode.disableFailed`))}finally{_(!1)}};return(0,p.jsx)(u,{open:!0,onOpenChange:e=>{!e&&!g&&m.resolve(`safe`)},children:(0,p.jsxs)(o,{"data-components-safe-mode-prompt":!0,children:[(0,p.jsxs)(l,{children:[(0,p.jsx)(s,{children:n(`custom-ui:safeMode.promptTitle`)}),(0,p.jsx)(a,{children:n(`custom-ui:safeMode.promptHint`)})]}),(0,p.jsxs)(c,{children:[(0,p.jsx)(i,{variant:`outline`,disabled:g,onClick:()=>void v(),children:n(`custom-ui:safeMode.disableAll`)}),(0,p.jsx)(i,{variant:`outline`,disabled:g,onClick:()=>m.resolve(`normal`),children:n(`custom-ui:safeMode.loadNormally`)}),(0,p.jsx)(i,{disabled:g,onClick:()=>m.resolve(`safe`),children:n(`custom-ui:safeMode.keepSafe`)})]})]})})}export{m as SafeModePrompt};
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-Cyg5th6Z.js";import{t as i}from"./button-CCcCN8tE.js";import{a,i as o,l as s,o as c,s as l,t as u}from"./dialog-5MLAAE-f.js";import{t as d}from"./safe-mode-instance-65Kg_IPn.js";var f=e(t(),1),p=n();function m({notify:e,disableAll:t}){let{t:n}=r(),m=d(),h=(0,f.useSyncExternalStore)(m.subscribe,m.mode,m.mode),[g,_]=(0,f.useState)(!1);if(h!==`pending`)return null;let v=async()=>{_(!0);try{await t()||e(n(`custom-ui:safeMode.disableFailed`)),m.resolve(`normal`)}catch{e(n(`custom-ui:safeMode.disableFailed`))}finally{_(!1)}};return(0,p.jsx)(u,{open:!0,onOpenChange:e=>{!e&&!g&&m.resolve(`safe`)},children:(0,p.jsxs)(o,{"data-components-safe-mode-prompt":!0,children:[(0,p.jsxs)(l,{children:[(0,p.jsx)(s,{children:n(`custom-ui:safeMode.promptTitle`)}),(0,p.jsx)(a,{children:n(`custom-ui:safeMode.promptHint`)})]}),(0,p.jsxs)(c,{children:[(0,p.jsx)(i,{variant:`outline`,disabled:g,onClick:()=>void v(),children:n(`custom-ui:safeMode.disableAll`)}),(0,p.jsx)(i,{variant:`outline`,disabled:g,onClick:()=>m.resolve(`normal`),children:n(`custom-ui:safeMode.loadNormally`)}),(0,p.jsx)(i,{disabled:g,onClick:()=>m.resolve(`safe`),children:n(`custom-ui:safeMode.keepSafe`)})]})]})})}export{m as SafeModePrompt};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{u as t}from"./vendor-router-CSN_DGvx.js";import{i as n,r}from"./vendor-react-DwNgTV1j.js";import{t as i}from"./use-i18n-BuN5i-jP.js";import{t as a}from"./api-Dg-aNpVe.js";import{t as o}from"./bell-BjONAtgH.js";import{t as s}from"./bot-B3TaBp_T.js";import{t as c}from"./calendar-clock-VIxTaqqy.js";import{t as l}from"./circle-check-iEdCm3Pw.js";import{t as u}from"./WorkspacePicker-C0t_ekAf.js";import{t as d}from"./folder-open-FIShC5Qk.js";import{n as f,t as p}from"./send-QxBfLFo-.js";import{t as m}from"./play-DNDjDNGn.js";import{t as h}from"./plus-fQbSqB1n.js";import{t as g}from"./trash-2-CNrPOoPR.js";import{t as _}from"./triangle-alert-CE1q54ci.js";import{t as v}from"./more-pages-D_PnxLN0.js";import{t as y}from"./switch-D_G8wFhs.js";import{t as b}from"./utils-C8uzG5AZ.js";import{n as x,t as S}from"./button-CCcCN8tE.js";import{s as C}from"./shortcuts-LBxOVau1.js";import{a as w}from"./format-DMJQzoZ7.js";import{t as T}from"./StatusGlyph-1KgitlUg.js";import{a as E,i as D,l as O,s as ee,t as k}from"./dialog-CtFjznlx.js";import{t as A}from"./input-CPw-zkYh.js";import{t as j}from"./textarea-DmATpOqT.js";import{t as M}from"./pick-system-directory-B1clvHS6.js";import{n as N,t as P}from"./PageState-Cz6vFMXv.js";import{a as te,i as ne,n as re,o as ie,r as ae,s as oe,t as se}from"./FeaturePage-C6kLKix5.js";import{n as F}from"./field-DoLEb0np.js";import{t as I}from"./AppSelect-BD6RAaJ5.js";import{i as L,s as R}from"./app-primitives-Drz_SjnR.js";var z=e(n(),1),B=r(),V={browser:{name:`通知`,Icon:o},feishu:{name:`飞书`,Icon:s},weixin:{name:`微信`,Icon:f},qq:{name:`QQ`,Icon:f},telegram:{name:`Telegram`,Icon:p}},H={once:`一次`,interval:`每隔一段时间`,daily:`每天`,weekly:`每周`,monthly:`每月`},U={minutes:`分钟`,hours:`小时`,days:`天`},W=[...new Set([`Asia/Hong_Kong`,`UTC`,...typeof Intl.supportedValuesOf==`function`?Intl.supportedValuesOf(`timeZone`):[]])],G=[`full-access`],K=`mt-4 border-t border-stroke-soft pt-1`,q=`form-grid grid gap-x-3 sm:grid-cols-3`,J=`schedule-interval-input grid grid-cols-[minmax(0,1fr)_minmax(84px,auto)] gap-1.5`,Y=`inline-grid h-8 grid-cols-2 rounded-md border border-stroke bg-chrome p-[3px] max-[650px]:h-auto max-[650px]:w-full pointer-coarse:h-auto`,ce=`inline-flex min-w-0 items-center justify-center rounded-sm border border-transparent px-3 text-sm text-content-secondary transition-colors duration-(--d-fast) hover:text-content aria-pressed:border-key-border aria-pressed:bg-key aria-pressed:font-medium aria-pressed:text-content aria-pressed:shadow-key max-[650px]:h-11 pointer-coarse:h-11`;function le({status:e}){return(0,B.jsx)(`span`,{"aria-hidden":`true`,className:`mt-px grid size-[18px] flex-none place-items-center`,children:(0,B.jsx)(T,{status:e===`running`?`run`:e===`completed`?`done`:`failed`,className:`size-3.5`})})}function ue(e){return e(`schedules:schedulesPage.fullAccessHelp`)}function de(e,t){return t(e===`once`?`schedules:schedulesPage.once`:e===`daily`?`schedules:schedulesPage.daily`:e===`weekly`?`schedules:schedulesPage.weekly`:e===`monthly`?`schedules:schedulesPage.monthly`:`schedules:schedulesPage.atIntervals`)}function fe(e,t){return t(e===`hours`?`schedules:schedulesPage.hours`:e===`days`?`schedules:schedulesPage.days`:`schedules:schedulesPage.minutes`)}function pe(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 X({value:e,onChange:t}){let{t:n}=i();return(0,B.jsxs)(F,{variant:`control`,children:[n(`schedules:schedulesPage.executionMode`),(0,B.jsx)(I,{value:e,onChange:e=>t(e.target.value),children:G.map(e=>(0,B.jsx)(`option`,{value:e,children:n(`schedules:schedulesPage.fullAccess`)},e))}),(0,B.jsx)(`small`,{children:ue(n)})]})}function Z(e){return Object.fromEntries((e?.inputs||[]).map(e=>[e.name,e.defaultValue??``]))}function Q(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 $({targetType:e,prompt:t,workflowId:n,workflowInputs:r,workflows:a,onChange:o}){let{t:s}=i(),c=a.find(e=>e.id===n);return(0,B.jsxs)(`div`,{className:`grid`,children:[(0,B.jsxs)(F,{variant:`control`,children:[s(`schedules:schedulesPage.executionTarget`),(0,B.jsxs)(I,{value:e,onChange:e=>{let t=e.target.value,i=a[0];o(t===`workflow`?{targetType:t,workflowId:n||i?.id||``,workflowInputs:n?r:Z(i)}:{targetType:t})},children:[(0,B.jsx)(`option`,{value:`prompt`,children:`Prompt`}),(0,B.jsx)(`option`,{value:`workflow`,children:s(`schedules:schedulesPage.workflow`)})]})]}),e===`prompt`?(0,B.jsxs)(F,{variant:`control`,children:[`Prompt`,(0,B.jsx)(j,{value:t,onChange:e=>o({prompt:e.target.value}),placeholder:s(`schedules:schedulesPage.describeTheWorkTheAgentShouldCompleteEachTime`)})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(F,{variant:`control`,children:[s(`schedules:schedulesPage.workflow`),(0,B.jsxs)(I,{value:n,onChange:e=>{let t=a.find(t=>t.id===e.target.value);o({workflowId:e.target.value,workflowInputs:Z(t)})},children:[(0,B.jsx)(`option`,{value:``,children:s(`schedules:schedulesPage.selectPublishedWorkflow`)}),a.map(e=>(0,B.jsxs)(`option`,{value:e.id,children:[e.name,` · v`,e.revision]},e.id))]}),(0,B.jsx)(`small`,{children:c?.description||(a.length?s(`schedules:schedulesPage.workflowUsesItsOwnRuntimeSettings`):s(`schedules:schedulesPage.noPublishedWorkflows`))})]}),c?.inputs.length?(0,B.jsxs)(`div`,{className:`grid`,children:[(0,B.jsxs)(`div`,{className:`schedule-workflow-inputs-heading mt-3 flex items-baseline justify-between gap-3 max-[650px]:flex-col max-[650px]:items-start max-[650px]:gap-0.5 [&_small]:text-xs [&_small]:text-content-muted [&_strong]:text-xs [&_strong]:font-medium [&_strong]:text-content-secondary`,children:[(0,B.jsx)(`strong`,{children:s(`schedules:schedulesPage.workflowInputs`)}),(0,B.jsx)(`small`,{children:s(`schedules:schedulesPage.workflowInputsHelp`)})]}),(0,B.jsx)(`div`,{className:`schedule-workflow-inputs grid gap-x-3 sm:grid-cols-2 [&_input[type=checkbox]]:size-4 [&_input[type=checkbox]]:justify-self-end [&_input[type=checkbox]]:accent-star`,children:c.inputs.map(e=>(0,B.jsxs)(F,{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,B.jsx)(y,{checked:!!r[e.name],onCheckedChange:t=>o({workflowInputs:{...r,[e.name]:t}})}):(0,B.jsx)(A,{type:e.type===`number`?`number`:`text`,required:e.required,value:String(r[e.name]??``),onChange:t=>o({workflowInputs:{...r,[e.name]:t.target.value}})}),e.description&&(0,B.jsx)(`small`,{children:e.description})]},e.id))})]}):null]})]})}function me({value:e,onChange:t}){let{t:n}=i(),[r,a]=(0,z.useState)(``),[o,s]=(0,z.useState)(!1),c=async()=>{a(``);try{let r=await M(e,n(`common:workspacePicker.selectWorkspaceForSchedule`));r.status===`picked`?t(r.path):r.status===`unavailable`&&s(!0)}catch(e){a(e instanceof Error?e.message:String(e))}};return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(F,{variant:`control`,children:[n(`schedules:schedulesPage.workingDirectory`),(0,B.jsxs)(`span`,{className:`schedule-workspace-input grid grid-cols-[minmax(0,1fr)_auto] gap-1.5 [&_input]:min-w-0 [&_input]:font-mono`,children:[(0,B.jsx)(A,{value:e,onChange:e=>t(e.target.value),placeholder:n(`schedules:schedulesPage.enterTheProjectSAbsolutePath`)}),(0,B.jsxs)(S,{type:`button`,variant:`secondary`,className:`h-auto min-h-8`,onClick:()=>void c(),children:[(0,B.jsx)(d,{}),n(`schedules:schedulesPage.browseDirectories`)]})]}),(0,B.jsx)(`small`,{children:n(`schedules:schedulesPage.theScheduledAgentWillRunInThisDirectory`)})]}),r&&(0,B.jsxs)(L,{children:[(0,B.jsx)(_,{size:13}),r]}),(0,B.jsx)(u,{open:o,initialPath:e,description:n(`common:workspacePicker.selectWorkspaceForSchedule`),onOpenChange:s,onSelect:e=>t(e)})]})}function he(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,date:e.date||``,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 ge(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 _e({notify:e,onBack:n,openNotificationSettings:r,requestConfirm:o}){let{t:s,language:l}=i(),u=t(),d=C(`focusSearch`),[f,p]=(0,z.useState)({tasks:[],runs:[],notificationTargets:{browser:{enabled:!1},feishu:{enabled:!1},weixin:{enabled:!1},qq:{enabled:!1},telegram:{enabled:!1}},workflows:[],defaultCwd:``}),[m,g]=(0,z.useState)(``),[_,y]=(0,z.useState)({}),[b,x]=(0,z.useState)(!0),[w,E]=(0,z.useState)(!1),[D,O]=(0,z.useState)(``),[ee,k]=(0,z.useState)(!1),[A,j]=(0,z.useState)(``),[M,F]=(0,z.useState)(!1),[I,L]=(0,z.useState)(``),R=(0,z.useCallback)(async()=>{try{let e=await a(`/api/schedules`);p(e),E(!0),O(``),g(t=>e.tasks.some(e=>e.id===t)?t:``),y(t=>{let n=Object.entries(t).filter(([t])=>e.tasks.some(e=>e.id===t));return n.length===Object.keys(t).length?t:Object.fromEntries(n)})}catch(e){O(e instanceof Error?e.message:String(e))}finally{x(!1)}},[]);(0,z.useEffect)(()=>{R()},[R]),(0,z.useEffect)(()=>{let e=window.setInterval(R,f.tasks.some(e=>e.lastStatus===`running`)?2e3:1e4);return()=>window.clearInterval(e)},[f.tasks,R]);let V=f.tasks.find(e=>e.id===m),H=f.workflows||[],U=V?_[V.id]??he(V):null,W=(0,z.useMemo)(()=>f.runs.filter(e=>e.taskId===m).sort((e,t)=>new Date(t.startedAt).getTime()-new Date(e.startedAt).getTime()).slice(0,20),[f.runs,m]),G=e=>H.find(t=>t.id===e.workflowId)?.name||s(`schedules:schedulesPage.workflowUnavailable`),K=I.trim().toLocaleLowerCase(),q=K?f.tasks.filter(e=>`${e.name} ${e.targetType===`workflow`?G(e):e.targetType===`bot`?e.botMessage||``:e.prompt}`.toLocaleLowerCase().includes(K)):f.tasks,J=f.tasks.filter(e=>e.enabled).length,Y=e=>{if(!V)return;let t=he(V);y(n=>({...n,[t.id]:{...n[t.id]??t,...e}}))},ce=e=>{U&&Y({notifications:U.notifications.includes(e)?U.notifications.filter(t=>t!==e):[...U.notifications,e]})},le=async()=>{if(!(!V||!U)){k(!0),j(``);try{let t=await a(`/api/schedules/${encodeURIComponent(V.id)}`,{method:`PATCH`,body:JSON.stringify(U)});p(t.state),y(e=>Object.fromEntries(Object.entries(e).filter(([e])=>e!==t.task.id))),e(s(`schedules:schedulesPage.scheduledTaskSaved`))}catch(e){j(e instanceof Error?e.message:String(e))}finally{k(!1)}}},ue=async()=>{if(V){k(!0),j(``);try{await a(`/api/schedules/${encodeURIComponent(V.id)}/run`,{method:`POST`,body:`{}`}),await R(),e(s(`schedules:schedulesPage.scheduledTaskStarted`))}catch(e){j(e instanceof Error?e.message:String(e))}finally{k(!1)}}},pe=async()=>{if(V&&await o({title:s(`schedules:schedulesPage.deleteScheduledTask`),message:s(`schedules:schedulesPage.deleteScheduledTaskNameAndItsRunHistory`,{name:V.name}),confirmLabel:s(`schedules:schedulesPage.delete`)}))try{await a(`/api/schedules/${encodeURIComponent(V.id)}`,{method:`DELETE`}),await R(),e(s(`schedules:schedulesPage.scheduledTaskDeleted`))}catch(e){j(e instanceof Error?e.message:String(e))}},X=t=>{p(t.state),g(t.task.id),e(s(`schedules:schedulesPage.scheduledTaskCreated`))},Z=e=>(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-col items-end gap-0.5 max-[650px]:flex-row max-[650px]:items-center max-[650px]:gap-2`,children:[e.lastStatus===`running`?(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-content-secondary`,children:[(0,B.jsx)(T,{status:`run`,className:`size-3.5`}),s(`schedules:schedulesPage.running`)]}):(0,B.jsx)(`span`,{className:`whitespace-nowrap`,children:e.enabled?s(`schedules:schedulesPage.nextRunTime`,{time:ge(e,l)}):e.lastStatus===`missed`?s(`schedules:schedulesPage.missed`):e.frequency===`once`&&e.lastRunAt?s(`schedules:schedulesPage.onceDone`):s(`schedules:schedulesPage.pause`)}),e.lastStatus===`failed`&&(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-content-secondary`,children:[(0,B.jsx)(T,{status:`failed`,className:`size-3.5`}),s(`schedules:schedulesPage.lastRunFailed`)]})]}),Q=s(`navigation:navigation.schedules`);return(0,B.jsxs)(ae,{title:Q,description:s(`schedules:schedulesPage.lede`),back:n&&{label:s(`navigation:sidebar.features`),ariaLabel:s(`navigation:shell.backToFeaturesLabel`),onBack:n},toolbar:(0,B.jsx)(oe,{search:(0,B.jsx)(te,{id:v,value:I,onValueChange:L,placeholder:s(`navigation:pageHeader.searchPage`,{page:Q}),shortcut:d,clearLabel:s(`navigation:more.clearSearch`)}),actions:(0,B.jsxs)(S,{type:`button`,className:`h-9`,disabled:!w,onClick:()=>F(!0),children:[(0,B.jsx)(h,{}),s(`schedules:schedulesPage.newTask`)]})}),children:[b?(0,B.jsx)(N,{kind:`loading`,title:s(`schedules:schedulesPage.loadingScheduledTasks`)}):D&&!w?(0,B.jsx)(N,{kind:`error`,title:s(`schedules:schedulesPage.loadFailed`),description:D,action:(0,B.jsx)(S,{variant:`secondary`,className:`max-[650px]:h-11`,onClick:()=>{x(!0),R()},children:s(`common:pageTemplate.retry`)})}):(0,B.jsxs)(B.Fragment,{children:[(A||D)&&(0,B.jsx)(se,{children:A||D}),(0,B.jsx)(ie,{title:s(`schedules:schedulesPage.tasks`),count:f.tasks.length,meta:f.tasks.length?s(`schedules:schedulesPage.enabledCount`,{count:J}):void 0,children:q.length?(0,B.jsx)(re,{children:q.map(e=>{let t=m===e.id;return(0,B.jsx)(ne,{"data-schedule-task":e.id,className:`schedule-list-item`,icon:(0,B.jsx)(c,{}),name:e.name,description:e.targetType===`workflow`?(0,B.jsx)(`span`,{className:`font-mono`,children:G(e)}):e.targetType===`bot`?s(`schedules:schedulesPage.botTarget`,{message:e.botMessage||``}):e.prompt,meta:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{children:de(e.frequency,s)}),(0,B.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,B.jsx)(`span`,{className:`tabular-nums`,children:e.frequency===`interval`?`${e.intervalValue} ${fe(e.intervalUnit,s)}`:e.frequency===`once`?`${e.date} ${e.time}`:e.time}),(0,B.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,B.jsx)(`span`,{className:`truncate`,children:e.timezone}),e.createdBy?.kind===`agent`&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,B.jsx)(`span`,{"data-schedule-created-by":`agent`,children:s(`schedules:schedulesPage.createdByAgent`)})]})]}),status:Z(e),expanded:t,onExpandedChange:t=>g(t?e.id:``),toggleLabel:s(`schedules:schedulesPage.toggleTaskDetails`,{name:e.name}),detail:t&&e.targetType===`bot`?(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm text-content-secondary`,children:[(0,B.jsx)(`span`,{className:`min-w-0 flex-1`,children:s(`schedules:schedulesPage.botManagedThere`)}),(0,B.jsx)(S,{size:`sm`,variant:`outline`,onClick:()=>u(`/bots/${encodeURIComponent(e.botId||``)}`),children:s(`schedules:schedulesPage.openBot`)})]}):t&&U&&V?(0,B.jsx)(ve,{task:V,draft:U,runs:W,saving:ee,workflows:H,notificationTargets:f.notificationTargets,language:l,onUpdate:Y,onToggleNotification:ce,onRun:ue,onRemove:pe,onSave:le,onEditTemplates:r}):null},e.id)})}):(0,B.jsx)(P,{title:f.tasks.length?s(`schedules:schedulesPage.noMatchingTasks`):s(`schedules:schedulesPage.theTimelineIsStillUnlit`),description:f.tasks.length?void 0:s(`schedules:schedulesPage.createATaskAndLetItSetOutAutomaticallyAtTheAppointedTime`)})})]}),M&&(0,B.jsx)(ye,{notificationTargets:f.notificationTargets,workflows:H,defaultCwd:f.defaultCwd,onClose:()=>F(!1),onCreated:e=>{F(!1),X(e)}})]})}function ve({task:e,draft:t,runs:n,saving:r,workflows:a,notificationTargets:o,language:s,onUpdate:c,onToggleNotification:u,onRun:d,onRemove:f,onSave:p,onEditTemplates:h}){let{t:_}=i(),v=e.lastStatus===`running`;return(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,B.jsxs)(`label`,{className:`mr-auto inline-flex min-h-8 items-center gap-2.5 text-sm text-content max-[650px]:min-h-11`,children:[(0,B.jsx)(R,{value:t.enabled,onChange:e=>c({enabled:e}),ariaLabel:_(`schedules:schedulesPage.enableTaskName`,{name:t.name})}),t.enabled?_(`schedules:schedulesPage.enabled`):_(`schedules:schedulesPage.pause`)]}),(0,B.jsxs)(S,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,disabled:r||v,onClick:d,children:[v?(0,B.jsx)(x,{}):(0,B.jsx)(m,{}),_(v?`schedules:schedulesPage.running`:`schedules:schedulesPage.runNow`)]}),(0,B.jsx)(S,{variant:`ghost`,size:`icon-sm`,className:`hover:bg-danger-soft hover:text-danger max-[650px]:size-11`,title:_(`schedules:schedulesPage.deleteTask`),"aria-label":_(`schedules:schedulesPage.deleteTask`),onClick:f,children:(0,B.jsx)(g,{})})]}),(0,B.jsx)($,{targetType:t.targetType,prompt:t.prompt,workflowId:t.workflowId,workflowInputs:t.workflowInputs,workflows:a,onChange:c}),t.targetType===`prompt`&&(0,B.jsx)(me,{value:t.cwd,onChange:e=>c({cwd:e})}),(0,B.jsx)(`div`,{className:K,children:(0,B.jsxs)(`div`,{className:q,children:[(0,B.jsxs)(F,{variant:`control`,children:[_(`schedules:schedulesPage.frequency`),(0,B.jsx)(I,{value:t.frequency,onChange:e=>c({frequency:e.target.value}),children:Object.keys(H).map(e=>(0,B.jsx)(`option`,{value:e,children:de(e,_)},e))})]}),t.frequency===`interval`?(0,B.jsxs)(F,{variant:`control`,children:[_(`schedules:schedulesPage.runInterval`),(0,B.jsxs)(`span`,{className:J,children:[(0,B.jsx)(A,{type:`number`,min:`1`,value:t.intervalValue,onChange:e=>c({intervalValue:Number(e.target.value)})}),(0,B.jsx)(I,{value:t.intervalUnit,onChange:e=>c({intervalUnit:e.target.value}),children:Object.keys(U).map(e=>(0,B.jsx)(`option`,{value:e,children:fe(e,_)},e))})]})]}):(0,B.jsxs)(B.Fragment,{children:[t.frequency===`once`&&(0,B.jsxs)(F,{variant:`control`,children:[_(`schedules:schedulesPage.date`),(0,B.jsx)(A,{type:`date`,className:`tabular-nums`,value:t.date,onChange:e=>c({date:e.target.value})})]}),(0,B.jsxs)(F,{variant:`control`,children:[_(`schedules:schedulesPage.time`),(0,B.jsx)(A,{type:`time`,className:`tabular-nums`,value:t.time,onChange:e=>c({time:e.target.value})})]})]}),(0,B.jsxs)(F,{variant:`control`,children:[_(`schedules:schedulesPage.timeZone`),(0,B.jsx)(I,{value:t.timezone,onChange:e=>c({timezone:e.target.value}),children:W.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))})]}),t.targetType===`prompt`&&(0,B.jsx)(X,{value:t.executionMode,onChange:e=>c({executionMode:e})})]})}),(0,B.jsxs)(`div`,{className:b(`schedule-notification-section pt-3`,K),children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,B.jsx)(`strong`,{className:`text-sm font-medium`,children:_(`schedules:schedulesPage.notificationChannels`)}),(0,B.jsx)(`button`,{type:`button`,className:`text-button text-xs font-medium text-content-secondary underline underline-offset-2 hover:text-content max-[650px]:min-h-11`,onClick:h,children:_(`schedules:schedulesPage.editTemplates`)})]}),(0,B.jsx)(`p`,{className:`mt-0.5 text-xs text-content-muted`,children:_(`schedules:schedulesPage.notificationChannelsHelp`)}),(0,B.jsx)(`div`,{className:`schedule-notification-targets mt-2.5 grid grid-cols-[repeat(auto-fill,minmax(132px,1fr))] gap-2`,children:Object.entries(V).map(([e,n])=>{let r=n.Icon,i=t.notifications.includes(e);return(0,B.jsxs)(`button`,{type:`button`,"aria-pressed":i,className:b(`grid min-h-[52px] grid-cols-[16px_minmax(0,1fr)_16px] items-center gap-2 rounded-md border px-2.5 py-2 text-left transition-colors duration-(--d-fast)`,i?`selected border-star-border bg-star-soft text-star-strong`:`border-stroke bg-panel text-content hover:bg-surface-subtle`),onClick:()=>u(e),children:[(0,B.jsx)(r,{className:`size-4`}),(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,B.jsx)(`strong`,{className:`truncate text-sm font-medium`,children:pe(e,_)}),(0,B.jsx)(`small`,{className:`truncate text-xs text-content-muted`,children:o[e].enabled?_(`schedules:schedulesPage.configured`):_(`schedules:schedulesPage.notConfigured`)})]}),(0,B.jsx)(l,{className:b(`size-4`,i?`text-star-strong`:`text-content-faint`)})]},e)})}),(0,B.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-3 gap-y-1.5`,children:[(0,B.jsx)(`span`,{id:`schedule-notify-on-${e.id}`,className:`text-xs text-content-muted`,children:_(`schedules:schedulesPage.notifyWhen`)}),(0,B.jsx)(`div`,{role:`group`,"aria-labelledby":`schedule-notify-on-${e.id}`,className:b(`schedule-notification-chip`,Y),children:[`always`,`failure`].map(e=>(0,B.jsx)(`button`,{type:`button`,"aria-pressed":t.notifyOn===e,className:ce,onClick:()=>c({notifyOn:e}),children:_(e===`failure`?`schedules:schedulesPage.failuresOnly`:`schedules:schedulesPage.completionAndFailure`)},e))})]})]}),(0,B.jsxs)(`div`,{className:`form-footer mt-4 flex items-center justify-between gap-2.5 border-t border-stroke-soft pt-3 max-[650px]:flex-wrap`,children:[(0,B.jsx)(`span`,{className:`text-xs text-content-muted tabular-nums`,children:e.lastRunAt?_(`schedules:schedulesPage.lastRunTime`,{time:w(e.lastRunAt,s)}):_(`schedules:schedulesPage.nextRunTime`,{time:ge(e,s)})}),(0,B.jsxs)(S,{className:`max-[650px]:h-11 max-[650px]:w-full`,disabled:r||!Q(t.targetType,t.prompt,t.workflowId,t.workflowInputs,a),onClick:p,children:[r?(0,B.jsx)(x,{className:`text-current`}):null,_(r?`schedules:schedulesPage.saving`:`schedules:schedulesPage.saveTask`)]})]})]}),(0,B.jsxs)(`section`,{"aria-labelledby":`schedule-runs-${e.id}`,className:`min-w-0`,children:[(0,B.jsxs)(`h3`,{id:`schedule-runs-${e.id}`,className:`mb-1.5 text-[13px] font-medium text-content-muted tabular-nums`,children:[_(`schedules:schedulesPage.recentRuns`),` · `,n.length]}),n.length?(0,B.jsx)(`ul`,{className:`divide-y divide-stroke-soft overflow-hidden rounded-[var(--r-md)] border border-stroke`,children:n.map(e=>(0,B.jsxs)(`li`,{className:`schedule-run-row grid min-h-11 grid-cols-[18px_minmax(0,1fr)_auto] items-start gap-2.5 px-3 py-2.5 ${e.status}`,children:[(0,B.jsx)(le,{status:e.status}),(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,B.jsx)(`strong`,{className:`line-clamp-2 text-sm leading-5 font-medium text-content`,children:e.status===`running`?_(`schedules:schedulesPage.running2`):e.status===`completed`?e.summary||_(`schedules:schedulesPage.taskCompleted`):e.status===`interrupted`?_(`schedules:schedulesPage.taskInterrupted`):e.error||_(`schedules:schedulesPage.taskFailed`)}),(0,B.jsxs)(`small`,{className:`text-xs text-content-muted tabular-nums`,children:[w(e.startedAt,s),` ·`,` `,e.trigger===`manual`?_(`schedules:schedulesPage.manualRun`):_(`schedules:schedulesPage.scheduledTrigger`),e.durationMs?` · ${_(`schedules:schedulesPage.countSec`,{count:Math.round(e.durationMs/1e3)})}`:``]})]}),(0,B.jsx)(`em`,{className:`font-mono text-xs leading-5 text-content-secondary not-italic tabular-nums`,children:new Intl.DateTimeFormat(s,{hour:`2-digit`,minute:`2-digit`}).format(new Date(e.startedAt))})]},e.id))}):(0,B.jsx)(P,{compact:!0,title:_(`schedules:schedulesPage.noRunHistory`)})]})]})}function ye({notificationTargets:e,workflows:t,defaultCwd:n,onClose:r,onCreated:o}){let{t:s}=i(),[c,l]=(0,z.useState)(``),[u,d]=(0,z.useState)(`prompt`),[f,p]=(0,z.useState)(``),[m,g]=(0,z.useState)(``),[v,y]=(0,z.useState)({}),[b,C]=(0,z.useState)(n||``),[w,T]=(0,z.useState)(`full-access`),[j,M]=(0,z.useState)(!1),[N,P]=(0,z.useState)(``);return(0,B.jsx)(k,{open:!0,onOpenChange:e=>!e&&r(),children:(0,B.jsx)(D,{size:`compact`,children:(0,B.jsxs)(`form`,{className:`grid min-w-0`,onSubmit:async t=>{t.preventDefault(),M(!0),P(``);try{let t=Object.entries(e).filter(([,e])=>e.enabled).map(([e])=>e);o(await a(`/api/schedules`,{method:`POST`,body:JSON.stringify({name:c,targetType:u,prompt:f,workflowId:m,workflowInputs:v,cwd:b,enabled:!0,frequency:`daily`,time:`09:00`,timezone:`Asia/Hong_Kong`,executionMode:w,notifications:t,notifyOn:`always`})}))}catch(e){P(e instanceof Error?e.message:String(e))}finally{M(!1)}},children:[(0,B.jsxs)(ee,{children:[(0,B.jsx)(O,{children:s(`schedules:schedulesPage.newScheduledTask`)}),(0,B.jsx)(E,{children:s(`schedules:schedulesPage.youCanContinueSettingTheRunTimeAndNotificationChannelsAfterCreation`)})]}),(0,B.jsxs)(F,{variant:`control`,children:[s(`schedules:schedulesPage.taskName`),(0,B.jsx)(A,{value:c,onChange:e=>l(e.target.value),placeholder:s(`schedules:schedulesPage.forExampleDailyCodeReview`)})]}),(0,B.jsx)($,{targetType:u,prompt:f,workflowId:m,workflowInputs:v,workflows:t,onChange:e=>{e.targetType&&d(e.targetType),e.prompt!==void 0&&p(e.prompt),e.workflowId!==void 0&&g(e.workflowId),e.workflowInputs!==void 0&&y(e.workflowInputs)}}),u===`prompt`&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(me,{value:b,onChange:C}),(0,B.jsx)(X,{value:w,onChange:T})]}),N&&(0,B.jsxs)(L,{children:[(0,B.jsx)(_,{size:13}),N]}),(0,B.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2 max-[650px]:[&>button]:h-11 max-[650px]:[&>button]:flex-1`,children:[(0,B.jsx)(S,{type:`button`,variant:`secondary`,onClick:r,children:s(`schedules:schedulesPage.cancel`)}),(0,B.jsxs)(S,{type:`submit`,disabled:j||!c.trim()||!Q(u,f,m,v,t),children:[j?(0,B.jsx)(x,{className:`text-current`}):(0,B.jsx)(h,{}),s(j?`schedules:schedulesPage.creating`:`schedules:schedulesPage.createTask`)]})]})]})})})}export{_e as SchedulesPage};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{u as t}from"./vendor-router-CSN_DGvx.js";import{i as n,r}from"./vendor-react-DwNgTV1j.js";import{t as i}from"./use-i18n-Cyg5th6Z.js";import{t as a}from"./api-m-Yq8n0q.js";import{t as o}from"./bell-BjONAtgH.js";import{t as s}from"./bot-B3TaBp_T.js";import{t as c}from"./calendar-clock-VIxTaqqy.js";import{t as l}from"./circle-check-iEdCm3Pw.js";import{t as u}from"./WorkspacePicker-LbBXFH77.js";import{t as d}from"./folder-open-FIShC5Qk.js";import{n as f,t as p}from"./send-QxBfLFo-.js";import{t as m}from"./play-DNDjDNGn.js";import{t as h}from"./plus-fQbSqB1n.js";import{t as g}from"./trash-2-CNrPOoPR.js";import{t as _}from"./triangle-alert-CE1q54ci.js";import{t as v}from"./more-pages-D_PnxLN0.js";import{t as y}from"./switch-D_G8wFhs.js";import{t as b}from"./utils-C8uzG5AZ.js";import{n as x,t as S}from"./button-CCcCN8tE.js";import{s as C}from"./shortcuts-Cgx6V2jI.js";import{a as w}from"./format-DMJQzoZ7.js";import{t as T}from"./StatusGlyph-1KgitlUg.js";import{a as E,i as D,l as O,s as ee,t as k}from"./dialog-5MLAAE-f.js";import{t as A}from"./input-CPw-zkYh.js";import{t as j}from"./textarea-DmATpOqT.js";import{t as M}from"./pick-system-directory-ByTVOp-v.js";import{n as N,t as P}from"./PageState-Cz6vFMXv.js";import{a as te,i as ne,n as re,o as ie,r as ae,s as oe,t as se}from"./FeaturePage-B3PLRtEG.js";import{n as F}from"./field-DoLEb0np.js";import{t as I}from"./AppSelect-BD6RAaJ5.js";import{i as L,s as R}from"./app-primitives-Drz_SjnR.js";var z=e(n(),1),B=r(),V={browser:{name:`通知`,Icon:o},feishu:{name:`飞书`,Icon:s},weixin:{name:`微信`,Icon:f},qq:{name:`QQ`,Icon:f},telegram:{name:`Telegram`,Icon:p}},H={once:`一次`,interval:`每隔一段时间`,daily:`每天`,weekly:`每周`,monthly:`每月`},U={minutes:`分钟`,hours:`小时`,days:`天`},W=[...new Set([`Asia/Hong_Kong`,`UTC`,...typeof Intl.supportedValuesOf==`function`?Intl.supportedValuesOf(`timeZone`):[]])],G=[`full-access`],K=`mt-4 border-t border-stroke-soft pt-1`,q=`form-grid grid gap-x-3 sm:grid-cols-3`,J=`schedule-interval-input grid grid-cols-[minmax(0,1fr)_minmax(84px,auto)] gap-1.5`,Y=`inline-grid h-8 grid-cols-2 rounded-md border border-stroke bg-chrome p-[3px] max-[650px]:h-auto max-[650px]:w-full pointer-coarse:h-auto`,ce=`inline-flex min-w-0 items-center justify-center rounded-sm border border-transparent px-3 text-sm text-content-secondary transition-colors duration-(--d-fast) hover:text-content aria-pressed:border-key-border aria-pressed:bg-key aria-pressed:font-medium aria-pressed:text-content aria-pressed:shadow-key max-[650px]:h-11 pointer-coarse:h-11`;function le({status:e}){return(0,B.jsx)(`span`,{"aria-hidden":`true`,className:`mt-px grid size-[18px] flex-none place-items-center`,children:(0,B.jsx)(T,{status:e===`running`?`run`:e===`completed`?`done`:`failed`,className:`size-3.5`})})}function ue(e){return e(`schedules:schedulesPage.fullAccessHelp`)}function de(e,t){return t(e===`once`?`schedules:schedulesPage.once`:e===`daily`?`schedules:schedulesPage.daily`:e===`weekly`?`schedules:schedulesPage.weekly`:e===`monthly`?`schedules:schedulesPage.monthly`:`schedules:schedulesPage.atIntervals`)}function fe(e,t){return t(e===`hours`?`schedules:schedulesPage.hours`:e===`days`?`schedules:schedulesPage.days`:`schedules:schedulesPage.minutes`)}function pe(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 X({value:e,onChange:t}){let{t:n}=i();return(0,B.jsxs)(F,{variant:`control`,children:[n(`schedules:schedulesPage.executionMode`),(0,B.jsx)(I,{value:e,onChange:e=>t(e.target.value),children:G.map(e=>(0,B.jsx)(`option`,{value:e,children:n(`schedules:schedulesPage.fullAccess`)},e))}),(0,B.jsx)(`small`,{children:ue(n)})]})}function Z(e){return Object.fromEntries((e?.inputs||[]).map(e=>[e.name,e.defaultValue??``]))}function Q(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 $({targetType:e,prompt:t,workflowId:n,workflowInputs:r,workflows:a,onChange:o}){let{t:s}=i(),c=a.find(e=>e.id===n);return(0,B.jsxs)(`div`,{className:`grid`,children:[(0,B.jsxs)(F,{variant:`control`,children:[s(`schedules:schedulesPage.executionTarget`),(0,B.jsxs)(I,{value:e,onChange:e=>{let t=e.target.value,i=a[0];o(t===`workflow`?{targetType:t,workflowId:n||i?.id||``,workflowInputs:n?r:Z(i)}:{targetType:t})},children:[(0,B.jsx)(`option`,{value:`prompt`,children:`Prompt`}),(0,B.jsx)(`option`,{value:`workflow`,children:s(`schedules:schedulesPage.workflow`)})]})]}),e===`prompt`?(0,B.jsxs)(F,{variant:`control`,children:[`Prompt`,(0,B.jsx)(j,{value:t,onChange:e=>o({prompt:e.target.value}),placeholder:s(`schedules:schedulesPage.describeTheWorkTheAgentShouldCompleteEachTime`)})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(F,{variant:`control`,children:[s(`schedules:schedulesPage.workflow`),(0,B.jsxs)(I,{value:n,onChange:e=>{let t=a.find(t=>t.id===e.target.value);o({workflowId:e.target.value,workflowInputs:Z(t)})},children:[(0,B.jsx)(`option`,{value:``,children:s(`schedules:schedulesPage.selectPublishedWorkflow`)}),a.map(e=>(0,B.jsxs)(`option`,{value:e.id,children:[e.name,` · v`,e.revision]},e.id))]}),(0,B.jsx)(`small`,{children:c?.description||(a.length?s(`schedules:schedulesPage.workflowUsesItsOwnRuntimeSettings`):s(`schedules:schedulesPage.noPublishedWorkflows`))})]}),c?.inputs.length?(0,B.jsxs)(`div`,{className:`grid`,children:[(0,B.jsxs)(`div`,{className:`schedule-workflow-inputs-heading mt-3 flex items-baseline justify-between gap-3 max-[650px]:flex-col max-[650px]:items-start max-[650px]:gap-0.5 [&_small]:text-xs [&_small]:text-content-muted [&_strong]:text-xs [&_strong]:font-medium [&_strong]:text-content-secondary`,children:[(0,B.jsx)(`strong`,{children:s(`schedules:schedulesPage.workflowInputs`)}),(0,B.jsx)(`small`,{children:s(`schedules:schedulesPage.workflowInputsHelp`)})]}),(0,B.jsx)(`div`,{className:`schedule-workflow-inputs grid gap-x-3 sm:grid-cols-2 [&_input[type=checkbox]]:size-4 [&_input[type=checkbox]]:justify-self-end [&_input[type=checkbox]]:accent-star`,children:c.inputs.map(e=>(0,B.jsxs)(F,{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,B.jsx)(y,{checked:!!r[e.name],onCheckedChange:t=>o({workflowInputs:{...r,[e.name]:t}})}):(0,B.jsx)(A,{type:e.type===`number`?`number`:`text`,required:e.required,value:String(r[e.name]??``),onChange:t=>o({workflowInputs:{...r,[e.name]:t.target.value}})}),e.description&&(0,B.jsx)(`small`,{children:e.description})]},e.id))})]}):null]})]})}function me({value:e,onChange:t}){let{t:n}=i(),[r,a]=(0,z.useState)(``),[o,s]=(0,z.useState)(!1),c=async()=>{a(``);try{let r=await M(e,n(`common:workspacePicker.selectWorkspaceForSchedule`));r.status===`picked`?t(r.path):r.status===`unavailable`&&s(!0)}catch(e){a(e instanceof Error?e.message:String(e))}};return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(F,{variant:`control`,children:[n(`schedules:schedulesPage.workingDirectory`),(0,B.jsxs)(`span`,{className:`schedule-workspace-input grid grid-cols-[minmax(0,1fr)_auto] gap-1.5 [&_input]:min-w-0 [&_input]:font-mono`,children:[(0,B.jsx)(A,{value:e,onChange:e=>t(e.target.value),placeholder:n(`schedules:schedulesPage.enterTheProjectSAbsolutePath`)}),(0,B.jsxs)(S,{type:`button`,variant:`secondary`,className:`h-auto min-h-8`,onClick:()=>void c(),children:[(0,B.jsx)(d,{}),n(`schedules:schedulesPage.browseDirectories`)]})]}),(0,B.jsx)(`small`,{children:n(`schedules:schedulesPage.theScheduledAgentWillRunInThisDirectory`)})]}),r&&(0,B.jsxs)(L,{children:[(0,B.jsx)(_,{size:13}),r]}),(0,B.jsx)(u,{open:o,initialPath:e,description:n(`common:workspacePicker.selectWorkspaceForSchedule`),onOpenChange:s,onSelect:e=>t(e)})]})}function he(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,date:e.date||``,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 ge(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 _e({notify:e,onBack:n,openNotificationSettings:r,requestConfirm:o}){let{t:s,language:l}=i(),u=t(),d=C(`focusSearch`),[f,p]=(0,z.useState)({tasks:[],runs:[],notificationTargets:{browser:{enabled:!1},feishu:{enabled:!1},weixin:{enabled:!1},qq:{enabled:!1},telegram:{enabled:!1}},workflows:[],defaultCwd:``}),[m,g]=(0,z.useState)(``),[_,y]=(0,z.useState)({}),[b,x]=(0,z.useState)(!0),[w,E]=(0,z.useState)(!1),[D,O]=(0,z.useState)(``),[ee,k]=(0,z.useState)(!1),[A,j]=(0,z.useState)(``),[M,F]=(0,z.useState)(!1),[I,L]=(0,z.useState)(``),R=(0,z.useCallback)(async()=>{try{let e=await a(`/api/schedules`);p(e),E(!0),O(``),g(t=>e.tasks.some(e=>e.id===t)?t:``),y(t=>{let n=Object.entries(t).filter(([t])=>e.tasks.some(e=>e.id===t));return n.length===Object.keys(t).length?t:Object.fromEntries(n)})}catch(e){O(e instanceof Error?e.message:String(e))}finally{x(!1)}},[]);(0,z.useEffect)(()=>{R()},[R]),(0,z.useEffect)(()=>{let e=window.setInterval(R,f.tasks.some(e=>e.lastStatus===`running`)?2e3:1e4);return()=>window.clearInterval(e)},[f.tasks,R]);let V=f.tasks.find(e=>e.id===m),H=f.workflows||[],U=V?_[V.id]??he(V):null,W=(0,z.useMemo)(()=>f.runs.filter(e=>e.taskId===m).sort((e,t)=>new Date(t.startedAt).getTime()-new Date(e.startedAt).getTime()).slice(0,20),[f.runs,m]),G=e=>H.find(t=>t.id===e.workflowId)?.name||s(`schedules:schedulesPage.workflowUnavailable`),K=I.trim().toLocaleLowerCase(),q=K?f.tasks.filter(e=>`${e.name} ${e.targetType===`workflow`?G(e):e.targetType===`bot`?e.botMessage||``:e.prompt}`.toLocaleLowerCase().includes(K)):f.tasks,J=f.tasks.filter(e=>e.enabled).length,Y=e=>{if(!V)return;let t=he(V);y(n=>({...n,[t.id]:{...n[t.id]??t,...e}}))},ce=e=>{U&&Y({notifications:U.notifications.includes(e)?U.notifications.filter(t=>t!==e):[...U.notifications,e]})},le=async()=>{if(!(!V||!U)){k(!0),j(``);try{let t=await a(`/api/schedules/${encodeURIComponent(V.id)}`,{method:`PATCH`,body:JSON.stringify(U)});p(t.state),y(e=>Object.fromEntries(Object.entries(e).filter(([e])=>e!==t.task.id))),e(s(`schedules:schedulesPage.scheduledTaskSaved`))}catch(e){j(e instanceof Error?e.message:String(e))}finally{k(!1)}}},ue=async()=>{if(V){k(!0),j(``);try{await a(`/api/schedules/${encodeURIComponent(V.id)}/run`,{method:`POST`,body:`{}`}),await R(),e(s(`schedules:schedulesPage.scheduledTaskStarted`))}catch(e){j(e instanceof Error?e.message:String(e))}finally{k(!1)}}},pe=async()=>{if(V&&await o({title:s(`schedules:schedulesPage.deleteScheduledTask`),message:s(`schedules:schedulesPage.deleteScheduledTaskNameAndItsRunHistory`,{name:V.name}),confirmLabel:s(`schedules:schedulesPage.delete`)}))try{await a(`/api/schedules/${encodeURIComponent(V.id)}`,{method:`DELETE`}),await R(),e(s(`schedules:schedulesPage.scheduledTaskDeleted`))}catch(e){j(e instanceof Error?e.message:String(e))}},X=t=>{p(t.state),g(t.task.id),e(s(`schedules:schedulesPage.scheduledTaskCreated`))},Z=e=>(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-col items-end gap-0.5 max-[650px]:flex-row max-[650px]:items-center max-[650px]:gap-2`,children:[e.lastStatus===`running`?(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-content-secondary`,children:[(0,B.jsx)(T,{status:`run`,className:`size-3.5`}),s(`schedules:schedulesPage.running`)]}):(0,B.jsx)(`span`,{className:`whitespace-nowrap`,children:e.enabled?s(`schedules:schedulesPage.nextRunTime`,{time:ge(e,l)}):e.lastStatus===`missed`?s(`schedules:schedulesPage.missed`):e.frequency===`once`&&e.lastRunAt?s(`schedules:schedulesPage.onceDone`):s(`schedules:schedulesPage.pause`)}),e.lastStatus===`failed`&&(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-content-secondary`,children:[(0,B.jsx)(T,{status:`failed`,className:`size-3.5`}),s(`schedules:schedulesPage.lastRunFailed`)]})]}),Q=s(`navigation:navigation.schedules`);return(0,B.jsxs)(ae,{title:Q,description:s(`schedules:schedulesPage.lede`),back:n&&{label:s(`navigation:sidebar.features`),ariaLabel:s(`navigation:shell.backToFeaturesLabel`),onBack:n},toolbar:(0,B.jsx)(oe,{search:(0,B.jsx)(te,{id:v,value:I,onValueChange:L,placeholder:s(`navigation:pageHeader.searchPage`,{page:Q}),shortcut:d,clearLabel:s(`navigation:more.clearSearch`)}),actions:(0,B.jsxs)(S,{type:`button`,className:`h-9`,disabled:!w,onClick:()=>F(!0),children:[(0,B.jsx)(h,{}),s(`schedules:schedulesPage.newTask`)]})}),children:[b?(0,B.jsx)(N,{kind:`loading`,title:s(`schedules:schedulesPage.loadingScheduledTasks`)}):D&&!w?(0,B.jsx)(N,{kind:`error`,title:s(`schedules:schedulesPage.loadFailed`),description:D,action:(0,B.jsx)(S,{variant:`secondary`,className:`max-[650px]:h-11`,onClick:()=>{x(!0),R()},children:s(`common:pageTemplate.retry`)})}):(0,B.jsxs)(B.Fragment,{children:[(A||D)&&(0,B.jsx)(se,{children:A||D}),(0,B.jsx)(ie,{title:s(`schedules:schedulesPage.tasks`),count:f.tasks.length,meta:f.tasks.length?s(`schedules:schedulesPage.enabledCount`,{count:J}):void 0,children:q.length?(0,B.jsx)(re,{children:q.map(e=>{let t=m===e.id;return(0,B.jsx)(ne,{"data-schedule-task":e.id,className:`schedule-list-item`,icon:(0,B.jsx)(c,{}),name:e.name,description:e.targetType===`workflow`?(0,B.jsx)(`span`,{className:`font-mono`,children:G(e)}):e.targetType===`bot`?s(`schedules:schedulesPage.botTarget`,{message:e.botMessage||``}):e.prompt,meta:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{children:de(e.frequency,s)}),(0,B.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,B.jsx)(`span`,{className:`tabular-nums`,children:e.frequency===`interval`?`${e.intervalValue} ${fe(e.intervalUnit,s)}`:e.frequency===`once`?`${e.date} ${e.time}`:e.time}),(0,B.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,B.jsx)(`span`,{className:`truncate`,children:e.timezone}),e.createdBy?.kind===`agent`&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,B.jsx)(`span`,{"data-schedule-created-by":`agent`,children:s(`schedules:schedulesPage.createdByAgent`)})]})]}),status:Z(e),expanded:t,onExpandedChange:t=>g(t?e.id:``),toggleLabel:s(`schedules:schedulesPage.toggleTaskDetails`,{name:e.name}),detail:t&&e.targetType===`bot`?(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm text-content-secondary`,children:[(0,B.jsx)(`span`,{className:`min-w-0 flex-1`,children:s(`schedules:schedulesPage.botManagedThere`)}),(0,B.jsx)(S,{size:`sm`,variant:`outline`,onClick:()=>u(`/bots/${encodeURIComponent(e.botId||``)}`),children:s(`schedules:schedulesPage.openBot`)})]}):t&&U&&V?(0,B.jsx)(ve,{task:V,draft:U,runs:W,saving:ee,workflows:H,notificationTargets:f.notificationTargets,language:l,onUpdate:Y,onToggleNotification:ce,onRun:ue,onRemove:pe,onSave:le,onEditTemplates:r}):null},e.id)})}):(0,B.jsx)(P,{title:f.tasks.length?s(`schedules:schedulesPage.noMatchingTasks`):s(`schedules:schedulesPage.theTimelineIsStillUnlit`),description:f.tasks.length?void 0:s(`schedules:schedulesPage.createATaskAndLetItSetOutAutomaticallyAtTheAppointedTime`)})})]}),M&&(0,B.jsx)(ye,{notificationTargets:f.notificationTargets,workflows:H,defaultCwd:f.defaultCwd,onClose:()=>F(!1),onCreated:e=>{F(!1),X(e)}})]})}function ve({task:e,draft:t,runs:n,saving:r,workflows:a,notificationTargets:o,language:s,onUpdate:c,onToggleNotification:u,onRun:d,onRemove:f,onSave:p,onEditTemplates:h}){let{t:_}=i(),v=e.lastStatus===`running`;return(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,B.jsxs)(`label`,{className:`mr-auto inline-flex min-h-8 items-center gap-2.5 text-sm text-content max-[650px]:min-h-11`,children:[(0,B.jsx)(R,{value:t.enabled,onChange:e=>c({enabled:e}),ariaLabel:_(`schedules:schedulesPage.enableTaskName`,{name:t.name})}),t.enabled?_(`schedules:schedulesPage.enabled`):_(`schedules:schedulesPage.pause`)]}),(0,B.jsxs)(S,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,disabled:r||v,onClick:d,children:[v?(0,B.jsx)(x,{}):(0,B.jsx)(m,{}),_(v?`schedules:schedulesPage.running`:`schedules:schedulesPage.runNow`)]}),(0,B.jsx)(S,{variant:`ghost`,size:`icon-sm`,className:`hover:bg-danger-soft hover:text-danger max-[650px]:size-11`,title:_(`schedules:schedulesPage.deleteTask`),"aria-label":_(`schedules:schedulesPage.deleteTask`),onClick:f,children:(0,B.jsx)(g,{})})]}),(0,B.jsx)($,{targetType:t.targetType,prompt:t.prompt,workflowId:t.workflowId,workflowInputs:t.workflowInputs,workflows:a,onChange:c}),t.targetType===`prompt`&&(0,B.jsx)(me,{value:t.cwd,onChange:e=>c({cwd:e})}),(0,B.jsx)(`div`,{className:K,children:(0,B.jsxs)(`div`,{className:q,children:[(0,B.jsxs)(F,{variant:`control`,children:[_(`schedules:schedulesPage.frequency`),(0,B.jsx)(I,{value:t.frequency,onChange:e=>c({frequency:e.target.value}),children:Object.keys(H).map(e=>(0,B.jsx)(`option`,{value:e,children:de(e,_)},e))})]}),t.frequency===`interval`?(0,B.jsxs)(F,{variant:`control`,children:[_(`schedules:schedulesPage.runInterval`),(0,B.jsxs)(`span`,{className:J,children:[(0,B.jsx)(A,{type:`number`,min:`1`,value:t.intervalValue,onChange:e=>c({intervalValue:Number(e.target.value)})}),(0,B.jsx)(I,{value:t.intervalUnit,onChange:e=>c({intervalUnit:e.target.value}),children:Object.keys(U).map(e=>(0,B.jsx)(`option`,{value:e,children:fe(e,_)},e))})]})]}):(0,B.jsxs)(B.Fragment,{children:[t.frequency===`once`&&(0,B.jsxs)(F,{variant:`control`,children:[_(`schedules:schedulesPage.date`),(0,B.jsx)(A,{type:`date`,className:`tabular-nums`,value:t.date,onChange:e=>c({date:e.target.value})})]}),(0,B.jsxs)(F,{variant:`control`,children:[_(`schedules:schedulesPage.time`),(0,B.jsx)(A,{type:`time`,className:`tabular-nums`,value:t.time,onChange:e=>c({time:e.target.value})})]})]}),(0,B.jsxs)(F,{variant:`control`,children:[_(`schedules:schedulesPage.timeZone`),(0,B.jsx)(I,{value:t.timezone,onChange:e=>c({timezone:e.target.value}),children:W.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))})]}),t.targetType===`prompt`&&(0,B.jsx)(X,{value:t.executionMode,onChange:e=>c({executionMode:e})})]})}),(0,B.jsxs)(`div`,{className:b(`schedule-notification-section pt-3`,K),children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,B.jsx)(`strong`,{className:`text-sm font-medium`,children:_(`schedules:schedulesPage.notificationChannels`)}),(0,B.jsx)(`button`,{type:`button`,className:`text-button text-xs font-medium text-content-secondary underline underline-offset-2 hover:text-content max-[650px]:min-h-11`,onClick:h,children:_(`schedules:schedulesPage.editTemplates`)})]}),(0,B.jsx)(`p`,{className:`mt-0.5 text-xs text-content-muted`,children:_(`schedules:schedulesPage.notificationChannelsHelp`)}),(0,B.jsx)(`div`,{className:`schedule-notification-targets mt-2.5 grid grid-cols-[repeat(auto-fill,minmax(132px,1fr))] gap-2`,children:Object.entries(V).map(([e,n])=>{let r=n.Icon,i=t.notifications.includes(e);return(0,B.jsxs)(`button`,{type:`button`,"aria-pressed":i,className:b(`grid min-h-[52px] grid-cols-[16px_minmax(0,1fr)_16px] items-center gap-2 rounded-md border px-2.5 py-2 text-left transition-colors duration-(--d-fast)`,i?`selected border-star-border bg-star-soft text-star-strong`:`border-stroke bg-panel text-content hover:bg-surface-subtle`),onClick:()=>u(e),children:[(0,B.jsx)(r,{className:`size-4`}),(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,B.jsx)(`strong`,{className:`truncate text-sm font-medium`,children:pe(e,_)}),(0,B.jsx)(`small`,{className:`truncate text-xs text-content-muted`,children:o[e].enabled?_(`schedules:schedulesPage.configured`):_(`schedules:schedulesPage.notConfigured`)})]}),(0,B.jsx)(l,{className:b(`size-4`,i?`text-star-strong`:`text-content-faint`)})]},e)})}),(0,B.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-3 gap-y-1.5`,children:[(0,B.jsx)(`span`,{id:`schedule-notify-on-${e.id}`,className:`text-xs text-content-muted`,children:_(`schedules:schedulesPage.notifyWhen`)}),(0,B.jsx)(`div`,{role:`group`,"aria-labelledby":`schedule-notify-on-${e.id}`,className:b(`schedule-notification-chip`,Y),children:[`always`,`failure`].map(e=>(0,B.jsx)(`button`,{type:`button`,"aria-pressed":t.notifyOn===e,className:ce,onClick:()=>c({notifyOn:e}),children:_(e===`failure`?`schedules:schedulesPage.failuresOnly`:`schedules:schedulesPage.completionAndFailure`)},e))})]})]}),(0,B.jsxs)(`div`,{className:`form-footer mt-4 flex items-center justify-between gap-2.5 border-t border-stroke-soft pt-3 max-[650px]:flex-wrap`,children:[(0,B.jsx)(`span`,{className:`text-xs text-content-muted tabular-nums`,children:e.lastRunAt?_(`schedules:schedulesPage.lastRunTime`,{time:w(e.lastRunAt,s)}):_(`schedules:schedulesPage.nextRunTime`,{time:ge(e,s)})}),(0,B.jsxs)(S,{className:`max-[650px]:h-11 max-[650px]:w-full`,disabled:r||!Q(t.targetType,t.prompt,t.workflowId,t.workflowInputs,a),onClick:p,children:[r?(0,B.jsx)(x,{className:`text-current`}):null,_(r?`schedules:schedulesPage.saving`:`schedules:schedulesPage.saveTask`)]})]})]}),(0,B.jsxs)(`section`,{"aria-labelledby":`schedule-runs-${e.id}`,className:`min-w-0`,children:[(0,B.jsxs)(`h3`,{id:`schedule-runs-${e.id}`,className:`mb-1.5 text-[13px] font-medium text-content-muted tabular-nums`,children:[_(`schedules:schedulesPage.recentRuns`),` · `,n.length]}),n.length?(0,B.jsx)(`ul`,{className:`divide-y divide-stroke-soft overflow-hidden rounded-[var(--r-md)] border border-stroke`,children:n.map(e=>(0,B.jsxs)(`li`,{className:`schedule-run-row grid min-h-11 grid-cols-[18px_minmax(0,1fr)_auto] items-start gap-2.5 px-3 py-2.5 ${e.status}`,children:[(0,B.jsx)(le,{status:e.status}),(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,B.jsx)(`strong`,{className:`line-clamp-2 text-sm leading-5 font-medium text-content`,children:e.status===`running`?_(`schedules:schedulesPage.running2`):e.status===`completed`?e.summary||_(`schedules:schedulesPage.taskCompleted`):e.status===`interrupted`?_(`schedules:schedulesPage.taskInterrupted`):e.error||_(`schedules:schedulesPage.taskFailed`)}),(0,B.jsxs)(`small`,{className:`text-xs text-content-muted tabular-nums`,children:[w(e.startedAt,s),` ·`,` `,e.trigger===`manual`?_(`schedules:schedulesPage.manualRun`):_(`schedules:schedulesPage.scheduledTrigger`),e.durationMs?` · ${_(`schedules:schedulesPage.countSec`,{count:Math.round(e.durationMs/1e3)})}`:``]})]}),(0,B.jsx)(`em`,{className:`font-mono text-xs leading-5 text-content-secondary not-italic tabular-nums`,children:new Intl.DateTimeFormat(s,{hour:`2-digit`,minute:`2-digit`}).format(new Date(e.startedAt))})]},e.id))}):(0,B.jsx)(P,{compact:!0,title:_(`schedules:schedulesPage.noRunHistory`)})]})]})}function ye({notificationTargets:e,workflows:t,defaultCwd:n,onClose:r,onCreated:o}){let{t:s}=i(),[c,l]=(0,z.useState)(``),[u,d]=(0,z.useState)(`prompt`),[f,p]=(0,z.useState)(``),[m,g]=(0,z.useState)(``),[v,y]=(0,z.useState)({}),[b,C]=(0,z.useState)(n||``),[w,T]=(0,z.useState)(`full-access`),[j,M]=(0,z.useState)(!1),[N,P]=(0,z.useState)(``);return(0,B.jsx)(k,{open:!0,onOpenChange:e=>!e&&r(),children:(0,B.jsx)(D,{size:`compact`,children:(0,B.jsxs)(`form`,{className:`grid min-w-0`,onSubmit:async t=>{t.preventDefault(),M(!0),P(``);try{let t=Object.entries(e).filter(([,e])=>e.enabled).map(([e])=>e);o(await a(`/api/schedules`,{method:`POST`,body:JSON.stringify({name:c,targetType:u,prompt:f,workflowId:m,workflowInputs:v,cwd:b,enabled:!0,frequency:`daily`,time:`09:00`,timezone:`Asia/Hong_Kong`,executionMode:w,notifications:t,notifyOn:`always`})}))}catch(e){P(e instanceof Error?e.message:String(e))}finally{M(!1)}},children:[(0,B.jsxs)(ee,{children:[(0,B.jsx)(O,{children:s(`schedules:schedulesPage.newScheduledTask`)}),(0,B.jsx)(E,{children:s(`schedules:schedulesPage.youCanContinueSettingTheRunTimeAndNotificationChannelsAfterCreation`)})]}),(0,B.jsxs)(F,{variant:`control`,children:[s(`schedules:schedulesPage.taskName`),(0,B.jsx)(A,{value:c,onChange:e=>l(e.target.value),placeholder:s(`schedules:schedulesPage.forExampleDailyCodeReview`)})]}),(0,B.jsx)($,{targetType:u,prompt:f,workflowId:m,workflowInputs:v,workflows:t,onChange:e=>{e.targetType&&d(e.targetType),e.prompt!==void 0&&p(e.prompt),e.workflowId!==void 0&&g(e.workflowId),e.workflowInputs!==void 0&&y(e.workflowInputs)}}),u===`prompt`&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(me,{value:b,onChange:C}),(0,B.jsx)(X,{value:w,onChange:T})]}),N&&(0,B.jsxs)(L,{children:[(0,B.jsx)(_,{size:13}),N]}),(0,B.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2 max-[650px]:[&>button]:h-11 max-[650px]:[&>button]:flex-1`,children:[(0,B.jsx)(S,{type:`button`,variant:`secondary`,onClick:r,children:s(`schedules:schedulesPage.cancel`)}),(0,B.jsxs)(S,{type:`submit`,disabled:j||!c.trim()||!Q(u,f,m,v,t),children:[j?(0,B.jsx)(x,{className:`text-current`}):(0,B.jsx)(h,{}),s(j?`schedules:schedulesPage.creating`:`schedules:schedulesPage.createTask`)]})]})]})})})}export{_e as SchedulesPage};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/GitDiffViewer-XzdYQWbX.js","assets/rolldown-runtime-B0Z9INg1.js","assets/vendor-react-DwNgTV1j.js","assets/use-i18n-Cyg5th6Z.js","assets/i18n-Du-JO3Qx.js","assets/vendor-router-CSN_DGvx.js","assets/index-DmohsuQg.js","assets/index-BY7X-ZtU.css","assets/storage-8QW6lXuT.js","assets/vendor-state-GkUciC5H.js","assets/createLucideIcon-Cd-3GVxJ.js","assets/x-07u4-129.js","assets/utils-C8uzG5AZ.js","assets/vendor-ui-DvrYggeS.js","assets/button-CCcCN8tE.js","assets/dist-41X0pdUs.js","assets/events-B0F69Vd3.js","assets/esm-DCV8yILT.js","assets/TaskTerminalView-BMjmp-4_.js","assets/square-terminal-BVG6cUT1.js","assets/square-bHHVTT3G.js","assets/PageState-Cz6vFMXv.js","assets/AppSelect-BD6RAaJ5.js","assets/use-mobile-C2tPBAza.js","assets/select-DD_WO-gs.js","assets/check-2vYc6QaP.js","assets/chevron-down-CxtxIjiP.js","assets/chevron-up-D_ZcXjqr.js","assets/dist-V8chnW6-.js","assets/dist-BsRXXcSL.js","assets/dist-BiRPwy4W.js","assets/dist-DzGQ7sLi.js","assets/es2015-DTZdOI9P.js","assets/dist-BRjj4UeB.js","assets/dist-OB2r6Xsr.js","assets/terminal-context-aIsIJPn8.js","assets/TaskTerminalView-BrP-ENHg.css","assets/TaskProcessesPane-B43p2Dvr.js","assets/chevron-right-C3t2Rckj.js","assets/checkbox-BrEHgFV0.js","assets/FileAttachmentPreview-fSmyWf24.js","assets/api-m-Yq8n0q.js","assets/abort-signal-f4JsiYKX.js","assets/download-BCfIiuaL.js","assets/file-Bllajneu.js","assets/refresh-cw-TbWxTY4K.js","assets/tabs-DsgBuvJv.js","assets/dist-BaBySQmo.js","assets/format-DMJQzoZ7.js","assets/dialog-5MLAAE-f.js","assets/dist-BHkR6BLP.js","assets/MarkdownMessage-B-IixrQ3.js","assets/vendor-markdown-plugins-CT5L3KA9.js","assets/vendor-shiki-runtime-DM7fm4Bl.js","assets/vendor-markdown-plugins-DEcVZfaU.css","assets/vendor-markdown-CT6Z4fh8.js","assets/copy-DHmIFc52.js","assets/route-context-DvWDul4T.js"])))=>i.map(i=>d[i]);
2
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{h as t}from"./vendor-router-CSN_DGvx.js";import{i as n,r}from"./vendor-react-DwNgTV1j.js";import{t as i}from"./use-i18n-Cyg5th6Z.js";import{t as a}from"./useQuery-DdcpUQhO.js";import{t as o}from"./createLucideIcon-Cd-3GVxJ.js";import{t as s}from"./arrow-up-DST6-qVQ.js";import{t as c}from"./check-2vYc6QaP.js";import{t as l}from"./chevron-down-CxtxIjiP.js";import{t as u}from"./chevron-right-C3t2Rckj.js";import{t as d}from"./earth-Ddy13fHh.js";import{t as f}from"./external-link-CEQqPcqc.js";import{i as p}from"./GitDiffViewer-XzdYQWbX.js";import{t as m}from"./file-Bllajneu.js";import{F as h,_ as g,a as _,f as v,g as y,i as b,o as x,r as S}from"./side-chat-context-Cm84nqzk.js";import{t as C}from"./git-branch-N7LGjtzt.js";import{t as w}from"./image-BY_c3FYU.js";import{t as T}from"./link-2-mgasYn21.js";import{t as E}from"./message-square-SKjZyY3v.js";import{t as D}from"./refresh-cw-TbWxTY4K.js";import{t as O}from"./square-bHHVTT3G.js";import"./tooltip-D4MFbqcG.js";import{t as k}from"./utils-C8uzG5AZ.js";import{n as A,t as j}from"./button-CCcCN8tE.js";import{c as M,r as ee}from"./shortcuts-Cgx6V2jI.js";import{t as N}from"./chat-api-DgJdhfOP.js";import{t as P}from"./input-CPw-zkYh.js";import{n as F}from"./session-change-summary-api-CbVgbX2o.js";import{n as I,t as L}from"./PageState-Cz6vFMXv.js";import{t as R}from"./AppSelect-BD6RAaJ5.js";import{t as z}from"./web-preview-Bo8YMR-t.js";import"./collapsible-Dcoy-qnz.js";import{o as B}from"./session-tree-summary-BfRtAGwx.js";var V=o(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),H=o(`list-checks`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]),U=o(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),W=e(n(),1),G=r(),K={completed:`completed`,in_progress:`running`,blocked:`blocked`,pending:`pending`};function q(e){let t=new Map(e.map(e=>[String(e.id||``),e])),n=e=>e?.status===`completed`;return e.map(e=>{let r=String(e.id||``),i=(Array.isArray(e.dependsOn)?e.dependsOn:[]).map(e=>t.get(String(e))).filter(e=>!!e&&!n(e)),a=e.status!==`completed`&&(e.status===`blocked`||i.length>0);return{...e,id:r,blocked:a,blockedBy:i}})}function J({status:e,t}){let n=t(e===`completed`?`chat:planBoard.completed`:e===`in_progress`?`chat:planBoard.inProgress`:e===`blocked`?`chat:planBoard.blocked`:`chat:planBoard.pending`);return(0,G.jsxs)(`span`,{className:`plan-board-status grid size-[18px] flex-none place-items-center rounded-xs text-content-muted [&.completed]:bg-success-soft [&.completed]:text-success [&.running]:text-accent-fg [&.blocked]:bg-danger-soft [&.blocked]:text-danger ${K[String(e)]||`pending`}`,title:n,children:[e===`completed`?(0,G.jsx)(c,{size:12,strokeWidth:2.25}):e===`in_progress`?(0,G.jsx)(A,{className:`size-3.5`}):e===`blocked`?(0,G.jsx)(U,{size:11,strokeWidth:2}):(0,G.jsx)(V,{size:11,strokeWidth:2}),(0,G.jsx)(`span`,{className:`sr-only`,children:n})]})}function Y({item:e,current:t,t:n}){return(0,G.jsxs)(`li`,{className:`plan-board-row flex min-w-0 flex-col gap-[2px] rounded-sm px-[6px] py-[6px] aria-[current=step]:bg-surface-subtle ${e.blocked?`blocked`:``}`,"aria-current":t?`step`:void 0,"data-pisper-plan-current":t?`true`:void 0,"data-pisper-plan-id":e.id,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-[10px]`,children:[(0,G.jsx)(J,{status:e.blocked?`blocked`:e.status,t:n}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] ${e.status===`completed`?`text-content-muted`:`text-foreground`}`,title:e.title,children:e.title}),e.assignee?(0,G.jsxs)(`span`,{className:`inline-flex max-w-[40%] flex-none items-center gap-[4px] truncate rounded-xs border border-stroke px-[6px] font-mono text-[12px] leading-[18px] text-content-secondary`,title:n(`chat:planBoard.assignedTo`,{name:e.assignee}),children:[(0,G.jsx)(h,{size:11,className:`flex-none`}),e.assignee]}):e.status!==`completed`&&(0,G.jsx)(`span`,{className:`flex-none text-[12px] text-content-muted`,children:n(`chat:planBoard.unassigned`)})]}),e.blockedBy.length>0&&(0,G.jsxs)(`div`,{className:`inline-flex min-w-0 items-center gap-[5px] pl-[28px] text-[12px] text-content-muted`,children:[(0,G.jsx)(U,{size:11,className:`flex-none`}),(0,G.jsx)(`span`,{className:`truncate`,children:n(`chat:planBoard.waitingFor`,{tasks:e.blockedBy.map(e=>e.title||e.id).join(` · `)})})]})]})}function X({plan:e,header:t,collapsible:n=!1}){let{t:r}=i(),a=(0,W.useRef)(null),[o,s]=(0,W.useState)(!0),c=e?.items||[],u=q(c),d=u.filter(e=>e.status===`completed`).length,f=u.filter(e=>e.status===`in_progress`&&!e.blocked).length,p=u.filter(e=>e.blocked).length,m=u.find(e=>e.status===`in_progress`&&!e.blocked)?.id??u.find(e=>e.blocked)?.id??u.find(e=>e.status===`pending`)?.id??u.at(-1)?.id;if((0,W.useLayoutEffect)(()=>{if(n&&!o)return;let e=a.current,t=e?.querySelector(`[data-pisper-plan-current="true"]`);if(!e||!t)return;let r=e.getBoundingClientRect(),i=t.getBoundingClientRect();i.top<r.top?e.scrollTop-=r.top-i.top:i.bottom>r.bottom&&(e.scrollTop+=i.bottom-r.bottom)},[n,m,o,u.length]),!c.length)return null;let h=u.find(e=>e.id===m),g=(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(H,{className:`flex-none text-content-muted`,size:15}),(0,G.jsx)(`strong`,{className:`tabular-nums`,children:r(`chat:planBoard.progress`,{completed:d,total:c.length})}),h?(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-content-secondary`,title:h.title,children:h.title}):null,(0,G.jsxs)(`span`,{className:`plan-board-counts inline-flex flex-none items-center gap-[8px] text-content-muted tabular-nums @max-[470px]:hidden`,children:[f>0&&(0,G.jsx)(`span`,{children:r(`chat:planBoard.countInProgress`,{count:f})}),p>0&&(0,G.jsx)(`span`,{className:`blocked text-danger`,children:r(`chat:planBoard.countBlocked`,{count:p})})]}),t,n?(0,G.jsx)(l,{className:`plan-board-chevron flex-none text-content-muted transition-transform duration-(--d-fast) ease-precise [.plan-board-collapsible[open]_&]:rotate-180`,size:15}):null]}),_=(0,G.jsx)(`ul`,{ref:a,className:`plan-board-list [.plan-board-collapsible_>_&]:border-t [.plan-board-collapsible_>_&]:border-stroke-soft [.plan-board-collapsible_>_&]:p-[6px_8px_8px] m-0 flex list-none flex-col gap-[1px] pt-[6px]${u.length>4?` is-scrollable [.session-plan-popover_.plan-board-list&]:[block-size:min(250px,38dvh)] [.plan-board-list&]:[block-size:min(220px,34dvh)] [.plan-board-list&]:overflow-y-auto [.plan-board-list&]:[overscroll-behavior:contain] [.plan-board-list&]:pr-[4px] [.plan-board-list&]:[scrollbar-gutter:stable] [.plan-board-list&:focus-visible]:outline-2 [.plan-board-list&:focus-visible]:outline-focus [.plan-board-list&:focus-visible]:outline-offset-2`:``}`,tabIndex:u.length>4?0:void 0,children:u.map(e=>(0,G.jsx)(Y,{item:e,current:e.id===m,t:r},e.id))});return n?(0,G.jsxs)(`details`,{className:`plan-board plan-board-collapsible m-[0_auto] flex w-[min(900px,100%)] flex-col overflow-hidden rounded-md border border-stroke bg-panel !p-0 [.session-plan-popover_&]:w-full [.session-plan-popover_&]:border-0 [.session-plan-popover_&]:bg-transparent`,open:o,onToggle:e=>s(e.currentTarget.open),children:[(0,G.jsx)(`summary`,{className:`plan-board-summary flex min-w-0 items-center gap-[8px] border-b border-stroke-soft pb-[8px] text-[13px] text-content-secondary [&_strong]:flex-none [&_strong]:font-medium [&_strong]:text-foreground [.plan-board-collapsible_>_&]:min-h-[34px] [.plan-board-collapsible_>_&]:cursor-pointer [.plan-board-collapsible_>_&]:list-none [.plan-board-collapsible_>_&]:border-0 [.plan-board-collapsible_>_&]:p-[6px_12px] max-[650px]:[.plan-board-collapsible_>_&]:min-h-11 [.plan-board-collapsible_>_&::-webkit-details-marker]:hidden [.plan-board-collapsible_>_&:hover]:bg-surface-subtle [.plan-board-collapsible_>_&:focus-visible]:outline-2 [.plan-board-collapsible_>_&:focus-visible]:-outline-offset-2 [.plan-board-collapsible_>_&:focus-visible]:outline-focus`,"aria-label":r(`chat:planBoard.toggleAriaLabel`),children:g}),_]}):(0,G.jsxs)(`section`,{className:`plan-board m-[0_auto] flex w-[min(900px,100%)] flex-col rounded-md border border-stroke bg-panel p-[10px_12px] [.session-plan-popover_&]:w-full [.session-plan-popover_&]:border-0 [.session-plan-popover_&]:bg-transparent [.session-plan-popover_&]:p-0`,"aria-label":r(`chat:planBoard.ariaLabel`),children:[(0,G.jsx)(`div`,{className:`plan-board-summary flex min-w-0 items-center gap-[8px] border-b border-stroke-soft pb-[8px] text-[13px] text-content-secondary [&_strong]:flex-none [&_strong]:font-medium [&_strong]:text-foreground [.plan-board-collapsible_>_&]:min-h-[34px] [.plan-board-collapsible_>_&]:cursor-pointer [.plan-board-collapsible_>_&]:list-none [.plan-board-collapsible_>_&]:border-0 [.plan-board-collapsible_>_&]:p-[6px_12px] max-[650px]:[.plan-board-collapsible_>_&]:min-h-11 [.plan-board-collapsible_>_&::-webkit-details-marker]:hidden [.plan-board-collapsible_>_&:hover]:bg-surface-subtle [.plan-board-collapsible_>_&:focus-visible]:outline-2 [.plan-board-collapsible_>_&:focus-visible]:-outline-offset-2 [.plan-board-collapsible_>_&:focus-visible]:outline-focus`,children:g}),_]})}var te=(0,W.memo)(X),ne=(0,W.lazy)(()=>t(()=>import(`./GitDiffViewer-XzdYQWbX.js`).then(e=>e.n).then(e=>({default:e.InlineGitDiff})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17])));function Z({sessionId:e,path:t,scope:n,revision:r=0,position:o,onReading:s,mode:c,fill:l=!1}){let{t:u}=i(),d=a({queryKey:[`task-file-diff`,e,n,t,r],queryFn:({signal:r})=>n===`project`?N.getFileDiff(e,t,{signal:r}):N.getSessionFileChangeDiff(e,t,{signal:r})});return d.isPending?(0,G.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 px-3 py-2.5 text-xs text-content-muted`,children:[(0,G.jsx)(A,{className:`size-3.5`}),u(`chat:focusSession.gitLoading`)]}):d.isError?(0,G.jsxs)(`div`,{className:`px-3 py-2.5`,children:[(0,G.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:d.error.message}),(0,G.jsx)(j,{variant:`ghost`,size:`sm`,onClick:()=>void d.refetch(),children:u(`chat:chatMessage.filePreviewRetry`)})]}):(0,G.jsx)(W.Suspense,{fallback:null,children:(0,G.jsx)(ne,{position:o,onReading:s,diff:d.data.diff,truncated:d.data.diffTruncated,mode:c,fill:l})})}function re({sessionId:e,cwd:t,streaming:n,view:r,onViewChange:o}){let{t:s}=i(),c=a({queryKey:[`task-project-changes`,e,t,n],queryFn:({signal:t})=>N.getVcsChanges(e,{signal:t})}),l=p(r.reading?.list,e=>o({reading:{...r.reading,list:e}})),d=(0,W.useMemo)(()=>y(c.data?.diff||``,c.data?.files.map(e=>e.path)||[],c.data?.diffTruncated),[c.data]),f=r.expandedFiles.filter(e=>c.data&&!c.data.files.some(t=>t.path===e)),m=c.error?.message||c.data?.error,h=c.data?.files||[];return(0,G.jsxs)(`section`,{"aria-label":s(`chat:workbench.projectChanges`),className:`flex min-h-0 flex-1 flex-col`,children:[(0,G.jsxs)(`header`,{className:`flex min-h-10 min-w-0 shrink-0 items-center gap-2 border-b border-stroke-soft pr-1.5 pl-3`,children:[(0,G.jsx)(`h2`,{className:`min-w-0 flex-1 truncate text-xs font-medium tracking-[.02em] text-content-muted`,children:s(`chat:workbench.projectChanges`)}),c.data?.isRepo&&!m&&(0,G.jsxs)(`span`,{className:`shrink-0 font-mono text-xs tabular-nums`,children:[(0,G.jsxs)(`span`,{className:`text-success`,children:[`+`,d.added]}),` `,(0,G.jsxs)(`span`,{className:`text-danger`,children:[`−`,d.removed]})]}),(0,G.jsx)(j,{variant:`ghost`,size:`icon`,className:`max-[650px]:size-11`,"aria-label":s(`chat:focusSession.gitRefresh`),disabled:c.isFetching,onClick:()=>void c.refetch(),children:(0,G.jsx)(D,{size:15,className:c.isFetching?`animate-spin`:void 0})})]}),(0,G.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2 border-b border-stroke-soft px-3 py-2.5`,children:[(0,G.jsx)(`p`,{className:`text-xs leading-relaxed text-content-muted`,children:s(`chat:workbench.projectScope`)}),(0,G.jsxs)(`p`,{className:`flex min-w-0 items-center gap-1.5 text-xs`,title:t,children:[c.data?.branch&&(0,G.jsxs)(`span`,{className:`inline-flex h-5.5 max-w-[45%] shrink-0 items-center gap-1 rounded-xs border border-stroke px-1.5 font-mono text-content-secondary`,children:[(0,G.jsx)(C,{size:12,className:`shrink-0`,"aria-hidden":`true`}),(0,G.jsx)(`span`,{className:`truncate`,children:c.data.branch})]}),(0,G.jsx)(`span`,{className:`min-w-0 truncate font-mono text-content-muted`,children:t})]}),(0,G.jsxs)(`div`,{className:`flex gap-1`,children:[(0,G.jsx)(j,{variant:`ghost`,size:`sm`,disabled:!h.length||!!m,onClick:()=>o({expandedFiles:h.map(e=>e.path)}),children:s(`chat:workbench.expandAll`)}),(0,G.jsx)(j,{variant:`ghost`,size:`sm`,onClick:()=>o({expandedFiles:[]}),children:s(`chat:workbench.collapseAll`)})]})]}),!c.isFetching&&!m&&f.map(e=>(0,G.jsx)(`p`,{role:`status`,className:`break-all px-3 pt-2 text-xs text-content-muted`,children:s(`chat:workbench.fileNoLongerChanged`,{path:e})},e)),c.isPending?(0,G.jsx)(I,{kind:`loading`,title:s(`chat:focusSession.gitLoading`)}):m?(0,G.jsx)(`p`,{role:`alert`,className:`p-3 text-sm text-danger`,children:m}):c.data?.isRepo?h.length?(0,G.jsx)(`div`,{ref:l.ref,className:`min-h-0 flex-1 overflow-y-auto`,children:h.map(t=>{let n=r.expandedFiles.includes(t.path);return(0,G.jsxs)(`article`,{className:`border-b border-stroke-soft`,children:[(0,G.jsxs)(`button`,{"aria-expanded":n,title:t.path,className:`flex min-h-9 w-full min-w-0 items-center gap-2 pr-3 pl-2 text-left text-sm hover:bg-surface-subtle focus-visible:-outline-offset-2 max-[650px]:min-h-11 pointer-coarse:min-h-11 ${n?`bg-surface-subtle`:``}`,onClick:()=>o({expandedFiles:n?r.expandedFiles.filter(e=>e!==t.path):[...r.expandedFiles,t.path]}),children:[(0,G.jsx)(u,{size:14,className:`shrink-0 text-content-muted transition-transform duration-(--d-fast) ${n?`rotate-90`:``}`}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs`,children:t.path}),(0,G.jsx)(`span`,{className:`min-w-4 shrink-0 text-center font-mono text-xs font-medium text-content-secondary`,children:t.status}),Object.hasOwn(d.files,t.path)&&(0,G.jsxs)(`span`,{className:`shrink-0 font-mono text-xs tabular-nums`,children:[(0,G.jsxs)(`span`,{className:`text-success`,children:[`+`,d.files[t.path].added]}),` `,(0,G.jsxs)(`span`,{className:`text-danger`,children:[`−`,d.files[t.path].removed]})]})]}),n&&(0,G.jsx)(`p`,{className:`break-all px-3 py-1.5 font-mono text-xs text-content-muted`,children:t.path}),n&&(0,G.jsx)(Z,{sessionId:e,path:t.path,scope:`project`,position:r.reading?.[t.path],onReading:e=>o({reading:{...r.reading,[t.path]:e}}),revision:c.dataUpdatedAt})]},t.path)})}):(0,G.jsx)(L,{compact:!0,title:s(`chat:focusSession.fileChangesEmpty`)}):(0,G.jsx)(L,{compact:!0,title:s(`chat:workbench.notRepository`)})]})}function Q(e){return e instanceof Error?e.message:String(e)}function ie({sessionId:e,streaming:t,requestConfirm:n}){let{t:r}=i(),[a,o]=(0,W.useState)(0),[s,c]=(0,W.useState)(0),[l,u]=(0,W.useState)(null),[d,f]=(0,W.useState)(!0),[p,m]=(0,W.useState)(``),[h,g]=(0,W.useState)(``),[_,v]=(0,W.useState)(``),[y,b]=(0,W.useState)(null),[x,S]=(0,W.useState)(null),[C,w]=(0,W.useState)(null),T=(0,W.useRef)(!1),E=(0,W.useRef)(0),D=(0,W.useRef)(0),O=(0,W.useRef)(!0),k=(0,W.useRef)(!1),A=(0,W.useRef)(t);return(0,W.useLayoutEffect)(()=>{A.current=t},[t]),(0,W.useLayoutEffect)(()=>(T.current=!0,()=>{T.current=!1,E.current+=1,D.current+=1}),[]),(0,W.useEffect)(()=>{let t=++E.current;return D.current+=1,S(null),w(null),O.current=!0,f(!0),m(``),N.getSessionFileChanges(e).then(e=>{T.current&&t===E.current&&(u(e),c(e=>e+1))},e=>{T.current&&t===E.current&&m(Q(e))}).finally(()=>{T.current&&t===E.current&&(O.current=!1,f(!1))}),()=>{E.current+=1}},[a,e,t]),{changes:l,loading:d,error:p,actionError:h,notice:_,running:y,diff:x,setDiff:S,diffLoading:C,snapshotRevision:s,writesDisabled:d||t||!!y||!!p||!l,pendingCount:l?.summary.pending||0,reversibleCount:l?.files.filter(e=>e.canRevert&&!e.reverted).length||0,displayedError:h||p,viewDiff:async t=>{if(k.current||O.current)return;let n=++D.current;w(t),g(``);try{let i=await N.getSessionFileChangeDiff(e,t);if(!T.current||n!==D.current)return;if(!i.diff?.trim()){g(r(`chat:focusSession.fileChangesNoSnapshot`));return}S({diff:i.diff,truncated:!!i.diffTruncated})}catch(e){T.current&&n===D.current&&g(Q(e))}finally{T.current&&n===D.current&&w(null)}},runAction:async t=>{if(!T.current||k.current||O.current||A.current||!l||p||!l.files.filter(e=>t.kind===`approve`?e.pending&&!e.approved&&!e.reverted:e.canRevert&&!e.reverted).some(e=>t.path===void 0||e.path===t.path))return;k.current=!0,b(t),g(``),v(``);let i=++E.current;D.current+=1,S(null),w(null);let a=!1;try{if(t.kind===`revert`&&!await n({title:t.path?r(`chat:focusSession.fileChangesRevertFile`):r(`chat:focusSession.fileChangesRevertAll`),message:t.path?r(`chat:focusSession.fileChangesRevertFileDescription`,{path:t.path}):r(`chat:focusSession.fileChangesRevertAllDescription`),confirmLabel:r(`chat:focusSession.fileChangesConfirmRevert`),tone:`danger`})||!T.current||A.current||O.current||i!==E.current)return;a=!0;let o=t.kind===`approve`?await N.approveSessionFileChanges(e,t.path):await N.revertSessionFileChanges(e,t.path);if(F(e),!T.current||i!==E.current)return;u(o),t.kind===`approve`?v(t.path?r(`chat:focusSession.fileChangesApproved`):r(`chat:focusSession.fileChangesApproveDone`)):o.reverted?t.path===void 0&&o.files.some(e=>e.pending)?v(r(`chat:focusSession.fileChangesRevertPartial`,{count:o.reverted})):v(r(`chat:focusSession.fileChangesRevertDone`)):v(r(`chat:focusSession.fileChangesRevertUnavailable`))}catch(e){T.current&&i===E.current&&g(Q(e))}finally{k.current=!1,T.current&&(b(null),a&&(O.current=!0,f(!0),o(e=>e+1)))}},refresh:()=>{O.current=!0,f(!0),g(``),o(e=>e+1)}}}var ae=(0,W.lazy)(()=>t(()=>import(`./TaskTerminalView-BMjmp-4_.js`).then(e=>({default:e.TaskTerminalView})),__vite__mapDeps([18,1,2,3,4,5,6,7,8,9,19,10,20,14,13,15,12,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36]))),oe=(0,W.lazy)(()=>t(()=>import(`./TaskProcessesPane-B43p2Dvr.js`).then(e=>({default:e.TaskProcessesPane})),__vite__mapDeps([37,1,2,3,4,5,6,7,8,9,38,10,19,20,39,25,15,29,34,12,13,14,21,22,23,24,26,27,28,30,31,32,33,35]))),se=(0,W.lazy)(()=>t(()=>import(`./FileAttachmentPreview-fSmyWf24.js`).then(e=>e.n).then(e=>({default:e.FileAttachmentPreview})),__vite__mapDeps([40,1,2,3,4,5,6,7,8,9,41,42,43,10,44,45,11,46,13,29,15,31,47,12,14,48,49,50,32,51,52,53,54,55,25,56,57])));function ce({sources:e,view:t,onViewChange:n}){let{t:r}=i(),a=p(t.reading?.list,e=>n({reading:{...t.reading,list:e}})),o=(0,W.useContext)(g),[s,c]=(0,W.useState)(``),l=(0,W.useRef)(null),d=e.find(e=>e.id===s),f=e.filter(e=>(!t.filter||e.kind===t.filter)&&e.name.toLocaleLowerCase().includes(t.query.toLocaleLowerCase()));return(0,G.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,"aria-label":r(`chat:workbench.sources`),children:[(0,G.jsxs)(`header`,{className:`flex min-h-10 min-w-0 shrink-0 items-center gap-2 border-b border-stroke-soft pr-1.5 pl-3`,children:[(0,G.jsxs)(`h2`,{className:`min-w-0 flex-1 truncate text-xs font-medium tracking-[.02em] text-content-muted`,children:[r(`chat:workbench.sources`),(0,G.jsx)(`span`,{className:`ml-1.5 tabular-nums`,children:e.length})]}),(0,G.jsx)(`span`,{className:`shrink-0 text-xs text-content-muted`,children:r(`chat:workbench.addSource`)}),(0,G.jsx)(`div`,{ref:o?.setSourceActionHost,className:`grid min-h-7 min-w-7 place-items-center`})]}),(0,G.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2 border-b border-stroke-soft px-3 py-2.5`,children:[(0,G.jsx)(`p`,{className:`text-xs leading-relaxed text-content-muted`,children:r(`chat:workbench.sourcesScope`)}),(0,G.jsxs)(`div`,{className:`flex min-w-0 gap-2`,children:[(0,G.jsx)(P,{className:`min-w-0 flex-1`,"aria-label":r(`chat:workbench.searchSources`),placeholder:r(`chat:workbench.searchSources`),value:t.query,onChange:e=>n({query:e.target.value})}),(0,G.jsxs)(R,{"aria-label":r(`chat:workbench.sourceType`),className:`w-auto max-w-[45%] shrink-0`,value:t.filter,onChange:e=>n({filter:e.target.value}),children:[(0,G.jsx)(`option`,{value:``,children:r(`chat:workbench.allTypes`)}),(0,G.jsx)(`option`,{value:`image`,children:r(`chat:workbench.images`)}),(0,G.jsx)(`option`,{value:`text`,children:r(`chat:workbench.text`)}),(0,G.jsx)(`option`,{value:`file`,children:r(`chat:workbench.files`)})]})]})]}),(0,G.jsxs)(`div`,{ref:a.ref,className:`min-h-0 flex-1 overflow-y-auto`,children:[!f.length&&(0,G.jsx)(L,{compact:!0,title:e.length?r(`chat:workbench.noMatches`):r(`chat:workbench.noSources`)}),f.map(e=>{let i=t.selectedSourceId===e.id,a=e.kind===`image`?w:e.method===`path`?T:m;return(0,G.jsxs)(`article`,{className:`border-b border-stroke-soft`,children:[(0,G.jsxs)(`button`,{className:`flex min-h-9 w-full min-w-0 items-center gap-2 px-2 text-left hover:bg-surface-subtle focus-visible:-outline-offset-2 max-[650px]:min-h-11 pointer-coarse:min-h-11 ${i?`bg-surface-subtle`:``}`,"aria-expanded":i,onClick:()=>n({selectedSourceId:i?``:e.id}),children:[(0,G.jsx)(u,{size:14,className:`shrink-0 text-content-muted transition-transform duration-(--d-fast) ${i?`rotate-90`:``}`}),(0,G.jsx)(a,{className:`size-3.5 shrink-0 text-content-muted`}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs`,children:e.name||r(`chat:chatMessage.fileAttachment`)})]}),i&&(0,G.jsxs)(`div`,{className:`space-y-1.5 border-t border-stroke-soft bg-code py-2.5 pr-3 pl-8 text-xs text-content-muted`,children:[(0,G.jsx)(`p`,{className:`break-all font-mono text-content-secondary`,children:e.attachment.path||e.attachment.id||r(`chat:workbench.unavailable`)}),(0,G.jsx)(`p`,{className:`font-mono`,children:e.attachment.mimeType||`application/octet-stream`}),(0,G.jsx)(`p`,{children:e.method===`asset`?r(`chat:workbench.registeredAsset`):e.method===`path`?r(`chat:workbench.pathReference`):r(`chat:workbench.invalidReference`)}),(0,G.jsx)(j,{variant:`secondary`,size:`sm`,className:`mt-1`,disabled:!e.available,onClick:t=>{l.current=t.currentTarget,c(e.id)},children:r(`chat:chatMessage.fileActionPreview`)})]})]},e.id)})]}),d&&(0,G.jsx)(W.Suspense,{fallback:null,children:(0,G.jsx)(se,{attachment:d.attachment,onClose:()=>c(``),onRestoreFocus:()=>l.current?.focus(),onDownload:()=>{typeof d.attachment.downloadUrl==`string`&&window.open(d.attachment.downloadUrl,`_blank`,`noopener,noreferrer`)}})})]})}function le({parentId:e,active:t}){let{t:n}=i(),{entry:r,runtime:a,load:o,setDraft:c}=S(e),l=r.session?.id??``,u=(0,W.useMemo)(()=>e=>a.subscribeSessionState(l,e),[a,l]),d=(0,W.useMemo)(()=>()=>a.getSessionState(l),[a,l]),f=(0,W.useSyncExternalStore)(u,d),[p,m]=(0,W.useState)(!1),[h,g]=(0,W.useState)(!1),[y,C]=(0,W.useState)(``),w=(0,W.useRef)(!1),T=(0,W.useRef)(!1),D=(0,W.useRef)(r.draft);D.current=r.draft;let k=(0,W.useRef)(null),N=M(e=>e.bindings),P=b(f,r.session);(0,W.useEffect)(()=>{t&&o(e)},[t,o,e]);let F=async t=>{t.preventDefault();let n=D.current.trim();if(!(!n||w.current||P||r.expired)){w.current=!0,m(!0),C(``);try{let t=await o(e,!r.session);if(!t?.session)return;let i=t.session.id;if(a.getSessionState(i).streaming)return;D.current.trim()===n&&c(e,``),m(!1),await a.send(i,n),await o(e)}catch(e){C(B(e))}finally{w.current=!1,m(!1)}}},I=(0,W.useCallback)(async()=>{if(!(!l||a.getSessionState(l).streaming)){C(``);try{await a.retry(l),await o(e)}catch(e){C(B(e))}}},[o,e,a,l]),L=async()=>{if(!(!l||h)){g(!0);try{C(``),await a.abort(l)}catch(e){C(B(e))}finally{g(!1)}}},R=(0,G.jsxs)(`div`,{className:`grid h-full min-h-36 place-content-center justify-items-center gap-2 px-3 text-center text-xs text-content-muted`,children:[(0,G.jsx)(`span`,{className:`mb-1 grid size-8 place-items-center rounded-md bg-key text-content-secondary shadow-key ring-1 ring-key-border`,children:(0,G.jsx)(E,{className:`size-4`,"aria-hidden":`true`})}),(0,G.jsx)(`p`,{className:`max-w-64 leading-relaxed`,children:r.expired?n(`chat:sideChat.expired`):n(`chat:sideChat.empty`)}),r.expired&&(0,G.jsxs)(j,{variant:`secondary`,size:`sm`,className:`mt-1`,disabled:r.loading,onClick:async()=>{(await o(e,!0))?.session&&k.current?.focus()},children:[r.loading&&(0,G.jsx)(A,{className:`size-3.5 text-current`}),n(`chat:sideChat.restart`)]})]}),z=y||r.error||f.error;return(0,G.jsxs)(`section`,{"data-side-chat-parent":e,"aria-label":n(`chat:sideChat.title`),className:`flex h-full min-h-0 min-w-0 flex-1 flex-col [container-type:inline-size]`,children:[(0,G.jsx)(`p`,{className:`shrink-0 border-b border-stroke-soft px-3 py-2 text-xs leading-relaxed text-content-muted`,children:n(`chat:sideChat.retention`)}),l?(0,G.jsx)(x,{sessionId:l,messages:f.messages,transcriptLoadState:f.loaded?`ready`:f.error?`error`:`loading`,emptyState:R,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:P,runStartedAt:f.runStartedAt,lastActivityAt:f.lastActivityAt,runFinishedAt:f.runFinishedAt,runStopped:f.runStopped,runNotice:f.runNotice,error:f.error,cwd:r.session?.cwd,onLoadOlder:()=>a.loadOlderMessages(l),onRetryLastTurn:I}):(0,G.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:R}),(0,G.jsxs)(`form`,{className:`flex shrink-0 flex-col gap-2 border-t border-stroke-soft p-3`,onSubmit:F,children:[z&&(0,G.jsx)(v,{error:z,onRetry:r.error||!f.loaded?async()=>{await o(e)}:I}),(0,G.jsx)(_,{approvals:f.approvals,onResolve:async(e,t)=>{try{await a.approve(l,e,t)}catch{}}}),(0,G.jsxs)(`div`,{className:`flex min-w-0 items-end gap-2 rounded-[var(--composer-radius,22px)] border border-control bg-panel py-2 pr-2 pl-3 shadow-composer transition-[border-color,box-shadow] duration-(--d-fast) focus-within:border-focus focus-within:ring-3 focus-within:ring-focus-ring`,children:[(0,G.jsx)(`textarea`,{ref:k,rows:2,value:r.draft,"aria-label":n(`chat:sideChat.message`),placeholder:n(`chat:sideChat.placeholder`),className:`max-h-40 min-h-14 min-w-0 flex-1 resize-y border-0 bg-transparent px-1 py-1 text-sm leading-relaxed text-content caret-focus outline-none placeholder:text-content-muted`,onChange:t=>c(e,t.target.value),onCompositionStart:()=>{T.current=!0},onCompositionEnd:()=>{T.current=!1},onKeyDown:e=>{!T.current&&!e.nativeEvent.isComposing&&e.nativeEvent.keyCode!==229&&ee(e.nativeEvent,N.sendMessage)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())}}),(0,G.jsx)(j,{type:P?`button`:`submit`,size:`icon`,className:`size-8 shrink-0 rounded-full max-[650px]:size-11 pointer-coarse:size-11`,"aria-label":n(P?`chat:sideChat.stop`:`chat:sideChat.send`),disabled:P?h:p||r.loading||r.expired||!r.draft.trim(),onClick:P?()=>void L():void 0,children:p||h?(0,G.jsx)(A,{className:`size-4 text-current`}):P?(0,G.jsx)(O,{size:13,fill:`currentColor`}):(0,G.jsx)(s,{size:17})})]})]})]})}var $=(0,W.createContext)(null),ue=()=>{let e=(0,W.useContext)($);if(!e)throw Error(`WebPreview components must be used within a WebPreview`);return e},de=({className:e,children:t,defaultUrl:n=``,onUrlChange:r,...i})=>{let[a,o]=(0,W.useState)(n),[s,c]=(0,W.useState)(!1),l=(0,W.useCallback)(e=>{o(e),r?.(e)},[r]),u=(0,W.useMemo)(()=>({consoleOpen:s,setConsoleOpen:c,setUrl:l,url:a}),[s,l,a]);return(0,G.jsx)($.Provider,{value:u,children:(0,G.jsx)(`div`,{className:k(`flex size-full min-h-0 flex-col rounded-lg border bg-card`,e),...i,children:t})})},fe=({className:e,loading:t,src:n,...r})=>{let{url:i}=ue();return(0,G.jsxs)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden bg-background`,children:[(0,G.jsx)(`iframe`,{className:k(`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 pe({page:e,onChange:t}){let{t:n}=i(),{draft:r,url:a}=e,[o,s]=(0,W.useState)(!1);return(0,G.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col gap-2 p-3`,"aria-label":n(`common:webPreview.title`),children:[(0,G.jsxs)(`form`,{className:`flex gap-2`,onSubmit:e=>{e.preventDefault();let n=z(r,window.location.href);s(!n),n&&t({url:n})},children:[(0,G.jsx)(P,{"aria-label":n(`common:webPreview.url`),className:`flex-1 font-mono`,value:r,onChange:e=>t({draft:e.target.value}),placeholder:n(`common:webPreview.urlPlaceholder`),maxLength:2048}),(0,G.jsx)(j,{type:`submit`,variant:`secondary`,children:n(`chat:sessionContext.openUrl`)})]}),o&&(0,G.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:n(`chat:sessionContext.invalidUrl`)}),a?(0,G.jsx)(de,{className:`min-h-0 flex-1 overflow-hidden rounded-md border-stroke`,defaultUrl:a,children:(0,G.jsx)(fe,{src:a,title:n(`common:webPreview.title`)})},a):(0,G.jsx)(L,{icon:d,className:`min-h-0 flex-1`,title:n(`chat:sessionContext.browserEmpty`)}),a&&(0,G.jsxs)(j,{type:`button`,variant:`ghost`,size:`sm`,className:`self-start`,onClick:()=>window.open(a,`_blank`,`noopener,noreferrer`),children:[(0,G.jsx)(f,{size:14}),n(`common:webPreview.openExternal`)]}),(0,G.jsx)(`p`,{className:`text-xs text-content-muted`,children:n(`common:webPreview.embedNotice`)})]})}export{ae as a,Z as c,oe as i,te as l,le as n,ie as o,ce as r,re as s,pe as t};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/GitDiffViewer-DGkjG02b.js","assets/rolldown-runtime-B0Z9INg1.js","assets/vendor-react-DwNgTV1j.js","assets/use-i18n-BuN5i-jP.js","assets/i18n-CyyEaQdX.js","assets/vendor-router-CSN_DGvx.js","assets/index-DsXdZRdL.js","assets/index-C13rJGuY.css","assets/storage-8QW6lXuT.js","assets/vendor-state-GkUciC5H.js","assets/createLucideIcon-Cd-3GVxJ.js","assets/x-07u4-129.js","assets/utils-C8uzG5AZ.js","assets/vendor-ui-DvrYggeS.js","assets/button-CCcCN8tE.js","assets/dist-41X0pdUs.js","assets/events-D0dbOYFR.js","assets/esm-DCV8yILT.js"])))=>i.map(i=>d[i]);
2
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{h as t}from"./vendor-router-CSN_DGvx.js";import{i as n,r}from"./vendor-react-DwNgTV1j.js";import{t as i}from"./use-i18n-BuN5i-jP.js";import{i as a}from"./runtime-capabilities-CHYOF_hE.js";import{t as o}from"./runtime-capabilities-store-B5Bam7pC.js";import{a as s}from"./permission-rules-api-CPImVuda.js";import{t as c}from"./arrow-left-B8oVrQ2S.js";import{t as l}from"./check-2vYc6QaP.js";import{t as u}from"./chevron-right-C3t2Rckj.js";import{a as d,c as f,i as p,l as m,n as h,o as g,r as _,s as v,t as y}from"./SessionBrowserPane-DOmbqdHK.js";import{t as b}from"./earth-Ddy13fHh.js";import{i as x,o as S}from"./GitDiffViewer-DGkjG02b.js";import{F as C,L as w,N as T,_ as E,g as D,h as O}from"./side-chat-context-hRj7FqXK.js";import{t as k}from"./link-2-mgasYn21.js";import{t as A}from"./message-square-SKjZyY3v.js";import{t as j}from"./plus-fQbSqB1n.js";import{t as M}from"./refresh-cw-TbWxTY4K.js";import{t as N}from"./square-terminal-BVG6cUT1.js";import{t as P}from"./x-07u4-129.js";import{n as F,t as I}from"./button-CCcCN8tE.js";import{s as L}from"./events-D0dbOYFR.js";import{a as ee,n as te,o as ne,t as re}from"./sheet-BTaIEX4w.js";import{t as R}from"./input-CPw-zkYh.js";import{n as z,t as B}from"./PageState-Cz6vFMXv.js";import{t as V}from"./web-preview-DUIdcsL2.js";import{n as ie}from"./terminal-context-aIsIJPn8.js";var H=e(n(),1),U=r(),W=(0,H.lazy)(()=>t(()=>import(`./GitDiffViewer-DGkjG02b.js`).then(e=>e.n).then(e=>({default:e.GitDiffDialog})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]))),G=100;function ae({sessionId:e,streaming:t,requestConfirm:n,view:r,onViewChange:a}){let{t:o}=i(),s=x(r?.reading?.list,e=>a?.({reading:{...r?.reading,list:e}})),[c,d]=(0,H.useState)([]),p=r?.expandedFiles||c,m=e=>a?a({expandedFiles:e}):d(e),{changes:h,loading:_,running:v,diff:y,setDiff:b,diffLoading:C,snapshotRevision:w,writesDisabled:E,pendingCount:D,reversibleCount:O,displayedError:k,notice:A,viewDiff:j,runAction:N,refresh:P}=g({sessionId:e,streaming:t,requestConfirm:n}),L=`max-[650px]:size-11 pointer-coarse:size-11`;return(0,U.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,"aria-label":o(`chat:focusSession.fileChanges`),"aria-busy":_||!!v,children:[(0,U.jsxs)(`header`,{className:`flex min-h-10 min-w-0 shrink-0 items-center gap-2 border-b border-stroke-soft pr-1.5 pl-3`,children:[(0,U.jsx)(`h2`,{className:`min-w-0 flex-1 truncate text-xs font-medium tracking-[.02em] text-content-muted`,children:o(`chat:focusSession.fileChanges`)}),h&&(0,U.jsxs)(`span`,{className:`shrink-0 font-mono text-xs tabular-nums`,children:[(0,U.jsxs)(`span`,{className:`text-success`,children:[`+`,h.summary.added]}),` `,(0,U.jsxs)(`span`,{className:`text-danger`,children:[`−`,h.summary.removed]})]}),(0,U.jsx)(I,{type:`button`,variant:`ghost`,size:`icon`,className:L,"aria-label":o(`chat:focusSession.gitRefresh`),title:o(`chat:focusSession.gitRefresh`),disabled:_||!!v,onClick:P,children:(0,U.jsx)(M,{className:_?`animate-spin`:``,size:15})})]}),(0,U.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2 border-b border-stroke-soft px-3 py-2.5`,children:[h&&(0,U.jsxs)(`p`,{className:`text-xs text-content-secondary tabular-nums`,children:[o(`chat:focusSession.fileChangesCount`,{count:h.summary.files}),D>0&&` · ${o(`chat:focusSession.fileChangesPending`,{count:D})}`]}),(0,U.jsx)(`p`,{className:`text-xs leading-relaxed text-content-muted`,children:o(`chat:workbench.taskSnapshotScope`)}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-1`,children:[(0,U.jsxs)(`div`,{className:`flex gap-1`,children:[(0,U.jsxs)(I,{type:`button`,variant:`secondary`,size:`sm`,disabled:E||D===0,title:t?o(`chat:focusSession.gitWaitForRunToFinish`):void 0,onClick:()=>void N({kind:`approve`}),children:[v?.kind===`approve`&&!v.path?(0,U.jsx)(M,{className:`animate-spin`,size:14}):(0,U.jsx)(l,{size:14}),o(`chat:focusSession.fileChangesApproveAll`)]}),(0,U.jsxs)(I,{type:`button`,variant:`secondary`,size:`sm`,disabled:E||O===0,title:o(t?`chat:focusSession.gitWaitForRunToFinish`:`chat:focusSession.fileChangesRevertAllDescription`),onClick:()=>void N({kind:`revert`}),children:[v?.kind===`revert`&&!v.path?(0,U.jsx)(M,{className:`animate-spin`,size:14}):(0,U.jsx)(T,{size:14}),o(`chat:focusSession.fileChangesRevertAll`)]})]}),(0,U.jsxs)(`div`,{className:`flex gap-1`,children:[(0,U.jsx)(I,{variant:`ghost`,size:`sm`,disabled:_||!h?.files.length,onClick:()=>m(h?.files.slice(0,G).map(e=>e.path)||[]),children:o(`chat:workbench.expandAll`)}),(0,U.jsx)(I,{variant:`ghost`,size:`sm`,onClick:()=>m([]),children:o(`chat:workbench.collapseAll`)})]})]})]}),k&&(0,U.jsx)(`p`,{role:`alert`,className:`px-3 pt-2.5 text-xs text-danger`,children:k}),A&&!k&&(0,U.jsx)(`p`,{role:`status`,className:`px-3 pt-2.5 text-xs text-content-secondary`,children:A}),_&&!h?(0,U.jsx)(z,{kind:`loading`,title:o(`chat:focusSession.gitLoading`)}):h?.files.length?(0,U.jsxs)(`ul`,{ref:s.ref,className:`min-h-0 flex-1 overflow-y-auto`,"aria-label":o(`chat:focusSession.fileChanges`),children:[h.files.slice(0,G).map(t=>{let n=p.includes(t.path);return(0,U.jsxs)(`li`,{className:`min-w-0 border-b border-stroke-soft`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-0.5 pr-1.5 hover:bg-surface-subtle ${n?`bg-surface-subtle`:``}`,children:[(0,U.jsxs)(`button`,{type:`button`,className:`flex min-h-9 min-w-0 flex-1 items-center gap-2 pl-2 text-left text-xs focus-visible:-outline-offset-2 disabled:opacity-60 max-[650px]:min-h-11 pointer-coarse:min-h-11`,title:t.path,disabled:_||!!v,"aria-busy":C===t.path,"aria-expanded":n,onClick:()=>m(n?p.filter(e=>e!==t.path):[...p,t.path]),children:[(0,U.jsx)(u,{size:14,className:`shrink-0 text-content-muted transition-transform duration-(--d-fast) ${n?`rotate-90`:``}`}),C===t.path?(0,U.jsx)(F,{className:`size-3.5`}):(0,U.jsx)(S,{size:14,className:`flex-none text-content-muted`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono`,children:t.path}),(t.reverted||t.approved)&&(0,U.jsx)(`span`,{className:`shrink-0 text-content-muted`,children:t.reverted?o(`chat:focusSession.fileChangesReverted`):o(`chat:focusSession.fileChangesApproved`)}),(0,U.jsxs)(`span`,{className:`shrink-0 font-mono tabular-nums`,children:[(0,U.jsxs)(`span`,{className:`text-success`,children:[`+`,t.added]}),` `,(0,U.jsxs)(`span`,{className:`text-danger`,children:[`−`,t.removed]})]})]}),(0,U.jsx)(I,{type:`button`,variant:`ghost`,size:`icon`,className:L,title:o(`chat:focusSession.fileChangesApproveFile`),"aria-label":`${o(`chat:focusSession.fileChangesApproveFile`)} ${t.path}`,disabled:E||!t.pending||t.approved||t.reverted,onClick:()=>void N({kind:`approve`,path:t.path}),children:(0,U.jsx)(l,{size:14})}),(0,U.jsx)(I,{type:`button`,variant:`ghost`,size:`icon`,className:L,title:o(`chat:focusSession.fileChangesRevertFile`),"aria-label":`${o(`chat:focusSession.fileChangesRevertFile`)} ${t.path}`,disabled:E||t.reverted||!t.canRevert,onClick:()=>void N({kind:`revert`,path:t.path}),children:(0,U.jsx)(T,{size:14})})]}),n&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(f,{sessionId:e,path:t.path,scope:`task`,position:r?.reading?.[t.path],onReading:e=>a?.({reading:{...r?.reading,[t.path]:e}}),revision:w}),(0,U.jsx)(I,{variant:`ghost`,size:`sm`,className:`m-1.5`,onClick:()=>void j(t.path),children:o(`chat:workbench.fullDiff`)})]})]},t.path)}),h.files.length>G&&(0,U.jsx)(`li`,{className:`px-3 py-2 text-xs text-content-muted tabular-nums`,children:o(`chat:focusSession.gitMoreFiles`,{count:h.files.length-G})})]}):!k&&(0,U.jsx)(B,{compact:!0,title:o(`chat:focusSession.fileChangesEmpty`)}),y&&(0,U.jsx)(H.Suspense,{fallback:null,children:(0,U.jsx)(W,{diff:y.diff,truncated:y.truncated,onClose:()=>b(null)})})]})}function oe({tools:e,onSelect:t,onOpenUrl:n}){let{t:r}=i(),[a,o]=(0,H.useState)(``),[s,c]=(0,H.useState)(!1);return(0,U.jsxs)(`section`,{className:`@container/new-tab flex min-h-0 flex-1 flex-col overflow-y-auto bg-panel p-4`,children:[(0,U.jsx)(`h2`,{className:`mb-3 text-sm font-medium text-content`,children:r(`chat:workbench.newTab`)}),(0,U.jsxs)(`form`,{className:`mb-4 flex gap-2`,onSubmit:e=>{e.preventDefault();let t=V(a,window.location.href);c(!t),t&&n(t)},children:[(0,U.jsx)(R,{className:`font-mono`,"aria-label":r(`common:webPreview.url`),placeholder:r(`common:webPreview.urlPlaceholder`),value:a,maxLength:2048,onChange:e=>o(e.target.value)}),(0,U.jsx)(I,{type:`submit`,variant:`secondary`,children:r(`chat:sessionContext.openUrl`)})]}),s&&(0,U.jsx)(`p`,{role:`alert`,className:`mb-3 text-xs text-danger`,children:r(`chat:sessionContext.invalidUrl`)}),(0,U.jsx)(`div`,{className:`grid grid-cols-1 gap-1.5 @min-[420px]/new-tab:grid-cols-2`,children:e.map(({id:e,label:n,icon:r,disabled:i})=>(0,U.jsxs)(I,{disabled:i,variant:`ghost`,className:`h-10 min-w-0 justify-start gap-2.5 border-stroke bg-panel px-3 font-normal text-content max-[650px]:h-11 pointer-coarse:h-11 [&_svg]:text-content-muted`,onClick:()=>t(e),children:[(0,U.jsx)(r,{className:`size-4 shrink-0`}),(0,U.jsx)(`span`,{className:`truncate`,children:n})]},e))})]})}function K({panelId:e,compact:t,embedded:n=!1,active:r=!0,sessionId:l,cwd:u=``,sources:f=[],tab:g,plan:x,streaming:T,plansAvailable:M,requestConfirm:F,onTabChange:R,onClose:z,onBack:V}){let{t:W}=i(),G=ie(),K=o(e=>e.capabilities),q=[{id:`terminal`,icon:N,label:W(`terminal:workspace.terminal`)},{id:`processes`,icon:s,label:W(`terminal:workspace.processes`)},{id:`changes`,icon:S,label:W(`chat:workbench.projectChanges`)},{id:`sources`,icon:k,label:W(`chat:workbench.sources`)},{id:`files`,icon:w,label:W(`chat:workbench.taskSnapshots`)},...M?[{id:`plan`,icon:C,label:W(`chat:sessionContext.plan`)}]:[],{id:`browser`,icon:b,label:W(`common:webPreview.title`)},{id:`side-chat`,icon:A,label:W(`chat:sideChat.title`)}],se=(0,H.useMemo)(()=>D(g),[g]),J=O(e=>Object.prototype.hasOwnProperty.call(e.sessions,l)?e.sessions[l]:void 0)??se,ce=(0,H.useRef)(null),Y=J.pages.find(e=>e.id===J.activeId)??J.pages[0],X=e=>e.kind===`new`?{id:`new`,icon:j,label:W(`chat:workbench.newTab`)}:q.find(t=>t.id===e.kind)??q[0],le=t=>requestAnimationFrame(()=>document.getElementById(`${e}-${t}-tab`)?.focus()),ue=(0,H.useEffectEvent)(()=>{r&&document.getElementById(`${e}-${J.activeId}-tab`)?.focus()});(0,H.useEffect)(()=>{let e=requestAnimationFrame(()=>ue());return()=>cancelAnimationFrame(e)},[e,J.activeId]);let Z=e=>{if(e.type===`view`&&!O.getState().sessions[l])return;[`add`,`open`,`select`,`close`,`kind`].includes(e.type)&&window.dispatchEvent(new Event(L));let t=E(J,e);O.getState().update(l,g,e);let n=t.pages.find(e=>e.id===t.activeId);n&&R(n.kind),(e.type===`add`||e.type===`select`||e.type===`close`)&&le(t.activeId),e.type===`close`&&J.pages.length===1&&z()},Q=W(`chat:sessionContext.addPage`),de=W(`chat:sessionContext.pageLimit`),fe=(0,U.jsx)(I,{variant:`ghost`,size:`icon`,className:`max-[650px]:size-11`,disabled:J.pages.length>=12,"aria-label":Q,title:J.pages.length>=12?de:Q,onClick:()=>Z({type:`add`,kind:`new`}),children:(0,U.jsx)(j,{size:16})}),$=(0,U.jsxs)(`div`,{"data-session-context-panel":!0,className:`flex h-full min-h-0 min-w-0 flex-col bg-panel text-content`,children:[(0,U.jsxs)(`header`,{"data-window-drag-region":!0,className:`auxiliary-page-header flex h-12 shrink-0 items-center gap-1 border-b border-stroke-soft px-2`,children:[V&&(0,U.jsx)(I,{variant:`ghost`,size:`icon`,className:`max-[650px]:size-11`,"aria-label":W(`chat:workbench.backToConversation`),title:W(`chat:workbench.backToConversation`),onClick:V,children:(0,U.jsx)(c,{size:16})}),(0,U.jsx)(`div`,{ref:ce,className:`flex min-w-0 flex-1 items-center gap-0.5 overflow-x-auto px-px py-1 [scrollbar-width:none]`,role:`tablist`,"aria-label":W(`chat:sessionContext.title`),onKeyDown:e=>{if(!(e.target instanceof HTMLElement)||e.target.getAttribute(`role`)!==`tab`)return;if(e.key===`Delete`){e.preventDefault(),Z({type:`close`,id:Y.id});return}if(![`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key))return;e.preventDefault();let t=J.pages.findIndex(e=>e.id===Y.id),n=e.key===`Home`?0:e.key===`End`?J.pages.length-1:(t+(e.key===`ArrowRight`?1:-1)+J.pages.length)%J.pages.length;Z({type:`select`,id:J.pages[n].id})},children:J.pages.map(t=>{let{icon:n,label:r}=X(t);return(0,U.jsxs)(`div`,{className:`relative flex max-w-40 min-w-20 shrink-0 items-center rounded-sm transition-colors duration-(--d-fast) ${t.id===Y.id?`bg-key font-medium text-content shadow-key ring-1 ring-key-border after:absolute after:inset-x-2 after:bottom-0 after:h-0.5 after:rounded-full after:bg-star`:`text-content-muted hover:bg-surface-hover hover:text-content`}`,children:[(0,U.jsxs)(`button`,{id:`${e}-${t.id}-tab`,type:`button`,role:`tab`,"aria-selected":t.id===Y.id,"aria-controls":`${e}-${t.id}-content`,tabIndex:t.id===Y.id?0:-1,className:`flex h-7 min-w-0 flex-1 items-center gap-1.5 rounded-sm pl-2 text-sm focus-visible:outline-offset-0 max-[650px]:h-11`,onClick:()=>Z({type:`select`,id:t.id}),children:[(0,U.jsx)(n,{size:14,className:`shrink-0`}),(0,U.jsx)(`span`,{className:`truncate`,children:r})]}),(0,U.jsx)(`button`,{type:`button`,className:`mx-0.5 grid size-5 shrink-0 place-items-center rounded-xs text-content-muted hover:bg-surface-hover hover:text-content focus-visible:outline-offset-0 max-[650px]:size-11`,"aria-label":`${W(`chat:sessionContext.closePage`)} · ${r}`,onClick:()=>Z({type:`close`,id:t.id}),children:(0,U.jsx)(P,{size:12})})]},t.id)})}),fe]}),J.pages.map(t=>{let n=X(t),r=Y.id===t.id;return(0,U.jsx)(`div`,{id:`${e}-${t.id}-content`,role:`tabpanel`,"aria-labelledby":`${e}-${t.id}-tab`,className:r?`flex min-h-0 flex-1 flex-col`:`hidden`,hidden:!r,children:n.id===`new`?r&&(0,U.jsx)(oe,{tools:q.map(e=>({...e,disabled:e.id===`terminal`||e.id===`processes`?!G||!a(K,`terminal`):e.id===`changes`&&!a(K,`vcs`)})),onOpenUrl:e=>{Z({type:`open`,kind:`browser`,replaceId:t.id}),O.getState().update(l,`browser`,{type:`browser`,id:t.id,url:e,draft:e})},onSelect:e=>Z({type:`open`,kind:e,replaceId:t.id})}):n.id===`changes`?r&&(0,U.jsx)(v,{sessionId:l,cwd:u,streaming:T,view:t.view,onViewChange:e=>Z({type:`view`,id:t.id,patch:e})}):n.id===`sources`?r&&(0,U.jsx)(_,{sources:f,view:t.view,onViewChange:e=>Z({type:`view`,id:t.id,patch:e})}):n.id===`terminal`?r&&(0,U.jsx)(d,{sessionId:l,cwd:u,terminalId:t.resourceId||void 0,onCreated:e=>O.getState().update(l,g,{type:`resource`,id:t.id,resourceId:e})}):n.id===`processes`?r&&(0,U.jsx)(p,{view:t.view,onViewChange:e=>Z({type:`view`,id:t.id,patch:e}),sessionId:l,onOpenTerminal:e=>Z({type:`open`,kind:`terminal`,resourceId:e})}):n.id===`side-chat`?(0,U.jsx)(h,{parentId:l,active:r}):n.id===`browser`?(0,U.jsx)(y,{page:t,onChange:e=>Z({type:`browser`,id:t.id,...e})}):r&&(n.id===`files`?(0,U.jsx)(ae,{view:t.view,onViewChange:e=>Z({type:`view`,id:t.id,patch:e}),sessionId:l,streaming:T,requestConfirm:F}):(0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-3`,children:x?.items?.length?(0,U.jsx)(m,{plan:x}):(0,U.jsx)(B,{compact:!0,title:W(`chat:sessionContext.planEmpty`)})}))},t.id)})]});return t?(0,U.jsx)(re,{open:!0,onOpenChange:e=>!e&&z(),children:(0,U.jsxs)(te,{id:e,side:`right`,showCloseButton:!1,className:`gap-0 overflow-hidden p-0`,style:{top:`var(--pisper-safe-area-top)`,right:`var(--pisper-safe-area-right)`,bottom:`var(--pisper-safe-area-bottom)`,height:`auto`,width:`min(calc(100vw - var(--pisper-safe-area-left) - var(--pisper-safe-area-right)), 420px)`,maxWidth:`none`},children:[(0,U.jsx)(ee,{className:`sr-only`,children:(0,U.jsx)(ne,{children:W(`chat:sessionContext.title`)})}),$]})}):(0,U.jsx)(`aside`,{id:e,tabIndex:n?-1:void 0,className:`h-full min-h-0 w-full overflow-hidden border-l border-stroke bg-panel`,"aria-label":W(`chat:sessionContext.title`),children:$})}export{K as SessionContextPanel};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/GitDiffViewer-XzdYQWbX.js","assets/rolldown-runtime-B0Z9INg1.js","assets/vendor-react-DwNgTV1j.js","assets/use-i18n-Cyg5th6Z.js","assets/i18n-Du-JO3Qx.js","assets/vendor-router-CSN_DGvx.js","assets/index-DmohsuQg.js","assets/index-BY7X-ZtU.css","assets/storage-8QW6lXuT.js","assets/vendor-state-GkUciC5H.js","assets/createLucideIcon-Cd-3GVxJ.js","assets/x-07u4-129.js","assets/utils-C8uzG5AZ.js","assets/vendor-ui-DvrYggeS.js","assets/button-CCcCN8tE.js","assets/dist-41X0pdUs.js","assets/events-B0F69Vd3.js","assets/esm-DCV8yILT.js"])))=>i.map(i=>d[i]);
2
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{h as t}from"./vendor-router-CSN_DGvx.js";import{i as n,r}from"./vendor-react-DwNgTV1j.js";import{t as i}from"./use-i18n-Cyg5th6Z.js";import{i as a}from"./runtime-capabilities-CHYOF_hE.js";import{t as o}from"./runtime-capabilities-store-DWW9jolt.js";import{a as s}from"./permission-rules-api-CAxfABVR.js";import{t as c}from"./arrow-left-B8oVrQ2S.js";import{t as l}from"./check-2vYc6QaP.js";import{t as u}from"./chevron-right-C3t2Rckj.js";import{a as d,c as f,i as p,l as m,n as h,o as g,r as _,s as v,t as y}from"./SessionBrowserPane-D2Z-J6tl.js";import{t as b}from"./earth-Ddy13fHh.js";import{i as x,o as S}from"./GitDiffViewer-XzdYQWbX.js";import{B as C,I as w,R as T,b as E,v as D,y as O}from"./side-chat-context-Cm84nqzk.js";import{t as k}from"./link-2-mgasYn21.js";import{t as A}from"./message-square-SKjZyY3v.js";import{t as j}from"./plus-fQbSqB1n.js";import{t as M}from"./refresh-cw-TbWxTY4K.js";import{t as N}from"./square-terminal-BVG6cUT1.js";import{t as P}from"./x-07u4-129.js";import{n as F,t as I}from"./button-CCcCN8tE.js";import{s as L}from"./events-B0F69Vd3.js";import{a as ee,n as te,o as ne,t as re}from"./sheet-BTaIEX4w.js";import{t as R}from"./input-CPw-zkYh.js";import{n as z,t as B}from"./PageState-Cz6vFMXv.js";import{t as V}from"./web-preview-Bo8YMR-t.js";import{n as ie}from"./terminal-context-aIsIJPn8.js";var H=e(n(),1),U=r(),W=(0,H.lazy)(()=>t(()=>import(`./GitDiffViewer-XzdYQWbX.js`).then(e=>e.n).then(e=>({default:e.GitDiffDialog})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]))),G=100;function ae({sessionId:e,streaming:t,requestConfirm:n,view:r,onViewChange:a}){let{t:o}=i(),s=x(r?.reading?.list,e=>a?.({reading:{...r?.reading,list:e}})),[c,d]=(0,H.useState)([]),p=r?.expandedFiles||c,m=e=>a?a({expandedFiles:e}):d(e),{changes:h,loading:_,running:v,diff:y,setDiff:b,diffLoading:C,snapshotRevision:T,writesDisabled:E,pendingCount:D,reversibleCount:O,displayedError:k,notice:A,viewDiff:j,runAction:N,refresh:P}=g({sessionId:e,streaming:t,requestConfirm:n}),L=`max-[650px]:size-11 pointer-coarse:size-11`;return(0,U.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,"aria-label":o(`chat:focusSession.fileChanges`),"aria-busy":_||!!v,children:[(0,U.jsxs)(`header`,{className:`flex min-h-10 min-w-0 shrink-0 items-center gap-2 border-b border-stroke-soft pr-1.5 pl-3`,children:[(0,U.jsx)(`h2`,{className:`min-w-0 flex-1 truncate text-xs font-medium tracking-[.02em] text-content-muted`,children:o(`chat:focusSession.fileChanges`)}),h&&(0,U.jsxs)(`span`,{className:`shrink-0 font-mono text-xs tabular-nums`,children:[(0,U.jsxs)(`span`,{className:`text-success`,children:[`+`,h.summary.added]}),` `,(0,U.jsxs)(`span`,{className:`text-danger`,children:[`−`,h.summary.removed]})]}),(0,U.jsx)(I,{type:`button`,variant:`ghost`,size:`icon`,className:L,"aria-label":o(`chat:focusSession.gitRefresh`),title:o(`chat:focusSession.gitRefresh`),disabled:_||!!v,onClick:P,children:(0,U.jsx)(M,{className:_?`animate-spin`:``,size:15})})]}),(0,U.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2 border-b border-stroke-soft px-3 py-2.5`,children:[h&&(0,U.jsxs)(`p`,{className:`text-xs text-content-secondary tabular-nums`,children:[o(`chat:focusSession.fileChangesCount`,{count:h.summary.files}),D>0&&` · ${o(`chat:focusSession.fileChangesPending`,{count:D})}`]}),(0,U.jsx)(`p`,{className:`text-xs leading-relaxed text-content-muted`,children:o(`chat:workbench.taskSnapshotScope`)}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-1`,children:[(0,U.jsxs)(`div`,{className:`flex gap-1`,children:[(0,U.jsxs)(I,{type:`button`,variant:`secondary`,size:`sm`,disabled:E||D===0,title:t?o(`chat:focusSession.gitWaitForRunToFinish`):void 0,onClick:()=>void N({kind:`approve`}),children:[v?.kind===`approve`&&!v.path?(0,U.jsx)(M,{className:`animate-spin`,size:14}):(0,U.jsx)(l,{size:14}),o(`chat:focusSession.fileChangesApproveAll`)]}),(0,U.jsxs)(I,{type:`button`,variant:`secondary`,size:`sm`,disabled:E||O===0,title:o(t?`chat:focusSession.gitWaitForRunToFinish`:`chat:focusSession.fileChangesRevertAllDescription`),onClick:()=>void N({kind:`revert`}),children:[v?.kind===`revert`&&!v.path?(0,U.jsx)(M,{className:`animate-spin`,size:14}):(0,U.jsx)(w,{size:14}),o(`chat:focusSession.fileChangesRevertAll`)]})]}),(0,U.jsxs)(`div`,{className:`flex gap-1`,children:[(0,U.jsx)(I,{variant:`ghost`,size:`sm`,disabled:_||!h?.files.length,onClick:()=>m(h?.files.slice(0,G).map(e=>e.path)||[]),children:o(`chat:workbench.expandAll`)}),(0,U.jsx)(I,{variant:`ghost`,size:`sm`,onClick:()=>m([]),children:o(`chat:workbench.collapseAll`)})]})]})]}),k&&(0,U.jsx)(`p`,{role:`alert`,className:`px-3 pt-2.5 text-xs text-danger`,children:k}),A&&!k&&(0,U.jsx)(`p`,{role:`status`,className:`px-3 pt-2.5 text-xs text-content-secondary`,children:A}),_&&!h?(0,U.jsx)(z,{kind:`loading`,title:o(`chat:focusSession.gitLoading`)}):h?.files.length?(0,U.jsxs)(`ul`,{ref:s.ref,className:`min-h-0 flex-1 overflow-y-auto`,"aria-label":o(`chat:focusSession.fileChanges`),children:[h.files.slice(0,G).map(t=>{let n=p.includes(t.path);return(0,U.jsxs)(`li`,{className:`min-w-0 border-b border-stroke-soft`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-0.5 pr-1.5 hover:bg-surface-subtle ${n?`bg-surface-subtle`:``}`,children:[(0,U.jsxs)(`button`,{type:`button`,className:`flex min-h-9 min-w-0 flex-1 items-center gap-2 pl-2 text-left text-xs focus-visible:-outline-offset-2 disabled:opacity-60 max-[650px]:min-h-11 pointer-coarse:min-h-11`,title:t.path,disabled:_||!!v,"aria-busy":C===t.path,"aria-expanded":n,onClick:()=>m(n?p.filter(e=>e!==t.path):[...p,t.path]),children:[(0,U.jsx)(u,{size:14,className:`shrink-0 text-content-muted transition-transform duration-(--d-fast) ${n?`rotate-90`:``}`}),C===t.path?(0,U.jsx)(F,{className:`size-3.5`}):(0,U.jsx)(S,{size:14,className:`flex-none text-content-muted`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono`,children:t.path}),(t.reverted||t.approved)&&(0,U.jsx)(`span`,{className:`shrink-0 text-content-muted`,children:t.reverted?o(`chat:focusSession.fileChangesReverted`):o(`chat:focusSession.fileChangesApproved`)}),(0,U.jsxs)(`span`,{className:`shrink-0 font-mono tabular-nums`,children:[(0,U.jsxs)(`span`,{className:`text-success`,children:[`+`,t.added]}),` `,(0,U.jsxs)(`span`,{className:`text-danger`,children:[`−`,t.removed]})]})]}),(0,U.jsx)(I,{type:`button`,variant:`ghost`,size:`icon`,className:L,title:o(`chat:focusSession.fileChangesApproveFile`),"aria-label":`${o(`chat:focusSession.fileChangesApproveFile`)} ${t.path}`,disabled:E||!t.pending||t.approved||t.reverted,onClick:()=>void N({kind:`approve`,path:t.path}),children:(0,U.jsx)(l,{size:14})}),(0,U.jsx)(I,{type:`button`,variant:`ghost`,size:`icon`,className:L,title:o(`chat:focusSession.fileChangesRevertFile`),"aria-label":`${o(`chat:focusSession.fileChangesRevertFile`)} ${t.path}`,disabled:E||t.reverted||!t.canRevert,onClick:()=>void N({kind:`revert`,path:t.path}),children:(0,U.jsx)(w,{size:14})})]}),n&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(f,{sessionId:e,path:t.path,scope:`task`,position:r?.reading?.[t.path],onReading:e=>a?.({reading:{...r?.reading,[t.path]:e}}),revision:T}),(0,U.jsx)(I,{variant:`ghost`,size:`sm`,className:`m-1.5`,onClick:()=>void j(t.path),children:o(`chat:workbench.fullDiff`)})]})]},t.path)}),h.files.length>G&&(0,U.jsx)(`li`,{className:`px-3 py-2 text-xs text-content-muted tabular-nums`,children:o(`chat:focusSession.gitMoreFiles`,{count:h.files.length-G})})]}):!k&&(0,U.jsx)(B,{compact:!0,title:o(`chat:focusSession.fileChangesEmpty`)}),y&&(0,U.jsx)(H.Suspense,{fallback:null,children:(0,U.jsx)(W,{diff:y.diff,truncated:y.truncated,onClose:()=>b(null)})})]})}function oe({tools:e,onSelect:t,onOpenUrl:n}){let{t:r}=i(),[a,o]=(0,H.useState)(``),[s,c]=(0,H.useState)(!1);return(0,U.jsxs)(`section`,{className:`@container/new-tab flex min-h-0 flex-1 flex-col overflow-y-auto bg-panel p-4`,children:[(0,U.jsx)(`h2`,{className:`mb-3 text-sm font-medium text-content`,children:r(`chat:workbench.newTab`)}),(0,U.jsxs)(`form`,{className:`mb-4 flex gap-2`,onSubmit:e=>{e.preventDefault();let t=V(a,window.location.href);c(!t),t&&n(t)},children:[(0,U.jsx)(R,{className:`font-mono`,"aria-label":r(`common:webPreview.url`),placeholder:r(`common:webPreview.urlPlaceholder`),value:a,maxLength:2048,onChange:e=>o(e.target.value)}),(0,U.jsx)(I,{type:`submit`,variant:`secondary`,children:r(`chat:sessionContext.openUrl`)})]}),s&&(0,U.jsx)(`p`,{role:`alert`,className:`mb-3 text-xs text-danger`,children:r(`chat:sessionContext.invalidUrl`)}),(0,U.jsx)(`div`,{className:`grid grid-cols-1 gap-1.5 @min-[420px]/new-tab:grid-cols-2`,children:e.map(({id:e,label:n,icon:r,disabled:i})=>(0,U.jsxs)(I,{disabled:i,variant:`ghost`,className:`h-10 min-w-0 justify-start gap-2.5 border-stroke bg-panel px-3 font-normal text-content max-[650px]:h-11 pointer-coarse:h-11 [&_svg]:text-content-muted`,onClick:()=>t(e),children:[(0,U.jsx)(r,{className:`size-4 shrink-0`}),(0,U.jsx)(`span`,{className:`truncate`,children:n})]},e))})]})}function K({panelId:e,compact:t,embedded:n=!1,active:r=!0,sessionId:l,cwd:u=``,sources:f=[],tab:g,plan:x,streaming:w,plansAvailable:M,requestConfirm:F,onTabChange:R,onClose:z,onBack:V}){let{t:W}=i(),G=ie(),K=o(e=>e.capabilities),q=[{id:`terminal`,icon:N,label:W(`terminal:workspace.terminal`)},{id:`processes`,icon:s,label:W(`terminal:workspace.processes`)},{id:`changes`,icon:S,label:W(`chat:workbench.projectChanges`)},{id:`sources`,icon:k,label:W(`chat:workbench.sources`)},{id:`files`,icon:C,label:W(`chat:workbench.taskSnapshots`)},...M?[{id:`plan`,icon:T,label:W(`chat:sessionContext.plan`)}]:[],{id:`browser`,icon:b,label:W(`common:webPreview.title`)},{id:`side-chat`,icon:A,label:W(`chat:sideChat.title`)}],se=(0,H.useMemo)(()=>O(g),[g]),J=D(e=>Object.prototype.hasOwnProperty.call(e.sessions,l)?e.sessions[l]:void 0)??se,ce=(0,H.useRef)(null),Y=J.pages.find(e=>e.id===J.activeId)??J.pages[0],X=e=>e.kind===`new`?{id:`new`,icon:j,label:W(`chat:workbench.newTab`)}:q.find(t=>t.id===e.kind)??q[0],le=t=>requestAnimationFrame(()=>document.getElementById(`${e}-${t}-tab`)?.focus()),ue=(0,H.useEffectEvent)(()=>{r&&document.getElementById(`${e}-${J.activeId}-tab`)?.focus()});(0,H.useEffect)(()=>{let e=requestAnimationFrame(()=>ue());return()=>cancelAnimationFrame(e)},[e,J.activeId]);let Z=e=>{if(e.type===`view`&&!D.getState().sessions[l])return;[`add`,`open`,`select`,`close`,`kind`].includes(e.type)&&window.dispatchEvent(new Event(L));let t=E(J,e);D.getState().update(l,g,e);let n=t.pages.find(e=>e.id===t.activeId);n&&R(n.kind),(e.type===`add`||e.type===`select`||e.type===`close`)&&le(t.activeId),e.type===`close`&&J.pages.length===1&&z()},Q=W(`chat:sessionContext.addPage`),de=W(`chat:sessionContext.pageLimit`),fe=(0,U.jsx)(I,{variant:`ghost`,size:`icon`,className:`max-[650px]:size-11`,disabled:J.pages.length>=12,"aria-label":Q,title:J.pages.length>=12?de:Q,onClick:()=>Z({type:`add`,kind:`new`}),children:(0,U.jsx)(j,{size:16})}),$=(0,U.jsxs)(`div`,{"data-session-context-panel":!0,className:`flex h-full min-h-0 min-w-0 flex-col bg-panel text-content`,children:[(0,U.jsxs)(`header`,{"data-window-drag-region":!0,className:`auxiliary-page-header flex h-12 shrink-0 items-center gap-1 border-b border-stroke-soft px-2`,children:[V&&(0,U.jsx)(I,{variant:`ghost`,size:`icon`,className:`max-[650px]:size-11`,"aria-label":W(`chat:workbench.backToConversation`),title:W(`chat:workbench.backToConversation`),onClick:V,children:(0,U.jsx)(c,{size:16})}),(0,U.jsx)(`div`,{ref:ce,className:`flex min-w-0 flex-1 items-center gap-0.5 overflow-x-auto px-px py-1 [scrollbar-width:none]`,role:`tablist`,"aria-label":W(`chat:sessionContext.title`),onKeyDown:e=>{if(!(e.target instanceof HTMLElement)||e.target.getAttribute(`role`)!==`tab`)return;if(e.key===`Delete`){e.preventDefault(),Z({type:`close`,id:Y.id});return}if(![`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key))return;e.preventDefault();let t=J.pages.findIndex(e=>e.id===Y.id),n=e.key===`Home`?0:e.key===`End`?J.pages.length-1:(t+(e.key===`ArrowRight`?1:-1)+J.pages.length)%J.pages.length;Z({type:`select`,id:J.pages[n].id})},children:J.pages.map(t=>{let{icon:n,label:r}=X(t);return(0,U.jsxs)(`div`,{className:`relative flex max-w-40 min-w-20 shrink-0 items-center rounded-sm transition-colors duration-(--d-fast) ${t.id===Y.id?`bg-key font-medium text-content shadow-key ring-1 ring-key-border after:absolute after:inset-x-2 after:bottom-0 after:h-0.5 after:rounded-full after:bg-star`:`text-content-muted hover:bg-surface-hover hover:text-content`}`,children:[(0,U.jsxs)(`button`,{id:`${e}-${t.id}-tab`,type:`button`,role:`tab`,"aria-selected":t.id===Y.id,"aria-controls":`${e}-${t.id}-content`,tabIndex:t.id===Y.id?0:-1,className:`flex h-7 min-w-0 flex-1 items-center gap-1.5 rounded-sm pl-2 text-sm focus-visible:outline-offset-0 max-[650px]:h-11`,onClick:()=>Z({type:`select`,id:t.id}),children:[(0,U.jsx)(n,{size:14,className:`shrink-0`}),(0,U.jsx)(`span`,{className:`truncate`,children:r})]}),(0,U.jsx)(`button`,{type:`button`,className:`mx-0.5 grid size-5 shrink-0 place-items-center rounded-xs text-content-muted hover:bg-surface-hover hover:text-content focus-visible:outline-offset-0 max-[650px]:size-11`,"aria-label":`${W(`chat:sessionContext.closePage`)} · ${r}`,onClick:()=>Z({type:`close`,id:t.id}),children:(0,U.jsx)(P,{size:12})})]},t.id)})}),fe]}),J.pages.map(t=>{let n=X(t),r=Y.id===t.id;return(0,U.jsx)(`div`,{id:`${e}-${t.id}-content`,role:`tabpanel`,"aria-labelledby":`${e}-${t.id}-tab`,className:r?`flex min-h-0 flex-1 flex-col`:`hidden`,hidden:!r,children:n.id===`new`?r&&(0,U.jsx)(oe,{tools:q.map(e=>({...e,disabled:e.id===`terminal`||e.id===`processes`?!G||!a(K,`terminal`):e.id===`changes`&&!a(K,`vcs`)})),onOpenUrl:e=>{Z({type:`open`,kind:`browser`,replaceId:t.id}),D.getState().update(l,`browser`,{type:`browser`,id:t.id,url:e,draft:e})},onSelect:e=>Z({type:`open`,kind:e,replaceId:t.id})}):n.id===`changes`?r&&(0,U.jsx)(v,{sessionId:l,cwd:u,streaming:w,view:t.view,onViewChange:e=>Z({type:`view`,id:t.id,patch:e})}):n.id===`sources`?r&&(0,U.jsx)(_,{sources:f,view:t.view,onViewChange:e=>Z({type:`view`,id:t.id,patch:e})}):n.id===`terminal`?r&&(0,U.jsx)(d,{sessionId:l,cwd:u,terminalId:t.resourceId||void 0,onCreated:e=>D.getState().update(l,g,{type:`resource`,id:t.id,resourceId:e})}):n.id===`processes`?r&&(0,U.jsx)(p,{view:t.view,onViewChange:e=>Z({type:`view`,id:t.id,patch:e}),sessionId:l,onOpenTerminal:e=>Z({type:`open`,kind:`terminal`,resourceId:e})}):n.id===`side-chat`?(0,U.jsx)(h,{parentId:l,active:r}):n.id===`browser`?(0,U.jsx)(y,{page:t,onChange:e=>Z({type:`browser`,id:t.id,...e})}):r&&(n.id===`files`?(0,U.jsx)(ae,{view:t.view,onViewChange:e=>Z({type:`view`,id:t.id,patch:e}),sessionId:l,streaming:w,requestConfirm:F}):(0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-3`,children:x?.items?.length?(0,U.jsx)(m,{plan:x}):(0,U.jsx)(B,{compact:!0,title:W(`chat:sessionContext.planEmpty`)})}))},t.id)})]});return t?(0,U.jsx)(re,{open:!0,onOpenChange:e=>!e&&z(),children:(0,U.jsxs)(te,{id:e,side:`right`,showCloseButton:!1,className:`gap-0 overflow-hidden p-0`,style:{top:`var(--pisper-safe-area-top)`,right:`var(--pisper-safe-area-right)`,bottom:`var(--pisper-safe-area-bottom)`,height:`auto`,width:`min(calc(100vw - var(--pisper-safe-area-left) - var(--pisper-safe-area-right)), 420px)`,maxWidth:`none`},children:[(0,U.jsx)(ee,{className:`sr-only`,children:(0,U.jsx)(ne,{children:W(`chat:sessionContext.title`)})}),$]})}):(0,U.jsx)(`aside`,{id:e,tabIndex:n?-1:void 0,className:`h-full min-h-0 w-full overflow-hidden border-l border-stroke bg-panel`,"aria-label":W(`chat:sessionContext.title`),children:$})}export{K as SessionContextPanel};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{u as t}from"./vendor-router-CSN_DGvx.js";import{i as n,r}from"./vendor-react-DwNgTV1j.js";import{f as i,t as a}from"./routes-DIeaqWVc.js";import{t as o}from"./use-i18n-BuN5i-jP.js";import{n as s,t as c}from"./usePhoneShell-Bkus67DO.js";import"./public-CNoWpIiC.js";import{t as l}from"./PhoneMenuButton-WhIGM1zy.js";import{t as u}from"./button-CCcCN8tE.js";import{t as d}from"./useSessionListQuery-DdFrJGiI.js";import{n as f}from"./PageState-Cz6vFMXv.js";import{n as p,r as m}from"./session-home-BrU5Pj9S.js";var h=e(n(),1),g=r();function _(e){let{t:n}=o(),r=t(),_=c(),v=s(),y=!_||v,[b]=(0,h.useState)(m),x=d(),S=p({lastId:b,data:x.data,failed:x.isError&&!x.isFetching}),C=S.kind===`session`?i(S.id):S.kind===`draft`?i():``;(0,h.useEffect)(()=>{C&&r(C,{replace:!0,state:a})},[r,C]);let w=(0,g.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-panel`,children:[!y&&(0,g.jsx)(`header`,{className:`flex h-14 shrink-0 items-center bg-panel px-1`,children:(0,g.jsx)(l,{})}),(0,g.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center`,children:S.kind===`error`?(0,g.jsx)(f,{kind:`error`,title:n(`board:home.loadFailed`),description:n(`board:home.loadFailedHint`),action:(0,g.jsxs)(`div`,{className:`flex flex-wrap justify-center gap-2`,children:[(0,g.jsx)(u,{variant:`secondary`,className:`pointer-coarse:min-h-11`,onClick:()=>void x.refetch(),children:n(`navigation:more.retry`)}),(0,g.jsx)(u,{variant:`ghost`,className:`pointer-coarse:min-h-11`,onClick:()=>r(i(),{state:a}),children:n(`board:home.startDraft`)})]})}):(0,g.jsx)(f,{kind:`loading`,title:n(`board:home.loading`)})})]});return(0,g.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,"data-session-shell":y?`desktop`:`phone`,"data-session-home":S.kind,children:(0,g.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1`,children:w})})}export{_ as SessionHome};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{u as t}from"./vendor-router-CSN_DGvx.js";import{i as n,r}from"./vendor-react-DwNgTV1j.js";import{f as i,t as a}from"./routes-DIeaqWVc.js";import{t as o}from"./use-i18n-Cyg5th6Z.js";import{n as s,t as c}from"./usePhoneShell-CDP-O4Gc.js";import"./public-CGbDaxd0.js";import{t as l}from"./PhoneMenuButton-CBT0H1Cn.js";import{t as u}from"./button-CCcCN8tE.js";import{t as d}from"./useSessionListQuery-BpWfS-tU.js";import{n as f}from"./PageState-Cz6vFMXv.js";import{n as p,r as m}from"./session-home-LwsMdqJu.js";var h=e(n(),1),g=r();function _(e){let{t:n}=o(),r=t(),_=c(),v=s(),y=!_||v,[b]=(0,h.useState)(m),x=d(),S=p({lastId:b,data:x.data,failed:x.isError&&!x.isFetching}),C=S.kind===`session`?i(S.id):S.kind===`draft`?i():``;(0,h.useEffect)(()=>{C&&r(C,{replace:!0,state:a})},[r,C]);let w=(0,g.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-panel`,children:[!y&&(0,g.jsx)(`header`,{className:`flex h-14 shrink-0 items-center bg-panel px-1`,children:(0,g.jsx)(l,{})}),(0,g.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center`,children:S.kind===`error`?(0,g.jsx)(f,{kind:`error`,title:n(`board:home.loadFailed`),description:n(`board:home.loadFailedHint`),action:(0,g.jsxs)(`div`,{className:`flex flex-wrap justify-center gap-2`,children:[(0,g.jsx)(u,{variant:`secondary`,className:`pointer-coarse:min-h-11`,onClick:()=>void x.refetch(),children:n(`navigation:more.retry`)}),(0,g.jsx)(u,{variant:`ghost`,className:`pointer-coarse:min-h-11`,onClick:()=>r(i(),{state:a}),children:n(`board:home.startDraft`)})]})}):(0,g.jsx)(f,{kind:`loading`,title:n(`board:home.loading`)})})]});return(0,g.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,"data-session-shell":y?`desktop`:`phone`,"data-session-home":S.kind,children:(0,g.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1`,children:w})})}export{_ as SessionHome};
@@ -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-Cyg5th6Z.js";import{t as i}from"./useQuery-DdcpUQhO.js";import{i as a}from"./runtime-capabilities-CHYOF_hE.js";import{t as o}from"./runtime-capabilities-store-DWW9jolt.js";import{t as s}from"./createLucideIcon-Cd-3GVxJ.js";import{i as c}from"./permission-rules-api-CAxfABVR.js";import{t as l}from"./check-2vYc6QaP.js";import{a as u,c as d,i as f,l as p,n as m,o as h,r as g,t as _}from"./SessionBrowserPane-D2Z-J6tl.js";import{t as v}from"./earth-Ddy13fHh.js";import{t as y}from"./ellipsis-CfGKfbq6.js";import{o as b}from"./GitDiffViewer-XzdYQWbX.js";import{B as ee,I as te,R as x,c as ne,g as S,s as re,v as C}from"./side-chat-context-Cm84nqzk.js";import{t as w}from"./git-branch-N7LGjtzt.js";import{t as ie}from"./message-square-SKjZyY3v.js";import{t as ae}from"./plus-fQbSqB1n.js";import{t as T}from"./refresh-cw-TbWxTY4K.js";import{t as oe}from"./square-terminal-BVG6cUT1.js";import{t as se}from"./x-07u4-129.js";import{c as ce,i as E,p as le,r as D,t as O}from"./dropdown-menu-CFIFNaKO.js";import{i as ue,n as de,t as fe}from"./popover-DUWwlhPy.js";import{t as pe}from"./segmented-control-BlM_GKV6.js";import{t as k}from"./utils-C8uzG5AZ.js";import{t as A}from"./button-CCcCN8tE.js";import{t as me}from"./chat-api-DgJdhfOP.js";import{a as j,r as M}from"./format-DMJQzoZ7.js";import{t as he}from"./StatusGlyph-1KgitlUg.js";import{t as ge}from"./session-change-summary-api-CbVgbX2o.js";import{n as N,t as P}from"./PageState-Cz6vFMXv.js";import{i as _e,n as F,r as ve}from"./MarkdownMessage-B-IixrQ3.js";import{t as ye}from"./route-context-DvWDul4T.js";import"./web-preview-Bo8YMR-t.js";import{n as be}from"./terminal-context-aIsIJPn8.js";var xe=s(`folder-search`,[[`path`,{d:`M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1`,key:`1bw5m7`}],[`path`,{d:`m21 21-1.9-1.9`,key:`1g2n9r`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}]]),Se=s(`panel-right-close`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m8 9 3 3-3 3`,key:`12hl5m`}]]),I=e(t(),1),L=n(),R={running:{kind:`run`,color:`text-st-run`},starting:{kind:`run`,color:`text-st-run`},queued:{kind:`queued`,color:`text-st-queue`},completed:{kind:`done`,color:`text-st-done`},failed:{kind:`failed`,color:`text-st-fail`},interrupted:{kind:`stopped`,color:`text-st-queue`},blocked:{kind:`queued`,color:`text-st-queue`}};function Ce(e,t){return t(e===`queued`?`chat:agentRunActivity.teamTaskQueued`:e===`starting`?`chat:agentRunActivity.teamTaskStarting`:e===`running`?`chat:agentRunActivity.teamTaskRunning`:e===`completed`?`chat:agentRunActivity.teamTaskCompleted`:e===`failed`?`chat:agentRunActivity.teamTaskFailed`:e===`interrupted`?`chat:agentRunActivity.teamTaskInterrupted`:e===`blocked`?`chat:agentRunActivity.teamTaskBlocked`:`chat:agentRunActivity.teamTaskStatusUpdated`)}function z(e,t){return e.status===`active`?e.mode===`team`?t(`chat:focusSession.runningAsTeam`):t(`chat:focusSession.runningAutonomously`):e.status===`paused`?t(`chat:focusSession.goalPaused`):e.status===`complete`?t(`chat:focusSession.goalComplete`):e.status===`budget_limited`?t(`chat:focusSession.goalReachedItsBudget`):``}function B({title:e,children:t}){return(0,L.jsxs)(`section`,{className:`grid min-w-0 gap-2`,"aria-label":e,children:[(0,L.jsx)(`h3`,{className:`text-xs font-semibold text-content-secondary`,children:e}),t]})}function V({status:e,name:t,detail:n,t:r}){let i=R[String(e)]??{kind:`queued`,color:`text-st-queue`};return(0,L.jsxs)(`li`,{className:`flex min-w-0 items-start gap-2 py-1.5 text-xs`,children:[(0,L.jsx)(he,{status:i.kind,className:`mt-px size-3.5 ${i.color}`}),(0,L.jsxs)(`span`,{className:`grid min-w-0 flex-1 gap-0.5`,children:[(0,L.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,L.jsx)(`strong`,{className:`min-w-0 truncate font-medium text-content`,children:t}),(0,L.jsx)(`span`,{className:`flex-none text-content-muted`,children:Ce(e,r)})]}),n&&(0,L.jsx)(`span`,{className:`min-w-0 break-words text-content-muted`,children:n})]})]})}function H(e){let t=new Map;for(let n of e){if(n?.type!==`agent`||!n.agent||typeof n.agent!=`object`)continue;let e=n.agent,r=String(e.id||e.taskName||t.size);t.set(r,e)}return[...t.values()]}function we({plan:e,goal:t,team:n,activity:i}){let{t:a}=r(),o=Array.isArray(n?.tasks)?n.tasks:[],s=H(i),c=!!(t?.id&&String(t.objective||``).trim()),l=!!e?.items?.length;if(!c&&!l&&!o.length&&!s.length)return(0,L.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-3`,children:(0,L.jsx)(P,{compact:!0,icon:x,title:a(`chat:sessionContext.planEmpty`)})});let u=Number(t?.mode===`team`?t?.teamTokenBudget:t?.tokenBudget)||0;return(0,L.jsxs)(`div`,{className:`grid min-h-0 flex-1 content-start gap-5 overflow-y-auto p-3`,"data-inspector-plan":!0,children:[c&&t&&(0,L.jsx)(B,{title:a(`board:inspector.goal`),children:(0,L.jsxs)(`div`,{className:`grid gap-1.5 rounded-md border border-stroke-soft bg-surface-subtle p-3 text-xs`,children:[(0,L.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-content`,children:String(t.objective)}),(0,L.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-2 text-content-muted tabular-nums`,children:[(0,L.jsx)(`span`,{children:z(t,a)}),(0,L.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,L.jsx)(`span`,{children:u>0?a(`chat:focusSession.usedBudgetTokensUsed`,{used:M(t.tokensUsed),budget:M(u)}):a(`chat:focusSession.usedUnlimitedGoalTokens`,{used:M(t.tokensUsed)})})]})]})}),l&&(0,L.jsx)(B,{title:a(`board:inspector.plan`),children:(0,L.jsx)(p,{plan:e})}),o.length>0&&(0,L.jsx)(B,{title:a(`board:inspector.team`),children:(0,L.jsx)(`ul`,{className:`divide-y divide-stroke-soft`,children:o.map((e,t)=>(0,L.jsx)(V,{status:e.status,name:e.taskName||a(`chat:agentRunActivity.subagent`),detail:e.error||e.output||``,t:a},e.id||`${e.taskName}-${t}`))})}),s.length>0&&(0,L.jsx)(B,{title:a(`board:inspector.subAgents`),children:(0,L.jsx)(`ul`,{className:`divide-y divide-stroke-soft`,children:s.map((e,t)=>(0,L.jsx)(V,{status:e.status,name:String(e.taskName||``).trim()||a(`chat:agentRunActivity.subagent`),detail:String(e.error||e.message||``).trim(),t:a},String(e.id||t)))})})]})}var U=100;function W(e){let t=e.trim().toUpperCase();return t===`??`||t.includes(`A`)?`created`:t.includes(`D`)?`deleted`:t.includes(`R`)?`renamed`:t.includes(`M`)?`modified`:`other`}var Te={modified:`M`,created:`A`,deleted:`D`,renamed:`R`,other:`·`},Ee={modified:`text-content-secondary`,created:`text-st-done`,deleted:`text-st-fail`,renamed:`text-content-secondary`,other:`text-content-muted`};function G(e){let t=e.replace(/\\/g,`/`),n=t.lastIndexOf(`/`);return n<0?{directory:``,name:t}:{directory:t.slice(0,n+1),name:t.slice(n+1)}}function K(e,t){return/^(?:[a-zA-Z]:[\\/]|\/|\\\\)/.test(t)?t:`${e.replace(/[\\/]+$/,``)}/${t}`}function De(e,t){window.dispatchEvent(new CustomEvent(ye,{detail:{message:e,tone:t}}))}function q({added:e,removed:t}){return e===null||t===null?null:(0,L.jsxs)(`span`,{className:`flex-none font-mono text-xs tabular-nums`,children:[(0,L.jsxs)(`span`,{className:`text-success`,children:[`+`,e]}),` `,(0,L.jsxs)(`span`,{className:`text-danger`,children:[`−`,t]})]})}function J({status:e,children:t}){let{t:n}=r();return(0,L.jsxs)(`footer`,{className:`mt-auto flex h-10 shrink-0 items-center gap-2 border-t border-stroke-soft pr-1.5 pl-3 text-xs text-content-muted`,"data-changes-footer":!0,children:[(0,L.jsx)(`span`,{className:`flex min-w-0 flex-1 items-center gap-1.5 truncate`,children:e}),(0,L.jsxs)(O,{children:[(0,L.jsx)(le,{asChild:!0,children:(0,L.jsx)(A,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`pointer-coarse:size-11`,"aria-label":n(`board:changes.more`),title:n(`board:changes.more`),"data-changes-more":!0,children:(0,L.jsx)(y,{"aria-hidden":`true`})})}),(0,L.jsx)(D,{align:`end`,side:`top`,className:`min-w-48`,children:t})]})]})}function Y({status:e}){let{t}=r(),n=t(e===`created`?`board:changes.statusCreated`:e===`deleted`?`board:changes.statusDeleted`:e===`renamed`?`board:changes.statusRenamed`:`board:changes.statusModified`);return(0,L.jsxs)(`span`,{className:k(`w-3.5 flex-none text-center font-mono text-xs font-semibold`,Ee[e]),title:n,children:[(0,L.jsx)(`span`,{"aria-hidden":`true`,children:Te[e]}),(0,L.jsx)(`span`,{className:`sr-only`,children:n})]})}function X({files:e,selected:t,label:n,onSelect:r}){let i=(0,I.useRef)(null);return(0,L.jsxs)(`ul`,{ref:i,"aria-label":n,className:`max-h-[34%] min-h-11 shrink-0 overflow-y-auto border-b border-stroke-soft py-1`,onKeyDown:e=>{if(![`ArrowDown`,`ArrowUp`,`Home`,`End`].includes(e.key))return;let t=[...i.current?.querySelectorAll(`[data-change-file]`)??[]],n=t.findIndex(e=>e===document.activeElement),a=t[e.key===`Home`?0:e.key===`End`?t.length-1:Math.min(t.length-1,Math.max(0,n+(e.key===`ArrowDown`?1:-1)))];a&&(e.preventDefault(),a.focus(),r(a.dataset.changeFile||``))},"data-change-list":!0,children:[e.slice(0,U).map(e=>{let n=e.path===t,{directory:i,name:a}=G(e.path);return(0,L.jsx)(`li`,{className:`px-1`,children:(0,L.jsxs)(`button`,{type:`button`,title:e.path,"aria-label":[e.path,Te[e.status],e.added!==null&&e.removed!==null?`+${e.added} −${e.removed}`:``,e.note||``].filter(Boolean).join(` `),"aria-current":n?`true`:void 0,"data-change-file":e.path,className:k(`flex h-8 w-full min-w-0 items-center gap-2 rounded-sm px-2 text-left text-xs transition-colors duration-(--d-fast) focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus max-[650px]:h-11 pointer-coarse:h-11`,n?`bg-solid shadow-[inset_0_0_0_1px_var(--stroke-strong)]`:`hover:bg-surface-hover`),onClick:()=>r(e.path),children:[(0,L.jsx)(Y,{status:e.status}),(0,L.jsxs)(`span`,{className:`flex min-w-0 flex-1 font-mono`,children:[(0,L.jsx)(`span`,{className:`min-w-0 truncate text-content-muted`,children:i}),(0,L.jsx)(`span`,{className:`flex-none text-content`,children:a})]}),e.note&&(0,L.jsx)(`span`,{className:`flex-none text-content-muted`,children:e.note}),(0,L.jsx)(q,{added:e.added,removed:e.removed})]})},e.path)}),e.length>U&&(0,L.jsx)(`li`,{className:`px-3 py-1.5 text-xs text-content-muted tabular-nums`,children:(0,L.jsx)(Oe,{count:e.length-U})})]})}function Oe({count:e}){let{t}=r();return(0,L.jsx)(L.Fragment,{children:t(`chat:focusSession.gitMoreFiles`,{count:e})})}var Z=600;function ke({sessionId:e,file:t,scope:n,revision:i,view:a,onViewChange:o,footer:s}){let{t:l}=r(),u=c(e=>e.diffMode),f=c(e=>e.setDiffMode),p=(0,I.useRef)(null),[m,h]=(0,I.useState)(0);(0,I.useLayoutEffect)(()=>{let e=p.current;if(!e)return;let t=()=>h(e.clientWidth);t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);let g=m===0||m>=Z,_=g?u:`unified`,v=g?void 0:l(`board:changes.splitTooNarrow`);return(0,L.jsxs)(`section`,{ref:p,className:`flex min-h-0 flex-1 flex-col`,"aria-label":t.path,"data-change-detail":t.path,children:[(0,L.jsxs)(`header`,{className:`flex min-h-10 shrink-0 items-center gap-2 border-b border-stroke-soft py-1.5 pr-2 pl-3`,children:[(0,L.jsx)(Y,{status:t.status}),(0,L.jsx)(`strong`,{className:`min-w-0 flex-1 truncate font-mono text-xs font-semibold text-content`,title:t.path,children:t.path}),(0,L.jsx)(q,{added:t.added,removed:t.removed}),(0,L.jsx)(pe,{size:`sm`,"aria-label":l(`board:changes.diffView`),title:v,"aria-description":v,value:_,onValueChange:f,options:[{value:`unified`,label:l(`board:changes.unified`)},{value:`split`,label:l(`board:changes.split`),disabled:!g}]})]}),(0,L.jsx)(d,{sessionId:e,path:t.path,scope:n,revision:i,mode:_,fill:!0,position:a?.reading?.[t.path],onReading:e=>o?.({reading:{...a?.reading,[t.path]:e}})},`${n}:${t.path}`),(0,L.jsx)(`footer`,{className:`flex min-h-10 shrink-0 flex-wrap items-center gap-1 border-t border-stroke-soft py-1 pr-1.5 pl-3 text-xs`,children:s})]})}function Ae({cwd:e,path:t}){let{t:n}=r();if(!window.pisperDesktop||!e)return null;let i=K(e,t);return(0,L.jsxs)(A,{type:`button`,variant:`ghost`,size:`sm`,className:`max-[650px]:h-11`,onClick:async()=>{try{await ve(i,_e),De(n(`common:markdownMessage.revealLocalPathOk`,{path:t}),`info`)}catch(e){De(e instanceof F&&e.reason===`unavailable`?n(`common:markdownMessage.revealLocalPathUnavailable`):e instanceof F&&e.reason===`timeout`?n(`common:markdownMessage.revealLocalPathTimeout`):n(`common:markdownMessage.revealLocalPathFailed`,{path:t}),`error`)}},children:[(0,L.jsx)(xe,{"aria-hidden":`true`}),n(`chat:chatMessage.fileActionReveal`)]})}function Q(e){return{path:e.path,status:e.status===`created`?`created`:e.status===`deleted`?`deleted`:`modified`,added:e.added,removed:e.removed}}function $(e,t){if(!e)return;let n=[];return e.lineEnding&&n.push(t(`chat:focusSession.fileChangesLineEnding`,{from:e.lineEnding[0].toUpperCase(),to:e.lineEnding[1].toUpperCase()})),e.bom?.[1]?n.push(t(`chat:focusSession.fileChangesBomAdded`)):e.bom&&n.push(t(`chat:focusSession.fileChangesBomRemoved`)),t(`chat:focusSession.fileChangesFormatOnly`,{detail:n.join(` · `)})}function je({sessionId:e,cwd:t,streaming:n,view:i,onViewChange:a,requestConfirm:o}){let{t:s,language:c}=r(),{changes:u,loading:d,running:f,snapshotRevision:p,writesDisabled:m,pendingCount:g,reversibleCount:_,displayedError:v,notice:y,runAction:b,refresh:ee}=h({sessionId:e,streaming:n,requestConfirm:o}),x=u?.files??[],ne=i?.expandedFiles?.[0],S=x.find(e=>e.path===ne)??x[0],re=e=>a?.({expandedFiles:[e]}),C=(e,t)=>f?.kind===e&&f.path===t,w=n?s(`chat:focusSession.gitWaitForRunToFinish`):void 0;return(0,L.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,"aria-label":s(`chat:focusSession.fileChanges`),"aria-busy":d||!!f,"data-changes-scope":`session`,children:[(0,L.jsx)(`header`,{className:`flex min-h-10 shrink-0 items-center gap-1.5 border-b border-stroke-soft py-1 pr-1.5 pl-3`,children:(0,L.jsxs)(`p`,{className:`flex min-w-0 flex-1 items-center gap-2 text-xs text-content-secondary`,children:[(0,L.jsx)(`span`,{className:`min-w-0 truncate`,children:s(`board:changes.sessionSummary`,{count:u?.summary.files??0})}),u&&u.summary.files>0&&(0,L.jsx)(q,{added:u.summary.added,removed:u.summary.removed})]})}),v&&(0,L.jsx)(`p`,{role:`alert`,className:`shrink-0 px-3 pt-2 text-xs text-st-fail`,children:v}),y&&!v&&(0,L.jsx)(`p`,{role:`status`,className:`shrink-0 px-3 pt-2 text-xs text-content-secondary`,children:y}),d&&!u?(0,L.jsx)(N,{kind:`loading`,title:s(`chat:focusSession.gitLoading`)}):x.length?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(X,{files:x.map(e=>({...Q(e),note:e.reverted?s(`chat:focusSession.fileChangesReverted`):e.approved?s(`chat:focusSession.fileChangesApproved`):$(e.formatChange,s)})),selected:S?.path??``,label:s(`board:changes.files`),onSelect:re}),S&&(0,L.jsx)(ke,{sessionId:e,file:Q(S),scope:`task`,revision:p,view:i,onViewChange:a,footer:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`span`,{className:k(`mr-auto flex min-w-0 items-center gap-1.5 truncate`,S.approved?`text-st-done`:`text-content-muted`),"data-change-state":S.reverted?`reverted`:S.approved?`approved`:`pending`,children:[S.approved&&!S.reverted&&(0,L.jsx)(l,{className:`size-3.5 flex-none`,"aria-hidden":`true`}),S.reverted?s(`board:changes.revertedAt`,{time:j(S.changedAt,c)}):S.approved?s(`board:changes.approvedAt`,{time:j(S.changedAt,c)}):s(`board:changes.pendingAt`,{time:j(S.changedAt,c)})]}),S.pending&&!S.approved&&!S.reverted&&(0,L.jsxs)(A,{type:`button`,variant:`ghost`,size:`sm`,disabled:m,title:w,onClick:()=>void b({kind:`approve`,path:S.path}),children:[C(`approve`,S.path)?(0,L.jsx)(T,{className:`animate-spin`}):(0,L.jsx)(l,{}),s(`chat:focusSession.fileChangesApproveFile`)]}),(0,L.jsxs)(A,{type:`button`,variant:`ghost`,size:`sm`,disabled:m||S.reverted||!S.canRevert,title:w,onClick:()=>void b({kind:`revert`,path:S.path}),children:[C(`revert`,S.path)?(0,L.jsx)(T,{className:`animate-spin`}):(0,L.jsx)(te,{}),s(`board:changes.revertFile`)]}),(0,L.jsx)(Ae,{cwd:t,path:S.path})]})})]}):!v&&(0,L.jsx)(P,{compact:!0,title:s(`chat:focusSession.fileChangesEmpty`)}),(0,L.jsxs)(J,{status:f?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(T,{className:`size-3.5 flex-none animate-spin`,"aria-hidden":`true`}),f.kind===`approve`?s(`chat:focusSession.fileChangesApproveAll`):s(`board:changes.revertAll`)]}):g>0?s(`board:changes.pending`,{count:g}):null,children:[g>0&&(0,L.jsxs)(E,{disabled:m,title:w,onSelect:()=>void b({kind:`approve`}),children:[(0,L.jsx)(l,{}),s(`chat:focusSession.fileChangesApproveAll`)]}),(u?.summary.files??0)>0&&(0,L.jsxs)(E,{disabled:m||_===0,title:w??s(`chat:focusSession.fileChangesRevertAllDescription`),onSelect:()=>void b({kind:`revert`}),children:[(0,L.jsx)(te,{}),s(`board:changes.revertAll`)]}),(g>0||(u?.summary.files??0)>0)&&(0,L.jsx)(ce,{}),(0,L.jsxs)(E,{disabled:d||!!f,onSelect:ee,children:[(0,L.jsx)(T,{}),s(`chat:focusSession.gitRefresh`)]})]})]})}function Me({sessionId:e,cwd:t,streaming:n,view:a,onViewChange:o}){let{t:s}=r(),c=i({queryKey:[`task-project-changes`,e,t,n],queryFn:({signal:t})=>me.getVcsChanges(e,{signal:t})}),l=(0,I.useMemo)(()=>S(c.data?.diff||``,c.data?.files.map(e=>e.path)||[],c.data?.diffTruncated),[c.data]),u=c.error?.message||c.data?.error,d=(c.data?.files||[]).map(e=>({path:e.path,status:W(e.status),added:Object.hasOwn(l.files,e.path)?l.files[e.path].added:null,removed:Object.hasOwn(l.files,e.path)?l.files[e.path].removed:null})),f=a?.expandedFiles?.[0],p=d.find(e=>e.path===f)??d[0];return(0,L.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,"aria-label":s(`chat:workbench.projectChanges`),"aria-busy":c.isFetching,"data-changes-scope":`workspace`,children:[(0,L.jsxs)(`header`,{className:`flex min-h-10 shrink-0 items-center gap-1.5 border-b border-stroke-soft py-1 pr-1.5 pl-3`,children:[(0,L.jsxs)(`p`,{className:`flex min-w-0 flex-1 items-center gap-2 text-xs text-content-secondary`,children:[(0,L.jsx)(`span`,{className:`min-w-0 truncate`,children:s(`board:changes.workspaceSummary`,{count:d.length})}),c.data?.isRepo&&!u&&d.length>0&&(0,L.jsx)(q,{added:l.added,removed:l.removed})]}),c.data?.branch&&(0,L.jsxs)(`span`,{className:`inline-flex h-5.5 max-w-[40%] min-w-0 flex-none items-center gap-1 rounded-xs border border-stroke px-1.5 font-mono text-xs text-content-secondary`,title:t,children:[(0,L.jsx)(w,{size:12,className:`flex-none`,"aria-hidden":`true`}),(0,L.jsx)(`span`,{className:`truncate`,children:c.data.branch})]})]}),c.isPending?(0,L.jsx)(N,{kind:`loading`,title:s(`chat:focusSession.gitLoading`)}):u?(0,L.jsx)(`p`,{role:`alert`,className:`p-3 text-xs text-st-fail`,children:u}):c.data?.isRepo?d.length?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(X,{files:d,selected:p?.path??``,label:s(`board:changes.files`),onSelect:e=>o?.({expandedFiles:[e]})}),p&&(0,L.jsx)(ke,{sessionId:e,file:p,scope:`project`,revision:c.dataUpdatedAt,view:a,onViewChange:o,footer:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{className:`mr-auto min-w-0 truncate font-mono text-content-muted`,title:t,children:t}),(0,L.jsx)(Ae,{cwd:t,path:p.path})]})})]}):(0,L.jsx)(P,{compact:!0,title:s(`chat:focusSession.fileChangesEmpty`)}):(0,L.jsx)(P,{compact:!0,title:s(`chat:workbench.notRepository`)}),(0,L.jsx)(J,{status:c.isFetching?(0,L.jsx)(T,{className:`size-3.5 flex-none animate-spin`,"aria-hidden":`true`}):null,children:(0,L.jsxs)(E,{disabled:c.isFetching,onSelect:()=>void c.refetch(),children:[(0,L.jsx)(T,{}),s(`chat:focusSession.gitRefresh`)]})})]})}function Ne({sessionId:e,cwd:t,streaming:n,scope:i,onScopeChange:a,vcsAvailable:o,view:s,onViewChange:c,requestConfirm:l}){let{t:u}=r();return(0,L.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,"data-inspector-changes":i,children:[(0,L.jsx)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-stroke-soft px-3 py-2`,children:(0,L.jsx)(pe,{size:`sm`,"aria-label":u(`board:inspector.changesScope`),value:i,onValueChange:a,options:[{value:`session`,label:u(`board:inspector.scopeSession`)},{value:`workspace`,label:u(`board:inspector.scopeWorkspace`),disabled:!o}]})}),s?i===`workspace`?(0,L.jsx)(Me,{sessionId:e,cwd:t,streaming:n,view:s,onViewChange:c}):(0,L.jsx)(je,{sessionId:e,cwd:t,streaming:n,view:s,onViewChange:c,requestConfirm:l}):(0,L.jsx)(`p`,{role:`status`,className:`p-4 text-sm text-content-muted`,children:u(`chat:focusSession.gitLoading`)})]})}var Pe=[];function Fe(e,t,n){return e===`changes`?n===`workspace`?`changes`:`files`:e===`terminal`?t:e===`files`?`sources`:e===`preview`?`browser`:e===`side-chat`?`side-chat`:null}function Ie({panelId:e,sessionId:t,cwd:n,streaming:s,plan:l,goal:d,team:p,activity:h,planTab:y,sources:te,mode:S,requestConfirm:w,onClose:T,onOpenComponents:ce,componentTabs:E,autoFocus:le=!1}){let{t:D}=r(),O=S===`sheet`,me=be(),j=o(e=>e.capabilities),M=!!me&&a(j,`terminal`),he=a(j,`vcs`),N=c(e=>e.tab),_e=c(e=>e.setTab),F=c(e=>e.terminalView),ve=c(e=>e.setTerminalView),ye=c(e=>e.changesView),xe=c(e=>e.setChangesView),R=C(e=>e.sessions[t]?.pages)??Pe,Ce=R.some(e=>e.kind===`side-chat`),z=N===`side-chat`&&!Ce||N===`plan`&&!y?`changes`:N,B=Fe(z,F,ye),V=B?R.find(e=>e.kind===B):void 0,H=!O&&E?E.tabs(n):[],[U,W]=(0,I.useState)(null),[Te,Ee]=(0,I.useState)(!1),G=H.some(e=>e.id===U)?U:null;(0,I.useEffect)(()=>W(null),[N]);let K=(0,I.useRef)(null);(0,I.useEffect)(()=>{K.current?.querySelector(`[role="tab"][aria-selected="true"]`)?.scrollIntoView?.({block:`nearest`,inline:`nearest`})},[z,G]);let De=(0,I.useRef)(le);(0,I.useEffect)(()=>{if(!De.current)return;let e=requestAnimationFrame(()=>K.current?.querySelector(`[role="tab"][aria-selected="true"]`)?.focus({preventScroll:!0}));return()=>cancelAnimationFrame(e)},[]),(0,I.useEffect)(()=>{if(!B||V||(B===`terminal`||B===`processes`)&&!M)return;let e=C.getState(),n=e.sessions[t]?.contentOpen??!1;e.update(t,B,{type:`add`,kind:B}),n||e.update(t,B,{type:`workspace`,contentOpen:!1})},[B,V,t,M]);let q=i({queryKey:[`session-change-summary`,t,s],queryFn:()=>ge(t),staleTime:1e4}),J=q.data?.status===`known`?q.data.changedFiles??0:0,Y=[{id:`changes`,icon:b,label:J>0?D(`board:inspector.changesCount`,{count:J}):D(`board:inspector.changes`)},{id:`terminal`,icon:oe,label:D(`board:inspector.terminal`)},{id:`files`,icon:ee,label:D(`board:inspector.files`)},{id:`preview`,icon:v,label:D(`board:inspector.preview`)},...y?[{id:`plan`,icon:x,label:D(`board:inspector.plan`)}]:[],...Ce?[{id:`side-chat`,icon:ie,label:D(`board:inspector.sideChat`)}]:[]],X=e=>{V&&C.getState().update(t,V.kind,{type:`view`,id:V.id,patch:e})},Oe=()=>{let n=R.find(e=>e.kind===`side-chat`);if(n&&C.getState().update(t,`side-chat`,{type:`close`,id:n.id}),_e(`changes`),O){T();return}requestAnimationFrame(()=>document.getElementById(`${e}-changes-tab`)?.focus())},Z=t=>`${e}-component-${t}-tab`,ke=e=>{W(null),_e(e)},Ae=t=>{if(![`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(t.key))return;t.preventDefault();let n=[...Y.map(t=>({fixed:t.id,id:`${e}-${t.id}-tab`})),...H.map(e=>({component:e.id,id:Z(e.id)}))],r=n.findIndex(e=>G?e.component===G:e.fixed===z),i=n[t.key===`Home`?0:t.key===`End`?n.length-1:(r+(t.key===`ArrowRight`?1:-1)+n.length)%n.length];i.component?W(i.component):i.fixed&&ke(i.fixed),requestAnimationFrame(()=>document.getElementById(i.id)?.focus())},Q=(0,L.jsx)(`p`,{role:`status`,className:`p-4 text-sm text-content-muted`,children:D(`chat:focusSession.gitLoading`)}),$;if(G&&E)$=E.render(G,{sessionId:t,cwd:n});else if(z===`changes`)$=(0,L.jsx)(Ne,{sessionId:t,cwd:n,streaming:s,scope:ye,onScopeChange:xe,vcsAvailable:he,view:V?.view,onViewChange:V?X:void 0,requestConfirm:w});else if(z===`terminal`)$=M?(0,L.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,L.jsx)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-stroke-soft px-3 py-2`,children:(0,L.jsx)(pe,{size:`sm`,"aria-label":D(`board:inspector.terminalScope`),value:F,onValueChange:ve,options:[{value:`terminal`,label:D(`board:inspector.terminal`)},{value:`processes`,label:D(`board:inspector.processes`)}]})}),(0,L.jsx)(I.Suspense,{fallback:Q,children:V?F===`processes`?(0,L.jsx)(f,{sessionId:t,view:V.view,onViewChange:X,onOpenTerminal:e=>{let n=C.getState(),r=n.sessions[t]?.pages.find(e=>e.kind===`terminal`);r?n.update(t,`terminal`,{type:`resource`,id:r.id,resourceId:e}):n.update(t,`terminal`,{type:`open`,kind:`terminal`,resourceId:e}),ve(`terminal`)}}):(0,L.jsx)(u,{sessionId:t,cwd:n,terminalId:V.resourceId||void 0,onCreated:e=>C.getState().update(t,`terminal`,{type:`resource`,id:V.id,resourceId:e})},V.id):Q})]}):(0,L.jsx)(P,{compact:!0,icon:oe,title:D(`board:inspector.terminalUnavailable`)});else if(z===`files`)$=V?(0,L.jsx)(g,{sources:te,view:V.view,onViewChange:X}):Q;else if(z===`preview`){let e=s?re([...h]):null;$=V?(0,L.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,"data-inspector-preview":!0,children:[e&&(0,L.jsx)(`div`,{className:`max-h-[50%] shrink-0 overflow-y-auto border-b border-stroke-soft p-2`,children:(0,L.jsx)(ne,{target:e,fallbackImage:e.previewImage,streaming:s})}),(0,L.jsx)(_,{page:V,onChange:e=>C.getState().update(t,`browser`,{type:`browser`,id:V.id,...e})})]}):Q}else $=z===`plan`?(0,L.jsx)(we,{plan:l,goal:d,team:p,activity:h}):(0,L.jsx)(m,{parentId:t,active:!0});return(0,L.jsxs)(`section`,{id:e,"aria-label":D(`board:inspector.label`),"data-session-inspector":S,"data-inspector-tab":z,"data-inspector-component":G??void 0,className:`flex h-full min-h-0 w-full min-w-0 flex-col bg-panel text-content`,children:[(0,L.jsxs)(`header`,{className:k(`flex shrink-0 items-center gap-1 border-b border-stroke-soft pr-1.5 pl-2`,O?`h-[52px]`:S===`aside`?`h-[52px] [[data-custom-titlebar]_&]:h-11 [[data-custom-titlebar]_&]:pointer-coarse:h-[52px]`:`h-11 pointer-coarse:h-[52px]`),children:[(0,L.jsxs)(`div`,{ref:K,role:`tablist`,"aria-label":D(`board:inspector.tabs`),className:`flex min-w-0 flex-1 items-center gap-0.5 overflow-x-auto [scrollbar-width:none]`,onKeyDown:Ae,children:[Y.map(({id:t,icon:n,label:r})=>{let i=!G&&t===z;return(0,L.jsxs)(`button`,{id:`${e}-${t}-tab`,type:`button`,role:`tab`,"aria-selected":i,"aria-controls":`${e}-body`,tabIndex:i?0:-1,"data-inspector-tab-id":t,className:k(`flex flex-none items-center gap-1.5 rounded-sm px-2 text-[13px] whitespace-nowrap transition-colors duration-(--d-fast) focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus`,O?`h-11 min-w-11 justify-center px-2.5`:`h-8 pointer-coarse:h-11 pointer-coarse:min-w-11`,i?`bg-solid font-medium text-content shadow-edge ring-1 ring-stroke-strong ring-inset`:`text-content-secondary hover:bg-surface-hover hover:text-content`),onClick:()=>ke(t),children:[!O&&(0,L.jsx)(n,{className:`size-3.5`,"aria-hidden":`true`}),r]},t)}),!G&&z===`side-chat`&&(0,L.jsx)(A,{type:`button`,variant:`ghost`,size:`icon-sm`,className:k(O&&`size-11`),"aria-label":D(`board:inspector.closeTab`,{tab:D(`board:inspector.sideChat`)}),onClick:Oe,children:(0,L.jsx)(se,{"aria-hidden":`true`})}),!O&&(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`mx-1 h-4 w-px flex-none bg-stroke`}),H.map(({id:t,label:n})=>{let r=t===G;return(0,L.jsx)(`button`,{id:Z(t),type:`button`,role:`tab`,"aria-selected":r,"aria-controls":`${e}-body`,tabIndex:r?0:-1,"data-inspector-component-tab":t,className:k(`flex h-8 max-w-40 flex-none items-center rounded-sm px-2 text-[13px] whitespace-nowrap transition-colors duration-(--d-fast) focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus pointer-coarse:h-11 pointer-coarse:min-w-11`,r?`bg-solid font-medium text-content shadow-edge ring-1 ring-stroke-strong ring-inset`:`text-content-secondary hover:bg-surface-hover hover:text-content`),onClick:()=>W(t),children:(0,L.jsx)(`span`,{className:`truncate`,children:n})},t)})]}),!O&&(0,L.jsxs)(fe,{open:Te,onOpenChange:Ee,children:[(0,L.jsx)(ue,{asChild:!0,children:(0,L.jsx)(A,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`flex-none`,"aria-label":D(`board:inspector.add`),title:D(`board:inspector.add`),"data-inspector-component-add":!0,children:(0,L.jsx)(ae,{"aria-hidden":`true`})})}),(0,L.jsxs)(de,{align:`end`,className:`w-64 text-xs`,children:[E?.addMenu?E.addMenu({cwd:n,onAdded:e=>{W(e),Ee(!1)}}):(0,L.jsx)(`p`,{className:`text-content-secondary`,children:D(`board:inspector.addHint`)}),ce&&(0,L.jsx)(A,{type:`button`,variant:`secondary`,size:`sm`,className:`self-start`,onClick:ce,children:D(`board:inspector.openComponents`)})]})]}),(0,L.jsx)(A,{type:`button`,variant:`ghost`,size:`icon-sm`,className:k(`flex-none`,O&&`size-11`),"aria-label":D(`board:inspector.close`),title:D(`board:inspector.close`),"aria-controls":e,onClick:T,children:S===`aside`?(0,L.jsx)(Se,{"aria-hidden":`true`}):(0,L.jsx)(se,{"aria-hidden":`true`})})]}),(0,L.jsx)(`div`,{id:`${e}-body`,role:`tabpanel`,"aria-labelledby":G?Z(G):`${e}-${z}-tab`,className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:$})]})}export{Ie as SessionInspector};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{f as t,l as n,u as r}from"./vendor-router-CSN_DGvx.js";import{i,r as a}from"./vendor-react-DwNgTV1j.js";import{f as o,r as s}from"./routes-DIeaqWVc.js";import{t as c}from"./use-i18n-BuN5i-jP.js";import{a as l,o as u,s as d,u as f}from"./placements-DNdBLaY4.js";import{t as p}from"./client-store-DF9a8Ka9.js";import{t as m}from"./usePhoneShell-Bkus67DO.js";import{t as h}from"./public-CNoWpIiC.js";import{t as g}from"./PhoneMenuButton-WhIGM1zy.js";import{t as _}from"./useSessionListQuery-DdFrJGiI.js";import{i as v,t as y}from"./session-home-BrU5Pj9S.js";var b=e(i(),1),x=a(),S=`(max-width: 1279px), (max-height: 760px)`,C=`(min-width: 960px) and (min-height: 640px)`;function w(e){let[t,n]=(0,b.useState)(()=>window.matchMedia(e).matches);return(0,b.useEffect)(()=>{let t=window.matchMedia(e),r=()=>n(t.matches);return r(),t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[e]),t}function T({context:e,ChatPage:i}){let a=r(),c=n(),{sessionId:l=``}=t(),u=m(),d=p(e=>e.client===`mobile-app`),f=w(`(min-width: 960px) and (min-height: 640px)`)&&d,C=w(S),T=!u||f,D=(0,b.useRef)(l);D.current=l;let O=(0,b.useRef)(c.state);O.current=c.state;let k=(0,b.useCallback)(e=>{if(!e||e===D.current)return;let t=D.current===`new`;a(o(e),{replace:t,state:t?O.current:void 0})},[a]),A=_(),j=!!(l&&l!==`new`&&A.data?.sessions.some(e=>e.id===l));(0,b.useEffect)(()=>{j&&v(l)},[j,l]);let M=E(e.notify,k),N=e.startNewTask,P=l===`new`,F=e.notify,I=h({onError:e=>F(e,`error`)}),L=P?I:void 0,R=(0,b.useMemo)(()=>({compact:C,overlayOnly:d,onOpenComponents:()=>a(s.components),componentTabs:M,onArchived:e=>{y(e),a(`/`,{replace:!0})},onHome:()=>a(`/`),onNewTask:N,newTaskDraft:L}),[C,d,a,M,N,L]),z=(0,b.useMemo)(()=>({...R,phone:{onNewTask:N}}),[R,N]);return(0,x.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,"data-session-shell":T?`desktop`:`phone`,children:(0,x.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1`,children:(0,x.jsx)(i,{notify:e.notify,navigate:e.navigate,browserNotify:e.browserNotify,pendingAsset:e.pendingAsset,onAssetConsumed:e.onAssetConsumed,requestText:e.requestText,requestConfirm:e.requestConfirm,routeSessionId:l,onRouteSessionChange:k,routeLeading:T?void 0:(0,x.jsx)(g,{}),pageChrome:T?R:z})})})}function E(e,t){let{language:n}=c(),{available:r,placed:i}=f(`session-panel`);return(0,b.useMemo)(()=>{if(r)return{tabs:e=>d(i,e,n),render:(n,{sessionId:r,cwd:a})=>{let o=i.find(e=>e.instance.instanceId===n);return o?(0,x.jsx)(b.Suspense,{fallback:null,children:(0,x.jsx)(u,{placed:o,sessionId:r,cwd:a,notify:e,onOpenSession:t})}):null},addMenu:({cwd:t,onAdded:n})=>(0,x.jsx)(b.Suspense,{fallback:null,children:(0,x.jsx)(l,{cwd:t,notify:e,onAdded:n})})}},[r,n,e,t,i])}export{S as SESSION_COMPACT_QUERY,C as SESSION_TABLET_QUERY,T as SessionShell};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{f as t,l as n,u as r}from"./vendor-router-CSN_DGvx.js";import{i,r as a}from"./vendor-react-DwNgTV1j.js";import{f as o,r as s}from"./routes-DIeaqWVc.js";import{t as c}from"./use-i18n-Cyg5th6Z.js";import{a as l,o as u,s as d,u as f}from"./placements-CuVM9Xxs.js";import{t as p}from"./client-store-BkVlLM-4.js";import{t as m}from"./usePhoneShell-CDP-O4Gc.js";import{t as h}from"./public-CGbDaxd0.js";import{t as g}from"./PhoneMenuButton-CBT0H1Cn.js";import{t as _}from"./useSessionListQuery-BpWfS-tU.js";import{i as v,t as y}from"./session-home-LwsMdqJu.js";var b=e(i(),1),x=a(),S=`(max-width: 1279px), (max-height: 760px)`,C=`(min-width: 960px) and (min-height: 640px)`;function w(e){let[t,n]=(0,b.useState)(()=>window.matchMedia(e).matches);return(0,b.useEffect)(()=>{let t=window.matchMedia(e),r=()=>n(t.matches);return r(),t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[e]),t}function T({context:e,ChatPage:i}){let a=r(),c=n(),{sessionId:l=``}=t(),u=m(),d=p(e=>e.client===`mobile-app`),f=w(`(min-width: 960px) and (min-height: 640px)`)&&d,C=w(S),T=!u||f,D=(0,b.useRef)(l);D.current=l;let O=(0,b.useRef)(c.state);O.current=c.state;let k=(0,b.useCallback)(e=>{if(!e||e===D.current)return;let t=D.current===`new`;a(o(e),{replace:t,state:t?O.current:void 0})},[a]),A=_(),j=!!(l&&l!==`new`&&A.data?.sessions.some(e=>e.id===l));(0,b.useEffect)(()=>{j&&v(l)},[j,l]);let M=E(e.notify,k),N=e.startNewTask,P=l===`new`,F=e.notify,I=h({onError:e=>F(e,`error`)}),L=P?I:void 0,R=(0,b.useMemo)(()=>({compact:C,overlayOnly:d,onOpenComponents:()=>a(s.components),componentTabs:M,onArchived:e=>{y(e),a(`/`,{replace:!0})},onHome:()=>a(`/`),onNewTask:N,newTaskDraft:L}),[C,d,a,M,N,L]),z=(0,b.useMemo)(()=>({...R,phone:{onNewTask:N}}),[R,N]);return(0,x.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,"data-session-shell":T?`desktop`:`phone`,children:(0,x.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1`,children:(0,x.jsx)(i,{notify:e.notify,navigate:e.navigate,browserNotify:e.browserNotify,pendingAsset:e.pendingAsset,onAssetConsumed:e.onAssetConsumed,requestText:e.requestText,requestConfirm:e.requestConfirm,routeSessionId:l,onRouteSessionChange:k,routeLeading:T?void 0:(0,x.jsx)(g,{}),pageChrome:T?R:z})})})}function E(e,t){let{language:n}=c(),{available:r,placed:i}=f(`session-panel`);return(0,b.useMemo)(()=>{if(r)return{tabs:e=>d(i,e,n),render:(n,{sessionId:r,cwd:a})=>{let o=i.find(e=>e.instance.instanceId===n);return o?(0,x.jsx)(b.Suspense,{fallback:null,children:(0,x.jsx)(u,{placed:o,sessionId:r,cwd:a,notify:e,onOpenSession:t})}):null},addMenu:({cwd:t,onAdded:n})=>(0,x.jsx)(b.Suspense,{fallback:null,children:(0,x.jsx)(l,{cwd:t,notify:e,onAdded:n})})}},[r,n,e,t,i])}export{S as SESSION_COMPACT_QUERY,C as SESSION_TABLET_QUERY,T as SessionShell};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-BuN5i-jP.js";import{t as i}from"./runtime-capabilities-store-B5Bam7pC.js";import{t as a}from"./arrow-left-B8oVrQ2S.js";import{t as o}from"./arrow-right-DqLOhpA2.js";import{r as s}from"./settings-navigation-DiP_AM1C.js";import{t as c}from"./utils-C8uzG5AZ.js";import{t as l}from"./kbd-CAufZTkl.js";import{n as u}from"./shortcuts-LBxOVau1.js";import{n as d,r as f}from"./back-navigation-CK7X_5Bc.js";var p=e(t(),1);function m(e,t=!0){let n=(0,p.useRef)(e);n.current=e,(0,p.useEffect)(()=>{if(!t)return;let e=new WeakSet,r=t=>{t.key===`Escape`&&d()&&e.add(t)},i=t=>{t.key!==`Escape`||t.defaultPrevented||t.isComposing||t.altKey||t.ctrlKey||t.metaKey||t.shiftKey||e.has(t)||u(t.target)&&!f(t)||(t.preventDefault(),n.current())};return window.addEventListener(`keydown`,r,!0),window.addEventListener(`keydown`,i),()=>{window.removeEventListener(`keydown`,r,!0),window.removeEventListener(`keydown`,i)}},[t])}var h=n(),g=`flex h-8 w-full min-w-0 items-center gap-2.5 rounded-[var(--r-md)] px-2.5 text-left text-[length:var(--app-font-size)] text-content transition-colors duration-(--d-fast) hover:bg-surface-hover focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus pointer-coarse:h-11`;function _({configSection:e,onSelectSection:t,onBack:n,onOpenFeatures:u,search:d,version:f,footer:p}){let{t:_}=r(),v=i(e=>e.capabilities),y=s(_,{capabilities:v});m(n);let b=_(`config:settingsShell.back`);return(0,h.jsxs)(`nav`,{"aria-label":_(`config:settingsShell.settingsNavigation`),"data-settings-sidebar":!0,className:`flex min-h-0 flex-1 flex-col animate-in fade-in duration-(--d-fast) motion-reduce:animate-none`,children:[(0,h.jsxs)(`div`,{"data-window-drag-region":!0,className:`flex h-[52px] flex-none items-center gap-2 pr-3.5 pl-2`,children:[(0,h.jsxs)(`button`,{type:`button`,"data-settings-back":!0,"aria-keyshortcuts":`Escape`,className:`flex h-8 items-center gap-2 rounded-[var(--r-md)] pr-2.5 pl-1.5 text-sm text-content-secondary transition-colors duration-(--d-fast) hover:bg-surface-hover hover:text-content focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus pointer-coarse:h-11`,onClick:n,children:[(0,h.jsx)(a,{className:`size-[18px]`,strokeWidth:1.75,"aria-hidden":`true`}),b]}),(0,h.jsx)(`span`,{className:`flex-1`}),(0,h.jsx)(l,{"aria-hidden":`true`,className:`border-transparent bg-transparent text-content-faint shadow-none pointer-coarse:hidden`,children:`Esc`})]}),(0,h.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-contain px-2 pb-2`,children:[(0,h.jsx)(`h2`,{className:`m-0 px-2.5 pt-2.5 pb-3 text-xl leading-7 font-semibold tracking-[-.01em] text-content`,children:_(`navigation:navigation.settings`)}),d&&(0,h.jsx)(`div`,{className:`relative z-20 mb-2 px-0.5`,children:d}),(0,h.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-px p-0`,children:y.map(n=>{let r=n.section===e;return(0,h.jsx)(`li`,{children:(0,h.jsxs)(`button`,{type:`button`,"data-settings-section":n.section,"aria-current":r?`page`:void 0,className:c(g,r&&`bg-surface-active font-medium hover:bg-surface-active`),onClick:()=>t(n.section),children:[(0,h.jsx)(n.icon,{className:`size-4 flex-none text-content-secondary`,strokeWidth:1.75,"aria-hidden":`true`}),(0,h.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:n.label}),n.section===`about`&&f&&(0,h.jsxs)(`small`,{className:`font-mono text-xs font-normal text-content-muted tabular-nums`,children:[`v`,f]})]})},n.section)})}),(0,h.jsxs)(`button`,{type:`button`,"data-settings-features-link":!0,className:`mt-4 flex min-h-8 w-full items-center gap-1 rounded-[var(--r-md)] px-2.5 py-1 text-left text-xs leading-5 text-content-muted transition-colors duration-(--d-fast) hover:bg-surface-hover hover:text-content-secondary focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus pointer-coarse:min-h-11`,onClick:u,children:[(0,h.jsx)(`span`,{className:`min-w-0 flex-1`,children:_(`config:settingsShell.featuresHint`)}),(0,h.jsx)(o,{className:`size-3.5 flex-none`,"aria-hidden":`true`})]})]}),p&&(0,h.jsx)(`div`,{className:`flex-none p-2`,children:p})]})}export{_ as SettingsSidebar};
1
+ 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-Cyg5th6Z.js";import{t as i}from"./runtime-capabilities-store-DWW9jolt.js";import{t as a}from"./arrow-left-B8oVrQ2S.js";import{t as o}from"./arrow-right-DqLOhpA2.js";import{r as s}from"./settings-navigation-DiP_AM1C.js";import{t as c}from"./utils-C8uzG5AZ.js";import{t as l}from"./kbd-CAufZTkl.js";import{n as u}from"./shortcuts-Cgx6V2jI.js";import{n as d,r as f}from"./back-navigation-CK7X_5Bc.js";var p=e(t(),1);function m(e,t=!0){let n=(0,p.useRef)(e);n.current=e,(0,p.useEffect)(()=>{if(!t)return;let e=new WeakSet,r=t=>{t.key===`Escape`&&d()&&e.add(t)},i=t=>{t.key!==`Escape`||t.defaultPrevented||t.isComposing||t.altKey||t.ctrlKey||t.metaKey||t.shiftKey||e.has(t)||u(t.target)&&!f(t)||(t.preventDefault(),n.current())};return window.addEventListener(`keydown`,r,!0),window.addEventListener(`keydown`,i),()=>{window.removeEventListener(`keydown`,r,!0),window.removeEventListener(`keydown`,i)}},[t])}var h=n(),g=`flex h-8 w-full min-w-0 items-center gap-2.5 rounded-[var(--r-md)] px-2.5 text-left text-[length:var(--app-font-size)] text-content transition-colors duration-(--d-fast) hover:bg-surface-hover focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus pointer-coarse:h-11`;function _({configSection:e,onSelectSection:t,onBack:n,onOpenFeatures:u,search:d,version:f,footer:p}){let{t:_}=r(),v=i(e=>e.capabilities),y=s(_,{capabilities:v});m(n);let b=_(`config:settingsShell.back`);return(0,h.jsxs)(`nav`,{"aria-label":_(`config:settingsShell.settingsNavigation`),"data-settings-sidebar":!0,className:`flex min-h-0 flex-1 flex-col animate-in fade-in duration-(--d-fast) motion-reduce:animate-none`,children:[(0,h.jsxs)(`div`,{"data-window-drag-region":!0,className:`flex h-[52px] flex-none items-center gap-2 pr-3.5 pl-2`,children:[(0,h.jsxs)(`button`,{type:`button`,"data-settings-back":!0,"aria-keyshortcuts":`Escape`,className:`flex h-8 items-center gap-2 rounded-[var(--r-md)] pr-2.5 pl-1.5 text-sm text-content-secondary transition-colors duration-(--d-fast) hover:bg-surface-hover hover:text-content focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus pointer-coarse:h-11`,onClick:n,children:[(0,h.jsx)(a,{className:`size-[18px]`,strokeWidth:1.75,"aria-hidden":`true`}),b]}),(0,h.jsx)(`span`,{className:`flex-1`}),(0,h.jsx)(l,{"aria-hidden":`true`,className:`border-transparent bg-transparent text-content-faint shadow-none pointer-coarse:hidden`,children:`Esc`})]}),(0,h.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-contain px-2 pb-2`,children:[(0,h.jsx)(`h2`,{className:`m-0 px-2.5 pt-2.5 pb-3 text-xl leading-7 font-semibold tracking-[-.01em] text-content`,children:_(`navigation:navigation.settings`)}),d&&(0,h.jsx)(`div`,{className:`relative z-20 mb-2 px-0.5`,children:d}),(0,h.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-px p-0`,children:y.map(n=>{let r=n.section===e;return(0,h.jsx)(`li`,{children:(0,h.jsxs)(`button`,{type:`button`,"data-settings-section":n.section,"aria-current":r?`page`:void 0,className:c(g,r&&`bg-surface-active font-medium hover:bg-surface-active`),onClick:()=>t(n.section),children:[(0,h.jsx)(n.icon,{className:`size-4 flex-none text-content-secondary`,strokeWidth:1.75,"aria-hidden":`true`}),(0,h.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:n.label}),n.section===`about`&&f&&(0,h.jsxs)(`small`,{className:`font-mono text-xs font-normal text-content-muted tabular-nums`,children:[`v`,f]})]})},n.section)})}),(0,h.jsxs)(`button`,{type:`button`,"data-settings-features-link":!0,className:`mt-4 flex min-h-8 w-full items-center gap-1 rounded-[var(--r-md)] px-2.5 py-1 text-left text-xs leading-5 text-content-muted transition-colors duration-(--d-fast) hover:bg-surface-hover hover:text-content-secondary focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus pointer-coarse:min-h-11`,onClick:u,children:[(0,h.jsx)(`span`,{className:`min-w-0 flex-1`,children:_(`config:settingsShell.featuresHint`)}),(0,h.jsx)(o,{className:`size-3.5 flex-none`,"aria-hidden":`true`})]})]}),p&&(0,h.jsx)(`div`,{className:`flex-none p-2`,children:p})]})}export{_ as SettingsSidebar};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-BuN5i-jP.js";import{t as i}from"./settings-QX0oWnVK.js";import{t as a}from"./button-CCcCN8tE.js";import{c as o}from"./shortcuts-LBxOVau1.js";import{a as s,i as c,l,n as u,o as d,s as f,t as p}from"./dialog-CtFjznlx.js";import{a as m,i as h,n as g,r as _,t as v}from"./ShortcutKeys-B1HCKuqe.js";var y=e(t(),1),b=n();function x({open:e,onOpenChange:t,onCustomize:n}){let{t:x}=r(),S=m(),C=o(e=>e.bindings),w=o(e=>e.boardBindings),[T]=(0,y.useState)(()=>document.activeElement instanceof HTMLElement?document.activeElement:null),E=(0,y.useRef)(null),[D,O]=(0,y.useState)(!0);return(0,b.jsx)(p,{open:e,onOpenChange:t,children:(0,b.jsxs)(c,{size:`wide`,scrollMode:`body`,className:`max-w-[min(92vw,760px)]`,"data-shortcut-help":!0,onOpenAutoFocus:e=>{E.current&&(e.preventDefault(),E.current.focus({preventScroll:!0}))},onCloseAutoFocus:e=>{T?.isConnected&&(e.preventDefault(),T.focus({preventScroll:!0}))},children:[(0,b.jsxs)(f,{className:`pr-8`,children:[(0,b.jsx)(l,{children:x(`board:shortcuts.shortcutHelp`)}),(0,b.jsx)(s,{children:x(`board:shortcuts.helpDescription`)})]}),(0,b.jsx)(u,{ref:E,tabIndex:0,role:`region`,"aria-label":x(`board:shortcuts.shortcutHelp`),"data-quiet-focus":D||void 0,onKeyDown:e=>{let{key:t,metaKey:n,ctrlKey:r,altKey:i}=e;t===`Escape`||t===`Shift`||n||r||i||O(!1)},onBlur:()=>O(!1),className:`-mx-4 px-4 py-2 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus data-quiet-focus:focus-visible:outline-none`,children:(0,b.jsx)(`div`,{className:`grid gap-x-8 gap-y-5 min-[720px]:grid-cols-2`,children:g.map(e=>(0,b.jsxs)(`section`,{"aria-labelledby":`shortcut-help-${e.id}`,"data-shortcut-help-group":e.id,className:e.id===`board`?`min-[720px]:row-span-2`:void 0,children:[(0,b.jsx)(`h3`,{id:`shortcut-help-${e.id}`,className:`text-[13px] leading-5 font-semibold text-content`,children:S.groups[e.id].title}),(0,b.jsx)(`p`,{className:`mb-1 text-xs text-content-muted`,children:S.groups[e.id].hint}),(0,b.jsx)(`dl`,{className:`divide-y divide-stroke-soft`,children:e.entries.map(e=>(0,b.jsxs)(`div`,{className:`flex min-h-7 min-w-0 items-center justify-between gap-3 py-0.5`,"data-shortcut-help-entry":_(e),children:[(0,b.jsx)(`dt`,{className:`min-w-0 text-[13px] text-content`,children:S.label(e)}),(0,b.jsx)(`dd`,{className:`flex-none`,children:(0,b.jsx)(v,{keys:h(e,C,w),className:`justify-end`})})]},_(e)))})]},e.id))})}),n&&(0,b.jsx)(d,{children:(0,b.jsxs)(a,{variant:`outline`,size:`dialogAction`,onClick:()=>{t(!1),n()},children:[(0,b.jsx)(i,{"aria-hidden":`true`}),x(`board:shortcuts.helpCustomize`)]})})]})})}export{x as ShortcutHelpDialog};
1
+ 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-Cyg5th6Z.js";import{t as i}from"./settings-QX0oWnVK.js";import{t as a}from"./button-CCcCN8tE.js";import{c as o}from"./shortcuts-Cgx6V2jI.js";import{a as s,i as c,l,n as u,o as d,s as f,t as p}from"./dialog-5MLAAE-f.js";import{a as m,i as h,n as g,r as _,t as v}from"./ShortcutKeys-CBl2x5Yl.js";var y=e(t(),1),b=n();function x({open:e,onOpenChange:t,onCustomize:n}){let{t:x}=r(),S=m(),C=o(e=>e.bindings),w=o(e=>e.boardBindings),[T]=(0,y.useState)(()=>document.activeElement instanceof HTMLElement?document.activeElement:null),E=(0,y.useRef)(null),[D,O]=(0,y.useState)(!0);return(0,b.jsx)(p,{open:e,onOpenChange:t,children:(0,b.jsxs)(c,{size:`wide`,scrollMode:`body`,className:`max-w-[min(92vw,760px)]`,"data-shortcut-help":!0,onOpenAutoFocus:e=>{E.current&&(e.preventDefault(),E.current.focus({preventScroll:!0}))},onCloseAutoFocus:e=>{T?.isConnected&&(e.preventDefault(),T.focus({preventScroll:!0}))},children:[(0,b.jsxs)(f,{className:`pr-8`,children:[(0,b.jsx)(l,{children:x(`board:shortcuts.shortcutHelp`)}),(0,b.jsx)(s,{children:x(`board:shortcuts.helpDescription`)})]}),(0,b.jsx)(u,{ref:E,tabIndex:0,role:`region`,"aria-label":x(`board:shortcuts.shortcutHelp`),"data-quiet-focus":D||void 0,onKeyDown:e=>{let{key:t,metaKey:n,ctrlKey:r,altKey:i}=e;t===`Escape`||t===`Shift`||n||r||i||O(!1)},onBlur:()=>O(!1),className:`-mx-4 px-4 py-2 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus data-quiet-focus:focus-visible:outline-none`,children:(0,b.jsx)(`div`,{className:`grid gap-x-8 gap-y-5 min-[720px]:grid-cols-2`,children:g.map(e=>(0,b.jsxs)(`section`,{"aria-labelledby":`shortcut-help-${e.id}`,"data-shortcut-help-group":e.id,className:e.id===`board`?`min-[720px]:row-span-2`:void 0,children:[(0,b.jsx)(`h3`,{id:`shortcut-help-${e.id}`,className:`text-[13px] leading-5 font-semibold text-content`,children:S.groups[e.id].title}),(0,b.jsx)(`p`,{className:`mb-1 text-xs text-content-muted`,children:S.groups[e.id].hint}),(0,b.jsx)(`dl`,{className:`divide-y divide-stroke-soft`,children:e.entries.map(e=>(0,b.jsxs)(`div`,{className:`flex min-h-7 min-w-0 items-center justify-between gap-3 py-0.5`,"data-shortcut-help-entry":_(e),children:[(0,b.jsx)(`dt`,{className:`min-w-0 text-[13px] text-content`,children:S.label(e)}),(0,b.jsx)(`dd`,{className:`flex-none`,children:(0,b.jsx)(v,{keys:h(e,C,w),className:`justify-end`})})]},_(e)))})]},e.id))})}),n&&(0,b.jsx)(d,{children:(0,b.jsxs)(a,{variant:`outline`,size:`dialogAction`,onClick:()=>{t(!1),n()},children:[(0,b.jsx)(i,{"aria-hidden":`true`}),x(`board:shortcuts.helpCustomize`)]})})]})})}export{x as ShortcutHelpDialog};