pisper 0.6.24 → 0.6.25
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 +5 -5
- package/web/.vite/manifest.json +769 -631
- package/web/assets/{AppDialog-BcXOXBcR.js → AppDialog-CuxO26Km.js} +1 -1
- package/web/assets/{AppOverlays-DhOsSE6q.js → AppOverlays-Bt5SL3PY.js} +1 -1
- package/web/assets/{AppSelect-BD6RAaJ5.js → AppSelect-DQYKUW5E.js} +1 -1
- package/web/assets/{AssetsPage-7Fuwati9.js → AssetsPage-BE6AzOGC.js} +1 -1
- package/web/assets/{BoardPage-C81aOK4p.js → BoardPage-DX0fJ_ap.js} +3 -3
- package/web/assets/ChannelsPage-CyT7oDYZ.js +1 -0
- package/web/assets/{ChatAppearancePage-DQr-uhHb.js → ChatAppearancePage-B6Dzj2Bj.js} +1 -1
- package/web/assets/ChatHistoryPage-Cq20l93c.js +1 -0
- package/web/assets/ChatPage-DgiS-Qj_.js +553 -0
- package/web/assets/ConfigPage-CgrWdzb5.js +5 -0
- package/web/assets/{DesktopWindowControls-BWe5YIjj.js → DesktopWindowControls-D8axeuEx.js} +1 -1
- package/web/assets/FeaturePage-BB1TeMlr.js +1 -0
- package/web/assets/{FileAttachmentPreview-IZzA3f8k.js → FileAttachmentPreview-DPjT_iYk.js} +1 -1
- package/web/assets/{FloatingWidgets-DgIJkrEC.js → FloatingWidgets-FI1S4hdn.js} +1 -1
- package/web/assets/FocusRuntimeControls-CvAx-KDV.js +1 -0
- package/web/assets/{GitDiffViewer-CypHOHdP.js → GitDiffViewer-DwFfeFOA.js} +1 -1
- package/web/assets/{ManageProjectsDialog-DxiTEqYf.js → ManageProjectsDialog-BSLNf6qD.js} +1 -1
- package/web/assets/{MarkdownMessage-CuaozZah.js → MarkdownMessage-NK7Ixb4Y.js} +1 -1
- package/web/assets/{McpPage-BbmxMKuy.js → McpPage-Cn-yDgC5.js} +1 -1
- package/web/assets/MemoryEvolution-B8IeSLcd.js +1 -0
- package/web/assets/MemoryPage-ZwoG_oj6.js +2 -0
- package/web/assets/{MobileNavigation-IZrksubf.js → MobileNavigation-DK5a0kZU.js} +1 -1
- package/web/assets/{MorePage-DObfXE0e.js → MorePage-BL8nDnTQ.js} +1 -1
- package/web/assets/{NewFolderDialog-CeRiD1xe.js → NewFolderDialog-COkq83LW.js} +1 -1
- package/web/assets/{PageHeader-D8QTuWd6.js → PageHeader-BBTCMqXc.js} +1 -1
- package/web/assets/{PhoneDrawer-Dfmmixh5.js → PhoneDrawer-BcPKJWl-.js} +1 -1
- package/web/assets/{PhoneMenuButton-Bbna_Bcf.js → PhoneMenuButton-D6vdTZdF.js} +1 -1
- package/web/assets/{PhoneTopBar-Dz94PR8O.js → PhoneTopBar-MqNeI69v.js} +1 -1
- package/web/assets/{PluginsPage-0rmSVMfr.js → PluginsPage-Bp71HpKD.js} +1 -1
- package/web/assets/{SafeModePrompt-CAfT8lBS.js → SafeModePrompt-CpvvU5wL.js} +1 -1
- package/web/assets/SchedulesPage-Drs10rEV.js +1 -0
- package/web/assets/{SessionBrowserPane-DMTNqq-e.js → SessionBrowserPane-DjtB4MCI.js} +2 -2
- package/web/assets/SessionContextPanel-ETfnp4pT.js +2 -0
- package/web/assets/{SessionHome-047YRkeb.js → SessionHome-CHBw3ZvP.js} +1 -1
- package/web/assets/SessionInspector-DVaRflQy.js +1 -0
- package/web/assets/{SessionShell-BqNSjTbQ.js → SessionShell-CwfQAX7i.js} +1 -1
- package/web/assets/{SettingsSidebar-a9IEYCfr.js → SettingsSidebar-FgC-tlY2.js} +1 -1
- package/web/assets/{ShortcutHelpDialog-B1RT_EMe.js → ShortcutHelpDialog-DKbIkUnk.js} +1 -1
- package/web/assets/{ShortcutKeys-DIEI9JQZ.js → ShortcutKeys-BuHXNKVW.js} +1 -1
- package/web/assets/{SidebarUpdateStatus-phIx4K_T.js → SidebarUpdateStatus-LKwNKESF.js} +1 -1
- package/web/assets/{SkillsPage-CZuR-0QX.js → SkillsPage-BbnerW44.js} +1 -1
- package/web/assets/{TaskProcessesPane-x73TNzuV.js → TaskProcessesPane-B2fyZEK9.js} +1 -1
- package/web/assets/{TaskTerminalView-D2UVtmT1.js → TaskTerminalView-CKApgF75.js} +1 -1
- package/web/assets/{TerminalPanel-C0U35k57.js → TerminalPanel-D03WycYm.js} +1 -1
- package/web/assets/{WebDesktopPet-CJtB44aG.js → WebDesktopPet-K2dbcbnQ.js} +1 -1
- package/web/assets/WorkflowsPage-CmzftCtz.js +1 -0
- package/web/assets/{WorkspacePicker-C7hhcfZV.js → WorkspacePicker-DbdbTOV2.js} +1 -1
- package/web/assets/{api-BmSvZCuH.js → api-BW_X0FMZ.js} +1 -1
- package/web/assets/{app-update-DhpOY37a.js → app-update-DYFXTosD.js} +1 -1
- package/web/assets/{approval-confirm-Dc3BZGo4.js → approval-confirm-DQ5N_lJB.js} +1 -1
- package/web/assets/archive-ojKJT7Fp.js +1 -0
- package/web/assets/{board-projects-C7DazgZG.js → board-projects-CrejrMrn.js} +1 -1
- package/web/assets/book-open-BuHHD9os.js +1 -0
- package/web/assets/bots-store-CNXTx3UY.js +1 -0
- package/web/assets/{chat-api-DHqVwcpJ.js → chat-api-Bo6nhq40.js} +1 -1
- package/web/assets/chevrons-up-down-C2sEPdAh.js +1 -0
- package/web/assets/{client-store-Dif482Kx.js → client-store-DzgOPMlh.js} +1 -1
- package/web/assets/{config-search-CKpXm_hp.js → config-search-BiQmWst4.js} +1 -1
- package/web/assets/{dialog-DFcH7POi.js → dialog-DFZX_Dek.js} +1 -1
- package/web/assets/dist-BS3ekNDj.js +1 -0
- package/web/assets/{events-C7sXXop4.js → events-PfANjkHx.js} +1 -1
- package/web/assets/{focus-session-composer-bits-D2XiGLcj.js → focus-session-composer-bits-C_LOpJH_.js} +1 -1
- package/web/assets/{folder-paths-CsQLylLL.js → folder-paths-aRRH_MYq.js} +1 -1
- package/web/assets/{hosts-CwTc21QE.js → hosts-lvoPwC3T.js} +1 -1
- package/web/assets/i18n-EVP8yIdy.js +1 -0
- package/web/assets/index-D_zLThH_.js +2 -0
- package/web/assets/index-l96Dl6z6.css +2 -0
- package/web/assets/memory-api-DkPje--t.js +1 -0
- package/web/assets/message-circle-D-XrK6Ft.js +1 -0
- package/web/assets/{mobile-remote-fallback-C2Q0wAa6.js → mobile-remote-fallback-LLMZWoIu.js} +1 -1
- package/web/assets/mount-app-7pFSwVLO.js +9 -0
- package/web/assets/{permission-rules-api-D1Tbe4E9.js → permission-rules-api-CAJsSBA5.js} +1 -1
- package/web/assets/{pick-system-directory-CQS5pqM-.js → pick-system-directory-yk6L7wR2.js} +1 -1
- package/web/assets/pin-off-BpRu_vrC.js +1 -0
- package/web/assets/placements-CMrgmg3t.js +2 -0
- package/web/assets/{popover-CXB2yzW6.js → popover--q2hs_pT.js} +1 -1
- package/web/assets/{public-D1nVPEiV.js → public-62LVX7HU.js} +1 -1
- package/web/assets/public-DWbrDr0p.js +3 -0
- package/web/assets/{public-BVKkvQiF.js → public-DkqrpWXx.js} +2 -2
- package/web/assets/{public-components-B6uxO_ZB.js → public-components-DHMvCgH2.js} +1 -1
- package/web/assets/public-diff-WjbTu91T.js +1 -0
- package/web/assets/public-events-CTdTIu5Q.js +1 -0
- package/web/assets/{public-flags-KylDNCsK.js → public-flags-D9LdpQwJ.js} +1 -1
- package/web/assets/public-greeting-DEKYruJJ.js +1 -0
- package/web/assets/{public-session-DjI86F5J.js → public-session-B9UHA6rN.js} +1 -1
- package/web/assets/{public-sidebar-PhHPuas_.js → public-sidebar-Lne86i_K.js} +1 -1
- package/web/assets/{runtime-capabilities-store-CTtXyNjK.js → runtime-capabilities-store-BNM5Ug-5.js} +1 -1
- package/web/assets/{safe-mode-instance-_WZgKT1M.js → safe-mode-instance-DnTP7EUr.js} +1 -1
- package/web/assets/safe-mode-sentinel-DOhqH4gj.js +1 -0
- package/web/assets/select-Bbk9bmXO.js +1 -0
- package/web/assets/send-Cj-W03w_.js +1 -0
- package/web/assets/{session-change-summary-api-DENj-A9c.js → session-change-summary-api-DMTwGz7o.js} +1 -1
- package/web/assets/{session-home-D1MkpdBS.js → session-home-DUpZt2dn.js} +1 -1
- package/web/assets/session-list-BRMu9JWa.js +1 -0
- package/web/assets/{session-organization-api-Cm9HoIme.js → session-organization-api-BGyp66Uv.js} +1 -1
- package/web/assets/{session-scope-BnKeB5vZ.js → session-scope-DZITSvZr.js} +1 -1
- package/web/assets/{session-tree-actions-DhF8lJLn.js → session-tree-actions-CRWyFqAD.js} +1 -1
- package/web/assets/{session-tree-summary-DEJ52bdp.js → session-tree-summary-HTmAo_9V.js} +1 -1
- package/web/assets/{shortcuts-DnykOp5e.js → shortcuts-D72gQCwH.js} +1 -1
- package/web/assets/side-chat-context-D1hZOT7g.js +7 -0
- package/web/assets/{sidebar-bemTfe07.js → sidebar-sj8X80Y9.js} +1 -1
- package/web/assets/{sidebar-store-Be8dU3KV.js → sidebar-store-CXZ7QrOr.js} +1 -1
- package/web/assets/slider-De8rWVNs.js +1 -0
- package/web/assets/sliders-horizontal-Dryf1XyC.js +1 -0
- package/web/assets/{speech-session-4UWWW7HR.js → speech-session-D2GQEOAL.js} +1 -1
- package/web/assets/{startup-queries-iq2o5pqJ.js → startup-queries-CuEXV1Zu.js} +1 -1
- package/web/assets/{storage-8QW6lXuT.js → storage-DtvZ_lEu.js} +1 -1
- package/web/assets/tool-labels-Bexnwp5q.js +1 -0
- package/web/assets/undo-2-C-xQ0UVT.js +1 -0
- package/web/assets/{use-i18n-DCxQRXLH.js → use-i18n-_vdxObu5.js} +1 -1
- package/web/assets/{use-open-bot-BTTe7141.js → use-open-bot-BTxzOAbZ.js} +1 -1
- package/web/assets/{use-studio-actions-CvTVL6vy.js → use-studio-actions-CbMHRZpd.js} +1 -1
- package/web/assets/{useCatalogProjects-D0_Xilel.js → useCatalogProjects-BEkCpADy.js} +1 -1
- package/web/assets/{useNewProjectPicker-C3dVgDqI.js → useNewProjectPicker-CUtLjwYE.js} +2 -2
- package/web/assets/{useNow-BrhALV5l.js → useNow-eQeBCqQk.js} +1 -1
- package/web/assets/{usePhoneShell-BleJZMk4.js → usePhoneShell-DZHZWXnN.js} +1 -1
- package/web/assets/{useSessionListQuery-CSTrzBD6.js → useSessionListQuery-BoUzmjZC.js} +1 -1
- package/web/assets/{useSessionRowActions-CBOzJhLW.js → useSessionRowActions-DCqDrGZY.js} +1 -1
- package/web/assets/{useSidebarModel-AYsswvjm.js → useSidebarModel-CZAfH4Fa.js} +1 -1
- package/web/assets/{web-preview-B9ooQu6f.js → web-preview-XrRFo42l.js} +1 -1
- package/web/assets/{web-preview-events-DZb37WWK.js → web-preview-events-Ba6duwGi.js} +1 -1
- package/web/assets/workflow-messages-Cc4pX_oo.js +1 -0
- package/web/assets/{workspace-order-store-CQ4SHO-9.js → workspace-order-store-Ao4OZ13V.js} +1 -1
- package/web/index.html +2 -2
- package/web/assets/ChannelsPage-LM4bpKzy.js +0 -1
- package/web/assets/ChatHistoryPage-DcjG1hoQ.js +0 -1
- package/web/assets/ChatPage-HBq1cr2I.js +0 -553
- package/web/assets/ConfigPage-Bcjc5mbO.js +0 -5
- package/web/assets/FeaturePage-DGauTCbU.js +0 -1
- package/web/assets/FocusRuntimeControls-Bgq7LvMl.js +0 -1
- package/web/assets/MemoryPage-BeI2YTUn.js +0 -1
- package/web/assets/SchedulesPage-C3TpSm9t.js +0 -1
- package/web/assets/SessionContextPanel-DoS-Xqny.js +0 -2
- package/web/assets/SessionInspector-GXGZ9n87.js +0 -1
- package/web/assets/WorkflowsPage-o4p12fMI.js +0 -1
- package/web/assets/bots-store-CeTfxdyY.js +0 -1
- package/web/assets/dist-V8chnW6-.js +0 -1
- package/web/assets/i18n-YQ8mc9k7.js +0 -1
- package/web/assets/index-DJA4qaOu.css +0 -2
- package/web/assets/index-DjSjahBi.js +0 -2
- package/web/assets/mount-app-DAxz1ll-.js +0 -9
- package/web/assets/placements-BuU0Zuqy.js +0 -2
- package/web/assets/public-BVuJa7Dh.js +0 -3
- package/web/assets/public-diff-CCVYk91T.js +0 -1
- package/web/assets/public-events-CVn8fEHx.js +0 -1
- package/web/assets/safe-mode-sentinel-CVhmZl77.js +0 -1
- package/web/assets/select-DD_WO-gs.js +0 -1
- package/web/assets/send-QxBfLFo-.js +0 -1
- package/web/assets/session-list-BeyOEzyU.js +0 -1
- package/web/assets/side-chat-context-C2SzUmd5.js +0 -7
- package/web/assets/slider-DTmAZl-R.js +0 -1
- package/web/assets/tool-labels-ghvpPFmc.js +0 -1
- package/web/assets/workflow-messages-Cj35aJZc.js +0 -1
- package/web/memory-galaxy-background.webp +0 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MemoryEvolution-B8IeSLcd.js","assets/rolldown-runtime-B0Z9INg1.js","assets/vendor-react-DwNgTV1j.js","assets/use-i18n-_vdxObu5.js","assets/i18n-EVP8yIdy.js","assets/vendor-router-CSN_DGvx.js","assets/index-D_zLThH_.js","assets/index-l96Dl6z6.css","assets/storage-DtvZ_lEu.js","assets/vendor-state-GkUciC5H.js","assets/createLucideIcon-Cd-3GVxJ.js","assets/info-DATxy0fb.js","assets/pause-CYWpPg1R.js","assets/play-DNDjDNGn.js","assets/x-07u4-129.js","assets/popover--q2hs_pT.js","assets/dist-41X0pdUs.js","assets/dist-BsRXXcSL.js","assets/es2015-DTZdOI9P.js","assets/dist-BRjj4UeB.js","assets/dist-OB2r6Xsr.js","assets/utils-C8uzG5AZ.js","assets/vendor-ui-DvrYggeS.js","assets/dialog-DFZX_Dek.js","assets/dist-BHkR6BLP.js","assets/button-CCcCN8tE.js","assets/slider-De8rWVNs.js","assets/dist-DzGQ7sLi.js","assets/dist-BS3ekNDj.js","assets/segmented-control-xkrEOP_d.js","assets/dist-BaBySQmo.js","assets/PageState-Cz6vFMXv.js","assets/motion-DTR4ZVle.js","assets/memory-api-DkPje--t.js","assets/api-BW_X0FMZ.js","assets/abort-signal-f4JsiYKX.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{h as t}from"./vendor-router-CSN_DGvx.js";import{t as n}from"./index-D_zLThH_.js";import{i as r,r as i}from"./vendor-react-DwNgTV1j.js";import{t as a}from"./use-i18n-_vdxObu5.js";import{t as o}from"./storage-DtvZ_lEu.js";import{u as s}from"./api-BW_X0FMZ.js";import{t as c}from"./createLucideIcon-Cd-3GVxJ.js";import{t as l}from"./archive-ojKJT7Fp.js";import{t as u}from"./book-open-BuHHD9os.js";import{t as d}from"./ellipsis-CfGKfbq6.js";import{t as f}from"./file-code-corner-BnE1ljT0.js";import{n as p,r as m,t as h}from"./undo-2-C-xQ0UVT.js";import{t as g}from"./pencil-U08v_vV9.js";import{t as _}from"./pin-off-BpRu_vrC.js";import{t as v}from"./pin-CU0FG0lI.js";import{t as y}from"./plus-fQbSqB1n.js";import{t as b}from"./refresh-cw-TbWxTY4K.js";import{t as x}from"./rotate-ccw-clock-CO6Bw-sF.js";import{t as S}from"./rotate-ccw-C0v8V77_.js";import{t as C}from"./sliders-horizontal-Dryf1XyC.js";import{t as w}from"./trash-2-CNrPOoPR.js";import{t as T}from"./triangle-alert-CE1q54ci.js";import{t as ee}from"./x-07u4-129.js";import{t as E}from"./more-pages-D_PnxLN0.js";import{c as D,i as O,p as te,r as ne,t as k}from"./dropdown-menu-Ds0gD8S8.js";import{i as A,n as re,r as ie,t as ae}from"./tabs-DsgBuvJv.js";import{t as oe}from"./segmented-control-xkrEOP_d.js";import{t as j}from"./utils-C8uzG5AZ.js";import{n as se,t as M}from"./button-CCcCN8tE.js";import{s as ce}from"./shortcuts-D72gQCwH.js";import{a as N,i as P,l as F,o as I,s as le,t as L}from"./dialog-DFZX_Dek.js";import{t as R}from"./input-CPw-zkYh.js";import{t as ue}from"./textarea-DmATpOqT.js";import{n as z,t as de}from"./PageState-Cz6vFMXv.js";import{a as fe,i as pe,n as me,o as he,r as ge,s as _e,t as ve}from"./FeaturePage-BB1TeMlr.js";import{n as B}from"./field-DoLEb0np.js";import{t as ye}from"./AppSelect-DQYKUW5E.js";import{t as be}from"./badge-CWB3lj2H.js";import{i as V}from"./app-primitives-Drz_SjnR.js";import{a as H,c as xe,f as U,h as Se,i as Ce,l as W,m as we,n as Te,o as Ee,p as De,r as G,s as Oe,t as ke,u as K}from"./memory-api-DkPje--t.js";var Ae=c(`check-check`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),je=c(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),Me=c(`eraser`,[[`path`,{d:`M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21`,key:`g5wo59`}],[`path`,{d:`m5.082 11.09 8.828 8.828`,key:`1wx5vj`}]]),q=c(`git-merge`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 21V9a9 9 0 0 0 9 9`,key:`7kw0sc`}]]),Ne=c(`milestone`,[[`path`,{d:`M12 13v8`,key:`1l5pq0`}],[`path`,{d:`M12 3v3`,key:`1n5kay`}],[`path`,{d:`M18.172 6a2 2 0 0 1 1.414.586l2.06 2.06a1.207 1.207 0 0 1 0 1.708l-2.06 2.06a2 2 0 0 1-1.414.586H4a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1z`,key:`8gz4t4`}]]),Pe=c(`replace`,[[`path`,{d:`M14 4a1 1 0 0 1 1-1`,key:`dhj8ez`}],[`path`,{d:`M15 10a1 1 0 0 1-1-1`,key:`1mnyi5`}],[`path`,{d:`M21 4a1 1 0 0 0-1-1`,key:`sfs9ap`}],[`path`,{d:`M21 9a1 1 0 0 1-1 1`,key:`mp6qeo`}],[`path`,{d:`m3 7 3 3 3-3`,key:`x25e72`}],[`path`,{d:`M6 10V5a2 2 0 0 1 2-2h2`,key:`15xut4`}],[`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`,key:`1bkyp8`}]]),J=e(r(),1),Fe={concept:m,file:f,risk:T,preference:C,decision:Ne,fact:u,task:p};function Ie(e,t){return t(e===`file`?`memory:memoryPage.fileType`:e===`risk`?`memory:memoryPage.riskType`:e===`preference`?`memory:memoryPage.preferenceType`:e===`decision`?`memory:memoryPage.decisionType`:e===`fact`?`memory:memoryPage.factType`:e===`task`?`memory:memoryPage.taskType`:`memory:memoryPage.conceptType`)}function Le(e,t){return t(e===`manual`?`memory:memoryPage.sourceManual`:e===`user_confirmed`?`memory:memoryPage.sourceUserRequest`:e===`agent`?`memory:memoryPage.sourceAgent`:e===`tool_verified`?`memory:memoryPage.sourceTool`:e===`external`?`memory:memoryPage.sourceExternal`:`memory:memoryPage.sourceConversation`)}function Re(e,t){return t(e===`assistant`?`memory:memoryPage.roleAssistant`:e===`tool`?`memory:memoryPage.roleTool`:e===`external`?`memory:memoryPage.roleExternal`:e===`manual`?`memory:memoryPage.roleManual`:`memory:memoryPage.roleUser`)}function ze(e,t){return[e.pinned&&t(`memory:memoryPage.pinnedBadge`),e.status===`stale`&&t(`memory:memoryPage.staleBadge`),e.tainted&&t(`memory:memoryPage.taintedBadge`),e.status===`archived`&&t(`memory:memoryPage.archivedBadge`),e.status===`superseded`&&t(`memory:memoryPage.supersededBadge`)].filter(e=>!!e)}function Be(e,t){return e?.kind===`global`?t(`memory:memoryPage.globalMemorySpace`):e?.name||``}function Y(e,t=`zh-CN`){if(!e)return`—`;let n=new Date(e);return Number.isNaN(n.getTime())?e:new Intl.DateTimeFormat(t,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(n)}function Ve(e,t=`zh-CN`){if(!e)return`—`;let n=new Date(e);return Number.isNaN(n.getTime())?e:new Intl.DateTimeFormat(t,{year:`numeric`,month:`2-digit`,day:`2-digit`}).format(n)}function He(e,t){let n={add:{icon:y,label:()=>t(`memory:memoryPage.eventAdd`)},supersede:{icon:Pe,label:()=>t(`memory:memoryPage.eventSupersede`)},merge:{icon:q,label:()=>t(`memory:memoryPage.eventMerge`)},archive:{icon:l,label:()=>t(`memory:memoryPage.eventArchive`)},expire:{icon:je,label:()=>t(`memory:memoryPage.eventExpire`)},stale:{icon:T,label:()=>t(`memory:memoryPage.eventStale`)},confirm:{icon:Ae,label:()=>t(`memory:memoryPage.eventConfirm`)},restore:{icon:S,label:()=>t(`memory:memoryPage.eventRestore`)},edit:{icon:g,label:()=>t(`memory:memoryPage.eventEdit`)},pin:{icon:v,label:()=>t(`memory:memoryPage.eventPin`)},unpin:{icon:_,label:()=>t(`memory:memoryPage.eventUnpin`)},delete:{icon:w,label:()=>t(`memory:memoryPage.eventDelete`)},purge:{icon:Me,label:()=>t(`memory:memoryPage.eventPurge`)},undo:{icon:h,label:()=>t(`memory:memoryPage.eventUndo`)},reinforce:{icon:b,label:()=>t(`memory:memoryPage.eventReinforce`)},migrate:{icon:x,label:()=>t(`memory:memoryPage.eventMigrate`)},consolidate:{icon:q,label:()=>t(`memory:memoryPage.eventConsolidate`)}}[e];return n?{icon:n.icon,label:n.label()}:{icon:x,label:t(`memory:memoryPage.eventGeneric`)}}function Ue(e,t){return e===`user`||e===`manual`||e===`user_confirmed`?t(`memory:memoryPage.actorYou`):[`consolidator`,`reconcile`,`lifecycle`].includes(e)?t(`memory:memoryPage.actorConsolidator`):t(e===`conversation`?`memory:memoryPage.actorConversation`:e===`agent`||e===`tool_verified`?`memory:memoryPage.actorAgent`:e===`external`?`memory:memoryPage.sourceExternal`:`memory:memoryPage.actorSystem`)}function We(e,t){if(e===`same_identity`)return t(`memory:memoryPage.reasonSameIdentity`);if(e===`lower_authority_conflict`)return t(`memory:memoryPage.reasonLowerAuthority`);if(e===`expired`||e===`retention_expired`)return t(`memory:memoryPage.reasonExpired`);if(e===`unused`||e===`low_utility`)return t(`memory:memoryPage.reasonLowUtility`);if(e===`user_deleted`)return t(`memory:memoryPage.reasonUserDeleted`);if(e===`user_requested`)return t(`memory:memoryPage.reasonUserRequested`);let n=/^digests:(\d+) merged:(\d+)$/.exec(e);if(n){let e=Number(n[1]),r=Number(n[2]);return e&&r?t(`memory:memoryPage.reasonConsolidatedBoth`,{digests:e,merged:r}):r?t(`memory:memoryPage.reasonConsolidatedMerged`,{merged:r}):t(`memory:memoryPage.reasonConsolidatedDigests`,{digests:e})}let r=/^promoted (\d+) pending candidates$/.exec(e);return r?t(`memory:memoryPage.reasonPromoted`,{count:Number(r[1])}):e}var X=i(),Ge=50;function Ke({spaceId:e,refreshKey:t,onChanged:n}){let{t:r,language:i}=a(),[o,c]=(0,J.useState)([]),[l,u]=(0,J.useState)(!0),[d,f]=(0,J.useState)(!1),[p,m]=(0,J.useState)(!1),[g,_]=(0,J.useState)(!1),[v,y]=(0,J.useState)(``),[b,x]=(0,J.useState)(``),S=(0,J.useRef)(0),C=e===`all`?``:e,w=(0,J.useCallback)(async()=>{let e=++S.current;u(!0),y(``);try{let t=await K({spaceId:C,limit:Ge});if(e!==S.current)return;c(t.events),m(t.events.length>=Ge),_(!1)}catch(t){if(e!==S.current)return;t instanceof s&&t.status===404?_(!0):y(t instanceof Error?t.message:String(t))}finally{e===S.current&&u(!1)}},[C]);(0,J.useEffect)(()=>(w(),()=>{S.current+=1}),[w,t]);let T=async()=>{let e=o.at(-1)?.at;if(!e||d)return;let t=S.current;f(!0);try{let n=await K({spaceId:C,before:e,limit:Ge});if(t!==S.current)return;c(e=>{let t=new Set(e.map(e=>e.id));return[...e,...n.events.filter(e=>!t.has(e.id))]}),m(n.events.length>=Ge)}catch(e){t===S.current&&y(e instanceof Error?e.message:String(e))}finally{f(!1)}},ee=async e=>{if(!b){x(e.id),y(``);try{await we(e.id),await n(r(`memory:memoryPage.eventUndone`))}catch(e){y(e instanceof Error?e.message:String(e))}finally{x(``)}}};return g?(0,X.jsx)(de,{compact:!0,title:r(`memory:memoryPage.activityUnsupported`)}):l&&!o.length?(0,X.jsx)(z,{kind:`loading`,title:r(`common:pageTemplate.loading`)}):v&&!o.length?(0,X.jsx)(z,{kind:`error`,title:r(`memory:memoryPage.activityLoadFailed`),description:v,action:(0,X.jsx)(M,{variant:`secondary`,className:`max-[650px]:h-11`,onClick:()=>void w(),children:r(`common:pageTemplate.retry`)})}):o.length?(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[v&&(0,X.jsx)(ve,{className:`mt-0`,children:v}),(0,X.jsx)(me,{children:o.map(e=>{let{icon:t,label:n}=He(e.action,r),a=e.reason?We(e.reason,r):``;return(0,X.jsx)(pe,{"data-memory-event":e.action,icon:(0,X.jsx)(t,{}),name:n,description:[...new Set(e.titles||[])].join(`、`)||void 0,meta:(0,X.jsxs)(`span`,{className:`truncate tabular-nums`,children:[Y(e.at,i),` · `,Ue(e.actor,r),a?` · ${a}`:``]}),status:e.undoneAt?r(`memory:memoryPage.undone`):void 0,actions:e.undoable?(0,X.jsxs)(M,{variant:`ghost`,size:`sm`,disabled:!!b,"aria-label":`${r(`memory:memoryPage.undo`)}: ${n}`,onClick:()=>void ee(e),children:[(0,X.jsx)(h,{}),r(`memory:memoryPage.undo`)]}):void 0},e.id)})}),p&&(0,X.jsx)(`div`,{className:`flex justify-center`,children:(0,X.jsx)(M,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,loading:d,disabled:d,onClick:()=>void T(),children:r(`memory:memoryPage.loadMore`)})})]}):(0,X.jsx)(de,{compact:!0,title:r(`memory:memoryPage.noActivity`)})}var Z=`flex min-h-[34px] min-w-0 items-center justify-between gap-4 border-t border-stroke-soft text-sm [&>dd]:min-w-0 [&>dd]:truncate [&>dd]:text-right [&>dd]:text-content [&>dt]:shrink-0 [&>dt]:text-content-muted`;function qe({labels:e}){return(0,X.jsx)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-1`,children:e.map(e=>(0,X.jsx)(be,{children:e},e))})}function Je({id:e,fallback:t=null,spaces:n,refreshKey:r=0,withHeading:i=!1,onClose:o,onEdit:s,onChanged:c,onDeleted:l,requestConfirm:u}){let{t:d,language:f}=a(),[p,m]=(0,J.useState)(null),[h,y]=(0,J.useState)(!0),[b,x]=(0,J.useState)(``),[C,T]=(0,J.useState)(``),[E,D]=(0,J.useState)(!1),[O,te]=(0,J.useState)(0);(0,J.useEffect)(()=>{let t=new AbortController;return y(!0),x(``),W(e,t.signal).then(e=>{t.signal.aborted||(m(e),y(!1))}).catch(e=>{t.signal.aborted||(x(e instanceof Error?e.message:String(e)),y(!1))}),()=>t.abort()},[e,r,O]);let ne=(0,J.useCallback)(async(e,t)=>{D(!0),T(``);try{await e(),await c(t)}catch(e){T(e instanceof Error?e.message:String(e))}finally{D(!1)}},[c]),k=p?.item?.id===e?p.item:t,A=p?.item?.id===e?p.history:[],re=async()=>{if(k&&await u({title:d(`memory:memoryPage.deleteMemory`),message:d(`memory:memoryPage.deleteMemoryName`,{name:k.title}),confirmLabel:d(`memory:memoryPage.delete`)})){D(!0),T(``);try{await H(k.id),await l(d(`memory:memoryPage.memoryDeleted`))}catch(e){T(e instanceof Error?e.message:String(e)),D(!1)}}};if(!k)return(0,X.jsx)(`div`,{className:`flex min-h-16 items-center gap-2 text-xs text-content-muted`,children:h?(0,X.jsx)(se,{className:`size-4`}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(V,{className:`my-0`,children:b||d(`memory:memoryPage.detailLoadFailed`)}),(0,X.jsx)(M,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,onClick:()=>te(e=>e+1),children:d(`memory:memoryPage.retry`)})]})});let ie=n.find(e=>e.id===k.spaceId),ae=k.status===`active`||k.status===`stale`||!k.status,oe=ze(k,d);return(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,"aria-busy":h||E||void 0,children:[i&&(0,X.jsxs)(`header`,{className:`flex min-w-0 items-start gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,X.jsx)(`h3`,{className:`text-[15px] leading-6 font-medium break-words text-content`,children:k.title}),oe.length>0&&(0,X.jsx)(qe,{labels:oe})]}),o&&(0,X.jsx)(M,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`-mt-0.5 flex-none max-[650px]:size-11`,"aria-label":d(`memory:memoryPage.closeDetail`),onClick:o,children:(0,X.jsx)(ee,{})})]}),(0,X.jsx)(`p`,{className:`text-[13px] leading-normal break-words whitespace-pre-wrap text-content-secondary`,children:k.content}),k.status===`stale`&&(0,X.jsx)(`p`,{className:`text-xs leading-normal text-content-muted`,children:d(`memory:memoryPage.staleHint`)}),k.tainted&&(0,X.jsx)(`p`,{className:`text-xs leading-normal text-content-muted`,children:d(`memory:memoryPage.taintedHint`)}),(0,X.jsxs)(`dl`,{className:`m-0`,children:[(0,X.jsxs)(`div`,{className:Z,children:[(0,X.jsx)(`dt`,{children:d(`memory:memoryPage.memoryType`)}),(0,X.jsx)(`dd`,{children:Ie(k.type,d)})]}),ie&&(0,X.jsxs)(`div`,{className:Z,children:[(0,X.jsx)(`dt`,{children:d(`memory:memoryPage.memorySpace`)}),(0,X.jsx)(`dd`,{children:Be(ie,d)})]}),(0,X.jsxs)(`div`,{className:Z,children:[(0,X.jsx)(`dt`,{children:d(`memory:memoryPage.source`)}),(0,X.jsx)(`dd`,{children:Le(k.sourceType,d)})]}),(0,X.jsxs)(`div`,{className:Z,children:[(0,X.jsx)(`dt`,{children:d(`memory:memoryPage.validFrom`)}),(0,X.jsx)(`dd`,{className:`tabular-nums`,children:Y(k.validFrom,f)})]}),(0,X.jsxs)(`div`,{className:Z,children:[(0,X.jsx)(`dt`,{children:d(`memory:memoryPage.validTo`)}),(0,X.jsx)(`dd`,{className:`tabular-nums`,children:k.validTo?Y(k.validTo,f):d(`memory:memoryPage.stillValid`)})]}),(0,X.jsxs)(`div`,{className:Z,children:[(0,X.jsx)(`dt`,{children:d(`memory:memoryPage.created`)}),(0,X.jsx)(`dd`,{className:`tabular-nums`,children:Y(k.createdAt,f)})]}),(0,X.jsxs)(`div`,{className:Z,children:[(0,X.jsx)(`dt`,{children:d(`memory:memoryPage.confirmCount`)}),(0,X.jsx)(`dd`,{className:`tabular-nums`,children:k.confirmCount??1})]}),k.expiresAt&&(0,X.jsxs)(`div`,{className:Z,children:[(0,X.jsx)(`dt`,{children:d(`memory:memoryPage.expires`)}),(0,X.jsx)(`dd`,{className:`tabular-nums`,children:Y(k.expiresAt,f)})]}),k.sourcePath&&(0,X.jsxs)(`div`,{className:Z,children:[(0,X.jsx)(`dt`,{children:d(`memory:memoryPage.relatedFilePath`)}),(0,X.jsx)(`dd`,{className:`font-mono text-xs`,title:k.sourcePath,children:k.sourcePath})]}),k.archiveReason&&(0,X.jsxs)(`div`,{className:Z,children:[(0,X.jsx)(`dt`,{children:d(`memory:memoryPage.archiveReason`)}),(0,X.jsx)(`dd`,{title:We(k.archiveReason,d),children:We(k.archiveReason,d)})]})]}),k.evidence&&(0,X.jsxs)(`section`,{className:`min-w-0`,"aria-label":d(`memory:memoryPage.evidence`),children:[(0,X.jsxs)(`h4`,{className:`mb-1 text-xs font-medium text-content-muted`,children:[d(`memory:memoryPage.evidenceFrom`),` · `,Re(k.evidenceRole,d)]}),(0,X.jsx)(`blockquote`,{className:`m-0 border-l-2 border-stroke pl-2.5 text-xs leading-normal break-words whitespace-pre-wrap text-content-secondary`,children:k.evidence})]}),A.length>1&&(0,X.jsxs)(`section`,{className:`min-w-0`,"aria-label":d(`memory:memoryPage.versionHistory`),children:[(0,X.jsxs)(`h4`,{className:`mb-1 text-xs font-medium text-content-muted tabular-nums`,children:[d(`memory:memoryPage.versionHistory`),` · `,A.length]}),(0,X.jsx)(`ol`,{"data-memory-history":!0,className:`m-0 flex list-none flex-col p-0`,children:A.map(e=>{let t=e.status===`active`||e.status===`stale`;return(0,X.jsxs)(`li`,{"aria-current":e.id===k.id||void 0,className:j(`flex min-w-0 flex-col gap-0.5 border-t border-stroke-soft py-1.5 text-xs leading-normal`,!t&&`text-content-muted`),children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-1.5 tabular-nums`,children:[Ve(e.validFrom,f),t&&(0,X.jsx)(be,{children:d(`memory:memoryPage.currentVersion`)})]}),(0,X.jsx)(`span`,{className:`break-words whitespace-pre-wrap`,children:e.content})]},e.id)})})]}),C&&(0,X.jsx)(V,{className:`my-0`,children:C}),(0,X.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[(0,X.jsxs)(M,{variant:`ghost`,size:`sm`,className:`text-danger hover:bg-danger-soft hover:text-danger max-[650px]:h-11`,disabled:E,onClick:()=>void re(),children:[(0,X.jsx)(w,{}),d(`memory:memoryPage.delete`)]}),ae?(0,X.jsxs)(X.Fragment,{children:[k.status===`stale`&&(0,X.jsxs)(M,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,disabled:E,onClick:()=>void ne(()=>U(k.id,`confirm`),d(`memory:memoryPage.confirmed`)),children:[(0,X.jsx)(Ae,{}),d(`memory:memoryPage.confirmStillValid`)]}),(0,X.jsxs)(M,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,disabled:E,onClick:()=>void ne(()=>U(k.id,k.pinned?`unpin`:`pin`),k.pinned?d(`memory:memoryPage.unpinned`):d(`memory:memoryPage.pinned`)),children:[k.pinned?(0,X.jsx)(_,{}):(0,X.jsx)(v,{}),k.pinned?d(`memory:memoryPage.unpin`):d(`memory:memoryPage.pin`)]}),(0,X.jsxs)(M,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,disabled:E,onClick:()=>s(k),children:[(0,X.jsx)(g,{}),d(`memory:memoryPage.edit`)]})]}):(0,X.jsxs)(M,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,disabled:E,onClick:()=>void ne(()=>U(k.id,`restore`),d(`memory:memoryPage.restored`)),children:[(0,X.jsx)(S,{}),d(`memory:memoryPage.restore`)]})]})]})}var Ye=[`concept`,`file`,`risk`,`preference`,`decision`,`fact`,`task`],Xe=[.3,.5,.8,1];function Ze(e){let t=e??.5;return Xe.reduce((e,n)=>Math.abs(n-t)<Math.abs(e-t)?n:e)}function Qe(e){return e instanceof Error?e.message:String(e)}function $e({spaces:e,node:t,initialSpaceId:n,onClose:r,onSaved:i}){let{t:o}=a(),[s,c]=(0,J.useState)({spaceId:t?.spaceId||n||e[0]?.id||``,title:t?.title||``,content:t?.content||``,type:t?.type||`concept`,sourcePath:t?.sourcePath||``,importance:Ze(t?.importance)}),[l,u]=(0,J.useState)(!1),[d,f]=(0,J.useState)(``),p=o(t?`memory:memoryPage.editMemory`:`memory:memoryPage.addMemory`),m=async e=>{if(e.preventDefault(),!l){u(!0),f(``);try{t?await Se(t.id,s):await G(s),await i(o(t?`memory:memoryPage.memoryUpdated`:`memory:memoryPage.memoryCreated`))}catch(e){f(Qe(e))}finally{u(!1)}}};return(0,X.jsx)(L,{open:!0,busy:l,onOpenChange:e=>!e&&r(),children:(0,X.jsx)(P,{size:`compact`,children:(0,X.jsxs)(`form`,{className:`grid min-w-0 gap-3`,onSubmit:e=>void m(e),children:[(0,X.jsxs)(le,{children:[(0,X.jsx)(F,{children:p}),(0,X.jsx)(N,{children:o(`memory:memoryPage.memoryDialogHint`)})]}),(0,X.jsxs)(B,{variant:`control`,children:[o(`memory:memoryPage.memoryTitle`),(0,X.jsx)(R,{value:s.title,onChange:e=>c({...s,title:e.target.value}),placeholder:o(`memory:memoryPage.forExampleProjectUIConstraints`)})]}),(0,X.jsxs)(B,{variant:`control`,children:[o(`memory:memoryPage.memoryContent`),(0,X.jsx)(ue,{value:s.content,onChange:e=>c({...s,content:e.target.value}),placeholder:o(`memory:memoryPage.recordStandaloneReusableMemoryForFutureChats`)})]}),(0,X.jsxs)(B,{variant:`control`,children:[o(`memory:memoryPage.memorySpace`),(0,X.jsx)(ye,{value:s.spaceId,onChange:e=>c({...s,spaceId:e.target.value}),children:e.map(e=>(0,X.jsx)(`option`,{value:e.id,children:Be(e,o)},e.id))})]}),(0,X.jsxs)(`div`,{className:`grid min-w-0 gap-x-2.5 gap-y-3 sm:grid-cols-2`,children:[(0,X.jsxs)(B,{variant:`control`,children:[o(`memory:memoryPage.memoryType`),(0,X.jsx)(ye,{value:s.type,onChange:e=>c({...s,type:e.target.value}),children:Ye.map(e=>(0,X.jsx)(`option`,{value:e,children:Ie(e,o)},e))})]}),(0,X.jsxs)(B,{variant:`control`,children:[o(`memory:memoryPage.importance`),(0,X.jsxs)(ye,{value:s.importance,onChange:e=>c({...s,importance:Number(e.target.value)}),children:[(0,X.jsx)(`option`,{value:`0.3`,children:o(`memory:memoryPage.normal`)}),(0,X.jsx)(`option`,{value:`0.5`,children:o(`memory:memoryPage.common`)}),(0,X.jsx)(`option`,{value:`0.8`,children:o(`memory:memoryPage.important`)}),(0,X.jsx)(`option`,{value:`1`,children:o(`memory:memoryPage.strict`)})]})]})]}),(0,X.jsxs)(B,{variant:`control`,children:[o(`memory:memoryPage.relatedFilePath`),(0,X.jsx)(R,{value:s.sourcePath,onChange:e=>c({...s,sourcePath:e.target.value}),placeholder:o(`memory:memoryPage.optionalForExampleECodeProjectREADMEMd`)})]}),d&&(0,X.jsx)(V,{children:d}),(0,X.jsxs)(I,{children:[(0,X.jsx)(M,{type:`button`,variant:`secondary`,size:`dialogAction`,disabled:l,onClick:r,children:o(`memory:memoryPage.cancel`)}),(0,X.jsxs)(M,{type:`submit`,size:`dialogAction`,disabled:l||!s.spaceId||!s.title.trim()||!s.content.trim(),children:[l&&(0,X.jsx)(se,{className:`text-current`}),o(l?`memory:memoryPage.saving`:`memory:memoryPage.save`)]})]})]})})})}function et({space:e,onClose:t,onSaved:n}){let{t:r}=a(),[i,o]=(0,J.useState)(e?.name||``),[s,c]=(0,J.useState)(!1),[l,u]=(0,J.useState)(``),d=r(e?`memory:memoryPage.renameMemorySpace`:`memory:memoryPage.newMemorySpace`),f=async t=>{if(t.preventDefault(),!s){c(!0),u(``);try{await n(e?await De(e.id,i):await Ce(i),r(e?`memory:memoryPage.memorySpaceRenamed`:`memory:memoryPage.memorySpaceCreated`))}catch(e){u(Qe(e))}finally{c(!1)}}};return(0,X.jsx)(L,{open:!0,busy:s,onOpenChange:e=>!e&&t(),children:(0,X.jsx)(P,{size:`compact`,children:(0,X.jsxs)(`form`,{className:`grid min-w-0 gap-3`,onSubmit:e=>void f(e),children:[(0,X.jsxs)(le,{children:[(0,X.jsx)(F,{children:d}),(0,X.jsx)(N,{children:r(`memory:memoryPage.memorySpaceHint`)})]}),(0,X.jsxs)(B,{variant:`control`,children:[r(`memory:memoryPage.memorySpaceName`),(0,X.jsx)(R,{value:i,onChange:e=>o(e.target.value),placeholder:r(`memory:memoryPage.forExampleProductDesignGuidelines`),autoFocus:!0})]}),l&&(0,X.jsx)(V,{children:l}),(0,X.jsxs)(I,{children:[(0,X.jsx)(M,{type:`button`,variant:`secondary`,size:`dialogAction`,disabled:s,onClick:t,children:r(`memory:memoryPage.cancel`)}),(0,X.jsxs)(M,{type:`submit`,size:`dialogAction`,disabled:s||!i.trim(),children:[s&&(0,X.jsx)(se,{className:`text-current`}),r(s?`memory:memoryPage.saving`:`memory:memoryPage.save`)]})]})]})})})}var tt=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate());function nt(e){let t=tt(e);return new Date(t.getFullYear(),t.getMonth(),t.getDate()-(t.getDay()+6)%7)}function rt(e,t,n=Date.now()){let r=new Date(n),i=tt(r).getTime(),a=i-864e5,o=nt(r).getTime(),s=new Map,c=(e,t)=>{let n=s.get(e.key);n?n.items.push(t):s.set(e.key,{...e,items:[t]})};for(let n of e){let e=Date.parse(t(n)||``);if(Number.isNaN(e))c({key:`unknown`,kind:`unknown`},n);else if(e>=i)c({key:`today`,kind:`today`},n);else if(e>=a)c({key:`yesterday`,kind:`yesterday`},n);else if(e>=o)c({key:`week`,kind:`week`},n);else{let t=new Date(e);c({key:`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}`,kind:`month`,month:new Date(t.getFullYear(),t.getMonth(),1)},n)}}return[...s.values()]}var it=(0,J.lazy)(()=>t(()=>import(`./MemoryEvolution-B8IeSLcd.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35]))),Q=`all`;function at(){try{let e=n.getItem(o.memoryView);return e===`timeline`||e===`activity`?e:`evolution`}catch{return`evolution`}}function ot(e){try{n.setItem(o.memoryView,e)}catch{}}function $(e){return e instanceof Error?e.message:String(e)}var st={spaces:[],selectedSpaceId:``,nodes:[]};function ct({notify:e,onBack:t,requestConfirm:n}){let{t:r,language:i}=a(),o=ce(`focusSearch`),[s,c]=(0,J.useState)(``),[l,u]=(0,J.useState)(at),[f,p]=(0,J.useState)(Q),[m,h]=(0,J.useState)(`current`),[g,_]=(0,J.useState)(st),[v,x]=(0,J.useState)(!0),[S,C]=(0,J.useState)(!1),[w,T]=(0,J.useState)(!1),[ee,j]=(0,J.useState)(``),[se,N]=(0,J.useState)(``),[P,F]=(0,J.useState)(null),[I,le]=(0,J.useState)(0),[L,R]=(0,J.useState)(null),[ue,B]=(0,J.useState)(null),[be,V]=(0,J.useState)(!1),H=(0,J.useRef)(0),U=(0,J.useCallback)(async()=>{let e=++H.current;x(!0),j(``);try{let t=await xe({spaceId:f,query:s,status:m});if(e!==H.current)return;_(t),T(!0),t.selectedSpaceId&&t.selectedSpaceId!==f&&p(t.selectedSpaceId)}catch(t){e===H.current&&j($(t))}finally{e===H.current&&x(!1)}},[s,f,m]);(0,J.useEffect)(()=>(U(),()=>{H.current+=1}),[U,I]);let Se=async()=>{let e=g.nodes.at(-1),t=e?.validFrom||e?.createdAt;if(!t||S)return;let n=H.current;C(!0);try{let e=await xe({spaceId:f,status:m,before:t});if(n!==H.current)return;_(t=>{let n=new Set(t.nodes.map(e=>e.id));return{...e,nodes:[...t.nodes,...e.nodes.filter(e=>!n.has(e.id))]}})}catch(e){n===H.current&&j($(e))}finally{C(!1)}},Ce=(0,J.useCallback)(()=>le(e=>e+1),[]),W=(0,J.useCallback)(t=>{e(t),Ce()},[e,Ce]),we=(0,J.useCallback)(e=>{N(``),F(null),W(e)},[W]),De=(0,J.useMemo)(()=>[...g.spaces].sort((e,t)=>Number(t.kind===`global`)-Number(e.kind===`global`)),[g.spaces]),G=g.spaces.find(e=>e.id===f)||null,K=!!s.trim(),Ae=(0,J.useMemo)(()=>rt(g.nodes,e=>e.validFrom||e.createdAt),[g.nodes]),je=e=>{let t=e;u(t),ot(t)},Me=e=>{c(e),N(``),e.trim()&&l!==`timeline`&&u(`timeline`)},q=e=>{p(e),N(``),F(null)},Ne=async()=>{if(G&&await n({title:r(`memory:memoryPage.deleteMemorySpace`),message:r(`memory:memoryPage.deleteMemorySpaceNameAndAllMemoriesInIt`,{name:Be(G,r)}),confirmLabel:r(`memory:memoryPage.delete`)}))try{await Ee(G.id),q(Q),W(r(`memory:memoryPage.memorySpaceDeleted`))}catch(e){j($(e))}},Pe=async()=>{try{let{markdown:t}=await Oe(f===Q?``:f),n=URL.createObjectURL(new Blob([t],{type:`text/markdown;charset=utf-8`})),i=document.createElement(`a`);i.href=n,i.download=`pisper-memory-${new Date().toISOString().slice(0,10)}.md`,i.click(),window.setTimeout(()=>URL.revokeObjectURL(n),1e3),e(r(`memory:memoryPage.exported`))}catch(e){j($(e))}},Re=async()=>{if(!be){V(!0),j(``);try{let e=await Te();W(e.ran?r(`memory:memoryPage.consolidated`):r(`memory:memoryPage.nothingToConsolidate`))}catch(e){j($(e))}finally{V(!1)}}},Y=async()=>{if(await n({title:r(`memory:memoryPage.clearEpisodes`),message:r(`memory:memoryPage.clearEpisodesConfirm`),confirmLabel:r(`memory:memoryPage.clearEpisodesAction`)}))try{let{cleared:e}=await ke(f===Q?``:f);W(r(`memory:memoryPage.episodesCleared`,{count:e}))}catch(e){j($(e))}},He=!!G&&G?.kind!==`global`,Ue=e=>(0,X.jsx)(Je,{id:e.id,fallback:e,spaces:g.spaces,refreshKey:I,onEdit:R,onChanged:W,onDeleted:we,requestConfirm:n}),We=e=>{let t=Fe[e.type]||Fe.concept,n=ze(e,r),a=g.spaces.find(t=>t.id===e.spaceId);return(0,X.jsx)(pe,{"data-memory-node":e.id,icon:(0,X.jsx)(t,{}),name:e.title,nameMeta:Ie(e.type,r),description:se===e.id?void 0:e.content,meta:(0,X.jsxs)(`span`,{className:`truncate tabular-nums`,children:[Ve(e.validFrom||e.createdAt,i),f===Q&&a?` · ${Be(a,r)}`:``,` · ${Le(e.sourceType,r)}`]}),status:n.length?(0,X.jsx)(qe,{labels:n}):void 0,expanded:se===e.id,onExpandedChange:t=>N(t?e.id:``),toggleLabel:e.title,detail:Ue(e)},e.id)},Ge=e=>e.kind===`today`?r(`memory:memoryPage.groupToday`):e.kind===`yesterday`?r(`memory:memoryPage.groupYesterday`):e.kind===`week`?r(`memory:memoryPage.groupThisWeek`):e.kind===`unknown`||!e.month?r(`memory:memoryPage.groupUnknown`):new Intl.DateTimeFormat(i,{year:`numeric`,month:`long`}).format(e.month),Z=r(K?`memory:memoryPage.noMatchingMemories`:m===`archived`?`memory:memoryPage.noArchivedMemories`:m===`history`?`memory:memoryPage.noHistoryVersions`:`memory:memoryPage.noMemoriesInSpace`);return(0,X.jsx)(ae,{asChild:!0,value:l,onValueChange:je,className:`gap-0`,children:(0,X.jsxs)(ge,{title:r(`navigation:navigation.memory`),description:r(`memory:memoryPage.lede`),back:t&&{label:r(`navigation:sidebar.features`),ariaLabel:r(`navigation:shell.backToFeaturesLabel`),onBack:t},toolbar:(0,X.jsx)(_e,{search:(0,X.jsx)(fe,{id:E,value:s,onValueChange:Me,placeholder:r(`navigation:pageHeader.searchMemoriesOrFiles`),shortcut:o,clearLabel:r(`navigation:more.clearSearch`)}),actions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(M,{type:`button`,className:`h-9`,disabled:!w,onClick:()=>R({spaceId:f===Q?`global`:f}),children:[(0,X.jsx)(y,{}),r(`memory:memoryPage.addMemory`)]}),(0,X.jsxs)(k,{children:[(0,X.jsx)(te,{asChild:!0,children:(0,X.jsx)(M,{type:`button`,variant:`secondary`,size:`icon-lg`,className:`max-[650px]:max-w-11`,disabled:!w,"aria-label":r(`memory:memoryPage.moreActions`),title:r(`memory:memoryPage.moreActions`),children:(0,X.jsx)(d,{})})}),(0,X.jsxs)(ne,{align:`end`,children:[(0,X.jsx)(O,{onSelect:()=>B(`new`),children:r(`memory:memoryPage.newMemorySpace`)}),(0,X.jsx)(O,{disabled:!He,onSelect:()=>G&&B(G),children:r(`memory:memoryPage.renameMemorySpace`)}),(0,X.jsx)(O,{variant:`destructive`,disabled:!He,onSelect:()=>void Ne(),children:r(`memory:memoryPage.deleteMemorySpace`)}),(0,X.jsx)(D,{}),(0,X.jsx)(O,{onSelect:()=>void Pe(),children:r(`memory:memoryPage.exportMarkdown`)}),(0,X.jsx)(O,{disabled:be,onSelect:()=>void Re(),children:r(`memory:memoryPage.consolidateNow`)}),(0,X.jsx)(O,{onSelect:()=>void Y(),children:r(`memory:memoryPage.clearEpisodes`)})]})]})]}),filters:(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2.5`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center justify-between gap-2`,children:[(0,X.jsxs)(ie,{"aria-label":r(`memory:memoryPage.viewsLabel`),children:[(0,X.jsx)(A,{value:`evolution`,children:r(`memory:memoryPage.evolutionView`)}),(0,X.jsx)(A,{value:`timeline`,children:r(`memory:memoryPage.timelineView`)}),(0,X.jsx)(A,{value:`activity`,children:r(`memory:memoryPage.activityView`)})]}),(0,X.jsxs)(ye,{className:`w-[200px] max-w-full max-[650px]:w-full`,"aria-label":r(`memory:memoryPage.memorySpace`),value:f,disabled:!w,onChange:e=>q(e.target.value),children:[(0,X.jsx)(`option`,{value:Q,children:r(`memory:memoryPage.allSpaces`)}),De.map(e=>(0,X.jsx)(`option`,{value:e.id,children:`${Be(e,r)} · ${e.nodeCount}`},e.id))]})]}),l===`timeline`&&w&&(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center justify-between gap-2`,children:[K?(0,X.jsxs)(`p`,{className:`m-0 text-[13px] font-medium text-content-muted tabular-nums`,children:[r(`memory:memoryPage.searchResults`),` · `,g.nodes.length]}):(0,X.jsx)(oe,{"aria-label":r(`memory:memoryPage.statusFilterLabel`),value:m,onValueChange:e=>{h(e),N(``)},options:[{value:`current`,label:r(`memory:memoryPage.statusCurrent`),count:g.counts?.current},{value:`archived`,label:r(`memory:memoryPage.statusArchived`),count:g.counts?.archived},{value:`history`,label:r(`memory:memoryPage.statusHistory`),count:g.counts?.history}]}),(0,X.jsx)(M,{variant:`ghost`,size:`icon-sm`,className:`text-content-muted max-[650px]:size-11`,loading:v,disabled:v,"aria-label":r(`memory:memoryPage.refresh`),title:r(`memory:memoryPage.refresh`),onClick:Ce,children:(0,X.jsx)(b,{})})]})]})}),children:[!w&&v?(0,X.jsx)(z,{kind:`loading`,title:r(`common:pageTemplate.loading`)}):w?(0,X.jsxs)(X.Fragment,{children:[ee&&(0,X.jsx)(ve,{children:ee}),(0,X.jsxs)(`div`,{className:`mt-5 min-w-0`,"aria-busy":v,children:[(0,X.jsxs)(re,{value:`evolution`,className:`flex min-w-0 flex-col gap-3`,children:[(0,X.jsx)(J.Suspense,{fallback:(0,X.jsx)(z,{kind:`loading`,title:r(`common:pageTemplate.loading`)}),children:(0,X.jsx)(it,{spaceId:f,refreshKey:I,selectedId:P,onSelect:F})}),(0,X.jsx)(`div`,{role:`region`,"data-memory-detail":!0,"aria-label":r(`memory:memoryPage.selectedMemory`),className:`min-w-0 rounded-[var(--r-md)] border border-stroke px-4 py-3`,children:P?(0,X.jsx)(Je,{id:P,spaces:g.spaces,refreshKey:I,withHeading:!0,onClose:()=>F(null),onEdit:R,onChanged:W,onDeleted:we,requestConfirm:n}):(0,X.jsx)(`p`,{className:`m-0 text-xs leading-normal text-content-muted`,children:r(`memory:memoryPage.selectAMemoryToViewDetails`)})})]}),(0,X.jsxs)(re,{value:`timeline`,className:`min-w-0`,"data-memory-timeline":!0,children:[g.nodes.length?K?(0,X.jsx)(me,{children:g.nodes.map(We)}):Ae.map(e=>(0,X.jsx)(he,{"data-memory-group":e.key,className:`mt-5 first:mt-0`,title:Ge(e),count:e.items.length,children:(0,X.jsx)(me,{children:e.items.map(We)})},e.key)):(0,X.jsx)(de,{compact:!0,title:Z}),!K&&g.hasMore&&(0,X.jsx)(`div`,{className:`mt-4 flex justify-center`,children:(0,X.jsx)(M,{variant:`secondary`,size:`sm`,className:`max-[650px]:h-11`,loading:S,disabled:S,onClick:()=>void Se(),children:r(`memory:memoryPage.loadMore`)})})]}),(0,X.jsx)(re,{value:`activity`,className:`min-w-0`,children:(0,X.jsx)(Ke,{spaceId:f,refreshKey:I,onChanged:W})})]})]}):(0,X.jsx)(z,{kind:`error`,title:r(`memory:memoryPage.loadFailed`),description:ee,action:(0,X.jsx)(M,{variant:`secondary`,className:`max-[650px]:h-11`,onClick:()=>void U(),children:r(`common:pageTemplate.retry`)})}),L&&(0,X.jsx)($e,{spaces:De,node:`id`in L?L:null,initialSpaceId:L.spaceId,onClose:()=>R(null),onSaved:e=>{R(null),W(e)}}),ue&&(0,X.jsx)(et,{space:ue===`new`?null:ue,onClose:()=>B(null),onSaved:(e,t)=>{B(null),q(e.id),W(t)}})]})})}export{ct as MemoryPage};
|
|
@@ -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-_vdxObu5.js";import{t as i}from"./runtime-capabilities-store-BNM5Ug-5.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-DiP_AM1C.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-DCxQRXLH.js";import{t as i}from"./useQuery-DdcpUQhO.js";import{a,l as o}from"./api-BmSvZCuH.js";import{a as s,n as c,t as l}from"./runtime-capabilities-CHYOF_hE.js";import{t as u}from"./runtime-capabilities-store-CTtXyNjK.js";import{m as d}from"./placements-BuU0Zuqy.js";import{t as ee}from"./client-store-Dif482Kx.js";import{t as f}from"./usePhoneShell-BleJZMk4.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-C7sXXop4.js";import{n as N,r as P}from"./config-search-CKpXm_hp.js";import{s as F}from"./shortcuts-DnykOp5e.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 o();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 a(`/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 o();return Math.floor(n)}function G(e){return a(`/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 o();return t.filter(e=>e&&typeof e==`object`&&e.enabled===!0).length}function q(e){return a(`/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 o();return Math.floor(n)}function ae(e){return a(`/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-_vdxObu5.js";import{t as i}from"./useQuery-DdcpUQhO.js";import{a,l as o}from"./api-BW_X0FMZ.js";import{a as s,n as c,t as l}from"./runtime-capabilities-CHYOF_hE.js";import{t as u}from"./runtime-capabilities-store-BNM5Ug-5.js";import{m as d}from"./placements-CMrgmg3t.js";import{t as ee}from"./client-store-DzgOPMlh.js";import{t as f}from"./usePhoneShell-DZHZWXnN.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-PfANjkHx.js";import{n as N,r as P}from"./config-search-BiQmWst4.js";import{s as F}from"./shortcuts-D72gQCwH.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 o();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 a(`/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 o();return Math.floor(n)}function G(e){return a(`/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 o();return t.filter(e=>e&&typeof e==`object`&&e.enabled===!0).length}function q(e){return a(`/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 o();return Math.floor(n)}function ae(e){return a(`/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-_vdxObu5.js";import{u as i}from"./api-BW_X0FMZ.js";import{t as a}from"./folder-open-FIShC5Qk.js";import{i as o}from"./workspace-order-store-Ao4OZ13V.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-DFZX_Dek.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-yk6L7wR2.js";import{r as S,t as C}from"./folder-paths-aRRH_MYq.js";import{n as w,t as T}from"./alert-firawb0H.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-_vdxObu5.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-D72gQCwH.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-_vdxObu5.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-CXZ7QrOr.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-_vdxObu5.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-CXZ7QrOr.js";import{t as a}from"./useSidebarModel-CZAfH4Fa.js";import"./public-62LVX7HU.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-_vdxObu5.js";import{t as n}from"./PhoneMenuButton-D6vdTZdF.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-DCxQRXLH.js";import{t as i}from"./api-BmSvZCuH.js";import{i as a}from"./runtime-capabilities-CHYOF_hE.js";import{t as o}from"./runtime-capabilities-store-CTtXyNjK.js";import{t as s}from"./createLucideIcon-Cd-3GVxJ.js";import{t as c}from"./circle-check-iEdCm3Pw.js";import{t as l}from"./earth-Ddy13fHh.js";import{t as u}from"./external-link-CEQqPcqc.js";import{t as d}from"./eye-uWAPXNzJ.js";import{t as f}from"./file-code-corner-BnE1ljT0.js";import{t as p}from"./folder-open-FIShC5Qk.js";import{t as m}from"./image-BY_c3FYU.js";import{t as h}from"./package-BOmkLaKS.js";import{t as g}from"./plug-BsIeHRwC.js";import{t as _}from"./save-CHBB52P8.js";import{t as v}from"./search-D0mqDaf_.js";import{t as y}from"./server-BgNvmqwJ.js";import{t as ee}from"./shield-alert-oZqX6MNu.js";import{t as te}from"./trash-2-CNrPOoPR.js";import{t as b}from"./triangle-alert-CE1q54ci.js";import{t as x}from"./more-pages-D_PnxLN0.js";import{a as S}from"./dist-41X0pdUs.js";import{o as C,s as w}from"./dist-BsRXXcSL.js";import{a as T,c as ne,i as E,l as D,n as O,o as k,r as re,s as ie,t as ae}from"./dist-BHkR6BLP.js";import{t as A}from"./utils-C8uzG5AZ.js";import{n as oe,t as j}from"./button-CCcCN8tE.js";import{s as se}from"./shortcuts-DnykOp5e.js";import{a as M,i as N,l as P,o as F,s as I,t as L}from"./dialog-DFcH7POi.js";import{t as R}from"./input-CPw-zkYh.js";import{t as ce}from"./pick-system-directory-CQS5pqM-.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-DGauTCbU.js";import{t as U}from"./AppSelect-BD6RAaJ5.js";import{c as me,i as he,s as ge}from"./app-primitives-Drz_SjnR.js";import{a as W,i as _e,n as ve,o as ye,r as G,s as be,t as xe}from"./tool-labels-ghvpPFmc.js";var K=s(`package-plus`,[[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`path`,{d:`M16 17h6`,key:`1ook5g`}],[`path`,{d:`M19 14v6`,key:`1ckrd5`}],[`path`,{d:`M21 10.535V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l1.675-.955`,key:`28k6lz`}],[`path`,{d:`M3.29 7 12 12l8.71-5`,key:`19ckod`}],[`path`,{d:`m7.5 4.27 8.997 5.148`,key:`9yrvtv`}]]),q=e(t(),1),J=n(),Y=Object.defineProperty,X=(e,t)=>Y(e,`name`,{value:t,configurable:!0}),[Se,Ce]=w(`AlertDialog`,[D]),Z=D(),we=X(e=>{let{__scopeAlertDialog:t,...n}=e,r=Z(t);return(0,J.jsx)(ae,{...r,...n,modal:!0})},`AlertDialog`);q.forwardRef(X(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Z(n);return(0,J.jsx)(ne,{...i,...r,ref:t})},`AlertDialogTrigger`));var Te=X(e=>{let{__scopeAlertDialog:t,...n}=e,r=Z(t);return(0,J.jsx)(k,{...r,...n})},`AlertDialogPortal`),Q=q.forwardRef(X(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Z(n);return(0,J.jsx)(T,{...i,...r,ref:t})},`AlertDialogOverlay`)),[Ee,$]=Se(`AlertDialogContent`),De=q.forwardRef(X(function(e,t){let{__scopeAlertDialog:n,children:r,...i}=e,a=Z(n),o=q.useRef(null),s=S(t,o),c=q.useRef(null);return(0,J.jsx)(Ee,{scope:n,cancelRef:c,children:(0,J.jsx)(re,{role:`alertdialog`,...a,...i,ref:s,onOpenAutoFocus:C(i.onOpenAutoFocus,e=>{e.preventDefault(),c.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:r})})},`AlertDialogContent`)),Oe=q.forwardRef(X(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Z(n);return(0,J.jsx)(ie,{...i,...r,ref:t})},`AlertDialogTitle`)),ke=q.forwardRef(X(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Z(n);return(0,J.jsx)(E,{...i,...r,ref:t})},`AlertDialogDescription`)),Ae=q.forwardRef(X(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Z(n);return(0,J.jsx)(O,{...i,...r,ref:t})},`AlertDialogAction`)),je=`AlertDialogCancel`,Me=q.forwardRef(X(function(e,t){let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=$(je,n),a=Z(n),o=S(t,i);return(0,J.jsx)(O,{...a,...r,ref:o})},`AlertDialogCancel`)),Ne=we,Pe=Te,Fe=Q,Ie=De,Le=Ae,Re=Me,ze=Oe,Be=ke;function Ve({...e}){return(0,J.jsx)(Ne,{"data-slot":`alert-dialog`,...e})}function He({...e}){return(0,J.jsx)(Pe,{"data-slot":`alert-dialog-portal`,...e})}function Ue({className:e,...t}){return(0,J.jsx)(Fe,{"data-slot":`alert-dialog-overlay`,className:A(`fixed inset-0 z-50 bg-[var(--overlay-scrim)] duration-100 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function We({className:e,size:t=`default`,...n}){return(0,J.jsxs)(He,{children:[(0,J.jsx)(Ue,{}),(0,J.jsx)(Ie,{"data-slot":`alert-dialog-content`,"data-size":t,className:A(`group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid max-h-[calc(100vh-2rem)] supports-[height:100dvh]:max-h-[calc(100dvh-2rem)] w-full -translate-x-1/2 -translate-y-1/2 gap-4 overflow-y-auto overscroll-contain rounded-xl bg-popover p-4 text-popover-foreground shadow-float duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...n})]})}function Ge({className:e,...t}){return(0,J.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:A(`grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]`,e),...t})}function Ke({className:e,...t}){return(0,J.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:A(`-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t border-stroke bg-surface-subtle px-4 py-3 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end`,e),...t})}function qe({className:e,...t}){return(0,J.jsx)(ze,{"data-slot":`alert-dialog-title`,className:A(`font-heading text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2`,e),...t})}function Je({className:e,...t}){return(0,J.jsx)(Be,{"data-slot":`alert-dialog-description`,className:A(`text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function Ye({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,J.jsx)(j,{variant:t,size:n,asChild:!0,children:(0,J.jsx)(Le,{"data-slot":`alert-dialog-action`,className:A(e),...r})})}function Xe({className:e,variant:t=`outline`,size:n=`default`,...r}){return(0,J.jsx)(j,{variant:t,size:n,asChild:!0,children:(0,J.jsx)(Re,{"data-slot":`alert-dialog-cancel`,className:A(e),...r})})}function Ze(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function Qe({open:e,onOpenChange:t,onInstalled:n}){let{t:a}=r(),[o,s]=(0,q.useState)(``),[l,u]=(0,q.useState)(null),[d,f]=(0,q.useState)(!1),[m,h]=(0,q.useState)(``);return(0,q.useEffect)(()=>{e||(s(``),u(null),f(!1),h(``))},[e]),(0,J.jsx)(L,{open:e,onOpenChange:e=>!d&&t(e),children:(0,J.jsxs)(N,{className:`z-[220] sm:max-w-xl`,overlayClassName:`z-[220]`,children:[(0,J.jsxs)(I,{children:[(0,J.jsxs)(P,{className:`flex items-center gap-2`,children:[(0,J.jsx)(K,{className:`size-4 text-content-secondary`}),a(`plugins:pluginsPage.installLocalPlugin`)]}),(0,J.jsx)(M,{children:a(`plugins:pluginsPage.installLocalPluginDescription`)})]}),(0,J.jsxs)(`div`,{className:`grid gap-3`,children:[(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-xs font-medium text-content-secondary`,children:[a(`plugins:pluginsPage.pluginDirectory`),(0,J.jsxs)(`span`,{className:`flex min-w-0 gap-2`,children:[(0,J.jsx)(R,{className:`min-w-0 flex-1 font-mono text-xs max-[650px]:h-11`,value:o,disabled:d,placeholder:a(`plugins:pluginsPage.pluginDirectoryPlaceholder`),onChange:e=>{s(e.target.value),u(null)}}),(0,J.jsx)(j,{type:`button`,variant:`secondary`,size:`icon`,className:`size-[34px] shrink-0 max-[650px]:size-11`,title:a(`plugins:pluginsPage.chooseDirectory`),"aria-label":a(`plugins:pluginsPage.chooseDirectory`),onClick:async()=>{h(``);try{let e=await ce(o,a(`plugins:pluginsPage.chooseDirectory`));e.status===`picked`?(s(e.path),u(null)):e.status===`unavailable`&&h(a(`common:workspacePicker.systemPickerUnavailable`))}catch(e){h(e instanceof Error?e.message:String(e))}},children:(0,J.jsx)(p,{})})]})]}),l&&(0,J.jsxs)(`div`,{className:`grid gap-3 overflow-hidden rounded-md border border-stroke bg-surface-subtle p-3`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,J.jsx)(`span`,{className:`grid size-8 shrink-0 place-items-center rounded-sm bg-success-soft text-success`,children:(0,J.jsx)(c,{className:`size-4`})}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`strong`,{className:`block truncate text-sm font-medium text-content`,children:l.plugin.name}),(0,J.jsxs)(`small`,{className:`block truncate font-mono text-xs text-content-muted tabular-nums`,children:[l.plugin.id,` · v`,l.plugin.version,` · `,l.fileCount,` `,a(`plugins:pluginsPage.files`),` · `,Ze(l.byteCount)]})]})]}),(0,J.jsx)(`div`,{className:`grid gap-1.5`,children:l.plugin.capabilities.map(e=>(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-3 border-t border-stroke-soft pt-2 text-xs`,children:[(0,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsx)(`strong`,{className:`block font-medium text-content`,children:e.label}),(0,J.jsx)(`small`,{className:`text-xs text-content-muted`,children:e.description})]}),(0,J.jsx)(`code`,{className:`shrink-0 font-mono text-xs text-content-secondary`,children:e.name})]},e.name))}),(0,J.jsxs)(`div`,{className:`flex items-start gap-2 rounded-sm bg-warning-soft p-2.5 text-xs leading-5 text-warning-strong`,children:[(0,J.jsx)(b,{className:`mt-0.5 shrink-0`,size:15}),(0,J.jsx)(`span`,{children:a(`plugins:pluginsPage.localPluginSecurityWarning`)})]})]}),m&&(0,J.jsxs)(he,{className:`m-0`,children:[(0,J.jsx)(b,{size:14}),(0,J.jsx)(`span`,{children:m})]})]}),(0,J.jsxs)(F,{children:[(0,J.jsx)(j,{type:`button`,variant:`secondary`,size:`dialogAction`,disabled:d,onClick:()=>t(!1),children:a(`common:ui.cancel`)}),(0,J.jsxs)(j,{type:`button`,size:`dialogAction`,disabled:d||!l&&!o.trim(),onClick:l?async()=>{if(!(!l||d)){f(!0),h(``);try{await i(`/api/plugins/install`,{method:`POST`,body:JSON.stringify({inspectionId:l.inspectionId})}),await n(),t(!1)}catch(e){h(e instanceof Error?e.message:String(e))}finally{f(!1)}}}:async()=>{if(!(!o.trim()||d)){f(!0),h(``);try{u(await i(`/api/plugins/inspect`,{method:`POST`,body:JSON.stringify({path:o.trim()})}))}catch(e){u(null),h(e instanceof Error?e.message:String(e))}finally{f(!1)}}},children:[d?(0,J.jsx)(oe,{className:`text-current`}):l?(0,J.jsx)(K,{}):(0,J.jsx)(c,{}),a(d?`plugins:pluginsPage.processing`:l?`plugins:pluginsPage.installPlugin`:`plugins:pluginsPage.inspectPlugin`)]})]})]})})}var $e=[`tool`,`prompt`,`skill`];function et(e){let t=Array.isArray(e.resourceTypes)?e.resourceTypes.filter(e=>$e.includes(e)):[];return t.length?t:[`tool`]}function tt(e,t){return{tool:t(`plugins:pluginsPage.extensionType.tool`),prompt:t(`plugins:pluginsPage.extensionType.prompt`),skill:t(`plugins:pluginsPage.extensionType.skill`)}[e]}var nt=[`all`,`builtin`,`local`],rt={read:d,ls:p,grep:v,find:v,edit:f,write:f,bash:y,web_search:l,browser_automation:l,generate_visual:m};function it(e,t){return t(e===`builtin`?`plugins:pluginsPage.builtIn`:e===`local`?`plugins:pluginsPage.local`:`plugins:pluginsPage.all`)}function at(e){return e.flatMap(e=>e.managedExternally?[]:e.capabilities.filter(e=>e.enabled).map(e=>e.name))}function ot(e){return e.filter(e=>!e.managedExternally||e.source===`pi`).flatMap(e=>e.capabilities.map(t=>({...t,pluginId:e.id,pluginName:e.name,pluginDescription:e.description,pluginVersion:e.version,pluginSource:e.source,pluginBuiltIn:e.builtIn,pluginPermissions:e.permissions||[],pluginSystemAccess:!!e.systemAccess})))}function st(e){return e.find(e=>e.source===`pi`&&e.name===`Computer Use`)?.enabled!==!1}function ct(e){return Object.fromEntries(e.filter(e=>e.source===`pi`&&e.name!==`Computer Use`&&!!e.packageSource).map(e=>[e.packageSource,e.enabled!==!1]))}function lt(e,t){return[...e].sort().join(`\0`)===[...t].sort().join(`\0`)}function ut(e,t){return W({id:e.name,name:e.label},t)}function dt(e,t){return e.pluginSource===`pi`?e.pluginName:G(e.pluginName,t)}function ft({value:e,testing:t,onChange:n,onTest:i}){let{t:a}=r();return(0,J.jsxs)(`div`,{className:`plugin-tool-config grid gap-2.5 border-t border-stroke pt-3 [&_label]:grid [&_label]:gap-1.5 [&_label]:text-xs [&_label]:font-medium [&_label]:text-content-secondary`,children:[(0,J.jsxs)(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-3`,children:[(0,J.jsxs)(`label`,{children:[a(`plugins:pluginsPage.defaultLanguage`),(0,J.jsxs)(U,{value:e.language,onChange:t=>n({...e,language:t.target.value}),children:[(0,J.jsx)(`option`,{value:`auto`,children:a(`plugins:pluginsPage.auto`)}),(0,J.jsx)(`option`,{value:`zh-CN`,children:a(`plugins:pluginsPage.simplifiedChinese`)}),(0,J.jsx)(`option`,{value:`en-US`,children:a(`plugins:pluginsPage.english`)})]})]}),(0,J.jsxs)(`label`,{children:[a(`plugins:pluginsPage.safeSearch`),(0,J.jsxs)(U,{value:e.safeSearch,onChange:t=>n({...e,safeSearch:Number(t.target.value)}),children:[(0,J.jsx)(`option`,{value:0,children:a(`plugins:pluginsPage.off`)}),(0,J.jsx)(`option`,{value:1,children:a(`plugins:pluginsPage.moderate`)}),(0,J.jsx)(`option`,{value:2,children:a(`plugins:pluginsPage.strict`)})]})]}),(0,J.jsxs)(`label`,{children:[a(`plugins:pluginsPage.resultCount`),(0,J.jsx)(R,{type:`number`,min:`1`,max:`12`,className:`tabular-nums`,value:e.maxResults,onChange:t=>n({...e,maxResults:Number(t.target.value)})})]})]}),(0,J.jsxs)(j,{type:`button`,variant:`secondary`,className:`justify-self-end max-[650px]:h-11`,loading:t,disabled:t,onClick:i,children:[(0,J.jsx)(l,{}),a(t?`plugins:pluginsPage.testing`:`plugins:pluginsPage.testConnection`)]})]})}function pt({query:e,notify:t,requestText:n,requestConfirm:a}){let{t:o}=r(),[s,c]=(0,q.useState)(``),[l,d]=(0,q.useState)(null),[f,p]=(0,q.useState)([]),[m,g]=(0,q.useState)(!1),[_,y]=(0,q.useState)(``),[ee,b]=(0,q.useState)(``),x=(0,q.useCallback)(async(e=``)=>{g(!0),b(``);try{let[t,n]=await Promise.all([i(`/api/extensions/market?name=${encodeURIComponent(e)}`),i(`/api/extensions`)]);d(t),p(n.packages||[])}catch(e){b(e instanceof Error?e.message:String(e))}finally{g(!1)}},[]);(0,q.useEffect)(()=>{x(``)},[x]);let S=(l?.packages||[]).filter(t=>`${t.name} ${t.description}`.toLowerCase().includes(e.trim().toLowerCase())),C=async e=>{if(await a?.({title:o(`plugins:pluginsPage.installExtension`),message:o(`plugins:pluginsPage.extensionSecurityWarning`,{name:e}),confirmLabel:o(`plugins:pluginsPage.installExtension`),tone:`danger`})!==!1){y(e);try{let n=/^(?:[.~\\/]|[A-Za-z]:[\\/])/.test(e)||/^(?:npm:|https?:\/\/|git\+)/i.test(e)?e:`npm:${e}`,r=await i(`/api/extensions/install`,{method:`POST`,body:JSON.stringify({source:n})});p(r.packages||[]),t(o(`plugins:pluginsPage.extensionInstalled`),`success`)}catch(e){t(e instanceof Error?e.message:String(e),`error`)}finally{y(``)}}},w=async()=>{let e=await n?.({title:o(`plugins:pluginsPage.installExtension`),message:o(`plugins:pluginsPage.extensionSourceHelp`),inputLabel:o(`plugins:pluginsPage.extensionSource`),placeholder:`npm:@scope/package or https://github.com/…`,maxLength:2e3});e?.trim()&&await C(e.trim())},T=async e=>{if(await a?.({title:o(`plugins:pluginsPage.uninstallExtension`),message:o(`plugins:pluginsPage.uninstallExtensionDescription`,{name:e.name}),confirmLabel:o(`plugins:pluginsPage.uninstallExtension`),tone:`danger`})!==!1){y(e.source);try{await i(`/api/extensions`,{method:`DELETE`,body:JSON.stringify({source:e.source,scope:e.scope})}),await x(s),t(o(`plugins:pluginsPage.extensionUninstalled`),`success`)}catch(e){t(e instanceof Error?e.message:String(e),`error`)}finally{y(``)}}},ne=$e.map(e=>({type:e,items:f.filter(t=>et(t).includes(e))})).filter(e=>e.items.length>0);return(0,J.jsxs)(J.Fragment,{children:[ne.map(e=>(0,J.jsx)(V,{className:`plugin-installed-extensions`,title:`${o(`plugins:pluginsPage.installedExtensions`)} · ${tt(e.type,o)}`,count:e.items.length,children:(0,J.jsx)(B,{children:e.items.map(t=>(0,J.jsx)(z,{icon:(0,J.jsx)(h,{}),name:(0,J.jsx)(`span`,{className:`font-mono`,children:t.name}),nameMeta:`v${t.version}`,description:(0,J.jsx)(`span`,{className:`font-mono text-xs`,children:t.source}),actions:(0,J.jsxs)(j,{type:`button`,variant:`ghost`,size:`sm`,className:`text-content-muted hover:bg-danger-soft hover:text-danger`,loading:_===t.source,disabled:!!_,onClick:()=>void T(t),children:[(0,J.jsx)(te,{}),o(`plugins:pluginsPage.uninstallExtension`)]})},`${e.type}:${t.scope}:${t.source}`))})},e.type)),(0,J.jsxs)(V,{className:`plugin-market`,title:o(`plugins:pluginsPage.extensionMarket`),actions:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(j,{asChild:!0,variant:`ghost`,size:`sm`,children:(0,J.jsxs)(`a`,{href:`https://pi.dev/packages`,target:`_blank`,rel:`noreferrer`,children:[(0,J.jsx)(u,{}),o(`plugins:pluginsPage.openPackageCatalog`)]})}),(0,J.jsxs)(j,{type:`button`,variant:`secondary`,size:`sm`,onClick:w,disabled:!!_,children:[(0,J.jsx)(K,{}),o(`plugins:pluginsPage.installExtension`)]})]}),children:[(0,J.jsxs)(`form`,{className:`mb-3 flex min-w-0 gap-2`,onSubmit:e=>{e.preventDefault(),x(s)},children:[(0,J.jsx)(R,{className:`min-w-0 flex-1 max-[650px]:h-11`,value:s,onChange:e=>c(e.target.value),placeholder:o(`plugins:pluginsPage.searchPackageCatalog`),"aria-label":o(`plugins:pluginsPage.searchPackageCatalog`)}),(0,J.jsxs)(j,{type:`submit`,variant:`secondary`,className:`h-[34px] max-[650px]:h-11`,loading:m,disabled:m,children:[(0,J.jsx)(v,{}),o(`plugins:pluginsPage.search`)]})]}),ee&&(0,J.jsx)(H,{className:`mt-0 mb-3`,children:ee}),S.length>0&&(0,J.jsx)(B,{children:S.slice(0,12).map(e=>{let t=f.some(t=>t.name===e.name||t.source===`npm:${e.name}`);return(0,J.jsx)(z,{icon:(0,J.jsx)(h,{}),name:(0,J.jsx)(`span`,{className:`font-mono`,children:e.name}),description:e.description,status:e.published,actions:(0,J.jsx)(j,{type:`button`,variant:`secondary`,size:`sm`,loading:_===e.name,disabled:t||!!_,onClick:()=>void C(e.name),children:o(t?`plugins:pluginsPage.installed`:`plugins:pluginsPage.installExtension`)})},e.name)})})]})]})}function mt({notify:e,onBack:t,requestText:n,requestConfirm:s}){let{t:c}=r(),l=se(`focusSearch`),u=o(e=>e.capabilities),d=a(u,`plugins`),f=d?nt:nt.slice(0,2),[p,m]=(0,q.useState)(``),[h,v]=(0,q.useState)(null),[y,S]=(0,q.useState)([]),[C,w]=(0,q.useState)(``),[T,ne]=(0,q.useState)(`all`),[E,D]=(0,q.useState)({provider:`bing`,language:`auto`,safeSearch:1,maxResults:8}),[O,k]=(0,q.useState)(!1),[re,ie]=(0,q.useState)(!1),[ae,M]=(0,q.useState)(!1),[N,P]=(0,q.useState)(null),[F,I]=(0,q.useState)(!1),[L,R]=(0,q.useState)(``),[ce,H]=(0,q.useState)(!1),U=(0,q.useCallback)(e=>{v(e),S(e.plugins),D(e.webSearch)},[]),W=(0,q.useCallback)(async()=>{R(``);try{U(await i(`/api/plugins`))}catch(e){R(e instanceof Error?e.message:String(e))}},[U]);(0,q.useEffect)(()=>{W()},[W]);let G=(0,q.useMemo)(()=>ot(y),[y]),Y=(0,q.useMemo)(()=>at(y),[y]),X=h?!lt(Y,h.enabledTools)||st(y)!==h.computerUseEnabled||JSON.stringify(ct(y))!==JSON.stringify(h.piExtensions)||JSON.stringify(E)!==JSON.stringify(h.webSearch):!1,Se=(0,q.useCallback)(async()=>{if(!O){if(!h||!X){h&&e(c(`plugins:pluginsPage.noPluginPolicyChanges`));return}k(!0),R(``);try{let t=await i(`/api/plugins`,{method:`PUT`,body:JSON.stringify({enabledTools:Y,webSearch:E,computerUseEnabled:st(y),piExtensions:ct(y)})});U(t),e(c(`plugins:pluginsPage.pluginPolicySavedAgentRuntimeUpdated`))}catch(e){R(e instanceof Error?e.message:String(e))}finally{k(!1)}}},[U,h,X,y,Y,e,O,c,E]),Ce=async()=>{ie(!0),R(``);try{let t=await i(`/api/plugins/web-search/test`,{method:`POST`,body:JSON.stringify(E)});e(c(`plugins:pluginsPage.bingSearchIsAvailableAndReturnedCountResults`,{count:t.count}))}catch(t){let n=t instanceof Error?t.message:String(t);R(n),e(n,`error`)}finally{ie(!1)}},Z=(e,t,n)=>{S(r=>r.map(r=>{if(r.id!==e)return r;let i=r.source===`pi`&&r.managedExternally;return{...r,enabled:n||r.capabilities.some(e=>e.enabled),capabilities:r.capabilities.map(e=>i||e.name===t?{...e,enabled:n}:e)}}))},we=()=>!X||(R(c(`plugins:pluginsPage.saveBeforePluginChanges`)),!1),Te=async()=>{if(!(!N||F)){I(!0),R(``);try{U(await i(`/api/plugins/${encodeURIComponent(N.pluginId)}`,{method:`DELETE`})),e(c(`plugins:pluginsPage.pluginUninstalled`,{name:N.pluginName})),w(``),P(null)}catch(e){R(e instanceof Error?e.message:String(e))}finally{I(!1)}}},Q=c(`navigation:navigation.plugins`),Ee=p.trim().toLowerCase(),$=G.filter(e=>T!==`all`&&e.pluginSource!==T?!1:[ut(e,c),e.name,e.description,dt(e,c),e.pluginId].join(` `).toLowerCase().includes(Ee));return(0,J.jsxs)(fe,{title:Q,description:c(`plugins:pluginsPage.lede`),back:t&&{label:c(`navigation:sidebar.features`),ariaLabel:c(`navigation:shell.backToFeaturesLabel`),onBack:t},toolbar:(0,J.jsx)(pe,{search:(0,J.jsx)(de,{id:x,value:p,onValueChange:m,placeholder:c(`navigation:pageHeader.searchPage`,{page:Q}),shortcut:l,clearLabel:c(`navigation:more.clearSearch`)}),actions:(0,J.jsxs)(J.Fragment,{children:[d&&(0,J.jsxs)(j,{type:`button`,variant:`secondary`,className:`h-9`,disabled:!h,onClick:()=>we()&&M(!0),children:[(0,J.jsx)(K,{}),c(`plugins:pluginsPage.installPlugin`)]}),(0,J.jsxs)(j,{type:`button`,className:`h-9`,"data-plugins-save":!0,loading:O,disabled:!h||O,onClick:()=>void Se(),children:[(0,J.jsx)(_,{}),c(`plugins:pluginsPage.savePolicy`)]})]}),filters:(0,J.jsx)(me,{options:f.map(e=>it(e,c)),value:it(T,c),onChange:e=>ne(f.find(t=>it(t,c)===e)||`all`)})}),children:[h?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(V,{className:`plugin-catalog`,title:c(`plugins:pluginsPage.toolCatalog`),count:$.length,meta:(0,J.jsxs)(`span`,{className:`plugin-catalog-summary`,children:[G.filter(e=>e.enabled).length,`/`,G.length,` `,c(`plugins:pluginsPage.enabled2`)]}),actions:X&&(0,J.jsxs)(`span`,{"data-plugins-unsaved":!0,className:`flex items-center gap-1.5 text-xs font-medium text-content-secondary`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`size-1.5 rounded-full bg-content-secondary`}),c(`plugins:pluginsPage.unsaved`)]}),children:$.length?(0,J.jsx)(B,{className:`plugin-tool-grid`,children:$.map(e=>{let t=rt[e.name]||g,n=ut(e,c);return(0,J.jsx)(z,{className:`plugin-tool-card`,"data-plugin-tool":e.name,icon:(0,J.jsx)(t,{}),name:(0,J.jsx)(`span`,{title:n,children:n}),nameMeta:e.name,description:`${dt(e,c)} · ${ye(e.risk,c)}`,status:e.pluginBuiltIn?void 0:c(`plugins:pluginsPage.local`),actions:(0,J.jsx)(ge,{value:e.enabled,onChange:t=>Z(e.pluginId,e.name,t),ariaLabel:n}),expanded:C===e.name,onExpandedChange:t=>w(t?e.name:``),toggleLabel:c(`plugins:pluginsPage.toggleToolDetails`,{name:n}),detail:(0,J.jsxs)(`div`,{className:`plugin-tool-details grid gap-3`,children:[(0,J.jsx)(`p`,{className:`text-sm leading-relaxed text-content-soft`,children:_e({id:e.name,description:e.description},c)}),(0,J.jsxs)(`dl`,{className:`grid grid-cols-[88px_minmax(0,1fr)] gap-x-3 gap-y-1.5 text-xs [&_dd]:min-w-0 [&_dd]:[overflow-wrap:anywhere] [&_dd]:text-content-soft [&_dt]:text-content-muted [&>div]:contents`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{children:c(`plugins:pluginsPage.source`)}),(0,J.jsxs)(`dd`,{className:`tabular-nums`,children:[dt(e,c),!e.pluginBuiltIn&&` · v${e.pluginVersion}`]})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{children:c(`plugins:pluginsPage.riskLevel`)}),(0,J.jsx)(`dd`,{className:A((xe(e.risk)||ve(e.risk))&&`font-medium text-content!`),children:ye(e.risk,c)})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{children:c(`plugins:pluginsPage.pathScope`)}),(0,J.jsx)(`dd`,{children:be({id:e.name,scope:e.scope},c)})]}),!e.pluginBuiltIn&&(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{children:c(`plugins:pluginsPage.executionMode`)}),(0,J.jsx)(`dd`,{children:c(`plugins:pluginsPage.confirmUnlessFullAccess`)})]})]}),!e.pluginBuiltIn&&(0,J.jsxs)(`div`,{className:`plugin-tool-warning flex items-start gap-2 rounded-sm bg-surface-subtle p-2.5 text-xs leading-normal text-content-secondary`,children:[(0,J.jsx)(ee,{className:`mt-px size-3.5 shrink-0`,"aria-hidden":`true`}),(0,J.jsx)(`span`,{children:c(`plugins:pluginsPage.localPluginSecurityWarning`)})]}),e.name===`web_search`&&(0,J.jsx)(ft,{value:E,testing:re,onChange:D,onTest:Ce}),!e.pluginBuiltIn&&(0,J.jsxs)(j,{type:`button`,variant:`ghost`,className:`justify-self-end text-danger hover:bg-danger-soft hover:text-danger max-[650px]:h-11`,onClick:()=>we()&&P(e),children:[(0,J.jsx)(te,{}),c(`plugins:pluginsPage.uninstallPlugin`)]})]})},e.name)})}):(0,J.jsx)(ue,{compact:!0,title:c(`plugins:pluginsPage.noMatchingTools`)})}),(0,J.jsx)(pt,{query:p,notify:e,requestText:n,requestConfirm:s})]}):L?(0,J.jsx)(le,{kind:`error`,title:c(`plugins:pluginsPage.loadFailed`),description:L,action:(0,J.jsx)(j,{variant:`secondary`,className:`max-[650px]:h-11`,loading:ce,disabled:ce,onClick:()=>{H(!0),W().finally(()=>H(!1))},children:c(`common:pageTemplate.retry`)})}):(0,J.jsx)(le,{kind:`loading`,title:c(`plugins:pluginsPage.loadingToolPlugins`)}),d&&(0,J.jsx)(Qe,{open:ae,onOpenChange:M,onInstalled:W}),(0,J.jsx)(Ve,{open:!!N,onOpenChange:e=>!e&&!F&&P(null),children:(0,J.jsxs)(We,{className:`z-[220]`,children:[(0,J.jsxs)(Ge,{children:[(0,J.jsx)(qe,{children:c(`plugins:pluginsPage.uninstallPlugin`)}),(0,J.jsx)(Je,{children:c(`plugins:pluginsPage.uninstallPluginDescription`,{name:N?.pluginName||``})})]}),(0,J.jsxs)(Ke,{children:[(0,J.jsx)(Xe,{disabled:F,children:c(`common:ui.cancel`)}),(0,J.jsxs)(Ye,{variant:`destructive`,disabled:F,onClick:Te,children:[F&&(0,J.jsx)(oe,{className:`text-current`}),c(`plugins:pluginsPage.uninstallPlugin`)]})]})]})}),L&&h&&(0,J.jsxs)(he,{className:`fixed right-6 bottom-6 z-[21] max-w-[360px] border border-danger-border shadow-float`,children:[(0,J.jsx)(b,{size:13}),L]})]})}export{mt as PluginsPage};
|
|
1
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-_vdxObu5.js";import{t as i}from"./api-BW_X0FMZ.js";import{i as a}from"./runtime-capabilities-CHYOF_hE.js";import{t as o}from"./runtime-capabilities-store-BNM5Ug-5.js";import{t as s}from"./createLucideIcon-Cd-3GVxJ.js";import{t as c}from"./circle-check-iEdCm3Pw.js";import{t as l}from"./earth-Ddy13fHh.js";import{t as u}from"./external-link-CEQqPcqc.js";import{t as d}from"./eye-uWAPXNzJ.js";import{t as f}from"./file-code-corner-BnE1ljT0.js";import{t as p}from"./folder-open-FIShC5Qk.js";import{t as m}from"./image-BY_c3FYU.js";import{t as h}from"./package-BOmkLaKS.js";import{t as g}from"./plug-BsIeHRwC.js";import{t as _}from"./save-CHBB52P8.js";import{t as v}from"./search-D0mqDaf_.js";import{t as y}from"./server-BgNvmqwJ.js";import{t as ee}from"./shield-alert-oZqX6MNu.js";import{t as te}from"./trash-2-CNrPOoPR.js";import{t as b}from"./triangle-alert-CE1q54ci.js";import{t as x}from"./more-pages-D_PnxLN0.js";import{a as S}from"./dist-41X0pdUs.js";import{o as C,s as w}from"./dist-BsRXXcSL.js";import{a as T,c as ne,i as E,l as D,n as O,o as k,r as re,s as ie,t as ae}from"./dist-BHkR6BLP.js";import{t as A}from"./utils-C8uzG5AZ.js";import{n as oe,t as j}from"./button-CCcCN8tE.js";import{s as se}from"./shortcuts-D72gQCwH.js";import{a as M,i as N,l as P,o as F,s as I,t as L}from"./dialog-DFZX_Dek.js";import{t as R}from"./input-CPw-zkYh.js";import{t as ce}from"./pick-system-directory-yk6L7wR2.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-BB1TeMlr.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-Bexnwp5q.js";var K=s(`package-plus`,[[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`path`,{d:`M16 17h6`,key:`1ook5g`}],[`path`,{d:`M19 14v6`,key:`1ckrd5`}],[`path`,{d:`M21 10.535V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l1.675-.955`,key:`28k6lz`}],[`path`,{d:`M3.29 7 12 12l8.71-5`,key:`19ckod`}],[`path`,{d:`m7.5 4.27 8.997 5.148`,key:`9yrvtv`}]]),q=e(t(),1),J=n(),Y=Object.defineProperty,X=(e,t)=>Y(e,`name`,{value:t,configurable:!0}),[Se,Ce]=w(`AlertDialog`,[D]),Z=D(),we=X(e=>{let{__scopeAlertDialog:t,...n}=e,r=Z(t);return(0,J.jsx)(ae,{...r,...n,modal:!0})},`AlertDialog`);q.forwardRef(X(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Z(n);return(0,J.jsx)(ne,{...i,...r,ref:t})},`AlertDialogTrigger`));var Te=X(e=>{let{__scopeAlertDialog:t,...n}=e,r=Z(t);return(0,J.jsx)(k,{...r,...n})},`AlertDialogPortal`),Q=q.forwardRef(X(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Z(n);return(0,J.jsx)(T,{...i,...r,ref:t})},`AlertDialogOverlay`)),[Ee,$]=Se(`AlertDialogContent`),De=q.forwardRef(X(function(e,t){let{__scopeAlertDialog:n,children:r,...i}=e,a=Z(n),o=q.useRef(null),s=S(t,o),c=q.useRef(null);return(0,J.jsx)(Ee,{scope:n,cancelRef:c,children:(0,J.jsx)(re,{role:`alertdialog`,...a,...i,ref:s,onOpenAutoFocus:C(i.onOpenAutoFocus,e=>{e.preventDefault(),c.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:r})})},`AlertDialogContent`)),Oe=q.forwardRef(X(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Z(n);return(0,J.jsx)(ie,{...i,...r,ref:t})},`AlertDialogTitle`)),ke=q.forwardRef(X(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Z(n);return(0,J.jsx)(E,{...i,...r,ref:t})},`AlertDialogDescription`)),Ae=q.forwardRef(X(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Z(n);return(0,J.jsx)(O,{...i,...r,ref:t})},`AlertDialogAction`)),je=`AlertDialogCancel`,Me=q.forwardRef(X(function(e,t){let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=$(je,n),a=Z(n),o=S(t,i);return(0,J.jsx)(O,{...a,...r,ref:o})},`AlertDialogCancel`)),Ne=we,Pe=Te,Fe=Q,Ie=De,Le=Ae,Re=Me,ze=Oe,Be=ke;function Ve({...e}){return(0,J.jsx)(Ne,{"data-slot":`alert-dialog`,...e})}function He({...e}){return(0,J.jsx)(Pe,{"data-slot":`alert-dialog-portal`,...e})}function Ue({className:e,...t}){return(0,J.jsx)(Fe,{"data-slot":`alert-dialog-overlay`,className:A(`fixed inset-0 z-50 bg-[var(--overlay-scrim)] duration-100 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function We({className:e,size:t=`default`,...n}){return(0,J.jsxs)(He,{children:[(0,J.jsx)(Ue,{}),(0,J.jsx)(Ie,{"data-slot":`alert-dialog-content`,"data-size":t,className:A(`group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid max-h-[calc(100vh-2rem)] supports-[height:100dvh]:max-h-[calc(100dvh-2rem)] w-full -translate-x-1/2 -translate-y-1/2 gap-4 overflow-y-auto overscroll-contain rounded-xl bg-popover p-4 text-popover-foreground shadow-float duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...n})]})}function Ge({className:e,...t}){return(0,J.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:A(`grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]`,e),...t})}function Ke({className:e,...t}){return(0,J.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:A(`-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t border-stroke bg-surface-subtle px-4 py-3 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end`,e),...t})}function qe({className:e,...t}){return(0,J.jsx)(ze,{"data-slot":`alert-dialog-title`,className:A(`font-heading text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2`,e),...t})}function Je({className:e,...t}){return(0,J.jsx)(Be,{"data-slot":`alert-dialog-description`,className:A(`text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function Ye({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,J.jsx)(j,{variant:t,size:n,asChild:!0,children:(0,J.jsx)(Le,{"data-slot":`alert-dialog-action`,className:A(e),...r})})}function Xe({className:e,variant:t=`outline`,size:n=`default`,...r}){return(0,J.jsx)(j,{variant:t,size:n,asChild:!0,children:(0,J.jsx)(Re,{"data-slot":`alert-dialog-cancel`,className:A(e),...r})})}function Ze(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function Qe({open:e,onOpenChange:t,onInstalled:n}){let{t:a}=r(),[o,s]=(0,q.useState)(``),[l,u]=(0,q.useState)(null),[d,f]=(0,q.useState)(!1),[m,h]=(0,q.useState)(``);return(0,q.useEffect)(()=>{e||(s(``),u(null),f(!1),h(``))},[e]),(0,J.jsx)(L,{open:e,onOpenChange:e=>!d&&t(e),children:(0,J.jsxs)(N,{className:`z-[220] sm:max-w-xl`,overlayClassName:`z-[220]`,children:[(0,J.jsxs)(I,{children:[(0,J.jsxs)(P,{className:`flex items-center gap-2`,children:[(0,J.jsx)(K,{className:`size-4 text-content-secondary`}),a(`plugins:pluginsPage.installLocalPlugin`)]}),(0,J.jsx)(M,{children:a(`plugins:pluginsPage.installLocalPluginDescription`)})]}),(0,J.jsxs)(`div`,{className:`grid gap-3`,children:[(0,J.jsxs)(`label`,{className:`grid gap-1.5 text-xs font-medium text-content-secondary`,children:[a(`plugins:pluginsPage.pluginDirectory`),(0,J.jsxs)(`span`,{className:`flex min-w-0 gap-2`,children:[(0,J.jsx)(R,{className:`min-w-0 flex-1 font-mono text-xs max-[650px]:h-11`,value:o,disabled:d,placeholder:a(`plugins:pluginsPage.pluginDirectoryPlaceholder`),onChange:e=>{s(e.target.value),u(null)}}),(0,J.jsx)(j,{type:`button`,variant:`secondary`,size:`icon`,className:`size-[34px] shrink-0 max-[650px]:size-11`,title:a(`plugins:pluginsPage.chooseDirectory`),"aria-label":a(`plugins:pluginsPage.chooseDirectory`),onClick:async()=>{h(``);try{let e=await ce(o,a(`plugins:pluginsPage.chooseDirectory`));e.status===`picked`?(s(e.path),u(null)):e.status===`unavailable`&&h(a(`common:workspacePicker.systemPickerUnavailable`))}catch(e){h(e instanceof Error?e.message:String(e))}},children:(0,J.jsx)(p,{})})]})]}),l&&(0,J.jsxs)(`div`,{className:`grid gap-3 overflow-hidden rounded-md border border-stroke bg-surface-subtle p-3`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,J.jsx)(`span`,{className:`grid size-8 shrink-0 place-items-center rounded-sm bg-success-soft text-success`,children:(0,J.jsx)(c,{className:`size-4`})}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`strong`,{className:`block truncate text-sm font-medium text-content`,children:l.plugin.name}),(0,J.jsxs)(`small`,{className:`block truncate font-mono text-xs text-content-muted tabular-nums`,children:[l.plugin.id,` · v`,l.plugin.version,` · `,l.fileCount,` `,a(`plugins:pluginsPage.files`),` · `,Ze(l.byteCount)]})]})]}),(0,J.jsx)(`div`,{className:`grid gap-1.5`,children:l.plugin.capabilities.map(e=>(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-3 border-t border-stroke-soft pt-2 text-xs`,children:[(0,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsx)(`strong`,{className:`block font-medium text-content`,children:e.label}),(0,J.jsx)(`small`,{className:`text-xs text-content-muted`,children:e.description})]}),(0,J.jsx)(`code`,{className:`shrink-0 font-mono text-xs text-content-secondary`,children:e.name})]},e.name))}),(0,J.jsxs)(`div`,{className:`flex items-start gap-2 rounded-sm bg-warning-soft p-2.5 text-xs leading-5 text-warning-strong`,children:[(0,J.jsx)(b,{className:`mt-0.5 shrink-0`,size:15}),(0,J.jsx)(`span`,{children:a(`plugins:pluginsPage.localPluginSecurityWarning`)})]})]}),m&&(0,J.jsxs)(he,{className:`m-0`,children:[(0,J.jsx)(b,{size:14}),(0,J.jsx)(`span`,{children:m})]})]}),(0,J.jsxs)(F,{children:[(0,J.jsx)(j,{type:`button`,variant:`secondary`,size:`dialogAction`,disabled:d,onClick:()=>t(!1),children:a(`common:ui.cancel`)}),(0,J.jsxs)(j,{type:`button`,size:`dialogAction`,disabled:d||!l&&!o.trim(),onClick:l?async()=>{if(!(!l||d)){f(!0),h(``);try{await i(`/api/plugins/install`,{method:`POST`,body:JSON.stringify({inspectionId:l.inspectionId})}),await n(),t(!1)}catch(e){h(e instanceof Error?e.message:String(e))}finally{f(!1)}}}:async()=>{if(!(!o.trim()||d)){f(!0),h(``);try{u(await i(`/api/plugins/inspect`,{method:`POST`,body:JSON.stringify({path:o.trim()})}))}catch(e){u(null),h(e instanceof Error?e.message:String(e))}finally{f(!1)}}},children:[d?(0,J.jsx)(oe,{className:`text-current`}):l?(0,J.jsx)(K,{}):(0,J.jsx)(c,{}),a(d?`plugins:pluginsPage.processing`:l?`plugins:pluginsPage.installPlugin`:`plugins:pluginsPage.inspectPlugin`)]})]})]})})}var $e=[`tool`,`prompt`,`skill`];function et(e){let t=Array.isArray(e.resourceTypes)?e.resourceTypes.filter(e=>$e.includes(e)):[];return t.length?t:[`tool`]}function tt(e,t){return{tool:t(`plugins:pluginsPage.extensionType.tool`),prompt:t(`plugins:pluginsPage.extensionType.prompt`),skill:t(`plugins:pluginsPage.extensionType.skill`)}[e]}var nt=[`all`,`builtin`,`local`],rt={read:d,ls:p,grep:v,find:v,edit:f,write:f,bash:y,web_search:l,browser_automation:l,generate_visual:m};function it(e,t){return t(e===`builtin`?`plugins:pluginsPage.builtIn`:e===`local`?`plugins:pluginsPage.local`:`plugins:pluginsPage.all`)}function at(e){return e.flatMap(e=>e.managedExternally?[]:e.capabilities.filter(e=>e.enabled).map(e=>e.name))}function ot(e){return e.filter(e=>!e.managedExternally||e.source===`pi`).flatMap(e=>e.capabilities.map(t=>({...t,pluginId:e.id,pluginName:e.name,pluginDescription:e.description,pluginVersion:e.version,pluginSource:e.source,pluginBuiltIn:e.builtIn,pluginPermissions:e.permissions||[],pluginSystemAccess:!!e.systemAccess})))}function st(e){return e.find(e=>e.source===`pi`&&e.name===`Computer Use`)?.enabled!==!1}function ct(e){return Object.fromEntries(e.filter(e=>e.source===`pi`&&e.name!==`Computer Use`&&!!e.packageSource).map(e=>[e.packageSource,e.enabled!==!1]))}function lt(e,t){return[...e].sort().join(`\0`)===[...t].sort().join(`\0`)}function ut(e,t){return W({id:e.name,name:e.label},t)}function dt(e,t){return e.pluginSource===`pi`?e.pluginName:G(e.pluginName,t)}function ft({value:e,testing:t,onChange:n,onTest:i}){let{t:a}=r();return(0,J.jsxs)(`div`,{className:`plugin-tool-config grid gap-2.5 border-t border-stroke pt-3 [&_label]:grid [&_label]:gap-1.5 [&_label]:text-xs [&_label]:font-medium [&_label]:text-content-secondary`,children:[(0,J.jsxs)(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-3`,children:[(0,J.jsxs)(`label`,{children:[a(`plugins:pluginsPage.defaultLanguage`),(0,J.jsxs)(U,{value:e.language,onChange:t=>n({...e,language:t.target.value}),children:[(0,J.jsx)(`option`,{value:`auto`,children:a(`plugins:pluginsPage.auto`)}),(0,J.jsx)(`option`,{value:`zh-CN`,children:a(`plugins:pluginsPage.simplifiedChinese`)}),(0,J.jsx)(`option`,{value:`en-US`,children:a(`plugins:pluginsPage.english`)})]})]}),(0,J.jsxs)(`label`,{children:[a(`plugins:pluginsPage.safeSearch`),(0,J.jsxs)(U,{value:e.safeSearch,onChange:t=>n({...e,safeSearch:Number(t.target.value)}),children:[(0,J.jsx)(`option`,{value:0,children:a(`plugins:pluginsPage.off`)}),(0,J.jsx)(`option`,{value:1,children:a(`plugins:pluginsPage.moderate`)}),(0,J.jsx)(`option`,{value:2,children:a(`plugins:pluginsPage.strict`)})]})]}),(0,J.jsxs)(`label`,{children:[a(`plugins:pluginsPage.resultCount`),(0,J.jsx)(R,{type:`number`,min:`1`,max:`12`,className:`tabular-nums`,value:e.maxResults,onChange:t=>n({...e,maxResults:Number(t.target.value)})})]})]}),(0,J.jsxs)(j,{type:`button`,variant:`secondary`,className:`justify-self-end max-[650px]:h-11`,loading:t,disabled:t,onClick:i,children:[(0,J.jsx)(l,{}),a(t?`plugins:pluginsPage.testing`:`plugins:pluginsPage.testConnection`)]})]})}function pt({query:e,notify:t,requestText:n,requestConfirm:a}){let{t:o}=r(),[s,c]=(0,q.useState)(``),[l,d]=(0,q.useState)(null),[f,p]=(0,q.useState)([]),[m,g]=(0,q.useState)(!1),[_,y]=(0,q.useState)(``),[ee,b]=(0,q.useState)(``),x=(0,q.useCallback)(async(e=``)=>{g(!0),b(``);try{let[t,n]=await Promise.all([i(`/api/extensions/market?name=${encodeURIComponent(e)}`),i(`/api/extensions`)]);d(t),p(n.packages||[])}catch(e){b(e instanceof Error?e.message:String(e))}finally{g(!1)}},[]);(0,q.useEffect)(()=>{x(``)},[x]);let S=(l?.packages||[]).filter(t=>`${t.name} ${t.description}`.toLowerCase().includes(e.trim().toLowerCase())),C=async e=>{if(await a?.({title:o(`plugins:pluginsPage.installExtension`),message:o(`plugins:pluginsPage.extensionSecurityWarning`,{name:e}),confirmLabel:o(`plugins:pluginsPage.installExtension`),tone:`danger`})!==!1){y(e);try{let n=/^(?:[.~\\/]|[A-Za-z]:[\\/])/.test(e)||/^(?:npm:|https?:\/\/|git\+)/i.test(e)?e:`npm:${e}`,r=await i(`/api/extensions/install`,{method:`POST`,body:JSON.stringify({source:n})});p(r.packages||[]),t(o(`plugins:pluginsPage.extensionInstalled`),`success`)}catch(e){t(e instanceof Error?e.message:String(e),`error`)}finally{y(``)}}},w=async()=>{let e=await n?.({title:o(`plugins:pluginsPage.installExtension`),message:o(`plugins:pluginsPage.extensionSourceHelp`),inputLabel:o(`plugins:pluginsPage.extensionSource`),placeholder:`npm:@scope/package or https://github.com/…`,maxLength:2e3});e?.trim()&&await C(e.trim())},T=async e=>{if(await a?.({title:o(`plugins:pluginsPage.uninstallExtension`),message:o(`plugins:pluginsPage.uninstallExtensionDescription`,{name:e.name}),confirmLabel:o(`plugins:pluginsPage.uninstallExtension`),tone:`danger`})!==!1){y(e.source);try{await i(`/api/extensions`,{method:`DELETE`,body:JSON.stringify({source:e.source,scope:e.scope})}),await x(s),t(o(`plugins:pluginsPage.extensionUninstalled`),`success`)}catch(e){t(e instanceof Error?e.message:String(e),`error`)}finally{y(``)}}},ne=$e.map(e=>({type:e,items:f.filter(t=>et(t).includes(e))})).filter(e=>e.items.length>0);return(0,J.jsxs)(J.Fragment,{children:[ne.map(e=>(0,J.jsx)(V,{className:`plugin-installed-extensions`,title:`${o(`plugins:pluginsPage.installedExtensions`)} · ${tt(e.type,o)}`,count:e.items.length,children:(0,J.jsx)(B,{children:e.items.map(t=>(0,J.jsx)(z,{icon:(0,J.jsx)(h,{}),name:(0,J.jsx)(`span`,{className:`font-mono`,children:t.name}),nameMeta:`v${t.version}`,description:(0,J.jsx)(`span`,{className:`font-mono text-xs`,children:t.source}),actions:(0,J.jsxs)(j,{type:`button`,variant:`ghost`,size:`sm`,className:`text-content-muted hover:bg-danger-soft hover:text-danger`,loading:_===t.source,disabled:!!_,onClick:()=>void T(t),children:[(0,J.jsx)(te,{}),o(`plugins:pluginsPage.uninstallExtension`)]})},`${e.type}:${t.scope}:${t.source}`))})},e.type)),(0,J.jsxs)(V,{className:`plugin-market`,title:o(`plugins:pluginsPage.extensionMarket`),actions:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(j,{asChild:!0,variant:`ghost`,size:`sm`,children:(0,J.jsxs)(`a`,{href:`https://pi.dev/packages`,target:`_blank`,rel:`noreferrer`,children:[(0,J.jsx)(u,{}),o(`plugins:pluginsPage.openPackageCatalog`)]})}),(0,J.jsxs)(j,{type:`button`,variant:`secondary`,size:`sm`,onClick:w,disabled:!!_,children:[(0,J.jsx)(K,{}),o(`plugins:pluginsPage.installExtension`)]})]}),children:[(0,J.jsxs)(`form`,{className:`mb-3 flex min-w-0 gap-2`,onSubmit:e=>{e.preventDefault(),x(s)},children:[(0,J.jsx)(R,{className:`min-w-0 flex-1 max-[650px]:h-11`,value:s,onChange:e=>c(e.target.value),placeholder:o(`plugins:pluginsPage.searchPackageCatalog`),"aria-label":o(`plugins:pluginsPage.searchPackageCatalog`)}),(0,J.jsxs)(j,{type:`submit`,variant:`secondary`,className:`h-[34px] max-[650px]:h-11`,loading:m,disabled:m,children:[(0,J.jsx)(v,{}),o(`plugins:pluginsPage.search`)]})]}),ee&&(0,J.jsx)(H,{className:`mt-0 mb-3`,children:ee}),S.length>0&&(0,J.jsx)(B,{children:S.slice(0,12).map(e=>{let t=f.some(t=>t.name===e.name||t.source===`npm:${e.name}`);return(0,J.jsx)(z,{icon:(0,J.jsx)(h,{}),name:(0,J.jsx)(`span`,{className:`font-mono`,children:e.name}),description:e.description,status:e.published,actions:(0,J.jsx)(j,{type:`button`,variant:`secondary`,size:`sm`,loading:_===e.name,disabled:t||!!_,onClick:()=>void C(e.name),children:o(t?`plugins:pluginsPage.installed`:`plugins:pluginsPage.installExtension`)})},e.name)})})]})]})}function mt({notify:e,onBack:t,requestText:n,requestConfirm:s}){let{t:c}=r(),l=se(`focusSearch`),u=o(e=>e.capabilities),d=a(u,`plugins`),f=d?nt:nt.slice(0,2),[p,m]=(0,q.useState)(``),[h,v]=(0,q.useState)(null),[y,S]=(0,q.useState)([]),[C,w]=(0,q.useState)(``),[T,ne]=(0,q.useState)(`all`),[E,D]=(0,q.useState)({provider:`bing`,language:`auto`,safeSearch:1,maxResults:8}),[O,k]=(0,q.useState)(!1),[re,ie]=(0,q.useState)(!1),[ae,M]=(0,q.useState)(!1),[N,P]=(0,q.useState)(null),[F,I]=(0,q.useState)(!1),[L,R]=(0,q.useState)(``),[ce,H]=(0,q.useState)(!1),U=(0,q.useCallback)(e=>{v(e),S(e.plugins),D(e.webSearch)},[]),W=(0,q.useCallback)(async()=>{R(``);try{U(await i(`/api/plugins`))}catch(e){R(e instanceof Error?e.message:String(e))}},[U]);(0,q.useEffect)(()=>{W()},[W]);let G=(0,q.useMemo)(()=>ot(y),[y]),Y=(0,q.useMemo)(()=>at(y),[y]),X=h?!lt(Y,h.enabledTools)||st(y)!==h.computerUseEnabled||JSON.stringify(ct(y))!==JSON.stringify(h.piExtensions)||JSON.stringify(E)!==JSON.stringify(h.webSearch):!1,Se=(0,q.useCallback)(async()=>{if(!O){if(!h||!X){h&&e(c(`plugins:pluginsPage.noPluginPolicyChanges`));return}k(!0),R(``);try{let t=await i(`/api/plugins`,{method:`PUT`,body:JSON.stringify({enabledTools:Y,webSearch:E,computerUseEnabled:st(y),piExtensions:ct(y)})});U(t),e(c(`plugins:pluginsPage.pluginPolicySavedAgentRuntimeUpdated`))}catch(e){R(e instanceof Error?e.message:String(e))}finally{k(!1)}}},[U,h,X,y,Y,e,O,c,E]),Ce=async()=>{ie(!0),R(``);try{let t=await i(`/api/plugins/web-search/test`,{method:`POST`,body:JSON.stringify(E)});e(c(`plugins:pluginsPage.bingSearchIsAvailableAndReturnedCountResults`,{count:t.count}))}catch(t){let n=t instanceof Error?t.message:String(t);R(n),e(n,`error`)}finally{ie(!1)}},Z=(e,t,n)=>{S(r=>r.map(r=>{if(r.id!==e)return r;let i=r.source===`pi`&&r.managedExternally;return{...r,enabled:n||r.capabilities.some(e=>e.enabled),capabilities:r.capabilities.map(e=>i||e.name===t?{...e,enabled:n}:e)}}))},we=()=>!X||(R(c(`plugins:pluginsPage.saveBeforePluginChanges`)),!1),Te=async()=>{if(!(!N||F)){I(!0),R(``);try{U(await i(`/api/plugins/${encodeURIComponent(N.pluginId)}`,{method:`DELETE`})),e(c(`plugins:pluginsPage.pluginUninstalled`,{name:N.pluginName})),w(``),P(null)}catch(e){R(e instanceof Error?e.message:String(e))}finally{I(!1)}}},Q=c(`navigation:navigation.plugins`),Ee=p.trim().toLowerCase(),$=G.filter(e=>T!==`all`&&e.pluginSource!==T?!1:[ut(e,c),e.name,e.description,dt(e,c),e.pluginId].join(` `).toLowerCase().includes(Ee));return(0,J.jsxs)(fe,{title:Q,description:c(`plugins:pluginsPage.lede`),back:t&&{label:c(`navigation:sidebar.features`),ariaLabel:c(`navigation:shell.backToFeaturesLabel`),onBack:t},toolbar:(0,J.jsx)(pe,{search:(0,J.jsx)(de,{id:x,value:p,onValueChange:m,placeholder:c(`navigation:pageHeader.searchPage`,{page:Q}),shortcut:l,clearLabel:c(`navigation:more.clearSearch`)}),actions:(0,J.jsxs)(J.Fragment,{children:[d&&(0,J.jsxs)(j,{type:`button`,variant:`secondary`,className:`h-9`,disabled:!h,onClick:()=>we()&&M(!0),children:[(0,J.jsx)(K,{}),c(`plugins:pluginsPage.installPlugin`)]}),(0,J.jsxs)(j,{type:`button`,className:`h-9`,"data-plugins-save":!0,loading:O,disabled:!h||O,onClick:()=>void Se(),children:[(0,J.jsx)(_,{}),c(`plugins:pluginsPage.savePolicy`)]})]}),filters:(0,J.jsx)(me,{options:f.map(e=>it(e,c)),value:it(T,c),onChange:e=>ne(f.find(t=>it(t,c)===e)||`all`)})}),children:[h?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(V,{className:`plugin-catalog`,title:c(`plugins:pluginsPage.toolCatalog`),count:$.length,meta:(0,J.jsxs)(`span`,{className:`plugin-catalog-summary`,children:[G.filter(e=>e.enabled).length,`/`,G.length,` `,c(`plugins:pluginsPage.enabled2`)]}),actions:X&&(0,J.jsxs)(`span`,{"data-plugins-unsaved":!0,className:`flex items-center gap-1.5 text-xs font-medium text-content-secondary`,children:[(0,J.jsx)(`span`,{"aria-hidden":`true`,className:`size-1.5 rounded-full bg-content-secondary`}),c(`plugins:pluginsPage.unsaved`)]}),children:$.length?(0,J.jsx)(B,{className:`plugin-tool-grid`,children:$.map(e=>{let t=rt[e.name]||g,n=ut(e,c);return(0,J.jsx)(z,{className:`plugin-tool-card`,"data-plugin-tool":e.name,icon:(0,J.jsx)(t,{}),name:(0,J.jsx)(`span`,{title:n,children:n}),nameMeta:e.name,description:`${dt(e,c)} · ${ye(e.risk,c)}`,status:e.pluginBuiltIn?void 0:c(`plugins:pluginsPage.local`),actions:(0,J.jsx)(ge,{value:e.enabled,onChange:t=>Z(e.pluginId,e.name,t),ariaLabel:n}),expanded:C===e.name,onExpandedChange:t=>w(t?e.name:``),toggleLabel:c(`plugins:pluginsPage.toggleToolDetails`,{name:n}),detail:(0,J.jsxs)(`div`,{className:`plugin-tool-details grid gap-3`,children:[(0,J.jsx)(`p`,{className:`text-sm leading-relaxed text-content-soft`,children:_e({id:e.name,description:e.description},c)}),(0,J.jsxs)(`dl`,{className:`grid grid-cols-[88px_minmax(0,1fr)] gap-x-3 gap-y-1.5 text-xs [&_dd]:min-w-0 [&_dd]:[overflow-wrap:anywhere] [&_dd]:text-content-soft [&_dt]:text-content-muted [&>div]:contents`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{children:c(`plugins:pluginsPage.source`)}),(0,J.jsxs)(`dd`,{className:`tabular-nums`,children:[dt(e,c),!e.pluginBuiltIn&&` · v${e.pluginVersion}`]})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{children:c(`plugins:pluginsPage.riskLevel`)}),(0,J.jsx)(`dd`,{className:A((xe(e.risk)||ve(e.risk))&&`font-medium text-content!`),children:ye(e.risk,c)})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{children:c(`plugins:pluginsPage.pathScope`)}),(0,J.jsx)(`dd`,{children:be({id:e.name,scope:e.scope},c)})]}),!e.pluginBuiltIn&&(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{children:c(`plugins:pluginsPage.executionMode`)}),(0,J.jsx)(`dd`,{children:c(`plugins:pluginsPage.confirmUnlessFullAccess`)})]})]}),!e.pluginBuiltIn&&(0,J.jsxs)(`div`,{className:`plugin-tool-warning flex items-start gap-2 rounded-sm bg-surface-subtle p-2.5 text-xs leading-normal text-content-secondary`,children:[(0,J.jsx)(ee,{className:`mt-px size-3.5 shrink-0`,"aria-hidden":`true`}),(0,J.jsx)(`span`,{children:c(`plugins:pluginsPage.localPluginSecurityWarning`)})]}),e.name===`web_search`&&(0,J.jsx)(ft,{value:E,testing:re,onChange:D,onTest:Ce}),!e.pluginBuiltIn&&(0,J.jsxs)(j,{type:`button`,variant:`ghost`,className:`justify-self-end text-danger hover:bg-danger-soft hover:text-danger max-[650px]:h-11`,onClick:()=>we()&&P(e),children:[(0,J.jsx)(te,{}),c(`plugins:pluginsPage.uninstallPlugin`)]})]})},e.name)})}):(0,J.jsx)(ue,{compact:!0,title:c(`plugins:pluginsPage.noMatchingTools`)})}),(0,J.jsx)(pt,{query:p,notify:e,requestText:n,requestConfirm:s})]}):L?(0,J.jsx)(le,{kind:`error`,title:c(`plugins:pluginsPage.loadFailed`),description:L,action:(0,J.jsx)(j,{variant:`secondary`,className:`max-[650px]:h-11`,loading:ce,disabled:ce,onClick:()=>{H(!0),W().finally(()=>H(!1))},children:c(`common:pageTemplate.retry`)})}):(0,J.jsx)(le,{kind:`loading`,title:c(`plugins:pluginsPage.loadingToolPlugins`)}),d&&(0,J.jsx)(Qe,{open:ae,onOpenChange:M,onInstalled:W}),(0,J.jsx)(Ve,{open:!!N,onOpenChange:e=>!e&&!F&&P(null),children:(0,J.jsxs)(We,{className:`z-[220]`,children:[(0,J.jsxs)(Ge,{children:[(0,J.jsx)(qe,{children:c(`plugins:pluginsPage.uninstallPlugin`)}),(0,J.jsx)(Je,{children:c(`plugins:pluginsPage.uninstallPluginDescription`,{name:N?.pluginName||``})})]}),(0,J.jsxs)(Ke,{children:[(0,J.jsx)(Xe,{disabled:F,children:c(`common:ui.cancel`)}),(0,J.jsxs)(Ye,{variant:`destructive`,disabled:F,onClick:Te,children:[F&&(0,J.jsx)(oe,{className:`text-current`}),c(`plugins:pluginsPage.uninstallPlugin`)]})]})]})}),L&&h&&(0,J.jsxs)(he,{className:`fixed right-6 bottom-6 z-[21] max-w-[360px] border border-danger-border shadow-float`,children:[(0,J.jsx)(b,{size:13}),L]})]})}export{mt as PluginsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{t as r}from"./use-i18n-
|
|
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-_vdxObu5.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-DFZX_Dek.js";import{t as d}from"./safe-mode-instance-DnTP7EUr.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};
|
|
@@ -0,0 +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-_vdxObu5.js";import{t as a}from"./api-BW_X0FMZ.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-DbdbTOV2.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-D72gQCwH.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-DFZX_Dek.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-yk6L7wR2.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-BB1TeMlr.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};
|