pisper 0.6.32 → 0.6.33
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 +640 -640
- package/web/assets/{AppDialog-CA7tBvM8.js → AppDialog-bqakHiqz.js} +1 -1
- package/web/assets/{AppOverlays-yAnO5otc.js → AppOverlays-CgpAvY9q.js} +1 -1
- package/web/assets/{AssetsPage-NJ7uc7WV.js → AssetsPage-BIYsLgYo.js} +1 -1
- package/web/assets/{BoardPage-DzHXQHbY.js → BoardPage-C3a-6d1u.js} +3 -3
- package/web/assets/{ChannelsPage-DPVT00J9.js → ChannelsPage-6Opibsv4.js} +1 -1
- package/web/assets/{ChatAppearancePage-RygKPTc1.js → ChatAppearancePage-D5gk_aXZ.js} +1 -1
- package/web/assets/{ChatHistoryPage-CYU3FOWt.js → ChatHistoryPage-D576j6vI.js} +1 -1
- package/web/assets/{ChatPage-B9kyMRtf.js → ChatPage-BK61m32j.js} +3 -3
- package/web/assets/{ConfigPage-YOI6Jn64.js → ConfigPage-BmnOjD9j.js} +2 -2
- package/web/assets/{DesktopWindowControls-DaK-mWjx.js → DesktopWindowControls-DlV6D3IF.js} +1 -1
- package/web/assets/{FeaturePage-DI7N2J_K.js → FeaturePage-qCmYebNB.js} +1 -1
- package/web/assets/{FileAttachmentPreview-CUdxe5_7.js → FileAttachmentPreview-DkYkLnxt.js} +1 -1
- package/web/assets/{FloatingWidgets-CWAsDelc.js → FloatingWidgets-1EwlF6Oj.js} +1 -1
- package/web/assets/{FocusRuntimeControls-6sWPafoU.js → FocusRuntimeControls-DiS4SP0x.js} +1 -1
- package/web/assets/{GitDiffViewer-Djkbc29o.js → GitDiffViewer-BYB7_K9o.js} +1 -1
- package/web/assets/{ManageProjectsDialog-CReohSBv.js → ManageProjectsDialog-CDY8CAam.js} +1 -1
- package/web/assets/{MarkdownMessage-jypOknWO.js → MarkdownMessage-BH5Nh-UO.js} +1 -1
- package/web/assets/{McpPage-DZuv-kd4.js → McpPage-DFwh1tmO.js} +1 -1
- package/web/assets/{MemoryEvolution-ULgArXX6.js → MemoryEvolution-BG4nAEH8.js} +1 -1
- package/web/assets/{MemoryPage-CXNLDgIX.js → MemoryPage-CSZweuq_.js} +2 -2
- package/web/assets/{MobileNavigation-CEUnhv7K.js → MobileNavigation-DdvgJ1_H.js} +1 -1
- package/web/assets/{MorePage-DC_HNY-i.js → MorePage-CM0nAh27.js} +1 -1
- package/web/assets/{NewFolderDialog-rxwZ78bu.js → NewFolderDialog-BgVVLoLF.js} +1 -1
- package/web/assets/{PageHeader-DQkMisCZ.js → PageHeader-V6fYs6FB.js} +1 -1
- package/web/assets/{PhoneDrawer-D3eRtYUJ.js → PhoneDrawer-_T7G0UlW.js} +1 -1
- package/web/assets/{PhoneMenuButton-Qt9aL2yf.js → PhoneMenuButton-DlK5D8AZ.js} +1 -1
- package/web/assets/{PhoneTopBar-UNRjPZJo.js → PhoneTopBar-CI5JxBFX.js} +1 -1
- package/web/assets/{PluginsPage-B19V8jKI.js → PluginsPage-DHJHTTXh.js} +1 -1
- package/web/assets/{SafeModePrompt-DDwctKZu.js → SafeModePrompt-B4hmTRuN.js} +1 -1
- package/web/assets/{SchedulesPage-C-MlYxbU.js → SchedulesPage-6Qe506NG.js} +1 -1
- package/web/assets/{SessionBrowserPane-C7pYbebX.js → SessionBrowserPane-DBc3TNje.js} +2 -2
- package/web/assets/{SessionContextPanel-B2sS7myK.js → SessionContextPanel-A-apbPUv.js} +2 -2
- package/web/assets/{SessionHome-CS5HPhh0.js → SessionHome-D-iS34Q7.js} +1 -1
- package/web/assets/{SessionInspector-BHdqiu1D.js → SessionInspector-B41l7gKR.js} +1 -1
- package/web/assets/{SessionShell-CI6d2UxF.js → SessionShell-Byw5069L.js} +1 -1
- package/web/assets/{SettingsSidebar-SMxWLbhN.js → SettingsSidebar-CMu7qKbO.js} +1 -1
- package/web/assets/{ShortcutHelpDialog-DDyxtBqb.js → ShortcutHelpDialog-CaaKIjWq.js} +1 -1
- package/web/assets/{ShortcutKeys-CuiTSvO5.js → ShortcutKeys-DEP10d_k.js} +1 -1
- package/web/assets/{SidebarUpdateStatus-CgDyoVVT.js → SidebarUpdateStatus-4sXZK0UG.js} +1 -1
- package/web/assets/{SkillsPage-C217PvFK.js → SkillsPage-r_UPbRKb.js} +1 -1
- package/web/assets/{TaskProcessesPane-CRRUKQPY.js → TaskProcessesPane-VO8SPtCI.js} +1 -1
- package/web/assets/{TaskTerminalView-DZL83yst.js → TaskTerminalView-B5GUaW-L.js} +1 -1
- package/web/assets/{TerminalPanel-CeGX1ISs.js → TerminalPanel-toRRYBjv.js} +1 -1
- package/web/assets/{WebDesktopPet-mgzM1lUl.js → WebDesktopPet-CM4U0kvi.js} +1 -1
- package/web/assets/{WorkflowsPage-CsH9o0Vt.js → WorkflowsPage-BcXqmyBY.js} +1 -1
- package/web/assets/{WorkspacePicker-Bo197KnL.js → WorkspacePicker-BRa_IVqp.js} +1 -1
- package/web/assets/{api-Bn6Yqhfj.js → api-CCLf8CGI.js} +1 -1
- package/web/assets/{app-update-C17JitpX.js → app-update-DcdhTBg3.js} +1 -1
- package/web/assets/{approval-confirm-CLyo75Wg.js → approval-confirm-Db5cFtCd.js} +1 -1
- package/web/assets/{board-projects-B7ISKK5M.js → board-projects-C3_RLAYt.js} +1 -1
- package/web/assets/{bots-store-BM-RDFHS.js → bots-store-BYTwHk9o.js} +1 -1
- package/web/assets/{chat-api-BL_tZCbY.js → chat-api-PdHMtAmc.js} +1 -1
- package/web/assets/{client-store-D3sThJb-.js → client-store-Df-MtlGW.js} +1 -1
- package/web/assets/{config-search-Q-gLiXu_.js → config-search-Bk1H58rt.js} +1 -1
- package/web/assets/{desktop-hosts-B3CWL4di.js → desktop-hosts-kpDUJPHM.js} +1 -1
- package/web/assets/{dialog-DzLlhTSc.js → dialog-CEcIiRdx.js} +1 -1
- package/web/assets/{event-stream-DHX619rI.js → event-stream-B3CGgFfm.js} +1 -1
- package/web/assets/{events-BOOZIPa5.js → events-fUNyYQhT.js} +1 -1
- package/web/assets/{focus-session-composer-bits-vPmpISU7.js → focus-session-composer-bits-DWovCteo.js} +1 -1
- package/web/assets/{folder-paths-CfkxmkpU.js → folder-paths-e_B8xA6T.js} +1 -1
- package/web/assets/{hosts-DI7_AOnB.js → hosts-DlCCpVaG.js} +1 -1
- package/web/assets/{http-BLTlr2yB.js → http-Ck9ziPLg.js} +1 -1
- package/web/assets/{http-response-BVH7o4IQ.js → http-response-BMpatf4O.js} +1 -1
- package/web/assets/{i18n-D5Pj8hy6.js → i18n-D1oE4DVX.js} +1 -1
- package/web/assets/{index-DguGXGe9.js → index-Cd49jlmz.js} +2 -2
- package/web/assets/{machine-messages-BjYmTDz4.js → machine-messages-D5urBDZn.js} +1 -1
- package/web/assets/{machines-api-AYwQ9wWh.js → machines-api-Be-AjTEL.js} +1 -1
- package/web/assets/{memory-api-260Oa_xZ.js → memory-api-D9qnDSAr.js} +1 -1
- package/web/assets/{mount-app-CoTBrIGD.js → mount-app-D278htsi.js} +3 -3
- package/web/assets/{permission-rules-api-D2u3PIpr.js → permission-rules-api-i-sBmQT3.js} +1 -1
- package/web/assets/{pick-system-directory-BPDhvlE7.js → pick-system-directory-Cnb1L8Kd.js} +1 -1
- package/web/assets/{placements-deNW2Eg-.js → placements-BPrt5jd4.js} +2 -2
- package/web/assets/{popover-B-a7ZBQS.js → popover-5MqQ5QIH.js} +1 -1
- package/web/assets/{public-Dbs615LR.js → public-B7A7Bf7w.js} +1 -1
- package/web/assets/{public-BV32k5q1.js → public-BhSl1_DQ.js} +2 -2
- package/web/assets/{public-COJrQD9j.js → public-DAqU5ju6.js} +2 -2
- package/web/assets/{public-CoescP9_.js → public-DHE_Bffl.js} +1 -1
- package/web/assets/{public-components-jrX-6RqC.js → public-components-DS306Oz2.js} +1 -1
- package/web/assets/public-diff-e-dAYuJF.js +1 -0
- package/web/assets/public-events-DK8fPqRB.js +1 -0
- package/web/assets/{public-flags-B-hhqV7C.js → public-flags-_XZrt2pU.js} +1 -1
- package/web/assets/{public-folder-dialog-ywXpPZXJ.js → public-folder-dialog-DgKjmujY.js} +1 -1
- package/web/assets/{public-greeting-VN-jBq7k.js → public-greeting-DJIT1WWT.js} +1 -1
- package/web/assets/{public-session-CzxHzz2C.js → public-session-CuS3mRPA.js} +1 -1
- package/web/assets/{public-sidebar-BA8SJ3r0.js → public-sidebar-Cxg21QnN.js} +1 -1
- package/web/assets/{runtime-capabilities-store-CXahF-U2.js → runtime-capabilities-store-DcLHj_-T.js} +1 -1
- package/web/assets/{safe-mode-instance-Dex9ZvJH.js → safe-mode-instance-Dpp0f3FD.js} +1 -1
- package/web/assets/safe-mode-sentinel-CpYA8gLC.js +1 -0
- package/web/assets/{session-change-summary-api-CJ2yVJEm.js → session-change-summary-api-BzjbV-XG.js} +1 -1
- package/web/assets/{session-home-BTPHTXVm.js → session-home-BE2Q0var.js} +1 -1
- package/web/assets/{session-inspector-store-DFANj1eG.js → session-inspector-store-BxozyuFV.js} +1 -1
- package/web/assets/{session-organization-api-5GadAj0U.js → session-organization-api-CLAh265X.js} +1 -1
- package/web/assets/{session-scope-C9THRhK5.js → session-scope-BM93WXwD.js} +1 -1
- package/web/assets/{session-tree-actions-C7sDBs9_.js → session-tree-actions-BlqzMI3H.js} +1 -1
- package/web/assets/{session-tree-summary-D_mv7Xsy.js → session-tree-summary-B8SEWLOy.js} +1 -1
- package/web/assets/{shortcuts-CQYp4qaG.js → shortcuts-SQuwtLn8.js} +1 -1
- package/web/assets/{side-chat-context-BoevraRd.js → side-chat-context-Dw_WsQW3.js} +4 -4
- package/web/assets/{sidebar-Ddf5aEv6.js → sidebar-B6oY6pcm.js} +1 -1
- package/web/assets/{sidebar-store-DlicJ7L2.js → sidebar-store-DWzo4gcp.js} +1 -1
- package/web/assets/{speech-session--qKchPMR.js → speech-session-Dx6waD1F.js} +1 -1
- package/web/assets/{startup-queries-Cf6RSLkK.js → startup-queries-DG8R4Ryc.js} +1 -1
- package/web/assets/{use-i18n-vKUIcJX7.js → use-i18n-CrMP8KP1.js} +1 -1
- package/web/assets/{use-open-bot-CBgzzpYP.js → use-open-bot-DU7b6x-6.js} +1 -1
- package/web/assets/{use-studio-actions-C0IOFiXt.js → use-studio-actions-Cb0xo6pc.js} +1 -1
- package/web/assets/{useCatalogProjects-HPDUmiqp.js → useCatalogProjects-BJCTVrvM.js} +1 -1
- package/web/assets/{useMachines-CPMVc3JJ.js → useMachines-BnEhFLR-.js} +1 -1
- package/web/assets/{useNewProjectPicker-DvaRu71A.js → useNewProjectPicker-CsJnnQt_.js} +2 -2
- package/web/assets/{useNow-Df6N6r2Y.js → useNow-D9FGGV1H.js} +1 -1
- package/web/assets/{usePhoneShell-K9ZGSs1n.js → usePhoneShell-Bjigstxq.js} +1 -1
- package/web/assets/{useSessionListQuery-w1eeoWqD.js → useSessionListQuery-Bfjp1ecc.js} +1 -1
- package/web/assets/{useSessionRowActions-DQcnq6I1.js → useSessionRowActions-84-_ahHt.js} +1 -1
- package/web/assets/{useSidebarModel-De1pMvik.js → useSidebarModel-0OeDSimB.js} +1 -1
- package/web/assets/{workspace-folders-B5Z-ckI5.js → workspace-folders-1RLblom2.js} +1 -1
- package/web/assets/{workspace-order-store-hJOk5NHh.js → workspace-order-store-Du6GVhMP.js} +1 -1
- package/web/index.html +1 -1
- package/web/assets/public-diff-D6Sa7fGe.js +0 -1
- package/web/assets/public-events-D8WNal9Q.js +0 -1
- package/web/assets/safe-mode-sentinel-DRBisTV9.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./api-
|
|
1
|
+
import{t as e}from"./api-CCLf8CGI.js";import{t}from"./createLucideIcon-Cd-3GVxJ.js";var n=t(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),r={list(){return e(`/api/permission-rules`)},add(t){return e(`/api/permission-rules`,{method:`POST`,body:JSON.stringify(t)})},remove(t){return e(`/api/permission-rules/`+encodeURIComponent(t),{method:`DELETE`})}},i=/[;&|`$<>\n\r\\(){}]/;function a(e){let t=e.trim().replace(/[ \t]+/g,` `);if(!t||i.test(t))return``;let[n,r]=t.split(` `);return n?r&&/^[a-z][\w:-]*$/i.test(r)?`${n} ${r}`:n:``}export{a as n,n as r,r as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./api-
|
|
1
|
+
import{t as e}from"./api-CCLf8CGI.js";async function t(t=``,n=``){let r=window.pisperDesktop?.pickDirectory;if(r){let e=await r(t||void 0);return e?{status:`picked`,path:e}:{status:`cancelled`}}let i;try{i=await e(`/api/local/directory-picker`,{method:`POST`,body:JSON.stringify({initialDirectory:t,title:n})})}catch{return{status:`unavailable`}}return i.status===`picked`&&i.path?{status:`picked`,path:i.path}:i.status===`cancelled`||i.status===`busy`?{status:`cancelled`}:{status:`unavailable`}}export{t};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/hosts-
|
|
2
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{h as t}from"./vendor-router-CSN_DGvx.js";import{i as n}from"./vendor-react-DwNgTV1j.js";import{a as r}from"./i18n-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/hosts-DlCCpVaG.js","assets/rolldown-runtime-B0Z9INg1.js","assets/vendor-router-CSN_DGvx.js","assets/vendor-react-DwNgTV1j.js","assets/index-Cd49jlmz.js","assets/index-BTqJTVNA.css","assets/routes-DIeaqWVc.js","assets/use-i18n-CrMP8KP1.js","assets/i18n-D1oE4DVX.js","assets/storage-DtvZ_lEu.js","assets/vendor-state-GkUciC5H.js","assets/useQuery-DfOU-27z.js","assets/query-DFQayLF5.js","assets/session-scope-BM93WXwD.js","assets/http-response-BMpatf4O.js","assets/http-Ck9ziPLg.js","assets/abort-signal-f4JsiYKX.js","assets/session-board-status-D2lpFPiI.js","assets/createLucideIcon-Cd-3GVxJ.js","assets/ellipsis-CfGKfbq6.js","assets/grip-vertical-B__LYT0s.js","assets/plus-fQbSqB1n.js","assets/rotate-ccw-C0v8V77_.js","assets/settings-2-CXJjXJS9.js","assets/x-07u4-129.js","assets/dropdown-menu-Ds0gD8S8.js","assets/check-2vYc6QaP.js","assets/chevron-right-C3t2Rckj.js","assets/dist-41X0pdUs.js","assets/dist-BsRXXcSL.js","assets/dist-DzGQ7sLi.js","assets/es2015-DTZdOI9P.js","assets/dist-BRjj4UeB.js","assets/dist-OB2r6Xsr.js","assets/dist-BaBySQmo.js","assets/utils-C8uzG5AZ.js","assets/vendor-ui-DvrYggeS.js","assets/popover-5MqQ5QIH.js","assets/dialog-CEcIiRdx.js","assets/dist-BHkR6BLP.js","assets/button-CCcCN8tE.js","assets/use-studio-actions-Cb0xo6pc.js","assets/checkbox-BrEHgFV0.js","assets/progress-5odAz3B9.js","assets/separator-BPh_qxvc.js","assets/switch-D_G8wFhs.js","assets/segmented-control-xkrEOP_d.js","assets/tooltip-D4MFbqcG.js","assets/dist-BiRPwy4W.js","assets/kbd-CAufZTkl.js","assets/useSessionListQuery-Bfjp1ecc.js","assets/startup-queries-DG8R4Ryc.js","assets/mutation-b4pPvB7p.js","assets/api-CCLf8CGI.js","assets/event-stream-B3CGgFfm.js","assets/component-changes-Q9Bf64Ob.js","assets/runtime-capabilities-store-DcLHj_-T.js","assets/runtime-capabilities-CPDBo3tu.js","assets/chat-api-PdHMtAmc.js","assets/session-organization-api-CLAh265X.js","assets/events-fUNyYQhT.js","assets/session-workspaces-Brm-8lHh.js","assets/session-questions-Cf-1g85h.js","assets/useNewProjectPicker-CsJnnQt_.js","assets/focus-session-composer-bits-DWovCteo.js","assets/arrow-up-DST6-qVQ.js","assets/braces-DQcXLGFF.js","assets/pencil-U08v_vV9.js","assets/refresh-cw-TbWxTY4K.js","assets/square-bHHVTT3G.js","assets/wrench-6pg6_bqI.js","assets/shortcuts-SQuwtLn8.js","assets/StatusGlyph-1KgitlUg.js","assets/run-activity-CwfO0cui.js","assets/FocusRuntimeControls-DiS4SP0x.js","assets/chevrons-up-down-C2sEPdAh.js","assets/search-D0mqDaf_.js","assets/slider-De8rWVNs.js","assets/dist-BS3ekNDj.js","assets/sheet-BTaIEX4w.js","assets/format-DMJQzoZ7.js","assets/input-group-h8z63MzW.js","assets/input-CPw-zkYh.js","assets/textarea-DmATpOqT.js","assets/model-display-kDwvtxrW.js","assets/workspace-order-store-Du6GVhMP.js","assets/useNow-D9FGGV1H.js","assets/card-presentation-1oph2b8P.js","assets/session-change-summary-api-BzjbV-XG.js","assets/folder-paths-e_B8xA6T.js","assets/pick-system-directory-Cnb1L8Kd.js","assets/public-BhSl1_DQ.js","assets/chevron-down-CxtxIjiP.js","assets/folder-open-FIShC5Qk.js","assets/folder-DPM8D8cf.js","assets/useMachines-BnEhFLR-.js","assets/machines-api-Be-AjTEL.js","assets/server-BgNvmqwJ.js","assets/useSidebarModel-0OeDSimB.js","assets/board-projects-C3_RLAYt.js","assets/badge-CWB3lj2H.js","assets/safe-mode-instance-Dpp0f3FD.js","assets/safe-mode-sentinel-CpYA8gLC.js","assets/SafeModePrompt-B4hmTRuN.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{h as t}from"./vendor-router-CSN_DGvx.js";import{i as n}from"./vendor-react-DwNgTV1j.js";import{a as r}from"./i18n-D1oE4DVX.js";import{t as i}from"./use-i18n-CrMP8KP1.js";import{r as a,t as o}from"./useQuery-DfOU-27z.js";import{n as s}from"./component-changes-Q9Bf64Ob.js";import{t as c}from"./runtime-capabilities-store-DcLHj_-T.js";import{_ as l,j as u,k as d,n as f,r as p,t as m}from"./session-scope-BM93WXwD.js";import"./safe-mode-sentinel-CpYA8gLC.js";var h=e(n(),1);function g(e){return e.id===`*`?[u.all]:e.reason===`instances`?[u.instances()]:[u.catalog(),u.describe(e.id),u.errors(e.id),u.versions(e.id),u.trash(),u.instances()]}function _(e){let t=0,n=null,r=null;return{retain(i){r=i,t+=1,n??=e(e=>{for(let t of g(e))Promise.resolve(r?.invalidateQueries({queryKey:t})).catch(()=>void 0)});let a=!1;return()=>{a||(a=!0,--t,!(t>0)&&(n?.(),n=null,r=null))}},users:()=>t}}var v=_(s);function y(e){let t=a();(0,h.useEffect)(()=>e?v.retain(t):void 0,[t,e])}function b(){return c(e=>e.capabilities.features[`components.native`])}function x(){let e=b();return y(e),o(f(e))}function S(e){return y(e),o(p(e))}function C(){return S(b())}function w(e){let t=b(),n=S(t),r=(0,h.useMemo)(()=>(n.data?.instances??[]).filter(t=>t.surface===e&&t.enabled),[n.data,e]),i=o(f(t&&r.length>0));return{available:t,placed:(0,h.useMemo)(()=>{if(!i.data)return[];let e=new Map(i.data.components.map(e=>[e.id,e])),t=[];for(let n of r){let r=e.get(n.componentId);r?.kind===`native`&&r.status===`ready`&&r.enabled&&t.push({instance:n,component:r})}return t},[r,i.data]),revision:n.data?.revision??null,isLoading:t&&(n.isPending||r.length>0&&i.isPending),error:n.error??i.error??null,refetch:()=>{n.refetch(),r.length&&i.refetch()}}}function T(e,t,n){return e.filter(({instance:e})=>m(e.scope,t)).map(({instance:e,component:t})=>({id:e.instanceId,label:e.title||t.manifest?.i18n[n]?.name||t.name}))}function E(){let e=S(b());return(0,h.useMemo)(()=>(e.data?.instances??[]).filter(e=>e.enabled).length,[e.data])}function D(){let{language:e}=i(),t=w(`feature-page`),n=(0,h.useMemo)(()=>t.placed.map(({instance:t,component:n})=>({instanceId:t.instanceId,componentId:n.id,name:n.manifest?.i18n[e]?.name||n.name,description:n.manifest?.i18n[e]?.description||n.description,icon:n.manifest?.icon||``})),[e,t.placed]);return{...t,items:n}}var O=()=>Promise.all([t(()=>import(`./hosts-DlCCpVaG.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,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102])),r()]).then(([e])=>e),k=(0,h.lazy)(()=>O().then(e=>({default:e.ComponentHost}))),A=(0,h.lazy)(()=>O().then(e=>({default:e.FloatingComponents}))),j=(0,h.lazy)(()=>Promise.all([t(()=>import(`./SafeModePrompt-B4hmTRuN.js`),__vite__mapDeps([103,1,3,7,8,2,4,5,9,10,40,36,28,35,38,24,18,39,29,31,101,102])),r()]).then(([e])=>({default:e.SafeModePrompt})));function M(){let e=a();return async()=>{let t=(await l()).components.filter(e=>e.kind===`native`&&e.enabled),n=await Promise.allSettled(t.map(e=>d(e.id,!1)));return e.invalidateQueries({queryKey:u.all}),n.every(e=>e.status===`fulfilled`)}}var N=(0,h.lazy)(()=>O().then(e=>({default:e.OverviewComponents}))),P=(0,h.lazy)(()=>O().then(e=>({default:e.SessionPanelComponent}))),F=(0,h.lazy)(()=>O().then(e=>({default:e.SessionComponentAddMenu})));export{F as a,x as c,b as d,M as f,j as i,C as l,D as m,A as n,P as o,E as p,N as r,T as s,k as t,w as u};
|
|
@@ -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{a as r,n as i}from"./dist-41X0pdUs.js";import{c as a,i as o,n as s,o as c,r as l,s as u}from"./dist-BsRXXcSL.js";import{a as d,i as f,n as p,r as m,s as h,t as g}from"./es2015-DTZdOI9P.js";import{a as _,i as v,r as y,t as b}from"./dist-BRjj4UeB.js";import{t as x}from"./utils-C8uzG5AZ.js";import{c as S}from"./dialog-
|
|
1
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{i as t,r as n}from"./vendor-react-DwNgTV1j.js";import{a as r,n as i}from"./dist-41X0pdUs.js";import{c as a,i as o,n as s,o as c,r as l,s as u}from"./dist-BsRXXcSL.js";import{a as d,i as f,n as p,r as m,s as h,t as g}from"./es2015-DTZdOI9P.js";import{a as _,i as v,r as y,t as b}from"./dist-BRjj4UeB.js";import{t as x}from"./utils-C8uzG5AZ.js";import{c as S}from"./dialog-CEcIiRdx.js";var C=e(t(),1),w=n(),T=Object.defineProperty,E=(e,t)=>T(e,`name`,{value:t,configurable:!0}),D=`Popover`,[O,ee]=u(D,[_]),k=_(),[A,j]=O(D),M=E(e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:c=!1}=e,l=k(t),u=C.useRef(null),[d,f]=C.useState(!1),[p,m]=o({prop:r,defaultProp:i??!1,onChange:a,caller:D});return(0,w.jsx)(v,{...l,children:(0,w.jsx)(A,{scope:t,contentId:s(),triggerRef:u,open:p,onOpenChange:m,onOpenToggle:C.useCallback(()=>m(e=>!e),[m]),hasCustomAnchor:d,onCustomAnchorAdd:C.useCallback(()=>f(!0),[]),onCustomAnchorRemove:C.useCallback(()=>f(!1),[]),modal:c,children:n})})},`Popover`),N=`PopoverTrigger`,P=C.forwardRef(E(function(e,t){let{__scopePopover:n,...i}=e,o=j(N,n),s=k(n),l=r(t,o.triggerRef),u=(0,w.jsx)(a.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":G(o.open),...i,ref:l,onClick:c(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?u:(0,w.jsx)(b,{asChild:!0,...s,children:u})},`PopoverTrigger`)),F=`PopoverPortal`,[I,L]=O(F,{forceMount:void 0}),R=E(e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=j(F,t);return(0,w.jsx)(I,{scope:t,forceMount:n,children:(0,w.jsx)(l,{present:n||a.open,children:(0,w.jsx)(f,{asChild:!0,container:i,children:r})})})},`PopoverPortal`),z=`PopoverContent`,B=C.forwardRef(E(function(e,t){let n=L(z,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=j(z,e.__scopePopover);return(0,w.jsx)(l,{present:r||a.open,children:a.modal?(0,w.jsx)(H,{...i,ref:t}):(0,w.jsx)(U,{...i,ref:t})})},`PopoverContent`)),V=i(`PopoverContent.RemoveScroll`),H=C.forwardRef(E(function(e,t){let n=j(z,e.__scopePopover),i=C.useRef(null),a=r(t,i),o=C.useRef(!1);return C.useEffect(()=>{let e=i.current;if(e)return g(e)},[]),(0,w.jsx)(p,{as:V,allowPinchZoom:!0,children:(0,w.jsx)(W,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:c(e.onCloseAutoFocus,e=>{e.preventDefault(),o.current||n.triggerRef.current?.focus()}),onPointerDownOutside:c(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;o.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:c(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})},`PopoverContentModal`)),U=C.forwardRef(E(function(e,t){let n=j(z,e.__scopePopover),r=C.useRef(!1),i=C.useRef(!1);return(0,w.jsx)(W,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`PopoverContentNonModal`)),W=C.forwardRef(E(function(e,t){let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...f}=e,p=j(z,n),g=k(n);return m(),(0,w.jsx)(d,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,w.jsx)(h,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>p.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,w.jsx)(y,{"data-state":G(p.open),role:`dialog`,id:p.contentId,...g,...f,ref:t,style:{...f.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})},`PopoverContentImpl`));function G(e){return e?`open`:`closed`}E(G,`getState`);var K=M,q=P,J=R,Y=B;function X({modal:e=!1,...t}){return(0,w.jsx)(K,{"data-slot":`popover`,modal:e,...t})}function Z({...e}){return(0,w.jsx)(q,{"data-slot":`popover-trigger`,...e})}function Q({className:e,align:t=`center`,sideOffset:n=8,alignOffset:r=t===`center`?0:-5,collisionPadding:i=20,portalContainer:a,...o}){let s=C.useContext(S);return(0,w.jsx)(J,{container:a===void 0?s??void 0:a,children:(0,w.jsx)(Y,{"data-slot":`popover-content`,align:t,sideOffset:n,alignOffset:r,collisionPadding:i,className:x(`z-[200] flex max-h-(--radix-popover-content-available-height) w-72 max-w-[calc(100vw-40px)] origin-(--radix-popover-content-transform-origin) flex-col gap-2.5 overflow-y-auto overscroll-contain rounded-md bg-popover p-2.5 text-sm text-popover-foreground shadow-float outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...o})})}function $({className:e,...t}){return(0,w.jsx)(`div`,{"data-slot":`popover-title`,className:x(`font-medium`,e),...t})}export{Z as i,Q as n,$ as r,X as t};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{f as t,m as n,n as r,r as i,u as a}from"./vendor-router-CSN_DGvx.js";import{i as o,r as s}from"./vendor-react-DwNgTV1j.js";import{r as c}from"./routes-DIeaqWVc.js";import{t as l}from"./use-i18n-
|
|
1
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{f as t,m as n,n as r,r as i,u as a}from"./vendor-router-CSN_DGvx.js";import{i as o,r as s}from"./vendor-react-DwNgTV1j.js";import{r as c}from"./routes-DIeaqWVc.js";import{t as l}from"./use-i18n-CrMP8KP1.js";import{t as u}from"./http-response-BMpatf4O.js";import{n as d}from"./http-Ck9ziPLg.js";import{t as f}from"./arrow-down-CDGua-ue.js";import{t as p}from"./arrow-up-DST6-qVQ.js";import{t as m}from"./calendar-clock-VIxTaqqy.js";import{t as h}from"./chevron-down-CxtxIjiP.js";import{t as g}from"./chevron-left-BAtyp3_6.js";import{t as _}from"./chevron-right-C3t2Rckj.js";import{t as v}from"./copy-DHmIFc52.js";import{t as y}from"./WorkspacePicker-BRa_IVqp.js";import{t as b}from"./message-circle-D-XrK6Ft.js";import{t as x}from"./monitor-ORxecA9m.js";import{t as S}from"./pencil-U08v_vV9.js";import{t as C}from"./plus-fQbSqB1n.js";import{a as w,c as T,i as E,l as D,n as O,o as k,r as A,s as j,t as M,u as N}from"./use-open-bot-DU7b6x-6.js";import{t as P}from"./trash-2-CNrPOoPR.js";import{t as ee}from"./users-CCtFZzwl.js";import{i as F,n as I,r as L,t as te}from"./accordion-CiJMkjqX.js";import{t as R}from"./switch-D_G8wFhs.js";import{t as z}from"./segmented-control-xkrEOP_d.js";import{t as ne}from"./utils-C8uzG5AZ.js";import{n as re,t as B}from"./button-CCcCN8tE.js";import{t as V}from"./input-CPw-zkYh.js";import{t as H}from"./textarea-DmATpOqT.js";import{t as ie}from"./model-display-kDwvtxrW.js";import{t as ae}from"./pick-system-directory-Cnb1L8Kd.js";import{n as U,t as W}from"./PageState-Cz6vFMXv.js";import{t as oe}from"./BotAvatar-CNL-APwP.js";import{t as G}from"./AppSelect-DQYKUW5E.js";import{A as se,C as ce,E as le,O as ue,T as K,_ as de,a as fe,b as pe,d as me,f as he,g as ge,h as _e,i as ve,j as q,l as ye,m as be,n as J,o as Y,p as xe,r as X,s as Se,t as Ce,u as we,v as Te,w as Ee,x as De,y as Oe}from"./bots-store-BYTwHk9o.js";import{t as ke}from"./public-flags-_XZrt2pU.js";var Z=e(o(),1);function Q(e,t){return!t||t.kind===`local`?e(`bots:computer.local`):t.name||e(`bots:computer.unnamed`)}function Ae(e,t){return[`npx pisper executor pair --brain ${e.remote.endpoints[0]||t.brain} --fingerprint ${e.remote.fingerprint||t.fingerprint} --code ${e.code} --root ${t.root}`,`npx pisper executor`]}var $=s();function je({environment:e,onRemoved:t,onError:n}){let{t:r}=l(),[i,a]=(0,Z.useState)(!1),[o,s]=(0,Z.useState)(!1),c=async()=>{s(!0);try{await ce(e.id),t()}catch(e){n(e instanceof Error?e.message:String(e)),a(!1)}finally{s(!1)}};return(0,$.jsxs)(`li`,{"data-environment":e.id,className:`flex flex-col gap-1 py-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,className:ne(`size-2 flex-none rounded-full`,e.online?`bg-success`:`bg-content-faint`)}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm font-medium text-content`,children:Q(r,e)}),(0,$.jsx)(`span`,{className:`text-xs text-content-muted`,children:e.online?r(`bots:computer.online`):r(`bots:computer.offline`)}),e.kind===`node`&&(i?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(B,{size:`sm`,variant:`ghost`,disabled:o,onClick:()=>a(!1),children:r(`bots:computer.cancel`)}),(0,$.jsx)(B,{size:`sm`,variant:`destructive`,disabled:o,onClick:()=>void c(),children:r(`bots:computer.confirmRemove`)})]}):(0,$.jsx)(B,{size:`sm`,variant:`ghost`,onClick:()=>a(!0),children:r(`bots:computer.remove`)}))]}),e.roots.length>0&&(0,$.jsx)(`p`,{className:`truncate pl-4 font-mono text-xs text-content-muted`,children:e.roots.join(` · `)}),e.usedBy.length>0&&(0,$.jsx)(`p`,{className:`pl-4 text-xs text-content-muted`,children:r(`bots:computer.usedBy`,{names:e.usedBy.map(e=>e.name).join(`、`)})})]})}function Me({pairing:e,onDone:t}){let{t:n}=l(),r=a(),[i,o]=(0,Z.useState)(!1),s=Ae(e,{brain:n(`bots:computer.brainPlaceholder`),fingerprint:`SHA256:…`,root:n(`bots:computer.rootPlaceholder`)}),c=async()=>{try{await navigator.clipboard.writeText(s.join(`
|
|
2
2
|
`)),o(!0)}catch{o(!1)}};return(0,$.jsxs)(`section`,{"aria-label":n(`bots:computer.addTitle`),className:`mt-2 rounded-xl border border-stroke bg-surface-subtle p-3 text-sm`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(`h4`,{className:`font-semibold text-content`,children:n(`bots:computer.addTitle`)}),(0,$.jsx)(B,{size:`sm`,variant:`ghost`,onClick:t,children:n(`bots:computer.done`)})]}),(0,$.jsxs)(`p`,{className:`mt-1 text-xs text-content-muted`,children:[n(`bots:computer.code`),` `,(0,$.jsx)(`b`,{"data-pairing-code":!0,className:`font-mono text-content`,children:e.code}),` `,`· `,n(`bots:computer.codeHint`)]}),!e.remote.enabled&&(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 rounded-lg border border-st-attn-border bg-surface-raised px-2.5 py-2 text-xs text-content-secondary`,children:[(0,$.jsx)(`span`,{className:`min-w-0 flex-1`,children:n(`bots:computer.remoteOff`)}),(0,$.jsx)(B,{size:`sm`,variant:`outline`,onClick:()=>r(`/config/remote-access`),children:n(`bots:computer.openRemote`)})]}),(0,$.jsx)(`p`,{className:`mt-2 text-xs text-content-muted`,children:n(`bots:computer.runThere`)}),(0,$.jsx)(`pre`,{className:`mt-1 max-h-40 overflow-auto rounded-lg bg-surface-raised p-2.5 font-mono text-xs whitespace-pre-wrap break-all text-content-secondary`,children:s.join(`
|
|
3
3
|
`)}),(0,$.jsxs)(`div`,{className:`mt-2 flex items-center justify-between gap-2`,children:[(0,$.jsx)(`p`,{className:`text-xs text-content-muted`,children:n(`bots:computer.rootHint`)}),(0,$.jsxs)(B,{size:`sm`,variant:`outline`,onClick:()=>void c(),children:[(0,$.jsx)(v,{"aria-hidden":`true`}),n(i?`bots:computer.copied`:`bots:computer.copy`)]})]})]})}function Ne({bot:e,environments:t,onEnvironmentsChanged:n,onError:r}){let{t:i}=l(),a=J(e=>e.upsert),[o,s]=(0,Z.useState)(e.workspace.environmentId),[c,u]=(0,Z.useState)(e.workspace.cwd),[d,f]=(0,Z.useState)(!1),[p,m]=(0,Z.useState)(!1),[h,g]=(0,Z.useState)(!1),[_,v]=(0,Z.useState)(null);(0,Z.useEffect)(()=>{s(e.workspace.environmentId),u(e.workspace.cwd)},[e.id,e.workspace.environmentId,e.workspace.cwd]);let b=t.find(e=>e.id===o),S=o===`local`,w=o!==e.workspace.environmentId||c.trim()!==e.workspace.cwd,T=async t=>{g(!0);try{a(await K(e.id,{workspace:{...e.workspace,...t}})),n()}catch(e){r(e instanceof Error?e.message:String(e))}finally{g(!1)}},E=async()=>{if(!d){if(!S){m(!0);return}f(!0);try{let t=await ae(c||e.workspace.cwd,i(`bots:computer.folder`));t.status===`picked`?u(t.path):t.status===`unavailable`&&m(!0)}catch(e){r(e instanceof Error?e.message:String(e))}finally{f(!1)}}},D=async()=>{try{v(await we())}catch(e){r(e instanceof Error?e.message:String(e))}};return(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,$.jsx)(`p`,{className:`text-xs text-content-muted`,children:i(`bots:computer.description`)}),(0,$.jsxs)(`label`,{className:`flex items-center justify-between gap-3 text-sm`,children:[(0,$.jsx)(`span`,{className:`flex-none`,children:i(`bots:computer.runsOn`)}),(0,$.jsxs)(G,{value:o,className:`w-48`,"aria-label":i(`bots:computer.runsOn`),disabled:h,onChange:t=>{s(t.target.value),u(t.target.value===e.workspace.environmentId?e.workspace.cwd:``)},children:[t.length===0&&(0,$.jsx)(`option`,{value:`local`,children:i(`bots:computer.local`)}),t.map(e=>(0,$.jsx)(`option`,{value:e.id,children:e.kind===`local`?i(`bots:computer.local`):i(`bots:computer.option`,{name:Q(i,e),state:e.online?i(`bots:computer.online`):i(`bots:computer.offline`)})},e.id))]})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-content-muted`,children:i(`bots:computer.folder`)}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(x,{className:`size-3.5 flex-none text-content-muted`,"aria-hidden":`true`}),(0,$.jsx)(V,{value:c,className:`font-mono text-xs`,"aria-label":i(`bots:computer.folder`),placeholder:S?i(`bots:computer.folderPlaceholder`):b?.roots[0]??i(`bots:computer.folderPlaceholder`),disabled:h,onChange:e=>u(e.target.value)}),(S||b)&&(0,$.jsx)(B,{size:`sm`,variant:`outline`,disabled:h||d,onClick:()=>void E(),children:i(`bots:new.pick`)})]}),!S&&b&&(0,$.jsx)(`p`,{className:`text-xs text-content-muted`,children:i(`bots:computer.folderInRoots`,{roots:b.roots.join(`、`)})}),w&&(0,$.jsx)(`div`,{className:`flex justify-end`,children:(0,$.jsx)(B,{size:`sm`,disabled:h||!c.trim(),onClick:()=>void T({environmentId:o,cwd:c.trim()}),children:i(`bots:computer.switch`)})})]}),(0,$.jsxs)(`section`,{"aria-label":i(`bots:computer.listTitle`),className:`border-t border-stroke pt-3`,children:[(0,$.jsx)(`h4`,{className:`text-xs font-medium text-content-muted`,children:i(`bots:computer.listTitle`)}),(0,$.jsx)(`ul`,{role:`list`,className:`m-0 list-none divide-y divide-stroke p-0`,children:t.map(e=>(0,$.jsx)(je,{environment:e,onRemoved:n,onError:r},e.id))}),_?(0,$.jsx)(Me,{pairing:_,onDone:()=>{v(null),n()}}):(0,$.jsxs)(B,{size:`sm`,variant:`outline`,className:`mt-1`,onClick:()=>void D(),children:[(0,$.jsx)(C,{"aria-hidden":`true`}),i(`bots:computer.add`)]})]}),(0,$.jsx)(y,{open:p,initialPath:c,onOpenChange:m,listFolders:(e,t)=>De(o,e,t),onSelect:e=>{u(e),m(!1)}})]})}function Pe(e){return`ref`in e?`ref:${e.ref}`:`tier:${e.tier}`}function Fe(e){return e.startsWith(`ref:`)?{ref:e.slice(4)}:{tier:X.find(t=>`tier:${t}`===e)??`standard`}}function Ie({bot:e,saving:t,onSave:n}){let{t:r}=l(),[i,a]=(0,Z.useState)([]);(0,Z.useEffect)(()=>{let e=!0;return ge().then(t=>e&&a(t)).catch(()=>e&&a([])),()=>{e=!1}},[]);let o=i.map(e=>e.name),s=Pe(e.model);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`label`,{className:`flex items-center justify-between gap-3 text-sm`,children:[(0,$.jsx)(`span`,{className:`flex-none`,children:r(`bots:model.model`)}),(0,$.jsxs)(G,{value:s,className:`w-56`,"aria-label":r(`bots:model.model`),disabled:t,onChange:e=>n({model:Fe(e.target.value)}),children:[X.map(e=>(0,$.jsx)(`option`,{value:`tier:${e}`,children:E(r,{tier:e})},e)),`ref`in e.model&&!i.some(e=>`ref:${e.ref}`===s)&&(0,$.jsx)(`option`,{value:s,children:e.model.ref}),i.map(e=>(0,$.jsx)(`option`,{value:`ref:${e.ref}`,children:`${ie(e.name,o)} · ${e.providerName}`},e.ref))]})]}),(0,$.jsxs)(`label`,{className:`flex items-center justify-between gap-3 text-sm`,children:[(0,$.jsx)(`span`,{className:`flex-none`,children:r(`bots:model.thinking`)}),(0,$.jsxs)(G,{value:e.thinking??``,className:`w-56`,"aria-label":r(`bots:model.thinking`),disabled:t,onChange:e=>n({thinking:Y.find(t=>t===e.target.value)??null}),children:[(0,$.jsx)(`option`,{value:``,children:r(`bots:model.thinkingDefault`)}),Y.map(e=>(0,$.jsx)(`option`,{value:e,children:w(r,e)},e))]})]}),(0,$.jsx)(`p`,{className:`text-xs text-content-muted`,children:r(`bots:model.hint`)})]})}function Le({bot:e,saving:t=!1,onError:n,onCount:r,onReadGlobalChange:i}){let{t:a}=l(),[o,s]=(0,Z.useState)(null),[c,u]=(0,Z.useState)(``),[d,f]=(0,Z.useState)(null),[p,m]=(0,Z.useState)(!1);(0,Z.useEffect)(()=>{let t=new AbortController;return _e(e.id,t.signal).then(e=>s(e)).catch(e=>{t.signal.aborted||(s([]),n(e instanceof Error?e.message:String(e)))}),()=>t.abort()},[e.id,n]),(0,Z.useEffect)(()=>{o&&r?.(o.length)},[o,r]);let h=async e=>{m(!0);try{await e()}catch(e){n(e instanceof Error?e.message:String(e))}finally{m(!1)}},g=()=>h(async()=>{let t=await Se(e.id,c);s(e=>[...(e||[]).filter(e=>e.id!==t.id),t]),u(``)}),_=()=>h(async()=>{if(!d)return;let t=await be(e.id,d.id,d.text);s(e=>(e||[]).map(e=>e.id===t.id?t:e)),f(null)}),v=t=>h(async()=>{await me(e.id,t),s(e=>(e||[]).filter(e=>e.id!==t))});return(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(`p`,{className:`m-0 text-xs text-content-muted`,children:a(`bots:memory.hint`,{name:e.name})}),i&&(0,$.jsxs)(`label`,{className:`flex items-center justify-between gap-3 text-sm`,children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,$.jsx)(`span`,{children:a(`bots:memory.readGlobal`)}),(0,$.jsx)(`span`,{className:`text-xs text-content-muted`,children:a(`bots:memory.readGlobalHint`)})]}),(0,$.jsx)(R,{checked:e.readGlobalMemory,disabled:t,onCheckedChange:i})]}),o&&!o.length&&(0,$.jsx)(W,{compact:!0,title:a(`bots:memory.empty`,{name:e.name})}),o&&o.length>0&&(0,$.jsx)(`ul`,{role:`list`,className:`m-0 flex list-none flex-col gap-1.5 p-0`,children:[...o].reverse().map(e=>d?.id===e.id?(0,$.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(V,{value:d.text,maxLength:500,"aria-label":a(`bots:memory.editLabel`),onChange:t=>f({id:e.id,text:t.target.value}),onKeyDown:e=>{e.key===`Enter`&&d.text.trim()&&_(),e.key===`Escape`&&f(null)}}),(0,$.jsx)(B,{size:`sm`,disabled:p||!d.text.trim(),onClick:()=>void _(),children:a(`bots:memory.save`)}),(0,$.jsx)(B,{size:`sm`,variant:`ghost`,onClick:()=>f(null),children:a(`bots:memory.cancel`)})]},e.id):(0,$.jsxs)(`li`,{"data-bot-memory":e.id,className:`group flex items-start gap-2 rounded-lg bg-surface-subtle px-2.5 py-2 text-[13px]`,children:[(0,$.jsx)(`span`,{className:`min-w-0 flex-1 text-content`,children:e.text}),(0,$.jsx)(B,{type:`button`,variant:`ghost`,size:`icon-xs`,className:`flex-none pointer-coarse:size-11`,"aria-label":a(`bots:memory.edit`),title:a(`bots:memory.edit`),disabled:p,onClick:()=>f({id:e.id,text:e.text}),children:(0,$.jsx)(S,{"aria-hidden":`true`})}),(0,$.jsx)(B,{type:`button`,variant:`ghost`,size:`icon-xs`,className:`flex-none pointer-coarse:size-11`,"aria-label":a(`bots:memory.delete`),title:a(`bots:memory.delete`),disabled:p,onClick:()=>void v(e.id),children:(0,$.jsx)(P,{"aria-hidden":`true`})})]},e.id))}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(V,{value:c,maxLength:500,"aria-label":a(`bots:memory.addLabel`),placeholder:a(`bots:memory.addPlaceholder`),onChange:e=>u(e.target.value),onKeyDown:e=>{e.key===`Enter`&&c.trim()&&g()}}),(0,$.jsx)(B,{size:`sm`,variant:`outline`,disabled:p||!c.trim(),onClick:()=>void g(),children:a(`bots:memory.add`)})]})]})}var Re=[`feishu`,`weixin`,`qq`,`telegram`],ze=e=>Re.includes(e);function Be(e){let t=e&&typeof e==`object`?e:null,n=t?.connections;if(!n||typeof n!=`object`||Array.isArray(n))throw u();let r=Re.flatMap(e=>{let t=n[e];if(!t||typeof t!=`object`)return[];let{enabled:r,ownerConfigured:i}=t;return r===!1?[]:[{platform:e,ownerConfigured:i===!0}]}),i=new Set(r.map(e=>e.platform));return{channels:r,groups:(Array.isArray(t.scopes)?t.scopes:[]).flatMap(e=>{let t=e&&typeof e==`object`?e:{},n=e=>typeof e==`string`?e.trim():``,r=n(t.peerId);return t.chatType!==`group`||!ze(t.platform)||!r||!i.has(t.platform)?[]:[{platform:t.platform,peerId:r,title:n(t.title)||r,lastMessage:n(t.lastMessage)}]})}}function Ve(e){return d(`/api/channels`,{signal:e,parse:Be})}function He(e,t){return e.some(e=>e.platform===t.platform&&e.chatType===t.chatType&&e.senderIds.length===0&&(e.peerIds===null||t.peerIds!==null&&t.peerIds.every(t=>e.peerIds?.includes(t))))}function Ue({bot:e,onError:t}){let{t:n}=l(),i=J(e=>e.upsert),[a,o]=(0,Z.useState)(!1),[s,u]=(0,Z.useState)(!1),[d,f]=(0,Z.useState)(!1),[p,m]=(0,Z.useState)(null),[h,g]=(0,Z.useState)(``),[_,v]=(0,Z.useState)(`feishu`),[y,x]=(0,Z.useState)(`p2p`),[S,w]=(0,Z.useState)(``),[T,E]=(0,Z.useState)(``),[O,k]=(0,Z.useState)(!1);(0,Z.useEffect)(()=>{let e=new AbortController;return g(``),Ve(e.signal).then(t=>{e.signal.aborted||m(t)},t=>{e.signal.aborted||g(t instanceof Error?t.message:String(t))}),()=>e.abort()},[a]);let A=async n=>{f(!0);try{return i(await K(e.id,{channels:n})),!0}catch(e){return t(e instanceof Error?e.message:String(e)),!1}finally{f(!1)}},M=()=>{o(!1),u(!1),w(``),E(``),k(!1)},N=async t=>{await A([...e.channels,t])&&M()},P=()=>{let e=D(S);N({platform:_,chatType:y,peerIds:e.length?e:null,senderIds:D(T),everyone:O})},F=p?[...p.channels.map(e=>({key:`${e.platform}:p2p`,title:n(`bots:triggers.pickP2p`,{platform:j(n,e.platform)}),detail:e.ownerConfigured?n(`bots:triggers.ownerOnly`):n(`bots:triggers.ownerMissing`),channel:{platform:e.platform,chatType:`p2p`,peerIds:null,senderIds:[],everyone:!1},unavailable:!e.ownerConfigured})),...p.groups.map(e=>{let t=p.channels.find(t=>t.platform===e.platform);return{key:`${e.platform}:group:${e.peerId}`,title:e.title,detail:[n(`bots:triggers.pickGroup`,{platform:j(n,e.platform)}),e.lastMessage].filter(Boolean).join(` · `),channel:{platform:e.platform,chatType:`group`,peerIds:[e.peerId],senderIds:[],everyone:!1},unavailable:!t?.ownerConfigured}})]:[];return(0,$.jsxs)(`div`,{className:`flex flex-col`,children:[(0,$.jsx)(`p`,{className:`mb-2 text-xs text-content-muted`,children:n(`bots:triggers.chatsHint`,{name:e.name})}),e.channels.length>0&&(0,$.jsx)(`ul`,{role:`list`,className:`m-0 mb-2 flex list-none flex-col gap-1.5 p-0`,children:e.channels.map((t,r)=>(0,$.jsxs)(`li`,{"data-bot-channel":t.platform,className:`flex items-start gap-2 rounded-lg bg-surface-subtle px-2.5 py-2 text-xs`,children:[(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`b`,{className:`font-medium text-content`,children:[j(n,t.platform),` ·`,` `,t.chatType===`group`?n(`bots:triggers.group`):n(`bots:triggers.p2p`)]}),(0,$.jsxs)(`span`,{className:`block truncate text-content-muted`,children:[t.peerIds?n(`bots:triggers.peers`,{ids:t.peerIds.map(e=>p?.groups.find(n=>n.platform===t.platform&&n.peerId===e)?.title||e).join(`、`)}):n(`bots:triggers.allPeers`),` · `,t.senderIds.length?n(`bots:triggers.adminsWith`,{ids:t.senderIds.join(`、`)}):n(`bots:triggers.admins`)]}),(0,$.jsxs)(`label`,{className:`mt-1.5 flex items-center gap-2 text-content-secondary`,children:[(0,$.jsx)(R,{size:`sm`,checked:t.everyone,disabled:d,onCheckedChange:t=>void A(e.channels.map((e,n)=>n===r?{...e,everyone:t}:e))}),n(`bots:triggers.everyone`)]})]}),(0,$.jsx)(B,{size:`sm`,variant:`ghost`,disabled:d,onClick:()=>void A(e.channels.filter((e,t)=>t!==r)),children:n(`bots:triggers.remove`)})]},`${t.platform}-${r}`))}),a?(0,$.jsxs)(`div`,{"data-bot-channel-picker":!0,className:`flex flex-col gap-2 rounded-lg border border-stroke p-2.5`,children:[s?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`m-0 text-xs text-content-muted`,children:n(`bots:triggers.manualHint`)}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(G,{value:_,className:`w-32`,"aria-label":n(`bots:triggers.platform`),onChange:e=>v(e.target.value),children:ve.map(e=>(0,$.jsx)(`option`,{value:e,children:j(n,e)},e))}),(0,$.jsx)(z,{value:y,onValueChange:e=>x(e),options:[{value:`p2p`,label:n(`bots:triggers.p2p`)},{value:`group`,label:n(`bots:triggers.group`)}]})]}),(0,$.jsx)(V,{value:S,"aria-label":n(`bots:triggers.peerIds`),placeholder:n(`bots:triggers.peerIdsPlaceholder`),onChange:e=>w(e.target.value)}),(0,$.jsx)(V,{value:T,"aria-label":n(`bots:triggers.senderIds`),placeholder:n(`bots:triggers.senderIdsPlaceholder`),onChange:e=>E(e.target.value)}),(0,$.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-content-secondary`,children:[(0,$.jsx)(R,{size:`sm`,checked:O,onCheckedChange:k}),n(`bots:triggers.everyone`)]})]}):h?(0,$.jsx)(`p`,{role:`alert`,className:`m-0 text-xs text-destructive`,children:h}):p?F.length===0?(0,$.jsx)(W,{compact:!0,icon:b,title:n(`bots:triggers.noChannels`),description:n(`bots:triggers.noChannelsHint`),action:(0,$.jsx)(B,{asChild:!0,size:`sm`,variant:`outline`,children:(0,$.jsx)(r,{to:c.channels,children:n(`bots:triggers.openChannels`)})})}):(0,$.jsx)(`ul`,{role:`list`,"aria-label":n(`bots:triggers.pickTitle`),className:`m-0 flex list-none flex-col p-0`,children:F.map(t=>{let r=He(e.channels,t.channel),i=t.channel.chatType===`group`?ee:b;return(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,"data-bot-chat-option":t.key,className:`flex min-h-11 w-full min-w-0 items-center gap-2.5 rounded-md px-2 py-1.5 text-left outline-none hover:bg-surface-hover focus-visible:ring-3 focus-visible:ring-focus-ring disabled:cursor-not-allowed disabled:opacity-50`,disabled:d||r||t.unavailable,onClick:()=>void N(t.channel),children:[(0,$.jsx)(i,{className:`size-4 flex-none text-content-muted`,"aria-hidden":`true`}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`span`,{className:`block truncate text-sm text-content`,children:t.title}),(0,$.jsx)(`span`,{className:`block truncate text-xs text-content-muted`,children:t.detail})]}),r?(0,$.jsx)(`span`,{className:`flex-none text-xs text-content-muted`,children:n(`bots:triggers.added`)}):(0,$.jsx)(C,{className:`size-4 flex-none text-content-muted`,"aria-hidden":`true`})]})},t.key)})}):(0,$.jsx)(`div`,{role:`status`,className:`grid min-h-16 place-items-center`,children:(0,$.jsx)(re,{className:`size-4`})}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[s?(0,$.jsx)(`span`,{}):(0,$.jsx)(B,{size:`sm`,variant:`ghost`,onClick:()=>u(!0),children:n(`bots:triggers.manual`)}),(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsx)(B,{size:`sm`,variant:`ghost`,onClick:M,children:n(`bots:triggers.cancel`)}),s&&(0,$.jsx)(B,{size:`sm`,disabled:d,onClick:P,children:n(`bots:triggers.add`)})]})]})]}):(0,$.jsx)(B,{size:`sm`,variant:`outline`,onClick:()=>o(!0),children:n(`bots:triggers.addChat`)})]})}var We=[1,2,3,4,5,6,0];function Ge(){let e=new Date,t=e=>String(e).padStart(2,`0`);return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`}function Ke({bot:e,initialMessage:t=``,onCancel:n,onCreated:r,onError:i}){let{t:a}=l(),[o,s]=(0,Z.useState)(!1),[c,u]=(0,Z.useState)(t),[d,f]=(0,Z.useState)(t?`weekly`:`daily`),[p,m]=(0,Z.useState)(`09:00`),[h,g]=(0,Z.useState)(Ge),[_,v]=(0,Z.useState)(t?5:1),y=async()=>{let t=c.trim();s(!0);try{await ye({botId:e.id,name:`${e.name}:${t.slice(0,40)}`,botMessage:t,frequency:d,time:p,date:d===`once`?h:``,dayOfWeek:_,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone||`Asia/Hong_Kong`}),r()}catch(e){i(e instanceof Error?e.message:String(e))}finally{s(!1)}};return(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg border border-stroke p-2.5`,children:[(0,$.jsx)(V,{value:c,maxLength:12e3,"aria-label":a(`bots:triggers.scheduleMessage`),placeholder:a(`bots:triggers.scheduleMessagePlaceholder`),onChange:e=>u(e.target.value)}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(G,{value:d,className:`w-28`,"aria-label":a(`bots:triggers.frequency`),onChange:e=>f(e.target.value),children:[(0,$.jsx)(`option`,{value:`daily`,children:a(`bots:triggers.daily`)}),(0,$.jsx)(`option`,{value:`weekly`,children:a(`bots:triggers.weekly`)}),(0,$.jsx)(`option`,{value:`once`,children:a(`bots:triggers.once`)})]}),d===`weekly`&&(0,$.jsx)(G,{value:String(_),className:`w-24`,"aria-label":a(`bots:triggers.weekday`),onChange:e=>v(Number(e.target.value)),children:We.map(e=>(0,$.jsx)(`option`,{value:e,children:N(a,e)},e))}),d===`once`&&(0,$.jsx)(V,{type:`date`,value:h,className:`w-40`,"aria-label":a(`bots:triggers.date`),onChange:e=>g(e.target.value)}),(0,$.jsx)(V,{type:`time`,value:p,className:`w-28`,"aria-label":a(`bots:triggers.time`),onChange:e=>m(e.target.value)})]}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,$.jsx)(B,{size:`sm`,variant:`ghost`,onClick:n,children:a(`bots:triggers.cancel`)}),(0,$.jsx)(B,{size:`sm`,disabled:o||!c.trim(),onClick:()=>void y(),children:a(`bots:triggers.add`)})]})]})}function qe({bot:e,onError:t}){let{t:n}=l(),[r,i]=(0,Z.useState)([]),[a,o]=(0,Z.useState)(!1),[s,c]=(0,Z.useState)(!1),u=(0,Z.useCallback)(async()=>{try{i(await de(e.id))}catch{}},[e.id]);(0,Z.useEffect)(()=>{u()},[u]);let d=async e=>{c(!0);try{await e(),await u()}catch(e){t(e instanceof Error?e.message:String(e))}finally{c(!1)}};return(0,$.jsxs)(`div`,{className:`flex flex-col`,children:[r.length>0&&(0,$.jsx)(`ul`,{role:`list`,className:`m-0 mb-2 flex list-none flex-col gap-1.5 p-0`,children:r.map(e=>(0,$.jsxs)(`li`,{"data-bot-schedule":e.id,className:`flex items-center gap-2 rounded-lg bg-surface-subtle px-2.5 py-2 text-xs`,children:[(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`b`,{className:`block truncate font-medium text-content`,children:e.botMessage}),(0,$.jsx)(`span`,{className:`text-content-muted`,children:T(n,e)})]}),(0,$.jsx)(R,{checked:e.enabled,disabled:s,"aria-label":n(`bots:triggers.scheduleEnabled`),onCheckedChange:t=>void d(()=>Ee(e.id,t))}),(0,$.jsx)(B,{size:`sm`,variant:`ghost`,disabled:s,onClick:()=>void d(()=>he(e.id)),children:n(`bots:triggers.remove`)})]},e.id))}),a?(0,$.jsx)(Ke,{bot:e,onCancel:()=>o(!1),onCreated:()=>{o(!1),u()},onError:t}):(0,$.jsx)(B,{size:`sm`,variant:`outline`,onClick:()=>o(!0),children:n(`bots:triggers.addSchedule`)})]})}function Je({bot:e,onError:t,onCount:n}){let{t:r}=l(),[i,a]=(0,Z.useState)(null),[o,s]=(0,Z.useState)(null),[c,u]=(0,Z.useState)(``),[d,f]=(0,Z.useState)(!1);(0,Z.useEffect)(()=>{let n=new AbortController;return Oe(e.id,n.signal).then(e=>a(e)).catch(e=>{n.signal.aborted||(a([]),t(e instanceof Error?e.message:String(e)))}),()=>n.abort()},[e.id,t]),(0,Z.useEffect)(()=>{i&&n?.(i.length)},[i,n]);let p=n=>{if(o?.name===n){s(null);return}s({name:n,body:null}),Te(e.id,n).then(e=>s(t=>t?.name===n?{name:n,body:e.body}:t)).catch(e=>{s(null),t(e instanceof Error?e.message:String(e))})},g=async n=>{f(!0);try{await xe(e.id,n),a(e=>(e||[]).filter(e=>e.name!==n)),o?.name===n&&s(null)}catch(e){t(e instanceof Error?e.message:String(e))}finally{f(!1)}};return(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(`p`,{className:`m-0 text-xs text-content-muted`,children:r(`bots:skills.hint`,{name:e.name})}),i&&!i.length&&(0,$.jsx)(W,{compact:!0,title:r(`bots:skills.empty`,{name:e.name})}),i&&i.length>0&&(0,$.jsx)(`ul`,{role:`list`,className:`m-0 flex list-none flex-col gap-1.5 p-0`,children:i.map(n=>{let i=o?.name===n.name;return(0,$.jsxs)(`li`,{"data-bot-skill":n.name,className:`flex flex-col gap-2 rounded-lg bg-surface-subtle px-2.5 py-2 text-[13px]`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,$.jsxs)(`button`,{type:`button`,className:`flex min-w-0 flex-1 items-start gap-1.5 text-left`,"aria-expanded":i,onClick:()=>p(n.name),children:[i?(0,$.jsx)(h,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 flex-none`}):(0,$.jsx)(_,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 flex-none`}),(0,$.jsxs)(`span`,{className:`min-w-0`,children:[(0,$.jsx)(`b`,{className:`block truncate font-medium text-content`,children:n.name}),(0,$.jsx)(`span`,{className:`block text-xs text-content-muted`,children:n.description})]})]}),(0,$.jsx)(B,{type:`button`,variant:`ghost`,size:`icon-xs`,className:`flex-none pointer-coarse:size-11`,"aria-label":r(`bots:skills.schedule`),title:r(`bots:skills.schedule`),disabled:d,onClick:()=>u(e=>e===n.name?``:n.name),children:(0,$.jsx)(m,{"aria-hidden":`true`})}),(0,$.jsx)(B,{type:`button`,variant:`ghost`,size:`icon-xs`,className:`flex-none pointer-coarse:size-11`,"aria-label":r(`bots:skills.delete`),title:r(`bots:skills.delete`),disabled:d,onClick:()=>void g(n.name),children:(0,$.jsx)(P,{"aria-hidden":`true`})})]}),i&&(0,$.jsx)(`pre`,{className:`m-0 max-h-72 overflow-auto rounded-md bg-surface px-2.5 py-2 text-xs whitespace-pre-wrap text-content`,children:o.body??r(`bots:skills.loading`)}),c===n.name&&(0,$.jsx)(Ke,{bot:e,initialMessage:r(`bots:skills.scheduleMessage`,{name:n.name}),onCancel:()=>u(``),onCreated:()=>u(``),onError:t})]},n.name)})})]})}function Ye({bot:e,saving:t,onSave:n}){let{t:r}=l(),[i,a]=(0,Z.useState)(e.proactive.briefAt);return(0,Z.useEffect)(()=>a(e.proactive.briefAt),[e.id,e.proactive.briefAt]),(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,$.jsxs)(`label`,{className:`flex items-center justify-between gap-3 text-sm`,children:[(0,$.jsx)(`span`,{children:r(`bots:proactive.check`)}),(0,$.jsx)(R,{checked:e.proactive.enabled,disabled:t,onCheckedChange:e=>n({enabled:e})})]}),e.proactive.enabled&&(0,$.jsxs)(`label`,{className:`flex items-center justify-between gap-3 text-sm`,children:[(0,$.jsx)(`span`,{className:`flex-none`,children:r(`bots:proactive.every`)}),(0,$.jsx)(G,{value:String(e.proactive.everyHours),className:`w-44`,"aria-label":r(`bots:proactive.every`),disabled:t,onChange:e=>n({everyHours:Number(e.target.value)}),children:fe.map(e=>(0,$.jsx)(`option`,{value:e,children:r(`bots:proactive.everyHours`,{count:e})},e))})]}),(0,$.jsx)(`p`,{className:`m-0 text-xs text-content-muted`,children:r(`bots:proactive.checkHint`,{name:e.name})}),(0,$.jsxs)(`label`,{className:`flex items-center justify-between gap-3 text-sm`,children:[(0,$.jsx)(`span`,{children:r(`bots:proactive.brief`)}),(0,$.jsx)(R,{checked:e.proactive.brief,disabled:t,onCheckedChange:e=>n({brief:e})})]}),e.proactive.brief&&(0,$.jsxs)(`label`,{className:`flex items-center justify-between gap-3 text-sm`,children:[(0,$.jsx)(`span`,{className:`flex-none`,children:r(`bots:proactive.briefAt`)}),(0,$.jsx)(V,{type:`time`,value:i,className:`w-44`,"aria-label":r(`bots:proactive.briefAt`),disabled:t,onChange:e=>a(e.target.value),onBlur:()=>{/^\d{2}:\d{2}$/.test(i)&&i!==e.proactive.briefAt&&n({briefAt:i})}})]}),(0,$.jsx)(`p`,{className:`m-0 text-xs text-content-muted`,children:r(`bots:proactive.briefHint`)})]})}var Xe={name:``,kind:`task`,text:``,audience:`admins`,allowExtra:!1};function Ze({initial:e,saving:t,onCancel:n,onSave:r}){let{t:i}=l(),[a,o]=(0,Z.useState)(e),s=e=>o(t=>({...t,...e})),c=a.kind===`task`;return(0,$.jsxs)(`form`,{"data-bot-command-form":!0,className:`flex flex-col gap-2 rounded-lg border border-stroke p-2.5`,onSubmit:e=>{e.preventDefault(),r({...a,name:a.name.trim(),text:a.text.trim()})},children:[(0,$.jsx)(V,{value:a.name,autoFocus:!0,maxLength:24,"aria-label":i(`bots:commands.name`),placeholder:i(`bots:commands.namePlaceholder`),onChange:e=>s({name:e.target.value})}),(0,$.jsx)(z,{value:a.kind,onValueChange:e=>s({kind:e,allowExtra:e===`task`&&a.allowExtra}),options:[{value:`task`,label:i(`bots:commands.task`)},{value:`reply`,label:i(`bots:commands.reply`)}]}),(0,$.jsx)(H,{value:a.text,rows:3,maxLength:4e3,"aria-label":i(c?`bots:commands.taskText`:`bots:commands.replyText`),placeholder:i(c?`bots:commands.taskPlaceholder`:`bots:commands.replyPlaceholder`),onChange:e=>s({text:e.target.value})}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 text-sm`,children:[(0,$.jsx)(`span`,{className:`text-content-secondary`,children:i(`bots:commands.audience`)}),(0,$.jsx)(z,{value:a.audience,onValueChange:e=>s({audience:e}),options:[{value:`admins`,label:i(`bots:commands.admins`)},{value:`everyone`,label:i(`bots:commands.everyone`)}]})]}),c&&(0,$.jsxs)(`label`,{className:`flex items-center justify-between gap-3 text-sm`,children:[(0,$.jsx)(`span`,{className:`text-content-secondary`,children:i(`bots:commands.allowExtra`)}),(0,$.jsx)(R,{checked:a.allowExtra,onCheckedChange:e=>s({allowExtra:e})})]}),c&&a.allowExtra&&a.audience===`everyone`&&(0,$.jsx)(`p`,{className:`m-0 text-xs text-content-muted`,children:i(`bots:commands.extraNote`)}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,$.jsx)(B,{type:`button`,size:`sm`,variant:`ghost`,onClick:n,children:i(`bots:triggers.cancel`)}),(0,$.jsx)(B,{type:`submit`,size:`sm`,disabled:t||!a.name.trim()||!a.text.trim(),children:i(`bots:commands.save`)})]})]})}function Qe({bot:e,onError:t}){let{t:n}=l(),r=J(e=>e.upsert),[i,a]=(0,Z.useState)(null),[o,s]=(0,Z.useState)(!1),c=async n=>{s(!0);try{return r(await K(e.id,{commands:n})),!0}catch(e){return t(e instanceof Error?e.message:String(e)),!1}finally{s(!1)}},u=(t,n)=>{let r=[...e.commands],[i]=r.splice(t,1);r.splice(t+n,0,i),c(r)},d=e.channels.some(e=>e.everyone);return(0,$.jsxs)(`div`,{className:`flex flex-col`,children:[(0,$.jsx)(`p`,{className:`mb-2 text-xs text-content-muted`,children:n(`bots:commands.hint`,{name:e.name})}),e.commands.some(e=>e.audience===`everyone`)&&!d&&(0,$.jsx)(`p`,{className:`mb-2 text-xs text-content-muted`,children:n(`bots:commands.noEveryoneChat`)}),e.commands.length>0&&(0,$.jsx)(`ol`,{className:`m-0 mb-2 flex list-none flex-col gap-1.5 p-0`,children:e.commands.map((t,r)=>i===r?(0,$.jsx)(`li`,{children:(0,$.jsx)(Ze,{initial:t,saving:o,onCancel:()=>a(null),onSave:async t=>{await c(e.commands.map((e,n)=>n===r?t:e))&&a(null)}})},t.name):(0,$.jsxs)(`li`,{"data-bot-command":t.name,className:`flex items-start gap-2 rounded-lg bg-surface-subtle px-2.5 py-2 text-xs`,children:[(0,$.jsx)(`span`,{className:`w-4 flex-none pt-px text-right font-mono text-content-muted`,children:r+1}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`b`,{className:`block truncate font-medium text-content`,children:t.name}),(0,$.jsx)(`span`,{className:`block truncate text-content-muted`,children:[t.audience===`everyone`?n(`bots:commands.everyone`):n(`bots:commands.admins`),t.kind===`reply`?n(`bots:commands.reply`):n(`bots:commands.task`),t.allowExtra?n(`bots:commands.extraAllowed`):``,t.text].filter(Boolean).join(` · `)})]}),(0,$.jsx)(B,{size:`icon-sm`,variant:`ghost`,"aria-label":n(`bots:commands.moveUp`),disabled:o||i!==null||r===0,onClick:()=>u(r,-1),children:(0,$.jsx)(p,{})}),(0,$.jsx)(B,{size:`icon-sm`,variant:`ghost`,"aria-label":n(`bots:commands.moveDown`),disabled:o||i!==null||r===e.commands.length-1,onClick:()=>u(r,1),children:(0,$.jsx)(f,{})}),(0,$.jsx)(B,{size:`sm`,variant:`ghost`,disabled:o||i!==null,onClick:()=>a(r),children:n(`bots:commands.edit`)}),(0,$.jsx)(B,{size:`sm`,variant:`ghost`,disabled:o||i!==null,onClick:()=>void c(e.commands.filter((e,t)=>t!==r)),children:n(`bots:triggers.remove`)})]},t.name))}),i===-1?(0,$.jsx)(Ze,{initial:Xe,saving:o,onCancel:()=>a(null),onSave:async t=>{await c([...e.commands,t])&&a(null)}}):(0,$.jsx)(B,{size:`sm`,variant:`outline`,disabled:i!==null||e.commands.length>=20,onClick:()=>a(-1),children:n(`bots:commands.add`)})]})}function $e({bot:e,environments:t,openSection:n,onEnvironmentsChanged:r,onError:i}){let{t:a}=l(),o=J(e=>e.upsert),[s,c]=(0,Z.useState)(e.instructions),[u,d]=(0,Z.useState)(!1),[f,p]=(0,Z.useState)(!1),[m,h]=(0,Z.useState)(null),[g,_]=(0,Z.useState)(null);(0,Z.useEffect)(()=>c(e.instructions),[e.id,e.instructions]);let v=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{n&&v.current?.querySelector(`[data-state="open"]`)?.scrollIntoView()},[n]);let y=async t=>{d(!0);try{o(await K(e.id,t))}catch(e){i(e instanceof Error?e.message:String(e))}finally{d(!1)}},b=t.find(t=>t.id===e.workspace.environmentId),x=se(e.workspace.cwd);return(0,$.jsxs)(`div`,{ref:v,className:`flex flex-col gap-4 pb-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(oe,{avatar:e.avatar,state:ue(e),size:48}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`div`,{className:`truncate text-base font-semibold text-content`,children:e.name}),(0,$.jsx)(`button`,{type:`button`,className:`text-xs text-content-muted underline-offset-2 hover:text-content hover:underline`,onClick:()=>p(e=>!e),children:a(f?`bots:settings.doneLook`:`bots:settings.changeLook`)})]})]}),f&&(0,$.jsx)(A,{value:e.avatar,disabled:u,onChange:e=>void y({avatar:e})}),(0,$.jsxs)(`section`,{"aria-label":a(`bots:details.instructions`),children:[(0,$.jsx)(`h3`,{className:`mb-1 text-sm font-medium text-content`,children:a(`bots:details.instructions`)}),(0,$.jsx)(H,{value:s,rows:4,maxLength:12e3,"aria-label":a(`bots:details.instructions`),placeholder:a(`bots:details.instructionsPlaceholder`),onChange:e=>c(e.target.value)}),s!==e.instructions&&(0,$.jsx)(`div`,{className:`mt-2 flex justify-end`,children:(0,$.jsx)(B,{size:`sm`,disabled:u,onClick:()=>void y({instructions:s}),children:a(`bots:details.save`)})})]}),(0,$.jsxs)(te,{type:`multiple`,defaultValue:n?[n]:void 0,className:`border-t border-stroke`,children:[(0,$.jsxs)(L,{value:`computer`,children:[(0,$.jsx)(F,{children:(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-2`,children:[a(`bots:settings.computer`),(0,$.jsx)(`span`,{className:`truncate text-xs font-normal text-content-muted`,children:a(`bots:settings.computerSummary`,{computer:Q(a,b),folder:x})})]})}),(0,$.jsx)(I,{className:`h-auto`,children:(0,$.jsx)(Ne,{bot:e,environments:t,onEnvironmentsChanged:r,onError:i})})]}),(0,$.jsxs)(L,{value:`memory`,children:[(0,$.jsx)(F,{children:(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-2`,children:[a(`bots:memory.title`),m!==null&&(0,$.jsx)(`span`,{className:`truncate text-xs font-normal text-content-muted`,children:a(`bots:memory.count`,{count:m})})]})}),(0,$.jsx)(I,{className:`h-auto`,children:(0,$.jsx)(Le,{bot:e,saving:u,onError:i,onCount:h,onReadGlobalChange:e=>void y({readGlobalMemory:e})})})]}),(0,$.jsxs)(L,{value:`skills`,children:[(0,$.jsx)(F,{children:(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-2`,children:[a(`bots:skills.title`),g!==null&&(0,$.jsx)(`span`,{className:`truncate text-xs font-normal text-content-muted`,children:a(`bots:skills.count`,{count:g})})]})}),(0,$.jsx)(I,{className:`h-auto`,children:(0,$.jsx)(Je,{bot:e,onError:i,onCount:_})})]}),(0,$.jsxs)(L,{value:`proactive`,children:[(0,$.jsx)(F,{children:(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-2`,children:[a(`bots:proactive.title`),(0,$.jsx)(`span`,{className:`truncate text-xs font-normal text-content-muted`,children:e.proactive.enabled||e.proactive.brief?[e.proactive.enabled?a(`bots:proactive.summaryCheck`,{count:e.proactive.everyHours}):``,e.proactive.brief?a(`bots:proactive.summaryBrief`,{time:e.proactive.briefAt}):``].filter(Boolean).join(` · `):a(`bots:proactive.off`)})]})}),(0,$.jsx)(I,{className:`h-auto`,children:(0,$.jsx)(Ye,{bot:e,saving:u,onSave:e=>void y({proactive:e})})})]}),(0,$.jsxs)(L,{value:`model`,children:[(0,$.jsx)(F,{children:(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-2`,children:[a(`bots:model.title`),(0,$.jsx)(`span`,{className:`truncate text-xs font-normal text-content-muted`,children:a(`bots:model.summary`,{model:E(a,e.model),thinking:w(a,e.thinking)})})]})}),(0,$.jsx)(I,{className:`flex h-auto flex-col gap-3`,children:(0,$.jsx)(Ie,{bot:e,saving:u,onSave:e=>void y(e)})})]}),(0,$.jsxs)(L,{value:`chats`,children:[(0,$.jsx)(F,{children:(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-2`,children:[a(`bots:triggers.chats`),(0,$.jsx)(`span`,{className:`truncate text-xs font-normal text-content-muted`,children:e.channels.length?a(`bots:settings.chatsCount`,{count:e.channels.length}):a(`bots:settings.notSet`)})]})}),(0,$.jsx)(I,{className:`h-auto`,children:(0,$.jsx)(Ue,{bot:e,onError:i})})]}),(0,$.jsxs)(L,{value:`commands`,children:[(0,$.jsx)(F,{children:(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-2`,children:[a(`bots:commands.title`),(0,$.jsx)(`span`,{className:`truncate text-xs font-normal text-content-muted`,children:e.commands.length?a(`bots:commands.count`,{count:e.commands.length,open:e.commands.filter(e=>e.audience===`everyone`).length}):a(`bots:settings.notSet`)})]})}),(0,$.jsx)(I,{className:`h-auto`,children:(0,$.jsx)(Qe,{bot:e,onError:i})})]}),(0,$.jsxs)(L,{value:`schedules`,children:[(0,$.jsx)(F,{children:a(`bots:triggers.schedules`)}),(0,$.jsx)(I,{className:`h-auto`,children:(0,$.jsx)(qe,{bot:e,onError:i})})]}),(0,$.jsxs)(L,{value:`advanced`,children:[(0,$.jsx)(F,{children:(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-2`,children:[a(`bots:settings.advanced`),(0,$.jsx)(`span`,{className:`truncate text-xs font-normal text-content-muted`,children:a(`bots:settings.advancedSummary`,{permission:k(a,e.executionMode)})})]})}),(0,$.jsxs)(I,{className:`flex h-auto flex-col gap-3`,children:[(0,$.jsxs)(`label`,{className:`flex items-center justify-between gap-3 text-sm`,children:[(0,$.jsx)(`span`,{children:a(`bots:details.acceptsWork`)}),(0,$.jsx)(R,{checked:e.enabled,disabled:u,onCheckedChange:e=>void y({enabled:e})})]}),(0,$.jsxs)(`label`,{className:`flex items-center justify-between gap-3 text-sm`,children:[(0,$.jsx)(`span`,{className:`flex-none`,children:a(`bots:details.permission`)}),(0,$.jsx)(G,{value:e.executionMode,className:`w-44`,"aria-label":a(`bots:details.permission`),disabled:u,onChange:e=>void y({executionMode:e.target.value}),children:[`approval-required`,`workspace-write`,`full-access`].map(e=>(0,$.jsx)(`option`,{value:e,children:k(a,e)},e))})]}),(0,$.jsx)(`p`,{className:`text-xs text-content-muted`,children:a(`bots:details.permissionHint`)}),(0,$.jsxs)(`label`,{className:`flex items-center justify-between gap-3 text-sm`,children:[(0,$.jsx)(`span`,{className:`flex-none`,children:a(`bots:details.tools`)}),(0,$.jsxs)(G,{value:q(e.tools),className:`w-44`,"aria-label":a(`bots:details.tools`),disabled:u,onChange:e=>void y({tools:e.target.value===`read-only`?[...le]:null}),children:[(0,$.jsx)(`option`,{value:`all`,children:a(`bots:details.toolsAll`)}),(0,$.jsx)(`option`,{value:`read-only`,children:a(`bots:details.toolsReadOnly`)}),q(e.tools)===`custom`&&(0,$.jsx)(`option`,{value:`custom`,disabled:!0,children:a(`bots:details.toolsCustom`,{count:e.tools?.length??0})})]})]}),(0,$.jsx)(`p`,{className:`text-xs text-content-muted`,children:a(`bots:details.toolsHint`)}),(0,$.jsxs)(`label`,{className:`flex items-center justify-between gap-3 text-sm`,children:[(0,$.jsx)(`span`,{className:`flex-none`,children:a(`bots:details.parallel`)}),(0,$.jsx)(G,{value:String(e.maxParallelAgents),className:`w-44`,"aria-label":a(`bots:details.parallel`),disabled:u,onChange:e=>void y({maxParallelAgents:Number(e.target.value)}),children:[1,2,3,4,5,6].map(e=>(0,$.jsx)(`option`,{value:e,children:a(`bots:details.parallelCount`,{count:e})},e))})]}),(0,$.jsx)(`p`,{className:`text-xs text-content-muted`,children:a(`bots:details.parallelHint`)})]})]})]})]})}var et={enabled:!1,endpoints:[],fingerprint:null};function tt(){let[e,t]=(0,Z.useState)([]),[n,r]=(0,Z.useState)(et),[i,a]=(0,Z.useState)(!1),o=(0,Z.useRef)(0),s=(0,Z.useCallback)(async()=>{let e=++o.current;try{let n=await pe();if(e!==o.current)return;t(n.environments),r(n.remote)}catch{}finally{e===o.current&&a(!0)}},[]);return(0,Z.useEffect)(()=>{s();let e=window.setInterval(()=>{document.visibilityState===`visible`&&s()},1e4);return()=>{window.clearInterval(e),o.current+=1}},[s]),{environments:e,remote:n,loaded:i,refresh:s}}function nt({notify:e}){let{t:n}=l(),r=ke(`bots`),{botId:o=``}=t(),s=a(),c=J(e=>e.bots),u=J(e=>e.loaded),[d,f]=(0,Z.useState)(!1),p=(0,Z.useCallback)(t=>e(t,`error`),[e]),m=M(p);Ce(r);let h=c.find(e=>e.id===o)??null;return r?u?!o&&c[0]?(0,$.jsx)(i,{to:`/bots/${encodeURIComponent(c[0].id)}`,replace:!0}):h?(0,$.jsx)(rt,{botId:h.id,onOpenChat:()=>void m(h),onError:p},h.id):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(U,{kind:`empty`,title:c.length?n(`bots:page.notFound`):n(`bots:page.emptyTitle`),description:n(`bots:page.emptyDescription`),action:(0,$.jsxs)(B,{onClick:()=>f(!0),children:[(0,$.jsx)(C,{"aria-hidden":`true`}),n(`bots:sidebar.newBot`)]})}),(0,$.jsx)(O,{open:d,onOpenChange:f,onCreated:e=>void m(e)})]}):(0,$.jsx)(U,{kind:`loading`,title:n(`bots:page.loading`)}):(0,$.jsx)(U,{kind:`empty`,title:n(`bots:page.disabledTitle`),description:n(`bots:page.disabledDescription`),action:(0,$.jsx)(B,{onClick:()=>s(`/config/labs`),children:n(`bots:page.openLabs`)})})}function rt({botId:e,onOpenChat:t,onError:r}){let{t:i}=l(),a=J(t=>t.bots.find(t=>t.id===e)),o=J(e=>e.load),s=tt(),[c]=n(),u=c.get(`section`)===`chats`?`chats`:void 0;return a?(0,$.jsxs)(`div`,{"data-bot-settings":a.id,className:`flex h-full min-h-0 w-full min-w-0 flex-col`,children:[(0,$.jsxs)(`header`,{"data-window-drag-region":!0,className:`flex h-[52px] flex-none items-center gap-2 border-b border-stroke px-3 [[data-custom-titlebar]_&]:pr-[144px]`,children:[(0,$.jsxs)(B,{variant:`ghost`,size:`sm`,onClick:t,children:[(0,$.jsx)(g,{"aria-hidden":`true`}),i(`bots:settingsPage.backToChat`,{name:a.name})]}),(0,$.jsx)(`h1`,{className:`sr-only`,children:i(`bots:settingsPage.title`,{name:a.name})})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,$.jsx)(`div`,{className:`mx-auto w-[min(640px,calc(100%-32px))] py-6`,children:(0,$.jsx)($e,{bot:a,environments:s.environments,openSection:u,onEnvironmentsChanged:()=>{s.refresh(),o()},onError:r})})})]}):null}export{nt as BotsPage};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/public-folder-dialog-
|
|
2
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{h as t,u as n}from"./vendor-router-CSN_DGvx.js";import{i as r,r as i}from"./vendor-react-DwNgTV1j.js";import{t as a}from"./use-i18n-vKUIcJX7.js";import{t as o}from"./useQuery-DfOU-27z.js";import{a as s,i as c,o as l}from"./startup-queries-Cf6RSLkK.js";import{i as u}from"./http-response-BVH7o4IQ.js";import{n as d}from"./http-BLTlr2yB.js";import{t as f}from"./runtime-capabilities-store-CXahF-U2.js";import{t as ee}from"./chevron-down-CxtxIjiP.js";import{t as p}from"./focus-session-composer-bits-vPmpISU7.js";import{t as m}from"./folder-open-FIShC5Qk.js";import{i as h,n as g,t as _}from"./workspace-order-store-hJOk5NHh.js";import{t as v}from"./folder-DPM8D8cf.js";import{n as y,t as te}from"./useMachines-CPMVc3JJ.js";import{t as b}from"./plus-fQbSqB1n.js";import{t as x}from"./server-BgNvmqwJ.js";import{a as S,c as C,i as w,o as ne,p as re,r as ie,s as T,t as ae}from"./dropdown-menu-Ds0gD8S8.js";import{t as E}from"./utils-C8uzG5AZ.js";import{u as D}from"./events-BOOZIPa5.js";import{t as O}from"./chat-api-BL_tZCbY.js";import{_ as k,d as A,l as j,t as M,u as N,v as P,x as F,y as I}from"./useSessionListQuery-w1eeoWqD.js";import"./useNow-Df6N6r2Y.js";import{a as oe,i as se,n as L,t as ce}from"./useNewProjectPicker-DvaRu71A.js";import{a as le}from"./card-presentation-1oph2b8P.js";import"./useSidebarModel-De1pMvik.js";import{o as R}from"./format-DMJQzoZ7.js";import{r as z,t as B}from"./board-projects-B7ISKK5M.js";var V=e(r(),1),H=class extends Error{stage;cause;sessionId;code=`board_launch_failed`;constructor(e,t,n=``){super(t instanceof Error?t.message:String(t||`launch failed`)),this.stage=e,this.cause=t,this.sessionId=n}},U=1e5,W=5e3;function G(e){if(!e||typeof e!=`object`)return!1;let t=e;return Array.isArray(t.messages)&&t.messages.length===0&&t.streaming===!1&&t.configurationBusy!==!0&&(t.queuedInputs===void 0||Array.isArray(t.queuedInputs)&&t.queuedInputs.length===0)}function K(e){return e instanceof u?`${e.kind||`error`}:${e.status??`-`}`:`error`}async function q(e){let t=`/api/sessions/${encodeURIComponent(e)}`;try{if(!G(await O.getLiveSession(e,{timeout:W})))return!1;await d(t,{method:`DELETE`,timeout:W})}catch(e){return console.warn(`[board] 派发失败后未能清理空会话(${K(e)})`),!1}return s.setQueryData(j,t=>t&&{...t,sessions:t.sessions.filter(t=>t.id!==e)}),D({deletedIds:[e]}),!0}function J(e){s.setQueryData(j,t=>t&&!t.sessions.some(t=>t.id===e.id)?{...t,sessions:[e,...t.sessions]}:t),c(`sessions`)}function ue(e){let t=e.indexOf(`/`);return t>0?{provider:e.slice(0,t),modelId:e.slice(t+1)}:null}async function de(e,t,n){let r=ue(n.model);r&&n.model!==t.model&&await O.updateModel(e,r.provider,r.modelId),n.thinkingLevel&&n.thinkingLevel!==t.thinkingLevel&&await O.setThinkingLevel(e,n.thinkingLevel),n.executionMode&&n.executionMode!==t.executionMode&&await O.updateExecutionMode(e,n.executionMode),n.runMode!==`plan`&&n.runMode!==t.runMode&&await O.updateRunMode(e,n.runMode)}async function fe(e){if(!e.prompt.trim().slice(0,U))throw new H(`create`,Error(`empty prompt`));let t;try{t=await O.createSession(``,e.cwd,{projectless:e.projectless===!0,machine:e.machine??null})}catch(e){throw new H(`create`,e)}let n=t.id;try{await de(n,t,e)}catch(e){throw await q(n),new H(`configure`,e,n)}return{session:t}}var pe=/^\/[a-z][a-z0-9:-]{0,63}$/;async function me(e){let{sessionId:t}=e,n=e.prompt.trim().slice(0,U);if(!t||!n)throw new H(`send`,Error(`empty prompt`),t);let r=e.commandWhenEmpty?.trim()??``;if(r&&!pe.test(r))throw new H(`send`,Error(`invalid command`),t);let i;try{i=await O.getLiveSession(t)}catch(e){throw new H(`send`,e,t)}let a=i&&typeof i==`object`?i:{},o=Array.isArray(a.messages)&&a.messages.length===0&&r?`${r} ${n}`:n,l=async()=>{try{await O.queueInput(t,o,[],`followUp`)}catch(e){throw new H(`send`,e,t)}return{sessionId:t,queued:!0}};if(a.streaming===!0)return l();e.created?.id===t?J({...e.created,firstMessage:n,messageCount:1}):s.getQueryData(j)?.sessions.some(e=>e.id===t)||c(`sessions`);let u=A(t,{streaming:!0});try{await F(t,`launch`,(e,n)=>O.openStream({sessionId:t,message:o,attachments:[],goalMode:!1,teamMode:!1},e,{signal:n}))}catch(e){if(k(t,u),e instanceof N)return l();throw I().catch(()=>void 0),new H(`send`,e,t)}return P(t,e=>!!e).catch(()=>void 0).finally(()=>k(t,u)),{sessionId:t,queued:!1}}function Y(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function X(e){return typeof e==`string`?e:``}function he(e){return(Array.isArray(Y(e).providers)?Y(e).providers:[]).flatMap(e=>{let t=Y(e),n=X(t.id);return!n||t.configured!==!0||t.enabled===!1?[]:(Array.isArray(t.models)?t.models:[]).flatMap(e=>{let r=Y(e),i=X(r.id);return!i||r.kind!==`chat`?[]:[{key:`${n}/${i}`,label:X(r.name)||i,providerName:X(t.name)||n,thinkingLevels:Array.isArray(r.thinkingLevels)?r.thinkingLevels.filter(e=>typeof e==`string`):[]}]})})}function Z(){let e=o(l(`config`)),t=M(),n=_(e=>e.names),r=g(e=>e.projects),i=f(e=>e.capabilities.features),a=(0,V.useMemo)(()=>he(e.data),[e.data]),s=e.data?.provider&&e.data?.model?`${e.data.provider}/${e.data.model}`:``,c=t.data?.sessions,u=(0,V.useMemo)(()=>z(c??[],r,n),[c,n,r]),d=(0,V.useMemo)(()=>B(c??[],u),[c,u]);return{models:a,defaultModel:s,defaultThinkingLevel:X(e.data?.thinkingLevel)||`medium`,projects:u,defaultCwd:d,goalsAvailable:i.goals!==!1,teamAvailable:i.goals!==!1&&i.multiAgent!==!1,loading:e.isPending,error:e.error??null}}var Q=i(),ge=(0,V.lazy)(()=>t(()=>import(`./public-folder-dialog-ywXpPZXJ.js`).then(e=>({default:e.MachineFolderDialog})),__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]))),$=`\0no-project`;function _e(e){return e===`full-access`||L.includes(e)}function ve(e){return e===`plan`||e===`goal`||e===`team`}function ye({onError:e}){let{t,language:r}=a(),i=n(),o=Z(),s=te(),[c,l]=(0,V.useState)(null),u=se(),[d,g]=(0,V.useState)(!1),_=(0,V.useRef)(null),D=ce({onProjectChosen:()=>void 0,onError:e}),O=f(e=>e.capabilities.features.workspaceFolders),k=o.models.some(e=>e.key===u.model),A=k?u.model:o.defaultModel,j=o.models.find(e=>e.key===A)?.thinkingLevels??[],M=j.includes(u.thinkingLevel)?u.thinkingLevel:``,N=M||(j.includes(o.defaultThinkingLevel)?o.defaultThinkingLevel:``),P=d?`full-access`:u.executionMode||`approval-required`,F=u.runMode===`team`&&!o.teamAvailable||u.runMode===`goal`&&!o.goalsAvailable?`plan`:u.runMode,I=(0,V.useMemo)(()=>{if(!u.cwd||o.projects.some(e=>e.cwd===u.cwd))return o.projects;let e=u.cwd.replace(/[\\/]+$/,``).split(/[\\/]/).pop()||u.cwd;return[{key:u.cwd,cwd:u.cwd,label:e},...o.projects]},[u.cwd,o.projects]),L=(0,V.useMemo)(()=>le(I),[I]),z=u.projectless,B=!!u.machineId,H=s.machines.find(e=>e.id===u.machineId),{rememberLaunch:U}=u;(0,V.useEffect)(()=>{B&&s.loaded&&!H&&U({machineId:``,machineCwd:``})},[H,B,s.loaded,U]);let W=B||z?``:u.cwd||o.defaultCwd||I[0]?.cwd||``,G=B||z?void 0:I.find(e=>e.cwd===W),K=`${H?.name??``}:${R(u.machineCwd,r)}`,q=B?K:G?.label||t(z?`board:launch.noProject`:`board:launch.defaultProject`),J=t(`board:launch.projectLabel`,{project:G?L.get(G.key)?`${G.label} (${L.get(G.key)})`:G.label:q});return{cwd:W,model:A,thinkingLevel:N,availableThinkingLevels:j,executionMode:P,runMode:F,onModelChange:e=>u.rememberLaunch({model:e,thinkingLevel:``}),onThinkingLevelChange:e=>u.rememberLaunch({thinkingLevel:e}),onExecutionModeChange:e=>_e(e)?(g(e===`full-access`),e!==`full-access`&&u.rememberLaunch({executionMode:e}),!0):!1,onRunModeChange:e=>ve(e)?(u.rememberLaunch({runMode:e}),!0):!1,renderProjectControl:e=>(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(ae,{children:[(0,Q.jsx)(re,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:e===`header`?`relative inline-flex h-6 max-w-full min-w-0 cursor-pointer items-center gap-1 rounded-full px-2 text-xs leading-4 text-content-muted outline-none after:absolute after:-inset-x-1 after:-inset-y-2.5 after:content-[""] focus-visible:outline-2 focus-visible:outline-focus active:bg-surface-hover aria-expanded:bg-surface-hover`:E(p,`max-w-[24ch] max-[650px]:max-w-[14ch]`),title:B?`${H?.name??``}:${u.machineCwd}`:G?.cwd||void 0,"aria-label":J,"data-new-task-project":B?`machine:${u.machineId}`:z?`none`:W||`default`,children:[B?(0,Q.jsx)(x,{size:e===`header`?12:14,className:`shrink-0`,"aria-hidden":`true`}):(0,Q.jsx)(v,{size:e===`header`?12:14,className:`shrink-0`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:E(`min-w-0 truncate`,(G?.label||B)&&`font-mono`),children:q}),(0,Q.jsx)(ee,{size:e===`header`?12:14,className:E(`shrink-0 opacity-70`,e===`chip`&&`max-[650px]:hidden`),"aria-hidden":`true`})]})}),(0,Q.jsxs)(ie,{align:e===`header`?`center`:`start`,side:e===`header`?`bottom`:`top`,className:`max-h-[min(24rem,var(--radix-dropdown-menu-content-available-height))] w-64 overflow-y-auto`,onCloseAutoFocus:e=>{let t=_.current;t&&(_.current=null,e.preventDefault(),t())},children:[(0,Q.jsxs)(ne,{value:B?``:z?$:W,onValueChange:e=>u.rememberLaunch(e===$?{projectless:!0}:{cwd:e}),children:[(0,Q.jsx)(T,{value:$,children:(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:t(`board:launch.noProject`)})}),(0,Q.jsx)(C,{}),(0,Q.jsx)(S,{children:t(`board:launch.projects`)}),I.length===0&&(0,Q.jsx)(T,{value:``,children:t(`board:launch.defaultProject`)}),I.map(e=>(0,Q.jsxs)(T,{value:e.cwd,title:e.cwd,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:e.label}),L.get(e.key)&&(0,Q.jsx)(`span`,{className:`ml-auto min-w-0 truncate pl-2 font-mono text-xs text-content-muted`,children:L.get(e.key)})]},e.key))]}),(0,Q.jsx)(C,{}),(0,Q.jsxs)(w,{disabled:D.picking,"data-launch-new-project":!0,onSelect:()=>_.current=()=>void D.newProject(),children:[(0,Q.jsx)(m,{"aria-hidden":`true`}),t(`board:launch.chooseFolder`)]}),O&&(0,Q.jsxs)(w,{"data-launch-new-folder":!0,onSelect:()=>_.current=()=>D.newFolder(W||o.defaultCwd),children:[(0,Q.jsx)(h,{"aria-hidden":`true`}),t(`board:launch.newFolder`)]}),s.available&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(C,{}),(0,Q.jsx)(S,{children:t(`board:launch.machines`)}),s.machines.map(e=>(0,Q.jsxs)(w,{"data-launch-machine":e.id,onSelect:()=>_.current=()=>l(e),children:[e.kind===`ssh`?(0,Q.jsx)(x,{"aria-hidden":`true`}):(0,Q.jsx)(y,{"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:e.name}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:E(`ml-auto size-2 flex-none rounded-full`,e.online?`bg-success`:`bg-content-faint`)})]},e.id)),(0,Q.jsxs)(w,{"data-launch-add-machine":!0,onSelect:()=>i(`/config/remote-access`),children:[(0,Q.jsx)(b,{"aria-hidden":`true`}),t(`board:launch.addMachine`)]})]})]})]}),(0,Q.jsx)(oe,{picker:D.picker,folderDialog:D.folderDialog}),c&&(0,Q.jsx)(V.Suspense,{fallback:null,children:(0,Q.jsx)(ge,{machine:c,initialCwd:c?.id===u.machineId?u.machineCwd:c?.defaultCwd??``,onOpenChange:e=>{e||l(null)},onChosen:(e,t)=>{U({machineId:e.id,machineCwd:t}),l(null)}})})]}),prepare:e=>fe({prompt:e,cwd:W,projectless:z,machine:B?{id:u.machineId,cwd:u.machineCwd}:null,model:k?A:``,thinkingLevel:M,executionMode:P,runMode:F}),onSent:()=>{g(!1)}}}export{me as n,ye as t};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/public-folder-dialog-DgKjmujY.js","assets/rolldown-runtime-B0Z9INg1.js","assets/vendor-react-DwNgTV1j.js","assets/use-i18n-CrMP8KP1.js","assets/i18n-D1oE4DVX.js","assets/vendor-router-CSN_DGvx.js","assets/index-Cd49jlmz.js","assets/index-BTqJTVNA.css","assets/storage-DtvZ_lEu.js","assets/vendor-state-GkUciC5H.js","assets/server-BgNvmqwJ.js","assets/createLucideIcon-Cd-3GVxJ.js","assets/triangle-alert-CE1q54ci.js","assets/button-CCcCN8tE.js","assets/vendor-ui-DvrYggeS.js","assets/dist-41X0pdUs.js","assets/utils-C8uzG5AZ.js","assets/dialog-CEcIiRdx.js","assets/x-07u4-129.js","assets/dist-BHkR6BLP.js","assets/dist-BsRXXcSL.js","assets/es2015-DTZdOI9P.js","assets/input-CPw-zkYh.js","assets/machines-api-Be-AjTEL.js","assets/http-response-BMpatf4O.js","assets/http-Ck9ziPLg.js","assets/abort-signal-f4JsiYKX.js","assets/alert-DRIrgNI4.js","assets/field-DoLEb0np.js","assets/label-CVWjEcfV.js","assets/separator-BPh_qxvc.js","assets/machine-messages-D5urBDZn.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{h as t,u as n}from"./vendor-router-CSN_DGvx.js";import{i as r,r as i}from"./vendor-react-DwNgTV1j.js";import{t as a}from"./use-i18n-CrMP8KP1.js";import{t as o}from"./useQuery-DfOU-27z.js";import{a as s,i as c,o as l}from"./startup-queries-DG8R4Ryc.js";import{i as u}from"./http-response-BMpatf4O.js";import{n as d}from"./http-Ck9ziPLg.js";import{t as f}from"./runtime-capabilities-store-DcLHj_-T.js";import{t as ee}from"./chevron-down-CxtxIjiP.js";import{t as p}from"./focus-session-composer-bits-DWovCteo.js";import{t as m}from"./folder-open-FIShC5Qk.js";import{i as h,n as g,t as _}from"./workspace-order-store-Du6GVhMP.js";import{t as v}from"./folder-DPM8D8cf.js";import{n as y,t as te}from"./useMachines-BnEhFLR-.js";import{t as b}from"./plus-fQbSqB1n.js";import{t as x}from"./server-BgNvmqwJ.js";import{a as S,c as C,i as w,o as ne,p as re,r as ie,s as T,t as ae}from"./dropdown-menu-Ds0gD8S8.js";import{t as E}from"./utils-C8uzG5AZ.js";import{u as D}from"./events-fUNyYQhT.js";import{t as O}from"./chat-api-PdHMtAmc.js";import{_ as k,d as A,l as j,t as M,u as N,v as P,x as F,y as I}from"./useSessionListQuery-Bfjp1ecc.js";import"./useNow-D9FGGV1H.js";import{a as oe,i as se,n as L,t as ce}from"./useNewProjectPicker-CsJnnQt_.js";import{a as le}from"./card-presentation-1oph2b8P.js";import"./useSidebarModel-0OeDSimB.js";import{o as R}from"./format-DMJQzoZ7.js";import{r as z,t as B}from"./board-projects-C3_RLAYt.js";var V=e(r(),1),H=class extends Error{stage;cause;sessionId;code=`board_launch_failed`;constructor(e,t,n=``){super(t instanceof Error?t.message:String(t||`launch failed`)),this.stage=e,this.cause=t,this.sessionId=n}},U=1e5,W=5e3;function G(e){if(!e||typeof e!=`object`)return!1;let t=e;return Array.isArray(t.messages)&&t.messages.length===0&&t.streaming===!1&&t.configurationBusy!==!0&&(t.queuedInputs===void 0||Array.isArray(t.queuedInputs)&&t.queuedInputs.length===0)}function K(e){return e instanceof u?`${e.kind||`error`}:${e.status??`-`}`:`error`}async function q(e){let t=`/api/sessions/${encodeURIComponent(e)}`;try{if(!G(await O.getLiveSession(e,{timeout:W})))return!1;await d(t,{method:`DELETE`,timeout:W})}catch(e){return console.warn(`[board] 派发失败后未能清理空会话(${K(e)})`),!1}return s.setQueryData(j,t=>t&&{...t,sessions:t.sessions.filter(t=>t.id!==e)}),D({deletedIds:[e]}),!0}function J(e){s.setQueryData(j,t=>t&&!t.sessions.some(t=>t.id===e.id)?{...t,sessions:[e,...t.sessions]}:t),c(`sessions`)}function ue(e){let t=e.indexOf(`/`);return t>0?{provider:e.slice(0,t),modelId:e.slice(t+1)}:null}async function de(e,t,n){let r=ue(n.model);r&&n.model!==t.model&&await O.updateModel(e,r.provider,r.modelId),n.thinkingLevel&&n.thinkingLevel!==t.thinkingLevel&&await O.setThinkingLevel(e,n.thinkingLevel),n.executionMode&&n.executionMode!==t.executionMode&&await O.updateExecutionMode(e,n.executionMode),n.runMode!==`plan`&&n.runMode!==t.runMode&&await O.updateRunMode(e,n.runMode)}async function fe(e){if(!e.prompt.trim().slice(0,U))throw new H(`create`,Error(`empty prompt`));let t;try{t=await O.createSession(``,e.cwd,{projectless:e.projectless===!0,machine:e.machine??null})}catch(e){throw new H(`create`,e)}let n=t.id;try{await de(n,t,e)}catch(e){throw await q(n),new H(`configure`,e,n)}return{session:t}}var pe=/^\/[a-z][a-z0-9:-]{0,63}$/;async function me(e){let{sessionId:t}=e,n=e.prompt.trim().slice(0,U);if(!t||!n)throw new H(`send`,Error(`empty prompt`),t);let r=e.commandWhenEmpty?.trim()??``;if(r&&!pe.test(r))throw new H(`send`,Error(`invalid command`),t);let i;try{i=await O.getLiveSession(t)}catch(e){throw new H(`send`,e,t)}let a=i&&typeof i==`object`?i:{},o=Array.isArray(a.messages)&&a.messages.length===0&&r?`${r} ${n}`:n,l=async()=>{try{await O.queueInput(t,o,[],`followUp`)}catch(e){throw new H(`send`,e,t)}return{sessionId:t,queued:!0}};if(a.streaming===!0)return l();e.created?.id===t?J({...e.created,firstMessage:n,messageCount:1}):s.getQueryData(j)?.sessions.some(e=>e.id===t)||c(`sessions`);let u=A(t,{streaming:!0});try{await F(t,`launch`,(e,n)=>O.openStream({sessionId:t,message:o,attachments:[],goalMode:!1,teamMode:!1},e,{signal:n}))}catch(e){if(k(t,u),e instanceof N)return l();throw I().catch(()=>void 0),new H(`send`,e,t)}return P(t,e=>!!e).catch(()=>void 0).finally(()=>k(t,u)),{sessionId:t,queued:!1}}function Y(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function X(e){return typeof e==`string`?e:``}function he(e){return(Array.isArray(Y(e).providers)?Y(e).providers:[]).flatMap(e=>{let t=Y(e),n=X(t.id);return!n||t.configured!==!0||t.enabled===!1?[]:(Array.isArray(t.models)?t.models:[]).flatMap(e=>{let r=Y(e),i=X(r.id);return!i||r.kind!==`chat`?[]:[{key:`${n}/${i}`,label:X(r.name)||i,providerName:X(t.name)||n,thinkingLevels:Array.isArray(r.thinkingLevels)?r.thinkingLevels.filter(e=>typeof e==`string`):[]}]})})}function Z(){let e=o(l(`config`)),t=M(),n=_(e=>e.names),r=g(e=>e.projects),i=f(e=>e.capabilities.features),a=(0,V.useMemo)(()=>he(e.data),[e.data]),s=e.data?.provider&&e.data?.model?`${e.data.provider}/${e.data.model}`:``,c=t.data?.sessions,u=(0,V.useMemo)(()=>z(c??[],r,n),[c,n,r]),d=(0,V.useMemo)(()=>B(c??[],u),[c,u]);return{models:a,defaultModel:s,defaultThinkingLevel:X(e.data?.thinkingLevel)||`medium`,projects:u,defaultCwd:d,goalsAvailable:i.goals!==!1,teamAvailable:i.goals!==!1&&i.multiAgent!==!1,loading:e.isPending,error:e.error??null}}var Q=i(),ge=(0,V.lazy)(()=>t(()=>import(`./public-folder-dialog-DgKjmujY.js`).then(e=>({default:e.MachineFolderDialog})),__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]))),$=`\0no-project`;function _e(e){return e===`full-access`||L.includes(e)}function ve(e){return e===`plan`||e===`goal`||e===`team`}function ye({onError:e}){let{t,language:r}=a(),i=n(),o=Z(),s=te(),[c,l]=(0,V.useState)(null),u=se(),[d,g]=(0,V.useState)(!1),_=(0,V.useRef)(null),D=ce({onProjectChosen:()=>void 0,onError:e}),O=f(e=>e.capabilities.features.workspaceFolders),k=o.models.some(e=>e.key===u.model),A=k?u.model:o.defaultModel,j=o.models.find(e=>e.key===A)?.thinkingLevels??[],M=j.includes(u.thinkingLevel)?u.thinkingLevel:``,N=M||(j.includes(o.defaultThinkingLevel)?o.defaultThinkingLevel:``),P=d?`full-access`:u.executionMode||`approval-required`,F=u.runMode===`team`&&!o.teamAvailable||u.runMode===`goal`&&!o.goalsAvailable?`plan`:u.runMode,I=(0,V.useMemo)(()=>{if(!u.cwd||o.projects.some(e=>e.cwd===u.cwd))return o.projects;let e=u.cwd.replace(/[\\/]+$/,``).split(/[\\/]/).pop()||u.cwd;return[{key:u.cwd,cwd:u.cwd,label:e},...o.projects]},[u.cwd,o.projects]),L=(0,V.useMemo)(()=>le(I),[I]),z=u.projectless,B=!!u.machineId,H=s.machines.find(e=>e.id===u.machineId),{rememberLaunch:U}=u;(0,V.useEffect)(()=>{B&&s.loaded&&!H&&U({machineId:``,machineCwd:``})},[H,B,s.loaded,U]);let W=B||z?``:u.cwd||o.defaultCwd||I[0]?.cwd||``,G=B||z?void 0:I.find(e=>e.cwd===W),K=`${H?.name??``}:${R(u.machineCwd,r)}`,q=B?K:G?.label||t(z?`board:launch.noProject`:`board:launch.defaultProject`),J=t(`board:launch.projectLabel`,{project:G?L.get(G.key)?`${G.label} (${L.get(G.key)})`:G.label:q});return{cwd:W,model:A,thinkingLevel:N,availableThinkingLevels:j,executionMode:P,runMode:F,onModelChange:e=>u.rememberLaunch({model:e,thinkingLevel:``}),onThinkingLevelChange:e=>u.rememberLaunch({thinkingLevel:e}),onExecutionModeChange:e=>_e(e)?(g(e===`full-access`),e!==`full-access`&&u.rememberLaunch({executionMode:e}),!0):!1,onRunModeChange:e=>ve(e)?(u.rememberLaunch({runMode:e}),!0):!1,renderProjectControl:e=>(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(ae,{children:[(0,Q.jsx)(re,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:e===`header`?`relative inline-flex h-6 max-w-full min-w-0 cursor-pointer items-center gap-1 rounded-full px-2 text-xs leading-4 text-content-muted outline-none after:absolute after:-inset-x-1 after:-inset-y-2.5 after:content-[""] focus-visible:outline-2 focus-visible:outline-focus active:bg-surface-hover aria-expanded:bg-surface-hover`:E(p,`max-w-[24ch] max-[650px]:max-w-[14ch]`),title:B?`${H?.name??``}:${u.machineCwd}`:G?.cwd||void 0,"aria-label":J,"data-new-task-project":B?`machine:${u.machineId}`:z?`none`:W||`default`,children:[B?(0,Q.jsx)(x,{size:e===`header`?12:14,className:`shrink-0`,"aria-hidden":`true`}):(0,Q.jsx)(v,{size:e===`header`?12:14,className:`shrink-0`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:E(`min-w-0 truncate`,(G?.label||B)&&`font-mono`),children:q}),(0,Q.jsx)(ee,{size:e===`header`?12:14,className:E(`shrink-0 opacity-70`,e===`chip`&&`max-[650px]:hidden`),"aria-hidden":`true`})]})}),(0,Q.jsxs)(ie,{align:e===`header`?`center`:`start`,side:e===`header`?`bottom`:`top`,className:`max-h-[min(24rem,var(--radix-dropdown-menu-content-available-height))] w-64 overflow-y-auto`,onCloseAutoFocus:e=>{let t=_.current;t&&(_.current=null,e.preventDefault(),t())},children:[(0,Q.jsxs)(ne,{value:B?``:z?$:W,onValueChange:e=>u.rememberLaunch(e===$?{projectless:!0}:{cwd:e}),children:[(0,Q.jsx)(T,{value:$,children:(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:t(`board:launch.noProject`)})}),(0,Q.jsx)(C,{}),(0,Q.jsx)(S,{children:t(`board:launch.projects`)}),I.length===0&&(0,Q.jsx)(T,{value:``,children:t(`board:launch.defaultProject`)}),I.map(e=>(0,Q.jsxs)(T,{value:e.cwd,title:e.cwd,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:e.label}),L.get(e.key)&&(0,Q.jsx)(`span`,{className:`ml-auto min-w-0 truncate pl-2 font-mono text-xs text-content-muted`,children:L.get(e.key)})]},e.key))]}),(0,Q.jsx)(C,{}),(0,Q.jsxs)(w,{disabled:D.picking,"data-launch-new-project":!0,onSelect:()=>_.current=()=>void D.newProject(),children:[(0,Q.jsx)(m,{"aria-hidden":`true`}),t(`board:launch.chooseFolder`)]}),O&&(0,Q.jsxs)(w,{"data-launch-new-folder":!0,onSelect:()=>_.current=()=>D.newFolder(W||o.defaultCwd),children:[(0,Q.jsx)(h,{"aria-hidden":`true`}),t(`board:launch.newFolder`)]}),s.available&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(C,{}),(0,Q.jsx)(S,{children:t(`board:launch.machines`)}),s.machines.map(e=>(0,Q.jsxs)(w,{"data-launch-machine":e.id,onSelect:()=>_.current=()=>l(e),children:[e.kind===`ssh`?(0,Q.jsx)(x,{"aria-hidden":`true`}):(0,Q.jsx)(y,{"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:e.name}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:E(`ml-auto size-2 flex-none rounded-full`,e.online?`bg-success`:`bg-content-faint`)})]},e.id)),(0,Q.jsxs)(w,{"data-launch-add-machine":!0,onSelect:()=>i(`/config/remote-access`),children:[(0,Q.jsx)(b,{"aria-hidden":`true`}),t(`board:launch.addMachine`)]})]})]})]}),(0,Q.jsx)(oe,{picker:D.picker,folderDialog:D.folderDialog}),c&&(0,Q.jsx)(V.Suspense,{fallback:null,children:(0,Q.jsx)(ge,{machine:c,initialCwd:c?.id===u.machineId?u.machineCwd:c?.defaultCwd??``,onOpenChange:e=>{e||l(null)},onChosen:(e,t)=>{U({machineId:e.id,machineCwd:t}),l(null)}})})]}),prepare:e=>fe({prompt:e,cwd:W,projectless:z,machine:B?{id:u.machineId,cwd:u.machineCwd}:null,model:k?A:``,thinkingLevel:M,executionMode:P,runMode:F}),onSent:()=>{g(!1)}}}export{me as n,ye as t};
|