pisper 0.6.6 → 0.6.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +7 -7
- package/web/.vite/manifest.json +481 -336
- package/web/assets/AppDialog-DuxuKq-0.js +1 -0
- package/web/assets/{AppOverlays-C_WrmeqC.js → AppOverlays-YPxRUvLN.js} +1 -1
- package/web/assets/{AppSelect-DNIjPL7I.js → AppSelect-DEmkrcvY.js} +1 -1
- package/web/assets/{AppShortcuts-V38tUYTp.js → AppShortcuts-CA7hbebL.js} +1 -1
- package/web/assets/{AssetsPage-BmSnyLZ5.js → AssetsPage-CkNI_8qz.js} +1 -1
- package/web/assets/{ChannelsPage-Da3JaYaC.js → ChannelsPage-BYfRQyV0.js} +1 -1
- package/web/assets/ChatAppearancePage-N_2bunil.js +2 -0
- package/web/assets/{ChatDockView-5Aptiph6.js → ChatDockView-B4nZfbx5.js} +1 -1
- package/web/assets/ChatHistoryPage-Di3epmcR.js +1 -0
- package/web/assets/ChatPage-IN5m7Fqh.js +4 -0
- package/web/assets/ConfigPage-BKTEOlQE.js +1 -0
- package/web/assets/{DecisionsPage-BwJ7RTAE.js → DecisionsPage-DNAUZCij.js} +1 -1
- package/web/assets/{DesktopWindowControls-CLVd8sg6.js → DesktopWindowControls-BAnWUUAZ.js} +1 -1
- package/web/assets/{FileAttachmentPreview-C6QaQFwb.js → FileAttachmentPreview-x4AORCVt.js} +1 -1
- package/web/assets/{FloatingWidgets-QMhElaDR.js → FloatingWidgets-CdbBMke7.js} +1 -1
- package/web/assets/GitDiffViewer-oJDF7l74.js +2 -0
- package/web/assets/{ListDetailLayout-S-IBs4f_.js → ListDetailLayout-Ctr6r0OI.js} +1 -1
- package/web/assets/{MarkdownMessage-bfyuGoi1.js → MarkdownMessage-D9zxSf6j.js} +1 -1
- package/web/assets/McpPage-DaOkWcq6.js +1 -0
- package/web/assets/{MemoryPage-CC37SohP.js → MemoryPage-B5sqhaYW.js} +1 -1
- package/web/assets/MobileContextScreen-DiM-lGec.js +2 -0
- package/web/assets/MobileNavigation-DZx6cE9f.js +1 -0
- package/web/assets/MobileShellContext-Cvv0RcjA.js +1 -0
- package/web/assets/MobileViewportStabilizer-BAI_nmS_.js +1 -0
- package/web/assets/{PageHeader-75eh-Z_A.js → PageHeader-FBipSHuW.js} +1 -1
- package/web/assets/{PluginsPage-za6FNr_k.js → PluginsPage-BFLnVcnm.js} +1 -1
- package/web/assets/{QuickPromptIdeas-CEjBwWlM.js → QuickPromptIdeas-CVcEEpAl.js} +1 -1
- package/web/assets/{SchedulesPage-BR1oIqzi.js → SchedulesPage-CVnoI4wZ.js} +1 -1
- package/web/assets/SessionContextPanel-CEmCvPx4.js +2 -0
- package/web/assets/SessionFilesPane-CAdkivkE.js +2 -0
- package/web/assets/{SidebarUpdateStatus-Chfb-00K.js → SidebarUpdateStatus-Co3QAKmb.js} +1 -1
- package/web/assets/{SkillsPage-DfFjecBO.js → SkillsPage-d8t6_KDS.js} +1 -1
- package/web/assets/{TaskProcessesPane-DJszMYjM.js → TaskProcessesPane-PRgpCplN.js} +1 -1
- package/web/assets/{TaskTerminalView-DyTURB64.js → TaskTerminalView-Dt8gIY5E.js} +1 -1
- package/web/assets/{TerminalPanel-BFqST5ja.js → TerminalPanel-BRib2LP-.js} +1 -1
- package/web/assets/{ThemeToggleButton-DmYU4_Nh.js → ThemeToggleButton-C1lL__80.js} +1 -1
- package/web/assets/{WebDesktopPet-COIAEeuY.js → WebDesktopPet-BWpgoZI3.js} +1 -1
- package/web/assets/WorkbenchNavigation-DmNiD2FD.js +1 -0
- package/web/assets/{WorkflowsPage-Heg3iqQg.js → WorkflowsPage-aRy0lYQ1.js} +1 -1
- package/web/assets/{WorkspacePicker-DFCZ_IJu.js → WorkspacePicker-NkoVoqez.js} +1 -1
- package/web/assets/{api-D8wGrWiI.js → api-CiEo53J1.js} +1 -1
- package/web/assets/app-update-CLhMRrNS.js +32 -0
- package/web/assets/calendar-clock-VIxTaqqy.js +1 -0
- package/web/assets/catalog-DLWnYiJc.js +1 -0
- package/web/assets/chat-api-CbgoP-8X.js +1 -0
- package/web/assets/{client-store-lT3geTlX.js → client-store-DCqgdbAp.js} +1 -1
- package/web/assets/{component-api-kxyOYPJN.js → component-api-BboiUuyG.js} +1 -1
- package/web/assets/{config-search-BThCMhnj.js → config-search-Cwglajsz.js} +1 -1
- package/web/assets/events-f8vVvSfH.js +1 -0
- package/web/assets/{floating-widgets-store-BhuWgVRT.js → floating-widgets-store-BAfPpV4Z.js} +2 -2
- package/web/assets/git-diff-f-zMaQOk.js +3 -0
- package/web/assets/{http-rQRvhTOP.js → http-Dx387MGl.js} +1 -1
- package/web/assets/i18n-CblgkPOp.js +1 -0
- package/web/assets/{index-BVIvzUyZ.js → index-BAYzSwUr.js} +2 -2
- package/web/assets/index-Bcpvpefn.css +2 -0
- package/web/assets/monitor-ORxecA9m.js +1 -0
- package/web/assets/mount-app-DGgK0IVe.js +9 -0
- package/web/assets/mutation-CEbxdVYy.js +1 -0
- package/web/assets/panels-top-left-K8n2CefH.js +1 -0
- package/web/assets/project-diff-summary-BzAMC_7C.js +1 -0
- package/web/assets/public-Cv_Xe2Sp.js +1 -0
- package/web/assets/{public-components-CS0BXa3D.js → public-components-Dfm4D7vP.js} +1 -1
- package/web/assets/public-navigation-zJPpUiuy.js +2 -0
- package/web/assets/query-Bj-DUNYq.js +1 -0
- package/web/assets/radio-tower-jGQwrFWB.js +1 -0
- package/web/assets/{runtime-capabilities-store-D5g-oC-Z.js → runtime-capabilities-store-C1lkVKpw.js} +1 -1
- package/web/assets/scale-pAyho3H9.js +1 -0
- package/web/assets/{session-change-summary-api-4_dTNU4L.js → session-change-summary-api-CqJa3Wdh.js} +1 -1
- package/web/assets/{session-organization-api-1F_dNhFa.js → session-organization-api-B0E2RXLS.js} +1 -1
- package/web/assets/session-streaming-state-DUehpyTs.js +3 -0
- package/web/assets/settings-navigation-BhTYSdv9.js +1 -0
- package/web/assets/{shortcuts-CAyIKRpZ.js → shortcuts-ChJr3RP4.js} +1 -1
- package/web/assets/{sidebar-CjfGBEog.js → sidebar-CERcJRog.js} +1 -1
- package/web/assets/{speech-session-BoAvAzPN.js → speech-session-BPNbd_CM.js} +1 -1
- package/web/assets/startup-queries-uKXB2KOP.js +1 -0
- package/web/assets/{ui-store-D-oOtKbW.js → ui-store-BM6pl-Rq.js} +1 -1
- package/web/assets/use-back-layer-B4dm_FZt.js +1 -0
- package/web/assets/{use-i18n-Dpn7lxcE.js → use-i18n-BrWBoyFl.js} +1 -1
- package/web/assets/use-mobile-PCHaokZZ.js +1 -0
- package/web/assets/{useCustomUiComponents-DzY3OjE_.js → useCustomUiComponents-IxX7wKrp.js} +1 -1
- package/web/assets/useQuery-DdcpUQhO.js +1 -0
- package/web/assets/web-preview-D1qOo-1X.js +1 -0
- package/web/assets/{web-preview-events-BS5O8D7_.js → web-preview-events-BMXsxTa3.js} +1 -1
- package/web/assets/web-preview-panel-B7JAZr2D.js +552 -0
- package/web/index.html +2 -2
- package/web/assets/ChatAppearancePage-Cjy9iir_.js +0 -2
- package/web/assets/ChatHistoryPage-BhXVvudL.js +0 -1
- package/web/assets/ChatPage-CzcvU3Tv.js +0 -4
- package/web/assets/ConfigPage-F1Y_oed5.js +0 -1
- package/web/assets/GitDiffViewer-Dv9WOiX1.js +0 -4
- package/web/assets/McpPage-CaUm1pYY.js +0 -1
- package/web/assets/MobileViewportStabilizer-OtwVmIPm.js +0 -1
- package/web/assets/SessionContextPanel-nvijY4R5.js +0 -2
- package/web/assets/WorkbenchNavigation-BBZRfeaC.js +0 -1
- package/web/assets/app-update-BHhqGwQp.js +0 -32
- package/web/assets/back-navigation-DS0YlxM8.js +0 -1
- package/web/assets/catalog-DpGpcvIi.js +0 -1
- package/web/assets/chat-api-CYidanXn.js +0 -1
- package/web/assets/events-By17Y3YI.js +0 -1
- package/web/assets/i18n-CAJMli-q.js +0 -1
- package/web/assets/index-Z8qQPd8t.css +0 -2
- package/web/assets/mount-app-Sl2T_gzZ.js +0 -9
- package/web/assets/mutation-Difliohy.js +0 -1
- package/web/assets/public-DAsd8NDM.js +0 -1
- package/web/assets/public-navigation-BzM_ocRb.js +0 -2
- package/web/assets/radio-tower-BW78Ns4R.js +0 -1
- package/web/assets/session-streaming-state-CX6zkOkc.js +0 -3
- package/web/assets/startup-queries-DItwFTRv.js +0 -1
- package/web/assets/use-back-layer-Cxm0-40v.js +0 -1
- package/web/assets/use-mobile-YXncArOq.js +0 -1
- package/web/assets/useQuery-Bg3cTjsY.js +0 -1
- package/web/assets/web-preview-C3u-dblt.js +0 -1
- package/web/assets/web-preview-panel-CHiIjAoR.js +0 -552
|
@@ -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-Dpn7lxcE.js";import{i}from"./dist-Cfh4kzCK.js";import{o as a,s as o}from"./dist-B_a0oV4U.js";import{a as s,c,i as l,l as u,n as d,o as f,r as p,s as m,t as h}from"./dist-BdkTa5R3.js";import{t as g}from"./AppSelect-DNIjPL7I.js";import{t as _}from"./utils-C8uzG5AZ.js";import{t as v}from"./createLucideIcon-Cd-3GVxJ.js";import{t as ee}from"./chevron-down-CxtxIjiP.js";import{t as y}from"./circle-check-iEdCm3Pw.js";import{t as b}from"./earth-Ddy13fHh.js";import{t as x}from"./external-link-CEQqPcqc.js";import{n as S,t as C}from"./shield-alert-CvFOTe9h.js";import{t as w}from"./file-code-corner-BnE1ljT0.js";import{t as T}from"./folder-open-FIShC5Qk.js";import{t as E}from"./image-BY_c3FYU.js";import{t as D}from"./loader-circle-BOwQzHB-.js";import{t as te}from"./plug-BsIeHRwC.js";import{t as O}from"./refresh-cw-TbWxTY4K.js";import{t as k}from"./search-D0mqDaf_.js";import{t as A}from"./server-BgNvmqwJ.js";import{t as ne}from"./trash-2-CNrPOoPR.js";import{t as j}from"./triangle-alert-CE1q54ci.js";import{t as M}from"./api-D8wGrWiI.js";import{t as N}from"./button-BcPDt1Ge.js";import{i as re,t as ie}from"./runtime-capabilities-store-D5g-oC-Z.js";import{a as P,i as F,o as I,r as L,s as R,t as z}from"./dialog-CGGxREwU.js";import{c as ae,i as B,l as oe,r as se,s as ce}from"./app-primitives-DhqJLud3.js";import{t as le}from"./PageFrame-BiJUCJku.js";import{t as ue}from"./PageToolbar-DGjx3obb.js";import{t as de}from"./usePagePrimaryAction-CWPC0C_f.js";import{a as fe,i as V,n as H,o as pe,r as me,t as he}from"./tool-labels-DJzY62Yr.js";import{n as U,t as ge}from"./pick-system-directory-BnIFt85A.js";var W=e(t(),1),G=n(),_e=Object.defineProperty,K=(e,t)=>_e(e,`name`,{value:t,configurable:!0}),[q,ve]=o(`AlertDialog`,[u]),J=u(),Y=K(e=>{let{__scopeAlertDialog:t,...n}=e,r=J(t);return(0,G.jsx)(h,{...r,...n,modal:!0})},`AlertDialog`);W.forwardRef(K(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=J(n);return(0,G.jsx)(c,{...i,...r,ref:t})},`AlertDialogTrigger`));var ye=K(e=>{let{__scopeAlertDialog:t,...n}=e,r=J(t);return(0,G.jsx)(f,{...r,...n})},`AlertDialogPortal`),be=W.forwardRef(K(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=J(n);return(0,G.jsx)(s,{...i,...r,ref:t})},`AlertDialogOverlay`)),[xe,Se]=q(`AlertDialogContent`),Ce=W.forwardRef(K(function(e,t){let{__scopeAlertDialog:n,children:r,...o}=e,s=J(n),c=W.useRef(null),l=i(t,c),u=W.useRef(null);return(0,G.jsx)(xe,{scope:n,cancelRef:u,children:(0,G.jsx)(p,{role:`alertdialog`,...s,...o,ref:l,onOpenAutoFocus:a(o.onOpenAutoFocus,e=>{e.preventDefault(),u.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:r})})},`AlertDialogContent`)),we=W.forwardRef(K(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=J(n);return(0,G.jsx)(m,{...i,...r,ref:t})},`AlertDialogTitle`)),Te=W.forwardRef(K(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=J(n);return(0,G.jsx)(l,{...i,...r,ref:t})},`AlertDialogDescription`)),Ee=W.forwardRef(K(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=J(n);return(0,G.jsx)(d,{...i,...r,ref:t})},`AlertDialogAction`)),De=`AlertDialogCancel`,Oe=W.forwardRef(K(function(e,t){let{__scopeAlertDialog:n,...r}=e,{cancelRef:a}=Se(De,n),o=J(n),s=i(t,a);return(0,G.jsx)(d,{...o,...r,ref:s})},`AlertDialogCancel`)),ke=Y,Ae=ye,je=be,Me=Ce,Ne=Ee,Pe=Oe,Fe=we,Ie=Te,X=v(`package-plus`,[[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`path`,{d:`M16 17h6`,key:`1ook5g`}],[`path`,{d:`M19 14v6`,key:`1ckrd5`}],[`path`,{d:`M21 10.535V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l1.675-.955`,key:`28k6lz`}],[`path`,{d:`M3.29 7 12 12l8.71-5`,key:`19ckod`}],[`path`,{d:`m7.5 4.27 8.997 5.148`,key:`9yrvtv`}]]);function Le({...e}){return(0,G.jsx)(ke,{"data-slot":`alert-dialog`,...e})}function Re({...e}){return(0,G.jsx)(Ae,{"data-slot":`alert-dialog-portal`,...e})}function ze({className:e,...t}){return(0,G.jsx)(je,{"data-slot":`alert-dialog-overlay`,className:_(`fixed inset-0 z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function Be({className:e,size:t=`default`,...n}){return(0,G.jsxs)(Re,{children:[(0,G.jsx)(ze,{}),(0,G.jsx)(Me,{"data-slot":`alert-dialog-content`,"data-size":t,className:_(`group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid max-h-[calc(100vh-2rem)] supports-[height:100dvh]:max-h-[calc(100dvh-2rem)] w-full -translate-x-1/2 -translate-y-1/2 gap-4 overflow-y-auto overscroll-contain rounded-xl bg-popover p-4 text-popover-foreground ring-1 ring-[var(--stroke-soft)] duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...n})]})}function Ve({className:e,...t}){return(0,G.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:_(`grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]`,e),...t})}function He({className:e,...t}){return(0,G.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:_(`-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-[var(--surface-subtle)] p-4 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end`,e),...t})}function Ue({className:e,...t}){return(0,G.jsx)(Fe,{"data-slot":`alert-dialog-title`,className:_(`font-heading text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2`,e),...t})}function We({className:e,...t}){return(0,G.jsx)(Ie,{"data-slot":`alert-dialog-description`,className:_(`text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function Ge({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,G.jsx)(N,{variant:t,size:n,asChild:!0,children:(0,G.jsx)(Ne,{"data-slot":`alert-dialog-action`,className:_(e),...r})})}function Ke({className:e,variant:t=`outline`,size:n=`default`,...r}){return(0,G.jsx)(N,{variant:t,size:n,asChild:!0,children:(0,G.jsx)(Pe,{"data-slot":`alert-dialog-cancel`,className:_(e),...r})})}function qe(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function Je({open:e,onOpenChange:t,onInstalled:n}){let{t:i}=r(),[a,o]=(0,W.useState)(``),[s,c]=(0,W.useState)(null),[l,u]=(0,W.useState)(!1),[d,f]=(0,W.useState)(``);return(0,W.useEffect)(()=>{e||(o(``),c(null),u(!1),f(``))},[e]),(0,G.jsx)(z,{open:e,onOpenChange:e=>!l&&t(e),children:(0,G.jsxs)(L,{className:`z-[220] sm:max-w-xl`,overlayClassName:`z-[220]`,children:[(0,G.jsxs)(I,{children:[(0,G.jsxs)(R,{className:`flex items-center gap-2`,children:[(0,G.jsx)(X,{size:17}),i(`plugins:pluginsPage.installLocalPlugin`)]}),(0,G.jsx)(F,{children:i(`plugins:pluginsPage.installLocalPluginDescription`)})]}),(0,G.jsxs)(`div`,{className:`grid gap-3`,children:[(0,G.jsxs)(`label`,{className:`grid gap-1.5 text-xs font-semibold text-[var(--text-soft)]`,children:[i(`plugins:pluginsPage.pluginDirectory`),(0,G.jsxs)(`span`,{className:`flex min-w-0 gap-2`,children:[(0,G.jsx)(`input`,{className:`h-10 min-w-0 flex-1 rounded-md border border-[var(--stroke)] bg-[var(--solid)] px-3 text-[13px] text-[var(--text)] outline-none focus:border-[var(--star-border)]`,value:a,disabled:l,placeholder:i(`plugins:pluginsPage.pluginDirectoryPlaceholder`),onChange:e=>{o(e.target.value),c(null)}}),ge()&&(0,G.jsx)(N,{type:`button`,variant:`ghost`,size:`icon`,className:`size-10 shrink-0`,title:i(`plugins:pluginsPage.chooseDirectory`),onClick:async()=>{f(``);try{let e=await U(a);e&&(o(e),c(null))}catch(e){f(e instanceof Error?e.message:String(e))}},children:(0,G.jsx)(T,{size:16})})]})]}),s&&(0,G.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-[var(--stroke)] bg-[var(--surface-muted)] p-3`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,G.jsx)(`span`,{className:`grid size-9 shrink-0 place-items-center rounded-md bg-[var(--success-soft)] text-[var(--success)]`,children:(0,G.jsx)(y,{size:17})}),(0,G.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`strong`,{className:`block truncate text-[13px] text-[var(--text)]`,children:s.plugin.name}),(0,G.jsxs)(`small`,{className:`block truncate text-[12px] text-[var(--text-muted)]`,children:[s.plugin.id,` · v`,s.plugin.version,` · `,s.fileCount,` `,i(`plugins:pluginsPage.files`),` · `,qe(s.byteCount)]})]})]}),(0,G.jsx)(`div`,{className:`grid gap-1.5`,children:s.plugin.capabilities.map(e=>(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3 border-t border-[var(--stroke-soft)] pt-2 text-xs`,children:[(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`strong`,{className:`block text-[var(--text)]`,children:e.label}),(0,G.jsx)(`small`,{className:`text-[var(--text-muted)]`,children:e.description})]}),(0,G.jsx)(`code`,{className:`shrink-0 text-[11px] text-[var(--text-soft)]`,children:e.name})]},e.name))}),(0,G.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md bg-[var(--warning-soft)] p-2.5 text-xs leading-5 text-[var(--warning-strong)]`,children:[(0,G.jsx)(j,{className:`mt-0.5 shrink-0`,size:15}),(0,G.jsx)(`span`,{children:i(`plugins:pluginsPage.localPluginSecurityWarning`)})]})]}),d&&(0,G.jsxs)(B,{className:`m-0`,children:[(0,G.jsx)(j,{size:14}),(0,G.jsx)(`span`,{children:d})]})]}),(0,G.jsxs)(P,{children:[(0,G.jsx)(N,{type:`button`,variant:`outline`,size:`lg`,className:`bg-surface-subtle`,disabled:l,onClick:()=>t(!1),children:i(`common:ui.cancel`)}),(0,G.jsxs)(N,{type:`button`,size:`lg`,disabled:l||!s&&!a.trim(),onClick:s?async()=>{if(!(!s||l)){u(!0),f(``);try{await M(`/api/plugins/install`,{method:`POST`,body:JSON.stringify({inspectionId:s.inspectionId})}),await n(),t(!1)}catch(e){f(e instanceof Error?e.message:String(e))}finally{u(!1)}}}:async()=>{if(!(!a.trim()||l)){u(!0),f(``);try{c(await M(`/api/plugins/inspect`,{method:`POST`,body:JSON.stringify({path:a.trim()})}))}catch(e){c(null),f(e instanceof Error?e.message:String(e))}finally{u(!1)}}},children:[l?(0,G.jsx)(D,{className:`animate-spin`,size:15}):s?(0,G.jsx)(X,{size:15}):(0,G.jsx)(y,{size:15}),i(l?`plugins:pluginsPage.processing`:s?`plugins:pluginsPage.installPlugin`:`plugins:pluginsPage.inspectPlugin`)]})]})]})})}var Ye=[`tool`,`prompt`,`skill`];function Xe(e){let t=Array.isArray(e.resourceTypes)?e.resourceTypes.filter(e=>Ye.includes(e)):[];return t.length?t:[`tool`]}function Ze(e,t){return{tool:t(`plugins:pluginsPage.extensionType.tool`),prompt:t(`plugins:pluginsPage.extensionType.prompt`),skill:t(`plugins:pluginsPage.extensionType.skill`)}[e]}var Qe=[`all`,`builtin`,`local`],$e={read:S,ls:T,grep:k,find:k,edit:w,write:w,bash:A,web_search:b,browser_automation:b,generate_visual:E};function Z(e,t){return t(e===`builtin`?`plugins:pluginsPage.builtIn`:e===`local`?`plugins:pluginsPage.local`:`plugins:pluginsPage.all`)}function et(e){return e.flatMap(e=>e.managedExternally?[]:e.capabilities.filter(e=>e.enabled).map(e=>e.name))}function tt(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 nt(e){return e.find(e=>e.source===`pi`&&e.name===`Computer Use`)?.enabled!==!1}function rt(e){return Object.fromEntries(e.filter(e=>e.source===`pi`&&e.name!==`Computer Use`&&!!e.packageSource).map(e=>[e.packageSource,e.enabled!==!1]))}function it(e,t){return[...e].sort().join(`\0`)===[...t].sort().join(`\0`)}function Q(e,t){return V({id:e.name,name:e.label},t)}function $(e,t){return e.pluginSource===`pi`?e.pluginName:H(e.pluginName,t)}function at({value:e,testing:t,onChange:n,onTest:i}){let{t:a}=r();return(0,G.jsxs)(`div`,{className:`plugin-tool-config [&_label]:grid [&_label]:gap-[5px] [&_label]:text-[var(--text-muted)] [&_label]:text-[11px] [&_label]:font-[600] [&_select]:w-full [&_select]:h-[34px] [&_select]:[border:1px_solid_var(--stroke)] [&_select]:rounded-[var(--r-xs)] [&_select]:bg-[var(--solid)] [&_select]:p-[0_8px] [&_select]:text-[var(--text)] [&_select]:text-[12px] [&_input]:w-full [&_input]:h-[34px] [&_input]:[border:1px_solid_var(--stroke)] [&_input]:rounded-[var(--r-xs)] [&_input]:bg-[var(--solid)] [&_input]:p-[0_8px] [&_input]:text-[var(--text)] [&_input]:text-[12px] grid gap-[9px] [border-top:1px_solid_var(--stroke)] [padding-top:10px]`,children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-3`,children:[(0,G.jsxs)(`label`,{children:[a(`plugins:pluginsPage.defaultLanguage`),(0,G.jsxs)(g,{value:e.language,onChange:t=>n({...e,language:t.target.value}),children:[(0,G.jsx)(`option`,{value:`auto`,children:a(`plugins:pluginsPage.auto`)}),(0,G.jsx)(`option`,{value:`zh-CN`,children:a(`plugins:pluginsPage.simplifiedChinese`)}),(0,G.jsx)(`option`,{value:`en-US`,children:a(`plugins:pluginsPage.english`)})]})]}),(0,G.jsxs)(`label`,{children:[a(`plugins:pluginsPage.safeSearch`),(0,G.jsxs)(g,{value:e.safeSearch,onChange:t=>n({...e,safeSearch:Number(t.target.value)}),children:[(0,G.jsx)(`option`,{value:0,children:a(`plugins:pluginsPage.off`)}),(0,G.jsx)(`option`,{value:1,children:a(`plugins:pluginsPage.moderate`)}),(0,G.jsx)(`option`,{value:2,children:a(`plugins:pluginsPage.strict`)})]})]}),(0,G.jsxs)(`label`,{children:[a(`plugins:pluginsPage.resultCount`),(0,G.jsx)(`input`,{type:`number`,min:`1`,max:`12`,value:e.maxResults,onChange:t=>n({...e,maxResults:Number(t.target.value)})})]})]}),(0,G.jsxs)(N,{type:`button`,variant:`outline`,size:`lg`,className:`justify-self-end bg-surface-subtle`,disabled:t,onClick:i,children:[t?(0,G.jsx)(O,{className:`animate-spin`,size:14}):(0,G.jsx)(b,{size:14}),a(t?`plugins:pluginsPage.testing`:`plugins:pluginsPage.testConnection`)]})]})}function ot({query:e,notify:t,requestText:n,requestConfirm:i}){let{t:a}=r(),[o,s]=(0,W.useState)(``),[c,l]=(0,W.useState)(null),[u,d]=(0,W.useState)([]),[f,p]=(0,W.useState)(!1),[m,h]=(0,W.useState)(``),[g,_]=(0,W.useState)(``),v=(0,W.useCallback)(async(e=``)=>{p(!0),_(``);try{let[t,n]=await Promise.all([M(`/api/extensions/market?name=${encodeURIComponent(e)}`),M(`/api/extensions`)]);l(t),d(n.packages||[])}catch(e){_(e instanceof Error?e.message:String(e))}finally{p(!1)}},[]);(0,W.useEffect)(()=>{v(``)},[v]);let ee=(c?.packages||[]).filter(t=>`${t.name} ${t.description}`.toLowerCase().includes(e.trim().toLowerCase())),y=async e=>{if(await i?.({title:a(`plugins:pluginsPage.installExtension`),message:a(`plugins:pluginsPage.extensionSecurityWarning`,{name:e}),confirmLabel:a(`plugins:pluginsPage.installExtension`),tone:`danger`})!==!1){h(e);try{let n=/^(?:[.~\\/]|[A-Za-z]:[\\/])/.test(e)||/^(?:npm:|https?:\/\/|git\+)/i.test(e)?e:`npm:${e}`,r=await M(`/api/extensions/install`,{method:`POST`,body:JSON.stringify({source:n})});d(r.packages||[]),t(a(`plugins:pluginsPage.extensionInstalled`),`success`)}catch(e){t(e instanceof Error?e.message:String(e),`error`)}finally{h(``)}}},b=async()=>{let e=await n?.({title:a(`plugins:pluginsPage.installExtension`),message:a(`plugins:pluginsPage.extensionSourceHelp`),inputLabel:a(`plugins:pluginsPage.extensionSource`),placeholder:`npm:@scope/package or https://github.com/…`,maxLength:2e3});e?.trim()&&await y(e.trim())},S=async e=>{if(await i?.({title:a(`plugins:pluginsPage.uninstallExtension`),message:a(`plugins:pluginsPage.uninstallExtensionDescription`,{name:e.name}),confirmLabel:a(`plugins:pluginsPage.uninstallExtension`),tone:`danger`})!==!1){h(e.source);try{await M(`/api/extensions`,{method:`DELETE`,body:JSON.stringify({source:e.source,scope:e.scope})}),await v(o),t(a(`plugins:pluginsPage.extensionUninstalled`),`success`)}catch(e){t(e instanceof Error?e.message:String(e),`error`)}finally{h(``)}}},C=Ye.map(e=>({type:e,items:u.filter(t=>Xe(t).includes(e))})).filter(e=>e.items.length>0);return(0,G.jsxs)(`section`,{className:`plugin-market grid gap-[10px] border-t border-[var(--stroke)] pt-[14px]`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-[10px]`,children:[(0,G.jsx)(`h2`,{className:`m-0 text-[14px] font-[650]`,children:a(`plugins:pluginsPage.extensionMarket`)}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsxs)(N,{type:`button`,variant:`outline`,size:`lg`,onClick:b,disabled:!!m,children:[(0,G.jsx)(X,{size:14}),a(`plugins:pluginsPage.installExtension`)]}),(0,G.jsxs)(`a`,{className:`inline-flex h-[34px] items-center gap-1 rounded-[var(--r-xs)] border border-[var(--stroke)] px-2 text-[12px] text-[var(--text-soft)] no-underline hover:bg-[var(--surface-hover)]`,href:`https://pi.dev/packages`,target:`_blank`,rel:`noreferrer`,children:[(0,G.jsx)(x,{size:13}),a(`plugins:pluginsPage.openPackageCatalog`)]})]})]}),(0,G.jsxs)(`form`,{className:`flex min-w-0 gap-2`,onSubmit:e=>{e.preventDefault(),v(o)},children:[(0,G.jsx)(`input`,{className:`h-[34px] min-w-0 flex-1 rounded-[var(--r-xs)] border border-[var(--stroke)] bg-[var(--solid)] px-2 text-[12px] text-[var(--text)]`,value:o,onChange:e=>s(e.target.value),placeholder:a(`plugins:pluginsPage.searchPackageCatalog`),"aria-label":a(`plugins:pluginsPage.searchPackageCatalog`)}),(0,G.jsxs)(N,{type:`submit`,variant:`outline`,size:`lg`,disabled:f,children:[f?(0,G.jsx)(O,{className:`animate-spin`,size:14}):(0,G.jsx)(k,{size:14}),a(`plugins:pluginsPage.search`)]})]}),g&&(0,G.jsx)(`p`,{className:`m-0 text-[12px] text-[var(--danger)]`,children:g}),C.length>0&&(0,G.jsxs)(`div`,{className:`grid gap-2`,children:[(0,G.jsx)(`h3`,{className:`m-0 text-[12px] font-[650] text-[var(--text-secondary)]`,children:a(`plugins:pluginsPage.installedExtensions`)}),C.map(e=>(0,G.jsxs)(`section`,{className:`grid gap-1`,children:[(0,G.jsx)(`h4`,{className:`m-0 text-[11px] font-[650] text-[var(--text-muted)]`,children:Ze(e.type,a)}),e.items.map(t=>(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-2 border-t border-[var(--stroke-soft)] py-2`,children:[(0,G.jsxs)(`span`,{className:`min-w-0`,children:[(0,G.jsx)(`strong`,{className:`block overflow-hidden text-ellipsis whitespace-nowrap text-[12px]`,children:t.name}),(0,G.jsxs)(`small`,{className:`block overflow-hidden text-ellipsis whitespace-nowrap text-[11px] text-[var(--text-muted)]`,children:[t.source,` · v`,t.version]})]}),(0,G.jsxs)(N,{type:`button`,variant:`ghost`,size:`sm`,disabled:!!m,onClick:()=>void S(t),children:[m===t.source?(0,G.jsx)(D,{className:`animate-spin`,size:13}):(0,G.jsx)(ne,{size:13}),a(`plugins:pluginsPage.uninstallExtension`)]})]},`${e.type}:${t.scope}:${t.source}`))]},e.type))]}),(0,G.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(230px,1fr))] gap-2`,children:ee.slice(0,12).map(e=>{let t=u.some(t=>t.name===e.name||t.source===`npm:${e.name}`);return(0,G.jsxs)(`article`,{className:`grid min-w-0 gap-2 rounded-[var(--r-xs)] border border-[var(--stroke)] bg-[var(--solid)] p-2`,children:[(0,G.jsx)(`strong`,{className:`overflow-hidden text-ellipsis whitespace-nowrap text-[12px]`,title:e.name,children:e.name}),(0,G.jsx)(`p`,{className:`m-0 line-clamp-3 min-h-[45px] text-[11px] leading-[1.45] text-[var(--text-secondary)]`,children:e.description}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsx)(`small`,{className:`text-[10px] text-[var(--text-muted)]`,children:e.published}),(0,G.jsxs)(N,{type:`button`,size:`sm`,disabled:t||!!m,onClick:()=>void y(e.name),children:[m===e.name&&(0,G.jsx)(D,{className:`animate-spin`,size:13}),a(t?`plugins:pluginsPage.installed`:`plugins:pluginsPage.installExtension`)]})]})]},e.name)})})]})}function st({query:e=``,notify:t,registerPrimaryAction:n,requestText:i,requestConfirm:a}){let{t:o}=r(),s=ie(e=>e.capabilities),c=re(s,`plugins`),l=c?Qe:Qe.slice(0,2),[u,d]=(0,W.useState)(null),[f,p]=(0,W.useState)([]),[m,h]=(0,W.useState)(``),[g,_]=(0,W.useState)(`all`),[v,y]=(0,W.useState)({provider:`bing`,language:`auto`,safeSearch:1,maxResults:8}),[b,x]=(0,W.useState)(!1),[S,w]=(0,W.useState)(!1),[T,E]=(0,W.useState)(!1),[k,A]=(0,W.useState)(null),[P,F]=(0,W.useState)(!1),[I,L]=(0,W.useState)(``),R=(0,W.useCallback)(e=>{d(e),p(e.plugins),y(e.webSearch)},[]),z=(0,W.useCallback)(async()=>{L(``);try{R(await M(`/api/plugins`))}catch(e){L(e instanceof Error?e.message:String(e))}},[R]);(0,W.useEffect)(()=>{z()},[z]);let V=(0,W.useMemo)(()=>tt(f),[f]),H=(0,W.useMemo)(()=>et(f),[f]),U=u?!it(H,u.enabledTools)||nt(f)!==u.computerUseEnabled||JSON.stringify(rt(f))!==JSON.stringify(u.piExtensions)||JSON.stringify(v)!==JSON.stringify(u.webSearch):!1,ge=(0,W.useCallback)(async()=>{if(!b){if(!u||!U){u&&t(o(`plugins:pluginsPage.noPluginPolicyChanges`));return}x(!0),L(``);try{let e=await M(`/api/plugins`,{method:`PUT`,body:JSON.stringify({enabledTools:H,webSearch:v,computerUseEnabled:nt(f),piExtensions:rt(f)})});R(e),t(o(`plugins:pluginsPage.pluginPolicySavedAgentRuntimeUpdated`))}catch(e){L(e instanceof Error?e.message:String(e))}finally{x(!1)}}},[R,u,U,f,H,t,b,o,v]);de(n,ge);let _e=async()=>{w(!0),L(``);try{let e=await M(`/api/plugins/web-search/test`,{method:`POST`,body:JSON.stringify(v)});t(o(`plugins:pluginsPage.bingSearchIsAvailableAndReturnedCountResults`,{count:e.count}))}catch(e){let n=e instanceof Error?e.message:String(e);L(n),t(n,`error`)}finally{w(!1)}},K=(e,t,n)=>{p(r=>r.map(r=>{if(r.id!==e)return r;let i=r.source===`pi`&&r.managedExternally;return{...r,enabled:n||r.capabilities.some(e=>e.enabled),capabilities:r.capabilities.map(e=>i||e.name===t?{...e,enabled:n}:e)}}))},q=()=>!U||(L(o(`plugins:pluginsPage.saveBeforePluginChanges`)),!1),ve=async()=>{if(!(!k||P)){F(!0),L(``);try{R(await M(`/api/plugins/${encodeURIComponent(k.pluginId)}`,{method:`DELETE`})),t(o(`plugins:pluginsPage.pluginUninstalled`,{name:k.pluginName})),h(``),A(null)}catch(e){L(e instanceof Error?e.message:String(e))}finally{F(!1)}}};if(!u)return(0,G.jsxs)(se,{children:[(0,G.jsx)(O,{className:`animate-spin`,size:24}),(0,G.jsx)(`h2`,{children:o(`plugins:pluginsPage.loadingToolPlugins`)}),I&&(0,G.jsxs)(B,{children:[(0,G.jsx)(j,{size:13}),I]})]});let J=e.trim().toLowerCase(),Y=V.filter(e=>g!==`all`&&e.pluginSource!==g?!1:[Q(e,o),e.name,e.description,$(e,o),e.pluginId].join(` `).toLowerCase().includes(J));return(0,G.jsx)(le,{variant:`collection`,children:(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[(0,G.jsxs)(ue,{children:[(0,G.jsx)(ae,{options:l.map(e=>Z(e,o)),value:Z(g,o),onChange:e=>_(l.find(t=>Z(t,o)===e)||`all`)}),(0,G.jsx)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:c&&(0,G.jsxs)(N,{type:`button`,variant:`outline`,size:`lg`,className:`bg-surface-subtle`,onClick:()=>q()&&E(!0),children:[(0,G.jsx)(X,{size:15}),o(`plugins:pluginsPage.installPlugin`)]})})]}),(0,G.jsxs)(`div`,{className:`plugin-catalog-heading [&_>_span]:flex [&_>_span]:items-center [&_>_span]:gap-[7px] [&_strong]:text-[13px] [&_small]:text-[var(--text-secondary)] [&_small]:text-[12px] [&_small]:[font-variant-numeric:tabular-nums] max-[650px]:items-start flex items-center justify-between gap-[12px] [padding:2px]`,children:[(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`strong`,{children:o(`plugins:pluginsPage.toolCatalog`)}),(0,G.jsx)(`small`,{children:Y.length})]}),(0,G.jsxs)(`span`,{className:`plugin-catalog-summary text-[var(--text-secondary)] text-[12px] [font-variant-numeric:tabular-nums] [&_>_i]:w-[7px] [&_>_i]:h-[7px] [&_>_i]:rounded-[50%] [&_>_i]:bg-[var(--status-green)] max-[650px]:flex-wrap max-[650px]:justify-end`,children:[(0,G.jsx)(`i`,{}),V.filter(e=>e.enabled).length,`/`,V.length,` `,o(`plugins:pluginsPage.enabled2`),U&&(0,G.jsx)(oe,{tone:`amber`,children:o(`plugins:pluginsPage.unsaved`)})]})]}),Y.length?(0,G.jsx)(`div`,{className:`plugin-tool-grid max-[650px]:grid-cols-[minmax(0,1fr)] grid grid-cols-[repeat(auto-fill,minmax(310px,1fr))] [align-items:start] gap-[10px] [padding-bottom:4px]`,children:Y.map(e=>{let t=m===e.name,n=$e[e.name]||te;return(0,G.jsxs)(`article`,{className:`plugin-tool-card [&[data-open]]:border-[var(--stroke-hover)] [&[data-open]]:shadow-[var(--sh-1)] min-w-0 overflow-hidden [border:1px_solid_var(--stroke)] rounded-[var(--r-sm)] bg-[var(--solid)]`,"data-open":t||void 0,children:[(0,G.jsxs)(`div`,{className:`plugin-tool-card-head hover:bg-[var(--surface-hover)] [.plugin-tool-card[data-open]_>_&]:bg-[var(--surface-hover)] max-[650px]:grid-cols-[minmax(0,1fr)_auto] max-[650px]:[padding-inline:8px] grid min-h-[56px] grid-cols-[minmax(0,1fr)_auto] items-center gap-[10px] [padding:7px_10px]`,children:[(0,G.jsxs)(`button`,{type:`button`,className:`grid min-w-0 h-full grid-cols-[32px_minmax(0,1fr)] items-center gap-[9px] border-0 bg-transparent p-0 text-inherit text-left`,"aria-expanded":t,onClick:()=>h(t=>t===e.name?``:e.name),children:[(0,G.jsx)(`span`,{className:`grid w-[32px] h-[32px] place-items-center rounded-[var(--r-xs)] bg-[var(--surface-muted)] text-[var(--text-soft)]`,children:(0,G.jsx)(n,{size:15})}),(0,G.jsxs)(`span`,{className:`plugin-tool-title [&_strong]:overflow-hidden [&_strong]:text-ellipsis [&_strong]:whitespace-nowrap [&_small]:overflow-hidden [&_small]:text-ellipsis [&_small]:whitespace-nowrap [&_strong]:text-[13px] [&_small]:text-[var(--text-muted)] [&_small]:text-[11px] flex min-w-0 flex-col gap-[2px]`,children:[(0,G.jsx)(`strong`,{title:Q(e,o),children:Q(e,o)}),(0,G.jsx)(`small`,{children:$(e,o)})]})]}),(0,G.jsxs)(`span`,{className:`plugin-tool-trailing [&_>_i]:w-[7px] [&_>_i]:h-[7px] [&_>_i]:rounded-[50%] [&_>_i]:bg-[var(--status-muted)] [&_>_i[data-enabled]]:bg-[var(--status-green)] max-[650px]:gap-[5px] inline-flex items-center gap-[7px]`,children:[(0,G.jsx)(`i`,{"data-enabled":e.enabled||void 0}),!e.pluginBuiltIn&&(0,G.jsx)(oe,{tone:`amber`,children:o(`plugins:pluginsPage.local`)}),(0,G.jsx)(ce,{value:e.enabled,onChange:t=>K(e.pluginId,e.name,t),ariaLabel:Q(e,o)}),(0,G.jsx)(`button`,{type:`button`,className:`plugin-tool-chevron hover:bg-[var(--surface-muted)] hover:text-[var(--text)] [&_svg]:[transition:transform_var(--d1)_var(--ease-out)] [&[aria-expanded='true']_svg]:[transform:rotate(180deg)] grid w-[24px] h-[24px] place-items-center border-0 rounded-[var(--r-xs)] bg-transparent text-[var(--text-muted)]`,"aria-label":o(`plugins:pluginsPage.toggleToolDetails`,{name:Q(e,o)}),"aria-expanded":t,onClick:()=>h(t=>t===e.name?``:e.name),children:(0,G.jsx)(ee,{size:14})})]})]}),t&&(0,G.jsxs)(`div`,{className:`plugin-tool-details [&_>_p]:m-0 [&_>_p]:text-[var(--text-soft)] [&_>_p]:text-[12px] [&_>_p]:leading-[1.55] [&_>_code]:[overflow-wrap:anywhere] [&_>_code]:text-[var(--text)] [&_>_code]:text-[11px] [&_dl]:grid [&_dl]:grid-cols-[78px_minmax(0,1fr)] [&_dl]:gap-[6px_10px] [&_dl]:m-0 [&_dl_div]:[display:contents] [&_dt]:text-[var(--text-muted)] [&_dt]:text-[11px] [&_dd]:min-w-0 [&_dd]:m-0 [&_dd]:[overflow-wrap:anywhere] [&_dd]:text-[var(--text-soft)] [&_dd]:text-[12px] max-[650px]:[&_dl]:grid-cols-[68px_minmax(0,1fr)] grid gap-[9px] [border-top:1px_solid_var(--stroke)] bg-[var(--surface-subtle)] [padding:11px_13px_13px]`,children:[(0,G.jsx)(`p`,{children:me({id:e.name,description:e.description},o)}),(0,G.jsx)(`code`,{children:e.name}),(0,G.jsxs)(`dl`,{children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:o(`plugins:pluginsPage.source`)}),(0,G.jsxs)(`dd`,{children:[$(e,o),!e.pluginBuiltIn&&` · v${e.pluginVersion}`]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:o(`plugins:pluginsPage.riskLevel`)}),(0,G.jsx)(`dd`,{className:he(e.risk)?`text-[var(--danger)]`:``,children:fe(e.risk,o)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:o(`plugins:pluginsPage.pathScope`)}),(0,G.jsx)(`dd`,{children:pe({id:e.name,scope:e.scope},o)})]}),!e.pluginBuiltIn&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:o(`plugins:pluginsPage.executionMode`)}),(0,G.jsx)(`dd`,{children:o(`plugins:pluginsPage.fullAccessOnly`)})]})]}),!e.pluginBuiltIn&&(0,G.jsxs)(`div`,{className:`plugin-tool-warning [&_svg]:flex-none [&_svg]:mt-[1px] flex items-start gap-[7px] rounded-[var(--r-xs)] bg-[var(--warning-soft)] [padding:8px] text-[var(--warning-strong)] text-[11px] leading-[1.5]`,children:[(0,G.jsx)(C,{size:14}),(0,G.jsx)(`span`,{children:o(`plugins:pluginsPage.localPluginSecurityWarning`)})]}),e.name===`web_search`&&(0,G.jsx)(at,{value:v,testing:S,onChange:y,onTest:_e}),!e.pluginBuiltIn&&(0,G.jsxs)(N,{type:`button`,variant:`destructive`,size:`lg`,className:`[justify-self:end]`,onClick:()=>q()&&A(e),children:[(0,G.jsx)(ne,{size:14}),o(`plugins:pluginsPage.uninstallPlugin`)]})]})]},e.name)})}):(0,G.jsx)(`div`,{className:`plugin-empty [&.compact]:min-h-[90px] grid min-h-[180px] place-items-center text-[var(--text-secondary)] text-[12px]`,children:o(`plugins:pluginsPage.noMatchingTools`)}),(0,G.jsx)(ot,{query:e,notify:t,requestText:i,requestConfirm:a}),c&&(0,G.jsx)(Je,{open:T,onOpenChange:E,onInstalled:z}),(0,G.jsx)(Le,{open:!!k,onOpenChange:e=>!e&&!P&&A(null),children:(0,G.jsxs)(Be,{className:`z-[220]`,children:[(0,G.jsxs)(Ve,{children:[(0,G.jsx)(Ue,{children:o(`plugins:pluginsPage.uninstallPlugin`)}),(0,G.jsx)(We,{children:o(`plugins:pluginsPage.uninstallPluginDescription`,{name:k?.pluginName||``})})]}),(0,G.jsxs)(He,{children:[(0,G.jsx)(Ke,{disabled:P,children:o(`common:ui.cancel`)}),(0,G.jsxs)(Ge,{variant:`destructive`,disabled:P,onClick:ve,children:[P&&(0,G.jsx)(D,{className:`animate-spin`,size:14}),o(`plugins:pluginsPage.uninstallPlugin`)]})]})]})}),I&&(0,G.jsxs)(B,{className:`fixed z-[21] [right:24px] [bottom:24px] max-w-[360px] shadow-[0_12px_28px_-18px_var(--floating-shadow)]`,children:[(0,G.jsx)(j,{size:13}),I]})]})})}export{st 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-BrWBoyFl.js";import{i}from"./dist-Cfh4kzCK.js";import{o as a,s as o}from"./dist-B_a0oV4U.js";import{a as s,c,i as l,l as u,n as d,o as f,r as p,s as m,t as h}from"./dist-BdkTa5R3.js";import{t as g}from"./AppSelect-DEmkrcvY.js";import{t as _}from"./utils-C8uzG5AZ.js";import{t as v}from"./createLucideIcon-Cd-3GVxJ.js";import{t as ee}from"./chevron-down-CxtxIjiP.js";import{t as y}from"./circle-check-iEdCm3Pw.js";import{t as b}from"./earth-Ddy13fHh.js";import{t as x}from"./external-link-CEQqPcqc.js";import{n as S,t as C}from"./shield-alert-CvFOTe9h.js";import{t as w}from"./file-code-corner-BnE1ljT0.js";import{t as T}from"./folder-open-FIShC5Qk.js";import{t as E}from"./image-BY_c3FYU.js";import{t as D}from"./loader-circle-BOwQzHB-.js";import{t as te}from"./plug-BsIeHRwC.js";import{t as O}from"./refresh-cw-TbWxTY4K.js";import{t as k}from"./search-D0mqDaf_.js";import{t as A}from"./server-BgNvmqwJ.js";import{t as ne}from"./trash-2-CNrPOoPR.js";import{t as j}from"./triangle-alert-CE1q54ci.js";import{t as M}from"./api-CiEo53J1.js";import{t as N}from"./button-BcPDt1Ge.js";import{i as re,t as ie}from"./runtime-capabilities-store-C1lkVKpw.js";import{a as P,i as F,o as I,r as L,s as R,t as z}from"./dialog-CGGxREwU.js";import{c as ae,i as B,l as oe,r as se,s as ce}from"./app-primitives-DhqJLud3.js";import{t as le}from"./PageFrame-BiJUCJku.js";import{t as ue}from"./PageToolbar-DGjx3obb.js";import{t as de}from"./usePagePrimaryAction-CWPC0C_f.js";import{a as fe,i as V,n as H,o as pe,r as me,t as he}from"./tool-labels-DJzY62Yr.js";import{n as U,t as ge}from"./pick-system-directory-BnIFt85A.js";var W=e(t(),1),G=n(),_e=Object.defineProperty,K=(e,t)=>_e(e,`name`,{value:t,configurable:!0}),[q,ve]=o(`AlertDialog`,[u]),J=u(),Y=K(e=>{let{__scopeAlertDialog:t,...n}=e,r=J(t);return(0,G.jsx)(h,{...r,...n,modal:!0})},`AlertDialog`);W.forwardRef(K(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=J(n);return(0,G.jsx)(c,{...i,...r,ref:t})},`AlertDialogTrigger`));var ye=K(e=>{let{__scopeAlertDialog:t,...n}=e,r=J(t);return(0,G.jsx)(f,{...r,...n})},`AlertDialogPortal`),be=W.forwardRef(K(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=J(n);return(0,G.jsx)(s,{...i,...r,ref:t})},`AlertDialogOverlay`)),[xe,Se]=q(`AlertDialogContent`),Ce=W.forwardRef(K(function(e,t){let{__scopeAlertDialog:n,children:r,...o}=e,s=J(n),c=W.useRef(null),l=i(t,c),u=W.useRef(null);return(0,G.jsx)(xe,{scope:n,cancelRef:u,children:(0,G.jsx)(p,{role:`alertdialog`,...s,...o,ref:l,onOpenAutoFocus:a(o.onOpenAutoFocus,e=>{e.preventDefault(),u.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:r})})},`AlertDialogContent`)),we=W.forwardRef(K(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=J(n);return(0,G.jsx)(m,{...i,...r,ref:t})},`AlertDialogTitle`)),Te=W.forwardRef(K(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=J(n);return(0,G.jsx)(l,{...i,...r,ref:t})},`AlertDialogDescription`)),Ee=W.forwardRef(K(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=J(n);return(0,G.jsx)(d,{...i,...r,ref:t})},`AlertDialogAction`)),De=`AlertDialogCancel`,Oe=W.forwardRef(K(function(e,t){let{__scopeAlertDialog:n,...r}=e,{cancelRef:a}=Se(De,n),o=J(n),s=i(t,a);return(0,G.jsx)(d,{...o,...r,ref:s})},`AlertDialogCancel`)),ke=Y,Ae=ye,je=be,Me=Ce,Ne=Ee,Pe=Oe,Fe=we,Ie=Te,X=v(`package-plus`,[[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`path`,{d:`M16 17h6`,key:`1ook5g`}],[`path`,{d:`M19 14v6`,key:`1ckrd5`}],[`path`,{d:`M21 10.535V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l1.675-.955`,key:`28k6lz`}],[`path`,{d:`M3.29 7 12 12l8.71-5`,key:`19ckod`}],[`path`,{d:`m7.5 4.27 8.997 5.148`,key:`9yrvtv`}]]);function Le({...e}){return(0,G.jsx)(ke,{"data-slot":`alert-dialog`,...e})}function Re({...e}){return(0,G.jsx)(Ae,{"data-slot":`alert-dialog-portal`,...e})}function ze({className:e,...t}){return(0,G.jsx)(je,{"data-slot":`alert-dialog-overlay`,className:_(`fixed inset-0 z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function Be({className:e,size:t=`default`,...n}){return(0,G.jsxs)(Re,{children:[(0,G.jsx)(ze,{}),(0,G.jsx)(Me,{"data-slot":`alert-dialog-content`,"data-size":t,className:_(`group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid max-h-[calc(100vh-2rem)] supports-[height:100dvh]:max-h-[calc(100dvh-2rem)] w-full -translate-x-1/2 -translate-y-1/2 gap-4 overflow-y-auto overscroll-contain rounded-xl bg-popover p-4 text-popover-foreground ring-1 ring-[var(--stroke-soft)] duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...n})]})}function Ve({className:e,...t}){return(0,G.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:_(`grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]`,e),...t})}function He({className:e,...t}){return(0,G.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:_(`-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-[var(--surface-subtle)] p-4 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end`,e),...t})}function Ue({className:e,...t}){return(0,G.jsx)(Fe,{"data-slot":`alert-dialog-title`,className:_(`font-heading text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2`,e),...t})}function We({className:e,...t}){return(0,G.jsx)(Ie,{"data-slot":`alert-dialog-description`,className:_(`text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function Ge({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,G.jsx)(N,{variant:t,size:n,asChild:!0,children:(0,G.jsx)(Ne,{"data-slot":`alert-dialog-action`,className:_(e),...r})})}function Ke({className:e,variant:t=`outline`,size:n=`default`,...r}){return(0,G.jsx)(N,{variant:t,size:n,asChild:!0,children:(0,G.jsx)(Pe,{"data-slot":`alert-dialog-cancel`,className:_(e),...r})})}function qe(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function Je({open:e,onOpenChange:t,onInstalled:n}){let{t:i}=r(),[a,o]=(0,W.useState)(``),[s,c]=(0,W.useState)(null),[l,u]=(0,W.useState)(!1),[d,f]=(0,W.useState)(``);return(0,W.useEffect)(()=>{e||(o(``),c(null),u(!1),f(``))},[e]),(0,G.jsx)(z,{open:e,onOpenChange:e=>!l&&t(e),children:(0,G.jsxs)(L,{className:`z-[220] sm:max-w-xl`,overlayClassName:`z-[220]`,children:[(0,G.jsxs)(I,{children:[(0,G.jsxs)(R,{className:`flex items-center gap-2`,children:[(0,G.jsx)(X,{size:17}),i(`plugins:pluginsPage.installLocalPlugin`)]}),(0,G.jsx)(F,{children:i(`plugins:pluginsPage.installLocalPluginDescription`)})]}),(0,G.jsxs)(`div`,{className:`grid gap-3`,children:[(0,G.jsxs)(`label`,{className:`grid gap-1.5 text-xs font-semibold text-[var(--text-soft)]`,children:[i(`plugins:pluginsPage.pluginDirectory`),(0,G.jsxs)(`span`,{className:`flex min-w-0 gap-2`,children:[(0,G.jsx)(`input`,{className:`h-10 min-w-0 flex-1 rounded-md border border-[var(--stroke)] bg-[var(--solid)] px-3 text-[13px] text-[var(--text)] outline-none focus:border-[var(--star-border)]`,value:a,disabled:l,placeholder:i(`plugins:pluginsPage.pluginDirectoryPlaceholder`),onChange:e=>{o(e.target.value),c(null)}}),ge()&&(0,G.jsx)(N,{type:`button`,variant:`ghost`,size:`icon`,className:`size-10 shrink-0`,title:i(`plugins:pluginsPage.chooseDirectory`),onClick:async()=>{f(``);try{let e=await U(a);e&&(o(e),c(null))}catch(e){f(e instanceof Error?e.message:String(e))}},children:(0,G.jsx)(T,{size:16})})]})]}),s&&(0,G.jsxs)(`div`,{className:`grid gap-3 rounded-md border border-[var(--stroke)] bg-[var(--surface-muted)] p-3`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,G.jsx)(`span`,{className:`grid size-9 shrink-0 place-items-center rounded-md bg-[var(--success-soft)] text-[var(--success)]`,children:(0,G.jsx)(y,{size:17})}),(0,G.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`strong`,{className:`block truncate text-[13px] text-[var(--text)]`,children:s.plugin.name}),(0,G.jsxs)(`small`,{className:`block truncate text-[12px] text-[var(--text-muted)]`,children:[s.plugin.id,` · v`,s.plugin.version,` · `,s.fileCount,` `,i(`plugins:pluginsPage.files`),` · `,qe(s.byteCount)]})]})]}),(0,G.jsx)(`div`,{className:`grid gap-1.5`,children:s.plugin.capabilities.map(e=>(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3 border-t border-[var(--stroke-soft)] pt-2 text-xs`,children:[(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`strong`,{className:`block text-[var(--text)]`,children:e.label}),(0,G.jsx)(`small`,{className:`text-[var(--text-muted)]`,children:e.description})]}),(0,G.jsx)(`code`,{className:`shrink-0 text-[11px] text-[var(--text-soft)]`,children:e.name})]},e.name))}),(0,G.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md bg-[var(--warning-soft)] p-2.5 text-xs leading-5 text-[var(--warning-strong)]`,children:[(0,G.jsx)(j,{className:`mt-0.5 shrink-0`,size:15}),(0,G.jsx)(`span`,{children:i(`plugins:pluginsPage.localPluginSecurityWarning`)})]})]}),d&&(0,G.jsxs)(B,{className:`m-0`,children:[(0,G.jsx)(j,{size:14}),(0,G.jsx)(`span`,{children:d})]})]}),(0,G.jsxs)(P,{children:[(0,G.jsx)(N,{type:`button`,variant:`outline`,size:`lg`,className:`bg-surface-subtle`,disabled:l,onClick:()=>t(!1),children:i(`common:ui.cancel`)}),(0,G.jsxs)(N,{type:`button`,size:`lg`,disabled:l||!s&&!a.trim(),onClick:s?async()=>{if(!(!s||l)){u(!0),f(``);try{await M(`/api/plugins/install`,{method:`POST`,body:JSON.stringify({inspectionId:s.inspectionId})}),await n(),t(!1)}catch(e){f(e instanceof Error?e.message:String(e))}finally{u(!1)}}}:async()=>{if(!(!a.trim()||l)){u(!0),f(``);try{c(await M(`/api/plugins/inspect`,{method:`POST`,body:JSON.stringify({path:a.trim()})}))}catch(e){c(null),f(e instanceof Error?e.message:String(e))}finally{u(!1)}}},children:[l?(0,G.jsx)(D,{className:`animate-spin`,size:15}):s?(0,G.jsx)(X,{size:15}):(0,G.jsx)(y,{size:15}),i(l?`plugins:pluginsPage.processing`:s?`plugins:pluginsPage.installPlugin`:`plugins:pluginsPage.inspectPlugin`)]})]})]})})}var Ye=[`tool`,`prompt`,`skill`];function Xe(e){let t=Array.isArray(e.resourceTypes)?e.resourceTypes.filter(e=>Ye.includes(e)):[];return t.length?t:[`tool`]}function Ze(e,t){return{tool:t(`plugins:pluginsPage.extensionType.tool`),prompt:t(`plugins:pluginsPage.extensionType.prompt`),skill:t(`plugins:pluginsPage.extensionType.skill`)}[e]}var Qe=[`all`,`builtin`,`local`],$e={read:S,ls:T,grep:k,find:k,edit:w,write:w,bash:A,web_search:b,browser_automation:b,generate_visual:E};function Z(e,t){return t(e===`builtin`?`plugins:pluginsPage.builtIn`:e===`local`?`plugins:pluginsPage.local`:`plugins:pluginsPage.all`)}function et(e){return e.flatMap(e=>e.managedExternally?[]:e.capabilities.filter(e=>e.enabled).map(e=>e.name))}function tt(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 nt(e){return e.find(e=>e.source===`pi`&&e.name===`Computer Use`)?.enabled!==!1}function rt(e){return Object.fromEntries(e.filter(e=>e.source===`pi`&&e.name!==`Computer Use`&&!!e.packageSource).map(e=>[e.packageSource,e.enabled!==!1]))}function it(e,t){return[...e].sort().join(`\0`)===[...t].sort().join(`\0`)}function Q(e,t){return V({id:e.name,name:e.label},t)}function $(e,t){return e.pluginSource===`pi`?e.pluginName:H(e.pluginName,t)}function at({value:e,testing:t,onChange:n,onTest:i}){let{t:a}=r();return(0,G.jsxs)(`div`,{className:`plugin-tool-config [&_label]:grid [&_label]:gap-[5px] [&_label]:text-[var(--text-muted)] [&_label]:text-[11px] [&_label]:font-[600] [&_select]:w-full [&_select]:h-[34px] [&_select]:[border:1px_solid_var(--stroke)] [&_select]:rounded-[var(--r-xs)] [&_select]:bg-[var(--solid)] [&_select]:p-[0_8px] [&_select]:text-[var(--text)] [&_select]:text-[12px] [&_input]:w-full [&_input]:h-[34px] [&_input]:[border:1px_solid_var(--stroke)] [&_input]:rounded-[var(--r-xs)] [&_input]:bg-[var(--solid)] [&_input]:p-[0_8px] [&_input]:text-[var(--text)] [&_input]:text-[12px] grid gap-[9px] [border-top:1px_solid_var(--stroke)] [padding-top:10px]`,children:[(0,G.jsxs)(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-3`,children:[(0,G.jsxs)(`label`,{children:[a(`plugins:pluginsPage.defaultLanguage`),(0,G.jsxs)(g,{value:e.language,onChange:t=>n({...e,language:t.target.value}),children:[(0,G.jsx)(`option`,{value:`auto`,children:a(`plugins:pluginsPage.auto`)}),(0,G.jsx)(`option`,{value:`zh-CN`,children:a(`plugins:pluginsPage.simplifiedChinese`)}),(0,G.jsx)(`option`,{value:`en-US`,children:a(`plugins:pluginsPage.english`)})]})]}),(0,G.jsxs)(`label`,{children:[a(`plugins:pluginsPage.safeSearch`),(0,G.jsxs)(g,{value:e.safeSearch,onChange:t=>n({...e,safeSearch:Number(t.target.value)}),children:[(0,G.jsx)(`option`,{value:0,children:a(`plugins:pluginsPage.off`)}),(0,G.jsx)(`option`,{value:1,children:a(`plugins:pluginsPage.moderate`)}),(0,G.jsx)(`option`,{value:2,children:a(`plugins:pluginsPage.strict`)})]})]}),(0,G.jsxs)(`label`,{children:[a(`plugins:pluginsPage.resultCount`),(0,G.jsx)(`input`,{type:`number`,min:`1`,max:`12`,value:e.maxResults,onChange:t=>n({...e,maxResults:Number(t.target.value)})})]})]}),(0,G.jsxs)(N,{type:`button`,variant:`outline`,size:`lg`,className:`justify-self-end bg-surface-subtle`,disabled:t,onClick:i,children:[t?(0,G.jsx)(O,{className:`animate-spin`,size:14}):(0,G.jsx)(b,{size:14}),a(t?`plugins:pluginsPage.testing`:`plugins:pluginsPage.testConnection`)]})]})}function ot({query:e,notify:t,requestText:n,requestConfirm:i}){let{t:a}=r(),[o,s]=(0,W.useState)(``),[c,l]=(0,W.useState)(null),[u,d]=(0,W.useState)([]),[f,p]=(0,W.useState)(!1),[m,h]=(0,W.useState)(``),[g,_]=(0,W.useState)(``),v=(0,W.useCallback)(async(e=``)=>{p(!0),_(``);try{let[t,n]=await Promise.all([M(`/api/extensions/market?name=${encodeURIComponent(e)}`),M(`/api/extensions`)]);l(t),d(n.packages||[])}catch(e){_(e instanceof Error?e.message:String(e))}finally{p(!1)}},[]);(0,W.useEffect)(()=>{v(``)},[v]);let ee=(c?.packages||[]).filter(t=>`${t.name} ${t.description}`.toLowerCase().includes(e.trim().toLowerCase())),y=async e=>{if(await i?.({title:a(`plugins:pluginsPage.installExtension`),message:a(`plugins:pluginsPage.extensionSecurityWarning`,{name:e}),confirmLabel:a(`plugins:pluginsPage.installExtension`),tone:`danger`})!==!1){h(e);try{let n=/^(?:[.~\\/]|[A-Za-z]:[\\/])/.test(e)||/^(?:npm:|https?:\/\/|git\+)/i.test(e)?e:`npm:${e}`,r=await M(`/api/extensions/install`,{method:`POST`,body:JSON.stringify({source:n})});d(r.packages||[]),t(a(`plugins:pluginsPage.extensionInstalled`),`success`)}catch(e){t(e instanceof Error?e.message:String(e),`error`)}finally{h(``)}}},b=async()=>{let e=await n?.({title:a(`plugins:pluginsPage.installExtension`),message:a(`plugins:pluginsPage.extensionSourceHelp`),inputLabel:a(`plugins:pluginsPage.extensionSource`),placeholder:`npm:@scope/package or https://github.com/…`,maxLength:2e3});e?.trim()&&await y(e.trim())},S=async e=>{if(await i?.({title:a(`plugins:pluginsPage.uninstallExtension`),message:a(`plugins:pluginsPage.uninstallExtensionDescription`,{name:e.name}),confirmLabel:a(`plugins:pluginsPage.uninstallExtension`),tone:`danger`})!==!1){h(e.source);try{await M(`/api/extensions`,{method:`DELETE`,body:JSON.stringify({source:e.source,scope:e.scope})}),await v(o),t(a(`plugins:pluginsPage.extensionUninstalled`),`success`)}catch(e){t(e instanceof Error?e.message:String(e),`error`)}finally{h(``)}}},C=Ye.map(e=>({type:e,items:u.filter(t=>Xe(t).includes(e))})).filter(e=>e.items.length>0);return(0,G.jsxs)(`section`,{className:`plugin-market grid gap-[10px] border-t border-[var(--stroke)] pt-[14px]`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-[10px]`,children:[(0,G.jsx)(`h2`,{className:`m-0 text-[14px] font-[650]`,children:a(`plugins:pluginsPage.extensionMarket`)}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsxs)(N,{type:`button`,variant:`outline`,size:`lg`,onClick:b,disabled:!!m,children:[(0,G.jsx)(X,{size:14}),a(`plugins:pluginsPage.installExtension`)]}),(0,G.jsxs)(`a`,{className:`inline-flex h-[34px] items-center gap-1 rounded-[var(--r-xs)] border border-[var(--stroke)] px-2 text-[12px] text-[var(--text-soft)] no-underline hover:bg-[var(--surface-hover)]`,href:`https://pi.dev/packages`,target:`_blank`,rel:`noreferrer`,children:[(0,G.jsx)(x,{size:13}),a(`plugins:pluginsPage.openPackageCatalog`)]})]})]}),(0,G.jsxs)(`form`,{className:`flex min-w-0 gap-2`,onSubmit:e=>{e.preventDefault(),v(o)},children:[(0,G.jsx)(`input`,{className:`h-[34px] min-w-0 flex-1 rounded-[var(--r-xs)] border border-[var(--stroke)] bg-[var(--solid)] px-2 text-[12px] text-[var(--text)]`,value:o,onChange:e=>s(e.target.value),placeholder:a(`plugins:pluginsPage.searchPackageCatalog`),"aria-label":a(`plugins:pluginsPage.searchPackageCatalog`)}),(0,G.jsxs)(N,{type:`submit`,variant:`outline`,size:`lg`,disabled:f,children:[f?(0,G.jsx)(O,{className:`animate-spin`,size:14}):(0,G.jsx)(k,{size:14}),a(`plugins:pluginsPage.search`)]})]}),g&&(0,G.jsx)(`p`,{className:`m-0 text-[12px] text-[var(--danger)]`,children:g}),C.length>0&&(0,G.jsxs)(`div`,{className:`grid gap-2`,children:[(0,G.jsx)(`h3`,{className:`m-0 text-[12px] font-[650] text-[var(--text-secondary)]`,children:a(`plugins:pluginsPage.installedExtensions`)}),C.map(e=>(0,G.jsxs)(`section`,{className:`grid gap-1`,children:[(0,G.jsx)(`h4`,{className:`m-0 text-[11px] font-[650] text-[var(--text-muted)]`,children:Ze(e.type,a)}),e.items.map(t=>(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-2 border-t border-[var(--stroke-soft)] py-2`,children:[(0,G.jsxs)(`span`,{className:`min-w-0`,children:[(0,G.jsx)(`strong`,{className:`block overflow-hidden text-ellipsis whitespace-nowrap text-[12px]`,children:t.name}),(0,G.jsxs)(`small`,{className:`block overflow-hidden text-ellipsis whitespace-nowrap text-[11px] text-[var(--text-muted)]`,children:[t.source,` · v`,t.version]})]}),(0,G.jsxs)(N,{type:`button`,variant:`ghost`,size:`sm`,disabled:!!m,onClick:()=>void S(t),children:[m===t.source?(0,G.jsx)(D,{className:`animate-spin`,size:13}):(0,G.jsx)(ne,{size:13}),a(`plugins:pluginsPage.uninstallExtension`)]})]},`${e.type}:${t.scope}:${t.source}`))]},e.type))]}),(0,G.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(230px,1fr))] gap-2`,children:ee.slice(0,12).map(e=>{let t=u.some(t=>t.name===e.name||t.source===`npm:${e.name}`);return(0,G.jsxs)(`article`,{className:`grid min-w-0 gap-2 rounded-[var(--r-xs)] border border-[var(--stroke)] bg-[var(--solid)] p-2`,children:[(0,G.jsx)(`strong`,{className:`overflow-hidden text-ellipsis whitespace-nowrap text-[12px]`,title:e.name,children:e.name}),(0,G.jsx)(`p`,{className:`m-0 line-clamp-3 min-h-[45px] text-[11px] leading-[1.45] text-[var(--text-secondary)]`,children:e.description}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsx)(`small`,{className:`text-[10px] text-[var(--text-muted)]`,children:e.published}),(0,G.jsxs)(N,{type:`button`,size:`sm`,disabled:t||!!m,onClick:()=>void y(e.name),children:[m===e.name&&(0,G.jsx)(D,{className:`animate-spin`,size:13}),a(t?`plugins:pluginsPage.installed`:`plugins:pluginsPage.installExtension`)]})]})]},e.name)})})]})}function st({query:e=``,notify:t,registerPrimaryAction:n,requestText:i,requestConfirm:a}){let{t:o}=r(),s=ie(e=>e.capabilities),c=re(s,`plugins`),l=c?Qe:Qe.slice(0,2),[u,d]=(0,W.useState)(null),[f,p]=(0,W.useState)([]),[m,h]=(0,W.useState)(``),[g,_]=(0,W.useState)(`all`),[v,y]=(0,W.useState)({provider:`bing`,language:`auto`,safeSearch:1,maxResults:8}),[b,x]=(0,W.useState)(!1),[S,w]=(0,W.useState)(!1),[T,E]=(0,W.useState)(!1),[k,A]=(0,W.useState)(null),[P,F]=(0,W.useState)(!1),[I,L]=(0,W.useState)(``),R=(0,W.useCallback)(e=>{d(e),p(e.plugins),y(e.webSearch)},[]),z=(0,W.useCallback)(async()=>{L(``);try{R(await M(`/api/plugins`))}catch(e){L(e instanceof Error?e.message:String(e))}},[R]);(0,W.useEffect)(()=>{z()},[z]);let V=(0,W.useMemo)(()=>tt(f),[f]),H=(0,W.useMemo)(()=>et(f),[f]),U=u?!it(H,u.enabledTools)||nt(f)!==u.computerUseEnabled||JSON.stringify(rt(f))!==JSON.stringify(u.piExtensions)||JSON.stringify(v)!==JSON.stringify(u.webSearch):!1,ge=(0,W.useCallback)(async()=>{if(!b){if(!u||!U){u&&t(o(`plugins:pluginsPage.noPluginPolicyChanges`));return}x(!0),L(``);try{let e=await M(`/api/plugins`,{method:`PUT`,body:JSON.stringify({enabledTools:H,webSearch:v,computerUseEnabled:nt(f),piExtensions:rt(f)})});R(e),t(o(`plugins:pluginsPage.pluginPolicySavedAgentRuntimeUpdated`))}catch(e){L(e instanceof Error?e.message:String(e))}finally{x(!1)}}},[R,u,U,f,H,t,b,o,v]);de(n,ge);let _e=async()=>{w(!0),L(``);try{let e=await M(`/api/plugins/web-search/test`,{method:`POST`,body:JSON.stringify(v)});t(o(`plugins:pluginsPage.bingSearchIsAvailableAndReturnedCountResults`,{count:e.count}))}catch(e){let n=e instanceof Error?e.message:String(e);L(n),t(n,`error`)}finally{w(!1)}},K=(e,t,n)=>{p(r=>r.map(r=>{if(r.id!==e)return r;let i=r.source===`pi`&&r.managedExternally;return{...r,enabled:n||r.capabilities.some(e=>e.enabled),capabilities:r.capabilities.map(e=>i||e.name===t?{...e,enabled:n}:e)}}))},q=()=>!U||(L(o(`plugins:pluginsPage.saveBeforePluginChanges`)),!1),ve=async()=>{if(!(!k||P)){F(!0),L(``);try{R(await M(`/api/plugins/${encodeURIComponent(k.pluginId)}`,{method:`DELETE`})),t(o(`plugins:pluginsPage.pluginUninstalled`,{name:k.pluginName})),h(``),A(null)}catch(e){L(e instanceof Error?e.message:String(e))}finally{F(!1)}}};if(!u)return(0,G.jsxs)(se,{children:[(0,G.jsx)(O,{className:`animate-spin`,size:24}),(0,G.jsx)(`h2`,{children:o(`plugins:pluginsPage.loadingToolPlugins`)}),I&&(0,G.jsxs)(B,{children:[(0,G.jsx)(j,{size:13}),I]})]});let J=e.trim().toLowerCase(),Y=V.filter(e=>g!==`all`&&e.pluginSource!==g?!1:[Q(e,o),e.name,e.description,$(e,o),e.pluginId].join(` `).toLowerCase().includes(J));return(0,G.jsx)(le,{variant:`collection`,children:(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[(0,G.jsxs)(ue,{children:[(0,G.jsx)(ae,{options:l.map(e=>Z(e,o)),value:Z(g,o),onChange:e=>_(l.find(t=>Z(t,o)===e)||`all`)}),(0,G.jsx)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:c&&(0,G.jsxs)(N,{type:`button`,variant:`outline`,size:`lg`,className:`bg-surface-subtle`,onClick:()=>q()&&E(!0),children:[(0,G.jsx)(X,{size:15}),o(`plugins:pluginsPage.installPlugin`)]})})]}),(0,G.jsxs)(`div`,{className:`plugin-catalog-heading [&_>_span]:flex [&_>_span]:items-center [&_>_span]:gap-[7px] [&_strong]:text-[13px] [&_small]:text-[var(--text-secondary)] [&_small]:text-[12px] [&_small]:[font-variant-numeric:tabular-nums] max-[650px]:items-start flex items-center justify-between gap-[12px] [padding:2px]`,children:[(0,G.jsxs)(`span`,{children:[(0,G.jsx)(`strong`,{children:o(`plugins:pluginsPage.toolCatalog`)}),(0,G.jsx)(`small`,{children:Y.length})]}),(0,G.jsxs)(`span`,{className:`plugin-catalog-summary text-[var(--text-secondary)] text-[12px] [font-variant-numeric:tabular-nums] [&_>_i]:w-[7px] [&_>_i]:h-[7px] [&_>_i]:rounded-[50%] [&_>_i]:bg-[var(--status-green)] max-[650px]:flex-wrap max-[650px]:justify-end`,children:[(0,G.jsx)(`i`,{}),V.filter(e=>e.enabled).length,`/`,V.length,` `,o(`plugins:pluginsPage.enabled2`),U&&(0,G.jsx)(oe,{tone:`amber`,children:o(`plugins:pluginsPage.unsaved`)})]})]}),Y.length?(0,G.jsx)(`div`,{className:`plugin-tool-grid max-[650px]:grid-cols-[minmax(0,1fr)] grid grid-cols-[repeat(auto-fill,minmax(310px,1fr))] [align-items:start] gap-[10px] [padding-bottom:4px]`,children:Y.map(e=>{let t=m===e.name,n=$e[e.name]||te;return(0,G.jsxs)(`article`,{className:`plugin-tool-card [&[data-open]]:border-[var(--stroke-hover)] [&[data-open]]:shadow-[var(--sh-1)] min-w-0 overflow-hidden [border:1px_solid_var(--stroke)] rounded-[var(--r-sm)] bg-[var(--solid)]`,"data-open":t||void 0,children:[(0,G.jsxs)(`div`,{className:`plugin-tool-card-head hover:bg-[var(--surface-hover)] [.plugin-tool-card[data-open]_>_&]:bg-[var(--surface-hover)] max-[650px]:grid-cols-[minmax(0,1fr)_auto] max-[650px]:[padding-inline:8px] grid min-h-[56px] grid-cols-[minmax(0,1fr)_auto] items-center gap-[10px] [padding:7px_10px]`,children:[(0,G.jsxs)(`button`,{type:`button`,className:`grid min-w-0 h-full grid-cols-[32px_minmax(0,1fr)] items-center gap-[9px] border-0 bg-transparent p-0 text-inherit text-left`,"aria-expanded":t,onClick:()=>h(t=>t===e.name?``:e.name),children:[(0,G.jsx)(`span`,{className:`grid w-[32px] h-[32px] place-items-center rounded-[var(--r-xs)] bg-[var(--surface-muted)] text-[var(--text-soft)]`,children:(0,G.jsx)(n,{size:15})}),(0,G.jsxs)(`span`,{className:`plugin-tool-title [&_strong]:overflow-hidden [&_strong]:text-ellipsis [&_strong]:whitespace-nowrap [&_small]:overflow-hidden [&_small]:text-ellipsis [&_small]:whitespace-nowrap [&_strong]:text-[13px] [&_small]:text-[var(--text-muted)] [&_small]:text-[11px] flex min-w-0 flex-col gap-[2px]`,children:[(0,G.jsx)(`strong`,{title:Q(e,o),children:Q(e,o)}),(0,G.jsx)(`small`,{children:$(e,o)})]})]}),(0,G.jsxs)(`span`,{className:`plugin-tool-trailing [&_>_i]:w-[7px] [&_>_i]:h-[7px] [&_>_i]:rounded-[50%] [&_>_i]:bg-[var(--status-muted)] [&_>_i[data-enabled]]:bg-[var(--status-green)] max-[650px]:gap-[5px] inline-flex items-center gap-[7px]`,children:[(0,G.jsx)(`i`,{"data-enabled":e.enabled||void 0}),!e.pluginBuiltIn&&(0,G.jsx)(oe,{tone:`amber`,children:o(`plugins:pluginsPage.local`)}),(0,G.jsx)(ce,{value:e.enabled,onChange:t=>K(e.pluginId,e.name,t),ariaLabel:Q(e,o)}),(0,G.jsx)(`button`,{type:`button`,className:`plugin-tool-chevron hover:bg-[var(--surface-muted)] hover:text-[var(--text)] [&_svg]:[transition:transform_var(--d1)_var(--ease-out)] [&[aria-expanded='true']_svg]:[transform:rotate(180deg)] grid w-[24px] h-[24px] place-items-center border-0 rounded-[var(--r-xs)] bg-transparent text-[var(--text-muted)]`,"aria-label":o(`plugins:pluginsPage.toggleToolDetails`,{name:Q(e,o)}),"aria-expanded":t,onClick:()=>h(t=>t===e.name?``:e.name),children:(0,G.jsx)(ee,{size:14})})]})]}),t&&(0,G.jsxs)(`div`,{className:`plugin-tool-details [&_>_p]:m-0 [&_>_p]:text-[var(--text-soft)] [&_>_p]:text-[12px] [&_>_p]:leading-[1.55] [&_>_code]:[overflow-wrap:anywhere] [&_>_code]:text-[var(--text)] [&_>_code]:text-[11px] [&_dl]:grid [&_dl]:grid-cols-[78px_minmax(0,1fr)] [&_dl]:gap-[6px_10px] [&_dl]:m-0 [&_dl_div]:[display:contents] [&_dt]:text-[var(--text-muted)] [&_dt]:text-[11px] [&_dd]:min-w-0 [&_dd]:m-0 [&_dd]:[overflow-wrap:anywhere] [&_dd]:text-[var(--text-soft)] [&_dd]:text-[12px] max-[650px]:[&_dl]:grid-cols-[68px_minmax(0,1fr)] grid gap-[9px] [border-top:1px_solid_var(--stroke)] bg-[var(--surface-subtle)] [padding:11px_13px_13px]`,children:[(0,G.jsx)(`p`,{children:me({id:e.name,description:e.description},o)}),(0,G.jsx)(`code`,{children:e.name}),(0,G.jsxs)(`dl`,{children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:o(`plugins:pluginsPage.source`)}),(0,G.jsxs)(`dd`,{children:[$(e,o),!e.pluginBuiltIn&&` · v${e.pluginVersion}`]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:o(`plugins:pluginsPage.riskLevel`)}),(0,G.jsx)(`dd`,{className:he(e.risk)?`text-[var(--danger)]`:``,children:fe(e.risk,o)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:o(`plugins:pluginsPage.pathScope`)}),(0,G.jsx)(`dd`,{children:pe({id:e.name,scope:e.scope},o)})]}),!e.pluginBuiltIn&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:o(`plugins:pluginsPage.executionMode`)}),(0,G.jsx)(`dd`,{children:o(`plugins:pluginsPage.fullAccessOnly`)})]})]}),!e.pluginBuiltIn&&(0,G.jsxs)(`div`,{className:`plugin-tool-warning [&_svg]:flex-none [&_svg]:mt-[1px] flex items-start gap-[7px] rounded-[var(--r-xs)] bg-[var(--warning-soft)] [padding:8px] text-[var(--warning-strong)] text-[11px] leading-[1.5]`,children:[(0,G.jsx)(C,{size:14}),(0,G.jsx)(`span`,{children:o(`plugins:pluginsPage.localPluginSecurityWarning`)})]}),e.name===`web_search`&&(0,G.jsx)(at,{value:v,testing:S,onChange:y,onTest:_e}),!e.pluginBuiltIn&&(0,G.jsxs)(N,{type:`button`,variant:`destructive`,size:`lg`,className:`[justify-self:end]`,onClick:()=>q()&&A(e),children:[(0,G.jsx)(ne,{size:14}),o(`plugins:pluginsPage.uninstallPlugin`)]})]})]},e.name)})}):(0,G.jsx)(`div`,{className:`plugin-empty [&.compact]:min-h-[90px] grid min-h-[180px] place-items-center text-[var(--text-secondary)] text-[12px]`,children:o(`plugins:pluginsPage.noMatchingTools`)}),(0,G.jsx)(ot,{query:e,notify:t,requestText:i,requestConfirm:a}),c&&(0,G.jsx)(Je,{open:T,onOpenChange:E,onInstalled:z}),(0,G.jsx)(Le,{open:!!k,onOpenChange:e=>!e&&!P&&A(null),children:(0,G.jsxs)(Be,{className:`z-[220]`,children:[(0,G.jsxs)(Ve,{children:[(0,G.jsx)(Ue,{children:o(`plugins:pluginsPage.uninstallPlugin`)}),(0,G.jsx)(We,{children:o(`plugins:pluginsPage.uninstallPluginDescription`,{name:k?.pluginName||``})})]}),(0,G.jsxs)(He,{children:[(0,G.jsx)(Ke,{disabled:P,children:o(`common:ui.cancel`)}),(0,G.jsxs)(Ge,{variant:`destructive`,disabled:P,onClick:ve,children:[P&&(0,G.jsx)(D,{className:`animate-spin`,size:14}),o(`plugins:pluginsPage.uninstallPlugin`)]})]})]})}),I&&(0,G.jsxs)(B,{className:`fixed z-[21] [right:24px] [bottom:24px] max-w-[360px] shadow-[0_12px_28px_-18px_var(--floating-shadow)]`,children:[(0,G.jsx)(j,{size:13}),I]})]})})}export{st 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-
|
|
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-BrWBoyFl.js";import{t as i}from"./createLucideIcon-Cd-3GVxJ.js";import{t as a}from"./chevron-left-BAtyp3_6.js";import{t as o}from"./chevron-right-C3t2Rckj.js";import{t as s}from"./code-xml-BrUXrBax.js";import{t as c}from"./file-text-N9JICX6E.js";import{t as l}from"./flask-conical-DhW5v7Zz.js";import{t as u}from"./list-checks-B5Jl4aiO.js";import{t as d}from"./wand-sparkles-DdQneChm.js";import{t as f}from"./button-BcPDt1Ge.js";var p=i(`bug`,[[`path`,{d:`M12 20v-9`,key:`1qisl0`}],[`path`,{d:`M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z`,key:`uouzyp`}],[`path`,{d:`M14.12 3.88 16 2`,key:`qol33r`}],[`path`,{d:`M21 21a4 4 0 0 0-3.81-4`,key:`1b0z45`}],[`path`,{d:`M21 5a4 4 0 0 1-3.55 3.97`,key:`5cxbf6`}],[`path`,{d:`M22 13h-4`,key:`1jl80f`}],[`path`,{d:`M3 21a4 4 0 0 1 3.81-4`,key:`1fjd4g`}],[`path`,{d:`M3 5a4 4 0 0 0 3.55 3.97`,key:`1d7oge`}],[`path`,{d:`M6 13H2`,key:`82j7cp`}],[`path`,{d:`m8 2 1.88 1.88`,key:`fmnt4t`}],[`path`,{d:`M9 7.13V6a3 3 0 1 1 6 0v1.13`,key:`1vgav8`}]]),m=i(`layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),h=i(`search-check`,[[`path`,{d:`m8 11 2 2 4-4`,key:`1sed1v`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]),g=e(t(),1),_=n();function v(e,t){return[{icon:s,label:e(`chat:focusSession.explainCode`),prompt:e(`chat:focusSession.explainHowThisCodeWorks`)},{icon:l,label:e(`chat:focusSession.writeTests`),prompt:e(`chat:focusSession.writeUnitTestsForTheFollowingCode`)},{icon:d,label:e(`chat:focusSession.refactor`),prompt:e(`chat:focusSession.refactorThisCodeAndExplainTheImprovements`)},{icon:p,label:e(`chat:focusSession.findABug`),prompt:e(`chat:focusSession.helpMeLocateAndFixThisBug`)},{icon:c,label:e(`chat:focusSession.summarize`),prompt:e(`chat:focusSession.summarizeContentAndExtractKeyPoints`)},...t?[{icon:u,label:e(`chat:focusSession.makeAPlan`),prompt:e(`chat:focusSession.makeAClearActionablePlanForThisGoal`)}]:[],{icon:m,label:e(`chat:focusSession.organizeInformation`),prompt:e(`chat:focusSession.organizeThisInformationIntoAClearStructure`)},{icon:h,label:e(`chat:focusSession.findIssues`),prompt:e(`chat:focusSession.reviewThisContentAndSuggestImprovements`)}]}function y({plansAvailable:e,onPromptSelect:t}){let{t:n}=r(),[i,s]=(0,g.useState)(0),c=v(n,e),l=Math.ceil(c.length/3)-1,u=Math.min(i,l);return(0,_.jsxs)(`section`,{"aria-label":n(`chat:focusSession.promptIdeas`),className:`pt-5 text-left text-sm`,children:[(0,_.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-2`,children:[(0,_.jsx)(`h2`,{className:`text-sm font-medium`,children:n(`chat:focusSession.promptIdeas`)}),(0,_.jsxs)(`div`,{className:`flex gap-1`,children:[(0,_.jsx)(f,{type:`button`,variant:`ghost`,size:`icon`,className:`size-9 rounded-full max-[650px]:size-11`,"aria-label":n(`chat:workbench.previousIdeas`),disabled:u===0,onClick:()=>s(u-1),children:(0,_.jsx)(a,{})}),(0,_.jsx)(f,{type:`button`,variant:`ghost`,size:`icon`,className:`size-9 rounded-full max-[650px]:size-11`,"aria-label":n(`chat:workbench.nextIdeas`),disabled:u===l,onClick:()=>s(u+1),children:(0,_.jsx)(o,{})})]})]}),(0,_.jsx)(`div`,{className:`welcome-chips grid grid-cols-3 gap-3 @max-[600px]:grid-cols-1`,children:c.slice(u*3,u*3+3).map(e=>(0,_.jsxs)(`button`,{type:`button`,"aria-label":e.label,"data-target-cursor":!0,onClick:()=>t(e.prompt),className:`flex min-h-32 min-w-0 flex-col gap-3 rounded-2xl border border-border bg-background p-3 text-left font-normal shadow-sm transition-colors hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring @max-[600px]:min-h-0 @max-[600px]:w-full`,children:[(0,_.jsxs)(`span`,{className:`flex w-full items-center justify-between gap-2`,children:[(0,_.jsx)(e.icon,{size:20,"aria-hidden":`true`}),(0,_.jsx)(`span`,{className:`rounded-full border border-border px-2 py-1 text-xs`,children:n(`chat:workbench.tryPrompt`)})]}),(0,_.jsx)(`span`,{children:e.label}),(0,_.jsx)(`span`,{className:`text-xs leading-relaxed text-muted-foreground`,children:e.prompt.replace(/[::]$/,``)})]},e.label))})]})}export{y as default};
|
|
@@ -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-Dpn7lxcE.js";import{t as i}from"./AppSelect-DNIjPL7I.js";import{t as a}from"./bell-BjONAtgH.js";import{t as o}from"./bot-B3TaBp_T.js";import{t as s}from"./circle-check-iEdCm3Pw.js";import{t as c}from"./folder-open-FIShC5Qk.js";import{t as l}from"./message-circle-D-XrK6Ft.js";import{t as u}from"./play-DNDjDNGn.js";import{t as d}from"./plus-fQbSqB1n.js";import{t as f}from"./refresh-cw-TbWxTY4K.js";import{t as p}from"./send-Cj-W03w_.js";import{t as ee}from"./trash-2-CNrPOoPR.js";import{t as m}from"./triangle-alert-CE1q54ci.js";import{t as h}from"./x-07u4-129.js";import{t as g}from"./api-D8wGrWiI.js";import{t as _}from"./button-BcPDt1Ge.js";import{WorkspacePicker as v}from"./WorkspacePicker-DFCZ_IJu.js";import{t as y}from"./field-3bN8nouy.js";import{r as b}from"./format-BRFKAYMT.js";import{i as x,l as S,n as C,o as w,r as T,s as E,t as D}from"./app-primitives-DhqJLud3.js";import{t as te}from"./PageFrame-BiJUCJku.js";import{t as O}from"./StarOrbit-BAAjh-hY.js";import{t as k}from"./usePagePrimaryAction-CWPC0C_f.js";import{t as A}from"./ListDetailLayout-S-IBs4f_.js";import{n as j,t as M}from"./pick-system-directory-BnIFt85A.js";var N=e(t(),1),P=n(),ne={browser:{name:`通知`,Icon:a},feishu:{name:`飞书`,Icon:o},weixin:{name:`微信`,Icon:l},qq:{name:`QQ`,Icon:l},telegram:{name:`Telegram`,Icon:p}},re={interval:`每隔一段时间`,daily:`每天`,weekly:`每周`,monthly:`每月`},ie={minutes:`分钟`,hours:`小时`,days:`天`},ae=[...new Set([`Asia/Hong_Kong`,`UTC`,...typeof Intl.supportedValuesOf==`function`?Intl.supportedValuesOf(`timeZone`):[]])],F=[`full-access`];function I(e){return e(`schedules:schedulesPage.fullAccessHelp`)}function oe(e,t){return t(e===`daily`?`schedules:schedulesPage.daily`:e===`weekly`?`schedules:schedulesPage.weekly`:e===`monthly`?`schedules:schedulesPage.monthly`:`schedules:schedulesPage.atIntervals`)}function se(e,t){return t(e===`hours`?`schedules:schedulesPage.hours`:e===`days`?`schedules:schedulesPage.days`:`schedules:schedulesPage.minutes`)}function L(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 R({value:e,onChange:t}){let{t:n}=r();return(0,P.jsxs)(y,{variant:`control`,children:[n(`schedules:schedulesPage.executionMode`),(0,P.jsx)(i,{value:e,onChange:e=>t(e.target.value),children:F.map(e=>(0,P.jsx)(`option`,{value:e,children:n(`schedules:schedulesPage.fullAccess`)},e))}),(0,P.jsx)(`small`,{children:I(n)})]})}function z(e){return Object.fromEntries((e?.inputs||[]).map(e=>[e.name,e.defaultValue??``]))}function B(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 V({targetType:e,prompt:t,workflowId:n,workflowInputs:a,workflows:o,onChange:s}){let{t:c}=r(),l=o.find(e=>e.id===n);return(0,P.jsxs)(`div`,{className:`grid gap-[10px]`,children:[(0,P.jsxs)(y,{variant:`control`,children:[c(`schedules:schedulesPage.executionTarget`),(0,P.jsxs)(i,{value:e,onChange:e=>{let t=e.target.value,r=o[0];s(t===`workflow`?{targetType:t,workflowId:n||r?.id||``,workflowInputs:n?a:z(r)}:{targetType:t})},children:[(0,P.jsx)(`option`,{value:`prompt`,children:`Prompt`}),(0,P.jsx)(`option`,{value:`workflow`,children:c(`schedules:schedulesPage.workflow`)})]})]}),e===`prompt`?(0,P.jsxs)(y,{variant:`control`,children:[`Prompt`,(0,P.jsx)(`textarea`,{value:t,onChange:e=>s({prompt:e.target.value}),placeholder:c(`schedules:schedulesPage.describeTheWorkTheAgentShouldCompleteEachTime`)})]}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(y,{variant:`control`,children:[c(`schedules:schedulesPage.workflow`),(0,P.jsxs)(i,{value:n,onChange:e=>{let t=o.find(t=>t.id===e.target.value);s({workflowId:e.target.value,workflowInputs:z(t)})},children:[(0,P.jsx)(`option`,{value:``,children:c(`schedules:schedulesPage.selectPublishedWorkflow`)}),o.map(e=>(0,P.jsxs)(`option`,{value:e.id,children:[e.name,` · v`,e.revision]},e.id))]}),(0,P.jsx)(`small`,{children:l?.description||(o.length?c(`schedules:schedulesPage.workflowUsesItsOwnRuntimeSettings`):c(`schedules:schedulesPage.noPublishedWorkflows`))})]}),l?.inputs.length?(0,P.jsxs)(`div`,{className:`grid gap-[8px]`,children:[(0,P.jsxs)(`div`,{className:`schedule-workflow-inputs-heading [&_strong]:text-[12px] [&_small]:text-[var(--text-muted)] [&_small]:text-[11px] [&_small]:text-right max-[650px]:items-start max-[650px]:flex-col max-[650px]:gap-[2px] max-[650px]:[&_small]:text-left flex [align-items:baseline] justify-between gap-[12px]`,children:[(0,P.jsx)(`strong`,{children:c(`schedules:schedulesPage.workflowInputs`)}),(0,P.jsx)(`small`,{children:c(`schedules:schedulesPage.workflowInputsHelp`)})]}),(0,P.jsx)(`div`,{className:`schedule-workflow-inputs [&_input[type='checkbox']]:w-[16px] [&_input[type='checkbox']]:h-[16px] [&_input[type='checkbox']]:[justify-self:end] max-[650px]:grid-cols-[1fr] grid grid-cols-[repeat(2,minmax(0,1fr))] gap-[8px]`,children:l.inputs.map(e=>(0,P.jsxs)(y,{variant:`control`,className:e.type===`boolean`?`grid grid-cols-[minmax(0,1fr)_auto] items-center`:void 0,children:[e.label,e.required?` *`:``,e.type===`boolean`?(0,P.jsx)(`input`,{type:`checkbox`,checked:!!a[e.name],onChange:t=>s({workflowInputs:{...a,[e.name]:t.target.checked}})}):(0,P.jsx)(`input`,{type:e.type===`number`?`number`:`text`,required:e.required,value:String(a[e.name]??``),onChange:t=>s({workflowInputs:{...a,[e.name]:t.target.value}})}),e.description&&(0,P.jsx)(`small`,{children:e.description})]},e.id))})]}):null]})]})}function H({value:e,onChange:t}){let{t:n}=r(),[i,a]=(0,N.useState)(``),[o,s]=(0,N.useState)(!1),l=async()=>{if(a(``),!M()){s(!0);return}try{let n=await j(e);n&&t(n)}catch(e){a(e instanceof Error?e.message:String(e))}};return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(y,{variant:`control`,children:[n(`schedules:schedulesPage.workingDirectory`),(0,P.jsxs)(`span`,{className:`schedule-workspace-input [&_input]:min-w-0 [&_input]:font-[ui-monospace,_SFMono-Regular,_Consolas,_'Liberation_Mono',_monospace] grid grid-cols-[minmax(0,1fr)_auto] gap-[6px]`,children:[(0,P.jsx)(`input`,{value:e,onChange:e=>t(e.target.value),placeholder:n(`schedules:schedulesPage.enterTheProjectSAbsolutePath`)}),(0,P.jsxs)(_,{type:`button`,variant:`outline`,size:`lg`,className:`bg-surface-subtle`,onClick:()=>void l(),children:[(0,P.jsx)(c,{size:13}),n(`schedules:schedulesPage.browseDirectories`)]})]}),(0,P.jsx)(`small`,{children:n(`schedules:schedulesPage.theScheduledAgentWillRunInThisDirectory`)})]}),i&&(0,P.jsxs)(x,{children:[(0,P.jsx)(m,{size:13}),i]}),(0,P.jsx)(v,{open:o,initialPath:e,description:n(`common:workspacePicker.selectWorkspaceForSchedule`),onOpenChange:s,onSelect:e=>t(e)})]})}function U(e){return{id:e.id,name:e.name,targetType:e.targetType||`prompt`,prompt:e.prompt,workflowId:e.workflowId||``,workflowInputs:e.workflowInputs||{},enabled:e.enabled,frequency:e.frequency,intervalValue:e.intervalValue||1,intervalUnit:e.intervalUnit||`hours`,time:e.time,timezone:e.timezone,dayOfWeek:e.dayOfWeek,dayOfMonth:e.dayOfMonth,cwd:e.cwd,executionMode:e.executionMode||`full-access`,model:e.model,notifications:e.notifications||[],notifyOn:e.notifyOn||`always`}}function W(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 G({notify:e,registerPrimaryAction:t,openNotificationSettings:n,requestConfirm:a}){let[o,c]=(0,N.useState)(!1),{t:l,language:d}=r(),[p,h]=(0,N.useState)({tasks:[],runs:[],notificationTargets:{browser:{enabled:!1},feishu:{enabled:!1},weixin:{enabled:!1},qq:{enabled:!1},telegram:{enabled:!1}},workflows:[],defaultCwd:``}),[v,j]=(0,N.useState)(``),[M,F]=(0,N.useState)(null),[I,z]=(0,N.useState)(!0),[G,q]=(0,N.useState)(!1),[le,J]=(0,N.useState)(``),[ue,Y]=(0,N.useState)(!1);k(t,()=>Y(!0));let X=(0,N.useCallback)(async()=>{try{let e=await g(`/api/schedules`);h(e),j(t=>e.tasks.some(e=>e.id===t)?t:e.tasks[0]?.id||``)}catch(e){J(e instanceof Error?e.message:String(e))}finally{z(!1)}},[]);(0,N.useEffect)(()=>{X()},[X]),(0,N.useEffect)(()=>{let e=window.setInterval(X,p.tasks.some(e=>e.lastStatus===`running`)?2e3:1e4);return()=>window.clearInterval(e)},[p.tasks,X]);let Z=p.tasks.find(e=>e.id===v),Q=p.workflows||[];(0,N.useEffect)(()=>{F(e=>Z?e?.id===Z.id?e:U(Z):null)},[Z]);let de=(0,N.useMemo)(()=>p.runs.filter(e=>e.taskId===v).sort((e,t)=>new Date(t.startedAt).getTime()-new Date(e.startedAt).getTime()).slice(0,20),[p.runs,v]),$=e=>F(t=>t&&{...t,...e}),fe=e=>{M&&$({notifications:M.notifications.includes(e)?M.notifications.filter(t=>t!==e):[...M.notifications,e]})};return I?(0,P.jsxs)(T,{children:[(0,P.jsx)(f,{className:`animate-spin`,size:23}),(0,P.jsx)(`h2`,{children:l(`schedules:schedulesPage.loadingScheduledTasks`)})]}):(0,P.jsx)(te,{variant:`list-detail`,children:(0,P.jsx)(`div`,{className:`flex h-full min-h-0 flex-col gap-3`,children:(0,P.jsxs)(P.Fragment,{children:[le&&(0,P.jsxs)(x,{children:[(0,P.jsx)(m,{size:13}),le]}),(0,P.jsx)(P.Fragment,{children:(0,P.jsx)(A,{selected:o,onBack:()=>c(!1),backLabel:l(`common:pageTemplate.backToList`),list:(0,P.jsxs)(D,{className:`min-w-0 border-0 bg-transparent p-0 shadow-none`,children:[(0,P.jsx)(w,{title:l(`schedules:schedulesPage.taskQueue`)}),p.tasks.length?p.tasks.map(e=>(0,P.jsx)(`div`,{className:`schedule-list-item hover:bg-[var(--accent-soft)] [&.active]:bg-[var(--accent-soft)] [&_>_button]:grid [&_>_button]:min-w-0 [&_>_button]:min-h-[68px] [&_>_button]:grid-cols-[minmax(0,1fr)_auto] [&_>_button]:items-center [&_>_button]:gap-[8px] [&_>_button]:border-0 [&_>_button]:bg-transparent [&_>_button]:p-[6px_2px] [&_>_button]:text-left [&_>_button_>_span]:flex [&_>_button_>_span]:min-w-0 [&_>_button_>_span]:flex-col [&_>_button_>_span]:gap-[5px] [&_strong]:overflow-hidden [&_strong]:text-ellipsis [&_strong]:whitespace-nowrap [&_small]:overflow-hidden [&_small]:text-ellipsis [&_small]:whitespace-nowrap [&_strong]:text-[13px] [&_small]:text-[var(--text-muted)] [&_small]:text-[13px] [&_em]:flex [&_em]:items-center [&_em]:gap-[4px] [&_em]:text-[var(--text-muted)] [&_em]:text-[13px] [&_em]:[font-style:normal] grid grid-cols-[minmax(0,1fr)_auto] items-center gap-[5px] [border-top:1px_solid_var(--stroke-soft)] rounded-[var(--r-sm)] [padding:3px_5px] ${v===e.id?`active`:``}`,children:(0,P.jsxs)(`button`,{onClick:()=>{c(!0),j(e.id)},children:[(0,P.jsxs)(`span`,{children:[(0,P.jsxs)(`div`,{className:`schedule-item-head [.schedule-list-item_&]:flex [.schedule-list-item_&]:min-w-0 [.schedule-list-item_&]:items-center [.schedule-list-item_&]:gap-[6px] [.schedule-list-item_&_strong]:flex-1 [.schedule-list-item_&_strong]:min-w-0`,children:[(0,P.jsx)(`strong`,{children:e.name}),(0,P.jsx)(S,{tone:e.enabled?`green`:`gray`,children:e.enabled?l(`schedules:schedulesPage.enabled`):l(`schedules:schedulesPage.pause`)})]}),(0,P.jsx)(`small`,{children:e.targetType===`workflow`?Q.find(t=>t.id===e.workflowId)?.name||l(`schedules:schedulesPage.workflowUnavailable`):e.prompt})]}),(0,P.jsx)(`em`,{children:W(e,d)})]})},e.id)):(0,P.jsxs)(`div`,{className:`channel-route-empty [&_strong]:mt-[9px] [&_strong]:text-[var(--text)] [&_strong]:text-[12px] [&_span]:mt-[4px] [&_span]:text-[13px] [&.compact]:min-h-[110px] [.workflow-assets-panel_&]:min-h-[150px] [.workflow-assets-panel_&]:border-0 [.workflow-assets-panel_&]:bg-transparent grid min-h-[185px] place-content-center justify-items-center text-[var(--text-muted)] text-center`,children:[(0,P.jsx)(O,{size:38}),(0,P.jsx)(`strong`,{children:l(`schedules:schedulesPage.theTimelineIsStillUnlit`)}),(0,P.jsx)(`span`,{children:l(`schedules:schedulesPage.createATaskAndLetItSetOutAutomaticallyAtTheAppointedTime`)})]})]}),detail:Z&&M?(0,P.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[(0,P.jsxs)(D,{children:[(0,P.jsxs)(C,{className:`max-[650px]:flex-wrap max-[650px]:items-start`,children:[(0,P.jsx)(`h2`,{className:`min-w-0 break-words`,children:M.name}),(0,P.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-[5px] max-[650px]:w-full`,children:[(0,P.jsx)(E,{value:M.enabled,onChange:e=>$({enabled:e}),ariaLabel:M.name}),(0,P.jsxs)(_,{size:`lg`,disabled:G||Z.lastStatus===`running`,onClick:async()=>{if(Z){q(!0),J(``);try{await g(`/api/schedules/${encodeURIComponent(Z.id)}/run`,{method:`POST`,body:`{}`}),await X(),e(l(`schedules:schedulesPage.scheduledTaskStarted`))}catch(e){J(e instanceof Error?e.message:String(e))}finally{q(!1)}}},children:[Z.lastStatus===`running`?(0,P.jsx)(f,{className:`animate-spin`,size:14}):(0,P.jsx)(u,{size:14}),Z.lastStatus===`running`?l(`schedules:schedulesPage.running`):l(`schedules:schedulesPage.runNow`)]}),(0,P.jsx)(_,{variant:`destructive`,size:`icon`,title:l(`schedules:schedulesPage.deleteTask`),"aria-label":l(`schedules:schedulesPage.deleteTask`),onClick:async()=>{if(Z&&await a({title:l(`schedules:schedulesPage.deleteScheduledTask`),message:l(`schedules:schedulesPage.deleteScheduledTaskNameAndItsRunHistory`,{name:Z.name}),confirmLabel:l(`schedules:schedulesPage.delete`)}))try{await g(`/api/schedules/${encodeURIComponent(Z.id)}`,{method:`DELETE`}),await X(),e(l(`schedules:schedulesPage.scheduledTaskDeleted`))}catch(e){J(e instanceof Error?e.message:String(e))}},children:(0,P.jsx)(ee,{size:14})})]})]}),(0,P.jsx)(V,{targetType:M.targetType,prompt:M.prompt,workflowId:M.workflowId,workflowInputs:M.workflowInputs,workflows:Q,onChange:$}),M.targetType===`prompt`&&(0,P.jsx)(H,{value:M.cwd,onChange:e=>$({cwd:e})}),(0,P.jsxs)(`div`,{className:`form-grid grid gap-[9px] three [.form-grid&]:grid-cols-[repeat(3,minmax(0,1fr))] max-[650px]:[.form-grid&]:grid-cols-[1fr]`,children:[(0,P.jsxs)(y,{variant:`control`,children:[l(`schedules:schedulesPage.frequency`),(0,P.jsx)(i,{value:M.frequency,onChange:e=>$({frequency:e.target.value}),children:Object.keys(re).map(e=>(0,P.jsx)(`option`,{value:e,children:oe(e,l)},e))})]}),M.frequency===`interval`?(0,P.jsxs)(y,{variant:`control`,children:[l(`schedules:schedulesPage.runInterval`),(0,P.jsxs)(`span`,{className:`schedule-interval-input [&_input]:w-full [&_input]:min-w-0 [&_input]:h-full [&_input]:border-0 [&_input]:[outline:0] [&_input]:bg-transparent [&_input]:p-[0_9px] [&_input]:text-[var(--text)] [&_select]:h-full [&_select]:border-0 [&_select]:[border-left:1px_solid_var(--stroke)] [&_select]:[outline:0] [&_select]:bg-[var(--solid)] [&_select]:p-[0_8px] [&_select]:text-[var(--text-tertiary)] [&_select]:text-[12px] [&_[data-slot='select-trigger']]:w-auto [&_[data-slot='select-trigger']]:min-w-[74px] [&_[data-slot='select-trigger']]:[border-left:1px_solid_var(--stroke)] [&_[data-slot='select-trigger']]:rounded-[0] [&_[data-slot='select-trigger']]:bg-[var(--solid)] [&_[data-slot='select-trigger']]:text-[var(--text-tertiary)] grid h-[31px] grid-cols-[minmax(0,1fr)_auto] overflow-hidden [border:1px_solid_var(--stroke)] rounded-[var(--r-xs)] bg-[var(--surface-subtle)]`,children:[(0,P.jsx)(`input`,{type:`number`,min:`1`,value:M.intervalValue,onChange:e=>$({intervalValue:Number(e.target.value)})}),(0,P.jsx)(i,{value:M.intervalUnit,onChange:e=>$({intervalUnit:e.target.value}),children:Object.keys(ie).map(e=>(0,P.jsx)(`option`,{value:e,children:se(e,l)},e))})]})]}):(0,P.jsxs)(y,{variant:`control`,children:[l(`schedules:schedulesPage.time`),(0,P.jsx)(`input`,{type:`time`,value:M.time,onChange:e=>$({time:e.target.value})})]}),(0,P.jsxs)(y,{variant:`control`,children:[l(`schedules:schedulesPage.timeZone`),(0,P.jsx)(i,{value:M.timezone,onChange:e=>$({timezone:e.target.value}),children:ae.map(e=>(0,P.jsx)(`option`,{value:e,children:e},e))})]}),M.targetType===`prompt`&&(0,P.jsx)(R,{value:M.executionMode,onChange:e=>$({executionMode:e})})]}),(0,P.jsxs)(`div`,{className:`schedule-notification-section [&_>_div:first-child]:flex [&_>_div:first-child]:items-center [&_>_div:first-child]:justify-between [&_>_div:first-child]:gap-[8px] [&_>_div:first-child_strong]:text-[13px] [&_>_p]:mt-[4px] [&_>_p]:text-[var(--text-muted)] [&_>_p]:text-[13px] [margin-top:13px] [border-top:1px_solid_var(--stroke-soft)] [padding-top:12px]`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`strong`,{children:l(`schedules:schedulesPage.notificationChannels`)}),(0,P.jsx)(`button`,{type:`button`,className:`text-button hover:text-[var(--text)] border-0 bg-transparent text-[var(--text-soft)] text-[12px] font-[600] [text-decoration:underline] [text-underline-offset:2px]`,onClick:n,children:l(`schedules:schedulesPage.editTemplates`)})]}),(0,P.jsx)(`p`,{children:l(`schedules:schedulesPage.notificationChannelsHelp`)}),(0,P.jsx)(`div`,{className:`schedule-notification-targets [&_>_button]:grid [&_>_button]:min-h-[52px] [&_>_button]:grid-cols-[auto_minmax(0,1fr)_auto] [&_>_button]:items-center [&_>_button]:gap-[7px] [&_>_button]:[border:1px_solid_var(--stroke)] [&_>_button]:rounded-[var(--r-sm)] [&_>_button]:bg-[var(--surface-subtle)] [&_>_button]:p-[7px_8px] [&_>_button]:text-left [&_>_button_>_span]:flex [&_>_button_>_span]:min-w-0 [&_>_button_>_span]:flex-col [&_>_button_>_span]:gap-[3px] [&_strong]:text-[13px] [&_small]:overflow-hidden [&_small]:text-[var(--text-muted)] [&_small]:text-[13px] [&_small]:text-ellipsis [&_small]:whitespace-nowrap [&_>_button_>_svg:last-child]:text-[var(--control-muted)] [&_>_button.selected]:border-[var(--focus)] [&_>_button.selected]:bg-[var(--accent-soft)] [&_>_button.selected]:text-[var(--star-strong)] [&_>_button.selected_>_svg:last-child]:text-[var(--success)] max-[650px]:grid-cols-[1fr] grid grid-cols-[repeat(5,minmax(0,1fr))] gap-[7px] [margin-top:9px]`,children:Object.entries(ne).map(([e,t])=>{let n=t.Icon,r=M.notifications.includes(e);return(0,P.jsxs)(`button`,{type:`button`,className:r?`selected`:``,onClick:()=>fe(e),children:[(0,P.jsx)(n,{size:15}),(0,P.jsxs)(`span`,{children:[(0,P.jsx)(`strong`,{children:L(e,l)}),(0,P.jsx)(`small`,{children:p.notificationTargets[e].enabled?l(`schedules:schedulesPage.configured`):l(`schedules:schedulesPage.notConfigured`)})]}),(0,P.jsx)(s,{size:15})]},e)})}),(0,P.jsx)(`div`,{className:`flex items-center gap-[6px] [margin-top:9px]`,children:(0,P.jsx)(`button`,{type:`button`,className:`schedule-notification-chip [&.selected]:border-[var(--control-selected-border)] [&.selected]:bg-[var(--control-selected-bg)] [&.selected]:text-[var(--control-selected-text)] [&.selected]:shadow-[var(--sh-1)] dark:bg-[var(--surface-subtle)] inline-flex h-[32px] items-center gap-[4px] [border:1px_solid_var(--stroke)] rounded-[var(--r-pill)] bg-[var(--surface-subtle)] text-[var(--text-muted)] [padding:0_10px] text-[13px] font-[600] ${M.notifyOn===`failure`?`selected`:``}`,onClick:()=>$({notifyOn:M.notifyOn===`failure`?`always`:`failure`}),children:M.notifyOn===`failure`?l(`schedules:schedulesPage.failuresOnly`):l(`schedules:schedulesPage.completionAndFailure`)})})]}),(0,P.jsxs)(`div`,{className:`form-footer [&_>_span]:text-[var(--text-muted)] [&_>_span]:text-[13px] flex items-center justify-between gap-[10px] [margin-top:10px]`,children:[(0,P.jsx)(`span`,{children:Z.lastRunAt?l(`schedules:schedulesPage.lastRunTime`,{time:b(Z.lastRunAt,d)}):l(`schedules:schedulesPage.nextRunTime`,{time:W(Z,d)})}),(0,P.jsxs)(_,{size:`lg`,disabled:G||!B(M.targetType,M.prompt,M.workflowId,M.workflowInputs,Q),onClick:async()=>{if(!(!Z||!M)){q(!0),J(``);try{let t=await g(`/api/schedules/${encodeURIComponent(Z.id)}`,{method:`PATCH`,body:JSON.stringify(M)});h(t.state),F(U(t.task)),e(l(`schedules:schedulesPage.scheduledTaskSaved`))}catch(e){J(e instanceof Error?e.message:String(e))}finally{q(!1)}}},children:[G?(0,P.jsx)(f,{className:`animate-spin`,size:14}):null,l(G?`schedules:schedulesPage.saving`:`schedules:schedulesPage.saveTask`)]})]})]}),(0,P.jsxs)(D,{children:[(0,P.jsx)(w,{title:l(`schedules:schedulesPage.recentRuns`)}),de.length?de.map(e=>(0,P.jsxs)(`div`,{className:`schedule-run-row [&_>_svg]:text-[var(--text-muted)] [&.completed_>_svg]:text-[var(--success)] [&.failed_>_svg]:text-[var(--danger)] [&.running_>_svg]:text-[var(--star-strong)] [&_>_span]:flex [&_>_span]:min-w-0 [&_>_span]:flex-col [&_>_span]:gap-[4px] [&_strong]:[display:-webkit-box] [&_strong]:overflow-hidden [&_strong]:text-[12px] [&_strong]:leading-[1.4] [&_strong]:[-webkit-box-orient:vertical] [&_strong]:[-webkit-line-clamp:2] [&_small]:text-[var(--text-muted)] [&_small]:text-[13px] [&_a]:text-[var(--text-soft)] [&_a]:text-[13px] [&_a]:[text-decoration:underline] [&_a]:[text-underline-offset:2px] [&_>_em]:text-[var(--text-secondary)] [&_>_em]:text-[12px] [&_>_em]:[font-style:normal] [&_>_em]:whitespace-nowrap grid grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-[9px] [border-top:1px_solid_var(--stroke-soft)] [padding:10px_2px] ${e.status}`,children:[e.status===`running`?(0,P.jsx)(f,{className:`animate-spin`,size:15}):e.status===`completed`?(0,P.jsx)(s,{size:15}):(0,P.jsx)(m,{size:15}),(0,P.jsxs)(`span`,{children:[(0,P.jsx)(`strong`,{children:e.status===`running`?l(`schedules:schedulesPage.running2`):e.status===`completed`?e.summary||l(`schedules:schedulesPage.taskCompleted`):e.status===`interrupted`?l(`schedules:schedulesPage.taskInterrupted`):e.error||l(`schedules:schedulesPage.taskFailed`)}),(0,P.jsxs)(`small`,{children:[b(e.startedAt,d),` ·`,` `,e.trigger===`manual`?l(`schedules:schedulesPage.manualRun`):l(`schedules:schedulesPage.scheduledTrigger`),e.durationMs?` · ${l(`schedules:schedulesPage.countSec`,{count:Math.round(e.durationMs/1e3)})}`:``]})]}),(0,P.jsx)(`em`,{children:new Intl.DateTimeFormat(d,{hour:`2-digit`,minute:`2-digit`}).format(new Date(e.startedAt))})]},e.id)):(0,P.jsxs)(`div`,{className:`channel-route-empty [&_strong]:mt-[9px] [&_strong]:text-[var(--text)] [&_strong]:text-[12px] [&_span]:mt-[4px] [&_span]:text-[13px] [&.compact]:min-h-[110px] [.workflow-assets-panel_&]:min-h-[150px] [.workflow-assets-panel_&]:border-0 [.workflow-assets-panel_&]:bg-transparent grid min-h-[185px] place-content-center justify-items-center text-[var(--text-muted)] text-center compact`,children:[(0,P.jsx)(O,{size:32}),(0,P.jsx)(`strong`,{children:l(`schedules:schedulesPage.noRunHistory`)})]})]})]}):(0,P.jsx)(K,{notificationTargets:p.notificationTargets,workflows:Q,defaultCwd:p.defaultCwd,onCreated:t=>{h(t.state),j(t.task.id),c(!0),e(l(`schedules:schedulesPage.scheduledTaskCreated`))}})})}),ue&&(0,P.jsx)(ce,{notificationTargets:p.notificationTargets,workflows:Q,defaultCwd:p.defaultCwd,onClose:()=>Y(!1),onCreated:t=>{Y(!1),h(t.state),j(t.task.id),c(!0),e(l(`schedules:schedulesPage.scheduledTaskCreated`))}})]})})})}function K({notificationTargets:e,workflows:t,defaultCwd:n,onCreated:a}){let{t:o}=r(),[s,c]=(0,N.useState)(``),[l,u]=(0,N.useState)(`prompt`),[p,ee]=(0,N.useState)(``),[h,v]=(0,N.useState)(``),[b,S]=(0,N.useState)({}),[w,T]=(0,N.useState)(n||``),[E,te]=(0,N.useState)(`daily`),[O,k]=(0,N.useState)(`09:00`),[A,j]=(0,N.useState)(`Asia/Hong_Kong`),[M,ne]=(0,N.useState)(1),[F,I]=(0,N.useState)(`hours`),[L,z]=(0,N.useState)(`full-access`),[U,W]=(0,N.useState)(!1),[G,K]=(0,N.useState)(``);return(0,P.jsxs)(D,{children:[(0,P.jsx)(C,{children:(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`h2`,{children:o(`schedules:schedulesPage.newScheduledTask`)}),(0,P.jsx)(`p`,{children:o(`schedules:schedulesPage.youCanContinueEditingTheRunTimeAndNotificationChannelsAfterCreation`)})]})}),(0,P.jsxs)(y,{variant:`control`,children:[o(`schedules:schedulesPage.taskName`),(0,P.jsx)(`input`,{value:s,onChange:e=>c(e.target.value),placeholder:o(`schedules:schedulesPage.forExampleDailyCodeReview`)})]}),(0,P.jsx)(V,{targetType:l,prompt:p,workflowId:h,workflowInputs:b,workflows:t,onChange:e=>{e.targetType&&u(e.targetType),e.prompt!==void 0&&ee(e.prompt),e.workflowId!==void 0&&v(e.workflowId),e.workflowInputs!==void 0&&S(e.workflowInputs)}}),l===`prompt`&&(0,P.jsx)(H,{value:w,onChange:T}),(0,P.jsxs)(`div`,{className:`form-grid grid gap-[9px] three [.form-grid&]:grid-cols-[repeat(3,minmax(0,1fr))] max-[650px]:[.form-grid&]:grid-cols-[1fr]`,children:[(0,P.jsxs)(y,{variant:`control`,children:[o(`schedules:schedulesPage.frequency`),(0,P.jsx)(i,{value:E,onChange:e=>te(e.target.value),children:Object.keys(re).map(e=>(0,P.jsx)(`option`,{value:e,children:oe(e,o)},e))})]}),E===`interval`?(0,P.jsxs)(y,{variant:`control`,children:[o(`schedules:schedulesPage.runInterval`),(0,P.jsxs)(`span`,{className:`schedule-interval-input [&_input]:w-full [&_input]:min-w-0 [&_input]:h-full [&_input]:border-0 [&_input]:[outline:0] [&_input]:bg-transparent [&_input]:p-[0_9px] [&_input]:text-[var(--text)] [&_select]:h-full [&_select]:border-0 [&_select]:[border-left:1px_solid_var(--stroke)] [&_select]:[outline:0] [&_select]:bg-[var(--solid)] [&_select]:p-[0_8px] [&_select]:text-[var(--text-tertiary)] [&_select]:text-[12px] [&_[data-slot='select-trigger']]:w-auto [&_[data-slot='select-trigger']]:min-w-[74px] [&_[data-slot='select-trigger']]:[border-left:1px_solid_var(--stroke)] [&_[data-slot='select-trigger']]:rounded-[0] [&_[data-slot='select-trigger']]:bg-[var(--solid)] [&_[data-slot='select-trigger']]:text-[var(--text-tertiary)] grid h-[31px] grid-cols-[minmax(0,1fr)_auto] overflow-hidden [border:1px_solid_var(--stroke)] rounded-[var(--r-xs)] bg-[var(--surface-subtle)]`,children:[(0,P.jsx)(`input`,{type:`number`,min:`1`,value:M,onChange:e=>ne(Number(e.target.value))}),(0,P.jsx)(i,{value:F,onChange:e=>I(e.target.value),children:Object.keys(ie).map(e=>(0,P.jsx)(`option`,{value:e,children:se(e,o)},e))})]})]}):(0,P.jsxs)(y,{variant:`control`,children:[o(`schedules:schedulesPage.time`),(0,P.jsx)(`input`,{type:`time`,value:O,onChange:e=>k(e.target.value)})]}),(0,P.jsxs)(y,{variant:`control`,children:[o(`schedules:schedulesPage.timeZone`),(0,P.jsx)(i,{value:A,onChange:e=>j(e.target.value),children:ae.map(e=>(0,P.jsx)(`option`,{value:e,children:e},e))})]}),l===`prompt`&&(0,P.jsx)(R,{value:L,onChange:z})]}),G&&(0,P.jsxs)(x,{children:[(0,P.jsx)(m,{size:13}),G]}),(0,P.jsxs)(`div`,{className:`form-footer [&_>_span]:text-[var(--text-muted)] [&_>_span]:text-[13px] flex items-center justify-between gap-[10px] [margin-top:10px]`,children:[(0,P.jsx)(`span`,{children:o(`schedules:schedulesPage.enabledAutomaticallyAfterCreation`)}),(0,P.jsxs)(_,{size:`lg`,disabled:U||!s.trim()||!B(l,p,h,b,t),onClick:async()=>{W(!0),K(``);try{let t=Object.entries(e).filter(([,e])=>e.enabled).map(([e])=>e);a(await g(`/api/schedules`,{method:`POST`,body:JSON.stringify({name:s,targetType:l,prompt:p,workflowId:h,workflowInputs:b,cwd:w,enabled:!0,frequency:E,time:O,timezone:A,intervalValue:M,intervalUnit:F,executionMode:L,notifications:t,notifyOn:`always`})}))}catch(e){K(e instanceof Error?e.message:String(e))}finally{W(!1)}},children:[U?(0,P.jsx)(f,{className:`animate-spin`,size:14}):(0,P.jsx)(d,{size:14}),o(U?`schedules:schedulesPage.creating`:`schedules:schedulesPage.createTask`)]})]})]})}function ce({notificationTargets:e,workflows:t,defaultCwd:n,onClose:i,onCreated:a}){let{t:o}=r(),[s,c]=(0,N.useState)(``),[l,u]=(0,N.useState)(`prompt`),[p,ee]=(0,N.useState)(``),[v,b]=(0,N.useState)(``),[S,w]=(0,N.useState)({}),[T,E]=(0,N.useState)(n||``),[D,te]=(0,N.useState)(`full-access`),[O,k]=(0,N.useState)(!1),[A,j]=(0,N.useState)(``);return(0,P.jsx)(`div`,{className:`modal-backdrop max-[650px]:p-[8px] fixed z-[70] inset-0 grid place-items-center overflow-y-auto bg-[var(--modal-overlay)] [backdrop-filter:blur(3px)] [padding:20px] [overscroll-behavior:contain] [animation:fade-in_var(--d1)_var(--ease-out)]`,onMouseDown:e=>e.target===e.currentTarget&&i(),children:(0,P.jsxs)(`form`,{className:`modal !w-[min(430px,100%)] max-h-[calc(100dvh_-_40px)] overflow-y-auto [overscroll-behavior:contain] [border:1px_solid_var(--surface-highlight)] rounded-[var(--r-md)] bg-[var(--solid)] p-[18px] shadow-[0_26px_70px_-25px_var(--shadow-strong)] [animation:modal-in_var(--d2)_var(--ease-out)] max-[650px]:max-h-[calc(100dvh_-_16px)]`,onSubmit:async t=>{t.preventDefault(),k(!0),j(``);try{let t=Object.entries(e).filter(([,e])=>e.enabled).map(([e])=>e);a(await g(`/api/schedules`,{method:`POST`,body:JSON.stringify({name:s,targetType:l,prompt:p,workflowId:v,workflowInputs:S,cwd:T,enabled:!0,frequency:`daily`,time:`09:00`,timezone:`Asia/Hong_Kong`,executionMode:D,notifications:t,notifyOn:`always`})}))}catch(e){j(e instanceof Error?e.message:String(e))}finally{k(!1)}},children:[(0,P.jsxs)(C,{children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`h2`,{children:o(`schedules:schedulesPage.newScheduledTask`)}),(0,P.jsx)(`p`,{children:o(`schedules:schedulesPage.youCanContinueSettingTheRunTimeAndNotificationChannelsAfterCreation`)})]}),(0,P.jsx)(_,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":o(`schedules:schedulesPage.closeDialog`),onClick:i,children:(0,P.jsx)(h,{size:17})})]}),(0,P.jsxs)(y,{variant:`control`,children:[o(`schedules:schedulesPage.taskName`),(0,P.jsx)(`input`,{value:s,onChange:e=>c(e.target.value),placeholder:o(`schedules:schedulesPage.forExampleDailyCodeReview`)})]}),(0,P.jsx)(V,{targetType:l,prompt:p,workflowId:v,workflowInputs:S,workflows:t,onChange:e=>{e.targetType&&u(e.targetType),e.prompt!==void 0&&ee(e.prompt),e.workflowId!==void 0&&b(e.workflowId),e.workflowInputs!==void 0&&w(e.workflowInputs)}}),l===`prompt`&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(H,{value:T,onChange:E}),(0,P.jsx)(R,{value:D,onChange:te})]}),A&&(0,P.jsxs)(x,{children:[(0,P.jsx)(m,{size:13}),A]}),(0,P.jsxs)(`div`,{className:`flex justify-end gap-[8px] [margin-top:18px]`,children:[(0,P.jsx)(_,{type:`button`,variant:`outline`,size:`lg`,className:`bg-surface-subtle`,onClick:i,children:o(`schedules:schedulesPage.cancel`)}),(0,P.jsxs)(_,{size:`lg`,disabled:O||!s.trim()||!B(l,p,v,S,t),children:[O?(0,P.jsx)(f,{className:`animate-spin`,size:14}):(0,P.jsx)(d,{size:14}),o(O?`schedules:schedulesPage.creating`:`schedules:schedulesPage.createTask`)]})]})]})})}export{G as SchedulesPage};
|
|
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-BrWBoyFl.js";import{t as i}from"./AppSelect-DEmkrcvY.js";import{t as a}from"./bell-BjONAtgH.js";import{t as o}from"./bot-B3TaBp_T.js";import{t as s}from"./circle-check-iEdCm3Pw.js";import{t as c}from"./folder-open-FIShC5Qk.js";import{t as l}from"./message-circle-D-XrK6Ft.js";import{t as u}from"./play-DNDjDNGn.js";import{t as d}from"./plus-fQbSqB1n.js";import{t as f}from"./refresh-cw-TbWxTY4K.js";import{t as p}from"./send-Cj-W03w_.js";import{t as ee}from"./trash-2-CNrPOoPR.js";import{t as m}from"./triangle-alert-CE1q54ci.js";import{t as h}from"./x-07u4-129.js";import{t as g}from"./api-CiEo53J1.js";import{t as _}from"./button-BcPDt1Ge.js";import{WorkspacePicker as v}from"./WorkspacePicker-NkoVoqez.js";import{t as y}from"./field-3bN8nouy.js";import{r as b}from"./format-BRFKAYMT.js";import{i as x,l as S,n as C,o as w,r as T,s as E,t as D}from"./app-primitives-DhqJLud3.js";import{t as te}from"./PageFrame-BiJUCJku.js";import{t as O}from"./StarOrbit-BAAjh-hY.js";import{t as k}from"./usePagePrimaryAction-CWPC0C_f.js";import{t as A}from"./ListDetailLayout-Ctr6r0OI.js";import{n as j,t as M}from"./pick-system-directory-BnIFt85A.js";var N=e(t(),1),P=n(),ne={browser:{name:`通知`,Icon:a},feishu:{name:`飞书`,Icon:o},weixin:{name:`微信`,Icon:l},qq:{name:`QQ`,Icon:l},telegram:{name:`Telegram`,Icon:p}},re={interval:`每隔一段时间`,daily:`每天`,weekly:`每周`,monthly:`每月`},ie={minutes:`分钟`,hours:`小时`,days:`天`},ae=[...new Set([`Asia/Hong_Kong`,`UTC`,...typeof Intl.supportedValuesOf==`function`?Intl.supportedValuesOf(`timeZone`):[]])],F=[`full-access`];function I(e){return e(`schedules:schedulesPage.fullAccessHelp`)}function oe(e,t){return t(e===`daily`?`schedules:schedulesPage.daily`:e===`weekly`?`schedules:schedulesPage.weekly`:e===`monthly`?`schedules:schedulesPage.monthly`:`schedules:schedulesPage.atIntervals`)}function se(e,t){return t(e===`hours`?`schedules:schedulesPage.hours`:e===`days`?`schedules:schedulesPage.days`:`schedules:schedulesPage.minutes`)}function L(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 R({value:e,onChange:t}){let{t:n}=r();return(0,P.jsxs)(y,{variant:`control`,children:[n(`schedules:schedulesPage.executionMode`),(0,P.jsx)(i,{value:e,onChange:e=>t(e.target.value),children:F.map(e=>(0,P.jsx)(`option`,{value:e,children:n(`schedules:schedulesPage.fullAccess`)},e))}),(0,P.jsx)(`small`,{children:I(n)})]})}function z(e){return Object.fromEntries((e?.inputs||[]).map(e=>[e.name,e.defaultValue??``]))}function B(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 V({targetType:e,prompt:t,workflowId:n,workflowInputs:a,workflows:o,onChange:s}){let{t:c}=r(),l=o.find(e=>e.id===n);return(0,P.jsxs)(`div`,{className:`grid gap-[10px]`,children:[(0,P.jsxs)(y,{variant:`control`,children:[c(`schedules:schedulesPage.executionTarget`),(0,P.jsxs)(i,{value:e,onChange:e=>{let t=e.target.value,r=o[0];s(t===`workflow`?{targetType:t,workflowId:n||r?.id||``,workflowInputs:n?a:z(r)}:{targetType:t})},children:[(0,P.jsx)(`option`,{value:`prompt`,children:`Prompt`}),(0,P.jsx)(`option`,{value:`workflow`,children:c(`schedules:schedulesPage.workflow`)})]})]}),e===`prompt`?(0,P.jsxs)(y,{variant:`control`,children:[`Prompt`,(0,P.jsx)(`textarea`,{value:t,onChange:e=>s({prompt:e.target.value}),placeholder:c(`schedules:schedulesPage.describeTheWorkTheAgentShouldCompleteEachTime`)})]}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(y,{variant:`control`,children:[c(`schedules:schedulesPage.workflow`),(0,P.jsxs)(i,{value:n,onChange:e=>{let t=o.find(t=>t.id===e.target.value);s({workflowId:e.target.value,workflowInputs:z(t)})},children:[(0,P.jsx)(`option`,{value:``,children:c(`schedules:schedulesPage.selectPublishedWorkflow`)}),o.map(e=>(0,P.jsxs)(`option`,{value:e.id,children:[e.name,` · v`,e.revision]},e.id))]}),(0,P.jsx)(`small`,{children:l?.description||(o.length?c(`schedules:schedulesPage.workflowUsesItsOwnRuntimeSettings`):c(`schedules:schedulesPage.noPublishedWorkflows`))})]}),l?.inputs.length?(0,P.jsxs)(`div`,{className:`grid gap-[8px]`,children:[(0,P.jsxs)(`div`,{className:`schedule-workflow-inputs-heading [&_strong]:text-[12px] [&_small]:text-[var(--text-muted)] [&_small]:text-[11px] [&_small]:text-right max-[650px]:items-start max-[650px]:flex-col max-[650px]:gap-[2px] max-[650px]:[&_small]:text-left flex [align-items:baseline] justify-between gap-[12px]`,children:[(0,P.jsx)(`strong`,{children:c(`schedules:schedulesPage.workflowInputs`)}),(0,P.jsx)(`small`,{children:c(`schedules:schedulesPage.workflowInputsHelp`)})]}),(0,P.jsx)(`div`,{className:`schedule-workflow-inputs [&_input[type='checkbox']]:w-[16px] [&_input[type='checkbox']]:h-[16px] [&_input[type='checkbox']]:[justify-self:end] max-[650px]:grid-cols-[1fr] grid grid-cols-[repeat(2,minmax(0,1fr))] gap-[8px]`,children:l.inputs.map(e=>(0,P.jsxs)(y,{variant:`control`,className:e.type===`boolean`?`grid grid-cols-[minmax(0,1fr)_auto] items-center`:void 0,children:[e.label,e.required?` *`:``,e.type===`boolean`?(0,P.jsx)(`input`,{type:`checkbox`,checked:!!a[e.name],onChange:t=>s({workflowInputs:{...a,[e.name]:t.target.checked}})}):(0,P.jsx)(`input`,{type:e.type===`number`?`number`:`text`,required:e.required,value:String(a[e.name]??``),onChange:t=>s({workflowInputs:{...a,[e.name]:t.target.value}})}),e.description&&(0,P.jsx)(`small`,{children:e.description})]},e.id))})]}):null]})]})}function H({value:e,onChange:t}){let{t:n}=r(),[i,a]=(0,N.useState)(``),[o,s]=(0,N.useState)(!1),l=async()=>{if(a(``),!M()){s(!0);return}try{let n=await j(e);n&&t(n)}catch(e){a(e instanceof Error?e.message:String(e))}};return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(y,{variant:`control`,children:[n(`schedules:schedulesPage.workingDirectory`),(0,P.jsxs)(`span`,{className:`schedule-workspace-input [&_input]:min-w-0 [&_input]:font-[ui-monospace,_SFMono-Regular,_Consolas,_'Liberation_Mono',_monospace] grid grid-cols-[minmax(0,1fr)_auto] gap-[6px]`,children:[(0,P.jsx)(`input`,{value:e,onChange:e=>t(e.target.value),placeholder:n(`schedules:schedulesPage.enterTheProjectSAbsolutePath`)}),(0,P.jsxs)(_,{type:`button`,variant:`outline`,size:`lg`,className:`bg-surface-subtle`,onClick:()=>void l(),children:[(0,P.jsx)(c,{size:13}),n(`schedules:schedulesPage.browseDirectories`)]})]}),(0,P.jsx)(`small`,{children:n(`schedules:schedulesPage.theScheduledAgentWillRunInThisDirectory`)})]}),i&&(0,P.jsxs)(x,{children:[(0,P.jsx)(m,{size:13}),i]}),(0,P.jsx)(v,{open:o,initialPath:e,description:n(`common:workspacePicker.selectWorkspaceForSchedule`),onOpenChange:s,onSelect:e=>t(e)})]})}function U(e){return{id:e.id,name:e.name,targetType:e.targetType||`prompt`,prompt:e.prompt,workflowId:e.workflowId||``,workflowInputs:e.workflowInputs||{},enabled:e.enabled,frequency:e.frequency,intervalValue:e.intervalValue||1,intervalUnit:e.intervalUnit||`hours`,time:e.time,timezone:e.timezone,dayOfWeek:e.dayOfWeek,dayOfMonth:e.dayOfMonth,cwd:e.cwd,executionMode:e.executionMode||`full-access`,model:e.model,notifications:e.notifications||[],notifyOn:e.notifyOn||`always`}}function W(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 G({notify:e,registerPrimaryAction:t,openNotificationSettings:n,requestConfirm:a}){let[o,c]=(0,N.useState)(!1),{t:l,language:d}=r(),[p,h]=(0,N.useState)({tasks:[],runs:[],notificationTargets:{browser:{enabled:!1},feishu:{enabled:!1},weixin:{enabled:!1},qq:{enabled:!1},telegram:{enabled:!1}},workflows:[],defaultCwd:``}),[v,j]=(0,N.useState)(``),[M,F]=(0,N.useState)(null),[I,z]=(0,N.useState)(!0),[G,q]=(0,N.useState)(!1),[le,J]=(0,N.useState)(``),[ue,Y]=(0,N.useState)(!1);k(t,()=>Y(!0));let X=(0,N.useCallback)(async()=>{try{let e=await g(`/api/schedules`);h(e),j(t=>e.tasks.some(e=>e.id===t)?t:e.tasks[0]?.id||``)}catch(e){J(e instanceof Error?e.message:String(e))}finally{z(!1)}},[]);(0,N.useEffect)(()=>{X()},[X]),(0,N.useEffect)(()=>{let e=window.setInterval(X,p.tasks.some(e=>e.lastStatus===`running`)?2e3:1e4);return()=>window.clearInterval(e)},[p.tasks,X]);let Z=p.tasks.find(e=>e.id===v),Q=p.workflows||[];(0,N.useEffect)(()=>{F(e=>Z?e?.id===Z.id?e:U(Z):null)},[Z]);let de=(0,N.useMemo)(()=>p.runs.filter(e=>e.taskId===v).sort((e,t)=>new Date(t.startedAt).getTime()-new Date(e.startedAt).getTime()).slice(0,20),[p.runs,v]),$=e=>F(t=>t&&{...t,...e}),fe=e=>{M&&$({notifications:M.notifications.includes(e)?M.notifications.filter(t=>t!==e):[...M.notifications,e]})};return I?(0,P.jsxs)(T,{children:[(0,P.jsx)(f,{className:`animate-spin`,size:23}),(0,P.jsx)(`h2`,{children:l(`schedules:schedulesPage.loadingScheduledTasks`)})]}):(0,P.jsx)(te,{variant:`list-detail`,children:(0,P.jsx)(`div`,{className:`flex h-full min-h-0 flex-col gap-3`,children:(0,P.jsxs)(P.Fragment,{children:[le&&(0,P.jsxs)(x,{children:[(0,P.jsx)(m,{size:13}),le]}),(0,P.jsx)(P.Fragment,{children:(0,P.jsx)(A,{selected:o,onBack:()=>c(!1),backLabel:l(`common:pageTemplate.backToList`),list:(0,P.jsxs)(D,{className:`min-w-0 border-0 bg-transparent p-0 shadow-none`,children:[(0,P.jsx)(w,{title:l(`schedules:schedulesPage.taskQueue`)}),p.tasks.length?p.tasks.map(e=>(0,P.jsx)(`div`,{className:`schedule-list-item hover:bg-[var(--accent-soft)] [&.active]:bg-[var(--accent-soft)] [&_>_button]:grid [&_>_button]:min-w-0 [&_>_button]:min-h-[68px] [&_>_button]:grid-cols-[minmax(0,1fr)_auto] [&_>_button]:items-center [&_>_button]:gap-[8px] [&_>_button]:border-0 [&_>_button]:bg-transparent [&_>_button]:p-[6px_2px] [&_>_button]:text-left [&_>_button_>_span]:flex [&_>_button_>_span]:min-w-0 [&_>_button_>_span]:flex-col [&_>_button_>_span]:gap-[5px] [&_strong]:overflow-hidden [&_strong]:text-ellipsis [&_strong]:whitespace-nowrap [&_small]:overflow-hidden [&_small]:text-ellipsis [&_small]:whitespace-nowrap [&_strong]:text-[13px] [&_small]:text-[var(--text-muted)] [&_small]:text-[13px] [&_em]:flex [&_em]:items-center [&_em]:gap-[4px] [&_em]:text-[var(--text-muted)] [&_em]:text-[13px] [&_em]:[font-style:normal] grid grid-cols-[minmax(0,1fr)_auto] items-center gap-[5px] [border-top:1px_solid_var(--stroke-soft)] rounded-[var(--r-sm)] [padding:3px_5px] ${v===e.id?`active`:``}`,children:(0,P.jsxs)(`button`,{onClick:()=>{c(!0),j(e.id)},children:[(0,P.jsxs)(`span`,{children:[(0,P.jsxs)(`div`,{className:`schedule-item-head [.schedule-list-item_&]:flex [.schedule-list-item_&]:min-w-0 [.schedule-list-item_&]:items-center [.schedule-list-item_&]:gap-[6px] [.schedule-list-item_&_strong]:flex-1 [.schedule-list-item_&_strong]:min-w-0`,children:[(0,P.jsx)(`strong`,{children:e.name}),(0,P.jsx)(S,{tone:e.enabled?`green`:`gray`,children:e.enabled?l(`schedules:schedulesPage.enabled`):l(`schedules:schedulesPage.pause`)})]}),(0,P.jsx)(`small`,{children:e.targetType===`workflow`?Q.find(t=>t.id===e.workflowId)?.name||l(`schedules:schedulesPage.workflowUnavailable`):e.prompt})]}),(0,P.jsx)(`em`,{children:W(e,d)})]})},e.id)):(0,P.jsxs)(`div`,{className:`channel-route-empty [&_strong]:mt-[9px] [&_strong]:text-[var(--text)] [&_strong]:text-[12px] [&_span]:mt-[4px] [&_span]:text-[13px] [&.compact]:min-h-[110px] [.workflow-assets-panel_&]:min-h-[150px] [.workflow-assets-panel_&]:border-0 [.workflow-assets-panel_&]:bg-transparent grid min-h-[185px] place-content-center justify-items-center text-[var(--text-muted)] text-center`,children:[(0,P.jsx)(O,{size:38}),(0,P.jsx)(`strong`,{children:l(`schedules:schedulesPage.theTimelineIsStillUnlit`)}),(0,P.jsx)(`span`,{children:l(`schedules:schedulesPage.createATaskAndLetItSetOutAutomaticallyAtTheAppointedTime`)})]})]}),detail:Z&&M?(0,P.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[(0,P.jsxs)(D,{children:[(0,P.jsxs)(C,{className:`max-[650px]:flex-wrap max-[650px]:items-start`,children:[(0,P.jsx)(`h2`,{className:`min-w-0 break-words`,children:M.name}),(0,P.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-[5px] max-[650px]:w-full`,children:[(0,P.jsx)(E,{value:M.enabled,onChange:e=>$({enabled:e}),ariaLabel:M.name}),(0,P.jsxs)(_,{size:`lg`,disabled:G||Z.lastStatus===`running`,onClick:async()=>{if(Z){q(!0),J(``);try{await g(`/api/schedules/${encodeURIComponent(Z.id)}/run`,{method:`POST`,body:`{}`}),await X(),e(l(`schedules:schedulesPage.scheduledTaskStarted`))}catch(e){J(e instanceof Error?e.message:String(e))}finally{q(!1)}}},children:[Z.lastStatus===`running`?(0,P.jsx)(f,{className:`animate-spin`,size:14}):(0,P.jsx)(u,{size:14}),Z.lastStatus===`running`?l(`schedules:schedulesPage.running`):l(`schedules:schedulesPage.runNow`)]}),(0,P.jsx)(_,{variant:`destructive`,size:`icon`,title:l(`schedules:schedulesPage.deleteTask`),"aria-label":l(`schedules:schedulesPage.deleteTask`),onClick:async()=>{if(Z&&await a({title:l(`schedules:schedulesPage.deleteScheduledTask`),message:l(`schedules:schedulesPage.deleteScheduledTaskNameAndItsRunHistory`,{name:Z.name}),confirmLabel:l(`schedules:schedulesPage.delete`)}))try{await g(`/api/schedules/${encodeURIComponent(Z.id)}`,{method:`DELETE`}),await X(),e(l(`schedules:schedulesPage.scheduledTaskDeleted`))}catch(e){J(e instanceof Error?e.message:String(e))}},children:(0,P.jsx)(ee,{size:14})})]})]}),(0,P.jsx)(V,{targetType:M.targetType,prompt:M.prompt,workflowId:M.workflowId,workflowInputs:M.workflowInputs,workflows:Q,onChange:$}),M.targetType===`prompt`&&(0,P.jsx)(H,{value:M.cwd,onChange:e=>$({cwd:e})}),(0,P.jsxs)(`div`,{className:`form-grid grid gap-[9px] three [.form-grid&]:grid-cols-[repeat(3,minmax(0,1fr))] max-[650px]:[.form-grid&]:grid-cols-[1fr]`,children:[(0,P.jsxs)(y,{variant:`control`,children:[l(`schedules:schedulesPage.frequency`),(0,P.jsx)(i,{value:M.frequency,onChange:e=>$({frequency:e.target.value}),children:Object.keys(re).map(e=>(0,P.jsx)(`option`,{value:e,children:oe(e,l)},e))})]}),M.frequency===`interval`?(0,P.jsxs)(y,{variant:`control`,children:[l(`schedules:schedulesPage.runInterval`),(0,P.jsxs)(`span`,{className:`schedule-interval-input [&_input]:w-full [&_input]:min-w-0 [&_input]:h-full [&_input]:border-0 [&_input]:[outline:0] [&_input]:bg-transparent [&_input]:p-[0_9px] [&_input]:text-[var(--text)] [&_select]:h-full [&_select]:border-0 [&_select]:[border-left:1px_solid_var(--stroke)] [&_select]:[outline:0] [&_select]:bg-[var(--solid)] [&_select]:p-[0_8px] [&_select]:text-[var(--text-tertiary)] [&_select]:text-[12px] [&_[data-slot='select-trigger']]:w-auto [&_[data-slot='select-trigger']]:min-w-[74px] [&_[data-slot='select-trigger']]:[border-left:1px_solid_var(--stroke)] [&_[data-slot='select-trigger']]:rounded-[0] [&_[data-slot='select-trigger']]:bg-[var(--solid)] [&_[data-slot='select-trigger']]:text-[var(--text-tertiary)] grid h-[31px] grid-cols-[minmax(0,1fr)_auto] overflow-hidden [border:1px_solid_var(--stroke)] rounded-[var(--r-xs)] bg-[var(--surface-subtle)]`,children:[(0,P.jsx)(`input`,{type:`number`,min:`1`,value:M.intervalValue,onChange:e=>$({intervalValue:Number(e.target.value)})}),(0,P.jsx)(i,{value:M.intervalUnit,onChange:e=>$({intervalUnit:e.target.value}),children:Object.keys(ie).map(e=>(0,P.jsx)(`option`,{value:e,children:se(e,l)},e))})]})]}):(0,P.jsxs)(y,{variant:`control`,children:[l(`schedules:schedulesPage.time`),(0,P.jsx)(`input`,{type:`time`,value:M.time,onChange:e=>$({time:e.target.value})})]}),(0,P.jsxs)(y,{variant:`control`,children:[l(`schedules:schedulesPage.timeZone`),(0,P.jsx)(i,{value:M.timezone,onChange:e=>$({timezone:e.target.value}),children:ae.map(e=>(0,P.jsx)(`option`,{value:e,children:e},e))})]}),M.targetType===`prompt`&&(0,P.jsx)(R,{value:M.executionMode,onChange:e=>$({executionMode:e})})]}),(0,P.jsxs)(`div`,{className:`schedule-notification-section [&_>_div:first-child]:flex [&_>_div:first-child]:items-center [&_>_div:first-child]:justify-between [&_>_div:first-child]:gap-[8px] [&_>_div:first-child_strong]:text-[13px] [&_>_p]:mt-[4px] [&_>_p]:text-[var(--text-muted)] [&_>_p]:text-[13px] [margin-top:13px] [border-top:1px_solid_var(--stroke-soft)] [padding-top:12px]`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`strong`,{children:l(`schedules:schedulesPage.notificationChannels`)}),(0,P.jsx)(`button`,{type:`button`,className:`text-button hover:text-[var(--text)] border-0 bg-transparent text-[var(--text-soft)] text-[12px] font-[600] [text-decoration:underline] [text-underline-offset:2px]`,onClick:n,children:l(`schedules:schedulesPage.editTemplates`)})]}),(0,P.jsx)(`p`,{children:l(`schedules:schedulesPage.notificationChannelsHelp`)}),(0,P.jsx)(`div`,{className:`schedule-notification-targets [&_>_button]:grid [&_>_button]:min-h-[52px] [&_>_button]:grid-cols-[auto_minmax(0,1fr)_auto] [&_>_button]:items-center [&_>_button]:gap-[7px] [&_>_button]:[border:1px_solid_var(--stroke)] [&_>_button]:rounded-[var(--r-sm)] [&_>_button]:bg-[var(--surface-subtle)] [&_>_button]:p-[7px_8px] [&_>_button]:text-left [&_>_button_>_span]:flex [&_>_button_>_span]:min-w-0 [&_>_button_>_span]:flex-col [&_>_button_>_span]:gap-[3px] [&_strong]:text-[13px] [&_small]:overflow-hidden [&_small]:text-[var(--text-muted)] [&_small]:text-[13px] [&_small]:text-ellipsis [&_small]:whitespace-nowrap [&_>_button_>_svg:last-child]:text-[var(--control-muted)] [&_>_button.selected]:border-[var(--focus)] [&_>_button.selected]:bg-[var(--accent-soft)] [&_>_button.selected]:text-[var(--star-strong)] [&_>_button.selected_>_svg:last-child]:text-[var(--success)] max-[650px]:grid-cols-[1fr] grid grid-cols-[repeat(5,minmax(0,1fr))] gap-[7px] [margin-top:9px]`,children:Object.entries(ne).map(([e,t])=>{let n=t.Icon,r=M.notifications.includes(e);return(0,P.jsxs)(`button`,{type:`button`,className:r?`selected`:``,onClick:()=>fe(e),children:[(0,P.jsx)(n,{size:15}),(0,P.jsxs)(`span`,{children:[(0,P.jsx)(`strong`,{children:L(e,l)}),(0,P.jsx)(`small`,{children:p.notificationTargets[e].enabled?l(`schedules:schedulesPage.configured`):l(`schedules:schedulesPage.notConfigured`)})]}),(0,P.jsx)(s,{size:15})]},e)})}),(0,P.jsx)(`div`,{className:`flex items-center gap-[6px] [margin-top:9px]`,children:(0,P.jsx)(`button`,{type:`button`,className:`schedule-notification-chip [&.selected]:border-[var(--control-selected-border)] [&.selected]:bg-[var(--control-selected-bg)] [&.selected]:text-[var(--control-selected-text)] [&.selected]:shadow-[var(--sh-1)] dark:bg-[var(--surface-subtle)] inline-flex h-[32px] items-center gap-[4px] [border:1px_solid_var(--stroke)] rounded-[var(--r-pill)] bg-[var(--surface-subtle)] text-[var(--text-muted)] [padding:0_10px] text-[13px] font-[600] ${M.notifyOn===`failure`?`selected`:``}`,onClick:()=>$({notifyOn:M.notifyOn===`failure`?`always`:`failure`}),children:M.notifyOn===`failure`?l(`schedules:schedulesPage.failuresOnly`):l(`schedules:schedulesPage.completionAndFailure`)})})]}),(0,P.jsxs)(`div`,{className:`form-footer [&_>_span]:text-[var(--text-muted)] [&_>_span]:text-[13px] flex items-center justify-between gap-[10px] [margin-top:10px]`,children:[(0,P.jsx)(`span`,{children:Z.lastRunAt?l(`schedules:schedulesPage.lastRunTime`,{time:b(Z.lastRunAt,d)}):l(`schedules:schedulesPage.nextRunTime`,{time:W(Z,d)})}),(0,P.jsxs)(_,{size:`lg`,disabled:G||!B(M.targetType,M.prompt,M.workflowId,M.workflowInputs,Q),onClick:async()=>{if(!(!Z||!M)){q(!0),J(``);try{let t=await g(`/api/schedules/${encodeURIComponent(Z.id)}`,{method:`PATCH`,body:JSON.stringify(M)});h(t.state),F(U(t.task)),e(l(`schedules:schedulesPage.scheduledTaskSaved`))}catch(e){J(e instanceof Error?e.message:String(e))}finally{q(!1)}}},children:[G?(0,P.jsx)(f,{className:`animate-spin`,size:14}):null,l(G?`schedules:schedulesPage.saving`:`schedules:schedulesPage.saveTask`)]})]})]}),(0,P.jsxs)(D,{children:[(0,P.jsx)(w,{title:l(`schedules:schedulesPage.recentRuns`)}),de.length?de.map(e=>(0,P.jsxs)(`div`,{className:`schedule-run-row [&_>_svg]:text-[var(--text-muted)] [&.completed_>_svg]:text-[var(--success)] [&.failed_>_svg]:text-[var(--danger)] [&.running_>_svg]:text-[var(--star-strong)] [&_>_span]:flex [&_>_span]:min-w-0 [&_>_span]:flex-col [&_>_span]:gap-[4px] [&_strong]:[display:-webkit-box] [&_strong]:overflow-hidden [&_strong]:text-[12px] [&_strong]:leading-[1.4] [&_strong]:[-webkit-box-orient:vertical] [&_strong]:[-webkit-line-clamp:2] [&_small]:text-[var(--text-muted)] [&_small]:text-[13px] [&_a]:text-[var(--text-soft)] [&_a]:text-[13px] [&_a]:[text-decoration:underline] [&_a]:[text-underline-offset:2px] [&_>_em]:text-[var(--text-secondary)] [&_>_em]:text-[12px] [&_>_em]:[font-style:normal] [&_>_em]:whitespace-nowrap grid grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-[9px] [border-top:1px_solid_var(--stroke-soft)] [padding:10px_2px] ${e.status}`,children:[e.status===`running`?(0,P.jsx)(f,{className:`animate-spin`,size:15}):e.status===`completed`?(0,P.jsx)(s,{size:15}):(0,P.jsx)(m,{size:15}),(0,P.jsxs)(`span`,{children:[(0,P.jsx)(`strong`,{children:e.status===`running`?l(`schedules:schedulesPage.running2`):e.status===`completed`?e.summary||l(`schedules:schedulesPage.taskCompleted`):e.status===`interrupted`?l(`schedules:schedulesPage.taskInterrupted`):e.error||l(`schedules:schedulesPage.taskFailed`)}),(0,P.jsxs)(`small`,{children:[b(e.startedAt,d),` ·`,` `,e.trigger===`manual`?l(`schedules:schedulesPage.manualRun`):l(`schedules:schedulesPage.scheduledTrigger`),e.durationMs?` · ${l(`schedules:schedulesPage.countSec`,{count:Math.round(e.durationMs/1e3)})}`:``]})]}),(0,P.jsx)(`em`,{children:new Intl.DateTimeFormat(d,{hour:`2-digit`,minute:`2-digit`}).format(new Date(e.startedAt))})]},e.id)):(0,P.jsxs)(`div`,{className:`channel-route-empty [&_strong]:mt-[9px] [&_strong]:text-[var(--text)] [&_strong]:text-[12px] [&_span]:mt-[4px] [&_span]:text-[13px] [&.compact]:min-h-[110px] [.workflow-assets-panel_&]:min-h-[150px] [.workflow-assets-panel_&]:border-0 [.workflow-assets-panel_&]:bg-transparent grid min-h-[185px] place-content-center justify-items-center text-[var(--text-muted)] text-center compact`,children:[(0,P.jsx)(O,{size:32}),(0,P.jsx)(`strong`,{children:l(`schedules:schedulesPage.noRunHistory`)})]})]})]}):(0,P.jsx)(K,{notificationTargets:p.notificationTargets,workflows:Q,defaultCwd:p.defaultCwd,onCreated:t=>{h(t.state),j(t.task.id),c(!0),e(l(`schedules:schedulesPage.scheduledTaskCreated`))}})})}),ue&&(0,P.jsx)(ce,{notificationTargets:p.notificationTargets,workflows:Q,defaultCwd:p.defaultCwd,onClose:()=>Y(!1),onCreated:t=>{Y(!1),h(t.state),j(t.task.id),c(!0),e(l(`schedules:schedulesPage.scheduledTaskCreated`))}})]})})})}function K({notificationTargets:e,workflows:t,defaultCwd:n,onCreated:a}){let{t:o}=r(),[s,c]=(0,N.useState)(``),[l,u]=(0,N.useState)(`prompt`),[p,ee]=(0,N.useState)(``),[h,v]=(0,N.useState)(``),[b,S]=(0,N.useState)({}),[w,T]=(0,N.useState)(n||``),[E,te]=(0,N.useState)(`daily`),[O,k]=(0,N.useState)(`09:00`),[A,j]=(0,N.useState)(`Asia/Hong_Kong`),[M,ne]=(0,N.useState)(1),[F,I]=(0,N.useState)(`hours`),[L,z]=(0,N.useState)(`full-access`),[U,W]=(0,N.useState)(!1),[G,K]=(0,N.useState)(``);return(0,P.jsxs)(D,{children:[(0,P.jsx)(C,{children:(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`h2`,{children:o(`schedules:schedulesPage.newScheduledTask`)}),(0,P.jsx)(`p`,{children:o(`schedules:schedulesPage.youCanContinueEditingTheRunTimeAndNotificationChannelsAfterCreation`)})]})}),(0,P.jsxs)(y,{variant:`control`,children:[o(`schedules:schedulesPage.taskName`),(0,P.jsx)(`input`,{value:s,onChange:e=>c(e.target.value),placeholder:o(`schedules:schedulesPage.forExampleDailyCodeReview`)})]}),(0,P.jsx)(V,{targetType:l,prompt:p,workflowId:h,workflowInputs:b,workflows:t,onChange:e=>{e.targetType&&u(e.targetType),e.prompt!==void 0&&ee(e.prompt),e.workflowId!==void 0&&v(e.workflowId),e.workflowInputs!==void 0&&S(e.workflowInputs)}}),l===`prompt`&&(0,P.jsx)(H,{value:w,onChange:T}),(0,P.jsxs)(`div`,{className:`form-grid grid gap-[9px] three [.form-grid&]:grid-cols-[repeat(3,minmax(0,1fr))] max-[650px]:[.form-grid&]:grid-cols-[1fr]`,children:[(0,P.jsxs)(y,{variant:`control`,children:[o(`schedules:schedulesPage.frequency`),(0,P.jsx)(i,{value:E,onChange:e=>te(e.target.value),children:Object.keys(re).map(e=>(0,P.jsx)(`option`,{value:e,children:oe(e,o)},e))})]}),E===`interval`?(0,P.jsxs)(y,{variant:`control`,children:[o(`schedules:schedulesPage.runInterval`),(0,P.jsxs)(`span`,{className:`schedule-interval-input [&_input]:w-full [&_input]:min-w-0 [&_input]:h-full [&_input]:border-0 [&_input]:[outline:0] [&_input]:bg-transparent [&_input]:p-[0_9px] [&_input]:text-[var(--text)] [&_select]:h-full [&_select]:border-0 [&_select]:[border-left:1px_solid_var(--stroke)] [&_select]:[outline:0] [&_select]:bg-[var(--solid)] [&_select]:p-[0_8px] [&_select]:text-[var(--text-tertiary)] [&_select]:text-[12px] [&_[data-slot='select-trigger']]:w-auto [&_[data-slot='select-trigger']]:min-w-[74px] [&_[data-slot='select-trigger']]:[border-left:1px_solid_var(--stroke)] [&_[data-slot='select-trigger']]:rounded-[0] [&_[data-slot='select-trigger']]:bg-[var(--solid)] [&_[data-slot='select-trigger']]:text-[var(--text-tertiary)] grid h-[31px] grid-cols-[minmax(0,1fr)_auto] overflow-hidden [border:1px_solid_var(--stroke)] rounded-[var(--r-xs)] bg-[var(--surface-subtle)]`,children:[(0,P.jsx)(`input`,{type:`number`,min:`1`,value:M,onChange:e=>ne(Number(e.target.value))}),(0,P.jsx)(i,{value:F,onChange:e=>I(e.target.value),children:Object.keys(ie).map(e=>(0,P.jsx)(`option`,{value:e,children:se(e,o)},e))})]})]}):(0,P.jsxs)(y,{variant:`control`,children:[o(`schedules:schedulesPage.time`),(0,P.jsx)(`input`,{type:`time`,value:O,onChange:e=>k(e.target.value)})]}),(0,P.jsxs)(y,{variant:`control`,children:[o(`schedules:schedulesPage.timeZone`),(0,P.jsx)(i,{value:A,onChange:e=>j(e.target.value),children:ae.map(e=>(0,P.jsx)(`option`,{value:e,children:e},e))})]}),l===`prompt`&&(0,P.jsx)(R,{value:L,onChange:z})]}),G&&(0,P.jsxs)(x,{children:[(0,P.jsx)(m,{size:13}),G]}),(0,P.jsxs)(`div`,{className:`form-footer [&_>_span]:text-[var(--text-muted)] [&_>_span]:text-[13px] flex items-center justify-between gap-[10px] [margin-top:10px]`,children:[(0,P.jsx)(`span`,{children:o(`schedules:schedulesPage.enabledAutomaticallyAfterCreation`)}),(0,P.jsxs)(_,{size:`lg`,disabled:U||!s.trim()||!B(l,p,h,b,t),onClick:async()=>{W(!0),K(``);try{let t=Object.entries(e).filter(([,e])=>e.enabled).map(([e])=>e);a(await g(`/api/schedules`,{method:`POST`,body:JSON.stringify({name:s,targetType:l,prompt:p,workflowId:h,workflowInputs:b,cwd:w,enabled:!0,frequency:E,time:O,timezone:A,intervalValue:M,intervalUnit:F,executionMode:L,notifications:t,notifyOn:`always`})}))}catch(e){K(e instanceof Error?e.message:String(e))}finally{W(!1)}},children:[U?(0,P.jsx)(f,{className:`animate-spin`,size:14}):(0,P.jsx)(d,{size:14}),o(U?`schedules:schedulesPage.creating`:`schedules:schedulesPage.createTask`)]})]})]})}function ce({notificationTargets:e,workflows:t,defaultCwd:n,onClose:i,onCreated:a}){let{t:o}=r(),[s,c]=(0,N.useState)(``),[l,u]=(0,N.useState)(`prompt`),[p,ee]=(0,N.useState)(``),[v,b]=(0,N.useState)(``),[S,w]=(0,N.useState)({}),[T,E]=(0,N.useState)(n||``),[D,te]=(0,N.useState)(`full-access`),[O,k]=(0,N.useState)(!1),[A,j]=(0,N.useState)(``);return(0,P.jsx)(`div`,{className:`modal-backdrop max-[650px]:p-[8px] fixed z-[70] inset-0 grid place-items-center overflow-y-auto bg-[var(--modal-overlay)] [backdrop-filter:blur(3px)] [padding:20px] [overscroll-behavior:contain] [animation:fade-in_var(--d1)_var(--ease-out)]`,onMouseDown:e=>e.target===e.currentTarget&&i(),children:(0,P.jsxs)(`form`,{className:`modal !w-[min(430px,100%)] max-h-[calc(100dvh_-_40px)] overflow-y-auto [overscroll-behavior:contain] [border:1px_solid_var(--surface-highlight)] rounded-[var(--r-md)] bg-[var(--solid)] p-[18px] shadow-[0_26px_70px_-25px_var(--shadow-strong)] [animation:modal-in_var(--d2)_var(--ease-out)] max-[650px]:max-h-[calc(100dvh_-_16px)]`,onSubmit:async t=>{t.preventDefault(),k(!0),j(``);try{let t=Object.entries(e).filter(([,e])=>e.enabled).map(([e])=>e);a(await g(`/api/schedules`,{method:`POST`,body:JSON.stringify({name:s,targetType:l,prompt:p,workflowId:v,workflowInputs:S,cwd:T,enabled:!0,frequency:`daily`,time:`09:00`,timezone:`Asia/Hong_Kong`,executionMode:D,notifications:t,notifyOn:`always`})}))}catch(e){j(e instanceof Error?e.message:String(e))}finally{k(!1)}},children:[(0,P.jsxs)(C,{children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`h2`,{children:o(`schedules:schedulesPage.newScheduledTask`)}),(0,P.jsx)(`p`,{children:o(`schedules:schedulesPage.youCanContinueSettingTheRunTimeAndNotificationChannelsAfterCreation`)})]}),(0,P.jsx)(_,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":o(`schedules:schedulesPage.closeDialog`),onClick:i,children:(0,P.jsx)(h,{size:17})})]}),(0,P.jsxs)(y,{variant:`control`,children:[o(`schedules:schedulesPage.taskName`),(0,P.jsx)(`input`,{value:s,onChange:e=>c(e.target.value),placeholder:o(`schedules:schedulesPage.forExampleDailyCodeReview`)})]}),(0,P.jsx)(V,{targetType:l,prompt:p,workflowId:v,workflowInputs:S,workflows:t,onChange:e=>{e.targetType&&u(e.targetType),e.prompt!==void 0&&ee(e.prompt),e.workflowId!==void 0&&b(e.workflowId),e.workflowInputs!==void 0&&w(e.workflowInputs)}}),l===`prompt`&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(H,{value:T,onChange:E}),(0,P.jsx)(R,{value:D,onChange:te})]}),A&&(0,P.jsxs)(x,{children:[(0,P.jsx)(m,{size:13}),A]}),(0,P.jsxs)(`div`,{className:`flex justify-end gap-[8px] [margin-top:18px]`,children:[(0,P.jsx)(_,{type:`button`,variant:`outline`,size:`lg`,className:`bg-surface-subtle`,onClick:i,children:o(`schedules:schedulesPage.cancel`)}),(0,P.jsxs)(_,{size:`lg`,disabled:O||!s.trim()||!B(l,p,v,S,t),children:[O?(0,P.jsx)(f,{className:`animate-spin`,size:14}):(0,P.jsx)(d,{size:14}),o(O?`schedules:schedulesPage.creating`:`schedules:schedulesPage.createTask`)]})]})]})})}export{G as SchedulesPage};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TaskTerminalView-Dt8gIY5E.js","assets/rolldown-runtime-B0Z9INg1.js","assets/vendor-react-DwNgTV1j.js","assets/use-i18n-BrWBoyFl.js","assets/i18n-CblgkPOp.js","assets/vendor-router-CZg2bCPV.js","assets/index-BAYzSwUr.js","assets/index-Bcpvpefn.css","assets/storage-BpAqa-YY.js","assets/vendor-state-GkUciC5H.js","assets/square-terminal-BVG6cUT1.js","assets/createLucideIcon-Cd-3GVxJ.js","assets/square-bHHVTT3G.js","assets/button-BcPDt1Ge.js","assets/vendor-ui-DvrYggeS.js","assets/dist-Cfh4kzCK.js","assets/utils-C8uzG5AZ.js","assets/terminal-context-aIsIJPn8.js","assets/PageState-CzlR-lkL.js","assets/loader-circle-BOwQzHB-.js","assets/TaskTerminalView-BrP-ENHg.css","assets/TaskProcessesPane-PRgpCplN.js","assets/chevron-right-C3t2Rckj.js","assets/FileAttachmentPreview-x4AORCVt.js","assets/tabs-DQYVDdOp.js","assets/dist-B_a0oV4U.js","assets/dist-DAs5KRGl.js","assets/download-BCfIiuaL.js","assets/file-Bllajneu.js","assets/refresh-cw-TbWxTY4K.js","assets/x-07u4-129.js","assets/api-CiEo53J1.js","assets/http-Dx387MGl.js","assets/abort-signal-f4JsiYKX.js","assets/dialog-CGGxREwU.js","assets/dist-BdkTa5R3.js","assets/es2015-0QT3KgdC.js","assets/format-BRFKAYMT.js","assets/MarkdownMessage-D9zxSf6j.js","assets/vendor-markdown-plugins-DisoihU3.js","assets/vendor-shiki-runtime-UFMr0O-Q.js","assets/vendor-markdown-plugins-DEcVZfaU.css","assets/vendor-markdown-Ck4Y_w0n.js","assets/check-2vYc6QaP.js","assets/copy-DHmIFc52.js","assets/route-context-DvWDul4T.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{p as t}from"./vendor-router-CZg2bCPV.js";import{i as n,r}from"./vendor-react-DwNgTV1j.js";import{t as i}from"./use-i18n-BrWBoyFl.js";import{a}from"./popover-BBuzaBfd.js";import{t as o}from"./activity-BCxvXCG3.js";import{t as s}from"./arrow-left-B8oVrQ2S.js";import{t as c}from"./chevron-right-C3t2Rckj.js";import{t as l}from"./earth-Ddy13fHh.js";import{t as u}from"./external-link-CEQqPcqc.js";import{t as d}from"./file-diff-GxOMJkLj.js";import{t as f}from"./file-Bllajneu.js";import{F as p,P as m,d as h,f as g,g as _,h as v,i as y,m as b,n as x,p as S,r as C,t as w}from"./session-streaming-state-DUehpyTs.js";import{t as T}from"./image-BY_c3FYU.js";import{t as E}from"./link-2-mgasYn21.js";import{t as D}from"./loader-circle-BOwQzHB-.js";import{t as O}from"./message-square-SKjZyY3v.js";import{t as k}from"./plus-fQbSqB1n.js";import{t as A}from"./square-terminal-BVG6cUT1.js";import{t as j}from"./square-bHHVTT3G.js";import{t as M}from"./x-07u4-129.js";import{t as N}from"./button-BcPDt1Ge.js";import{i as P,t as F}from"./runtime-capabilities-store-C1lkVKpw.js";import{s as I}from"./events-f8vVvSfH.js";import{n as L}from"./git-diff-f-zMaQOk.js";import{n as R,t as ee}from"./SessionFilesPane-CAdkivkE.js";import{t as z}from"./input-CvjGYteF.js";import{r as B,s as V}from"./shortcuts-ChJr3RP4.js";import{a as H,i as U,n as te,t as ne}from"./sheet-CAEHyJHI.js";import{t as W}from"./web-preview-D1qOo-1X.js";import{n as re}from"./terminal-context-aIsIJPn8.js";import{n as G,t as K}from"./web-preview-C-4r6kgm.js";import{r as q}from"./side-chat-context-Dr2QLUJA.js";var J=e(n(),1),ie=(0,J.lazy)(()=>t(()=>import(`./TaskTerminalView-Dt8gIY5E.js`).then(e=>({default:e.TaskTerminalView})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]))),ae=(0,J.lazy)(()=>t(()=>import(`./TaskProcessesPane-PRgpCplN.js`).then(e=>({default:e.TaskProcessesPane})),__vite__mapDeps([21,1,2,3,4,5,6,7,8,9,22,11,10,12,13,14,15,16,17,18,19]))),Y=r(),X=(0,J.lazy)(()=>t(()=>import(`./FileAttachmentPreview-x4AORCVt.js`).then(e=>e.n).then(e=>({default:e.FileAttachmentPreview})),__vite__mapDeps([23,1,2,3,4,5,6,7,8,9,24,14,25,15,26,16,27,11,28,19,29,30,31,32,33,13,34,35,36,37,38,39,40,41,42,43,44,45])));function oe({sources:e,view:t,onViewChange:n}){let{t:r}=i(),a=L(t.reading?.list,e=>n({reading:{...t.reading,list:e}})),o=(0,J.useContext)(S),[s,l]=(0,J.useState)(``),u=(0,J.useRef)(null),d=e.find(e=>e.id===s),p=e.filter(e=>(!t.filter||e.kind===t.filter)&&e.name.toLocaleLowerCase().includes(t.query.toLocaleLowerCase()));return(0,Y.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col gap-3 p-3`,"aria-label":r(`chat:workbench.sources`),children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`h2`,{className:`flex-1 text-sm font-medium`,children:r(`chat:workbench.sources`)}),(0,Y.jsx)(`span`,{className:`text-xs text-content-muted`,children:r(`chat:workbench.addSource`)}),(0,Y.jsx)(`div`,{ref:o?.setSourceActionHost,className:`grid size-9 place-items-center`})]}),(0,Y.jsx)(`p`,{className:`text-xs text-content-muted`,children:r(`chat:workbench.sourcesScope`)}),(0,Y.jsx)(z,{"aria-label":r(`chat:workbench.searchSources`),placeholder:r(`chat:workbench.searchSources`),value:t.query,onChange:e=>n({query:e.target.value})}),(0,Y.jsxs)(`select`,{"aria-label":r(`chat:workbench.sourceType`),className:`h-9 rounded-md border border-border bg-background px-2 text-sm`,value:t.filter,onChange:e=>n({filter:e.target.value}),children:[(0,Y.jsx)(`option`,{value:``,children:r(`chat:workbench.allTypes`)}),(0,Y.jsx)(`option`,{value:`image`,children:r(`chat:workbench.images`)}),(0,Y.jsx)(`option`,{value:`text`,children:r(`chat:workbench.text`)}),(0,Y.jsx)(`option`,{value:`file`,children:r(`chat:workbench.files`)})]}),(0,Y.jsxs)(`div`,{ref:a.ref,className:`min-h-0 flex-1 overflow-y-auto`,children:[!p.length&&(0,Y.jsx)(`p`,{className:`p-3 text-sm text-content-muted`,children:e.length?r(`chat:workbench.noMatches`):r(`chat:workbench.noSources`)}),p.map(e=>{let i=t.selectedSourceId===e.id,a=e.kind===`image`?T:e.method===`path`?E:f;return(0,Y.jsxs)(`article`,{className:`border-b border-border/60`,children:[(0,Y.jsxs)(`button`,{className:`flex min-h-12 w-full min-w-0 items-center gap-2 px-2 text-left`,"aria-expanded":i,onClick:()=>n({selectedSourceId:i?``:e.id}),children:[(0,Y.jsx)(c,{size:14,className:i?`rotate-90 shrink-0`:`shrink-0`}),(0,Y.jsx)(a,{className:`size-4 shrink-0 text-content-muted`}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,children:e.name||r(`chat:chatMessage.fileAttachment`)})]}),i&&(0,Y.jsxs)(`div`,{className:`space-y-2 bg-surface-subtle p-3 text-xs text-content-muted`,children:[(0,Y.jsx)(`p`,{className:`break-all`,children:e.attachment.path||e.attachment.id||r(`chat:workbench.unavailable`)}),(0,Y.jsx)(`p`,{children:e.attachment.mimeType||`application/octet-stream`}),(0,Y.jsx)(`p`,{children:e.method===`asset`?r(`chat:workbench.registeredAsset`):e.method===`path`?r(`chat:workbench.pathReference`):r(`chat:workbench.invalidReference`)}),(0,Y.jsx)(N,{variant:`outline`,size:`sm`,disabled:!e.available,onClick:t=>{u.current=t.currentTarget,l(e.id)},children:r(`chat:chatMessage.fileActionPreview`)})]})]},e.id)})]}),d&&(0,Y.jsx)(J.Suspense,{fallback:null,children:(0,Y.jsx)(X,{attachment:d.attachment,onClose:()=>l(``),onRestoreFocus:()=>u.current?.focus(),onDownload:()=>{typeof d.attachment.downloadUrl==`string`&&window.open(d.attachment.downloadUrl,`_blank`,`noopener,noreferrer`)}})})]})}function se({tools:e,onSelect:t,onOpenUrl:n}){let{t:r}=i(),[a,o]=(0,J.useState)(``),[s,c]=(0,J.useState)(!1);return(0,Y.jsxs)(`section`,{className:`@container/new-tab flex min-h-0 flex-1 flex-col overflow-y-auto bg-surface-subtle/40 p-5`,children:[(0,Y.jsx)(`h2`,{className:`mb-4 text-sm font-medium`,children:r(`chat:workbench.newTab`)}),(0,Y.jsxs)(`form`,{className:`mb-5 flex gap-2`,onSubmit:e=>{e.preventDefault();let t=W(a,window.location.href);c(!t),t&&n(t)},children:[(0,Y.jsx)(z,{className:`h-10 rounded-full bg-background px-4`,"aria-label":r(`common:webPreview.url`),placeholder:r(`common:webPreview.urlPlaceholder`),value:a,maxLength:2048,onChange:e=>o(e.target.value)}),(0,Y.jsx)(N,{type:`submit`,variant:`outline`,children:r(`chat:sessionContext.openUrl`)})]}),s&&(0,Y.jsx)(`p`,{role:`alert`,className:`mb-3 text-sm text-destructive`,children:r(`chat:sessionContext.invalidUrl`)}),(0,Y.jsx)(`div`,{className:`grid grid-cols-1 gap-2 @min-[420px]/new-tab:grid-cols-2`,children:e.map(({id:e,label:n,icon:r,disabled:i})=>(0,Y.jsxs)(N,{disabled:i,variant:`outline`,className:`h-12 min-w-0 justify-start gap-3 rounded-xl border-transparent bg-background px-3 font-normal shadow-none`,onClick:()=>t(e),children:[(0,Y.jsx)(r,{className:`size-4 shrink-0`}),(0,Y.jsx)(`span`,{className:`truncate`,children:n})]},e))})]})}function ce({parentId:e,active:t}){let{t:n}=i(),{entry:r,runtime:o,load:s,setDraft:c}=q(e),l=r.session?.id??``,u=(0,J.useMemo)(()=>e=>o.subscribeSessionState(l,e),[o,l]),d=(0,J.useMemo)(()=>()=>o.getSessionState(l),[o,l]),f=(0,J.useSyncExternalStore)(u,d),[p,m]=(0,J.useState)(!1),[h,_]=(0,J.useState)(!1),[v,b]=(0,J.useState)(``),S=(0,J.useRef)(!1),T=(0,J.useRef)(!1),E=(0,J.useRef)(r.draft);E.current=r.draft;let k=(0,J.useRef)(null),A=V(e=>e.bindings),M=w(f,r.session);(0,J.useEffect)(()=>{t&&s(e)},[t,s,e]);let P=async t=>{t.preventDefault();let n=E.current.trim();if(!(!n||S.current||M||r.expired)){S.current=!0,m(!0),b(``);try{let t=await s(e,!r.session);if(!t?.session)return;let i=t.session.id;if(o.getSessionState(i).streaming)return;E.current.trim()===n&&c(e,``),m(!1),await o.send(i,n),await s(e)}catch(e){b(y(e))}finally{S.current=!1,m(!1)}}},F=(0,J.useCallback)(async()=>{if(!(!l||o.getSessionState(l).streaming)){b(``);try{await o.retry(l),await s(e)}catch(e){b(y(e))}}},[s,e,o,l]),I=async()=>{if(!(!l||h)){_(!0);try{b(``),await o.abort(l)}catch(e){b(y(e))}finally{_(!1)}}},L=(0,Y.jsxs)(`div`,{className:`grid h-full min-h-36 place-content-center justify-items-center gap-3 px-3 text-center text-sm text-muted-foreground`,children:[(0,Y.jsx)(O,{size:22,"aria-hidden":`true`}),(0,Y.jsx)(`p`,{className:`max-w-64 leading-relaxed`,children:r.expired?n(`chat:sideChat.expired`):n(`chat:sideChat.empty`)}),r.expired&&(0,Y.jsxs)(N,{variant:`outline`,size:`sm`,disabled:r.loading,onClick:async()=>{(await s(e,!0))?.session&&k.current?.focus()},children:[r.loading&&(0,Y.jsx)(D,{className:`size-4 animate-spin`}),n(`chat:sideChat.restart`)]})]}),R=v||r.error||f.error;return(0,Y.jsxs)(`section`,{"data-side-chat-parent":e,"aria-label":n(`chat:sideChat.title`),className:`flex h-full min-h-0 min-w-0 flex-1 flex-col [container-type:inline-size]`,children:[(0,Y.jsx)(`p`,{className:`shrink-0 border-b border-border/50 px-3 py-2 text-xs leading-relaxed text-muted-foreground`,children:n(`chat:sideChat.retention`)}),l?(0,Y.jsx)(C,{sessionId:l,messages:f.messages,transcriptLoadState:f.loaded?`ready`:f.error?`error`:`loading`,emptyState:L,messageStart:f.messageStart,hasOlder:f.hasOlder,loadingOlder:f.loadingOlder,olderError:f.olderError,activityFeed:f.activityFeed,tools:f.tools,thinkingText:f.thinkingText,currentActivity:f.currentActivity,compaction:f.compaction,streaming:M,runStartedAt:f.runStartedAt,lastActivityAt:f.lastActivityAt,runFinishedAt:f.runFinishedAt,runStopped:f.runStopped,runNotice:f.runNotice,error:f.error,cwd:r.session?.cwd,onLoadOlder:()=>o.loadOlderMessages(l),onRetryLastTurn:F}):(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:L}),(0,Y.jsxs)(`form`,{className:`flex shrink-0 flex-col gap-2 border-t border-border/50 p-3`,onSubmit:P,children:[R&&(0,Y.jsx)(g,{error:R,onRetry:r.error||!f.loaded?async()=>{await s(e)}:F}),(0,Y.jsx)(x,{approvals:f.approvals,onResolve:async(e,t)=>{try{await o.approve(l,e,t)}catch{}}}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-end gap-2 rounded-xl border border-border/70 bg-muted/40 p-2 focus-within:border-ring/50`,children:[(0,Y.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-foreground outline-none placeholder:text-muted-foreground`,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&&B(e.nativeEvent,A.sendMessage)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())}}),(0,Y.jsx)(N,{type:M?`button`:`submit`,size:`icon`,className:`size-9 shrink-0 rounded-full`,"aria-label":n(M?`chat:sideChat.stop`:`chat:sideChat.send`),disabled:M?h:p||r.loading||r.expired||!r.draft.trim(),onClick:M?()=>void I():void 0,children:p||h?(0,Y.jsx)(D,{className:`size-4 animate-spin`}):M?(0,Y.jsx)(j,{size:13,fill:`currentColor`}):(0,Y.jsx)(a,{size:17})})]})]})]})}function le({page:e,onChange:t}){let{t:n}=i(),{draft:r,url:a}=e,[o,s]=(0,J.useState)(!1);return(0,Y.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col gap-2 p-3`,"aria-label":n(`common:webPreview.title`),children:[(0,Y.jsxs)(`form`,{className:`flex gap-2`,onSubmit:e=>{e.preventDefault();let n=W(r,window.location.href);s(!n),n&&t({url:n})},children:[(0,Y.jsx)(`input`,{"aria-label":n(`common:webPreview.url`),className:`min-w-0 flex-1 rounded-md border border-[var(--stroke)] bg-[var(--solid)] px-2 text-[length:var(--app-font-size)]`,value:r,onChange:e=>t({draft:e.target.value}),placeholder:n(`common:webPreview.urlPlaceholder`),maxLength:2048}),(0,Y.jsx)(N,{type:`submit`,variant:`outline`,size:`sm`,children:n(`chat:sessionContext.openUrl`)})]}),o&&(0,Y.jsx)(`p`,{role:`alert`,className:`text-[length:var(--app-small-size)] text-[var(--text-secondary)]`,children:n(`chat:sessionContext.invalidUrl`)}),a?(0,Y.jsx)(K,{className:`min-h-0 flex-1 overflow-hidden rounded-md`,defaultUrl:a,children:(0,Y.jsx)(G,{src:a,title:n(`common:webPreview.title`)})},a):(0,Y.jsxs)(`div`,{className:`grid min-h-0 flex-1 place-content-center justify-items-center gap-2 rounded-md border border-dashed border-[var(--stroke-soft)] text-center text-[length:var(--app-font-size)] text-[var(--text-muted)]`,children:[(0,Y.jsx)(l,{size:24,"aria-hidden":`true`}),(0,Y.jsx)(`p`,{children:n(`chat:sessionContext.browserEmpty`)})]}),a&&(0,Y.jsxs)(N,{type:`button`,variant:`ghost`,size:`sm`,className:`self-start`,onClick:()=>window.open(a,`_blank`,`noopener,noreferrer`),children:[(0,Y.jsx)(u,{size:14}),n(`common:webPreview.openExternal`)]}),(0,Y.jsx)(`p`,{className:`text-[length:var(--app-small-size)] text-[var(--text-muted)]`,children:n(`common:webPreview.embedNotice`)})]})}function Z({panelId:e,compact:t,embedded:n=!1,active:r=!0,sessionId:a,cwd:c=``,sources:u=[],tab:f,plan:g,streaming:y,plansAvailable:x,requestConfirm:S,onTabChange:C,onClose:w,onBack:T}){let{t:D}=i(),j=re(),L=F(e=>e.capabilities),z=[{id:`terminal`,icon:A,label:D(`terminal:workspace.terminal`)},{id:`processes`,icon:o,label:D(`terminal:workspace.processes`)},{id:`changes`,icon:d,label:D(`chat:workbench.projectChanges`)},{id:`sources`,icon:E,label:D(`chat:workbench.sources`)},{id:`files`,icon:p,label:D(`chat:workbench.taskSnapshots`)},...x?[{id:`plan`,icon:m,label:D(`chat:sessionContext.plan`)}]:[],{id:`browser`,icon:l,label:D(`common:webPreview.title`)},{id:`side-chat`,icon:O,label:D(`chat:sideChat.title`)}],B=(0,J.useMemo)(()=>v(f),[f]),V=b(e=>Object.prototype.hasOwnProperty.call(e.sessions,a)?e.sessions[a]:void 0)??B,W=(0,J.useRef)(null),G=V.pages.find(e=>e.id===V.activeId)??V.pages[0],K=e=>e.kind===`new`?{id:`new`,icon:k,label:D(`chat:workbench.newTab`)}:z.find(t=>t.id===e.kind)??z[0],q=t=>requestAnimationFrame(()=>document.getElementById(`${e}-${t}-tab`)?.focus()),X=(0,J.useEffectEvent)(()=>{r&&document.getElementById(`${e}-${V.activeId}-tab`)?.focus()});(0,J.useEffect)(()=>{let e=requestAnimationFrame(()=>X());return()=>cancelAnimationFrame(e)},[e,V.activeId]);let Z=e=>{if(e.type===`view`&&!b.getState().sessions[a])return;[`add`,`open`,`select`,`close`,`kind`].includes(e.type)&&window.dispatchEvent(new Event(I));let t=_(V,e);b.getState().update(a,f,e);let n=t.pages.find(e=>e.id===t.activeId);n&&C(n.kind),(e.type===`add`||e.type===`select`||e.type===`close`)&&q(t.activeId),e.type===`close`&&V.pages.length===1&&w()},Q=D(`chat:sessionContext.addPage`),ue=D(`chat:sessionContext.pageLimit`),de=(0,Y.jsx)(N,{variant:`ghost`,size:`icon`,disabled:V.pages.length>=12,"aria-label":Q,title:V.pages.length>=12?ue:Q,onClick:()=>Z({type:`add`,kind:`new`}),children:(0,Y.jsx)(k,{size:15})}),$=(0,Y.jsxs)(`div`,{"data-session-context-panel":!0,className:`flex h-full min-h-0 min-w-0 flex-col bg-background text-foreground`,children:[(0,Y.jsxs)(`header`,{"data-window-drag-region":!0,className:`auxiliary-page-header flex h-14 shrink-0 items-center gap-0.5 border-b border-border/60 px-1.5`,children:[T&&(0,Y.jsx)(N,{variant:`ghost`,size:`icon`,"aria-label":D(`chat:workbench.backToConversation`),title:D(`chat:workbench.backToConversation`),onClick:T,children:(0,Y.jsx)(s,{size:16})}),(0,Y.jsx)(`div`,{ref:W,className:`flex min-w-0 flex-1 items-center overflow-x-auto`,role:`tablist`,"aria-label":D(`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:G.id});return}if(![`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key))return;e.preventDefault();let t=V.pages.findIndex(e=>e.id===G.id),n=e.key===`Home`?0:e.key===`End`?V.pages.length-1:(t+(e.key===`ArrowRight`?1:-1)+V.pages.length)%V.pages.length;Z({type:`select`,id:V.pages[n].id})},children:V.pages.map(t=>{let{icon:n,label:r}=K(t);return(0,Y.jsxs)(`div`,{className:`group flex max-w-40 min-w-20 shrink-0 items-center rounded-md ${t.id===G.id?`bg-muted`:`text-muted-foreground`}`,children:[(0,Y.jsxs)(`button`,{id:`${e}-${t.id}-tab`,type:`button`,role:`tab`,"aria-selected":t.id===G.id,"aria-controls":`${e}-${t.id}-content`,tabIndex:t.id===G.id?0:-1,className:`flex h-8 min-w-0 flex-1 items-center gap-1.5 px-2 text-xs`,onClick:()=>Z({type:`select`,id:t.id}),children:[(0,Y.jsx)(n,{size:13,className:`shrink-0`}),(0,Y.jsx)(`span`,{className:`truncate`,children:r})]}),(0,Y.jsx)(`button`,{type:`button`,className:`mr-0.5 grid size-5 shrink-0 place-items-center rounded hover:bg-foreground/10`,"aria-label":`${D(`chat:sessionContext.closePage`)} · ${r}`,onClick:()=>Z({type:`close`,id:t.id}),children:(0,Y.jsx)(M,{size:11})})]},t.id)})}),de]}),V.pages.map(t=>{let n=K(t),r=G.id===t.id;return(0,Y.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,Y.jsx)(se,{tools:z.map(e=>({...e,disabled:e.id===`terminal`||e.id===`processes`?!j||!P(L,`terminal`):e.id===`changes`&&!P(L,`vcs`)})),onOpenUrl:e=>{Z({type:`open`,kind:`browser`,replaceId:t.id}),b.getState().update(a,`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,Y.jsx)(R,{sessionId:a,cwd:c,streaming:y,view:t.view,onViewChange:e=>Z({type:`view`,id:t.id,patch:e})}):n.id===`sources`?r&&(0,Y.jsx)(oe,{sources:u,view:t.view,onViewChange:e=>Z({type:`view`,id:t.id,patch:e})}):n.id===`terminal`?r&&(0,Y.jsx)(ie,{sessionId:a,cwd:c,terminalId:t.resourceId||void 0,onCreated:e=>b.getState().update(a,f,{type:`resource`,id:t.id,resourceId:e})}):n.id===`processes`?r&&(0,Y.jsx)(ae,{view:t.view,onViewChange:e=>Z({type:`view`,id:t.id,patch:e}),sessionId:a,onOpenTerminal:e=>Z({type:`open`,kind:`terminal`,resourceId:e})}):n.id===`side-chat`?(0,Y.jsx)(ce,{parentId:a,active:r}):n.id===`browser`?(0,Y.jsx)(le,{page:t,onChange:e=>Z({type:`browser`,id:t.id,...e})}):r&&(n.id===`files`?(0,Y.jsx)(ee,{view:t.view,onViewChange:e=>Z({type:`view`,id:t.id,patch:e}),sessionId:a,streaming:y,requestConfirm:S}):(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-3`,children:g?.items?.length?(0,Y.jsx)(h,{plan:g}):(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:D(`chat:sessionContext.planEmpty`)})}))},t.id)})]});return t?(0,Y.jsx)(ne,{open:!0,onOpenChange:e=>!e&&w(),children:(0,Y.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,Y.jsx)(U,{className:`sr-only`,children:(0,Y.jsx)(H,{children:D(`chat:sessionContext.title`)})}),$]})}):(0,Y.jsx)(`aside`,{id:e,tabIndex:n?-1:void 0,className:`h-full min-h-0 w-full overflow-hidden border-l border-border/60`,"aria-label":D(`chat:sessionContext.title`),children:$})}export{Z as SessionContextPanel};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/GitDiffViewer-oJDF7l74.js","assets/rolldown-runtime-B0Z9INg1.js","assets/vendor-react-DwNgTV1j.js","assets/use-i18n-BrWBoyFl.js","assets/i18n-CblgkPOp.js","assets/vendor-router-CZg2bCPV.js","assets/index-BAYzSwUr.js","assets/index-Bcpvpefn.css","assets/storage-BpAqa-YY.js","assets/vendor-state-GkUciC5H.js","assets/file-diff-GxOMJkLj.js","assets/createLucideIcon-Cd-3GVxJ.js","assets/x-07u4-129.js","assets/button-BcPDt1Ge.js","assets/vendor-ui-DvrYggeS.js","assets/dist-Cfh4kzCK.js","assets/utils-C8uzG5AZ.js","assets/git-diff-f-zMaQOk.js","assets/events-f8vVvSfH.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{p as t}from"./vendor-router-CZg2bCPV.js";import{i as n,r}from"./vendor-react-DwNgTV1j.js";import{t as i}from"./use-i18n-BrWBoyFl.js";import{t as a}from"./check-2vYc6QaP.js";import{t as o}from"./chevron-right-C3t2Rckj.js";import{t as s}from"./file-diff-GxOMJkLj.js";import{t as c}from"./refresh-cw-TbWxTY4K.js";import{n as l,t as u}from"./project-diff-summary-BzAMC_7C.js";import{t as d}from"./button-BcPDt1Ge.js";import{t as f}from"./useQuery-DdcpUQhO.js";import{n as p}from"./git-diff-f-zMaQOk.js";import{t as m}from"./chat-api-CbgoP-8X.js";import{n as h}from"./session-change-summary-api-CqJa3Wdh.js";var g=e(n(),1),_=r(),v=(0,g.lazy)(()=>t(()=>import(`./GitDiffViewer-oJDF7l74.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,18])));function y({sessionId:e,path:t,scope:n,revision:r=0,position:a,onReading:o}){let{t:s}=i(),c=f({queryKey:[`task-file-diff`,e,n,t,r],queryFn:({signal:r})=>n===`project`?m.getFileDiff(e,t,{signal:r}):m.getSessionFileChangeDiff(e,t,{signal:r})});return c.isPending?(0,_.jsx)(`p`,{role:`status`,className:`p-3 text-xs text-content-muted`,children:s(`chat:focusSession.gitLoading`)}):c.isError?(0,_.jsxs)(`div`,{className:`p-3`,children:[(0,_.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:c.error.message}),(0,_.jsx)(d,{variant:`ghost`,size:`sm`,onClick:()=>void c.refetch(),children:s(`chat:chatMessage.filePreviewRetry`)})]}):(0,_.jsx)(g.Suspense,{fallback:null,children:(0,_.jsx)(v,{position:a,onReading:o,diff:c.data.diff,truncated:c.data.diffTruncated})})}function b({sessionId:e,cwd:t,streaming:n,view:r,onViewChange:a}){let{t:s}=i(),l=f({queryKey:[`task-project-changes`,e,t,n],queryFn:({signal:t})=>m.getVcsChanges(e,{signal:t})}),h=p(r.reading?.list,e=>a({reading:{...r.reading,list:e}})),v=(0,g.useMemo)(()=>u(l.data?.diff||``,l.data?.files.map(e=>e.path)||[],l.data?.diffTruncated),[l.data]),b=r.expandedFiles.filter(e=>l.data&&!l.data.files.some(t=>t.path===e)),x=l.error?.message||l.data?.error,S=l.data?.files||[];return(0,_.jsxs)(`section`,{"aria-label":s(`chat:workbench.projectChanges`),className:`flex min-h-0 flex-1 flex-col gap-3 p-3`,children:[(0,_.jsxs)(`header`,{className:`flex min-w-0 items-center gap-2`,children:[(0,_.jsx)(`h2`,{className:`flex-1 text-sm font-medium`,children:s(`chat:workbench.projectChanges`)}),(0,_.jsx)(d,{variant:`ghost`,size:`icon-sm`,"aria-label":s(`chat:focusSession.gitRefresh`),disabled:l.isFetching,onClick:()=>void l.refetch(),children:(0,_.jsx)(c,{size:15})})]}),(0,_.jsx)(`p`,{className:`text-xs text-content-muted`,children:s(`chat:workbench.projectScope`)}),(0,_.jsxs)(`p`,{className:`truncate text-xs text-content-muted`,title:t,children:[l.data?.branch?`${l.data.branch} · `:``,t]}),(0,_.jsxs)(`div`,{className:`flex gap-2`,children:[(0,_.jsx)(d,{variant:`outline`,size:`sm`,disabled:!S.length||!!x,onClick:()=>a({expandedFiles:S.map(e=>e.path)}),children:s(`chat:workbench.expandAll`)}),(0,_.jsx)(d,{variant:`ghost`,size:`sm`,onClick:()=>a({expandedFiles:[]}),children:s(`chat:workbench.collapseAll`)})]}),!l.isFetching&&!x&&b.map(e=>(0,_.jsx)(`p`,{role:`status`,className:`break-all text-xs text-content-muted`,children:s(`chat:workbench.fileNoLongerChanged`,{path:e})},e)),l.isPending?(0,_.jsx)(`p`,{role:`status`,className:`text-sm text-content-muted`,children:s(`chat:focusSession.gitLoading`)}):x?(0,_.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:x}):l.data?.isRepo?S.length?(0,_.jsx)(`div`,{ref:h.ref,className:`min-h-0 flex-1 overflow-y-auto`,children:S.map(t=>{let n=r.expandedFiles.includes(t.path);return(0,_.jsxs)(`article`,{className:`border-b border-border/60`,children:[(0,_.jsxs)(`button`,{"aria-expanded":n,title:t.path,className:`flex min-h-11 w-full min-w-0 items-center gap-2 text-left text-sm`,onClick:()=>a({expandedFiles:n?r.expandedFiles.filter(e=>e!==t.path):[...r.expandedFiles,t.path]}),children:[(0,_.jsx)(o,{size:15,className:n?`shrink-0 rotate-90`:`shrink-0`}),(0,_.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t.path}),(0,_.jsx)(`span`,{className:`shrink-0 text-xs text-content-muted`,children:t.status}),Object.hasOwn(v.files,t.path)&&(0,_.jsxs)(`span`,{className:`shrink-0 text-xs text-content-muted`,children:[`+`,v.files[t.path].added,` −`,v.files[t.path].removed]})]}),n&&(0,_.jsx)(`p`,{className:`break-all p-2 text-xs text-content-muted`,children:t.path}),n&&(0,_.jsx)(y,{sessionId:e,path:t.path,scope:`project`,position:r.reading?.[t.path],onReading:e=>a({reading:{...r.reading,[t.path]:e}}),revision:l.dataUpdatedAt})]},t.path)})}):(0,_.jsx)(`p`,{className:`text-sm text-content-muted`,children:s(`chat:focusSession.fileChangesEmpty`)}):(0,_.jsx)(`p`,{className:`text-sm text-content-muted`,children:s(`chat:workbench.notRepository`)})]})}var x=(0,g.lazy)(()=>t(()=>import(`./GitDiffViewer-oJDF7l74.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,18]))),S=100;function C(e){return e instanceof Error?e.message:String(e)}function w({sessionId:e,streaming:t,requestConfirm:n,view:r,onViewChange:u}){let{t:f}=i(),v=p(r?.reading?.list,e=>u?.({reading:{...r?.reading,list:e}})),[b,w]=(0,g.useState)([]),T=r?.expandedFiles||b,E=e=>u?u({expandedFiles:e}):w(e),[ee,D]=(0,g.useState)(0),[te,ne]=(0,g.useState)(0),[O,k]=(0,g.useState)(null),[A,j]=(0,g.useState)(!0),[M,N]=(0,g.useState)(``),[P,F]=(0,g.useState)(``),[I,L]=(0,g.useState)(``),[R,z]=(0,g.useState)(null),[B,V]=(0,g.useState)(null),[H,U]=(0,g.useState)(null),W=(0,g.useRef)(!1),G=(0,g.useRef)(0),K=(0,g.useRef)(0),q=(0,g.useRef)(!0),J=(0,g.useRef)(!1),Y=(0,g.useRef)(t);(0,g.useLayoutEffect)(()=>{Y.current=t},[t]),(0,g.useLayoutEffect)(()=>(W.current=!0,()=>{W.current=!1,G.current+=1,K.current+=1}),[]),(0,g.useEffect)(()=>{let t=++G.current;return K.current+=1,V(null),U(null),q.current=!0,j(!0),N(``),m.getSessionFileChanges(e).then(e=>{W.current&&t===G.current&&(k(e),ne(e=>e+1))},e=>{W.current&&t===G.current&&N(C(e))}).finally(()=>{W.current&&t===G.current&&(q.current=!1,j(!1))}),()=>{G.current+=1}},[ee,e,t]);let re=async t=>{if(J.current||q.current)return;let n=++K.current;U(t),F(``);try{let r=await m.getSessionFileChangeDiff(e,t);if(!W.current||n!==K.current)return;if(!r.diff?.trim()){F(f(`chat:focusSession.fileChangesNoSnapshot`));return}V({diff:r.diff,truncated:!!r.diffTruncated})}catch(e){W.current&&n===K.current&&F(C(e))}finally{W.current&&n===K.current&&U(null)}},X=async t=>{if(!W.current||J.current||q.current||Y.current||!O||M||!O.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;J.current=!0,z(t),F(``),L(``);let r=++G.current;K.current+=1,V(null),U(null);let i=!1;try{if(t.kind===`revert`&&!await n({title:t.path?f(`chat:focusSession.fileChangesRevertFile`):f(`chat:focusSession.fileChangesRevertAll`),message:t.path?f(`chat:focusSession.fileChangesRevertFileDescription`,{path:t.path}):f(`chat:focusSession.fileChangesRevertAllDescription`),confirmLabel:f(`chat:focusSession.fileChangesConfirmRevert`),tone:`danger`})||!W.current||Y.current||q.current||r!==G.current)return;i=!0;let a=t.kind===`approve`?await m.approveSessionFileChanges(e,t.path):await m.revertSessionFileChanges(e,t.path);if(h(e),!W.current||r!==G.current)return;k(a),t.kind===`approve`?L(t.path?f(`chat:focusSession.fileChangesApproved`):f(`chat:focusSession.fileChangesApproveDone`)):a.reverted?t.path===void 0&&a.files.some(e=>e.pending)?L(f(`chat:focusSession.fileChangesRevertPartial`,{count:a.reverted})):L(f(`chat:focusSession.fileChangesRevertDone`)):L(f(`chat:focusSession.fileChangesRevertUnavailable`))}catch(e){W.current&&r===G.current&&F(C(e))}finally{J.current=!1,W.current&&(z(null),i&&(q.current=!0,j(!0),D(e=>e+1)))}},Z=A||t||!!R||!!M||!O,Q=O?.summary.pending||0,ie=O?.files.filter(e=>e.canRevert&&!e.reverted).length||0,$=P||M;return(0,_.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col gap-3 p-3`,"aria-label":f(`chat:focusSession.fileChanges`),"aria-busy":A||!!R,children:[(0,_.jsxs)(`div`,{className:`flex flex-none flex-wrap items-center justify-between gap-2`,children:[(0,_.jsxs)(`div`,{className:`min-w-0`,children:[(0,_.jsx)(`p`,{className:`text-[length:var(--app-font-size)] font-medium`,children:f(`chat:focusSession.fileChanges`)}),O&&(0,_.jsxs)(`p`,{className:`text-[length:var(--app-small-size)] text-[var(--text-muted)]`,children:[f(`chat:focusSession.fileChangesCount`,{count:O.summary.files}),` · `,`+`,O.summary.added,` −`,O.summary.removed,Q>0&&` · ${f(`chat:focusSession.fileChangesPending`,{count:Q})}`]})]}),(0,_.jsxs)(`div`,{className:`ml-auto flex flex-wrap items-center justify-end gap-1.5`,children:[(0,_.jsxs)(d,{type:`button`,variant:`outline`,size:`sm`,className:`min-h-11 sm:min-h-9`,disabled:Z||Q===0,title:t?f(`chat:focusSession.gitWaitForRunToFinish`):void 0,onClick:()=>void X({kind:`approve`}),children:[R?.kind===`approve`&&!R.path?(0,_.jsx)(c,{className:`animate-spin`,size:14}):(0,_.jsx)(a,{size:14}),f(`chat:focusSession.fileChangesApproveAll`)]}),(0,_.jsxs)(d,{type:`button`,variant:`outline`,size:`sm`,className:`min-h-11 sm:min-h-9`,disabled:Z||ie===0,title:f(t?`chat:focusSession.gitWaitForRunToFinish`:`chat:focusSession.fileChangesRevertAllDescription`),onClick:()=>void X({kind:`revert`}),children:[R?.kind===`revert`&&!R.path?(0,_.jsx)(c,{className:`animate-spin`,size:14}):(0,_.jsx)(l,{size:14}),f(`chat:focusSession.fileChangesRevertAll`)]}),(0,_.jsx)(d,{type:`button`,variant:`ghost`,size:`icon`,className:`size-11 sm:size-9`,"aria-label":f(`chat:focusSession.gitRefresh`),title:f(`chat:focusSession.gitRefresh`),disabled:A||!!R,onClick:()=>{q.current=!0,j(!0),F(``),D(e=>e+1)},children:(0,_.jsx)(c,{className:A?`animate-spin`:``,size:16})})]})]}),(0,_.jsx)(`p`,{className:`text-xs text-content-muted`,children:f(`chat:workbench.taskSnapshotScope`)}),(0,_.jsxs)(`div`,{className:`flex gap-2`,children:[(0,_.jsx)(d,{variant:`outline`,size:`sm`,disabled:A||!O?.files.length,onClick:()=>E(O?.files.slice(0,S).map(e=>e.path)||[]),children:f(`chat:workbench.expandAll`)}),(0,_.jsx)(d,{variant:`ghost`,size:`sm`,onClick:()=>E([]),children:f(`chat:workbench.collapseAll`)})]}),$&&(0,_.jsx)(`p`,{role:`alert`,className:`text-[length:var(--app-small-size)] text-[var(--text-secondary)]`,children:$}),I&&!$&&(0,_.jsx)(`p`,{role:`status`,className:`text-[length:var(--app-small-size)] text-[var(--text-secondary)]`,children:I}),A&&!O?(0,_.jsx)(`p`,{role:`status`,className:`text-[length:var(--app-font-size)] text-[var(--text-muted)]`,children:f(`chat:focusSession.gitLoading`)}):O?.files.length?(0,_.jsxs)(`ul`,{ref:v.ref,className:`min-h-0 flex-1 space-y-1 overflow-y-auto`,"aria-label":f(`chat:focusSession.fileChanges`),children:[O.files.slice(0,S).map(t=>(0,_.jsxs)(`li`,{className:`min-w-0 rounded-md border-b border-border/60`,children:[(0,_.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1 px-2 py-1`,children:[(0,_.jsxs)(`button`,{type:`button`,className:`flex min-h-11 min-w-0 flex-1 items-center gap-2 rounded-md text-left text-[length:var(--app-small-size)] outline-none focus-visible:ring-2 focus-visible:ring-[var(--brand-blue)] disabled:opacity-60`,title:t.path,disabled:A||!!R,"aria-busy":H===t.path,"aria-expanded":T.includes(t.path),onClick:()=>E(T.includes(t.path)?T.filter(e=>e!==t.path):[...T,t.path]),children:[(0,_.jsx)(o,{size:14,className:T.includes(t.path)?`rotate-90 shrink-0`:`shrink-0`}),H===t.path?(0,_.jsx)(c,{size:14,className:`flex-none animate-spin`}):(0,_.jsx)(s,{size:14,className:`flex-none text-[var(--star-strong)]`}),(0,_.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,_.jsx)(`span`,{className:`block truncate`,children:t.path}),(0,_.jsxs)(`span`,{className:`block text-[var(--text-muted)]`,children:[`+`,t.added,` −`,t.removed,t.reverted?` · ${f(`chat:focusSession.fileChangesReverted`)}`:t.approved?` · ${f(`chat:focusSession.fileChangesApproved`)}`:``]})]})]}),(0,_.jsx)(d,{type:`button`,variant:`ghost`,size:`icon`,className:`size-11 sm:size-9`,title:f(`chat:focusSession.fileChangesApproveFile`),"aria-label":`${f(`chat:focusSession.fileChangesApproveFile`)} ${t.path}`,disabled:Z||!t.pending||t.approved||t.reverted,onClick:()=>void X({kind:`approve`,path:t.path}),children:(0,_.jsx)(a,{size:14})}),(0,_.jsx)(d,{type:`button`,variant:`ghost`,size:`icon`,className:`size-11 sm:size-9`,title:f(`chat:focusSession.fileChangesRevertFile`),"aria-label":`${f(`chat:focusSession.fileChangesRevertFile`)} ${t.path}`,disabled:Z||t.reverted||!t.canRevert,onClick:()=>void X({kind:`revert`,path:t.path}),children:(0,_.jsx)(l,{size:14})})]}),T.includes(t.path)&&(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(y,{sessionId:e,path:t.path,scope:`task`,position:r?.reading?.[t.path],onReading:e=>u?.({reading:{...r?.reading,[t.path]:e}}),revision:te}),(0,_.jsx)(d,{variant:`ghost`,size:`sm`,onClick:()=>void re(t.path),children:f(`chat:workbench.fullDiff`)})]})]},t.path)),O.files.length>S&&(0,_.jsx)(`li`,{className:`px-2 py-1 text-[length:var(--app-small-size)] text-[var(--text-muted)]`,children:f(`chat:focusSession.gitMoreFiles`,{count:O.files.length-S})})]}):!$&&(0,_.jsx)(`p`,{className:`text-[length:var(--app-font-size)] text-[var(--text-muted)]`,children:f(`chat:focusSession.fileChangesEmpty`)}),B&&(0,_.jsx)(g.Suspense,{fallback:null,children:(0,_.jsx)(x,{diff:B.diff,truncated:B.truncated,onClose:()=>V(null)})})]})}export{b as n,w as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-
|
|
1
|
+
import{r as e}from"./vendor-react-DwNgTV1j.js";import{t}from"./use-i18n-BrWBoyFl.js";import{t as n}from"./download-BCfIiuaL.js";import{t as r}from"./external-link-CEQqPcqc.js";import{t as i}from"./refresh-cw-TbWxTY4K.js";import{t as a}from"./rocket-BgLSjoHY.js";var o=e();function s({update:e,collapsed:s,onOpen:c}){let{t:l}=t(),u=e?.status||{state:`idle`},d=!!(e?.info?.desktop||e?.info?.mobile);if(![`available`,`downloading`,`downloaded`].includes(u.state))return null;let f=u.state===`downloading`,p=u.state===`downloaded`,m=l(p?`navigation:appSidebar.readyToRestart`:f?`navigation:appSidebar.downloading`:d?`navigation:appSidebar.updateAvailable`:`navigation:appSidebar.sourceUpdatesAvailable`),h=f?`${Math.round(u.percent||0)}%`:d&&u.availableVersion?`v${u.availableVersion}`:u.behindBy?l(`navigation:appSidebar.countCommitsBehindBranch`,{branch:u.branch||`main`,count:u.behindBy}):u.availableCommit?u.availableCommit.slice(0,7):l(`navigation:appSidebar.viewUpdateDetails`),g=p?a:f?i:d?n:r;return(0,o.jsxs)(`button`,{type:`button`,className:`flex min-h-11 w-full items-center rounded-[var(--r-sm)] border border-[var(--stroke)] bg-[var(--accent-soft)] text-[var(--text)] transition-colors hover:bg-sidebar-accent ${s?`justify-center px-0`:`gap-2.5 px-3 text-left`}`,title:`${m} · ${h}`,"aria-label":`${m} · ${h}`,onClick:c,children:[(0,o.jsx)(g,{className:f?`animate-spin shrink-0`:`shrink-0`,size:16}),!s&&(0,o.jsxs)(`span`,{className:`min-w-0`,children:[(0,o.jsx)(`strong`,{className:`block truncate text-[12px]`,children:m}),(0,o.jsx)(`small`,{className:`mt-0.5 block truncate text-[11px] text-[var(--text-muted)]`,children:h})]})]})}export{s as default};
|
|
@@ -1 +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-Dpn7lxcE.js";import{t as i}from"./createLucideIcon-Cd-3GVxJ.js";import{t as a}from"./file-code-corner-BnE1ljT0.js";import{t as o}from"./image-BY_c3FYU.js";import{t as s}from"./refresh-cw-TbWxTY4K.js";import{t as c}from"./save-CHBB52P8.js";import{t as l}from"./sparkles-S_eeuqn9.js";import{t as u}from"./trash-2-CNrPOoPR.js";import{t as d}from"./wrench-6pg6_bqI.js";import{t as f}from"./api-D8wGrWiI.js";import{t as p}from"./button-BcPDt1Ge.js";import{c as m,l as h,n as ee,o as g,r as _,s as v,t as y}from"./app-primitives-DhqJLud3.js";import{t as b}from"./PageFrame-BiJUCJku.js";import{t as x}from"./usePagePrimaryAction-CWPC0C_f.js";import{t as te}from"./ListDetailLayout-S-IBs4f_.js";var S=i(`package`,[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]),C=e(t(),1),w=n(),T=[`all`,`global`,`project`,`design`,`code`,`docs`,`privileged`];function E(e,t=``){return t?`${e}${e.includes(`?`)?`&`:`?`}sessionId=${encodeURIComponent(t)}`:e}function D(e,t){return t(e===`global`?`skills:skillsPage.global`:e===`project`?`skills:skillsPage.project`:e===`design`?`skills:skillsPage.design`:e===`code`?`skills:skillsPage.code`:e===`docs`?`skills:skillsPage.documents`:e===`privileged`?`skills:skillsPage.highPrivilege`:`skills:skillsPage.all`)}function O(e){let t=`${e?.name||``} ${e?.description||``}`.toLowerCase();return/image|visual|design|figma|svg|图片|视觉|设计/.test(t)?o:/doc|pdf|文档|说明/.test(t)?a:/install|package|market|安装|包/.test(t)?S:/code|test|plugin|skill|代码|测试|插件|技能/.test(t)?d:l}function k(e,t){if(t===`all`)return!0;if(t===`global`)return e.sourceInfo?.scope!==`project`;if(t===`project`)return e.sourceInfo?.scope===`project`;let n=`${e.name} ${e.description} ${(e.allowedTools||[]).join(` `)}`.toLowerCase();return t===`design`?/image|visual|design|figma|svg|图片|视觉|设计/.test(n):t===`code`?/code|test|plugin|代码|测试|插件/.test(n):t===`docs`?/doc|pdf|文档|说明/.test(n):t!==`privileged`||(e.allowedTools||[]).some(e=>[`bash`,`write`,`edit`].includes(e))}function A({notify:e,query:t=``,activeSessionId:n=``,registerPrimaryAction:i,requestText:a,requestConfirm:o}){let[l,d]=(0,C.useState)(!1),{t:A}=r(),[j,M]=(0,C.useState)(null),[N,P]=(0,C.useState)(``),[F,I]=(0,C.useState)(`all`),[L,R]=(0,C.useState)(!1),[z,B]=(0,C.useState)(!0),[,V]=(0,C.useState)(``),H=(0,C.useCallback)(async()=>{V(``);try{let e=await f(E(`/api/skills`,n));return M(e),P(t=>e.skills.some(e=>e.id===t)?t:e.skills[0]?.id||``),e}catch(e){return V(e instanceof Error?e.message:String(e)),null}finally{B(!1)}},[n]);(0,C.useEffect)(()=>{H()},[H]);let U=(0,C.useCallback)(async()=>{let t=await a?.({title:A(`skills:skillsPage.importGlobalSkill`),message:A(`skills:skillsPage.globalSkillSourceHelp`),inputLabel:A(`skills:skillsPage.skillSource`),placeholder:`E:\\path\\to\\skill, npm:@scope/package, or https://github.com/...`,maxLength:2e3,confirmLabel:A(`skills:skillsPage.continue`)});if(t?.trim()&&await o?.({title:A(`skills:skillsPage.importGlobalSkill`),message:A(`skills:skillsPage.skillsProvideInstructionsToTheAgentAndMayIncludeExecutableScriptsConfirmThatYouTrustTheSource`),confirmLabel:A(`skills:skillsPage.import`),tone:`danger`})!==!1){R(!0),V(``);try{let r=await f(E(`/api/skills/install`,n),{method:`POST`,body:JSON.stringify({source:t})});M(r),P(r.installed?.[0]?.id||r.skills[0]?.id||``),e(A(`skills:skillsPage.skillInstalledAndLoadedIntoTheAgentRuntime`),`success`)}catch(t){let n=t instanceof Error?t.message:String(t);V(n),e(n,`error`)}finally{R(!1)}}},[n,e,o,a,A]);if(x(i,U),z&&!j)return(0,w.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3`,children:(0,w.jsxs)(_,{children:[(0,w.jsx)(s,{className:`animate-spin`,size:23}),(0,w.jsx)(`h2`,{children:A(`skills:skillsPage.loadingSkills`)}),(0,w.jsx)(`p`,{children:A(`skills:skillsPage.scanningSkillDirectoriesAndConfiguredPackages`)})]})});let W=j?.skills||[],G=W.filter(e=>k(e,F)&&`${e.name} ${e.description}`.toLowerCase().includes(t.toLowerCase())),K=W.filter(e=>e.sourceInfo?.scope!==`project`),q=W.filter(e=>e.sourceInfo?.scope===`project`),J=G.filter(e=>e.sourceInfo?.scope!==`project`),Y=G.filter(e=>e.sourceInfo?.scope===`project`),X=W.find(e=>e.id===N)||G[0]||W[0]||null,Z=(j?.packages||[]).map(e=>({source:e.source,description:e.scope===`project`?A(`skills:skillsPage.projectScopedConfiguration`):A(`skills:skillsPage.userScopedConfiguration`),status:e.installed?A(`skills:skillsPage.locallyReady`):A(`skills:skillsPage.notMaterialized`),tone:e.installed?`green`:`gray`})).filter(e=>`${e.source} ${e.description}`.toLowerCase().includes(t.toLowerCase())),Q=async(e,t)=>{if(e){R(!0),V(``);try{let r=await f(E(`/api/skills/${encodeURIComponent(e.id)}`,n),{method:`PATCH`,body:JSON.stringify(t)});M(e=>{if(!e)return e;let t=e.skills.map(e=>e.id===r.id?r:e);return{...e,skills:t,counts:{...e.counts,enabled:t.filter(e=>e.enabled).length,modelInvocable:t.filter(e=>e.enabled&&e.modelInvocationEnabled).length}}})}catch(e){V(e instanceof Error?e.message:String(e))}finally{R(!1)}}},ne=async()=>{R(!0),V(``);try{M(await f(E(`/api/skills/reload`,n),{method:`POST`,body:`{}`})),e(A(`skills:skillsPage.skillSettingsSavedAndReloaded`),`success`)}catch(e){V(e instanceof Error?e.message:String(e))}finally{R(!1)}},re=async()=>{if(X?.removable&&await o?.({title:A(`skills:skillsPage.uninstallSkill`),message:A(`skills:skillsPage.thisRemovesTheSkillDirectoryInstalledByPisperItDoesNotUninstallTheOriginalNpmOrGitPackage`),confirmLabel:A(`skills:skillsPage.uninstall`),tone:`danger`})!==!1){R(!0),V(``);try{await f(E(`/api/skills/${encodeURIComponent(X.id)}`,n),{method:`DELETE`});let t=await H();P(t?.skills[0]?.id||``),e(A(`skills:skillsPage.skillUninstalled`),`success`)}catch(t){let n=t instanceof Error?t.message:String(t);V(n),e(n,`error`)}finally{R(!1)}}},$=(e,t,n,r,i=``)=>(0,w.jsxs)(`section`,{className:`skill-scope [.skill-scope_+_&]:[border-top:1px_solid_var(--stroke)] [.skill-scope_+_&]:pt-[14px]`,children:[(0,w.jsxs)(`div`,{className:`skill-scope-head [&_>_div]:min-w-0 [&_small]:block [&_small]:overflow-hidden [&_small]:text-[var(--text-muted)] [&_small]:font-[ui-monospace,_SFMono-Regular,_Consolas,_'Liberation_Mono',_monospace] [&_small]:text-[11px] [&_small]:text-ellipsis [&_small]:whitespace-nowrap [&_>_span]:min-w-[24px] [&_>_span]:text-[var(--text-secondary)] [&_>_span]:text-[12px] [&_>_span]:font-[600] [&_>_span]:text-right flex min-w-0 items-start justify-between gap-[10px]`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(g,{title:e,className:`mb-0.5`}),i&&(0,w.jsx)(`small`,{title:i,children:i})]}),(0,w.jsx)(`span`,{children:t.length})]}),t.length?t.map(e=>{let t=O(e);return(0,w.jsxs)(`div`,{className:`skill-row grid w-full grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-[9px] border-0 [border-top:1px_solid_var(--stroke-soft)] bg-transparent p-[10px_8px] text-left hover:rounded-[var(--r-sm)] hover:bg-[var(--accent-soft)] [&.selected]:rounded-[var(--r-sm)] [&.selected]:bg-[var(--accent-soft)] [&_>_span:nth-child(2)]:flex [&_>_span:nth-child(2)]:flex-col [&_>_span:nth-child(2)]:gap-[3px] [&_strong]:text-[13px] [&_small]:text-[var(--text-muted)] [&_small]:text-[13px] grid-cols-[minmax(0,1fr)_auto] [padding-block:4px] ${X?.id===e.id?`selected`:``}`,children:[(0,w.jsxs)(`button`,{className:`skill-row-main [&_>_span:nth-child(2)]:flex [&_>_span:nth-child(2)]:min-w-0 [&_>_span:nth-child(2)]:flex-col [&_>_span:nth-child(2)]:gap-[3px] grid min-w-0 grid-cols-[auto_minmax(0,1fr)] items-center gap-[9px] border-0 bg-transparent [padding:6px_4px] text-left`,onClick:()=>{d(!0),P(e.id)},children:[(0,w.jsx)(`span`,{className:`list-icon [.chat-resource-list_&]:grid [.chat-resource-list_&]:w-[28px] [.chat-resource-list_&]:h-[28px] [.chat-resource-list_&]:place-items-center [.chat-resource-list_&]:rounded-[var(--r-sm)] [.chat-resource-list_&]:bg-[var(--surface-subtle)] [.chat-resource-list_&]:text-[var(--star-strong)] [.session-workflow-summary_&]:grid [.session-workflow-summary_&]:w-[28px] [.session-workflow-summary_&]:h-[28px] [.session-workflow-summary_&]:place-items-center [.session-workflow-summary_&]:rounded-[var(--r-sm)] [.session-workflow-summary_&]:bg-[var(--surface-subtle)] [.session-workflow-summary_&]:text-[var(--star-strong)] grid w-[27px] h-[27px] place-items-center rounded-[var(--r-sm)] bg-[var(--accent-soft)] text-[var(--star-strong)] [.workflow-template-gallery_&]:grid [.workflow-template-gallery_&]:w-[32px] [.workflow-template-gallery_&]:h-[32px] [.workflow-template-gallery_&]:place-items-center [.workflow-template-gallery_&]:rounded-[var(--r-sm)] [.workflow-template-gallery_&]:bg-[var(--surface-subtle)] [.workflow-template-gallery_&]:text-[var(--star-strong)]`,children:(0,w.jsx)(t,{size:15})}),(0,w.jsxs)(`span`,{children:[(0,w.jsx)(`strong`,{children:e.name}),(0,w.jsx)(`small`,{className:`line-clamp-2`,title:e.description,children:e.description})]})]}),(0,w.jsx)(v,{value:e.enabled,disabled:L,ariaLabel:A(`skills:skillsPage.toggleSkillName`,{name:e.name}),onChange:t=>void Q(e,{enabled:t})})]},e.id)}):(0,w.jsx)(`p`,{className:`muted-copy m-[8px_0_14px] text-[var(--text-secondary)] text-[12px] leading-[1.55] skills-empty-copy !m-[8px_2px_4px]`,children:n.length?A(`skills:skillsPage.noSkillsMatchTheCurrentFilter`):r})]});return(0,w.jsx)(b,{variant:`list-detail`,children:(0,w.jsx)(`div`,{className:`flex h-full min-h-0 flex-col gap-3`,children:(0,w.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3`,children:[(0,w.jsx)(m,{options:T.map(e=>D(e,A)),value:D(F,A),onChange:e=>I(T.find(t=>D(t,A)===e)||`all`)}),(0,w.jsx)(w.Fragment,{children:(0,w.jsx)(te,{selected:l,onBack:()=>d(!1),backLabel:A(`common:pageTemplate.backToList`),list:(0,w.jsxs)(y,{className:`min-w-0 border-0 bg-transparent p-0 shadow-none`,children:[(0,w.jsx)(p,{variant:`outline`,className:`mb-3 w-full @min-[760px]/list-detail:hidden`,onClick:()=>d(!0),children:A(`skills:skillsPage.configuredSkillPackages`)}),F!==`project`&&$(A(`skills:skillsPage.globalSkills`),J,K,A(`skills:skillsPage.noGlobalSkills`),j?.locations?.global||`~/.pisper/agent/skills`),F!==`global`&&$(A(`skills:skillsPage.projectSkills`),Y,q,A(`skills:skillsPage.noProjectSkills`),j?.locations?.project||(j?.cwd?`${j.cwd.replace(/[\\/]$/,``)}/.pisper/skills`:``))]}),detail:(0,w.jsxs)(y,{children:[(0,w.jsxs)(ee,{children:[(0,w.jsx)(g,{title:A(`skills:skillsPage.configuredSkillPackages`)}),(0,w.jsx)(`span`,{className:`text-[var(--text-secondary)] text-[12px] font-[600]`,children:A(`skills:skillsPage.countSkillPackages`,{count:Z.length})})]}),Z.length?Z.map(e=>(0,w.jsxs)(`div`,{className:`market-row [&_>_span:nth-child(2)]:flex [&_>_span:nth-child(2)]:flex-col [&_>_span:nth-child(2)]:gap-[3px] [&_strong]:text-[13px] [&_small]:text-[var(--text-muted)] [&_small]:text-[13px] [&_strong]:overflow-hidden [&_strong]:text-ellipsis [&_strong]:whitespace-nowrap grid min-h-[48px] grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-[8px] [border-top:1px_solid_var(--stroke-soft)] [padding:6px_2px]`,children:[(0,w.jsx)(`span`,{className:`list-icon [.chat-resource-list_&]:grid [.chat-resource-list_&]:w-[28px] [.chat-resource-list_&]:h-[28px] [.chat-resource-list_&]:place-items-center [.chat-resource-list_&]:rounded-[var(--r-sm)] [.chat-resource-list_&]:bg-[var(--surface-subtle)] [.chat-resource-list_&]:text-[var(--star-strong)] [.session-workflow-summary_&]:grid [.session-workflow-summary_&]:w-[28px] [.session-workflow-summary_&]:h-[28px] [.session-workflow-summary_&]:place-items-center [.session-workflow-summary_&]:rounded-[var(--r-sm)] [.session-workflow-summary_&]:bg-[var(--surface-subtle)] [.session-workflow-summary_&]:text-[var(--star-strong)] grid w-[27px] h-[27px] place-items-center rounded-[var(--r-sm)] bg-[var(--accent-soft)] text-[var(--star-strong)] [.workflow-template-gallery_&]:grid [.workflow-template-gallery_&]:w-[32px] [.workflow-template-gallery_&]:h-[32px] [.workflow-template-gallery_&]:place-items-center [.workflow-template-gallery_&]:rounded-[var(--r-sm)] [.workflow-template-gallery_&]:bg-[var(--surface-subtle)] [.workflow-template-gallery_&]:text-[var(--star-strong)]`,children:(0,w.jsx)(S,{size:15})}),(0,w.jsxs)(`span`,{children:[(0,w.jsx)(`strong`,{title:e.source,children:e.source}),(0,w.jsx)(`small`,{children:e.description})]}),(0,w.jsx)(h,{tone:e.tone,children:e.status})]},e.source)):(0,w.jsx)(`p`,{className:`muted-copy m-[8px_0_14px] text-[var(--text-secondary)] text-[12px] leading-[1.55] skills-empty-copy !m-[8px_2px_4px]`,children:A(`skills:skillsPage.noSkillPackagesAreConfiguredYetAfterYouInstallASkillItsSourceWillAppearHere`)})]}),inspector:(0,w.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[(0,w.jsxs)(y,{children:[(0,w.jsx)(g,{title:A(`skills:skillsPage.selectedSkill`)}),(0,w.jsx)(`h2`,{children:X?.name||A(`skills:skillsPage.noSkillAvailable`)}),(0,w.jsx)(`p`,{className:`muted-copy m-[8px_0_14px] text-[var(--text-secondary)] text-[12px] leading-[1.55]`,children:X?.description||A(`skills:skillsPage.addGlobalOrProjectSkill`)}),[[A(`skills:skillsPage.triggerMode`),X?.modelInvocationEnabled?A(`skills:skillsPage.automaticManual`):A(`skills:skillsPage.manualOnly`)],[A(`skills:skillsPage.permissions`),X?.allowedTools?.length?X.allowedTools.join(`, `):A(`skills:skillsPage.usesChatToolPermissions`)],[A(`skills:skillsPage.scope`),X?.sourceInfo?.scope===`project`?A(`skills:skillsPage.project`):A(`skills:skillsPage.global`)],[A(`skills:skillsPage.version`),X?.version||`latest`],[A(`skills:skillsPage.source`),X?.source||`—`]].map(e=>(0,w.jsxs)(`div`,{className:`key-value [&:first-of-type]:mt-[7px] [&_span]:text-[var(--text-muted)] [&_button]:flex [&_button]:items-center [&_button]:gap-[4px] [&_button]:border-0 [&_button]:bg-transparent [&_button]:text-[var(--text-soft)] [&_button]:text-[12px] [&_strong]:min-w-0 [&_strong]:overflow-hidden [&_strong]:text-[13px] [&_strong]:text-ellipsis [&_strong]:whitespace-nowrap flex min-h-[31px] items-center justify-between gap-[10px] [border-top:1px_solid_var(--stroke-soft)] text-[13px]`,children:[(0,w.jsx)(`span`,{children:e[0]}),(0,w.jsx)(`strong`,{children:e[1]})]},e[0])),(0,w.jsxs)(p,{variant:X?.removable?`destructive`:`default`,size:`lg`,className:`w-full`,disabled:L,onClick:X?.removable?re:ne,children:[X?.removable?(0,w.jsx)(u,{size:14}):(0,w.jsx)(c,{size:14}),X?.removable?A(`skills:skillsPage.uninstallSkill`):A(`skills:skillsPage.saveSettings`)]})]}),(0,w.jsxs)(y,{children:[(0,w.jsx)(g,{title:A(`skills:skillsPage.triggerConditions`)}),[[A(`skills:skillsPage.allowAutomaticModelInvocation`),!!X?.modelInvocationEnabled,!1,e=>void Q(X,{modelInvocationEnabled:e})],[A(`skills:skillsPage.supportManualSkillCommand`),!!X?.command,!0],[A(`skills:skillsPage.projectScopedSkill`),X?.sourceInfo?.scope===`project`,!0],[A(`skills:skillsPage.declaresRequiredTools`),!!X?.allowedTools?.length,!0]].map(([e,t,n,r])=>(0,w.jsxs)(`label`,{className:`check-row [&_input]:[accent-color:var(--star-strong)] flex items-center gap-[7px] [border-top:1px_solid_var(--stroke-soft)] [padding:8px_2px] text-[12px]`,children:[(0,w.jsx)(`input`,{type:`checkbox`,checked:t,disabled:!X||L||n,onChange:e=>r?.(e.target.checked)}),(0,w.jsx)(`span`,{children:e})]},e))]})]})})})]})})})}export{A as SkillsPage};
|
|
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-BrWBoyFl.js";import{t as i}from"./createLucideIcon-Cd-3GVxJ.js";import{t as a}from"./file-code-corner-BnE1ljT0.js";import{t as o}from"./image-BY_c3FYU.js";import{t as s}from"./refresh-cw-TbWxTY4K.js";import{t as c}from"./save-CHBB52P8.js";import{t as l}from"./sparkles-S_eeuqn9.js";import{t as u}from"./trash-2-CNrPOoPR.js";import{t as d}from"./wrench-6pg6_bqI.js";import{t as f}from"./api-CiEo53J1.js";import{t as p}from"./button-BcPDt1Ge.js";import{c as m,l as h,n as ee,o as g,r as _,s as v,t as y}from"./app-primitives-DhqJLud3.js";import{t as b}from"./PageFrame-BiJUCJku.js";import{t as x}from"./usePagePrimaryAction-CWPC0C_f.js";import{t as te}from"./ListDetailLayout-Ctr6r0OI.js";var S=i(`package`,[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]),C=e(t(),1),w=n(),T=[`all`,`global`,`project`,`design`,`code`,`docs`,`privileged`];function E(e,t=``){return t?`${e}${e.includes(`?`)?`&`:`?`}sessionId=${encodeURIComponent(t)}`:e}function D(e,t){return t(e===`global`?`skills:skillsPage.global`:e===`project`?`skills:skillsPage.project`:e===`design`?`skills:skillsPage.design`:e===`code`?`skills:skillsPage.code`:e===`docs`?`skills:skillsPage.documents`:e===`privileged`?`skills:skillsPage.highPrivilege`:`skills:skillsPage.all`)}function O(e){let t=`${e?.name||``} ${e?.description||``}`.toLowerCase();return/image|visual|design|figma|svg|图片|视觉|设计/.test(t)?o:/doc|pdf|文档|说明/.test(t)?a:/install|package|market|安装|包/.test(t)?S:/code|test|plugin|skill|代码|测试|插件|技能/.test(t)?d:l}function k(e,t){if(t===`all`)return!0;if(t===`global`)return e.sourceInfo?.scope!==`project`;if(t===`project`)return e.sourceInfo?.scope===`project`;let n=`${e.name} ${e.description} ${(e.allowedTools||[]).join(` `)}`.toLowerCase();return t===`design`?/image|visual|design|figma|svg|图片|视觉|设计/.test(n):t===`code`?/code|test|plugin|代码|测试|插件/.test(n):t===`docs`?/doc|pdf|文档|说明/.test(n):t!==`privileged`||(e.allowedTools||[]).some(e=>[`bash`,`write`,`edit`].includes(e))}function A({notify:e,query:t=``,activeSessionId:n=``,registerPrimaryAction:i,requestText:a,requestConfirm:o}){let[l,d]=(0,C.useState)(!1),{t:A}=r(),[j,M]=(0,C.useState)(null),[N,P]=(0,C.useState)(``),[F,I]=(0,C.useState)(`all`),[L,R]=(0,C.useState)(!1),[z,B]=(0,C.useState)(!0),[,V]=(0,C.useState)(``),H=(0,C.useCallback)(async()=>{V(``);try{let e=await f(E(`/api/skills`,n));return M(e),P(t=>e.skills.some(e=>e.id===t)?t:e.skills[0]?.id||``),e}catch(e){return V(e instanceof Error?e.message:String(e)),null}finally{B(!1)}},[n]);(0,C.useEffect)(()=>{H()},[H]);let U=(0,C.useCallback)(async()=>{let t=await a?.({title:A(`skills:skillsPage.importGlobalSkill`),message:A(`skills:skillsPage.globalSkillSourceHelp`),inputLabel:A(`skills:skillsPage.skillSource`),placeholder:`E:\\path\\to\\skill, npm:@scope/package, or https://github.com/...`,maxLength:2e3,confirmLabel:A(`skills:skillsPage.continue`)});if(t?.trim()&&await o?.({title:A(`skills:skillsPage.importGlobalSkill`),message:A(`skills:skillsPage.skillsProvideInstructionsToTheAgentAndMayIncludeExecutableScriptsConfirmThatYouTrustTheSource`),confirmLabel:A(`skills:skillsPage.import`),tone:`danger`})!==!1){R(!0),V(``);try{let r=await f(E(`/api/skills/install`,n),{method:`POST`,body:JSON.stringify({source:t})});M(r),P(r.installed?.[0]?.id||r.skills[0]?.id||``),e(A(`skills:skillsPage.skillInstalledAndLoadedIntoTheAgentRuntime`),`success`)}catch(t){let n=t instanceof Error?t.message:String(t);V(n),e(n,`error`)}finally{R(!1)}}},[n,e,o,a,A]);if(x(i,U),z&&!j)return(0,w.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3`,children:(0,w.jsxs)(_,{children:[(0,w.jsx)(s,{className:`animate-spin`,size:23}),(0,w.jsx)(`h2`,{children:A(`skills:skillsPage.loadingSkills`)}),(0,w.jsx)(`p`,{children:A(`skills:skillsPage.scanningSkillDirectoriesAndConfiguredPackages`)})]})});let W=j?.skills||[],G=W.filter(e=>k(e,F)&&`${e.name} ${e.description}`.toLowerCase().includes(t.toLowerCase())),K=W.filter(e=>e.sourceInfo?.scope!==`project`),q=W.filter(e=>e.sourceInfo?.scope===`project`),J=G.filter(e=>e.sourceInfo?.scope!==`project`),Y=G.filter(e=>e.sourceInfo?.scope===`project`),X=W.find(e=>e.id===N)||G[0]||W[0]||null,Z=(j?.packages||[]).map(e=>({source:e.source,description:e.scope===`project`?A(`skills:skillsPage.projectScopedConfiguration`):A(`skills:skillsPage.userScopedConfiguration`),status:e.installed?A(`skills:skillsPage.locallyReady`):A(`skills:skillsPage.notMaterialized`),tone:e.installed?`green`:`gray`})).filter(e=>`${e.source} ${e.description}`.toLowerCase().includes(t.toLowerCase())),Q=async(e,t)=>{if(e){R(!0),V(``);try{let r=await f(E(`/api/skills/${encodeURIComponent(e.id)}`,n),{method:`PATCH`,body:JSON.stringify(t)});M(e=>{if(!e)return e;let t=e.skills.map(e=>e.id===r.id?r:e);return{...e,skills:t,counts:{...e.counts,enabled:t.filter(e=>e.enabled).length,modelInvocable:t.filter(e=>e.enabled&&e.modelInvocationEnabled).length}}})}catch(e){V(e instanceof Error?e.message:String(e))}finally{R(!1)}}},ne=async()=>{R(!0),V(``);try{M(await f(E(`/api/skills/reload`,n),{method:`POST`,body:`{}`})),e(A(`skills:skillsPage.skillSettingsSavedAndReloaded`),`success`)}catch(e){V(e instanceof Error?e.message:String(e))}finally{R(!1)}},re=async()=>{if(X?.removable&&await o?.({title:A(`skills:skillsPage.uninstallSkill`),message:A(`skills:skillsPage.thisRemovesTheSkillDirectoryInstalledByPisperItDoesNotUninstallTheOriginalNpmOrGitPackage`),confirmLabel:A(`skills:skillsPage.uninstall`),tone:`danger`})!==!1){R(!0),V(``);try{await f(E(`/api/skills/${encodeURIComponent(X.id)}`,n),{method:`DELETE`});let t=await H();P(t?.skills[0]?.id||``),e(A(`skills:skillsPage.skillUninstalled`),`success`)}catch(t){let n=t instanceof Error?t.message:String(t);V(n),e(n,`error`)}finally{R(!1)}}},$=(e,t,n,r,i=``)=>(0,w.jsxs)(`section`,{className:`skill-scope [.skill-scope_+_&]:[border-top:1px_solid_var(--stroke)] [.skill-scope_+_&]:pt-[14px]`,children:[(0,w.jsxs)(`div`,{className:`skill-scope-head [&_>_div]:min-w-0 [&_small]:block [&_small]:overflow-hidden [&_small]:text-[var(--text-muted)] [&_small]:font-[ui-monospace,_SFMono-Regular,_Consolas,_'Liberation_Mono',_monospace] [&_small]:text-[11px] [&_small]:text-ellipsis [&_small]:whitespace-nowrap [&_>_span]:min-w-[24px] [&_>_span]:text-[var(--text-secondary)] [&_>_span]:text-[12px] [&_>_span]:font-[600] [&_>_span]:text-right flex min-w-0 items-start justify-between gap-[10px]`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(g,{title:e,className:`mb-0.5`}),i&&(0,w.jsx)(`small`,{title:i,children:i})]}),(0,w.jsx)(`span`,{children:t.length})]}),t.length?t.map(e=>{let t=O(e);return(0,w.jsxs)(`div`,{className:`skill-row grid w-full grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-[9px] border-0 [border-top:1px_solid_var(--stroke-soft)] bg-transparent p-[10px_8px] text-left hover:rounded-[var(--r-sm)] hover:bg-[var(--accent-soft)] [&.selected]:rounded-[var(--r-sm)] [&.selected]:bg-[var(--accent-soft)] [&_>_span:nth-child(2)]:flex [&_>_span:nth-child(2)]:flex-col [&_>_span:nth-child(2)]:gap-[3px] [&_strong]:text-[13px] [&_small]:text-[var(--text-muted)] [&_small]:text-[13px] grid-cols-[minmax(0,1fr)_auto] [padding-block:4px] ${X?.id===e.id?`selected`:``}`,children:[(0,w.jsxs)(`button`,{className:`skill-row-main [&_>_span:nth-child(2)]:flex [&_>_span:nth-child(2)]:min-w-0 [&_>_span:nth-child(2)]:flex-col [&_>_span:nth-child(2)]:gap-[3px] grid min-w-0 grid-cols-[auto_minmax(0,1fr)] items-center gap-[9px] border-0 bg-transparent [padding:6px_4px] text-left`,onClick:()=>{d(!0),P(e.id)},children:[(0,w.jsx)(`span`,{className:`list-icon [.chat-resource-list_&]:grid [.chat-resource-list_&]:w-[28px] [.chat-resource-list_&]:h-[28px] [.chat-resource-list_&]:place-items-center [.chat-resource-list_&]:rounded-[var(--r-sm)] [.chat-resource-list_&]:bg-[var(--surface-subtle)] [.chat-resource-list_&]:text-[var(--star-strong)] [.session-workflow-summary_&]:grid [.session-workflow-summary_&]:w-[28px] [.session-workflow-summary_&]:h-[28px] [.session-workflow-summary_&]:place-items-center [.session-workflow-summary_&]:rounded-[var(--r-sm)] [.session-workflow-summary_&]:bg-[var(--surface-subtle)] [.session-workflow-summary_&]:text-[var(--star-strong)] grid w-[27px] h-[27px] place-items-center rounded-[var(--r-sm)] bg-[var(--accent-soft)] text-[var(--star-strong)] [.workflow-template-gallery_&]:grid [.workflow-template-gallery_&]:w-[32px] [.workflow-template-gallery_&]:h-[32px] [.workflow-template-gallery_&]:place-items-center [.workflow-template-gallery_&]:rounded-[var(--r-sm)] [.workflow-template-gallery_&]:bg-[var(--surface-subtle)] [.workflow-template-gallery_&]:text-[var(--star-strong)]`,children:(0,w.jsx)(t,{size:15})}),(0,w.jsxs)(`span`,{children:[(0,w.jsx)(`strong`,{children:e.name}),(0,w.jsx)(`small`,{className:`line-clamp-2`,title:e.description,children:e.description})]})]}),(0,w.jsx)(v,{value:e.enabled,disabled:L,ariaLabel:A(`skills:skillsPage.toggleSkillName`,{name:e.name}),onChange:t=>void Q(e,{enabled:t})})]},e.id)}):(0,w.jsx)(`p`,{className:`muted-copy m-[8px_0_14px] text-[var(--text-secondary)] text-[12px] leading-[1.55] skills-empty-copy !m-[8px_2px_4px]`,children:n.length?A(`skills:skillsPage.noSkillsMatchTheCurrentFilter`):r})]});return(0,w.jsx)(b,{variant:`list-detail`,children:(0,w.jsx)(`div`,{className:`flex h-full min-h-0 flex-col gap-3`,children:(0,w.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3`,children:[(0,w.jsx)(m,{options:T.map(e=>D(e,A)),value:D(F,A),onChange:e=>I(T.find(t=>D(t,A)===e)||`all`)}),(0,w.jsx)(w.Fragment,{children:(0,w.jsx)(te,{selected:l,onBack:()=>d(!1),backLabel:A(`common:pageTemplate.backToList`),list:(0,w.jsxs)(y,{className:`min-w-0 border-0 bg-transparent p-0 shadow-none`,children:[(0,w.jsx)(p,{variant:`outline`,className:`mb-3 w-full @min-[760px]/list-detail:hidden`,onClick:()=>d(!0),children:A(`skills:skillsPage.configuredSkillPackages`)}),F!==`project`&&$(A(`skills:skillsPage.globalSkills`),J,K,A(`skills:skillsPage.noGlobalSkills`),j?.locations?.global||`~/.pisper/agent/skills`),F!==`global`&&$(A(`skills:skillsPage.projectSkills`),Y,q,A(`skills:skillsPage.noProjectSkills`),j?.locations?.project||(j?.cwd?`${j.cwd.replace(/[\\/]$/,``)}/.pisper/skills`:``))]}),detail:(0,w.jsxs)(y,{children:[(0,w.jsxs)(ee,{children:[(0,w.jsx)(g,{title:A(`skills:skillsPage.configuredSkillPackages`)}),(0,w.jsx)(`span`,{className:`text-[var(--text-secondary)] text-[12px] font-[600]`,children:A(`skills:skillsPage.countSkillPackages`,{count:Z.length})})]}),Z.length?Z.map(e=>(0,w.jsxs)(`div`,{className:`market-row [&_>_span:nth-child(2)]:flex [&_>_span:nth-child(2)]:flex-col [&_>_span:nth-child(2)]:gap-[3px] [&_strong]:text-[13px] [&_small]:text-[var(--text-muted)] [&_small]:text-[13px] [&_strong]:overflow-hidden [&_strong]:text-ellipsis [&_strong]:whitespace-nowrap grid min-h-[48px] grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-[8px] [border-top:1px_solid_var(--stroke-soft)] [padding:6px_2px]`,children:[(0,w.jsx)(`span`,{className:`list-icon [.chat-resource-list_&]:grid [.chat-resource-list_&]:w-[28px] [.chat-resource-list_&]:h-[28px] [.chat-resource-list_&]:place-items-center [.chat-resource-list_&]:rounded-[var(--r-sm)] [.chat-resource-list_&]:bg-[var(--surface-subtle)] [.chat-resource-list_&]:text-[var(--star-strong)] [.session-workflow-summary_&]:grid [.session-workflow-summary_&]:w-[28px] [.session-workflow-summary_&]:h-[28px] [.session-workflow-summary_&]:place-items-center [.session-workflow-summary_&]:rounded-[var(--r-sm)] [.session-workflow-summary_&]:bg-[var(--surface-subtle)] [.session-workflow-summary_&]:text-[var(--star-strong)] grid w-[27px] h-[27px] place-items-center rounded-[var(--r-sm)] bg-[var(--accent-soft)] text-[var(--star-strong)] [.workflow-template-gallery_&]:grid [.workflow-template-gallery_&]:w-[32px] [.workflow-template-gallery_&]:h-[32px] [.workflow-template-gallery_&]:place-items-center [.workflow-template-gallery_&]:rounded-[var(--r-sm)] [.workflow-template-gallery_&]:bg-[var(--surface-subtle)] [.workflow-template-gallery_&]:text-[var(--star-strong)]`,children:(0,w.jsx)(S,{size:15})}),(0,w.jsxs)(`span`,{children:[(0,w.jsx)(`strong`,{title:e.source,children:e.source}),(0,w.jsx)(`small`,{children:e.description})]}),(0,w.jsx)(h,{tone:e.tone,children:e.status})]},e.source)):(0,w.jsx)(`p`,{className:`muted-copy m-[8px_0_14px] text-[var(--text-secondary)] text-[12px] leading-[1.55] skills-empty-copy !m-[8px_2px_4px]`,children:A(`skills:skillsPage.noSkillPackagesAreConfiguredYetAfterYouInstallASkillItsSourceWillAppearHere`)})]}),inspector:(0,w.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[(0,w.jsxs)(y,{children:[(0,w.jsx)(g,{title:A(`skills:skillsPage.selectedSkill`)}),(0,w.jsx)(`h2`,{children:X?.name||A(`skills:skillsPage.noSkillAvailable`)}),(0,w.jsx)(`p`,{className:`muted-copy m-[8px_0_14px] text-[var(--text-secondary)] text-[12px] leading-[1.55]`,children:X?.description||A(`skills:skillsPage.addGlobalOrProjectSkill`)}),[[A(`skills:skillsPage.triggerMode`),X?.modelInvocationEnabled?A(`skills:skillsPage.automaticManual`):A(`skills:skillsPage.manualOnly`)],[A(`skills:skillsPage.permissions`),X?.allowedTools?.length?X.allowedTools.join(`, `):A(`skills:skillsPage.usesChatToolPermissions`)],[A(`skills:skillsPage.scope`),X?.sourceInfo?.scope===`project`?A(`skills:skillsPage.project`):A(`skills:skillsPage.global`)],[A(`skills:skillsPage.version`),X?.version||`latest`],[A(`skills:skillsPage.source`),X?.source||`—`]].map(e=>(0,w.jsxs)(`div`,{className:`key-value [&:first-of-type]:mt-[7px] [&_span]:text-[var(--text-muted)] [&_button]:flex [&_button]:items-center [&_button]:gap-[4px] [&_button]:border-0 [&_button]:bg-transparent [&_button]:text-[var(--text-soft)] [&_button]:text-[12px] [&_strong]:min-w-0 [&_strong]:overflow-hidden [&_strong]:text-[13px] [&_strong]:text-ellipsis [&_strong]:whitespace-nowrap flex min-h-[31px] items-center justify-between gap-[10px] [border-top:1px_solid_var(--stroke-soft)] text-[13px]`,children:[(0,w.jsx)(`span`,{children:e[0]}),(0,w.jsx)(`strong`,{children:e[1]})]},e[0])),(0,w.jsxs)(p,{variant:X?.removable?`destructive`:`default`,size:`lg`,className:`w-full`,disabled:L,onClick:X?.removable?re:ne,children:[X?.removable?(0,w.jsx)(u,{size:14}):(0,w.jsx)(c,{size:14}),X?.removable?A(`skills:skillsPage.uninstallSkill`):A(`skills:skillsPage.saveSettings`)]})]}),(0,w.jsxs)(y,{children:[(0,w.jsx)(g,{title:A(`skills:skillsPage.triggerConditions`)}),[[A(`skills:skillsPage.allowAutomaticModelInvocation`),!!X?.modelInvocationEnabled,!1,e=>void Q(X,{modelInvocationEnabled:e})],[A(`skills:skillsPage.supportManualSkillCommand`),!!X?.command,!0],[A(`skills:skillsPage.projectScopedSkill`),X?.sourceInfo?.scope===`project`,!0],[A(`skills:skillsPage.declaresRequiredTools`),!!X?.allowedTools?.length,!0]].map(([e,t,n,r])=>(0,w.jsxs)(`label`,{className:`check-row [&_input]:[accent-color:var(--star-strong)] flex items-center gap-[7px] [border-top:1px_solid_var(--stroke-soft)] [padding:8px_2px] text-[12px]`,children:[(0,w.jsx)(`input`,{type:`checkbox`,checked:t,disabled:!X||L||n,onChange:e=>r?.(e.target.checked)}),(0,w.jsx)(`span`,{children:e})]},e))]})]})})})]})})})}export{A as SkillsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-
|
|
1
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-BrWBoyFl.js";import{t as i}from"./chevron-right-C3t2Rckj.js";import{t as a}from"./square-terminal-BVG6cUT1.js";import{t as o}from"./square-bHHVTT3G.js";import{t as s}from"./button-BcPDt1Ge.js";import{n as c,r as l}from"./terminal-context-aIsIJPn8.js";import{t as u}from"./PageState-CzlR-lkL.js";var d=e(t(),1),f=n();function p({record:e,follow:t,initialTop:n,onFollow:i,onScroll:a}){let{t:o}=r(),s=(0,d.useRef)(null),c=(0,d.useRef)(n);return(0,d.useLayoutEffect)(()=>{s.current&&(s.current.scrollTop=c.current)},[]),(0,d.useLayoutEffect)(()=>{t&&s.current&&(s.current.scrollTop=s.current.scrollHeight)},[e.output,t]),(0,f.jsxs)(`div`,{className:`border-t border-border p-3`,children:[(0,f.jsxs)(`label`,{className:`mb-2 flex items-center gap-2 text-xs text-content-muted`,children:[(0,f.jsx)(`input`,{type:`checkbox`,checked:t,onChange:e=>i(e.target.checked)}),o(`terminal:workspace.follow`)]}),e.truncated&&(0,f.jsx)(`p`,{className:`mb-2 text-xs text-content-muted`,children:o(`terminal:workspace.truncated`)}),(0,f.jsx)(`pre`,{ref:s,tabIndex:0,onWheel:e=>{e.deltaY<0&&i(!1)},onScroll:e=>{let t=e.currentTarget;t.scrollTop+t.clientHeight<t.scrollHeight-4&&i(!1),a(t.scrollTop)},className:`max-h-80 overflow-auto whitespace-pre-wrap break-all rounded-md bg-surface-subtle p-3 font-mono text-xs`,children:e.output||o(`terminal:workspace.noOutput`)})]})}function m({sessionId:e,onOpenTerminal:t,view:n,onViewChange:m}){let{t:h}=r(),g=c(),_=l(e),v=n.filter||`all`,y=new Set(n.expandedProcesses),[b,x]=(0,d.useState)(``);if(!g)return(0,f.jsx)(u,{kind:`empty`,title:h(`terminal:workspace.unavailable`),description:h(`terminal:workspace.nativeOnly`)});let S={starting:h(`terminal:workspace.starting`),running:h(`terminal:workspace.running`),stopping:h(`terminal:workspace.stopping`),exited:h(`terminal:workspace.exited`),error:h(`terminal:workspace.error`)},C=_.filter(e=>v===`all`||e.status===v);return(0,f.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col`,children:[(0,f.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-3 border-b border-border p-3`,children:[(0,f.jsx)(`span`,{className:`flex-1 text-xs text-content-muted`,children:h(`terminal:workspace.ownedProcesses`)}),(0,f.jsxs)(`select`,{"aria-label":h(`terminal:workspace.filter`),value:v,onChange:e=>m({filter:e.target.value}),className:`rounded-md border border-border bg-background px-2 py-1 text-sm`,children:[(0,f.jsx)(`option`,{value:`all`,children:h(`terminal:workspace.all`)}),Object.entries(S).map(([e,t])=>(0,f.jsx)(`option`,{value:e,children:t},e))]})]}),b&&(0,f.jsx)(`p`,{role:`alert`,className:`p-3 text-sm text-danger`,children:b}),(0,f.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-3`,children:C.length?C.map(e=>(0,f.jsxs)(`article`,{className:`mb-2 overflow-hidden rounded-lg border border-border`,children:[(0,f.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 p-2`,children:[(0,f.jsx)(s,{variant:`ghost`,size:`icon`,"aria-expanded":y.has(e.id),"aria-label":h(`terminal:workspace.logs`),onClick:()=>m({expandedProcesses:y.has(e.id)?n.expandedProcesses.filter(t=>t!==e.id):[...n.expandedProcesses,e.id]}),children:(0,f.jsx)(i,{className:y.has(e.id)?`rotate-90`:``})}),(0,f.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,f.jsx)(`strong`,{className:`block truncate text-sm font-medium`,children:e.profileId}),(0,f.jsx)(`span`,{className:`block truncate text-xs text-content-muted`,title:e.cwd,children:e.cwd})]}),(0,f.jsx)(`span`,{className:`text-xs text-content-muted`,children:S[e.status]||h(`terminal:workspace.unknown`)}),(0,f.jsx)(s,{variant:`ghost`,size:`icon`,"aria-label":h(`terminal:workspace.open`),onClick:()=>t(e.id),children:(0,f.jsx)(a,{})}),e.status!==`exited`&&(0,f.jsx)(s,{variant:`ghost`,size:`icon`,disabled:e.status===`stopping`,"aria-label":h(`terminal:workspace.stop`),onClick:()=>{x(``),g.registry.stop(e.id).catch(e=>x(String(e)))},children:(0,f.jsx)(o,{className:`size-4`})})]}),e.error&&(0,f.jsx)(`p`,{className:`px-3 pb-2 text-xs text-danger`,children:e.error}),y.has(e.id)&&(0,f.jsx)(p,{record:e,follow:n.processFollow[e.id]!==!1,initialTop:n.processScroll[e.id]||0,onFollow:t=>m({processFollow:{...n.processFollow,[e.id]:t}}),onScroll:t=>m({processScroll:{...n.processScroll,[e.id]:t}})})]},e.id)):(0,f.jsx)(u,{kind:`empty`,title:_.length?h(`terminal:workspace.noMatch`):h(`terminal:workspace.noProcesses`)})})]})}export{m as TaskProcessesPane};
|