pisper 0.6.28 → 0.6.29
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 +6 -6
- package/web/.vite/manifest.json +654 -641
- package/web/assets/{AppDialog-Cjnspn8J.js → AppDialog-CX0n4qav.js} +1 -1
- package/web/assets/{AppOverlays-ielr5J2J.js → AppOverlays-J_rOhlw3.js} +1 -1
- package/web/assets/{AssetsPage-BC1mYvQw.js → AssetsPage-BuAZJf2M.js} +1 -1
- package/web/assets/{BoardPage-BS3oBeRU.js → BoardPage-BT684h8Y.js} +3 -3
- package/web/assets/{ChannelsPage-DOysYIcY.js → ChannelsPage-CznKEDyh.js} +1 -1
- package/web/assets/{ChatAppearancePage-DqNJD2hC.js → ChatAppearancePage-BrZ30LfD.js} +1 -1
- package/web/assets/{ChatHistoryPage-DcTFMdWO.js → ChatHistoryPage-BEJbiMs3.js} +1 -1
- package/web/assets/{ChatPage-DaKslieG.js → ChatPage-CCL8A95i.js} +3 -3
- package/web/assets/{ConfigPage-Cg93xSDY.js → ConfigPage-_YQZcZlC.js} +2 -2
- package/web/assets/{DesktopWindowControls-Zz88RwFF.js → DesktopWindowControls-C-LzcrLu.js} +1 -1
- package/web/assets/{FeaturePage-bqByIxYg.js → FeaturePage-C4fMefC-.js} +1 -1
- package/web/assets/{FileAttachmentPreview-Dc92kq62.js → FileAttachmentPreview-DCdc0GFC.js} +1 -1
- package/web/assets/{FloatingWidgets-CwJuWUMz.js → FloatingWidgets-C5PMwmK1.js} +1 -1
- package/web/assets/{FocusRuntimeControls-huHLWDdy.js → FocusRuntimeControls-D6Rj2AHK.js} +1 -1
- package/web/assets/{GitDiffViewer-b4QqrnGx.js → GitDiffViewer-D2QUzasQ.js} +1 -1
- package/web/assets/{ManageProjectsDialog-DpwUwosB.js → ManageProjectsDialog-CCg0vZ07.js} +1 -1
- package/web/assets/{MarkdownMessage-BEmTlPSn.js → MarkdownMessage-DbPFHAG0.js} +1 -1
- package/web/assets/{McpPage-COTq4Jjj.js → McpPage-DAg9VlnU.js} +1 -1
- package/web/assets/{MemoryEvolution-CNi44VEB.js → MemoryEvolution-CVF6CYuV.js} +1 -1
- package/web/assets/{MemoryPage-fUDrPE_v.js → MemoryPage-C4C8Efhi.js} +2 -2
- package/web/assets/{MobileNavigation-BvCRGO5c.js → MobileNavigation-EsJOtmUl.js} +1 -1
- package/web/assets/{MorePage-BuKQ5rBF.js → MorePage-BslKLMFa.js} +1 -1
- package/web/assets/{NewFolderDialog-Btk5x-Ar.js → NewFolderDialog-Bb4T0UPO.js} +1 -1
- package/web/assets/{PageHeader-BjhZ50ed.js → PageHeader-DjJ0Ab6e.js} +1 -1
- package/web/assets/{PhoneDrawer-Cs-ka4ZZ.js → PhoneDrawer-Cu2FDUc1.js} +1 -1
- package/web/assets/{PhoneMenuButton-CTlyYTpl.js → PhoneMenuButton-C8pYulkt.js} +1 -1
- package/web/assets/{PhoneTopBar-Cx2DM1ne.js → PhoneTopBar-CvMWkksM.js} +1 -1
- package/web/assets/{PluginsPage-B9Xlbo-c.js → PluginsPage-DxjMMa05.js} +1 -1
- package/web/assets/{SafeModePrompt-BCrBZdI6.js → SafeModePrompt-DG64bady.js} +1 -1
- package/web/assets/{SchedulesPage-Eh7MyRAr.js → SchedulesPage-Bd0sjkiZ.js} +1 -1
- package/web/assets/{SessionBrowserPane-Zeec5cZP.js → SessionBrowserPane-CigWhKGU.js} +2 -2
- package/web/assets/{SessionContextPanel-CVKmX-do.js → SessionContextPanel-HfjETMcF.js} +2 -2
- package/web/assets/{SessionHome-CJR_Ufgl.js → SessionHome-DtzbkF19.js} +1 -1
- package/web/assets/{SessionInspector-D5tmy63H.js → SessionInspector-BZyFstFl.js} +1 -1
- package/web/assets/{SessionShell-w3sKK33I.js → SessionShell-BCIVsKr9.js} +1 -1
- package/web/assets/{SettingsSidebar-CseRAdbZ.js → SettingsSidebar-F20r1qhh.js} +1 -1
- package/web/assets/{ShortcutHelpDialog-R4Gx-9DQ.js → ShortcutHelpDialog-BSiv5k3S.js} +1 -1
- package/web/assets/{ShortcutKeys-DksC1OkE.js → ShortcutKeys-BWYkyL77.js} +1 -1
- package/web/assets/{SidebarUpdateStatus-BCd1eq_6.js → SidebarUpdateStatus-BA3cyY6N.js} +1 -1
- package/web/assets/{SkillsPage-Bn2y_EfT.js → SkillsPage-C6cF2A7j.js} +1 -1
- package/web/assets/{TaskProcessesPane-FwGhuWob.js → TaskProcessesPane-B6O5Mirv.js} +1 -1
- package/web/assets/{TaskTerminalView-Cd4PIsW7.js → TaskTerminalView-IR5bGXk7.js} +1 -1
- package/web/assets/{TerminalPanel-48zgvDnP.js → TerminalPanel-BAl1Ytmx.js} +1 -1
- package/web/assets/{WebDesktopPet-gSDBRZ3C.js → WebDesktopPet-CLjE98zM.js} +1 -1
- package/web/assets/{WorkflowsPage-Cs8PPuKK.js → WorkflowsPage-5kMzkdP5.js} +1 -1
- package/web/assets/{WorkspacePicker-93gmdtjf.js → WorkspacePicker-Dy3QRSbL.js} +1 -1
- package/web/assets/{api-AeFmYDtL.js → api-BhPOJ07B.js} +1 -1
- package/web/assets/app-update-DK-2lnli.js +34 -0
- package/web/assets/{approval-confirm-D-cfu-xY.js → approval-confirm-BiKVYJXn.js} +1 -1
- package/web/assets/{board-projects-CjfuDvHx.js → board-projects-BmfKMy9W.js} +1 -1
- package/web/assets/{bots-store-vErH7x9u.js → bots-store-sXgxSYjm.js} +1 -1
- package/web/assets/browser-notifications-CvHO-BlP.js +1 -0
- package/web/assets/{chat-api-CSAs7Y6E.js → chat-api-CdqM-TFw.js} +1 -1
- package/web/assets/{client-store-B5wZ2IWH.js → client-store-CkmBBzE5.js} +1 -1
- package/web/assets/{config-search-eh2zQyZD.js → config-search-DTHZrqfb.js} +1 -1
- package/web/assets/{desktop-hosts-BNXtrr7R.js → desktop-hosts-BzI81G6K.js} +1 -1
- package/web/assets/{dialog-BDNbY1pW.js → dialog-BVAtioHy.js} +1 -1
- package/web/assets/{event-stream-Dh7h5sXJ.js → event-stream-B9eeQcgA.js} +1 -1
- package/web/assets/{events-CuVwhRWu.js → events-CcKmvwE6.js} +1 -1
- package/web/assets/{focus-session-composer-bits-Dkc0qSzm.js → focus-session-composer-bits-BuYWKdXR.js} +1 -1
- package/web/assets/{folder-paths-BKS24lJ6.js → folder-paths-D8nYAh7q.js} +1 -1
- package/web/assets/{hosts-B_02vF1S.js → hosts-BRNTbndS.js} +1 -1
- package/web/assets/{http-Bp65Kb4t.js → http-CXQuFoDX.js} +1 -1
- package/web/assets/{http-response-PZN5QIRk.js → http-response-scdqC11Q.js} +1 -1
- package/web/assets/i18n-D5XUOwJ3.js +1 -0
- package/web/assets/{index-CiRnxTh1.js → index-at6jiRd2.js} +2 -2
- package/web/assets/{machine-messages-Y3INM-Uy.js → machine-messages-BhLpbeyp.js} +1 -1
- package/web/assets/{machines-api-08M8wQiu.js → machines-api-c4gyvYeB.js} +1 -1
- package/web/assets/{memory-api-DSpQSQ5N.js → memory-api-BZLLcIF1.js} +1 -1
- package/web/assets/mount-app-713eDAlJ.js +9 -0
- package/web/assets/notification-sound-synth-DIRfyEoK.js +1 -0
- package/web/assets/{permission-rules-api-D931wxo9.js → permission-rules-api-BoggV-So.js} +1 -1
- package/web/assets/{pick-system-directory-CaiscVfr.js → pick-system-directory-COxOQmRm.js} +1 -1
- package/web/assets/{placements-BERPVxJD.js → placements-CWg24KPB.js} +2 -2
- package/web/assets/{popover-BKgOyW2Z.js → popover-BKEwGK6p.js} +1 -1
- package/web/assets/{public-DrlrVRdl.js → public-CFmAK4C5.js} +1 -1
- package/web/assets/{public-D9GopZqN.js → public-Ds92tfxs.js} +2 -2
- package/web/assets/{public-CEKKZh7R.js → public-DyoA5qbn.js} +2 -2
- package/web/assets/{public-CwI1S0by.js → public-_SuCE3iR.js} +1 -1
- package/web/assets/{public-components-BX9oxLC6.js → public-components-CiFLJxlo.js} +1 -1
- package/web/assets/public-diff-ByaSqbeU.js +1 -0
- package/web/assets/public-events-BZoQRupR.js +1 -0
- package/web/assets/{public-flags-DaG3PoAy.js → public-flags-wwqdZl3u.js} +1 -1
- package/web/assets/{public-folder-dialog-_QoxpOd4.js → public-folder-dialog-MYvmKYka.js} +1 -1
- package/web/assets/{public-greeting-hvhJuZMw.js → public-greeting-DFC9u9sY.js} +1 -1
- package/web/assets/{public-session-DUzugr9Y.js → public-session-qSMh175y.js} +1 -1
- package/web/assets/{public-sidebar-QGIKY-SE.js → public-sidebar-WFoUZVnB.js} +1 -1
- package/web/assets/{runtime-capabilities-store-Bd3gWIM7.js → runtime-capabilities-store-D0EC-a9c.js} +1 -1
- package/web/assets/{safe-mode-instance-B7_JMLGQ.js → safe-mode-instance-Ct43-TDv.js} +1 -1
- package/web/assets/safe-mode-sentinel-BKPGGJEL.js +1 -0
- package/web/assets/{session-change-summary-api-BHpd8dcW.js → session-change-summary-api-CyghX14t.js} +1 -1
- package/web/assets/{session-home-BmAnhROp.js → session-home-DY7RkKbH.js} +1 -1
- package/web/assets/{session-inspector-store-DHEIlh_X.js → session-inspector-store-BocK0l86.js} +1 -1
- package/web/assets/{session-organization-api-D9hTSIh7.js → session-organization-api-CGRK7VMP.js} +1 -1
- package/web/assets/{session-scope-yI3Hi_8F.js → session-scope-DDZF_AQ6.js} +1 -1
- package/web/assets/{session-tree-actions-BhCOaiTd.js → session-tree-actions-g769G3qz.js} +1 -1
- package/web/assets/{session-tree-summary-BLv-bkYC.js → session-tree-summary-CqrRroey.js} +1 -1
- package/web/assets/{shortcuts-Dsd4mjfP.js → shortcuts-BsrTXPiU.js} +1 -1
- package/web/assets/{side-chat-context-scyCH7W7.js → side-chat-context-DNQ3tThq.js} +4 -4
- package/web/assets/{sidebar-BKgF_JcM.js → sidebar-R690QKPw.js} +1 -1
- package/web/assets/{sidebar-store-DHwAOBnN.js → sidebar-store-QvX0w7hQ.js} +1 -1
- package/web/assets/{speech-session-B7DFYRtL.js → speech-session-DnBIZldd.js} +1 -1
- package/web/assets/{startup-queries-BlA4Hayt.js → startup-queries-BpV9-ykp.js} +1 -1
- package/web/assets/{use-i18n-BVRhlQ1v.js → use-i18n-AM3jlRYR.js} +1 -1
- package/web/assets/{use-open-bot-DyXtOatN.js → use-open-bot-BDco631W.js} +1 -1
- package/web/assets/{use-studio-actions-DEeR_rS9.js → use-studio-actions-C7W6Soh6.js} +1 -1
- package/web/assets/{useCatalogProjects-BD5GyCxg.js → useCatalogProjects-DCT51aGo.js} +1 -1
- package/web/assets/{useMachines-CwX7YqNe.js → useMachines-BJtbuUVt.js} +1 -1
- package/web/assets/{useNewProjectPicker-COxPJj6n.js → useNewProjectPicker-B85EuCYh.js} +2 -2
- package/web/assets/{useNow-CfPk0uIz.js → useNow-BUhFR4QI.js} +1 -1
- package/web/assets/{usePhoneShell-BpuKJgci.js → usePhoneShell-CK9XBtgf.js} +1 -1
- package/web/assets/{useSessionListQuery-CURESPBn.js → useSessionListQuery-B4Xmcfwa.js} +1 -1
- package/web/assets/{useSessionRowActions-DoCwFh8w.js → useSessionRowActions-BMestf2F.js} +1 -1
- package/web/assets/{useSidebarModel-CY79-mYl.js → useSidebarModel-BDfzya9Z.js} +1 -1
- package/web/assets/{workspace-order-store-C-jYrC0l.js → workspace-order-store-C_t43Zgq.js} +1 -1
- package/web/index.html +1 -1
- package/web/assets/app-update-Cf9JJ7WK.js +0 -34
- package/web/assets/browser-notifications-DBS0oXqN.js +0 -1
- package/web/assets/i18n-D80GstlU.js +0 -1
- package/web/assets/mount-app-DRohHSG7.js +0 -9
- package/web/assets/public-diff-DpNMZ8NJ.js +0 -1
- package/web/assets/public-events-CLCgth5h.js +0 -1
- package/web/assets/safe-mode-sentinel-B_NPQ0qy.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-
|
|
1
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-AM3jlRYR.js";import{t as i}from"./runtime-capabilities-store-D0EC-a9c.js";import{t as a}from"./chevron-left-BAtyp3_6.js";import{t as o}from"./chevron-right-C3t2Rckj.js";import{r as s}from"./settings-navigation-C6_RpGgI.js";var c=e(t(),1),l=n(),u=`flex min-h-14 w-full min-w-0 items-center gap-3 px-4 text-left text-base text-content focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus active:bg-surface-hover`;function d({onNavigate:e,onOpenFeatures:t}){let{t:n}=r(),a=i(e=>e.capabilities),d=(0,c.useMemo)(()=>s(n,{capabilities:a}),[a,n]);return(0,l.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto bg-background`,children:[(0,l.jsx)(`h1`,{className:`sr-only`,children:n(`navigation:navigation.settings`)}),(0,l.jsx)(`nav`,{"aria-label":n(`config:settingsShell.settingsNavigation`),"data-mobile-navigation":`settings`,className:`mx-4 mt-2 overflow-hidden rounded-[14px] border border-stroke-soft bg-panel`,children:(0,l.jsx)(`ul`,{className:`m-0 list-none p-0 [&>li+li]:border-t [&>li+li]:border-stroke-soft`,children:d.map(t=>{let n=t.icon;return(0,l.jsx)(`li`,{children:(0,l.jsxs)(`button`,{type:`button`,"data-settings-section":t.section,className:u,onClick:()=>e(t.section),children:[(0,l.jsx)(n,{className:`size-[18px] flex-none text-content-secondary`,strokeWidth:1.75,"aria-hidden":`true`}),(0,l.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t.label}),(0,l.jsx)(o,{className:`size-4 flex-none text-content-faint`,"aria-hidden":`true`})]})},t.section)})})}),(0,l.jsx)(`button`,{type:`button`,"data-settings-features-hint":!0,className:`mx-4 mt-3 flex min-h-11 items-center rounded-[var(--r-md)] px-1 text-left text-sm text-content-muted focus-visible:outline-2 focus-visible:outline-focus active:text-content`,onClick:t,children:n(`config:settingsShell.featuresHint`)})]})}function f({onBack:e}){let{t}=r();return(0,l.jsx)(`div`,{className:`flex flex-none px-2 pt-1`,children:(0,l.jsxs)(`button`,{type:`button`,"data-settings-back":!0,className:`flex h-11 items-center gap-0.5 rounded-[var(--r-md)] pr-3 pl-1 text-sm text-content-secondary focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus active:bg-surface-hover`,onClick:e,children:[(0,l.jsx)(a,{className:`size-5`,"aria-hidden":`true`}),t(`navigation:navigation.settings`)]})})}export{f as MobileSettingsBack,d as MobileSettingsList};
|
|
@@ -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-BVRhlQ1v.js";import{t as i}from"./useQuery-DfOU-27z.js";import{t as a}from"./http-response-PZN5QIRk.js";import{n as o}from"./http-Bp65Kb4t.js";import{a as s,n as c,t as l}from"./runtime-capabilities-B7qveLBm.js";import{t as u}from"./runtime-capabilities-store-Bd3gWIM7.js";import{m as d}from"./placements-BERPVxJD.js";import{t as ee}from"./client-store-B5wZ2IWH.js";import{t as f}from"./usePhoneShell-BpuKJgci.js";import{t as p}from"./createLucideIcon-Cd-3GVxJ.js";import{t as m}from"./app-window-CPNdvYNt.js";import{t as h}from"./blocks-Olsdp5Lp.js";import{t as g}from"./bot-B3TaBp_T.js";import{t as _}from"./brain-qxhnKqYP.js";import{t as v}from"./calendar-clock-VIxTaqqy.js";import{t as y}from"./chevron-right-C3t2Rckj.js";import{t as b}from"./image-BY_c3FYU.js";import{t as x}from"./monitor-smartphone-B1gIjItA.js";import{t as S}from"./plug-BsIeHRwC.js";import{t as C}from"./plus-fQbSqB1n.js";import{t as w}from"./radio-tower-jGQwrFWB.js";import{t as T}from"./rotate-ccw-clock-CO6Bw-sF.js";import{t as E}from"./search-D0mqDaf_.js";import{t as te}from"./server-BgNvmqwJ.js";import{t as ne}from"./sparkles-S_eeuqn9.js";import{t as re}from"./workflow-Bg94dy8I.js";import{t as D}from"./x-07u4-129.js";import{t as O}from"./brand-DIEc3fK8.js";import{i as k}from"./more-pages-D_PnxLN0.js";import{t as A}from"./utils-C8uzG5AZ.js";import{t as j}from"./button-CCcCN8tE.js";import{t as M}from"./kbd-CAufZTkl.js";import{g as ie}from"./events-CuVwhRWu.js";import{n as N,r as P}from"./config-search-eh2zQyZD.js";import{s as F}from"./shortcuts-Dsd4mjfP.js";var I=p(`command`,[[`path`,{d:`M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3`,key:`11bfej`}]]),L=e(t(),1),R=`add:component`;function z(e,{capabilities:t=l,mobileApp:n=!1,components:r=[]}={}){let i=(e,n,r,i)=>s(t,e)?{key:`page:${e}`,label:n,description:r,icon:i,destination:{type:`page`,id:e}}:null,a=e=>c(t,e,{mobileApp:n}),o=a(`remote-access`),u=a(`desktop-pet`),d=[a(`mobile-server`).supported?{key:`config:mobile-server`,label:e(`config:configPage.mobileServer`),description:e(`navigation:more.mobileServerHint`),icon:x,destination:{type:`config`,id:`mobile-server`}}:o.supported?{key:`config:remote-access`,label:e(`config:configPage.remoteAccess`),description:e(`navigation:more.remoteAccessHint`),icon:x,destination:{type:`config`,id:`remote-access`}}:null,u.supported||u.reason===`desktop-only`?{key:`config:desktop-pet`,label:e(`config:configPage.desktopPet`),description:e(`navigation:more.desktopPetHint`),icon:g,destination:{type:`config`,id:`desktop-pet`},...u.supported?{}:{disabledReason:e(`navigation:more.desktopOnly`)}}:null];return[{id:`sessions`,label:e(`navigation:more.groupSessions`),tiles:[i(`chatHistory`,e(`navigation:navigation.chatHistory`),e(`navigation:more.chatHistoryHint`),T),i(`assets`,e(`navigation:navigation.assets`),e(`navigation:more.assetsHint`),b),i(`memory`,e(`navigation:navigation.memory`),e(`navigation:more.memoryHint`),_)]},{id:`automation`,label:e(`navigation:more.groupAutomation`),tiles:[i(`workflows`,e(`navigation:navigation.workflows`),e(`navigation:more.workflowsHint`),re),i(`schedules`,e(`navigation:navigation.schedules`),e(`navigation:more.schedulesHint`),v),i(`channels`,e(`navigation:navigation.channels`),e(`navigation:more.channelsHint`),w)]},{id:`extensions`,label:e(`navigation:more.groupExtensions`),tiles:[i(`plugins`,e(`navigation:navigation.plugins`),e(`navigation:more.pluginsHint`),S),i(`skills`,e(`navigation:navigation.skills`),e(`navigation:more.skillsHint`),ne),i(`mcp`,e(`navigation:navigation.mcp`),e(`navigation:more.mcpHint`),te),{key:`page:components`,label:e(`navigation:shell.components`),description:e(`navigation:more.componentStudioHint`),icon:h,destination:{type:`page`,id:`components`}}]},{id:`devices`,label:e(`navigation:more.groupDevices`),tiles:d},{id:`components`,label:e(`navigation:more.groupComponents`),tiles:[...r.map(t=>({key:`component:${t.id}`,label:t.name,description:t.description||e(`navigation:more.componentHint`),icon:m,destination:{type:`component`,id:t.id}})),{key:R,label:e(`navigation:more.addComponent`),description:e(`navigation:more.addComponentHint`),icon:C,destination:{type:`page`,id:`components`}}]}].map(e=>({id:e.id,label:e.label,tiles:e.tiles.filter(e=>e!==null)})).filter(e=>e.tiles.length>0)}function B(e,t,n){let r=t.trim().toLocaleLowerCase(n);return r?e.map(e=>({...e,tiles:e.tiles.filter(t=>[t.label,t.description,e.label].some(e=>e.toLocaleLowerCase(n).includes(r)))})).filter(e=>e.tiles.length>0):[...e]}var V=new Set([`connected`,`connecting`,`reconnecting`]);function H(e){let t=e&&typeof e==`object`?e.connections:null;if(!t||typeof t!=`object`||Array.isArray(t))throw a();let n=0;for(let e of Object.values(t)){if(!e||typeof e!=`object`)continue;let{enabled:t,status:r}=e;t!==!1&&(typeof r!=`string`||!V.has(r))&&(n+=1)}return n}function U(e){return o(`/api/channels`,{signal:e,parse:H})}function W(e){let t=e&&typeof e==`object`?e.metrics:null,n=t&&typeof t==`object`?t.onlineServices:void 0;if(typeof n!=`number`||!Number.isFinite(n)||n<0)throw a();return Math.floor(n)}function G(e){return o(`/api/mcp?refresh=0`,{signal:e,parse:W})}function K(e){let t=e&&typeof e==`object`?e.tasks:null;if(!Array.isArray(t))throw a();return t.filter(e=>e&&typeof e==`object`&&e.enabled===!0).length}function q(e){return o(`/api/schedules`,{signal:e,parse:K})}function J(e){let t=e&&typeof e==`object`?e.limits:null,n=t&&typeof t==`object`?t.running:void 0;if(typeof n!=`number`||!Number.isFinite(n)||n<0)throw a();return Math.floor(n)}function ae(e){return o(`/api/workflows`,{signal:e,parse:J})}var Y=[{key:`page:workflows`,load:ae,tone:`run`,interval:15e3},{key:`page:schedules`,load:q,tone:`neutral`,interval:6e4},{key:`page:channels`,load:U,tone:`attn`,interval:3e4},{key:`page:mcp`,load:G,tone:`neutral`,interval:6e4}];function X(e,t){return i({queryKey:[`more-tile-badge`,e.key],queryFn:({signal:t})=>e.load(t),enabled:t,staleTime:1e4,refetchInterval:t?e.interval:!1,retry:!1}).data}function oe(e,t){let n=[X(Y[0],t.has(Y[0].key)),X(Y[1],t.has(Y[1].key)),X(Y[2],t.has(Y[2].key)),X(Y[3],t.has(Y[3].key))],r=[t=>e(`navigation:more.badgeRunning`,{count:t}),t=>e(`navigation:more.badgeEnabled`,{count:t}),t=>e(`navigation:more.badgeDisconnected`,{count:t}),t=>e(`navigation:more.badgeOnline`,{count:t})],i=new Map;return Y.forEach((e,a)=>{let o=n[a];typeof o==`number`&&o>0&&t.has(e.key)&&i.set(e.key,{label:r[a](o),tone:e.tone})}),i}var Z=n(),se=6,Q=`[data-more-tile]`,$=``;function ce(e,t){return e?.querySelector(`[data-more-tile="${CSS.escape(t)}"]`)??null}function le({onOpen:e}){let{t,language:n}=r(),i=(0,L.useId)(),[a,o]=(0,L.useState)(``),s=F(`commandPalette`),c=F(`focusSearch`),l=u(e=>e.capabilities),p=ee(e=>e.client===`mobile-app`),m=f(),h=t(`navigation:more.title`),g=d(),_=(0,L.useMemo)(()=>g.items.map(({componentId:e,name:t,description:n})=>({id:e,name:t,description:n})),[g.items]),v=(0,L.useMemo)(()=>z(t,{capabilities:l,mobileApp:p,components:_}),[l,_,p,t]),b=(0,L.useMemo)(()=>B(v,a,n),[v,n,a]),x=oe(t,(0,L.useMemo)(()=>new Set(v.flatMap(e=>e.tiles.map(e=>e.key))),[v])),S=(0,L.useMemo)(()=>a.trim()?P(a,n,{capabilities:l,mobileApp:p}).slice(0,se):[],[l,n,p,a]);(0,L.useEffect)(()=>(document.title=`${h} · ${O}`,()=>{document.title=O}),[h]);let C=t=>{if(t.entry.card===`interface-custom-ui`){e({type:`page`,id:`components`});return}N(t.entry.card,t.entry.section,{targetId:t.entry.targetId,targetText:t.title,expandGroup:t.entry.expandGroup}),e({type:`config`,id:t.entry.section})},w=(0,Z.jsxs)(j,{variant:`outline`,className:`h-auto min-h-11 w-full justify-start gap-2.5 py-2 text-left whitespace-normal`,"data-more-palette-search":!0,onClick:()=>ie(a.trim()),children:[m?(0,Z.jsx)(E,{className:`flex-none`,"aria-hidden":`true`}):(0,Z.jsx)(I,{className:`flex-none`,"aria-hidden":`true`}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Z.jsx)(`span`,{className:`truncate text-sm text-content`,children:t(`navigation:more.searchPalette`,{query:a.trim()})}),(0,Z.jsx)(`span`,{className:`text-xs font-normal text-content-muted`,children:t(`navigation:more.searchPaletteHint`)})]})]}),T=`mb-2 text-[13px] font-medium text-content-muted`;return(0,L.useLayoutEffect)(()=>{let e=document.querySelector(`[data-features-index]`),t=$;$=``;let n=0,r=0,i=!t,a=()=>{let o=ce(e,t);o?(o.focus(),i=!0):(n+=1)<20?r=requestAnimationFrame(a):i=!0};return t&&(r=requestAnimationFrame(a)),()=>{cancelAnimationFrame(r),i||($=t);let n=document.activeElement,a=n instanceof HTMLElement&&e?.contains(n)?n.closest(Q):null;a?.dataset.moreTile&&($=a.dataset.moreTile)}},[]),(0,Z.jsxs)(`div`,{"data-features-index":!0,className:`flex h-full min-h-0 w-full flex-col bg-background`,children:[!m&&(0,Z.jsx)(`div`,{"data-window-drag-region":!0,"aria-hidden":`true`,className:`h-[52px] flex-none`}),(0,Z.jsx)(`div`,{"data-features-scroller":!0,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,onKeyDown:ue,children:(0,Z.jsxs)(`div`,{"data-features-column":!0,className:`mx-auto flex w-full max-w-[808px] flex-col px-6 pb-16 max-[650px]:px-4 max-[650px]:pt-4 max-[650px]:pb-8`,children:[(0,Z.jsxs)(`header`,{"data-focus-region":`header`,className:`flex flex-col`,children:[(0,Z.jsx)(`h1`,{id:i,className:A(`text-2xl leading-8 font-semibold tracking-[-.01em] text-content`,m&&`sr-only`),children:h}),(0,Z.jsx)(`p`,{className:A(`mt-1 text-sm text-content-muted`,m&&`hidden`),children:s&&!m?t(`navigation:more.lede`,{shortcut:s}):t(`navigation:more.ledeNoShortcut`)}),(0,Z.jsxs)(`label`,{className:A(`relative mt-5 flex h-9 w-full items-center gap-2 rounded-[var(--r-md)] border border-control bg-panel px-3 text-content-muted focus-within:border-focus focus-within:ring-3 focus-within:ring-focus-ring max-[650px]:h-11`,m&&`mt-0`),children:[(0,Z.jsx)(E,{className:`size-4 flex-none`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:t(`navigation:more.search`)}),(0,Z.jsx)(`input`,{id:k,type:`search`,value:a,placeholder:t(`navigation:more.search`),"aria-keyshortcuts":c||void 0,className:`w-full min-w-0 border-0 bg-transparent text-[length:var(--app-font-size)] text-content caret-focus outline-none max-[650px]:text-[16px] [&::-webkit-search-cancel-button]:hidden`,onChange:e=>o(e.target.value),onKeyDown:e=>{if(e.key===`Escape`&&a)e.preventDefault(),e.stopPropagation(),o(``);else if(e.key===`ArrowDown`){let t=e.currentTarget.closest(`[data-features-scroller]`)?.querySelector(Q);t&&(e.preventDefault(),e.stopPropagation(),t.focus())}}}),a?(0,Z.jsx)(`button`,{type:`button`,className:`grid size-6 flex-none place-items-center rounded-xs text-content-muted hover:bg-surface-hover hover:text-content focus-visible:outline-2 focus-visible:outline-focus pointer-coarse:size-11`,"aria-label":t(`navigation:more.clearSearch`),onClick:()=>o(``),children:(0,Z.jsx)(D,{className:`size-3.5`,"aria-hidden":`true`})}):c&&(0,Z.jsx)(M,{className:`flex-none pointer-coarse:hidden`,children:c})]})]}),b.length===0&&S.length===0?(0,Z.jsxs)(`div`,{role:`status`,"data-features-empty":!0,className:`flex flex-col items-center gap-2 py-16 text-center`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium text-content`,children:t(`navigation:more.noResults`)}),(0,Z.jsx)(`p`,{className:`max-w-sm text-xs text-content-muted`,children:t(`navigation:more.noResultsHint`,{shortcut:s||`⌘K`})}),(0,Z.jsxs)(`div`,{className:`mt-2 flex w-full max-w-sm flex-col gap-2`,children:[w,(0,Z.jsx)(j,{variant:`secondary`,className:`min-h-11`,onClick:()=>o(``),children:t(`navigation:more.clearSearch`)})]})]}):b.map(n=>{let r=`${i}-${n.id}`;return(0,Z.jsxs)(`section`,{"data-more-group":n.id,"aria-labelledby":r,className:`mt-7 flex flex-col`,children:[(0,Z.jsx)(`h2`,{id:r,className:T,children:n.label}),(0,Z.jsx)(`ul`,{className:`grid grid-cols-2 gap-2 max-[650px]:grid-cols-1`,children:n.tiles.map(t=>(0,Z.jsx)(`li`,{className:`min-w-0`,children:(0,Z.jsx)(de,{tile:t,badge:x.get(t.key),onOpen:e})},t.key))}),n.id===`components`&&!a&&g.isLoading&&(0,Z.jsx)(`p`,{role:`status`,className:`mt-2 text-xs text-content-muted`,children:t(`navigation:more.componentsLoading`)}),n.id===`components`&&!a&&!!g.error&&(0,Z.jsxs)(`p`,{role:`alert`,className:`mt-2 flex items-center gap-2 text-xs text-content-muted`,children:[t(`navigation:more.componentsError`),(0,Z.jsx)(j,{variant:`ghost`,size:`xs`,onClick:g.refetch,children:t(`navigation:more.retry`)})]})]},n.id)}),a.trim()&&(b.length>0||S.length>0)&&(0,Z.jsxs)(`section`,{"aria-labelledby":`${i}-search`,className:`mt-7 flex flex-col`,children:[(0,Z.jsx)(`h2`,{id:`${i}-search`,className:T,children:t(`navigation:more.settingsResults`)}),S.length>0&&(0,Z.jsx)(`ul`,{"data-more-settings-results":!0,className:`mb-2 flex flex-col divide-y divide-stroke-soft overflow-hidden rounded-card border border-stroke`,children:S.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`button`,{type:`button`,className:`flex min-h-11 w-full min-w-0 items-center gap-3 px-3.5 py-2 text-left transition-colors duration-(--d-fast) hover:bg-surface-hover focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus`,onClick:()=>C(e),children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Z.jsx)(`span`,{className:`truncate text-sm text-content`,children:e.title}),e.sectionTitle!==e.title&&(0,Z.jsx)(`span`,{className:`truncate text-xs text-content-muted`,children:e.sectionTitle})]}),(0,Z.jsx)(y,{className:`size-4 flex-none text-content-muted`,"aria-hidden":`true`})]})},e.entry.id))}),w]})]})})]})}function ue(e){let t=e.target;if(!(t instanceof HTMLElement)||!t.matches(Q)||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)return;let n=[...e.currentTarget.querySelectorAll(Q)],r=n.indexOf(t);if(r<0)return;let i;if(e.key===`ArrowRight`)i=n[r+1];else if(e.key===`ArrowLeft`)i=n[r-1];else if(e.key===`Home`)i=n[0];else if(e.key===`End`)i=n.at(-1);else if(e.key===`ArrowDown`||e.key===`ArrowUp`){let r=t.getBoundingClientRect(),a=e.key===`ArrowDown`,o=r.left+r.width/2,s=n.map(e=>({tile:e,box:e.getBoundingClientRect()})).filter(({box:e})=>a?e.top>=r.bottom-1:e.bottom<=r.top+1);if(s.length>0){let e=a?Math.min(...s.map(({box:e})=>e.top)):Math.max(...s.map(({box:e})=>e.top));i=s.filter(({box:t})=>Math.abs(t.top-e)<2).sort((e,t)=>Math.abs(e.box.left+e.box.width/2-o)-Math.abs(t.box.left+t.box.width/2-o))[0]?.tile}else if(!a){document.getElementById(k)?.focus(),e.preventDefault();return}}else return;e.preventDefault(),i?.focus()}function de({tile:e,badge:t,onOpen:n}){let{t:i}=r(),a=e.icon,o=!!e.disabledReason,s=e.key===R;return(0,Z.jsxs)(`button`,{type:`button`,"data-more-tile":e.key,"aria-disabled":o||void 0,"aria-label":o?i(`navigation:more.disabledTile`,{label:e.label,reason:e.disabledReason}):void 0,className:A(`flex min-h-16 w-full min-w-0 items-center gap-3 rounded-card border px-3.5 py-2.5 text-left transition-colors duration-(--d-fast) focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus max-[650px]:min-h-14 max-[650px]:py-2`,s?`border-dashed border-stroke-strong`:`border-stroke`,o?`cursor-not-allowed`:`hover:bg-surface-hover`),onClick:()=>{o||($=e.key,n(e.destination))},children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:A(`grid size-[34px] flex-none place-items-center rounded-[var(--r-md)] max-[650px]:size-8`,s?`text-content-muted`:`bg-surface-subtle text-content-secondary`,o&&`text-content-muted`),children:(0,Z.jsx)(a,{className:`size-[18px]`,strokeWidth:1.75})}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Z.jsx)(`span`,{className:A(`truncate text-sm font-medium text-content`,(o||s)&&`text-content-secondary`),children:e.label}),(0,Z.jsx)(`span`,{className:`truncate text-xs text-content-muted`,children:e.disabledReason||e.description})]}),t&&!o&&(0,Z.jsxs)(`span`,{"data-more-badge":t.tone,className:A(`flex max-w-[45%] flex-none items-center gap-1.5 text-xs whitespace-nowrap tabular-nums`,t.tone===`attn`?`font-medium text-st-attn`:`text-content-muted`),children:[t.tone===`attn`&&(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 flex-none rounded-full bg-st-attn-fill`}),(0,Z.jsx)(`span`,{className:`truncate`,children:t.label})]})]})}export{le as MorePage};
|
|
1
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-AM3jlRYR.js";import{t as i}from"./useQuery-DfOU-27z.js";import{t as a}from"./http-response-scdqC11Q.js";import{n as o}from"./http-CXQuFoDX.js";import{a as s,n as c,t as l}from"./runtime-capabilities-B7qveLBm.js";import{t as u}from"./runtime-capabilities-store-D0EC-a9c.js";import{m as d}from"./placements-CWg24KPB.js";import{t as ee}from"./client-store-CkmBBzE5.js";import{t as f}from"./usePhoneShell-CK9XBtgf.js";import{t as p}from"./createLucideIcon-Cd-3GVxJ.js";import{t as m}from"./app-window-CPNdvYNt.js";import{t as h}from"./blocks-Olsdp5Lp.js";import{t as g}from"./bot-B3TaBp_T.js";import{t as _}from"./brain-qxhnKqYP.js";import{t as v}from"./calendar-clock-VIxTaqqy.js";import{t as y}from"./chevron-right-C3t2Rckj.js";import{t as b}from"./image-BY_c3FYU.js";import{t as x}from"./monitor-smartphone-B1gIjItA.js";import{t as S}from"./plug-BsIeHRwC.js";import{t as C}from"./plus-fQbSqB1n.js";import{t as w}from"./radio-tower-jGQwrFWB.js";import{t as T}from"./rotate-ccw-clock-CO6Bw-sF.js";import{t as E}from"./search-D0mqDaf_.js";import{t as te}from"./server-BgNvmqwJ.js";import{t as ne}from"./sparkles-S_eeuqn9.js";import{t as re}from"./workflow-Bg94dy8I.js";import{t as D}from"./x-07u4-129.js";import{t as O}from"./brand-DIEc3fK8.js";import{i as k}from"./more-pages-D_PnxLN0.js";import{t as A}from"./utils-C8uzG5AZ.js";import{t as j}from"./button-CCcCN8tE.js";import{t as M}from"./kbd-CAufZTkl.js";import{g as ie}from"./events-CcKmvwE6.js";import{n as N,r as P}from"./config-search-DTHZrqfb.js";import{s as F}from"./shortcuts-BsrTXPiU.js";var I=p(`command`,[[`path`,{d:`M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3`,key:`11bfej`}]]),L=e(t(),1),R=`add:component`;function z(e,{capabilities:t=l,mobileApp:n=!1,components:r=[]}={}){let i=(e,n,r,i)=>s(t,e)?{key:`page:${e}`,label:n,description:r,icon:i,destination:{type:`page`,id:e}}:null,a=e=>c(t,e,{mobileApp:n}),o=a(`remote-access`),u=a(`desktop-pet`),d=[a(`mobile-server`).supported?{key:`config:mobile-server`,label:e(`config:configPage.mobileServer`),description:e(`navigation:more.mobileServerHint`),icon:x,destination:{type:`config`,id:`mobile-server`}}:o.supported?{key:`config:remote-access`,label:e(`config:configPage.remoteAccess`),description:e(`navigation:more.remoteAccessHint`),icon:x,destination:{type:`config`,id:`remote-access`}}:null,u.supported||u.reason===`desktop-only`?{key:`config:desktop-pet`,label:e(`config:configPage.desktopPet`),description:e(`navigation:more.desktopPetHint`),icon:g,destination:{type:`config`,id:`desktop-pet`},...u.supported?{}:{disabledReason:e(`navigation:more.desktopOnly`)}}:null];return[{id:`sessions`,label:e(`navigation:more.groupSessions`),tiles:[i(`chatHistory`,e(`navigation:navigation.chatHistory`),e(`navigation:more.chatHistoryHint`),T),i(`assets`,e(`navigation:navigation.assets`),e(`navigation:more.assetsHint`),b),i(`memory`,e(`navigation:navigation.memory`),e(`navigation:more.memoryHint`),_)]},{id:`automation`,label:e(`navigation:more.groupAutomation`),tiles:[i(`workflows`,e(`navigation:navigation.workflows`),e(`navigation:more.workflowsHint`),re),i(`schedules`,e(`navigation:navigation.schedules`),e(`navigation:more.schedulesHint`),v),i(`channels`,e(`navigation:navigation.channels`),e(`navigation:more.channelsHint`),w)]},{id:`extensions`,label:e(`navigation:more.groupExtensions`),tiles:[i(`plugins`,e(`navigation:navigation.plugins`),e(`navigation:more.pluginsHint`),S),i(`skills`,e(`navigation:navigation.skills`),e(`navigation:more.skillsHint`),ne),i(`mcp`,e(`navigation:navigation.mcp`),e(`navigation:more.mcpHint`),te),{key:`page:components`,label:e(`navigation:shell.components`),description:e(`navigation:more.componentStudioHint`),icon:h,destination:{type:`page`,id:`components`}}]},{id:`devices`,label:e(`navigation:more.groupDevices`),tiles:d},{id:`components`,label:e(`navigation:more.groupComponents`),tiles:[...r.map(t=>({key:`component:${t.id}`,label:t.name,description:t.description||e(`navigation:more.componentHint`),icon:m,destination:{type:`component`,id:t.id}})),{key:R,label:e(`navigation:more.addComponent`),description:e(`navigation:more.addComponentHint`),icon:C,destination:{type:`page`,id:`components`}}]}].map(e=>({id:e.id,label:e.label,tiles:e.tiles.filter(e=>e!==null)})).filter(e=>e.tiles.length>0)}function B(e,t,n){let r=t.trim().toLocaleLowerCase(n);return r?e.map(e=>({...e,tiles:e.tiles.filter(t=>[t.label,t.description,e.label].some(e=>e.toLocaleLowerCase(n).includes(r)))})).filter(e=>e.tiles.length>0):[...e]}var V=new Set([`connected`,`connecting`,`reconnecting`]);function H(e){let t=e&&typeof e==`object`?e.connections:null;if(!t||typeof t!=`object`||Array.isArray(t))throw a();let n=0;for(let e of Object.values(t)){if(!e||typeof e!=`object`)continue;let{enabled:t,status:r}=e;t!==!1&&(typeof r!=`string`||!V.has(r))&&(n+=1)}return n}function U(e){return o(`/api/channels`,{signal:e,parse:H})}function W(e){let t=e&&typeof e==`object`?e.metrics:null,n=t&&typeof t==`object`?t.onlineServices:void 0;if(typeof n!=`number`||!Number.isFinite(n)||n<0)throw a();return Math.floor(n)}function G(e){return o(`/api/mcp?refresh=0`,{signal:e,parse:W})}function K(e){let t=e&&typeof e==`object`?e.tasks:null;if(!Array.isArray(t))throw a();return t.filter(e=>e&&typeof e==`object`&&e.enabled===!0).length}function q(e){return o(`/api/schedules`,{signal:e,parse:K})}function J(e){let t=e&&typeof e==`object`?e.limits:null,n=t&&typeof t==`object`?t.running:void 0;if(typeof n!=`number`||!Number.isFinite(n)||n<0)throw a();return Math.floor(n)}function ae(e){return o(`/api/workflows`,{signal:e,parse:J})}var Y=[{key:`page:workflows`,load:ae,tone:`run`,interval:15e3},{key:`page:schedules`,load:q,tone:`neutral`,interval:6e4},{key:`page:channels`,load:U,tone:`attn`,interval:3e4},{key:`page:mcp`,load:G,tone:`neutral`,interval:6e4}];function X(e,t){return i({queryKey:[`more-tile-badge`,e.key],queryFn:({signal:t})=>e.load(t),enabled:t,staleTime:1e4,refetchInterval:t?e.interval:!1,retry:!1}).data}function oe(e,t){let n=[X(Y[0],t.has(Y[0].key)),X(Y[1],t.has(Y[1].key)),X(Y[2],t.has(Y[2].key)),X(Y[3],t.has(Y[3].key))],r=[t=>e(`navigation:more.badgeRunning`,{count:t}),t=>e(`navigation:more.badgeEnabled`,{count:t}),t=>e(`navigation:more.badgeDisconnected`,{count:t}),t=>e(`navigation:more.badgeOnline`,{count:t})],i=new Map;return Y.forEach((e,a)=>{let o=n[a];typeof o==`number`&&o>0&&t.has(e.key)&&i.set(e.key,{label:r[a](o),tone:e.tone})}),i}var Z=n(),se=6,Q=`[data-more-tile]`,$=``;function ce(e,t){return e?.querySelector(`[data-more-tile="${CSS.escape(t)}"]`)??null}function le({onOpen:e}){let{t,language:n}=r(),i=(0,L.useId)(),[a,o]=(0,L.useState)(``),s=F(`commandPalette`),c=F(`focusSearch`),l=u(e=>e.capabilities),p=ee(e=>e.client===`mobile-app`),m=f(),h=t(`navigation:more.title`),g=d(),_=(0,L.useMemo)(()=>g.items.map(({componentId:e,name:t,description:n})=>({id:e,name:t,description:n})),[g.items]),v=(0,L.useMemo)(()=>z(t,{capabilities:l,mobileApp:p,components:_}),[l,_,p,t]),b=(0,L.useMemo)(()=>B(v,a,n),[v,n,a]),x=oe(t,(0,L.useMemo)(()=>new Set(v.flatMap(e=>e.tiles.map(e=>e.key))),[v])),S=(0,L.useMemo)(()=>a.trim()?P(a,n,{capabilities:l,mobileApp:p}).slice(0,se):[],[l,n,p,a]);(0,L.useEffect)(()=>(document.title=`${h} · ${O}`,()=>{document.title=O}),[h]);let C=t=>{if(t.entry.card===`interface-custom-ui`){e({type:`page`,id:`components`});return}N(t.entry.card,t.entry.section,{targetId:t.entry.targetId,targetText:t.title,expandGroup:t.entry.expandGroup}),e({type:`config`,id:t.entry.section})},w=(0,Z.jsxs)(j,{variant:`outline`,className:`h-auto min-h-11 w-full justify-start gap-2.5 py-2 text-left whitespace-normal`,"data-more-palette-search":!0,onClick:()=>ie(a.trim()),children:[m?(0,Z.jsx)(E,{className:`flex-none`,"aria-hidden":`true`}):(0,Z.jsx)(I,{className:`flex-none`,"aria-hidden":`true`}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Z.jsx)(`span`,{className:`truncate text-sm text-content`,children:t(`navigation:more.searchPalette`,{query:a.trim()})}),(0,Z.jsx)(`span`,{className:`text-xs font-normal text-content-muted`,children:t(`navigation:more.searchPaletteHint`)})]})]}),T=`mb-2 text-[13px] font-medium text-content-muted`;return(0,L.useLayoutEffect)(()=>{let e=document.querySelector(`[data-features-index]`),t=$;$=``;let n=0,r=0,i=!t,a=()=>{let o=ce(e,t);o?(o.focus(),i=!0):(n+=1)<20?r=requestAnimationFrame(a):i=!0};return t&&(r=requestAnimationFrame(a)),()=>{cancelAnimationFrame(r),i||($=t);let n=document.activeElement,a=n instanceof HTMLElement&&e?.contains(n)?n.closest(Q):null;a?.dataset.moreTile&&($=a.dataset.moreTile)}},[]),(0,Z.jsxs)(`div`,{"data-features-index":!0,className:`flex h-full min-h-0 w-full flex-col bg-background`,children:[!m&&(0,Z.jsx)(`div`,{"data-window-drag-region":!0,"aria-hidden":`true`,className:`h-[52px] flex-none`}),(0,Z.jsx)(`div`,{"data-features-scroller":!0,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,onKeyDown:ue,children:(0,Z.jsxs)(`div`,{"data-features-column":!0,className:`mx-auto flex w-full max-w-[808px] flex-col px-6 pb-16 max-[650px]:px-4 max-[650px]:pt-4 max-[650px]:pb-8`,children:[(0,Z.jsxs)(`header`,{"data-focus-region":`header`,className:`flex flex-col`,children:[(0,Z.jsx)(`h1`,{id:i,className:A(`text-2xl leading-8 font-semibold tracking-[-.01em] text-content`,m&&`sr-only`),children:h}),(0,Z.jsx)(`p`,{className:A(`mt-1 text-sm text-content-muted`,m&&`hidden`),children:s&&!m?t(`navigation:more.lede`,{shortcut:s}):t(`navigation:more.ledeNoShortcut`)}),(0,Z.jsxs)(`label`,{className:A(`relative mt-5 flex h-9 w-full items-center gap-2 rounded-[var(--r-md)] border border-control bg-panel px-3 text-content-muted focus-within:border-focus focus-within:ring-3 focus-within:ring-focus-ring max-[650px]:h-11`,m&&`mt-0`),children:[(0,Z.jsx)(E,{className:`size-4 flex-none`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:t(`navigation:more.search`)}),(0,Z.jsx)(`input`,{id:k,type:`search`,value:a,placeholder:t(`navigation:more.search`),"aria-keyshortcuts":c||void 0,className:`w-full min-w-0 border-0 bg-transparent text-[length:var(--app-font-size)] text-content caret-focus outline-none max-[650px]:text-[16px] [&::-webkit-search-cancel-button]:hidden`,onChange:e=>o(e.target.value),onKeyDown:e=>{if(e.key===`Escape`&&a)e.preventDefault(),e.stopPropagation(),o(``);else if(e.key===`ArrowDown`){let t=e.currentTarget.closest(`[data-features-scroller]`)?.querySelector(Q);t&&(e.preventDefault(),e.stopPropagation(),t.focus())}}}),a?(0,Z.jsx)(`button`,{type:`button`,className:`grid size-6 flex-none place-items-center rounded-xs text-content-muted hover:bg-surface-hover hover:text-content focus-visible:outline-2 focus-visible:outline-focus pointer-coarse:size-11`,"aria-label":t(`navigation:more.clearSearch`),onClick:()=>o(``),children:(0,Z.jsx)(D,{className:`size-3.5`,"aria-hidden":`true`})}):c&&(0,Z.jsx)(M,{className:`flex-none pointer-coarse:hidden`,children:c})]})]}),b.length===0&&S.length===0?(0,Z.jsxs)(`div`,{role:`status`,"data-features-empty":!0,className:`flex flex-col items-center gap-2 py-16 text-center`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium text-content`,children:t(`navigation:more.noResults`)}),(0,Z.jsx)(`p`,{className:`max-w-sm text-xs text-content-muted`,children:t(`navigation:more.noResultsHint`,{shortcut:s||`⌘K`})}),(0,Z.jsxs)(`div`,{className:`mt-2 flex w-full max-w-sm flex-col gap-2`,children:[w,(0,Z.jsx)(j,{variant:`secondary`,className:`min-h-11`,onClick:()=>o(``),children:t(`navigation:more.clearSearch`)})]})]}):b.map(n=>{let r=`${i}-${n.id}`;return(0,Z.jsxs)(`section`,{"data-more-group":n.id,"aria-labelledby":r,className:`mt-7 flex flex-col`,children:[(0,Z.jsx)(`h2`,{id:r,className:T,children:n.label}),(0,Z.jsx)(`ul`,{className:`grid grid-cols-2 gap-2 max-[650px]:grid-cols-1`,children:n.tiles.map(t=>(0,Z.jsx)(`li`,{className:`min-w-0`,children:(0,Z.jsx)(de,{tile:t,badge:x.get(t.key),onOpen:e})},t.key))}),n.id===`components`&&!a&&g.isLoading&&(0,Z.jsx)(`p`,{role:`status`,className:`mt-2 text-xs text-content-muted`,children:t(`navigation:more.componentsLoading`)}),n.id===`components`&&!a&&!!g.error&&(0,Z.jsxs)(`p`,{role:`alert`,className:`mt-2 flex items-center gap-2 text-xs text-content-muted`,children:[t(`navigation:more.componentsError`),(0,Z.jsx)(j,{variant:`ghost`,size:`xs`,onClick:g.refetch,children:t(`navigation:more.retry`)})]})]},n.id)}),a.trim()&&(b.length>0||S.length>0)&&(0,Z.jsxs)(`section`,{"aria-labelledby":`${i}-search`,className:`mt-7 flex flex-col`,children:[(0,Z.jsx)(`h2`,{id:`${i}-search`,className:T,children:t(`navigation:more.settingsResults`)}),S.length>0&&(0,Z.jsx)(`ul`,{"data-more-settings-results":!0,className:`mb-2 flex flex-col divide-y divide-stroke-soft overflow-hidden rounded-card border border-stroke`,children:S.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`button`,{type:`button`,className:`flex min-h-11 w-full min-w-0 items-center gap-3 px-3.5 py-2 text-left transition-colors duration-(--d-fast) hover:bg-surface-hover focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus`,onClick:()=>C(e),children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Z.jsx)(`span`,{className:`truncate text-sm text-content`,children:e.title}),e.sectionTitle!==e.title&&(0,Z.jsx)(`span`,{className:`truncate text-xs text-content-muted`,children:e.sectionTitle})]}),(0,Z.jsx)(y,{className:`size-4 flex-none text-content-muted`,"aria-hidden":`true`})]})},e.entry.id))}),w]})]})})]})}function ue(e){let t=e.target;if(!(t instanceof HTMLElement)||!t.matches(Q)||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)return;let n=[...e.currentTarget.querySelectorAll(Q)],r=n.indexOf(t);if(r<0)return;let i;if(e.key===`ArrowRight`)i=n[r+1];else if(e.key===`ArrowLeft`)i=n[r-1];else if(e.key===`Home`)i=n[0];else if(e.key===`End`)i=n.at(-1);else if(e.key===`ArrowDown`||e.key===`ArrowUp`){let r=t.getBoundingClientRect(),a=e.key===`ArrowDown`,o=r.left+r.width/2,s=n.map(e=>({tile:e,box:e.getBoundingClientRect()})).filter(({box:e})=>a?e.top>=r.bottom-1:e.bottom<=r.top+1);if(s.length>0){let e=a?Math.min(...s.map(({box:e})=>e.top)):Math.max(...s.map(({box:e})=>e.top));i=s.filter(({box:t})=>Math.abs(t.top-e)<2).sort((e,t)=>Math.abs(e.box.left+e.box.width/2-o)-Math.abs(t.box.left+t.box.width/2-o))[0]?.tile}else if(!a){document.getElementById(k)?.focus(),e.preventDefault();return}}else return;e.preventDefault(),i?.focus()}function de({tile:e,badge:t,onOpen:n}){let{t:i}=r(),a=e.icon,o=!!e.disabledReason,s=e.key===R;return(0,Z.jsxs)(`button`,{type:`button`,"data-more-tile":e.key,"aria-disabled":o||void 0,"aria-label":o?i(`navigation:more.disabledTile`,{label:e.label,reason:e.disabledReason}):void 0,className:A(`flex min-h-16 w-full min-w-0 items-center gap-3 rounded-card border px-3.5 py-2.5 text-left transition-colors duration-(--d-fast) focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus max-[650px]:min-h-14 max-[650px]:py-2`,s?`border-dashed border-stroke-strong`:`border-stroke`,o?`cursor-not-allowed`:`hover:bg-surface-hover`),onClick:()=>{o||($=e.key,n(e.destination))},children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:A(`grid size-[34px] flex-none place-items-center rounded-[var(--r-md)] max-[650px]:size-8`,s?`text-content-muted`:`bg-surface-subtle text-content-secondary`,o&&`text-content-muted`),children:(0,Z.jsx)(a,{className:`size-[18px]`,strokeWidth:1.75})}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,Z.jsx)(`span`,{className:A(`truncate text-sm font-medium text-content`,(o||s)&&`text-content-secondary`),children:e.label}),(0,Z.jsx)(`span`,{className:`truncate text-xs text-content-muted`,children:e.disabledReason||e.description})]}),t&&!o&&(0,Z.jsxs)(`span`,{"data-more-badge":t.tone,className:A(`flex max-w-[45%] flex-none items-center gap-1.5 text-xs whitespace-nowrap tabular-nums`,t.tone===`attn`?`font-medium text-st-attn`:`text-content-muted`),children:[t.tone===`attn`&&(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 flex-none rounded-full bg-st-attn-fill`}),(0,Z.jsx)(`span`,{className:`truncate`,children:t.label})]})]})}export{le as MorePage};
|
|
@@ -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-AM3jlRYR.js";import{i}from"./http-response-scdqC11Q.js";import{t as a}from"./folder-open-FIShC5Qk.js";import{i as o}from"./workspace-order-store-C_t43Zgq.js";import{t as s}from"./triangle-alert-CE1q54ci.js";import{n as c,t as l}from"./button-CCcCN8tE.js";import{a as u,i as d,l as f,o as p,s as m,t as h}from"./dialog-BVAtioHy.js";import{t as g}from"./input-CPw-zkYh.js";import{i as _,n as v,r as y,t as b}from"./input-group-h8z63MzW.js";import{t as x}from"./pick-system-directory-COxOQmRm.js";import{r as S,t as C}from"./folder-paths-D8nYAh7q.js";import{n as w,t as T}from"./alert-DRIrgNI4.js";import{n as E,t as D}from"./field-DoLEb0np.js";var O=e(t(),1),k=n();function A(e,t){switch(e){case`folder_name_required`:return t(`board:folder.error.nameRequired`);case`folder_name_invalid`:return t(`board:folder.error.nameInvalid`);case`folder_parent_missing`:case`folder_parent_invalid`:return t(`board:folder.error.parentMissing`);case`folder_exists_as_file`:return t(`board:folder.error.existsAsFile`);case`folder_permission_denied`:return t(`board:folder.error.permission`);default:return``}}function j({open:e,initialParent:t,onOpenChange:n,onCreated:j,onCloseAutoFocus:M}){let{t:N}=r(),[P,F]=(0,O.useState)(t),[I,L]=(0,O.useState)(``),[R,z]=(0,O.useState)(!1),[B,V]=(0,O.useState)(!1),[H,U]=(0,O.useState)(!1),[W,G]=(0,O.useState)(``),K=(0,O.useRef)(0),q=(0,O.useRef)(!1),J=(0,O.useRef)(null),Y=R||B;(0,O.useEffect)(()=>{K.current+=1,q.current=!1,e&&(F(t),L(``),z(!1),V(!1),U(!1),G(``))},[t,e]);let X=async()=>{if(q.current)return;q.current=!0;let e=K.current;V(!0),G(``);try{let t=await x(P.trim(),N(`board:folder.browseTitle`));if(e!==K.current)return;t.status===`picked`?F(t.path):t.status===`unavailable`&&(U(!0),J.current?.focus())}catch(t){e===K.current&&G(t instanceof Error?t.message:String(t))}finally{e===K.current&&(q.current=!1,V(!1))}},Z=async e=>{if(e.preventDefault(),q.current||!I.trim())return;q.current=!0;let t=K.current;z(!0),G(``);try{let e=await S(P.trim(),I.trim());if(t!==K.current)return;j(e.path),n(!1)}catch(e){if(t!==K.current)return;let n=A(e instanceof i?e.data?.code:void 0,N);G(n||(e instanceof Error&&e.message?N(`board:folder.error.failedWithReason`,{reason:e.message}):N(`board:folder.error.failed`)))}finally{t===K.current&&(q.current=!1,z(!1))}},Q=I.trim()?C(P,I.trim()):``;return(0,k.jsx)(h,{open:e,onOpenChange:e=>!q.current&&n(e),children:(0,k.jsxs)(d,{showCloseButton:!Y,"aria-describedby":`board-new-folder`,onCloseAutoFocus:M,"data-new-folder-dialog":!0,children:[(0,k.jsxs)(m,{children:[(0,k.jsx)(f,{children:N(`board:folder.title`)}),(0,k.jsx)(u,{id:`board-new-folder`,children:N(`board:folder.description`)})]}),(0,k.jsxs)(`form`,{className:`flex min-w-0 flex-col gap-4`,onSubmit:e=>void Z(e),children:[(0,k.jsxs)(E,{variant:`control`,children:[N(`board:folder.parent`),(0,k.jsxs)(b,{className:`max-[650px]:h-11`,children:[(0,k.jsx)(_,{ref:J,className:`font-mono text-xs`,value:P,disabled:Y,placeholder:N(`board:folder.parentPlaceholder`),"data-new-folder-parent":!0,onChange:e=>F(e.target.value)}),(0,k.jsx)(v,{align:`inline-end`,children:(0,k.jsxs)(y,{size:`xs`,disabled:Y,"data-new-folder-browse":!0,onClick:()=>void X(),children:[B?(0,k.jsx)(c,{className:`text-current`}):(0,k.jsx)(a,{}),N(`board:folder.browse`)]})})]})]}),H&&(0,k.jsx)(D,{className:`-mt-2`,children:N(`board:folder.browseUnavailable`)}),(0,k.jsxs)(E,{variant:`control`,children:[N(`board:folder.name`),(0,k.jsx)(g,{autoFocus:!0,className:`max-[650px]:h-11`,value:I,disabled:Y,placeholder:N(`board:folder.namePlaceholder`),autoComplete:`off`,spellCheck:!1,"data-new-folder-name":!0,onChange:e=>{L(e.target.value),W&&G(``)}})]}),Q&&(0,k.jsx)(`p`,{className:`-mt-2 truncate font-mono text-xs text-content-muted`,title:Q,children:N(`board:folder.preview`,{path:Q})}),W&&(0,k.jsxs)(T,{variant:`destructive`,children:[(0,k.jsx)(s,{}),(0,k.jsx)(w,{className:`min-w-0 break-words`,children:W})]}),(0,k.jsxs)(p,{children:[(0,k.jsx)(l,{type:`button`,variant:`secondary`,size:`dialogAction`,disabled:Y,onClick:()=>n(!1),children:N(`common:ui.cancel`)}),(0,k.jsxs)(l,{type:`submit`,size:`dialogAction`,disabled:Y||!I.trim(),children:[R?(0,k.jsx)(c,{className:`text-current`}):(0,k.jsx)(o,{}),N(R?`board:folder.creating`:`board:folder.create`)]})]})]})]})})}export{j as NewFolderDialog};
|
|
@@ -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-AM3jlRYR.js";import{t as n}from"./chevron-left-BAtyp3_6.js";import{t as r}from"./square-terminal-BVG6cUT1.js";import{r as i}from"./more-pages-D_PnxLN0.js";import{t as a}from"./utils-C8uzG5AZ.js";import{t as o}from"./button-CCcCN8tE.js";import{s}from"./shortcuts-BsrTXPiU.js";var c=e();function l({meta:e,page:l,desktopPlatform:u,terminalOpen:d,onToggleTerminal:f,onBackToMore:p,phoneShell:m=!1}){let{t:h}=t(),g=s(`toggleTerminal`),_=!!u,v=i.has(l)||p?h(`navigation:sidebar.features`):``;return(0,c.jsx)(`header`,{"data-focus-region":`header`,"data-window-drag-region":!0,className:a(`@container/page-header relative z-[2] flex flex-none flex-col`,_&&`[-webkit-app-region:drag]`),children:(0,c.jsxs)(`div`,{className:a(`flex min-h-12 items-center gap-2 border-b border-stroke-soft py-1.5 pr-2.5 in-data-[density=compact]:min-h-11 max-[650px]:min-h-0 max-[650px]:flex-wrap max-[650px]:gap-x-2 max-[650px]:gap-y-0 max-[650px]:border-b-0 max-[650px]:px-4 max-[650px]:pt-0 max-[650px]:pb-3`,`pl-[calc(16px+var(--workbench-leading-inset,0px))] max-[650px]:pl-4`,`[[data-custom-titlebar]_&]:pr-[144px]`),children:[(0,c.jsxs)(`div`,{className:a(`mr-auto flex min-w-0 items-center gap-1.5 text-[13px]`,`max-[650px]:h-14 max-[650px]:basis-full max-[650px]:gap-2`,m&&(v&&p?`max-[650px]:h-11`:`max-[650px]:h-0`)),children:[v&&p?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsxs)(`button`,{type:`button`,"data-back-to-more":!0,className:`-ml-1.5 flex h-7 shrink-0 items-center gap-0.5 rounded-sm pr-1.5 pl-1 text-content-muted transition-colors duration-(--d-fast) hover:bg-surface-hover hover:text-content focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus max-[650px]:-ml-3 max-[650px]:h-11 max-[650px]:min-w-11 max-[650px]:pr-2 max-[650px]:text-sm max-[650px]:text-content-secondary`,"aria-label":h(`navigation:shell.backToFeaturesLabel`),onClick:p,children:[(0,c.jsx)(n,{className:`size-4 max-[650px]:size-5`,"aria-hidden":`true`}),(0,c.jsx)(`span`,{children:v})]}),(0,c.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 text-content-faint max-[650px]:hidden`,children:`/`})]}):v&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(`span`,{className:`shrink-0 text-content-muted max-[900px]:hidden`,children:v}),(0,c.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 text-content-faint max-[900px]:hidden`,children:`/`})]}),(0,c.jsx)(`h1`,{className:a(`max-w-full min-w-[4em] truncate text-[13px] leading-5 font-medium text-content max-[650px]:min-w-0 max-[650px]:text-2xl max-[650px]:leading-8 max-[650px]:font-[650] max-[650px]:tracking-[-.015em]`,m&&`sr-only`),children:e[0]}),e[1]&&!m&&(0,c.jsx)(`p`,{className:`ml-1.5 min-w-0 truncate text-xs text-content-muted max-[900px]:hidden max-[650px]:ml-0 max-[650px]:block max-[650px]:flex-1 max-[650px]:basis-0`,children:e[1]})]}),_&&(0,c.jsx)(`div`,{className:`flex min-w-0 items-center justify-end gap-1.5 [-webkit-app-region:no-drag]`,children:(0,c.jsx)(o,{variant:`ghost`,size:`icon`,className:a(`text-content-muted max-[650px]:hidden`,d&&`bg-surface-hover text-accent-fg`),title:g?`${h(`navigation:pageHeader.toggleTerminal`)} (${g})`:h(`navigation:pageHeader.toggleTerminal`),"aria-label":h(`navigation:pageHeader.toggleTerminal`),"aria-pressed":d,onClick:f,children:(0,c.jsx)(r,{size:16})})})]})})}export{l as PageHeader};
|
|
@@ -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-AM3jlRYR.js";import{n,t as r}from"./list-T5PqlpS2.js";import{t as i}from"./search-D0mqDaf_.js";import{t as a}from"./settings-QX0oWnVK.js";import{t as o}from"./square-pen-hYbjKh6A.js";import{t as s}from"./utils-C8uzG5AZ.js";import{n as c,o as l,r as u,t as d}from"./sheet-BTaIEX4w.js";import{t as f}from"./sidebar-store-QvX0w7hQ.js";var p=e(),m=`flex h-11 w-full min-w-0 items-center gap-3 rounded-[var(--r-md)] px-2.5 text-base text-content transition-colors duration-(--d-fast) focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus active:bg-surface-hover`;function h({active:e,onSearch:h,onNewTask:g,onOpenBoard:_,onOpenFeatures:v,onOpenSettings:y,content:b,boardCount:x,update:S}){let{t:C}=t(),w=f(e=>e.drawerOpen),T=f(e=>e.setDrawerOpen),E=e=>()=>{T(!1),e()},D=(t,n,r,i,a)=>(0,p.jsxs)(`button`,{type:`button`,"data-drawer-entry":t,"aria-current":e===t?`page`:void 0,className:s(m,e===t&&`bg-surface-active`),onClick:E(i),children:[(0,p.jsx)(n,{className:`size-[18px] flex-none text-content-secondary`,strokeWidth:1.75,"aria-hidden":`true`}),(0,p.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:r}),a]});return(0,p.jsx)(d,{open:w,onOpenChange:T,children:(0,p.jsxs)(c,{side:`left`,showCloseButton:!1,"data-phone-drawer":!0,onCloseAutoFocus:e=>{let t=document.querySelector(`[data-phone-menu]`);t&&(e.preventDefault(),t.focus())},"aria-describedby":void 0,className:`w-[min(320px,85vw)] gap-0 border-stroke-soft bg-sidebar p-0 pt-[var(--pisper-safe-area-top)] pb-[var(--pisper-safe-area-bottom)] pl-[var(--pisper-safe-area-left)] data-[side=left]:w-[min(320px,85vw)] data-[side=left]:max-w-none`,children:[(0,p.jsx)(l,{className:`sr-only`,children:C(`navigation:phone.drawer`)}),(0,p.jsx)(u,{className:`sr-only`,children:C(`navigation:phone.drawerHint`)}),(0,p.jsxs)(`div`,{className:`flex flex-none items-center gap-2 px-3 pt-3 pb-2`,children:[(0,p.jsxs)(`button`,{type:`button`,"data-drawer-search":!0,className:`flex h-11 min-w-0 flex-1 items-center gap-2 rounded-[10px] bg-surface-muted px-3 text-left text-base text-content-muted focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus`,onClick:E(h),children:[(0,p.jsx)(i,{className:`size-[18px] flex-none`,strokeWidth:1.75,"aria-hidden":`true`}),(0,p.jsx)(`span`,{className:`truncate`,children:C(`navigation:sidebar.search`)})]}),(0,p.jsx)(`button`,{type:`button`,"data-drawer-new-task":!0,"aria-label":C(`navigation:shell.newTask`),className:`grid size-11 flex-none place-items-center rounded-[var(--r-md)] text-content-secondary focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus active:bg-surface-hover`,onClick:E(g),children:(0,p.jsx)(o,{className:`size-5`,strokeWidth:1.75,"aria-hidden":`true`})})]}),(0,p.jsxs)(`nav`,{"aria-label":C(`navigation:shell.primaryNavigation`),className:`flex-none px-2 pb-2`,children:[D(`board`,r,C(`navigation:sidebar.allAgents`),_,x?(0,p.jsx)(`span`,{className:`flex-none text-sm text-content-muted tabular-nums`,children:x}):void 0),D(`features`,n,C(`navigation:sidebar.features`),v)]}),(0,p.jsx)(`div`,{"data-drawer-sessions":!0,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-2 pt-1`,children:b}),(0,p.jsxs)(`div`,{className:`flex flex-none items-center gap-1 border-t border-stroke-soft px-2 py-2`,children:[(0,p.jsx)(`div`,{className:`min-w-0 flex-1`,children:D(`settings`,a,C(`navigation:navigation.settings`),y)}),S]})]})})}export{h as PhoneDrawer};
|
|
@@ -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-AM3jlRYR.js";import{t as n}from"./createLucideIcon-Cd-3GVxJ.js";import{t as r}from"./utils-C8uzG5AZ.js";import{t as i}from"./sidebar-store-QvX0w7hQ.js";import{t as a}from"./useSidebarModel-BDfzya9Z.js";import"./public-DyoA5qbn.js";var o=n(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),s=e();function c({className:e}){let{t:n}=t(),{model:c}=a(),l=i(e=>e.drawerOpen),u=i(e=>e.setDrawerOpen),d=c.counts.attention;return(0,s.jsxs)(`button`,{type:`button`,"data-phone-menu":!0,"aria-haspopup":`dialog`,"aria-expanded":l,"aria-label":d>0?n(`navigation:phone.menuAttention`,{count:d}):n(`navigation:phone.menu`),className:r(`flex h-11 min-w-11 flex-none items-center justify-center gap-1.5 rounded-full bg-surface-muted px-2.5 text-content transition-colors duration-(--d-fast) focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus active:bg-surface-hover dark:bg-surface-active`,e),onClick:()=>u(!0),children:[(0,s.jsx)(o,{className:`size-5`,strokeWidth:1.75,"aria-hidden":`true`}),d>0&&(0,s.jsxs)(`span`,{"aria-hidden":`true`,"data-phone-attention":d,className:`flex h-5 items-center gap-1 rounded-full bg-warning-soft px-1.5 text-xs leading-none font-semibold text-warning-strong tabular-nums ring-1 ring-st-attn-border ring-inset`,children:[(0,s.jsx)(`span`,{className:`size-1.5 rounded-full bg-st-attn-fill`}),d>99?`99+`:d]})]})}export{c 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-AM3jlRYR.js";import{t as n}from"./PhoneMenuButton-C8pYulkt.js";import{t as r}from"./search-D0mqDaf_.js";import{t as i}from"./square-pen-hYbjKh6A.js";var a=e(),o=`grid size-11 flex-none place-items-center rounded-full bg-surface-muted text-content focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus active:bg-surface-hover dark:bg-surface-active`;function s({title:e,onNewTask:s,onSearch:c}){let{t:l}=t();return(0,a.jsxs)(`header`,{"data-phone-topbar":!0,"data-focus-region":`header`,className:`relative grid h-14 flex-none grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] items-center bg-panel px-3`,children:[(0,a.jsx)(`div`,{className:`flex min-w-0 items-center`,children:(0,a.jsx)(n,{})}),(0,a.jsx)(`p`,{"data-phone-title":!0,"aria-hidden":`true`,className:`max-w-[min(56vw,240px)] truncate text-center text-base leading-6 font-semibold text-content`,children:e}),(0,a.jsxs)(`div`,{className:`flex min-w-0 items-center justify-end gap-2`,children:[c&&(0,a.jsx)(`button`,{type:`button`,"data-phone-search":!0,"aria-label":l(`navigation:sidebar.search`),className:o,onClick:c,children:(0,a.jsx)(r,{className:`size-5`,strokeWidth:1.75,"aria-hidden":`true`})}),(0,a.jsx)(`button`,{type:`button`,"data-phone-new-task":!0,"aria-label":l(`navigation:shell.newTask`),className:o,onClick:s,children:(0,a.jsx)(i,{className:`size-5`,strokeWidth:1.75,"aria-hidden":`true`})})]})]})}export{s as PhoneTopBar};
|
|
@@ -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-BVRhlQ1v.js";import{t as i}from"./api-AeFmYDtL.js";import{i as a}from"./runtime-capabilities-B7qveLBm.js";import{t as o}from"./runtime-capabilities-store-Bd3gWIM7.js";import{t as s}from"./createLucideIcon-Cd-3GVxJ.js";import{t as c}from"./circle-check-iEdCm3Pw.js";import{t as l}from"./earth-Ddy13fHh.js";import{t as u}from"./external-link-CEQqPcqc.js";import{t as d}from"./eye-uWAPXNzJ.js";import{t as f}from"./file-code-corner-BnE1ljT0.js";import{t as p}from"./folder-open-FIShC5Qk.js";import{t as m}from"./image-BY_c3FYU.js";import{t as h}from"./package-BOmkLaKS.js";import{t as g}from"./plug-BsIeHRwC.js";import{t as _}from"./save-CHBB52P8.js";import{t as v}from"./search-D0mqDaf_.js";import{t as y}from"./server-BgNvmqwJ.js";import{t as ee}from"./shield-alert-oZqX6MNu.js";import{t as te}from"./trash-2-CNrPOoPR.js";import{t as b}from"./triangle-alert-CE1q54ci.js";import{t as x}from"./more-pages-D_PnxLN0.js";import{a as S}from"./dist-41X0pdUs.js";import{o as C,s as w}from"./dist-BsRXXcSL.js";import{a as T,c as E,i as D,l as O,n as k,o as ne,r as re,s as ie,t as ae}from"./dist-BHkR6BLP.js";import{t as A}from"./utils-C8uzG5AZ.js";import{n as oe,t as j}from"./button-CCcCN8tE.js";import{s as se}from"./shortcuts-Dsd4mjfP.js";import{a as ce,i as M,l as N,o as P,s as F,t as I}from"./dialog-BDNbY1pW.js";import{t as L}from"./input-CPw-zkYh.js";import{t as R}from"./pick-system-directory-CaiscVfr.js";import{n as le,t as ue}from"./PageState-Cz6vFMXv.js";import{a as de,i as z,n as B,o as V,r as fe,s as pe,t as H}from"./FeaturePage-bqByIxYg.js";import{t as U}from"./AppSelect-DQYKUW5E.js";import{c as me,i as he,s as ge}from"./app-primitives-Drz_SjnR.js";import{a as W,i as _e,n as ve,o as ye,r as G,s as be,t as xe}from"./tool-labels-D-3gybP7.js";var K=s(`mouse-pointer-2`,[[`path`,{d:`M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z`,key:`edeuup`}]]),q=s(`package-plus`,[[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`path`,{d:`M16 17h6`,key:`1ook5g`}],[`path`,{d:`M19 14v6`,key:`1ckrd5`}],[`path`,{d:`M21 10.535V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l1.675-.955`,key:`28k6lz`}],[`path`,{d:`M3.29 7 12 12l8.71-5`,key:`19ckod`}],[`path`,{d:`m7.5 4.27 8.997 5.148`,key:`9yrvtv`}]]),J=e(t(),1),Y=n(),X=Object.defineProperty,Z=(e,t)=>X(e,`name`,{value:t,configurable:!0}),[Se,Ce]=w(`AlertDialog`,[O]),Q=O(),we=Z(e=>{let{__scopeAlertDialog:t,...n}=e,r=Q(t);return(0,Y.jsx)(ae,{...r,...n,modal:!0})},`AlertDialog`);J.forwardRef(Z(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Q(n);return(0,Y.jsx)(E,{...i,...r,ref:t})},`AlertDialogTrigger`));var Te=Z(e=>{let{__scopeAlertDialog:t,...n}=e,r=Q(t);return(0,Y.jsx)(ne,{...r,...n})},`AlertDialogPortal`),Ee=J.forwardRef(Z(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Q(n);return(0,Y.jsx)(T,{...i,...r,ref:t})},`AlertDialogOverlay`)),[$,De]=Se(`AlertDialogContent`),Oe=J.forwardRef(Z(function(e,t){let{__scopeAlertDialog:n,children:r,...i}=e,a=Q(n),o=J.useRef(null),s=S(t,o),c=J.useRef(null);return(0,Y.jsx)($,{scope:n,cancelRef:c,children:(0,Y.jsx)(re,{role:`alertdialog`,...a,...i,ref:s,onOpenAutoFocus:C(i.onOpenAutoFocus,e=>{e.preventDefault(),c.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:r})})},`AlertDialogContent`)),ke=J.forwardRef(Z(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Q(n);return(0,Y.jsx)(ie,{...i,...r,ref:t})},`AlertDialogTitle`)),Ae=J.forwardRef(Z(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Q(n);return(0,Y.jsx)(D,{...i,...r,ref:t})},`AlertDialogDescription`)),je=J.forwardRef(Z(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Q(n);return(0,Y.jsx)(k,{...i,...r,ref:t})},`AlertDialogAction`)),Me=`AlertDialogCancel`,Ne=J.forwardRef(Z(function(e,t){let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=De(Me,n),a=Q(n),o=S(t,i);return(0,Y.jsx)(k,{...a,...r,ref:o})},`AlertDialogCancel`)),Pe=we,Fe=Te,Ie=Ee,Le=Oe,Re=je,ze=Ne,Be=ke,Ve=Ae;function He({...e}){return(0,Y.jsx)(Pe,{"data-slot":`alert-dialog`,...e})}function Ue({...e}){return(0,Y.jsx)(Fe,{"data-slot":`alert-dialog-portal`,...e})}function We({className:e,...t}){return(0,Y.jsx)(Ie,{"data-slot":`alert-dialog-overlay`,className:A(`fixed inset-0 z-50 bg-[var(--overlay-scrim)] duration-100 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function Ge({className:e,size:t=`default`,...n}){return(0,Y.jsxs)(Ue,{children:[(0,Y.jsx)(We,{}),(0,Y.jsx)(Le,{"data-slot":`alert-dialog-content`,"data-size":t,className:A(`group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid max-h-[calc(100vh-2rem)] supports-[height:100dvh]:max-h-[calc(100dvh-2rem)] w-full -translate-x-1/2 -translate-y-1/2 gap-4 overflow-y-auto overscroll-contain rounded-xl bg-popover p-4 text-popover-foreground shadow-float duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...n})]})}function Ke({className:e,...t}){return(0,Y.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:A(`grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]`,e),...t})}function qe({className:e,...t}){return(0,Y.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:A(`-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t border-stroke bg-surface-subtle px-4 py-3 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end`,e),...t})}function Je({className:e,...t}){return(0,Y.jsx)(Be,{"data-slot":`alert-dialog-title`,className:A(`font-heading text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2`,e),...t})}function Ye({className:e,...t}){return(0,Y.jsx)(Ve,{"data-slot":`alert-dialog-description`,className:A(`text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function Xe({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,Y.jsx)(j,{variant:t,size:n,asChild:!0,children:(0,Y.jsx)(Re,{"data-slot":`alert-dialog-action`,className:A(e),...r})})}function Ze({className:e,variant:t=`outline`,size:n=`default`,...r}){return(0,Y.jsx)(j,{variant:t,size:n,asChild:!0,children:(0,Y.jsx)(ze,{"data-slot":`alert-dialog-cancel`,className:A(e),...r})})}function Qe(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function $e({open:e,onOpenChange:t,onInstalled:n}){let{t:a}=r(),[o,s]=(0,J.useState)(``),[l,u]=(0,J.useState)(null),[d,f]=(0,J.useState)(!1),[m,h]=(0,J.useState)(``);return(0,J.useEffect)(()=>{e||(s(``),u(null),f(!1),h(``))},[e]),(0,Y.jsx)(I,{open:e,onOpenChange:e=>!d&&t(e),children:(0,Y.jsxs)(M,{className:`z-[220] sm:max-w-xl`,overlayClassName:`z-[220]`,children:[(0,Y.jsxs)(F,{children:[(0,Y.jsxs)(N,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(q,{className:`size-4 text-content-secondary`}),a(`plugins:pluginsPage.installLocalPlugin`)]}),(0,Y.jsx)(ce,{children:a(`plugins:pluginsPage.installLocalPluginDescription`)})]}),(0,Y.jsxs)(`div`,{className:`grid gap-3`,children:[(0,Y.jsxs)(`label`,{className:`grid gap-1.5 text-xs font-medium text-content-secondary`,children:[a(`plugins:pluginsPage.pluginDirectory`),(0,Y.jsxs)(`span`,{className:`flex min-w-0 gap-2`,children:[(0,Y.jsx)(L,{className:`min-w-0 flex-1 font-mono text-xs max-[650px]:h-11`,value:o,disabled:d,placeholder:a(`plugins:pluginsPage.pluginDirectoryPlaceholder`),onChange:e=>{s(e.target.value),u(null)}}),(0,Y.jsx)(j,{type:`button`,variant:`secondary`,size:`icon`,className:`size-[34px] shrink-0 max-[650px]:size-11`,title:a(`plugins:pluginsPage.chooseDirectory`),"aria-label":a(`plugins:pluginsPage.chooseDirectory`),onClick:async()=>{h(``);try{let e=await R(o,a(`plugins:pluginsPage.chooseDirectory`));e.status===`picked`?(s(e.path),u(null)):e.status===`unavailable`&&h(a(`common:workspacePicker.systemPickerUnavailable`))}catch(e){h(e instanceof Error?e.message:String(e))}},children:(0,Y.jsx)(p,{})})]})]}),l&&(0,Y.jsxs)(`div`,{className:`grid gap-3 overflow-hidden rounded-md border border-stroke bg-surface-subtle p-3`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,Y.jsx)(`span`,{className:`grid size-8 shrink-0 place-items-center rounded-sm bg-success-soft text-success`,children:(0,Y.jsx)(c,{className:`size-4`})}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`strong`,{className:`block truncate text-sm font-medium text-content`,children:l.plugin.name}),(0,Y.jsxs)(`small`,{className:`block truncate font-mono text-xs text-content-muted tabular-nums`,children:[l.plugin.id,` · v`,l.plugin.version,` · `,l.fileCount,` `,a(`plugins:pluginsPage.files`),` · `,Qe(l.byteCount)]})]})]}),(0,Y.jsx)(`div`,{className:`grid gap-1.5`,children:l.plugin.capabilities.map(e=>(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-3 border-t border-stroke-soft pt-2 text-xs`,children:[(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[(0,Y.jsx)(`strong`,{className:`block font-medium text-content`,children:e.label}),(0,Y.jsx)(`small`,{className:`text-xs text-content-muted`,children:e.description})]}),(0,Y.jsx)(`code`,{className:`shrink-0 font-mono text-xs text-content-secondary`,children:e.name})]},e.name))}),(0,Y.jsxs)(`div`,{className:`flex items-start gap-2 rounded-sm bg-warning-soft p-2.5 text-xs leading-5 text-warning-strong`,children:[(0,Y.jsx)(b,{className:`mt-0.5 shrink-0`,size:15}),(0,Y.jsx)(`span`,{children:a(`plugins:pluginsPage.localPluginSecurityWarning`)})]})]}),m&&(0,Y.jsxs)(he,{className:`m-0`,children:[(0,Y.jsx)(b,{size:14}),(0,Y.jsx)(`span`,{children:m})]})]}),(0,Y.jsxs)(P,{children:[(0,Y.jsx)(j,{type:`button`,variant:`secondary`,size:`dialogAction`,disabled:d,onClick:()=>t(!1),children:a(`common:ui.cancel`)}),(0,Y.jsxs)(j,{type:`button`,size:`dialogAction`,disabled:d||!l&&!o.trim(),onClick:l?async()=>{if(!(!l||d)){f(!0),h(``);try{await i(`/api/plugins/install`,{method:`POST`,body:JSON.stringify({inspectionId:l.inspectionId})}),await n(),t(!1)}catch(e){h(e instanceof Error?e.message:String(e))}finally{f(!1)}}}:async()=>{if(!(!o.trim()||d)){f(!0),h(``);try{u(await i(`/api/plugins/inspect`,{method:`POST`,body:JSON.stringify({path:o.trim()})}))}catch(e){u(null),h(e instanceof Error?e.message:String(e))}finally{f(!1)}}},children:[d?(0,Y.jsx)(oe,{className:`text-current`}):l?(0,Y.jsx)(q,{}):(0,Y.jsx)(c,{}),a(d?`plugins:pluginsPage.processing`:l?`plugins:pluginsPage.installPlugin`:`plugins:pluginsPage.inspectPlugin`)]})]})]})})}var et=[`tool`,`prompt`,`skill`];function tt(e){let t=Array.isArray(e.resourceTypes)?e.resourceTypes.filter(e=>et.includes(e)):[];return t.length?t:[`tool`]}function nt(e,t){return{tool:t(`plugins:pluginsPage.extensionType.tool`),prompt:t(`plugins:pluginsPage.extensionType.prompt`),skill:t(`plugins:pluginsPage.extensionType.skill`)}[e]}var rt=[`all`,`builtin`,`local`],it={read:d,ls:p,grep:v,find:v,edit:f,write:f,bash:y,web_search:l,browser_automation:l,computer_use:K,generate_visual:m};function at(e,t){return t(e===`builtin`?`plugins:pluginsPage.builtIn`:e===`local`?`plugins:pluginsPage.local`:`plugins:pluginsPage.all`)}function ot(e){return e.flatMap(e=>e.managedExternally?[]:e.capabilities.filter(e=>e.enabled).map(e=>e.name))}function st(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 ct(e){return Object.fromEntries(e.filter(e=>e.source===`pi`&&e.name!==`Computer Use`&&!!e.packageSource).map(e=>[e.packageSource,e.enabled!==!1]))}function lt(e,t){return[...e].sort().join(`\0`)===[...t].sort().join(`\0`)}function ut(e,t){return W({id:e.name,name:e.label},t)}function dt(e,t){return e.pluginSource===`pi`?e.pluginName:G(e.pluginName,t)}function ft({value:e,testing:t,onChange:n,onTest:i}){let{t:a}=r();return(0,Y.jsxs)(`div`,{className:`plugin-tool-config grid gap-2.5 border-t border-stroke pt-3 [&_label]:grid [&_label]:gap-1.5 [&_label]:text-xs [&_label]:font-medium [&_label]:text-content-secondary`,children:[(0,Y.jsxs)(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-3`,children:[(0,Y.jsxs)(`label`,{children:[a(`plugins:pluginsPage.defaultLanguage`),(0,Y.jsxs)(U,{value:e.language,onChange:t=>n({...e,language:t.target.value}),children:[(0,Y.jsx)(`option`,{value:`auto`,children:a(`plugins:pluginsPage.auto`)}),(0,Y.jsx)(`option`,{value:`zh-CN`,children:a(`plugins:pluginsPage.simplifiedChinese`)}),(0,Y.jsx)(`option`,{value:`en-US`,children:a(`plugins:pluginsPage.english`)})]})]}),(0,Y.jsxs)(`label`,{children:[a(`plugins:pluginsPage.safeSearch`),(0,Y.jsxs)(U,{value:e.safeSearch,onChange:t=>n({...e,safeSearch:Number(t.target.value)}),children:[(0,Y.jsx)(`option`,{value:0,children:a(`plugins:pluginsPage.off`)}),(0,Y.jsx)(`option`,{value:1,children:a(`plugins:pluginsPage.moderate`)}),(0,Y.jsx)(`option`,{value:2,children:a(`plugins:pluginsPage.strict`)})]})]}),(0,Y.jsxs)(`label`,{children:[a(`plugins:pluginsPage.resultCount`),(0,Y.jsx)(L,{type:`number`,min:`1`,max:`12`,className:`tabular-nums`,value:e.maxResults,onChange:t=>n({...e,maxResults:Number(t.target.value)})})]})]}),(0,Y.jsxs)(j,{type:`button`,variant:`secondary`,className:`justify-self-end max-[650px]:h-11`,loading:t,disabled:t,onClick:i,children:[(0,Y.jsx)(l,{}),a(t?`plugins:pluginsPage.testing`:`plugins:pluginsPage.testConnection`)]})]})}function pt({query:e,notify:t,requestText:n,requestConfirm:a}){let{t:o}=r(),[s,c]=(0,J.useState)(``),[l,d]=(0,J.useState)(null),[f,p]=(0,J.useState)([]),[m,g]=(0,J.useState)(!1),[_,y]=(0,J.useState)(``),[ee,b]=(0,J.useState)(``),x=(0,J.useCallback)(async(e=``)=>{g(!0),b(``);try{let[t,n]=await Promise.all([i(`/api/extensions/market?name=${encodeURIComponent(e)}`),i(`/api/extensions`)]);d(t),p(n.packages||[])}catch(e){b(e instanceof Error?e.message:String(e))}finally{g(!1)}},[]);(0,J.useEffect)(()=>{x(``)},[x]);let S=(l?.packages||[]).filter(t=>`${t.name} ${t.description}`.toLowerCase().includes(e.trim().toLowerCase())),C=async e=>{if(await a?.({title:o(`plugins:pluginsPage.installExtension`),message:o(`plugins:pluginsPage.extensionSecurityWarning`,{name:e}),confirmLabel:o(`plugins:pluginsPage.installExtension`),tone:`danger`})!==!1){y(e);try{let n=/^(?:[.~\\/]|[A-Za-z]:[\\/])/.test(e)||/^(?:npm:|https?:\/\/|git\+)/i.test(e)?e:`npm:${e}`,r=await i(`/api/extensions/install`,{method:`POST`,body:JSON.stringify({source:n})});p(r.packages||[]),t(o(`plugins:pluginsPage.extensionInstalled`),`success`)}catch(e){t(e instanceof Error?e.message:String(e),`error`)}finally{y(``)}}},w=async()=>{let e=await n?.({title:o(`plugins:pluginsPage.installExtension`),message:o(`plugins:pluginsPage.extensionSourceHelp`),inputLabel:o(`plugins:pluginsPage.extensionSource`),placeholder:`npm:@scope/package or https://github.com/…`,maxLength:2e3});e?.trim()&&await C(e.trim())},T=async e=>{if(await a?.({title:o(`plugins:pluginsPage.uninstallExtension`),message:o(`plugins:pluginsPage.uninstallExtensionDescription`,{name:e.name}),confirmLabel:o(`plugins:pluginsPage.uninstallExtension`),tone:`danger`})!==!1){y(e.source);try{await i(`/api/extensions`,{method:`DELETE`,body:JSON.stringify({source:e.source,scope:e.scope})}),await x(s),t(o(`plugins:pluginsPage.extensionUninstalled`),`success`)}catch(e){t(e instanceof Error?e.message:String(e),`error`)}finally{y(``)}}},E=et.map(e=>({type:e,items:f.filter(t=>tt(t).includes(e))})).filter(e=>e.items.length>0);return(0,Y.jsxs)(Y.Fragment,{children:[E.map(e=>(0,Y.jsx)(V,{className:`plugin-installed-extensions`,title:`${o(`plugins:pluginsPage.installedExtensions`)} · ${nt(e.type,o)}`,count:e.items.length,children:(0,Y.jsx)(B,{children:e.items.map(t=>(0,Y.jsx)(z,{icon:(0,Y.jsx)(h,{}),name:(0,Y.jsx)(`span`,{className:`font-mono`,children:t.name}),nameMeta:`v${t.version}`,description:(0,Y.jsx)(`span`,{className:`font-mono text-xs`,children:t.source}),actions:(0,Y.jsxs)(j,{type:`button`,variant:`ghost`,size:`sm`,className:`text-content-muted hover:bg-danger-soft hover:text-danger`,loading:_===t.source,disabled:!!_,onClick:()=>void T(t),children:[(0,Y.jsx)(te,{}),o(`plugins:pluginsPage.uninstallExtension`)]})},`${e.type}:${t.scope}:${t.source}`))})},e.type)),(0,Y.jsxs)(V,{className:`plugin-market`,title:o(`plugins:pluginsPage.extensionMarket`),actions:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(j,{asChild:!0,variant:`ghost`,size:`sm`,children:(0,Y.jsxs)(`a`,{href:`https://pi.dev/packages`,target:`_blank`,rel:`noreferrer`,children:[(0,Y.jsx)(u,{}),o(`plugins:pluginsPage.openPackageCatalog`)]})}),(0,Y.jsxs)(j,{type:`button`,variant:`secondary`,size:`sm`,onClick:w,disabled:!!_,children:[(0,Y.jsx)(q,{}),o(`plugins:pluginsPage.installExtension`)]})]}),children:[(0,Y.jsxs)(`form`,{className:`mb-3 flex min-w-0 gap-2`,onSubmit:e=>{e.preventDefault(),x(s)},children:[(0,Y.jsx)(L,{className:`min-w-0 flex-1 max-[650px]:h-11`,value:s,onChange:e=>c(e.target.value),placeholder:o(`plugins:pluginsPage.searchPackageCatalog`),"aria-label":o(`plugins:pluginsPage.searchPackageCatalog`)}),(0,Y.jsxs)(j,{type:`submit`,variant:`secondary`,className:`h-[34px] max-[650px]:h-11`,loading:m,disabled:m,children:[(0,Y.jsx)(v,{}),o(`plugins:pluginsPage.search`)]})]}),ee&&(0,Y.jsx)(H,{className:`mt-0 mb-3`,children:ee}),S.length>0&&(0,Y.jsx)(B,{children:S.slice(0,12).map(e=>{let t=f.some(t=>t.name===e.name||t.source===`npm:${e.name}`);return(0,Y.jsx)(z,{icon:(0,Y.jsx)(h,{}),name:(0,Y.jsx)(`span`,{className:`font-mono`,children:e.name}),description:e.description,status:e.published,actions:(0,Y.jsx)(j,{type:`button`,variant:`secondary`,size:`sm`,loading:_===e.name,disabled:t||!!_,onClick:()=>void C(e.name),children:o(t?`plugins:pluginsPage.installed`:`plugins:pluginsPage.installExtension`)})},e.name)})})]})]})}function mt({notify:e,onBack:t,requestText:n,requestConfirm:s}){let{t:c}=r(),l=se(`focusSearch`),u=o(e=>e.capabilities),d=a(u,`plugins`),f=d?rt:rt.slice(0,2),[p,m]=(0,J.useState)(``),[h,v]=(0,J.useState)(null),[y,S]=(0,J.useState)([]),[C,w]=(0,J.useState)(``),[T,E]=(0,J.useState)(`all`),[D,O]=(0,J.useState)({provider:`bing`,language:`auto`,safeSearch:1,maxResults:8}),[k,ne]=(0,J.useState)(!1),[re,ie]=(0,J.useState)(!1),[ae,ce]=(0,J.useState)(!1),[M,N]=(0,J.useState)(null),[P,F]=(0,J.useState)(!1),[I,L]=(0,J.useState)(``),[R,H]=(0,J.useState)(!1),U=(0,J.useCallback)(e=>{v(e),S(e.plugins),O(e.webSearch)},[]),W=(0,J.useCallback)(async()=>{L(``);try{U(await i(`/api/plugins`))}catch(e){L(e instanceof Error?e.message:String(e))}},[U]);(0,J.useEffect)(()=>{W()},[W]);let G=(0,J.useMemo)(()=>st(y),[y]),K=(0,J.useMemo)(()=>ot(y),[y]),X=h?!lt(K,h.enabledTools)||JSON.stringify(ct(y))!==JSON.stringify(h.piExtensions)||JSON.stringify(D)!==JSON.stringify(h.webSearch):!1,Z=(0,J.useCallback)(async()=>{if(!k){if(!h||!X){h&&e(c(`plugins:pluginsPage.noPluginPolicyChanges`));return}ne(!0),L(``);try{let t=await i(`/api/plugins`,{method:`PUT`,body:JSON.stringify({enabledTools:K,webSearch:D,piExtensions:ct(y)})});U(t),e(c(`plugins:pluginsPage.pluginPolicySavedAgentRuntimeUpdated`))}catch(e){L(e instanceof Error?e.message:String(e))}finally{ne(!1)}}},[U,h,X,y,K,e,k,c,D]),Se=async()=>{ie(!0),L(``);try{let t=await i(`/api/plugins/web-search/test`,{method:`POST`,body:JSON.stringify(D)});e(c(`plugins:pluginsPage.bingSearchIsAvailableAndReturnedCountResults`,{count:t.count}))}catch(t){let n=t instanceof Error?t.message:String(t);L(n),e(n,`error`)}finally{ie(!1)}},Ce=(e,t,n)=>{S(r=>r.map(r=>{if(r.id!==e)return r;let i=r.source===`pi`&&r.managedExternally;return{...r,enabled:n||r.capabilities.some(e=>e.enabled),capabilities:r.capabilities.map(e=>i||e.name===t?{...e,enabled:n}:e)}}))},Q=()=>!X||(L(c(`plugins:pluginsPage.saveBeforePluginChanges`)),!1),we=async()=>{if(!(!M||P)){F(!0),L(``);try{U(await i(`/api/plugins/${encodeURIComponent(M.pluginId)}`,{method:`DELETE`})),e(c(`plugins:pluginsPage.pluginUninstalled`,{name:M.pluginName})),w(``),N(null)}catch(e){L(e instanceof Error?e.message:String(e))}finally{F(!1)}}},Te=c(`navigation:navigation.plugins`),Ee=p.trim().toLowerCase(),$=G.filter(e=>T!==`all`&&e.pluginSource!==T?!1:[ut(e,c),e.name,e.description,dt(e,c),e.pluginId].join(` `).toLowerCase().includes(Ee));return(0,Y.jsxs)(fe,{title:Te,description:c(`plugins:pluginsPage.lede`),back:t&&{label:c(`navigation:sidebar.features`),ariaLabel:c(`navigation:shell.backToFeaturesLabel`),onBack:t},toolbar:(0,Y.jsx)(pe,{search:(0,Y.jsx)(de,{id:x,value:p,onValueChange:m,placeholder:c(`navigation:pageHeader.searchPage`,{page:Te}),shortcut:l,clearLabel:c(`navigation:more.clearSearch`)}),actions:(0,Y.jsxs)(Y.Fragment,{children:[d&&(0,Y.jsxs)(j,{type:`button`,variant:`secondary`,className:`h-9`,disabled:!h,onClick:()=>Q()&&ce(!0),children:[(0,Y.jsx)(q,{}),c(`plugins:pluginsPage.installPlugin`)]}),(0,Y.jsxs)(j,{type:`button`,className:`h-9`,"data-plugins-save":!0,loading:k,disabled:!h||k,onClick:()=>void Z(),children:[(0,Y.jsx)(_,{}),c(`plugins:pluginsPage.savePolicy`)]})]}),filters:(0,Y.jsx)(me,{options:f.map(e=>at(e,c)),value:at(T,c),onChange:e=>E(f.find(t=>at(t,c)===e)||`all`)})}),children:[h?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(V,{className:`plugin-catalog`,title:c(`plugins:pluginsPage.toolCatalog`),count:$.length,meta:(0,Y.jsxs)(`span`,{className:`plugin-catalog-summary`,children:[G.filter(e=>e.enabled).length,`/`,G.length,` `,c(`plugins:pluginsPage.enabled2`)]}),actions:X&&(0,Y.jsxs)(`span`,{"data-plugins-unsaved":!0,className:`flex items-center gap-1.5 text-xs font-medium text-content-secondary`,children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`size-1.5 rounded-full bg-content-secondary`}),c(`plugins:pluginsPage.unsaved`)]}),children:$.length?(0,Y.jsx)(B,{className:`plugin-tool-grid`,children:$.map(e=>{let t=it[e.name]||g,n=ut(e,c);return(0,Y.jsx)(z,{className:`plugin-tool-card`,"data-plugin-tool":e.name,icon:(0,Y.jsx)(t,{}),name:(0,Y.jsx)(`span`,{title:n,children:n}),nameMeta:e.name,description:`${dt(e,c)} · ${ye(e.risk,c)}`,status:e.pluginBuiltIn?void 0:c(`plugins:pluginsPage.local`),actions:(0,Y.jsx)(ge,{value:e.enabled,onChange:t=>Ce(e.pluginId,e.name,t),ariaLabel:n}),expanded:C===e.name,onExpandedChange:t=>w(t?e.name:``),toggleLabel:c(`plugins:pluginsPage.toggleToolDetails`,{name:n}),detail:(0,Y.jsxs)(`div`,{className:`plugin-tool-details grid gap-3`,children:[(0,Y.jsx)(`p`,{className:`text-sm leading-relaxed text-content-soft`,children:_e({id:e.name,description:e.description},c)}),(0,Y.jsxs)(`dl`,{className:`grid grid-cols-[88px_minmax(0,1fr)] gap-x-3 gap-y-1.5 text-xs [&_dd]:min-w-0 [&_dd]:[overflow-wrap:anywhere] [&_dd]:text-content-soft [&_dt]:text-content-muted [&>div]:contents`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{children:c(`plugins:pluginsPage.source`)}),(0,Y.jsxs)(`dd`,{className:`tabular-nums`,children:[dt(e,c),!e.pluginBuiltIn&&` · v${e.pluginVersion}`]})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{children:c(`plugins:pluginsPage.riskLevel`)}),(0,Y.jsx)(`dd`,{className:A((xe(e.risk)||ve(e.risk))&&`font-medium text-content!`),children:ye(e.risk,c)})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{children:c(`plugins:pluginsPage.pathScope`)}),(0,Y.jsx)(`dd`,{children:be({id:e.name,scope:e.scope},c)})]}),!e.pluginBuiltIn&&(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{children:c(`plugins:pluginsPage.executionMode`)}),(0,Y.jsx)(`dd`,{children:c(`plugins:pluginsPage.confirmUnlessFullAccess`)})]})]}),!e.pluginBuiltIn&&(0,Y.jsxs)(`div`,{className:`plugin-tool-warning flex items-start gap-2 rounded-sm bg-surface-subtle p-2.5 text-xs leading-normal text-content-secondary`,children:[(0,Y.jsx)(ee,{className:`mt-px size-3.5 shrink-0`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{children:c(`plugins:pluginsPage.localPluginSecurityWarning`)})]}),e.name===`web_search`&&(0,Y.jsx)(ft,{value:D,testing:re,onChange:O,onTest:Se}),!e.pluginBuiltIn&&(0,Y.jsxs)(j,{type:`button`,variant:`ghost`,className:`justify-self-end text-danger hover:bg-danger-soft hover:text-danger max-[650px]:h-11`,onClick:()=>Q()&&N(e),children:[(0,Y.jsx)(te,{}),c(`plugins:pluginsPage.uninstallPlugin`)]})]})},e.name)})}):(0,Y.jsx)(ue,{compact:!0,title:c(`plugins:pluginsPage.noMatchingTools`)})}),(0,Y.jsx)(pt,{query:p,notify:e,requestText:n,requestConfirm:s})]}):I?(0,Y.jsx)(le,{kind:`error`,title:c(`plugins:pluginsPage.loadFailed`),description:I,action:(0,Y.jsx)(j,{variant:`secondary`,className:`max-[650px]:h-11`,loading:R,disabled:R,onClick:()=>{H(!0),W().finally(()=>H(!1))},children:c(`common:pageTemplate.retry`)})}):(0,Y.jsx)(le,{kind:`loading`,title:c(`plugins:pluginsPage.loadingToolPlugins`)}),d&&(0,Y.jsx)($e,{open:ae,onOpenChange:ce,onInstalled:W}),(0,Y.jsx)(He,{open:!!M,onOpenChange:e=>!e&&!P&&N(null),children:(0,Y.jsxs)(Ge,{className:`z-[220]`,children:[(0,Y.jsxs)(Ke,{children:[(0,Y.jsx)(Je,{children:c(`plugins:pluginsPage.uninstallPlugin`)}),(0,Y.jsx)(Ye,{children:c(`plugins:pluginsPage.uninstallPluginDescription`,{name:M?.pluginName||``})})]}),(0,Y.jsxs)(qe,{children:[(0,Y.jsx)(Ze,{disabled:P,children:c(`common:ui.cancel`)}),(0,Y.jsxs)(Xe,{variant:`destructive`,disabled:P,onClick:we,children:[P&&(0,Y.jsx)(oe,{className:`text-current`}),c(`plugins:pluginsPage.uninstallPlugin`)]})]})]})}),I&&h&&(0,Y.jsxs)(he,{className:`fixed right-6 bottom-6 z-[21] max-w-[360px] border border-danger-border shadow-float`,children:[(0,Y.jsx)(b,{size:13}),I]})]})}export{mt as PluginsPage};
|
|
1
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-AM3jlRYR.js";import{t as i}from"./api-BhPOJ07B.js";import{i as a}from"./runtime-capabilities-B7qveLBm.js";import{t as o}from"./runtime-capabilities-store-D0EC-a9c.js";import{t as s}from"./createLucideIcon-Cd-3GVxJ.js";import{t as c}from"./circle-check-iEdCm3Pw.js";import{t as l}from"./earth-Ddy13fHh.js";import{t as u}from"./external-link-CEQqPcqc.js";import{t as d}from"./eye-uWAPXNzJ.js";import{t as f}from"./file-code-corner-BnE1ljT0.js";import{t as p}from"./folder-open-FIShC5Qk.js";import{t as m}from"./image-BY_c3FYU.js";import{t as h}from"./package-BOmkLaKS.js";import{t as g}from"./plug-BsIeHRwC.js";import{t as _}from"./save-CHBB52P8.js";import{t as v}from"./search-D0mqDaf_.js";import{t as y}from"./server-BgNvmqwJ.js";import{t as ee}from"./shield-alert-oZqX6MNu.js";import{t as te}from"./trash-2-CNrPOoPR.js";import{t as b}from"./triangle-alert-CE1q54ci.js";import{t as x}from"./more-pages-D_PnxLN0.js";import{a as S}from"./dist-41X0pdUs.js";import{o as C,s as w}from"./dist-BsRXXcSL.js";import{a as T,c as E,i as D,l as O,n as k,o as ne,r as re,s as ie,t as ae}from"./dist-BHkR6BLP.js";import{t as A}from"./utils-C8uzG5AZ.js";import{n as oe,t as j}from"./button-CCcCN8tE.js";import{s as se}from"./shortcuts-BsrTXPiU.js";import{a as ce,i as M,l as N,o as P,s as F,t as I}from"./dialog-BVAtioHy.js";import{t as L}from"./input-CPw-zkYh.js";import{t as R}from"./pick-system-directory-COxOQmRm.js";import{n as le,t as ue}from"./PageState-Cz6vFMXv.js";import{a as de,i as z,n as B,o as V,r as fe,s as pe,t as H}from"./FeaturePage-C4fMefC-.js";import{t as U}from"./AppSelect-DQYKUW5E.js";import{c as me,i as he,s as ge}from"./app-primitives-Drz_SjnR.js";import{a as W,i as _e,n as ve,o as ye,r as G,s as be,t as xe}from"./tool-labels-D-3gybP7.js";var K=s(`mouse-pointer-2`,[[`path`,{d:`M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z`,key:`edeuup`}]]),q=s(`package-plus`,[[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`path`,{d:`M16 17h6`,key:`1ook5g`}],[`path`,{d:`M19 14v6`,key:`1ckrd5`}],[`path`,{d:`M21 10.535V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l1.675-.955`,key:`28k6lz`}],[`path`,{d:`M3.29 7 12 12l8.71-5`,key:`19ckod`}],[`path`,{d:`m7.5 4.27 8.997 5.148`,key:`9yrvtv`}]]),J=e(t(),1),Y=n(),X=Object.defineProperty,Z=(e,t)=>X(e,`name`,{value:t,configurable:!0}),[Se,Ce]=w(`AlertDialog`,[O]),Q=O(),we=Z(e=>{let{__scopeAlertDialog:t,...n}=e,r=Q(t);return(0,Y.jsx)(ae,{...r,...n,modal:!0})},`AlertDialog`);J.forwardRef(Z(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Q(n);return(0,Y.jsx)(E,{...i,...r,ref:t})},`AlertDialogTrigger`));var Te=Z(e=>{let{__scopeAlertDialog:t,...n}=e,r=Q(t);return(0,Y.jsx)(ne,{...r,...n})},`AlertDialogPortal`),Ee=J.forwardRef(Z(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Q(n);return(0,Y.jsx)(T,{...i,...r,ref:t})},`AlertDialogOverlay`)),[$,De]=Se(`AlertDialogContent`),Oe=J.forwardRef(Z(function(e,t){let{__scopeAlertDialog:n,children:r,...i}=e,a=Q(n),o=J.useRef(null),s=S(t,o),c=J.useRef(null);return(0,Y.jsx)($,{scope:n,cancelRef:c,children:(0,Y.jsx)(re,{role:`alertdialog`,...a,...i,ref:s,onOpenAutoFocus:C(i.onOpenAutoFocus,e=>{e.preventDefault(),c.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:r})})},`AlertDialogContent`)),ke=J.forwardRef(Z(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Q(n);return(0,Y.jsx)(ie,{...i,...r,ref:t})},`AlertDialogTitle`)),Ae=J.forwardRef(Z(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Q(n);return(0,Y.jsx)(D,{...i,...r,ref:t})},`AlertDialogDescription`)),je=J.forwardRef(Z(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Q(n);return(0,Y.jsx)(k,{...i,...r,ref:t})},`AlertDialogAction`)),Me=`AlertDialogCancel`,Ne=J.forwardRef(Z(function(e,t){let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=De(Me,n),a=Q(n),o=S(t,i);return(0,Y.jsx)(k,{...a,...r,ref:o})},`AlertDialogCancel`)),Pe=we,Fe=Te,Ie=Ee,Le=Oe,Re=je,ze=Ne,Be=ke,Ve=Ae;function He({...e}){return(0,Y.jsx)(Pe,{"data-slot":`alert-dialog`,...e})}function Ue({...e}){return(0,Y.jsx)(Fe,{"data-slot":`alert-dialog-portal`,...e})}function We({className:e,...t}){return(0,Y.jsx)(Ie,{"data-slot":`alert-dialog-overlay`,className:A(`fixed inset-0 z-50 bg-[var(--overlay-scrim)] duration-100 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function Ge({className:e,size:t=`default`,...n}){return(0,Y.jsxs)(Ue,{children:[(0,Y.jsx)(We,{}),(0,Y.jsx)(Le,{"data-slot":`alert-dialog-content`,"data-size":t,className:A(`group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid max-h-[calc(100vh-2rem)] supports-[height:100dvh]:max-h-[calc(100dvh-2rem)] w-full -translate-x-1/2 -translate-y-1/2 gap-4 overflow-y-auto overscroll-contain rounded-xl bg-popover p-4 text-popover-foreground shadow-float duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...n})]})}function Ke({className:e,...t}){return(0,Y.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:A(`grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]`,e),...t})}function qe({className:e,...t}){return(0,Y.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:A(`-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t border-stroke bg-surface-subtle px-4 py-3 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end`,e),...t})}function Je({className:e,...t}){return(0,Y.jsx)(Be,{"data-slot":`alert-dialog-title`,className:A(`font-heading text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2`,e),...t})}function Ye({className:e,...t}){return(0,Y.jsx)(Ve,{"data-slot":`alert-dialog-description`,className:A(`text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function Xe({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,Y.jsx)(j,{variant:t,size:n,asChild:!0,children:(0,Y.jsx)(Re,{"data-slot":`alert-dialog-action`,className:A(e),...r})})}function Ze({className:e,variant:t=`outline`,size:n=`default`,...r}){return(0,Y.jsx)(j,{variant:t,size:n,asChild:!0,children:(0,Y.jsx)(ze,{"data-slot":`alert-dialog-cancel`,className:A(e),...r})})}function Qe(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function $e({open:e,onOpenChange:t,onInstalled:n}){let{t:a}=r(),[o,s]=(0,J.useState)(``),[l,u]=(0,J.useState)(null),[d,f]=(0,J.useState)(!1),[m,h]=(0,J.useState)(``);return(0,J.useEffect)(()=>{e||(s(``),u(null),f(!1),h(``))},[e]),(0,Y.jsx)(I,{open:e,onOpenChange:e=>!d&&t(e),children:(0,Y.jsxs)(M,{className:`z-[220] sm:max-w-xl`,overlayClassName:`z-[220]`,children:[(0,Y.jsxs)(F,{children:[(0,Y.jsxs)(N,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(q,{className:`size-4 text-content-secondary`}),a(`plugins:pluginsPage.installLocalPlugin`)]}),(0,Y.jsx)(ce,{children:a(`plugins:pluginsPage.installLocalPluginDescription`)})]}),(0,Y.jsxs)(`div`,{className:`grid gap-3`,children:[(0,Y.jsxs)(`label`,{className:`grid gap-1.5 text-xs font-medium text-content-secondary`,children:[a(`plugins:pluginsPage.pluginDirectory`),(0,Y.jsxs)(`span`,{className:`flex min-w-0 gap-2`,children:[(0,Y.jsx)(L,{className:`min-w-0 flex-1 font-mono text-xs max-[650px]:h-11`,value:o,disabled:d,placeholder:a(`plugins:pluginsPage.pluginDirectoryPlaceholder`),onChange:e=>{s(e.target.value),u(null)}}),(0,Y.jsx)(j,{type:`button`,variant:`secondary`,size:`icon`,className:`size-[34px] shrink-0 max-[650px]:size-11`,title:a(`plugins:pluginsPage.chooseDirectory`),"aria-label":a(`plugins:pluginsPage.chooseDirectory`),onClick:async()=>{h(``);try{let e=await R(o,a(`plugins:pluginsPage.chooseDirectory`));e.status===`picked`?(s(e.path),u(null)):e.status===`unavailable`&&h(a(`common:workspacePicker.systemPickerUnavailable`))}catch(e){h(e instanceof Error?e.message:String(e))}},children:(0,Y.jsx)(p,{})})]})]}),l&&(0,Y.jsxs)(`div`,{className:`grid gap-3 overflow-hidden rounded-md border border-stroke bg-surface-subtle p-3`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,Y.jsx)(`span`,{className:`grid size-8 shrink-0 place-items-center rounded-sm bg-success-soft text-success`,children:(0,Y.jsx)(c,{className:`size-4`})}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`strong`,{className:`block truncate text-sm font-medium text-content`,children:l.plugin.name}),(0,Y.jsxs)(`small`,{className:`block truncate font-mono text-xs text-content-muted tabular-nums`,children:[l.plugin.id,` · v`,l.plugin.version,` · `,l.fileCount,` `,a(`plugins:pluginsPage.files`),` · `,Qe(l.byteCount)]})]})]}),(0,Y.jsx)(`div`,{className:`grid gap-1.5`,children:l.plugin.capabilities.map(e=>(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-3 border-t border-stroke-soft pt-2 text-xs`,children:[(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[(0,Y.jsx)(`strong`,{className:`block font-medium text-content`,children:e.label}),(0,Y.jsx)(`small`,{className:`text-xs text-content-muted`,children:e.description})]}),(0,Y.jsx)(`code`,{className:`shrink-0 font-mono text-xs text-content-secondary`,children:e.name})]},e.name))}),(0,Y.jsxs)(`div`,{className:`flex items-start gap-2 rounded-sm bg-warning-soft p-2.5 text-xs leading-5 text-warning-strong`,children:[(0,Y.jsx)(b,{className:`mt-0.5 shrink-0`,size:15}),(0,Y.jsx)(`span`,{children:a(`plugins:pluginsPage.localPluginSecurityWarning`)})]})]}),m&&(0,Y.jsxs)(he,{className:`m-0`,children:[(0,Y.jsx)(b,{size:14}),(0,Y.jsx)(`span`,{children:m})]})]}),(0,Y.jsxs)(P,{children:[(0,Y.jsx)(j,{type:`button`,variant:`secondary`,size:`dialogAction`,disabled:d,onClick:()=>t(!1),children:a(`common:ui.cancel`)}),(0,Y.jsxs)(j,{type:`button`,size:`dialogAction`,disabled:d||!l&&!o.trim(),onClick:l?async()=>{if(!(!l||d)){f(!0),h(``);try{await i(`/api/plugins/install`,{method:`POST`,body:JSON.stringify({inspectionId:l.inspectionId})}),await n(),t(!1)}catch(e){h(e instanceof Error?e.message:String(e))}finally{f(!1)}}}:async()=>{if(!(!o.trim()||d)){f(!0),h(``);try{u(await i(`/api/plugins/inspect`,{method:`POST`,body:JSON.stringify({path:o.trim()})}))}catch(e){u(null),h(e instanceof Error?e.message:String(e))}finally{f(!1)}}},children:[d?(0,Y.jsx)(oe,{className:`text-current`}):l?(0,Y.jsx)(q,{}):(0,Y.jsx)(c,{}),a(d?`plugins:pluginsPage.processing`:l?`plugins:pluginsPage.installPlugin`:`plugins:pluginsPage.inspectPlugin`)]})]})]})})}var et=[`tool`,`prompt`,`skill`];function tt(e){let t=Array.isArray(e.resourceTypes)?e.resourceTypes.filter(e=>et.includes(e)):[];return t.length?t:[`tool`]}function nt(e,t){return{tool:t(`plugins:pluginsPage.extensionType.tool`),prompt:t(`plugins:pluginsPage.extensionType.prompt`),skill:t(`plugins:pluginsPage.extensionType.skill`)}[e]}var rt=[`all`,`builtin`,`local`],it={read:d,ls:p,grep:v,find:v,edit:f,write:f,bash:y,web_search:l,browser_automation:l,computer_use:K,generate_visual:m};function at(e,t){return t(e===`builtin`?`plugins:pluginsPage.builtIn`:e===`local`?`plugins:pluginsPage.local`:`plugins:pluginsPage.all`)}function ot(e){return e.flatMap(e=>e.managedExternally?[]:e.capabilities.filter(e=>e.enabled).map(e=>e.name))}function st(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 ct(e){return Object.fromEntries(e.filter(e=>e.source===`pi`&&e.name!==`Computer Use`&&!!e.packageSource).map(e=>[e.packageSource,e.enabled!==!1]))}function lt(e,t){return[...e].sort().join(`\0`)===[...t].sort().join(`\0`)}function ut(e,t){return W({id:e.name,name:e.label},t)}function dt(e,t){return e.pluginSource===`pi`?e.pluginName:G(e.pluginName,t)}function ft({value:e,testing:t,onChange:n,onTest:i}){let{t:a}=r();return(0,Y.jsxs)(`div`,{className:`plugin-tool-config grid gap-2.5 border-t border-stroke pt-3 [&_label]:grid [&_label]:gap-1.5 [&_label]:text-xs [&_label]:font-medium [&_label]:text-content-secondary`,children:[(0,Y.jsxs)(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-3`,children:[(0,Y.jsxs)(`label`,{children:[a(`plugins:pluginsPage.defaultLanguage`),(0,Y.jsxs)(U,{value:e.language,onChange:t=>n({...e,language:t.target.value}),children:[(0,Y.jsx)(`option`,{value:`auto`,children:a(`plugins:pluginsPage.auto`)}),(0,Y.jsx)(`option`,{value:`zh-CN`,children:a(`plugins:pluginsPage.simplifiedChinese`)}),(0,Y.jsx)(`option`,{value:`en-US`,children:a(`plugins:pluginsPage.english`)})]})]}),(0,Y.jsxs)(`label`,{children:[a(`plugins:pluginsPage.safeSearch`),(0,Y.jsxs)(U,{value:e.safeSearch,onChange:t=>n({...e,safeSearch:Number(t.target.value)}),children:[(0,Y.jsx)(`option`,{value:0,children:a(`plugins:pluginsPage.off`)}),(0,Y.jsx)(`option`,{value:1,children:a(`plugins:pluginsPage.moderate`)}),(0,Y.jsx)(`option`,{value:2,children:a(`plugins:pluginsPage.strict`)})]})]}),(0,Y.jsxs)(`label`,{children:[a(`plugins:pluginsPage.resultCount`),(0,Y.jsx)(L,{type:`number`,min:`1`,max:`12`,className:`tabular-nums`,value:e.maxResults,onChange:t=>n({...e,maxResults:Number(t.target.value)})})]})]}),(0,Y.jsxs)(j,{type:`button`,variant:`secondary`,className:`justify-self-end max-[650px]:h-11`,loading:t,disabled:t,onClick:i,children:[(0,Y.jsx)(l,{}),a(t?`plugins:pluginsPage.testing`:`plugins:pluginsPage.testConnection`)]})]})}function pt({query:e,notify:t,requestText:n,requestConfirm:a}){let{t:o}=r(),[s,c]=(0,J.useState)(``),[l,d]=(0,J.useState)(null),[f,p]=(0,J.useState)([]),[m,g]=(0,J.useState)(!1),[_,y]=(0,J.useState)(``),[ee,b]=(0,J.useState)(``),x=(0,J.useCallback)(async(e=``)=>{g(!0),b(``);try{let[t,n]=await Promise.all([i(`/api/extensions/market?name=${encodeURIComponent(e)}`),i(`/api/extensions`)]);d(t),p(n.packages||[])}catch(e){b(e instanceof Error?e.message:String(e))}finally{g(!1)}},[]);(0,J.useEffect)(()=>{x(``)},[x]);let S=(l?.packages||[]).filter(t=>`${t.name} ${t.description}`.toLowerCase().includes(e.trim().toLowerCase())),C=async e=>{if(await a?.({title:o(`plugins:pluginsPage.installExtension`),message:o(`plugins:pluginsPage.extensionSecurityWarning`,{name:e}),confirmLabel:o(`plugins:pluginsPage.installExtension`),tone:`danger`})!==!1){y(e);try{let n=/^(?:[.~\\/]|[A-Za-z]:[\\/])/.test(e)||/^(?:npm:|https?:\/\/|git\+)/i.test(e)?e:`npm:${e}`,r=await i(`/api/extensions/install`,{method:`POST`,body:JSON.stringify({source:n})});p(r.packages||[]),t(o(`plugins:pluginsPage.extensionInstalled`),`success`)}catch(e){t(e instanceof Error?e.message:String(e),`error`)}finally{y(``)}}},w=async()=>{let e=await n?.({title:o(`plugins:pluginsPage.installExtension`),message:o(`plugins:pluginsPage.extensionSourceHelp`),inputLabel:o(`plugins:pluginsPage.extensionSource`),placeholder:`npm:@scope/package or https://github.com/…`,maxLength:2e3});e?.trim()&&await C(e.trim())},T=async e=>{if(await a?.({title:o(`plugins:pluginsPage.uninstallExtension`),message:o(`plugins:pluginsPage.uninstallExtensionDescription`,{name:e.name}),confirmLabel:o(`plugins:pluginsPage.uninstallExtension`),tone:`danger`})!==!1){y(e.source);try{await i(`/api/extensions`,{method:`DELETE`,body:JSON.stringify({source:e.source,scope:e.scope})}),await x(s),t(o(`plugins:pluginsPage.extensionUninstalled`),`success`)}catch(e){t(e instanceof Error?e.message:String(e),`error`)}finally{y(``)}}},E=et.map(e=>({type:e,items:f.filter(t=>tt(t).includes(e))})).filter(e=>e.items.length>0);return(0,Y.jsxs)(Y.Fragment,{children:[E.map(e=>(0,Y.jsx)(V,{className:`plugin-installed-extensions`,title:`${o(`plugins:pluginsPage.installedExtensions`)} · ${nt(e.type,o)}`,count:e.items.length,children:(0,Y.jsx)(B,{children:e.items.map(t=>(0,Y.jsx)(z,{icon:(0,Y.jsx)(h,{}),name:(0,Y.jsx)(`span`,{className:`font-mono`,children:t.name}),nameMeta:`v${t.version}`,description:(0,Y.jsx)(`span`,{className:`font-mono text-xs`,children:t.source}),actions:(0,Y.jsxs)(j,{type:`button`,variant:`ghost`,size:`sm`,className:`text-content-muted hover:bg-danger-soft hover:text-danger`,loading:_===t.source,disabled:!!_,onClick:()=>void T(t),children:[(0,Y.jsx)(te,{}),o(`plugins:pluginsPage.uninstallExtension`)]})},`${e.type}:${t.scope}:${t.source}`))})},e.type)),(0,Y.jsxs)(V,{className:`plugin-market`,title:o(`plugins:pluginsPage.extensionMarket`),actions:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(j,{asChild:!0,variant:`ghost`,size:`sm`,children:(0,Y.jsxs)(`a`,{href:`https://pi.dev/packages`,target:`_blank`,rel:`noreferrer`,children:[(0,Y.jsx)(u,{}),o(`plugins:pluginsPage.openPackageCatalog`)]})}),(0,Y.jsxs)(j,{type:`button`,variant:`secondary`,size:`sm`,onClick:w,disabled:!!_,children:[(0,Y.jsx)(q,{}),o(`plugins:pluginsPage.installExtension`)]})]}),children:[(0,Y.jsxs)(`form`,{className:`mb-3 flex min-w-0 gap-2`,onSubmit:e=>{e.preventDefault(),x(s)},children:[(0,Y.jsx)(L,{className:`min-w-0 flex-1 max-[650px]:h-11`,value:s,onChange:e=>c(e.target.value),placeholder:o(`plugins:pluginsPage.searchPackageCatalog`),"aria-label":o(`plugins:pluginsPage.searchPackageCatalog`)}),(0,Y.jsxs)(j,{type:`submit`,variant:`secondary`,className:`h-[34px] max-[650px]:h-11`,loading:m,disabled:m,children:[(0,Y.jsx)(v,{}),o(`plugins:pluginsPage.search`)]})]}),ee&&(0,Y.jsx)(H,{className:`mt-0 mb-3`,children:ee}),S.length>0&&(0,Y.jsx)(B,{children:S.slice(0,12).map(e=>{let t=f.some(t=>t.name===e.name||t.source===`npm:${e.name}`);return(0,Y.jsx)(z,{icon:(0,Y.jsx)(h,{}),name:(0,Y.jsx)(`span`,{className:`font-mono`,children:e.name}),description:e.description,status:e.published,actions:(0,Y.jsx)(j,{type:`button`,variant:`secondary`,size:`sm`,loading:_===e.name,disabled:t||!!_,onClick:()=>void C(e.name),children:o(t?`plugins:pluginsPage.installed`:`plugins:pluginsPage.installExtension`)})},e.name)})})]})]})}function mt({notify:e,onBack:t,requestText:n,requestConfirm:s}){let{t:c}=r(),l=se(`focusSearch`),u=o(e=>e.capabilities),d=a(u,`plugins`),f=d?rt:rt.slice(0,2),[p,m]=(0,J.useState)(``),[h,v]=(0,J.useState)(null),[y,S]=(0,J.useState)([]),[C,w]=(0,J.useState)(``),[T,E]=(0,J.useState)(`all`),[D,O]=(0,J.useState)({provider:`bing`,language:`auto`,safeSearch:1,maxResults:8}),[k,ne]=(0,J.useState)(!1),[re,ie]=(0,J.useState)(!1),[ae,ce]=(0,J.useState)(!1),[M,N]=(0,J.useState)(null),[P,F]=(0,J.useState)(!1),[I,L]=(0,J.useState)(``),[R,H]=(0,J.useState)(!1),U=(0,J.useCallback)(e=>{v(e),S(e.plugins),O(e.webSearch)},[]),W=(0,J.useCallback)(async()=>{L(``);try{U(await i(`/api/plugins`))}catch(e){L(e instanceof Error?e.message:String(e))}},[U]);(0,J.useEffect)(()=>{W()},[W]);let G=(0,J.useMemo)(()=>st(y),[y]),K=(0,J.useMemo)(()=>ot(y),[y]),X=h?!lt(K,h.enabledTools)||JSON.stringify(ct(y))!==JSON.stringify(h.piExtensions)||JSON.stringify(D)!==JSON.stringify(h.webSearch):!1,Z=(0,J.useCallback)(async()=>{if(!k){if(!h||!X){h&&e(c(`plugins:pluginsPage.noPluginPolicyChanges`));return}ne(!0),L(``);try{let t=await i(`/api/plugins`,{method:`PUT`,body:JSON.stringify({enabledTools:K,webSearch:D,piExtensions:ct(y)})});U(t),e(c(`plugins:pluginsPage.pluginPolicySavedAgentRuntimeUpdated`))}catch(e){L(e instanceof Error?e.message:String(e))}finally{ne(!1)}}},[U,h,X,y,K,e,k,c,D]),Se=async()=>{ie(!0),L(``);try{let t=await i(`/api/plugins/web-search/test`,{method:`POST`,body:JSON.stringify(D)});e(c(`plugins:pluginsPage.bingSearchIsAvailableAndReturnedCountResults`,{count:t.count}))}catch(t){let n=t instanceof Error?t.message:String(t);L(n),e(n,`error`)}finally{ie(!1)}},Ce=(e,t,n)=>{S(r=>r.map(r=>{if(r.id!==e)return r;let i=r.source===`pi`&&r.managedExternally;return{...r,enabled:n||r.capabilities.some(e=>e.enabled),capabilities:r.capabilities.map(e=>i||e.name===t?{...e,enabled:n}:e)}}))},Q=()=>!X||(L(c(`plugins:pluginsPage.saveBeforePluginChanges`)),!1),we=async()=>{if(!(!M||P)){F(!0),L(``);try{U(await i(`/api/plugins/${encodeURIComponent(M.pluginId)}`,{method:`DELETE`})),e(c(`plugins:pluginsPage.pluginUninstalled`,{name:M.pluginName})),w(``),N(null)}catch(e){L(e instanceof Error?e.message:String(e))}finally{F(!1)}}},Te=c(`navigation:navigation.plugins`),Ee=p.trim().toLowerCase(),$=G.filter(e=>T!==`all`&&e.pluginSource!==T?!1:[ut(e,c),e.name,e.description,dt(e,c),e.pluginId].join(` `).toLowerCase().includes(Ee));return(0,Y.jsxs)(fe,{title:Te,description:c(`plugins:pluginsPage.lede`),back:t&&{label:c(`navigation:sidebar.features`),ariaLabel:c(`navigation:shell.backToFeaturesLabel`),onBack:t},toolbar:(0,Y.jsx)(pe,{search:(0,Y.jsx)(de,{id:x,value:p,onValueChange:m,placeholder:c(`navigation:pageHeader.searchPage`,{page:Te}),shortcut:l,clearLabel:c(`navigation:more.clearSearch`)}),actions:(0,Y.jsxs)(Y.Fragment,{children:[d&&(0,Y.jsxs)(j,{type:`button`,variant:`secondary`,className:`h-9`,disabled:!h,onClick:()=>Q()&&ce(!0),children:[(0,Y.jsx)(q,{}),c(`plugins:pluginsPage.installPlugin`)]}),(0,Y.jsxs)(j,{type:`button`,className:`h-9`,"data-plugins-save":!0,loading:k,disabled:!h||k,onClick:()=>void Z(),children:[(0,Y.jsx)(_,{}),c(`plugins:pluginsPage.savePolicy`)]})]}),filters:(0,Y.jsx)(me,{options:f.map(e=>at(e,c)),value:at(T,c),onChange:e=>E(f.find(t=>at(t,c)===e)||`all`)})}),children:[h?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(V,{className:`plugin-catalog`,title:c(`plugins:pluginsPage.toolCatalog`),count:$.length,meta:(0,Y.jsxs)(`span`,{className:`plugin-catalog-summary`,children:[G.filter(e=>e.enabled).length,`/`,G.length,` `,c(`plugins:pluginsPage.enabled2`)]}),actions:X&&(0,Y.jsxs)(`span`,{"data-plugins-unsaved":!0,className:`flex items-center gap-1.5 text-xs font-medium text-content-secondary`,children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`size-1.5 rounded-full bg-content-secondary`}),c(`plugins:pluginsPage.unsaved`)]}),children:$.length?(0,Y.jsx)(B,{className:`plugin-tool-grid`,children:$.map(e=>{let t=it[e.name]||g,n=ut(e,c);return(0,Y.jsx)(z,{className:`plugin-tool-card`,"data-plugin-tool":e.name,icon:(0,Y.jsx)(t,{}),name:(0,Y.jsx)(`span`,{title:n,children:n}),nameMeta:e.name,description:`${dt(e,c)} · ${ye(e.risk,c)}`,status:e.pluginBuiltIn?void 0:c(`plugins:pluginsPage.local`),actions:(0,Y.jsx)(ge,{value:e.enabled,onChange:t=>Ce(e.pluginId,e.name,t),ariaLabel:n}),expanded:C===e.name,onExpandedChange:t=>w(t?e.name:``),toggleLabel:c(`plugins:pluginsPage.toggleToolDetails`,{name:n}),detail:(0,Y.jsxs)(`div`,{className:`plugin-tool-details grid gap-3`,children:[(0,Y.jsx)(`p`,{className:`text-sm leading-relaxed text-content-soft`,children:_e({id:e.name,description:e.description},c)}),(0,Y.jsxs)(`dl`,{className:`grid grid-cols-[88px_minmax(0,1fr)] gap-x-3 gap-y-1.5 text-xs [&_dd]:min-w-0 [&_dd]:[overflow-wrap:anywhere] [&_dd]:text-content-soft [&_dt]:text-content-muted [&>div]:contents`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{children:c(`plugins:pluginsPage.source`)}),(0,Y.jsxs)(`dd`,{className:`tabular-nums`,children:[dt(e,c),!e.pluginBuiltIn&&` · v${e.pluginVersion}`]})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{children:c(`plugins:pluginsPage.riskLevel`)}),(0,Y.jsx)(`dd`,{className:A((xe(e.risk)||ve(e.risk))&&`font-medium text-content!`),children:ye(e.risk,c)})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{children:c(`plugins:pluginsPage.pathScope`)}),(0,Y.jsx)(`dd`,{children:be({id:e.name,scope:e.scope},c)})]}),!e.pluginBuiltIn&&(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{children:c(`plugins:pluginsPage.executionMode`)}),(0,Y.jsx)(`dd`,{children:c(`plugins:pluginsPage.confirmUnlessFullAccess`)})]})]}),!e.pluginBuiltIn&&(0,Y.jsxs)(`div`,{className:`plugin-tool-warning flex items-start gap-2 rounded-sm bg-surface-subtle p-2.5 text-xs leading-normal text-content-secondary`,children:[(0,Y.jsx)(ee,{className:`mt-px size-3.5 shrink-0`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{children:c(`plugins:pluginsPage.localPluginSecurityWarning`)})]}),e.name===`web_search`&&(0,Y.jsx)(ft,{value:D,testing:re,onChange:O,onTest:Se}),!e.pluginBuiltIn&&(0,Y.jsxs)(j,{type:`button`,variant:`ghost`,className:`justify-self-end text-danger hover:bg-danger-soft hover:text-danger max-[650px]:h-11`,onClick:()=>Q()&&N(e),children:[(0,Y.jsx)(te,{}),c(`plugins:pluginsPage.uninstallPlugin`)]})]})},e.name)})}):(0,Y.jsx)(ue,{compact:!0,title:c(`plugins:pluginsPage.noMatchingTools`)})}),(0,Y.jsx)(pt,{query:p,notify:e,requestText:n,requestConfirm:s})]}):I?(0,Y.jsx)(le,{kind:`error`,title:c(`plugins:pluginsPage.loadFailed`),description:I,action:(0,Y.jsx)(j,{variant:`secondary`,className:`max-[650px]:h-11`,loading:R,disabled:R,onClick:()=>{H(!0),W().finally(()=>H(!1))},children:c(`common:pageTemplate.retry`)})}):(0,Y.jsx)(le,{kind:`loading`,title:c(`plugins:pluginsPage.loadingToolPlugins`)}),d&&(0,Y.jsx)($e,{open:ae,onOpenChange:ce,onInstalled:W}),(0,Y.jsx)(He,{open:!!M,onOpenChange:e=>!e&&!P&&N(null),children:(0,Y.jsxs)(Ge,{className:`z-[220]`,children:[(0,Y.jsxs)(Ke,{children:[(0,Y.jsx)(Je,{children:c(`plugins:pluginsPage.uninstallPlugin`)}),(0,Y.jsx)(Ye,{children:c(`plugins:pluginsPage.uninstallPluginDescription`,{name:M?.pluginName||``})})]}),(0,Y.jsxs)(qe,{children:[(0,Y.jsx)(Ze,{disabled:P,children:c(`common:ui.cancel`)}),(0,Y.jsxs)(Xe,{variant:`destructive`,disabled:P,onClick:we,children:[P&&(0,Y.jsx)(oe,{className:`text-current`}),c(`plugins:pluginsPage.uninstallPlugin`)]})]})]})}),I&&h&&(0,Y.jsxs)(he,{className:`fixed right-6 bottom-6 z-[21] max-w-[360px] border border-danger-border shadow-float`,children:[(0,Y.jsx)(b,{size:13}),I]})]})}export{mt as PluginsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-
|
|
1
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-AM3jlRYR.js";import{t as i}from"./button-CCcCN8tE.js";import{a,i as o,l as s,o as c,s as l,t as u}from"./dialog-BVAtioHy.js";import{t as d}from"./safe-mode-instance-Ct43-TDv.js";var f=e(t(),1),p=n();function m({notify:e,disableAll:t}){let{t:n}=r(),m=d(),h=(0,f.useSyncExternalStore)(m.subscribe,m.mode,m.mode),[g,_]=(0,f.useState)(!1);if(h!==`pending`)return null;let v=async()=>{_(!0);try{await t()||e(n(`custom-ui:safeMode.disableFailed`)),m.resolve(`normal`)}catch{e(n(`custom-ui:safeMode.disableFailed`))}finally{_(!1)}};return(0,p.jsx)(u,{open:!0,onOpenChange:e=>{!e&&!g&&m.resolve(`safe`)},children:(0,p.jsxs)(o,{"data-components-safe-mode-prompt":!0,children:[(0,p.jsxs)(l,{children:[(0,p.jsx)(s,{children:n(`custom-ui:safeMode.promptTitle`)}),(0,p.jsx)(a,{children:n(`custom-ui:safeMode.promptHint`)})]}),(0,p.jsxs)(c,{children:[(0,p.jsx)(i,{variant:`outline`,disabled:g,onClick:()=>void v(),children:n(`custom-ui:safeMode.disableAll`)}),(0,p.jsx)(i,{variant:`outline`,disabled:g,onClick:()=>m.resolve(`normal`),children:n(`custom-ui:safeMode.loadNormally`)}),(0,p.jsx)(i,{disabled:g,onClick:()=>m.resolve(`safe`),children:n(`custom-ui:safeMode.keepSafe`)})]})]})})}export{m as SafeModePrompt};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{u as t}from"./vendor-router-CSN_DGvx.js";import{i as n,r}from"./vendor-react-DwNgTV1j.js";import{t as i}from"./use-i18n-BVRhlQ1v.js";import{t as a}from"./api-AeFmYDtL.js";import{t as o}from"./bell-BjONAtgH.js";import{t as s}from"./bot-B3TaBp_T.js";import{t as c}from"./calendar-clock-VIxTaqqy.js";import{t as l}from"./circle-check-iEdCm3Pw.js";import{t as u}from"./WorkspacePicker-93gmdtjf.js";import{t as d}from"./folder-open-FIShC5Qk.js";import{t as f}from"./message-circle-D-XrK6Ft.js";import{t as p}from"./play-DNDjDNGn.js";import{t as m}from"./plus-fQbSqB1n.js";import{t as h}from"./send-Cj-W03w_.js";import{t as g}from"./trash-2-CNrPOoPR.js";import{t as _}from"./triangle-alert-CE1q54ci.js";import{t as v}from"./more-pages-D_PnxLN0.js";import{t as y}from"./switch-D_G8wFhs.js";import{t as b}from"./utils-C8uzG5AZ.js";import{n as x,t as S}from"./button-CCcCN8tE.js";import{s as C}from"./shortcuts-Dsd4mjfP.js";import{a as w}from"./format-DMJQzoZ7.js";import{t as T}from"./StatusGlyph-1KgitlUg.js";import{a as E,i as D,l as O,s as ee,t as k}from"./dialog-BDNbY1pW.js";import{t as A}from"./input-CPw-zkYh.js";import{t as j}from"./textarea-DmATpOqT.js";import{t as M}from"./pick-system-directory-CaiscVfr.js";import{n as N,t as P}from"./PageState-Cz6vFMXv.js";import{a as te,i as ne,n as re,o as ie,r as ae,s as oe,t as se}from"./FeaturePage-bqByIxYg.js";import{n as F}from"./field-DoLEb0np.js";import{t as I}from"./AppSelect-DQYKUW5E.js";import{i as L,s as R}from"./app-primitives-Drz_SjnR.js";var z=e(n(),1),B=r(),V={browser:{name:`通知`,Icon:o},feishu:{name:`飞书`,Icon:s},weixin:{name:`微信`,Icon:f},qq:{name:`QQ`,Icon:f},telegram:{name:`Telegram`,Icon:h}},H={once:`一次`,interval:`每隔一段时间`,daily:`每天`,weekly:`每周`,monthly:`每月`},U={minutes:`分钟`,hours:`小时`,days:`天`},W=[...new Set([`Asia/Hong_Kong`,`UTC`,...typeof Intl.supportedValuesOf==`function`?Intl.supportedValuesOf(`timeZone`):[]])],G=[`full-access`],K=`mt-4 border-t border-stroke-soft pt-1`,q=`form-grid grid gap-x-3 sm:grid-cols-3`,J=`schedule-interval-input grid grid-cols-[minmax(0,1fr)_minmax(84px,auto)] gap-1.5`,Y=`inline-grid h-8 grid-cols-2 rounded-md border border-stroke bg-chrome p-[3px] max-[650px]:h-auto max-[650px]:w-full pointer-coarse:h-auto`,ce=`inline-flex min-w-0 items-center justify-center rounded-sm border border-transparent px-3 text-sm text-content-secondary transition-colors duration-(--d-fast) hover:text-content aria-pressed:border-key-border aria-pressed:bg-key aria-pressed:font-medium aria-pressed:text-content aria-pressed:shadow-key max-[650px]:h-11 pointer-coarse:h-11`;function le({status:e}){return(0,B.jsx)(`span`,{"aria-hidden":`true`,className:`mt-px grid size-[18px] flex-none place-items-center`,children:(0,B.jsx)(T,{status:e===`running`?`run`:e===`completed`?`done`:`failed`,className:`size-3.5`})})}function ue(e){return e(`schedules:schedulesPage.fullAccessHelp`)}function de(e,t){return t(e===`once`?`schedules:schedulesPage.once`:e===`daily`?`schedules:schedulesPage.daily`:e===`weekly`?`schedules:schedulesPage.weekly`:e===`monthly`?`schedules:schedulesPage.monthly`:`schedules:schedulesPage.atIntervals`)}function fe(e,t){return t(e===`hours`?`schedules:schedulesPage.hours`:e===`days`?`schedules:schedulesPage.days`:`schedules:schedulesPage.minutes`)}function pe(e,t){return t(e===`feishu`?`schedules:schedulesPage.feishu`:e===`weixin`?`schedules:schedulesPage.weChat`:e===`qq`?`schedules:schedulesPage.qq`:e===`telegram`?`schedules:schedulesPage.telegram`:`schedules:schedulesPage.browserNotification`)}function X({value:e,onChange:t}){let{t:n}=i();return(0,B.jsxs)(F,{variant:`control`,children:[n(`schedules:schedulesPage.executionMode`),(0,B.jsx)(I,{value:e,onChange:e=>t(e.target.value),children:G.map(e=>(0,B.jsx)(`option`,{value:e,children:n(`schedules:schedulesPage.fullAccess`)},e))}),(0,B.jsx)(`small`,{children:ue(n)})]})}function Z(e){return Object.fromEntries((e?.inputs||[]).map(e=>[e.name,e.defaultValue??``]))}function Q(e,t,n,r,i){if(e===`prompt`)return!!t.trim();let a=i.find(e=>e.id===n);return a?a.inputs.every(e=>{let t=Object.hasOwn(r,e.name)?r[e.name]:e.defaultValue;return!e.required||t!=null&&t!==``}):!1}function $({targetType:e,prompt:t,workflowId:n,workflowInputs:r,workflows:a,onChange:o}){let{t:s}=i(),c=a.find(e=>e.id===n);return(0,B.jsxs)(`div`,{className:`grid`,children:[(0,B.jsxs)(F,{variant:`control`,children:[s(`schedules:schedulesPage.executionTarget`),(0,B.jsxs)(I,{value:e,onChange:e=>{let t=e.target.value,i=a[0];o(t===`workflow`?{targetType:t,workflowId:n||i?.id||``,workflowInputs:n?r:Z(i)}:{targetType:t})},children:[(0,B.jsx)(`option`,{value:`prompt`,children:`Prompt`}),(0,B.jsx)(`option`,{value:`workflow`,children:s(`schedules:schedulesPage.workflow`)})]})]}),e===`prompt`?(0,B.jsxs)(F,{variant:`control`,children:[`Prompt`,(0,B.jsx)(j,{value:t,onChange:e=>o({prompt:e.target.value}),placeholder:s(`schedules:schedulesPage.describeTheWorkTheAgentShouldCompleteEachTime`)})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(F,{variant:`control`,children:[s(`schedules:schedulesPage.workflow`),(0,B.jsxs)(I,{value:n,onChange:e=>{let t=a.find(t=>t.id===e.target.value);o({workflowId:e.target.value,workflowInputs:Z(t)})},children:[(0,B.jsx)(`option`,{value:``,children:s(`schedules:schedulesPage.selectPublishedWorkflow`)}),a.map(e=>(0,B.jsxs)(`option`,{value:e.id,children:[e.name,` · v`,e.revision]},e.id))]}),(0,B.jsx)(`small`,{children:c?.description||(a.length?s(`schedules:schedulesPage.workflowUsesItsOwnRuntimeSettings`):s(`schedules:schedulesPage.noPublishedWorkflows`))})]}),c?.inputs.length?(0,B.jsxs)(`div`,{className:`grid`,children:[(0,B.jsxs)(`div`,{className:`schedule-workflow-inputs-heading mt-3 flex items-baseline justify-between gap-3 max-[650px]:flex-col max-[650px]:items-start max-[650px]:gap-0.5 [&_small]:text-xs [&_small]:text-content-muted [&_strong]:text-xs [&_strong]:font-medium [&_strong]:text-content-secondary`,children:[(0,B.jsx)(`strong`,{children:s(`schedules:schedulesPage.workflowInputs`)}),(0,B.jsx)(`small`,{children:s(`schedules:schedulesPage.workflowInputsHelp`)})]}),(0,B.jsx)(`div`,{className:`schedule-workflow-inputs grid gap-x-3 sm:grid-cols-2 [&_input[type=checkbox]]:size-4 [&_input[type=checkbox]]:justify-self-end [&_input[type=checkbox]]:accent-star`,children:c.inputs.map(e=>(0,B.jsxs)(F,{variant:`control`,className:e.type===`boolean`?`grid grid-cols-[minmax(0,1fr)_auto] items-center`:void 0,children:[e.label,e.required?` *`:``,e.type===`boolean`?(0,B.jsx)(y,{checked:!!r[e.name],onCheckedChange:t=>o({workflowInputs:{...r,[e.name]:t}})}):(0,B.jsx)(A,{type:e.type===`number`?`number`:`text`,required:e.required,value:String(r[e.name]??``),onChange:t=>o({workflowInputs:{...r,[e.name]:t.target.value}})}),e.description&&(0,B.jsx)(`small`,{children:e.description})]},e.id))})]}):null]})]})}function me({value:e,onChange:t}){let{t:n}=i(),[r,a]=(0,z.useState)(``),[o,s]=(0,z.useState)(!1),c=async()=>{a(``);try{let r=await M(e,n(`common:workspacePicker.selectWorkspaceForSchedule`));r.status===`picked`?t(r.path):r.status===`unavailable`&&s(!0)}catch(e){a(e instanceof Error?e.message:String(e))}};return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(F,{variant:`control`,children:[n(`schedules:schedulesPage.workingDirectory`),(0,B.jsxs)(`span`,{className:`schedule-workspace-input grid grid-cols-[minmax(0,1fr)_auto] gap-1.5 [&_input]:min-w-0 [&_input]:font-mono`,children:[(0,B.jsx)(A,{value:e,onChange:e=>t(e.target.value),placeholder:n(`schedules:schedulesPage.enterTheProjectSAbsolutePath`)}),(0,B.jsxs)(S,{type:`button`,variant:`secondary`,className:`h-auto min-h-8`,onClick:()=>void c(),children:[(0,B.jsx)(d,{}),n(`schedules:schedulesPage.browseDirectories`)]})]}),(0,B.jsx)(`small`,{children:n(`schedules:schedulesPage.theScheduledAgentWillRunInThisDirectory`)})]}),r&&(0,B.jsxs)(L,{children:[(0,B.jsx)(_,{size:13}),r]}),(0,B.jsx)(u,{open:o,initialPath:e,description:n(`common:workspacePicker.selectWorkspaceForSchedule`),onOpenChange:s,onSelect:e=>t(e)})]})}function he(e){return{id:e.id,name:e.name,targetType:e.targetType||`prompt`,prompt:e.prompt,workflowId:e.workflowId||``,workflowInputs:e.workflowInputs||{},enabled:e.enabled,frequency:e.frequency,intervalValue:e.intervalValue||1,intervalUnit:e.intervalUnit||`hours`,time:e.time,date:e.date||``,timezone:e.timezone,dayOfWeek:e.dayOfWeek,dayOfMonth:e.dayOfMonth,cwd:e.cwd,executionMode:e.executionMode||`full-access`,model:e.model,notifications:e.notifications||[],notifyOn:e.notifyOn||`always`}}function ge(e,t=`zh-CN`){return!e.enabled||!e.nextRunAt?t===`en-US`?`Paused`:`已暂停`:new Intl.DateTimeFormat(t,{timeZone:e.timezone,dateStyle:`medium`,timeStyle:`short`}).format(new Date(e.nextRunAt))}function _e({notify:e,onBack:n,openNotificationSettings:r,requestConfirm:o}){let{t:s,language:l}=i(),u=t(),d=C(`focusSearch`),[f,p]=(0,z.useState)({tasks:[],runs:[],notificationTargets:{browser:{enabled:!1},feishu:{enabled:!1},weixin:{enabled:!1},qq:{enabled:!1},telegram:{enabled:!1}},workflows:[],defaultCwd:``}),[h,g]=(0,z.useState)(``),[_,y]=(0,z.useState)({}),[b,x]=(0,z.useState)(!0),[w,E]=(0,z.useState)(!1),[D,O]=(0,z.useState)(``),[ee,k]=(0,z.useState)(!1),[A,j]=(0,z.useState)(``),[M,F]=(0,z.useState)(!1),[I,L]=(0,z.useState)(``),R=(0,z.useCallback)(async()=>{try{let e=await a(`/api/schedules`);p(e),E(!0),O(``),g(t=>e.tasks.some(e=>e.id===t)?t:``),y(t=>{let n=Object.entries(t).filter(([t])=>e.tasks.some(e=>e.id===t));return n.length===Object.keys(t).length?t:Object.fromEntries(n)})}catch(e){O(e instanceof Error?e.message:String(e))}finally{x(!1)}},[]);(0,z.useEffect)(()=>{R()},[R]),(0,z.useEffect)(()=>{let e=window.setInterval(R,f.tasks.some(e=>e.lastStatus===`running`)?2e3:1e4);return()=>window.clearInterval(e)},[f.tasks,R]);let V=f.tasks.find(e=>e.id===h),H=f.workflows||[],U=V?_[V.id]??he(V):null,W=(0,z.useMemo)(()=>f.runs.filter(e=>e.taskId===h).sort((e,t)=>new Date(t.startedAt).getTime()-new Date(e.startedAt).getTime()).slice(0,20),[f.runs,h]),G=e=>H.find(t=>t.id===e.workflowId)?.name||s(`schedules:schedulesPage.workflowUnavailable`),K=I.trim().toLocaleLowerCase(),q=K?f.tasks.filter(e=>`${e.name} ${e.targetType===`workflow`?G(e):e.targetType===`bot`?e.botMessage||``:e.prompt}`.toLocaleLowerCase().includes(K)):f.tasks,J=f.tasks.filter(e=>e.enabled).length,Y=e=>{if(!V)return;let t=he(V);y(n=>({...n,[t.id]:{...n[t.id]??t,...e}}))},ce=e=>{U&&Y({notifications:U.notifications.includes(e)?U.notifications.filter(t=>t!==e):[...U.notifications,e]})},le=async()=>{if(!(!V||!U)){k(!0),j(``);try{let t=await a(`/api/schedules/${encodeURIComponent(V.id)}`,{method:`PATCH`,body:JSON.stringify(U)});p(t.state),y(e=>Object.fromEntries(Object.entries(e).filter(([e])=>e!==t.task.id))),e(s(`schedules:schedulesPage.scheduledTaskSaved`))}catch(e){j(e instanceof Error?e.message:String(e))}finally{k(!1)}}},ue=async()=>{if(V){k(!0),j(``);try{await a(`/api/schedules/${encodeURIComponent(V.id)}/run`,{method:`POST`,body:`{}`}),await R(),e(s(`schedules:schedulesPage.scheduledTaskStarted`))}catch(e){j(e instanceof Error?e.message:String(e))}finally{k(!1)}}},pe=async()=>{if(V&&await o({title:s(`schedules:schedulesPage.deleteScheduledTask`),message:s(`schedules:schedulesPage.deleteScheduledTaskNameAndItsRunHistory`,{name:V.name}),confirmLabel:s(`schedules:schedulesPage.delete`)}))try{await a(`/api/schedules/${encodeURIComponent(V.id)}`,{method:`DELETE`}),await R(),e(s(`schedules:schedulesPage.scheduledTaskDeleted`))}catch(e){j(e instanceof Error?e.message:String(e))}},X=t=>{p(t.state),g(t.task.id),e(s(`schedules:schedulesPage.scheduledTaskCreated`))},Z=e=>(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-col items-end gap-0.5 max-[650px]:flex-row max-[650px]:items-center max-[650px]:gap-2`,children:[e.lastStatus===`running`?(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-content-secondary`,children:[(0,B.jsx)(T,{status:`run`,className:`size-3.5`}),s(`schedules:schedulesPage.running`)]}):(0,B.jsx)(`span`,{className:`whitespace-nowrap`,children:e.enabled?s(`schedules:schedulesPage.nextRunTime`,{time:ge(e,l)}):e.lastStatus===`missed`?s(`schedules:schedulesPage.missed`):e.frequency===`once`&&e.lastRunAt?s(`schedules:schedulesPage.onceDone`):s(`schedules:schedulesPage.pause`)}),e.lastStatus===`failed`&&(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-content-secondary`,children:[(0,B.jsx)(T,{status:`failed`,className:`size-3.5`}),s(`schedules:schedulesPage.lastRunFailed`)]})]}),Q=s(`navigation:navigation.schedules`);return(0,B.jsxs)(ae,{title:Q,description:s(`schedules:schedulesPage.lede`),back:n&&{label:s(`navigation:sidebar.features`),ariaLabel:s(`navigation:shell.backToFeaturesLabel`),onBack:n},toolbar:(0,B.jsx)(oe,{search:(0,B.jsx)(te,{id:v,value:I,onValueChange:L,placeholder:s(`navigation:pageHeader.searchPage`,{page:Q}),shortcut:d,clearLabel:s(`navigation:more.clearSearch`)}),actions:(0,B.jsxs)(S,{type:`button`,className:`h-9`,disabled:!w,onClick:()=>F(!0),children:[(0,B.jsx)(m,{}),s(`schedules:schedulesPage.newTask`)]})}),children:[b?(0,B.jsx)(N,{kind:`loading`,title:s(`schedules:schedulesPage.loadingScheduledTasks`)}):D&&!w?(0,B.jsx)(N,{kind:`error`,title:s(`schedules:schedulesPage.loadFailed`),description:D,action:(0,B.jsx)(S,{variant:`secondary`,className:`max-[650px]:h-11`,onClick:()=>{x(!0),R()},children:s(`common:pageTemplate.retry`)})}):(0,B.jsxs)(B.Fragment,{children:[(A||D)&&(0,B.jsx)(se,{children:A||D}),(0,B.jsx)(ie,{title:s(`schedules:schedulesPage.tasks`),count:f.tasks.length,meta:f.tasks.length?s(`schedules:schedulesPage.enabledCount`,{count:J}):void 0,children:q.length?(0,B.jsx)(re,{children:q.map(e=>{let t=h===e.id;return(0,B.jsx)(ne,{"data-schedule-task":e.id,className:`schedule-list-item`,icon:(0,B.jsx)(c,{}),name:e.name,description:e.targetType===`workflow`?(0,B.jsx)(`span`,{className:`font-mono`,children:G(e)}):e.targetType===`bot`?s(`schedules:schedulesPage.botTarget`,{message:e.botMessage||``}):e.prompt,meta:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{children:de(e.frequency,s)}),(0,B.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,B.jsx)(`span`,{className:`tabular-nums`,children:e.frequency===`interval`?`${e.intervalValue} ${fe(e.intervalUnit,s)}`:e.frequency===`once`?`${e.date} ${e.time}`:e.time}),(0,B.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,B.jsx)(`span`,{className:`truncate`,children:e.timezone}),e.createdBy?.kind===`agent`&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,B.jsx)(`span`,{"data-schedule-created-by":`agent`,children:s(`schedules:schedulesPage.createdByAgent`)})]})]}),status:Z(e),expanded:t,onExpandedChange:t=>g(t?e.id:``),toggleLabel:s(`schedules:schedulesPage.toggleTaskDetails`,{name:e.name}),detail:t&&e.targetType===`bot`?(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm text-content-secondary`,children:[(0,B.jsx)(`span`,{className:`min-w-0 flex-1`,children:s(`schedules:schedulesPage.botManagedThere`)}),(0,B.jsx)(S,{size:`sm`,variant:`outline`,onClick:()=>u(`/bots/${encodeURIComponent(e.botId||``)}`),children:s(`schedules:schedulesPage.openBot`)})]}):t&&U&&V?(0,B.jsx)(ve,{task:V,draft:U,runs:W,saving:ee,workflows:H,notificationTargets:f.notificationTargets,language:l,onUpdate:Y,onToggleNotification:ce,onRun:ue,onRemove:pe,onSave:le,onEditTemplates:r}):null},e.id)})}):(0,B.jsx)(P,{title:f.tasks.length?s(`schedules:schedulesPage.noMatchingTasks`):s(`schedules:schedulesPage.theTimelineIsStillUnlit`),description:f.tasks.length?void 0:s(`schedules:schedulesPage.createATaskAndLetItSetOutAutomaticallyAtTheAppointedTime`)})})]}),M&&(0,B.jsx)(ye,{notificationTargets:f.notificationTargets,workflows:H,defaultCwd:f.defaultCwd,onClose:()=>F(!1),onCreated:e=>{F(!1),X(e)}})]})}function ve({task:e,draft:t,runs:n,saving:r,workflows:a,notificationTargets:o,language:s,onUpdate:c,onToggleNotification:u,onRun:d,onRemove:f,onSave:m,onEditTemplates:h}){let{t:_}=i(),v=e.lastStatus===`running`;return(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,B.jsxs)(`label`,{className:`mr-auto inline-flex min-h-8 items-center gap-2.5 text-sm text-content max-[650px]:min-h-11`,children:[(0,B.jsx)(R,{value:t.enabled,onChange:e=>c({enabled:e}),ariaLabel:_(`schedules:schedulesPage.enableTaskName`,{name:t.name})}),t.enabled?_(`schedules:schedulesPage.enabled`):_(`schedules:schedulesPage.pause`)]}),(0,B.jsxs)(S,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,disabled:r||v,onClick:d,children:[v?(0,B.jsx)(x,{}):(0,B.jsx)(p,{}),_(v?`schedules:schedulesPage.running`:`schedules:schedulesPage.runNow`)]}),(0,B.jsx)(S,{variant:`ghost`,size:`icon-sm`,className:`hover:bg-danger-soft hover:text-danger max-[650px]:size-11`,title:_(`schedules:schedulesPage.deleteTask`),"aria-label":_(`schedules:schedulesPage.deleteTask`),onClick:f,children:(0,B.jsx)(g,{})})]}),(0,B.jsx)($,{targetType:t.targetType,prompt:t.prompt,workflowId:t.workflowId,workflowInputs:t.workflowInputs,workflows:a,onChange:c}),t.targetType===`prompt`&&(0,B.jsx)(me,{value:t.cwd,onChange:e=>c({cwd:e})}),(0,B.jsx)(`div`,{className:K,children:(0,B.jsxs)(`div`,{className:q,children:[(0,B.jsxs)(F,{variant:`control`,children:[_(`schedules:schedulesPage.frequency`),(0,B.jsx)(I,{value:t.frequency,onChange:e=>c({frequency:e.target.value}),children:Object.keys(H).map(e=>(0,B.jsx)(`option`,{value:e,children:de(e,_)},e))})]}),t.frequency===`interval`?(0,B.jsxs)(F,{variant:`control`,children:[_(`schedules:schedulesPage.runInterval`),(0,B.jsxs)(`span`,{className:J,children:[(0,B.jsx)(A,{type:`number`,min:`1`,value:t.intervalValue,onChange:e=>c({intervalValue:Number(e.target.value)})}),(0,B.jsx)(I,{value:t.intervalUnit,onChange:e=>c({intervalUnit:e.target.value}),children:Object.keys(U).map(e=>(0,B.jsx)(`option`,{value:e,children:fe(e,_)},e))})]})]}):(0,B.jsxs)(B.Fragment,{children:[t.frequency===`once`&&(0,B.jsxs)(F,{variant:`control`,children:[_(`schedules:schedulesPage.date`),(0,B.jsx)(A,{type:`date`,className:`tabular-nums`,value:t.date,onChange:e=>c({date:e.target.value})})]}),(0,B.jsxs)(F,{variant:`control`,children:[_(`schedules:schedulesPage.time`),(0,B.jsx)(A,{type:`time`,className:`tabular-nums`,value:t.time,onChange:e=>c({time:e.target.value})})]})]}),(0,B.jsxs)(F,{variant:`control`,children:[_(`schedules:schedulesPage.timeZone`),(0,B.jsx)(I,{value:t.timezone,onChange:e=>c({timezone:e.target.value}),children:W.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))})]}),t.targetType===`prompt`&&(0,B.jsx)(X,{value:t.executionMode,onChange:e=>c({executionMode:e})})]})}),(0,B.jsxs)(`div`,{className:b(`schedule-notification-section pt-3`,K),children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,B.jsx)(`strong`,{className:`text-sm font-medium`,children:_(`schedules:schedulesPage.notificationChannels`)}),(0,B.jsx)(`button`,{type:`button`,className:`text-button text-xs font-medium text-content-secondary underline underline-offset-2 hover:text-content max-[650px]:min-h-11`,onClick:h,children:_(`schedules:schedulesPage.editTemplates`)})]}),(0,B.jsx)(`p`,{className:`mt-0.5 text-xs text-content-muted`,children:_(`schedules:schedulesPage.notificationChannelsHelp`)}),(0,B.jsx)(`div`,{className:`schedule-notification-targets mt-2.5 grid grid-cols-[repeat(auto-fill,minmax(132px,1fr))] gap-2`,children:Object.entries(V).map(([e,n])=>{let r=n.Icon,i=t.notifications.includes(e);return(0,B.jsxs)(`button`,{type:`button`,"aria-pressed":i,className:b(`grid min-h-[52px] grid-cols-[16px_minmax(0,1fr)_16px] items-center gap-2 rounded-md border px-2.5 py-2 text-left transition-colors duration-(--d-fast)`,i?`selected border-star-border bg-star-soft text-star-strong`:`border-stroke bg-panel text-content hover:bg-surface-subtle`),onClick:()=>u(e),children:[(0,B.jsx)(r,{className:`size-4`}),(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,B.jsx)(`strong`,{className:`truncate text-sm font-medium`,children:pe(e,_)}),(0,B.jsx)(`small`,{className:`truncate text-xs text-content-muted`,children:o[e].enabled?_(`schedules:schedulesPage.configured`):_(`schedules:schedulesPage.notConfigured`)})]}),(0,B.jsx)(l,{className:b(`size-4`,i?`text-star-strong`:`text-content-faint`)})]},e)})}),(0,B.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-3 gap-y-1.5`,children:[(0,B.jsx)(`span`,{id:`schedule-notify-on-${e.id}`,className:`text-xs text-content-muted`,children:_(`schedules:schedulesPage.notifyWhen`)}),(0,B.jsx)(`div`,{role:`group`,"aria-labelledby":`schedule-notify-on-${e.id}`,className:b(`schedule-notification-chip`,Y),children:[`always`,`failure`].map(e=>(0,B.jsx)(`button`,{type:`button`,"aria-pressed":t.notifyOn===e,className:ce,onClick:()=>c({notifyOn:e}),children:_(e===`failure`?`schedules:schedulesPage.failuresOnly`:`schedules:schedulesPage.completionAndFailure`)},e))})]})]}),(0,B.jsxs)(`div`,{className:`form-footer mt-4 flex items-center justify-between gap-2.5 border-t border-stroke-soft pt-3 max-[650px]:flex-wrap`,children:[(0,B.jsx)(`span`,{className:`text-xs text-content-muted tabular-nums`,children:e.lastRunAt?_(`schedules:schedulesPage.lastRunTime`,{time:w(e.lastRunAt,s)}):_(`schedules:schedulesPage.nextRunTime`,{time:ge(e,s)})}),(0,B.jsxs)(S,{className:`max-[650px]:h-11 max-[650px]:w-full`,disabled:r||!Q(t.targetType,t.prompt,t.workflowId,t.workflowInputs,a),onClick:m,children:[r?(0,B.jsx)(x,{className:`text-current`}):null,_(r?`schedules:schedulesPage.saving`:`schedules:schedulesPage.saveTask`)]})]})]}),(0,B.jsxs)(`section`,{"aria-labelledby":`schedule-runs-${e.id}`,className:`min-w-0`,children:[(0,B.jsxs)(`h3`,{id:`schedule-runs-${e.id}`,className:`mb-1.5 text-[13px] font-medium text-content-muted tabular-nums`,children:[_(`schedules:schedulesPage.recentRuns`),` · `,n.length]}),n.length?(0,B.jsx)(`ul`,{className:`divide-y divide-stroke-soft overflow-hidden rounded-[var(--r-md)] border border-stroke`,children:n.map(e=>(0,B.jsxs)(`li`,{className:`schedule-run-row grid min-h-11 grid-cols-[18px_minmax(0,1fr)_auto] items-start gap-2.5 px-3 py-2.5 ${e.status}`,children:[(0,B.jsx)(le,{status:e.status}),(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,B.jsx)(`strong`,{className:`line-clamp-2 text-sm leading-5 font-medium text-content`,children:e.status===`running`?_(`schedules:schedulesPage.running2`):e.status===`completed`?e.summary||_(`schedules:schedulesPage.taskCompleted`):e.status===`interrupted`?_(`schedules:schedulesPage.taskInterrupted`):e.error||_(`schedules:schedulesPage.taskFailed`)}),(0,B.jsxs)(`small`,{className:`text-xs text-content-muted tabular-nums`,children:[w(e.startedAt,s),` ·`,` `,e.trigger===`manual`?_(`schedules:schedulesPage.manualRun`):_(`schedules:schedulesPage.scheduledTrigger`),e.durationMs?` · ${_(`schedules:schedulesPage.countSec`,{count:Math.round(e.durationMs/1e3)})}`:``]})]}),(0,B.jsx)(`em`,{className:`font-mono text-xs leading-5 text-content-secondary not-italic tabular-nums`,children:new Intl.DateTimeFormat(s,{hour:`2-digit`,minute:`2-digit`}).format(new Date(e.startedAt))})]},e.id))}):(0,B.jsx)(P,{compact:!0,title:_(`schedules:schedulesPage.noRunHistory`)})]})]})}function ye({notificationTargets:e,workflows:t,defaultCwd:n,onClose:r,onCreated:o}){let{t:s}=i(),[c,l]=(0,z.useState)(``),[u,d]=(0,z.useState)(`prompt`),[f,p]=(0,z.useState)(``),[h,g]=(0,z.useState)(``),[v,y]=(0,z.useState)({}),[b,C]=(0,z.useState)(n||``),[w,T]=(0,z.useState)(`full-access`),[j,M]=(0,z.useState)(!1),[N,P]=(0,z.useState)(``);return(0,B.jsx)(k,{open:!0,onOpenChange:e=>!e&&r(),children:(0,B.jsx)(D,{size:`compact`,children:(0,B.jsxs)(`form`,{className:`grid min-w-0`,onSubmit:async t=>{t.preventDefault(),M(!0),P(``);try{let t=Object.entries(e).filter(([,e])=>e.enabled).map(([e])=>e);o(await a(`/api/schedules`,{method:`POST`,body:JSON.stringify({name:c,targetType:u,prompt:f,workflowId:h,workflowInputs:v,cwd:b,enabled:!0,frequency:`daily`,time:`09:00`,timezone:`Asia/Hong_Kong`,executionMode:w,notifications:t,notifyOn:`always`})}))}catch(e){P(e instanceof Error?e.message:String(e))}finally{M(!1)}},children:[(0,B.jsxs)(ee,{children:[(0,B.jsx)(O,{children:s(`schedules:schedulesPage.newScheduledTask`)}),(0,B.jsx)(E,{children:s(`schedules:schedulesPage.youCanContinueSettingTheRunTimeAndNotificationChannelsAfterCreation`)})]}),(0,B.jsxs)(F,{variant:`control`,children:[s(`schedules:schedulesPage.taskName`),(0,B.jsx)(A,{value:c,onChange:e=>l(e.target.value),placeholder:s(`schedules:schedulesPage.forExampleDailyCodeReview`)})]}),(0,B.jsx)($,{targetType:u,prompt:f,workflowId:h,workflowInputs:v,workflows:t,onChange:e=>{e.targetType&&d(e.targetType),e.prompt!==void 0&&p(e.prompt),e.workflowId!==void 0&&g(e.workflowId),e.workflowInputs!==void 0&&y(e.workflowInputs)}}),u===`prompt`&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(me,{value:b,onChange:C}),(0,B.jsx)(X,{value:w,onChange:T})]}),N&&(0,B.jsxs)(L,{children:[(0,B.jsx)(_,{size:13}),N]}),(0,B.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2 max-[650px]:[&>button]:h-11 max-[650px]:[&>button]:flex-1`,children:[(0,B.jsx)(S,{type:`button`,variant:`secondary`,onClick:r,children:s(`schedules:schedulesPage.cancel`)}),(0,B.jsxs)(S,{type:`submit`,disabled:j||!c.trim()||!Q(u,f,h,v,t),children:[j?(0,B.jsx)(x,{className:`text-current`}):(0,B.jsx)(m,{}),s(j?`schedules:schedulesPage.creating`:`schedules:schedulesPage.createTask`)]})]})]})})})}export{_e as SchedulesPage};
|
|
1
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{u as t}from"./vendor-router-CSN_DGvx.js";import{i as n,r}from"./vendor-react-DwNgTV1j.js";import{t as i}from"./use-i18n-AM3jlRYR.js";import{t as a}from"./api-BhPOJ07B.js";import{t as o}from"./bell-BjONAtgH.js";import{t as s}from"./bot-B3TaBp_T.js";import{t as c}from"./calendar-clock-VIxTaqqy.js";import{t as l}from"./circle-check-iEdCm3Pw.js";import{t as u}from"./WorkspacePicker-Dy3QRSbL.js";import{t as d}from"./folder-open-FIShC5Qk.js";import{t as f}from"./message-circle-D-XrK6Ft.js";import{t as p}from"./play-DNDjDNGn.js";import{t as m}from"./plus-fQbSqB1n.js";import{t as h}from"./send-Cj-W03w_.js";import{t as g}from"./trash-2-CNrPOoPR.js";import{t as _}from"./triangle-alert-CE1q54ci.js";import{t as v}from"./more-pages-D_PnxLN0.js";import{t as y}from"./switch-D_G8wFhs.js";import{t as b}from"./utils-C8uzG5AZ.js";import{n as x,t as S}from"./button-CCcCN8tE.js";import{s as C}from"./shortcuts-BsrTXPiU.js";import{a as w}from"./format-DMJQzoZ7.js";import{t as T}from"./StatusGlyph-1KgitlUg.js";import{a as E,i as D,l as O,s as ee,t as k}from"./dialog-BVAtioHy.js";import{t as A}from"./input-CPw-zkYh.js";import{t as j}from"./textarea-DmATpOqT.js";import{t as M}from"./pick-system-directory-COxOQmRm.js";import{n as N,t as P}from"./PageState-Cz6vFMXv.js";import{a as te,i as ne,n as re,o as ie,r as ae,s as oe,t as se}from"./FeaturePage-C4fMefC-.js";import{n as F}from"./field-DoLEb0np.js";import{t as I}from"./AppSelect-DQYKUW5E.js";import{i as L,s as R}from"./app-primitives-Drz_SjnR.js";var z=e(n(),1),B=r(),V={browser:{name:`通知`,Icon:o},feishu:{name:`飞书`,Icon:s},weixin:{name:`微信`,Icon:f},qq:{name:`QQ`,Icon:f},telegram:{name:`Telegram`,Icon:h}},H={once:`一次`,interval:`每隔一段时间`,daily:`每天`,weekly:`每周`,monthly:`每月`},U={minutes:`分钟`,hours:`小时`,days:`天`},W=[...new Set([`Asia/Hong_Kong`,`UTC`,...typeof Intl.supportedValuesOf==`function`?Intl.supportedValuesOf(`timeZone`):[]])],G=[`full-access`],K=`mt-4 border-t border-stroke-soft pt-1`,q=`form-grid grid gap-x-3 sm:grid-cols-3`,J=`schedule-interval-input grid grid-cols-[minmax(0,1fr)_minmax(84px,auto)] gap-1.5`,Y=`inline-grid h-8 grid-cols-2 rounded-md border border-stroke bg-chrome p-[3px] max-[650px]:h-auto max-[650px]:w-full pointer-coarse:h-auto`,ce=`inline-flex min-w-0 items-center justify-center rounded-sm border border-transparent px-3 text-sm text-content-secondary transition-colors duration-(--d-fast) hover:text-content aria-pressed:border-key-border aria-pressed:bg-key aria-pressed:font-medium aria-pressed:text-content aria-pressed:shadow-key max-[650px]:h-11 pointer-coarse:h-11`;function le({status:e}){return(0,B.jsx)(`span`,{"aria-hidden":`true`,className:`mt-px grid size-[18px] flex-none place-items-center`,children:(0,B.jsx)(T,{status:e===`running`?`run`:e===`completed`?`done`:`failed`,className:`size-3.5`})})}function ue(e){return e(`schedules:schedulesPage.fullAccessHelp`)}function de(e,t){return t(e===`once`?`schedules:schedulesPage.once`:e===`daily`?`schedules:schedulesPage.daily`:e===`weekly`?`schedules:schedulesPage.weekly`:e===`monthly`?`schedules:schedulesPage.monthly`:`schedules:schedulesPage.atIntervals`)}function fe(e,t){return t(e===`hours`?`schedules:schedulesPage.hours`:e===`days`?`schedules:schedulesPage.days`:`schedules:schedulesPage.minutes`)}function pe(e,t){return t(e===`feishu`?`schedules:schedulesPage.feishu`:e===`weixin`?`schedules:schedulesPage.weChat`:e===`qq`?`schedules:schedulesPage.qq`:e===`telegram`?`schedules:schedulesPage.telegram`:`schedules:schedulesPage.browserNotification`)}function X({value:e,onChange:t}){let{t:n}=i();return(0,B.jsxs)(F,{variant:`control`,children:[n(`schedules:schedulesPage.executionMode`),(0,B.jsx)(I,{value:e,onChange:e=>t(e.target.value),children:G.map(e=>(0,B.jsx)(`option`,{value:e,children:n(`schedules:schedulesPage.fullAccess`)},e))}),(0,B.jsx)(`small`,{children:ue(n)})]})}function Z(e){return Object.fromEntries((e?.inputs||[]).map(e=>[e.name,e.defaultValue??``]))}function Q(e,t,n,r,i){if(e===`prompt`)return!!t.trim();let a=i.find(e=>e.id===n);return a?a.inputs.every(e=>{let t=Object.hasOwn(r,e.name)?r[e.name]:e.defaultValue;return!e.required||t!=null&&t!==``}):!1}function $({targetType:e,prompt:t,workflowId:n,workflowInputs:r,workflows:a,onChange:o}){let{t:s}=i(),c=a.find(e=>e.id===n);return(0,B.jsxs)(`div`,{className:`grid`,children:[(0,B.jsxs)(F,{variant:`control`,children:[s(`schedules:schedulesPage.executionTarget`),(0,B.jsxs)(I,{value:e,onChange:e=>{let t=e.target.value,i=a[0];o(t===`workflow`?{targetType:t,workflowId:n||i?.id||``,workflowInputs:n?r:Z(i)}:{targetType:t})},children:[(0,B.jsx)(`option`,{value:`prompt`,children:`Prompt`}),(0,B.jsx)(`option`,{value:`workflow`,children:s(`schedules:schedulesPage.workflow`)})]})]}),e===`prompt`?(0,B.jsxs)(F,{variant:`control`,children:[`Prompt`,(0,B.jsx)(j,{value:t,onChange:e=>o({prompt:e.target.value}),placeholder:s(`schedules:schedulesPage.describeTheWorkTheAgentShouldCompleteEachTime`)})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(F,{variant:`control`,children:[s(`schedules:schedulesPage.workflow`),(0,B.jsxs)(I,{value:n,onChange:e=>{let t=a.find(t=>t.id===e.target.value);o({workflowId:e.target.value,workflowInputs:Z(t)})},children:[(0,B.jsx)(`option`,{value:``,children:s(`schedules:schedulesPage.selectPublishedWorkflow`)}),a.map(e=>(0,B.jsxs)(`option`,{value:e.id,children:[e.name,` · v`,e.revision]},e.id))]}),(0,B.jsx)(`small`,{children:c?.description||(a.length?s(`schedules:schedulesPage.workflowUsesItsOwnRuntimeSettings`):s(`schedules:schedulesPage.noPublishedWorkflows`))})]}),c?.inputs.length?(0,B.jsxs)(`div`,{className:`grid`,children:[(0,B.jsxs)(`div`,{className:`schedule-workflow-inputs-heading mt-3 flex items-baseline justify-between gap-3 max-[650px]:flex-col max-[650px]:items-start max-[650px]:gap-0.5 [&_small]:text-xs [&_small]:text-content-muted [&_strong]:text-xs [&_strong]:font-medium [&_strong]:text-content-secondary`,children:[(0,B.jsx)(`strong`,{children:s(`schedules:schedulesPage.workflowInputs`)}),(0,B.jsx)(`small`,{children:s(`schedules:schedulesPage.workflowInputsHelp`)})]}),(0,B.jsx)(`div`,{className:`schedule-workflow-inputs grid gap-x-3 sm:grid-cols-2 [&_input[type=checkbox]]:size-4 [&_input[type=checkbox]]:justify-self-end [&_input[type=checkbox]]:accent-star`,children:c.inputs.map(e=>(0,B.jsxs)(F,{variant:`control`,className:e.type===`boolean`?`grid grid-cols-[minmax(0,1fr)_auto] items-center`:void 0,children:[e.label,e.required?` *`:``,e.type===`boolean`?(0,B.jsx)(y,{checked:!!r[e.name],onCheckedChange:t=>o({workflowInputs:{...r,[e.name]:t}})}):(0,B.jsx)(A,{type:e.type===`number`?`number`:`text`,required:e.required,value:String(r[e.name]??``),onChange:t=>o({workflowInputs:{...r,[e.name]:t.target.value}})}),e.description&&(0,B.jsx)(`small`,{children:e.description})]},e.id))})]}):null]})]})}function me({value:e,onChange:t}){let{t:n}=i(),[r,a]=(0,z.useState)(``),[o,s]=(0,z.useState)(!1),c=async()=>{a(``);try{let r=await M(e,n(`common:workspacePicker.selectWorkspaceForSchedule`));r.status===`picked`?t(r.path):r.status===`unavailable`&&s(!0)}catch(e){a(e instanceof Error?e.message:String(e))}};return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(F,{variant:`control`,children:[n(`schedules:schedulesPage.workingDirectory`),(0,B.jsxs)(`span`,{className:`schedule-workspace-input grid grid-cols-[minmax(0,1fr)_auto] gap-1.5 [&_input]:min-w-0 [&_input]:font-mono`,children:[(0,B.jsx)(A,{value:e,onChange:e=>t(e.target.value),placeholder:n(`schedules:schedulesPage.enterTheProjectSAbsolutePath`)}),(0,B.jsxs)(S,{type:`button`,variant:`secondary`,className:`h-auto min-h-8`,onClick:()=>void c(),children:[(0,B.jsx)(d,{}),n(`schedules:schedulesPage.browseDirectories`)]})]}),(0,B.jsx)(`small`,{children:n(`schedules:schedulesPage.theScheduledAgentWillRunInThisDirectory`)})]}),r&&(0,B.jsxs)(L,{children:[(0,B.jsx)(_,{size:13}),r]}),(0,B.jsx)(u,{open:o,initialPath:e,description:n(`common:workspacePicker.selectWorkspaceForSchedule`),onOpenChange:s,onSelect:e=>t(e)})]})}function he(e){return{id:e.id,name:e.name,targetType:e.targetType||`prompt`,prompt:e.prompt,workflowId:e.workflowId||``,workflowInputs:e.workflowInputs||{},enabled:e.enabled,frequency:e.frequency,intervalValue:e.intervalValue||1,intervalUnit:e.intervalUnit||`hours`,time:e.time,date:e.date||``,timezone:e.timezone,dayOfWeek:e.dayOfWeek,dayOfMonth:e.dayOfMonth,cwd:e.cwd,executionMode:e.executionMode||`full-access`,model:e.model,notifications:e.notifications||[],notifyOn:e.notifyOn||`always`}}function ge(e,t=`zh-CN`){return!e.enabled||!e.nextRunAt?t===`en-US`?`Paused`:`已暂停`:new Intl.DateTimeFormat(t,{timeZone:e.timezone,dateStyle:`medium`,timeStyle:`short`}).format(new Date(e.nextRunAt))}function _e({notify:e,onBack:n,openNotificationSettings:r,requestConfirm:o}){let{t:s,language:l}=i(),u=t(),d=C(`focusSearch`),[f,p]=(0,z.useState)({tasks:[],runs:[],notificationTargets:{browser:{enabled:!1},feishu:{enabled:!1},weixin:{enabled:!1},qq:{enabled:!1},telegram:{enabled:!1}},workflows:[],defaultCwd:``}),[h,g]=(0,z.useState)(``),[_,y]=(0,z.useState)({}),[b,x]=(0,z.useState)(!0),[w,E]=(0,z.useState)(!1),[D,O]=(0,z.useState)(``),[ee,k]=(0,z.useState)(!1),[A,j]=(0,z.useState)(``),[M,F]=(0,z.useState)(!1),[I,L]=(0,z.useState)(``),R=(0,z.useCallback)(async()=>{try{let e=await a(`/api/schedules`);p(e),E(!0),O(``),g(t=>e.tasks.some(e=>e.id===t)?t:``),y(t=>{let n=Object.entries(t).filter(([t])=>e.tasks.some(e=>e.id===t));return n.length===Object.keys(t).length?t:Object.fromEntries(n)})}catch(e){O(e instanceof Error?e.message:String(e))}finally{x(!1)}},[]);(0,z.useEffect)(()=>{R()},[R]),(0,z.useEffect)(()=>{let e=window.setInterval(R,f.tasks.some(e=>e.lastStatus===`running`)?2e3:1e4);return()=>window.clearInterval(e)},[f.tasks,R]);let V=f.tasks.find(e=>e.id===h),H=f.workflows||[],U=V?_[V.id]??he(V):null,W=(0,z.useMemo)(()=>f.runs.filter(e=>e.taskId===h).sort((e,t)=>new Date(t.startedAt).getTime()-new Date(e.startedAt).getTime()).slice(0,20),[f.runs,h]),G=e=>H.find(t=>t.id===e.workflowId)?.name||s(`schedules:schedulesPage.workflowUnavailable`),K=I.trim().toLocaleLowerCase(),q=K?f.tasks.filter(e=>`${e.name} ${e.targetType===`workflow`?G(e):e.targetType===`bot`?e.botMessage||``:e.prompt}`.toLocaleLowerCase().includes(K)):f.tasks,J=f.tasks.filter(e=>e.enabled).length,Y=e=>{if(!V)return;let t=he(V);y(n=>({...n,[t.id]:{...n[t.id]??t,...e}}))},ce=e=>{U&&Y({notifications:U.notifications.includes(e)?U.notifications.filter(t=>t!==e):[...U.notifications,e]})},le=async()=>{if(!(!V||!U)){k(!0),j(``);try{let t=await a(`/api/schedules/${encodeURIComponent(V.id)}`,{method:`PATCH`,body:JSON.stringify(U)});p(t.state),y(e=>Object.fromEntries(Object.entries(e).filter(([e])=>e!==t.task.id))),e(s(`schedules:schedulesPage.scheduledTaskSaved`))}catch(e){j(e instanceof Error?e.message:String(e))}finally{k(!1)}}},ue=async()=>{if(V){k(!0),j(``);try{await a(`/api/schedules/${encodeURIComponent(V.id)}/run`,{method:`POST`,body:`{}`}),await R(),e(s(`schedules:schedulesPage.scheduledTaskStarted`))}catch(e){j(e instanceof Error?e.message:String(e))}finally{k(!1)}}},pe=async()=>{if(V&&await o({title:s(`schedules:schedulesPage.deleteScheduledTask`),message:s(`schedules:schedulesPage.deleteScheduledTaskNameAndItsRunHistory`,{name:V.name}),confirmLabel:s(`schedules:schedulesPage.delete`)}))try{await a(`/api/schedules/${encodeURIComponent(V.id)}`,{method:`DELETE`}),await R(),e(s(`schedules:schedulesPage.scheduledTaskDeleted`))}catch(e){j(e instanceof Error?e.message:String(e))}},X=t=>{p(t.state),g(t.task.id),e(s(`schedules:schedulesPage.scheduledTaskCreated`))},Z=e=>(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-col items-end gap-0.5 max-[650px]:flex-row max-[650px]:items-center max-[650px]:gap-2`,children:[e.lastStatus===`running`?(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-content-secondary`,children:[(0,B.jsx)(T,{status:`run`,className:`size-3.5`}),s(`schedules:schedulesPage.running`)]}):(0,B.jsx)(`span`,{className:`whitespace-nowrap`,children:e.enabled?s(`schedules:schedulesPage.nextRunTime`,{time:ge(e,l)}):e.lastStatus===`missed`?s(`schedules:schedulesPage.missed`):e.frequency===`once`&&e.lastRunAt?s(`schedules:schedulesPage.onceDone`):s(`schedules:schedulesPage.pause`)}),e.lastStatus===`failed`&&(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-content-secondary`,children:[(0,B.jsx)(T,{status:`failed`,className:`size-3.5`}),s(`schedules:schedulesPage.lastRunFailed`)]})]}),Q=s(`navigation:navigation.schedules`);return(0,B.jsxs)(ae,{title:Q,description:s(`schedules:schedulesPage.lede`),back:n&&{label:s(`navigation:sidebar.features`),ariaLabel:s(`navigation:shell.backToFeaturesLabel`),onBack:n},toolbar:(0,B.jsx)(oe,{search:(0,B.jsx)(te,{id:v,value:I,onValueChange:L,placeholder:s(`navigation:pageHeader.searchPage`,{page:Q}),shortcut:d,clearLabel:s(`navigation:more.clearSearch`)}),actions:(0,B.jsxs)(S,{type:`button`,className:`h-9`,disabled:!w,onClick:()=>F(!0),children:[(0,B.jsx)(m,{}),s(`schedules:schedulesPage.newTask`)]})}),children:[b?(0,B.jsx)(N,{kind:`loading`,title:s(`schedules:schedulesPage.loadingScheduledTasks`)}):D&&!w?(0,B.jsx)(N,{kind:`error`,title:s(`schedules:schedulesPage.loadFailed`),description:D,action:(0,B.jsx)(S,{variant:`secondary`,className:`max-[650px]:h-11`,onClick:()=>{x(!0),R()},children:s(`common:pageTemplate.retry`)})}):(0,B.jsxs)(B.Fragment,{children:[(A||D)&&(0,B.jsx)(se,{children:A||D}),(0,B.jsx)(ie,{title:s(`schedules:schedulesPage.tasks`),count:f.tasks.length,meta:f.tasks.length?s(`schedules:schedulesPage.enabledCount`,{count:J}):void 0,children:q.length?(0,B.jsx)(re,{children:q.map(e=>{let t=h===e.id;return(0,B.jsx)(ne,{"data-schedule-task":e.id,className:`schedule-list-item`,icon:(0,B.jsx)(c,{}),name:e.name,description:e.targetType===`workflow`?(0,B.jsx)(`span`,{className:`font-mono`,children:G(e)}):e.targetType===`bot`?s(`schedules:schedulesPage.botTarget`,{message:e.botMessage||``}):e.prompt,meta:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{children:de(e.frequency,s)}),(0,B.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,B.jsx)(`span`,{className:`tabular-nums`,children:e.frequency===`interval`?`${e.intervalValue} ${fe(e.intervalUnit,s)}`:e.frequency===`once`?`${e.date} ${e.time}`:e.time}),(0,B.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,B.jsx)(`span`,{className:`truncate`,children:e.timezone}),e.createdBy?.kind===`agent`&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,B.jsx)(`span`,{"data-schedule-created-by":`agent`,children:s(`schedules:schedulesPage.createdByAgent`)})]})]}),status:Z(e),expanded:t,onExpandedChange:t=>g(t?e.id:``),toggleLabel:s(`schedules:schedulesPage.toggleTaskDetails`,{name:e.name}),detail:t&&e.targetType===`bot`?(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm text-content-secondary`,children:[(0,B.jsx)(`span`,{className:`min-w-0 flex-1`,children:s(`schedules:schedulesPage.botManagedThere`)}),(0,B.jsx)(S,{size:`sm`,variant:`outline`,onClick:()=>u(`/bots/${encodeURIComponent(e.botId||``)}`),children:s(`schedules:schedulesPage.openBot`)})]}):t&&U&&V?(0,B.jsx)(ve,{task:V,draft:U,runs:W,saving:ee,workflows:H,notificationTargets:f.notificationTargets,language:l,onUpdate:Y,onToggleNotification:ce,onRun:ue,onRemove:pe,onSave:le,onEditTemplates:r}):null},e.id)})}):(0,B.jsx)(P,{title:f.tasks.length?s(`schedules:schedulesPage.noMatchingTasks`):s(`schedules:schedulesPage.theTimelineIsStillUnlit`),description:f.tasks.length?void 0:s(`schedules:schedulesPage.createATaskAndLetItSetOutAutomaticallyAtTheAppointedTime`)})})]}),M&&(0,B.jsx)(ye,{notificationTargets:f.notificationTargets,workflows:H,defaultCwd:f.defaultCwd,onClose:()=>F(!1),onCreated:e=>{F(!1),X(e)}})]})}function ve({task:e,draft:t,runs:n,saving:r,workflows:a,notificationTargets:o,language:s,onUpdate:c,onToggleNotification:u,onRun:d,onRemove:f,onSave:m,onEditTemplates:h}){let{t:_}=i(),v=e.lastStatus===`running`;return(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,B.jsxs)(`label`,{className:`mr-auto inline-flex min-h-8 items-center gap-2.5 text-sm text-content max-[650px]:min-h-11`,children:[(0,B.jsx)(R,{value:t.enabled,onChange:e=>c({enabled:e}),ariaLabel:_(`schedules:schedulesPage.enableTaskName`,{name:t.name})}),t.enabled?_(`schedules:schedulesPage.enabled`):_(`schedules:schedulesPage.pause`)]}),(0,B.jsxs)(S,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,disabled:r||v,onClick:d,children:[v?(0,B.jsx)(x,{}):(0,B.jsx)(p,{}),_(v?`schedules:schedulesPage.running`:`schedules:schedulesPage.runNow`)]}),(0,B.jsx)(S,{variant:`ghost`,size:`icon-sm`,className:`hover:bg-danger-soft hover:text-danger max-[650px]:size-11`,title:_(`schedules:schedulesPage.deleteTask`),"aria-label":_(`schedules:schedulesPage.deleteTask`),onClick:f,children:(0,B.jsx)(g,{})})]}),(0,B.jsx)($,{targetType:t.targetType,prompt:t.prompt,workflowId:t.workflowId,workflowInputs:t.workflowInputs,workflows:a,onChange:c}),t.targetType===`prompt`&&(0,B.jsx)(me,{value:t.cwd,onChange:e=>c({cwd:e})}),(0,B.jsx)(`div`,{className:K,children:(0,B.jsxs)(`div`,{className:q,children:[(0,B.jsxs)(F,{variant:`control`,children:[_(`schedules:schedulesPage.frequency`),(0,B.jsx)(I,{value:t.frequency,onChange:e=>c({frequency:e.target.value}),children:Object.keys(H).map(e=>(0,B.jsx)(`option`,{value:e,children:de(e,_)},e))})]}),t.frequency===`interval`?(0,B.jsxs)(F,{variant:`control`,children:[_(`schedules:schedulesPage.runInterval`),(0,B.jsxs)(`span`,{className:J,children:[(0,B.jsx)(A,{type:`number`,min:`1`,value:t.intervalValue,onChange:e=>c({intervalValue:Number(e.target.value)})}),(0,B.jsx)(I,{value:t.intervalUnit,onChange:e=>c({intervalUnit:e.target.value}),children:Object.keys(U).map(e=>(0,B.jsx)(`option`,{value:e,children:fe(e,_)},e))})]})]}):(0,B.jsxs)(B.Fragment,{children:[t.frequency===`once`&&(0,B.jsxs)(F,{variant:`control`,children:[_(`schedules:schedulesPage.date`),(0,B.jsx)(A,{type:`date`,className:`tabular-nums`,value:t.date,onChange:e=>c({date:e.target.value})})]}),(0,B.jsxs)(F,{variant:`control`,children:[_(`schedules:schedulesPage.time`),(0,B.jsx)(A,{type:`time`,className:`tabular-nums`,value:t.time,onChange:e=>c({time:e.target.value})})]})]}),(0,B.jsxs)(F,{variant:`control`,children:[_(`schedules:schedulesPage.timeZone`),(0,B.jsx)(I,{value:t.timezone,onChange:e=>c({timezone:e.target.value}),children:W.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))})]}),t.targetType===`prompt`&&(0,B.jsx)(X,{value:t.executionMode,onChange:e=>c({executionMode:e})})]})}),(0,B.jsxs)(`div`,{className:b(`schedule-notification-section pt-3`,K),children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,B.jsx)(`strong`,{className:`text-sm font-medium`,children:_(`schedules:schedulesPage.notificationChannels`)}),(0,B.jsx)(`button`,{type:`button`,className:`text-button text-xs font-medium text-content-secondary underline underline-offset-2 hover:text-content max-[650px]:min-h-11`,onClick:h,children:_(`schedules:schedulesPage.editTemplates`)})]}),(0,B.jsx)(`p`,{className:`mt-0.5 text-xs text-content-muted`,children:_(`schedules:schedulesPage.notificationChannelsHelp`)}),(0,B.jsx)(`div`,{className:`schedule-notification-targets mt-2.5 grid grid-cols-[repeat(auto-fill,minmax(132px,1fr))] gap-2`,children:Object.entries(V).map(([e,n])=>{let r=n.Icon,i=t.notifications.includes(e);return(0,B.jsxs)(`button`,{type:`button`,"aria-pressed":i,className:b(`grid min-h-[52px] grid-cols-[16px_minmax(0,1fr)_16px] items-center gap-2 rounded-md border px-2.5 py-2 text-left transition-colors duration-(--d-fast)`,i?`selected border-star-border bg-star-soft text-star-strong`:`border-stroke bg-panel text-content hover:bg-surface-subtle`),onClick:()=>u(e),children:[(0,B.jsx)(r,{className:`size-4`}),(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,B.jsx)(`strong`,{className:`truncate text-sm font-medium`,children:pe(e,_)}),(0,B.jsx)(`small`,{className:`truncate text-xs text-content-muted`,children:o[e].enabled?_(`schedules:schedulesPage.configured`):_(`schedules:schedulesPage.notConfigured`)})]}),(0,B.jsx)(l,{className:b(`size-4`,i?`text-star-strong`:`text-content-faint`)})]},e)})}),(0,B.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-3 gap-y-1.5`,children:[(0,B.jsx)(`span`,{id:`schedule-notify-on-${e.id}`,className:`text-xs text-content-muted`,children:_(`schedules:schedulesPage.notifyWhen`)}),(0,B.jsx)(`div`,{role:`group`,"aria-labelledby":`schedule-notify-on-${e.id}`,className:b(`schedule-notification-chip`,Y),children:[`always`,`failure`].map(e=>(0,B.jsx)(`button`,{type:`button`,"aria-pressed":t.notifyOn===e,className:ce,onClick:()=>c({notifyOn:e}),children:_(e===`failure`?`schedules:schedulesPage.failuresOnly`:`schedules:schedulesPage.completionAndFailure`)},e))})]})]}),(0,B.jsxs)(`div`,{className:`form-footer mt-4 flex items-center justify-between gap-2.5 border-t border-stroke-soft pt-3 max-[650px]:flex-wrap`,children:[(0,B.jsx)(`span`,{className:`text-xs text-content-muted tabular-nums`,children:e.lastRunAt?_(`schedules:schedulesPage.lastRunTime`,{time:w(e.lastRunAt,s)}):_(`schedules:schedulesPage.nextRunTime`,{time:ge(e,s)})}),(0,B.jsxs)(S,{className:`max-[650px]:h-11 max-[650px]:w-full`,disabled:r||!Q(t.targetType,t.prompt,t.workflowId,t.workflowInputs,a),onClick:m,children:[r?(0,B.jsx)(x,{className:`text-current`}):null,_(r?`schedules:schedulesPage.saving`:`schedules:schedulesPage.saveTask`)]})]})]}),(0,B.jsxs)(`section`,{"aria-labelledby":`schedule-runs-${e.id}`,className:`min-w-0`,children:[(0,B.jsxs)(`h3`,{id:`schedule-runs-${e.id}`,className:`mb-1.5 text-[13px] font-medium text-content-muted tabular-nums`,children:[_(`schedules:schedulesPage.recentRuns`),` · `,n.length]}),n.length?(0,B.jsx)(`ul`,{className:`divide-y divide-stroke-soft overflow-hidden rounded-[var(--r-md)] border border-stroke`,children:n.map(e=>(0,B.jsxs)(`li`,{className:`schedule-run-row grid min-h-11 grid-cols-[18px_minmax(0,1fr)_auto] items-start gap-2.5 px-3 py-2.5 ${e.status}`,children:[(0,B.jsx)(le,{status:e.status}),(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,B.jsx)(`strong`,{className:`line-clamp-2 text-sm leading-5 font-medium text-content`,children:e.status===`running`?_(`schedules:schedulesPage.running2`):e.status===`completed`?e.summary||_(`schedules:schedulesPage.taskCompleted`):e.status===`interrupted`?_(`schedules:schedulesPage.taskInterrupted`):e.error||_(`schedules:schedulesPage.taskFailed`)}),(0,B.jsxs)(`small`,{className:`text-xs text-content-muted tabular-nums`,children:[w(e.startedAt,s),` ·`,` `,e.trigger===`manual`?_(`schedules:schedulesPage.manualRun`):_(`schedules:schedulesPage.scheduledTrigger`),e.durationMs?` · ${_(`schedules:schedulesPage.countSec`,{count:Math.round(e.durationMs/1e3)})}`:``]})]}),(0,B.jsx)(`em`,{className:`font-mono text-xs leading-5 text-content-secondary not-italic tabular-nums`,children:new Intl.DateTimeFormat(s,{hour:`2-digit`,minute:`2-digit`}).format(new Date(e.startedAt))})]},e.id))}):(0,B.jsx)(P,{compact:!0,title:_(`schedules:schedulesPage.noRunHistory`)})]})]})}function ye({notificationTargets:e,workflows:t,defaultCwd:n,onClose:r,onCreated:o}){let{t:s}=i(),[c,l]=(0,z.useState)(``),[u,d]=(0,z.useState)(`prompt`),[f,p]=(0,z.useState)(``),[h,g]=(0,z.useState)(``),[v,y]=(0,z.useState)({}),[b,C]=(0,z.useState)(n||``),[w,T]=(0,z.useState)(`full-access`),[j,M]=(0,z.useState)(!1),[N,P]=(0,z.useState)(``);return(0,B.jsx)(k,{open:!0,onOpenChange:e=>!e&&r(),children:(0,B.jsx)(D,{size:`compact`,children:(0,B.jsxs)(`form`,{className:`grid min-w-0`,onSubmit:async t=>{t.preventDefault(),M(!0),P(``);try{let t=Object.entries(e).filter(([,e])=>e.enabled).map(([e])=>e);o(await a(`/api/schedules`,{method:`POST`,body:JSON.stringify({name:c,targetType:u,prompt:f,workflowId:h,workflowInputs:v,cwd:b,enabled:!0,frequency:`daily`,time:`09:00`,timezone:`Asia/Hong_Kong`,executionMode:w,notifications:t,notifyOn:`always`})}))}catch(e){P(e instanceof Error?e.message:String(e))}finally{M(!1)}},children:[(0,B.jsxs)(ee,{children:[(0,B.jsx)(O,{children:s(`schedules:schedulesPage.newScheduledTask`)}),(0,B.jsx)(E,{children:s(`schedules:schedulesPage.youCanContinueSettingTheRunTimeAndNotificationChannelsAfterCreation`)})]}),(0,B.jsxs)(F,{variant:`control`,children:[s(`schedules:schedulesPage.taskName`),(0,B.jsx)(A,{value:c,onChange:e=>l(e.target.value),placeholder:s(`schedules:schedulesPage.forExampleDailyCodeReview`)})]}),(0,B.jsx)($,{targetType:u,prompt:f,workflowId:h,workflowInputs:v,workflows:t,onChange:e=>{e.targetType&&d(e.targetType),e.prompt!==void 0&&p(e.prompt),e.workflowId!==void 0&&g(e.workflowId),e.workflowInputs!==void 0&&y(e.workflowInputs)}}),u===`prompt`&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(me,{value:b,onChange:C}),(0,B.jsx)(X,{value:w,onChange:T})]}),N&&(0,B.jsxs)(L,{children:[(0,B.jsx)(_,{size:13}),N]}),(0,B.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2 max-[650px]:[&>button]:h-11 max-[650px]:[&>button]:flex-1`,children:[(0,B.jsx)(S,{type:`button`,variant:`secondary`,onClick:r,children:s(`schedules:schedulesPage.cancel`)}),(0,B.jsxs)(S,{type:`submit`,disabled:j||!c.trim()||!Q(u,f,h,v,t),children:[j?(0,B.jsx)(x,{className:`text-current`}):(0,B.jsx)(m,{}),s(j?`schedules:schedulesPage.creating`:`schedules:schedulesPage.createTask`)]})]})]})})})}export{_e as SchedulesPage};
|