@seira-bot/seira 0.1.180 → 0.1.181
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/dist/assets/{ActivityPanel-DpipGqnm.js → ActivityPanel-tZLxRHYi.js} +1 -1
- package/dist/assets/{AnnouncementsPage-GCXia4xK.js → AnnouncementsPage-BrGYAaS0.js} +1 -1
- package/dist/assets/{App-BIllYA_e.js → App-h8WTNY4l.js} +136 -136
- package/dist/assets/{AppEventEditor-DYdUkpiM.js → AppEventEditor-CLpZ2lyb.js} +1 -1
- package/dist/assets/{BotSettingsDialog-DxRMUwAP.js → BotSettingsDialog-COjDhP9V.js} +1 -1
- package/dist/assets/{BrowserPanel-Cu_GqDA1.js → BrowserPanel-D_kPeSZ3.js} +1 -1
- package/dist/assets/{BrowserProfilesManager-CL3TIl73.js → BrowserProfilesManager-haN8RgPf.js} +1 -1
- package/dist/assets/{CloudAddDialog-DUk6i4df.js → CloudAddDialog-vwGwJIYN.js} +1 -1
- package/dist/assets/{ComputerFilesPane-HvpeAXhL.js → ComputerFilesPane-DJu1k1Ap.js} +1 -1
- package/dist/assets/{ComputerPanel-CozzFQeF.js → ComputerPanel-D9bTedHq.js} +2 -2
- package/dist/assets/{DataPanel-DGqcWB1O.js → DataPanel-CsuS_ybT.js} +1 -1
- package/dist/assets/{DesktopViewer-BoBSIDfB.js → DesktopViewer-YvIV04Lf.js} +1 -1
- package/dist/assets/{EnginesSettings-D643-yZk.js → EnginesSettings-C27xDaBN.js} +1 -1
- package/dist/assets/{FilesView-b5DFlMDt.js → FilesView-Dsxj73nW.js} +1 -1
- package/dist/assets/{GrokMoveDialog-gGTLfrGg.js → GrokMoveDialog-DEgRQW9G.js} +1 -1
- package/dist/assets/{ImportDialog-Bu5X6qOF.js → ImportDialog-DLVTgN-h.js} +1 -1
- package/dist/assets/{InspectorPanel-DU7_iwQR.js → InspectorPanel-gvFj5wfe.js} +1 -1
- package/dist/assets/{KeyboardShortcutsModal-Wxnn1d66.js → KeyboardShortcutsModal-aF0vhD29.js} +1 -1
- package/dist/assets/{LiveDesktop-D9PC-iAT.js → LiveDesktop-Bca91cEb.js} +1 -1
- package/dist/assets/{LocalVmWorkspace-0YxB-I-X.js → LocalVmWorkspace-CVLDY3ws.js} +1 -1
- package/dist/assets/{MacLocalControl-DoEGcs3V.js → MacLocalControl-BeNWQ9oY.js} +1 -1
- package/dist/assets/{MarkdownFilePreview-CAlARwd0.js → MarkdownFilePreview-CYw3CQ3T.js} +1 -1
- package/dist/assets/{MenuMotion-DfjnHTCi.js → MenuMotion-CHp-hB40.js} +1 -1
- package/dist/assets/{NewBotDialog-D3i7j_KP.js → NewBotDialog-BxeQktoI.js} +1 -1
- package/dist/assets/{PhoneAppDialog-OeXLO0Wb.js → PhoneAppDialog-CIlw_m5U.js} +1 -1
- package/dist/assets/{PlacesRail-3RaNlpug.js → PlacesRail-Df-jNTHn.js} +1 -1
- package/dist/assets/PluginsPanel-CMqZcDkC.js +8 -0
- package/dist/assets/{ProIntroduction-B3phUWnc.js → ProIntroduction-D8hWm9R5.js} +1 -1
- package/dist/assets/{PublishedAppsPage-BXWDYkhG.js → PublishedAppsPage-BMn3C64O.js} +1 -1
- package/dist/assets/{RemoteAgentSettingsPanel-vgrEf5B7.js → RemoteAgentSettingsPanel-B7QJizjx.js} +1 -1
- package/dist/assets/{RoomPanel-BmXypXPv.js → RoomPanel-CyWZ4kkq.js} +1 -1
- package/dist/assets/RoutinesPage-B9kKyfFp.js +2 -0
- package/dist/assets/{ServerPairingCard-c2fKq1gh.js → ServerPairingCard-D21dP5Bc.js} +1 -1
- package/dist/assets/SettingsModal-afRPXeYI.js +2 -0
- package/dist/assets/{ShareDepartmentDialog-CJITsmAd.js → ShareDepartmentDialog-CwErWDth.js} +1 -1
- package/dist/assets/{SignedInSites-B2pCMdic.js → SignedInSites-CFyvOLSc.js} +1 -1
- package/dist/assets/{TeamFilesPage-B10cdbwa.js → TeamFilesPage-BvhXs2O5.js} +1 -1
- package/dist/assets/{TeamLibraryPanel-CRmTfBOI.js → TeamLibraryPanel-Dm8wjNB4.js} +1 -1
- package/dist/assets/{TeamMapPage-BoTNppEy.js → TeamMapPage-jCSzFPvB.js} +1 -1
- package/dist/assets/{ToolPageShell-BPd_nyJ8.js → ToolPageShell-DKZUregg.js} +1 -1
- package/dist/assets/{TriggersPage-DDxtJMT4.js → TriggersPage-wSB6z1cp.js} +1 -1
- package/dist/assets/{VisibilitySection-Cd3TZvS_.js → VisibilitySection-CFr6fOzq.js} +1 -1
- package/dist/assets/{WebhookTrigger-AJduidiC.js → WebhookTrigger-BJN-V-bx.js} +1 -1
- package/dist/assets/{WorksOnGrid-DHo10o0j.js → WorksOnGrid-B3wYro9M.js} +1 -1
- package/dist/assets/{abnfDiagram-YUKMZFIV-DnIZyeSK.js → abnfDiagram-YUKMZFIV-DRhWKTiz.js} +1 -1
- package/dist/assets/{activity-DrX2_Hm9.js → activity-l0oTqbd6.js} +1 -1
- package/dist/assets/{architectureDiagram-47P4ROYG-DHdulT2e.js → architectureDiagram-47P4ROYG-C_qnTvJF.js} +1 -1
- package/dist/assets/{blockDiagram-E7TT5TSB-BGReDH4k.js → blockDiagram-E7TT5TSB-DzLSloVY.js} +1 -1
- package/dist/assets/{c4Diagram-CRA5TL53-BV9zDZsL.js → c4Diagram-CRA5TL53-BzVViHCA.js} +1 -1
- package/dist/assets/{calendar-days-Ddhxf1PV.js → calendar-days-DFd3GKf_.js} +1 -1
- package/dist/assets/channel-B2D6cAE5.js +1 -0
- package/dist/assets/{chunk-2Q5K7J3B-DAj16syq.js → chunk-2Q5K7J3B-hR-bQJHo.js} +1 -1
- package/dist/assets/{chunk-5VM5RSS4-CMyoXW_3.js → chunk-5VM5RSS4-BWmBW1XC.js} +1 -1
- package/dist/assets/{chunk-7TKQ45FW--z54G8Jv.js → chunk-7TKQ45FW-DuUk7RXl.js} +1 -1
- package/dist/assets/{chunk-AW2ZBBNX-CPPbUHIj.js → chunk-AW2ZBBNX-Madgl1uv.js} +1 -1
- package/dist/assets/{chunk-FVRAUYC3-pKEz9wbK.js → chunk-FVRAUYC3-WSgsvIGA.js} +2 -2
- package/dist/assets/{chunk-HTAEGDNF-DIOqwx2X.js → chunk-HTAEGDNF-CfoPR2yG.js} +1 -1
- package/dist/assets/{chunk-JWPE2WC7-BW474-Li.js → chunk-JWPE2WC7-tLRHdBom.js} +1 -1
- package/dist/assets/{chunk-KQW6MTUR-DjAEB-Df.js → chunk-KQW6MTUR-BqwuNuVY.js} +1 -1
- package/dist/assets/{chunk-XXDRQBXY-CMZz2xNV.js → chunk-XXDRQBXY-BOeb8xE4.js} +1 -1
- package/dist/assets/{classDiagram-v2-K4WV4PDN-7GYDWs2n.js → classDiagram-v2-K4WV4PDN-CFeH5trZ.js} +1 -1
- package/dist/assets/{core-Dq4LUz6X.js → core-CnInZb-o.js} +1 -1
- package/dist/assets/{cose-bilkent-JH36ORCC-Dy2zOVu3.js → cose-bilkent-JH36ORCC-BEg68hhI.js} +1 -1
- package/dist/assets/{cynefin-EF2NZ3EQ-C7I3qmqf.js → cynefin-EF2NZ3EQ-B_Xq3hQ3.js} +1 -1
- package/dist/assets/{cynefinDiagram-3GCD6N5R-CsPcUXHD.js → cynefinDiagram-3GCD6N5R-DN1o2ihW.js} +1 -1
- package/dist/assets/{dagre-W4DXFKR2-DxvGlifm.js → dagre-W4DXFKR2-BFf83-nP.js} +1 -1
- package/dist/assets/{de-CrlnmnfQ.js → de-BpsYkrLY.js} +1 -1
- package/dist/assets/{desktop-connection-Df-k5QBM.js → desktop-connection-CU6jsy2e.js} +1 -1
- package/dist/assets/{diagram-2UJZ2QOL-Qz2-e2_u.js → diagram-2UJZ2QOL-_qwbS5JH.js} +1 -1
- package/dist/assets/{diagram-OVF4WLC6-D1u4ioUX.js → diagram-OVF4WLC6-9sq9EfiF.js} +1 -1
- package/dist/assets/{diagram-PFPMY2P6-DZiCtcMI.js → diagram-PFPMY2P6-Ow1v5ZhK.js} +1 -1
- package/dist/assets/{diagram-UMYRVEAY-DmVn9h1H.js → diagram-UMYRVEAY-DDTBFPls.js} +1 -1
- package/dist/assets/{diagram-YEKJPTXX-CJK2ajcB.js → diagram-YEKJPTXX-D1zZ8KqI.js} +1 -1
- package/dist/assets/{diagram-ZIFT7M5P-NoYT_JX9.js → diagram-ZIFT7M5P-C_vZWUw8.js} +1 -1
- package/dist/assets/{ebnfDiagram-VR2GEFS7-BooF3Pem.js → ebnfDiagram-VR2GEFS7-D_1GvBDx.js} +1 -1
- package/dist/assets/{elk-IJKZMXRS-4Ai0igvq.js → elk-IJKZMXRS-CV-PzspH.js} +1 -1
- package/dist/assets/{erDiagram-O2IAPWRE-CdhhzqVX.js → erDiagram-O2IAPWRE-CnKVd0av.js} +1 -1
- package/dist/assets/{es-BIPy8tP9.js → es-COLCGADa.js} +1 -1
- package/dist/assets/{file-up-Bs5NWcjw.js → file-up-Bjx5Vcmk.js} +1 -1
- package/dist/assets/{flowDiagram-OXPTDLAJ-SeyZJAiT.js → flowDiagram-OXPTDLAJ-CGJh171P.js} +1 -1
- package/dist/assets/{fr-CCbXz1Dc.js → fr-CJ1x1iRl.js} +1 -1
- package/dist/assets/{ganttDiagram-R7TSEDQI-rmA_SJlC.js → ganttDiagram-R7TSEDQI-CygoACFs.js} +1 -1
- package/dist/assets/{gitGraphDiagram-XJZIOB7I-Coc2oeHo.js → gitGraphDiagram-XJZIOB7I-ByxErzHV.js} +1 -1
- package/dist/assets/{hi-DmCL9a_Y.js → hi-BC0iO7jD.js} +1 -1
- package/dist/assets/{index-uiyAwyX1.js → index-BRfvYRb5.js} +1 -1
- package/dist/assets/{index-D69O3YiA.js → index-DQZxP2c4.js} +2 -2
- package/dist/assets/{index-C1PEx1tc.js → index-DtDQrExn.js} +3 -3
- package/dist/assets/{infoDiagram-5W2HQ5XZ-DScYPtht.js → infoDiagram-5W2HQ5XZ-BlzjfTwq.js} +1 -1
- package/dist/assets/{ishikawaDiagram-K3B6WC7H-Cf7mJB_l.js → ishikawaDiagram-K3B6WC7H-2rf_4lR_.js} +1 -1
- package/dist/assets/{it-BWkdcVfm.js → it-BIwsqdpz.js} +2 -2
- package/dist/assets/{ja-BaOL6cSA.js → ja-BJYXkO5E.js} +2 -2
- package/dist/assets/{journeyDiagram-COXZFDF6-Dtmolw3A.js → journeyDiagram-COXZFDF6-mGgPoETt.js} +1 -1
- package/dist/assets/{kanban-definition-P3RFRI5V-CSL1-s5L.js → kanban-definition-P3RFRI5V-j2hU8Bw4.js} +1 -1
- package/dist/assets/{kit-Cjq8TV0N.js → kit-qjammJR4.js} +1 -1
- package/dist/assets/{ko-ebMBLBXv.js → ko-7QtaPFvf.js} +2 -2
- package/dist/assets/{livekit-KT4NEVZO-B3DA1PsD.js → livekit-KT4NEVZO-DbFoU2r9.js} +1 -1
- package/dist/assets/{mcp-servers-DoMFsds6.js → mcp-servers-Tb2cnkiM.js} +1 -1
- package/dist/assets/{memory-BR-ujoQY.js → memory-BNaMRI5v.js} +1 -1
- package/dist/assets/{mermaid.core-BK1qxlD4.js → mermaid.core-B1mlFiOp.js} +4 -4
- package/dist/assets/{mindmap-definition-LZFPQGKD-Cb7ESZ0y.js → mindmap-definition-LZFPQGKD-C7XLkIzZ.js} +1 -1
- package/dist/assets/{minimize-msM7mbil.js → minimize-Dga3UCb8.js} +1 -1
- package/dist/assets/{monitor-DpsqT1_R.js → monitor-DMPjQDZP.js} +1 -1
- package/dist/assets/{org-library-alRyzCTE.js → org-library-IKFXm7D6.js} +1 -1
- package/dist/assets/{package-format-BFXbXHk8.js → package-format-COujx3jP.js} +1 -1
- package/dist/assets/{pegDiagram-BGZESJAR-CqmJQKhe.js → pegDiagram-BGZESJAR-BS2zKH6g.js} +1 -1
- package/dist/assets/{phones-J7mYR-fY.js → phones-CINpTjZv.js} +1 -1
- package/dist/assets/{pieDiagram-CAPJLFHJ-w_QuumOv.js → pieDiagram-CAPJLFHJ-DVAuLXem.js} +1 -1
- package/dist/assets/{pl-CSbinyb5.js → pl-CLa2ta1_.js} +2 -2
- package/dist/assets/{pt-br-BkWykL5e.js → pt-br-8RQzCbpg.js} +3 -3
- package/dist/assets/{quadrantDiagram-GDMTTRAM-248q9C3h.js → quadrantDiagram-GDMTTRAM-H7QRxmHt.js} +1 -1
- package/dist/assets/{rail-DRr_33Fe.js → rail-DNpLzOxa.js} +1 -1
- package/dist/assets/{railroadDiagram-SM67HX2B-BLzQ_5t7.js → railroadDiagram-SM67HX2B-dq6Rokc9.js} +1 -1
- package/dist/assets/{remote-desktop-panel-BPK6Q0O6.js → remote-desktop-panel-Cxv6Qt3x.js} +1 -1
- package/dist/assets/{requirementDiagram-X7JNWC4A-Bgi1TLdN.js → requirementDiagram-X7JNWC4A-BeWeL_-r.js} +1 -1
- package/dist/assets/{ru-DD01Hb1S.js → ru-CIdzvRVZ.js} +2 -2
- package/dist/assets/{sankeyDiagram-UM26HJRW-CrZgn-Cf.js → sankeyDiagram-UM26HJRW-BmJ-9lt-.js} +1 -1
- package/dist/assets/{sequenceDiagram-ZO4K6R2Y-gAwq1ZfG.js → sequenceDiagram-ZO4K6R2Y-Uuh1hEOh.js} +1 -1
- package/dist/assets/{sizeCapture-INFHLROL-BlXmG_DJ.js → sizeCapture-INFHLROL-mKDf6lys.js} +1 -1
- package/dist/assets/{stateDiagram-v2-TBUQTH76-CEFB1Iaq.js → stateDiagram-v2-TBUQTH76-BaEihzov.js} +1 -1
- package/dist/assets/{styles-DOJOOIp4.js → styles-3g-ZPS7M.js} +5 -5
- package/dist/assets/styles-CsrDURJH.css +1 -0
- package/dist/assets/{swimlanes-N4OXWK64-BtJmWAOz.js → swimlanes-N4OXWK64-CpP-NKGz.js} +1 -1
- package/dist/assets/swimlanesDiagram-K3J5GTZL-C50Dm6LQ.js +8 -0
- package/dist/assets/{template-add-BcTS64TG.js → template-add-CHwGLPet.js} +1 -1
- package/dist/assets/{timeline-definition-YOQAKGHF-BZ270zxf.js → timeline-definition-YOQAKGHF-Ca3rjetv.js} +1 -1
- package/dist/assets/{tr-Bw35A32w.js → tr-BhclavHM.js} +1 -1
- package/dist/assets/{uk-DsPsCgp4.js → uk-Or5wmf6s.js} +1 -1
- package/dist/assets/{usecaseDiagram-VIAY4XPW-D5yZb3KQ.js → usecaseDiagram-VIAY4XPW-BuuYl689.js} +1 -1
- package/dist/assets/{vennDiagram-BLWOH2XV-OFx2qTzp.js → vennDiagram-BLWOH2XV-C__pWnnE.js} +1 -1
- package/dist/assets/{vi-DhPdzwW-.js → vi-CYbGVqh-.js} +1 -1
- package/dist/assets/{wardleyDiagram-YMQ3BMBF-DzSmrVKa.js → wardleyDiagram-YMQ3BMBF-yWcEHD-N.js} +1 -1
- package/dist/assets/{xychartDiagram-TAQBALBS-UP1H1u5V.js → xychartDiagram-TAQBALBS-CvcdOA7A.js} +1 -1
- package/dist/assets/{zh-CzC3CUQA.js → zh-iptM1e_T.js} +2 -2
- package/dist/assets/{zh-tw-DeXHnAvy.js → zh-tw-BaO1c--E.js} +2 -2
- package/dist/index.html +3 -3
- package/dist/rail.html +5 -5
- package/dist-server/container-mcp.js +18 -17
- package/dist-server/index.js +1136 -1114
- package/dist-server/openmausbot.js +182 -180
- package/dist-server/package.json +1 -1
- package/dist-server/pair-cli.js +182 -180
- package/dist-server/server/ai-pool.js +72 -0
- package/dist-server/server/cloud-connected-apps.js +33 -16
- package/dist-server/server/composio-broker-access.js +1 -1
- package/dist-server/server/composio.js +3 -2
- package/dist-server/server/config.js +5 -7
- package/dist-server/server/connector-auth-config-hint.js +5 -0
- package/dist-server/server/drivers/claude.js +14 -11
- package/dist-server/server/flatpak-host.js +5 -2
- package/dist-server/server/host/ai-pool.js +109 -0
- package/dist-server/server/host/app-suggestions.js +2 -1
- package/dist-server/server/host/limit-takeover.js +11 -4
- package/dist-server/server/index.js +33 -26
- package/dist-server/server/limit-failover.js +3 -0
- package/dist-server/server/model-selection-schema.js +9 -0
- package/dist-server/server/routes/ai-pool-patch.js +24 -0
- package/dist-server/server/routes/config.js +8 -1
- package/dist-server/server/routine-dispatch.js +21 -0
- package/dist-server/server/routines.js +4 -18
- package/dist-server/server/tailscale.js +16 -6
- package/dist-server/server/workspace-backup-http.js +2 -2
- package/dist-server/shared/limit-backup.js +1 -1
- package/dist-server/shared/settings-places.js +1 -0
- package/dist-server/shared/toolkit-card.js +1 -0
- package/dist-server/vps-container-mcp.js +18 -17
- package/dist-server/workspace-backup.worker.js +18 -17
- package/package.json +1 -1
- package/dist/assets/PluginsPanel-B5Q70eO8.js +0 -8
- package/dist/assets/RoutinesPage-CLXohizn.js +0 -2
- package/dist/assets/SettingsModal-BlX9XoBu.js +0 -2
- package/dist/assets/channel-DZM5KU--.js +0 -1
- package/dist/assets/styles-9UFSdSaJ.css +0 -1
- package/dist/assets/swimlanesDiagram-K3J5GTZL-pBTtzroP.js +0 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as l,h as ae,k as ce,l as O,m as A,p as ve,r as i,q as he,j as c,X as we,a as Z,u as xe}from"./styles-DOJOOIp4.js";import{u as be,aj as ke,ak as ee,al as ie,g as q,y as ye,ai as te,am as ge}from"./App-BIllYA_e.js";import{u as Ne,L as T}from"./PlacesRail-3RaNlpug.js";import{M as le}from"./monitor-DpsqT1_R.js";import{R as je}from"./MenuMotion-DfjnHTCi.js";import"./index-C1PEx1tc.js";import"./placement-BKtVnQht.js";function Ce(s,e){const u=(n,o)=>n.left<o.right&&n.right>o.left&&n.top<o.bottom&&n.bottom>o.top;return e.some(n=>n.visible&&n.rect.width>0&&n.rect.height>0&&(n.explicit||n.zIndex!==null&&n.zIndex>=10)&&s.some(o=>u(n.rect,o)))}async function Se(s,e,u,n){e&&e!==u&&(await s.setInteractive(null),await s.release(e));const o=await s.take(u);if(!o.held)throw new Error(l("vm.workspace.holdNotAcquired"));if(o.owned!==!0)return{status:"held-elsewhere",botId:u,snapshot:o};try{await s.setInteractive(n)}catch(d){throw await s.setInteractive(null).catch(()=>{}),await s.release(u).catch(()=>{}),d}return{status:"controlled",botId:u,snapshot:o}}async function U(s,e){return e?(await s.setInteractive(null).catch(()=>{}),s.release(e)):null}function ue(s){return s.filter(e=>e.computer==="vm"&&e.hidden!==!0).map(e=>e.id)}function Ee(s,e){const u=ue(s),n=u.includes(e)?e:u[0]??null;return[n,u.find(o=>o!==n)??null]}function Re(s,e,u){const n=[...s],o=e===0?1:0;return u&&n[o]===u&&(n[o]=n[e]),n[e]=u,n}function Le(s,e){const u=ue(e),n=new Set(u),o=[null,null];for(const d of[0,1]){const p=s[d];p&&n.delete(p)&&(o[d]=p)}for(const d of[0,1]){if(o[d])continue;const p=[...n][0];p&&(o[d]=p,n.delete(p))}return o}const ze=ae({mode:A(["shared","per-bot","pool"]).optional(),max_instances:ve().int().positive().optional(),container:A(["running","stopped","missing"]).optional(),network:A(["loopback","unsafe","unknown"]).optional(),security:A(["hardened","unsafe","unknown"]).optional(),persistence:A(["durable","unsafe","unknown"]).optional(),desktopReady:O().optional(),ready:O().optional(),viewer_url:ce().min(1).optional()});function de(s){const e=ze.safeParse(s);return e.success?e.data:null}function D(s){const e=de(s),u=e?.mode??"unknown",n=e?.container??"unknown",o=e?.network??"unknown",d=e?.security??"unknown",p=e?.persistence??"unknown",w=e?.max_instances??0,h=e?.desktopReady===!0,x=!!(e?.ready===!0&&n==="running"&&o==="loopback"&&d==="hardened"&&p==="durable"&&h);return{mode:u,maxInstances:w,container:n,network:o,security:d,persistence:p,desktopReady:h,ready:x}}function Ve(s){const e=de(s);return!e||!D(s).ready?null:e.viewer_url??null}const J=["local-vm-workspace:left","local-vm-workspace:right"],me=ae({held:O(),helpReason:ce().nullable(),help:xe().optional().transform(ge),owned:O().optional(),acquired:O().optional(),released:O().optional()});async function ne(s,e,u){const n=await q(`/api/bots/${s}/computer/control`,{method:"POST",body:JSON.stringify({action:e,controlLeaseId:u})}),o=me.safeParse(n);if(!o.success)throw new Error("invalid-control-snapshot");return o.data}async function Oe(s){const e=me.safeParse(await q(`/api/bots/${s}/computer/control`));if(!e.success)throw new Error("invalid-control-snapshot");return e.data}function re(s,e){fetch(`/api/bots/${s}/computer/control`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"release",controlLeaseId:e}),keepalive:!0}).then(async u=>{u.ok}).catch(()=>{})}async function se(s,e){return!0}function H(s,e,u){s({type:"computerControl",botId:e,held:u.held,helpReason:u.helpReason,help:u.help??null})}function oe(s){const e=s.current?.getBoundingClientRect();return!e||e.width<1||e.height<1?null:{x:Math.round(e.left),y:Math.round(e.top),width:Math.round(e.width),height:Math.round(e.height)}}const Be=['[aria-modal="true"]','[role="dialog"]','[role="menu"]',"[popover]","[data-native-view-overlay]",".fixed",".absolute"].join(",");function Ie(){const s=[...document.querySelectorAll("[data-native-view-host]")],e=s.map(n=>n.getBoundingClientRect()).filter(n=>n.width>0&&n.height>0);if(e.length===0)return!1;const u=[...document.querySelectorAll(Be)].filter(n=>!s.some(o=>n===o||n.contains(o)||o.contains(n))).map(n=>{const o=window.getComputedStyle(n),d=n.matches('[aria-modal="true"], [role="dialog"], [role="menu"], [popover], [data-native-view-overlay]'),p=Number.parseInt(o.zIndex,10);return{rect:n.getBoundingClientRect(),explicit:d,visible:o.display!=="none"&&o.visibility!=="hidden"&&Number(o.opacity)!==0,zIndex:Number.isFinite(p)?p:null}});return Ce(e,u)}function Ae(s){const[e,u]=i.useState(!1);return i.useEffect(()=>{let n=0;const o=()=>u(Ie()),d=()=>{n||(n=requestAnimationFrame(()=>{n=0,o()}))};o();const p=new MutationObserver(d);p.observe(document.body,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["class","style","aria-hidden","aria-modal","role","open","popover"]});const w=new ResizeObserver(d);w.observe(document.body);for(const x of document.querySelectorAll("[data-native-view-host]"))w.observe(x);const h=["toggle","animationstart","animationend","transitionstart","transitionend"];for(const x of h)document.addEventListener(x,d,!0);return window.addEventListener("resize",d),window.addEventListener("scroll",d,!0),()=>{n&&cancelAnimationFrame(n),p.disconnect(),w.disconnect();for(const x of h)document.removeEventListener(x,d,!0);window.removeEventListener("resize",d),window.removeEventListener("scroll",d,!0)}},[]),s||e}function We(s,e){return s?s.container==="missing"?l("vm.workspace.status.missing"):s.container==="stopped"?l("vm.workspace.status.stopped"):s.ready?e==="error"?l("vm.workspace.status.viewerUnavailable"):e!=="ready"?l("vm.workspace.status.connecting"):l("vm.workspace.status.live"):l("vm.workspace.status.unavailable"):l("vm.workspace.status.checking")}function _e({index:s,bot:e,bots:u,otherBotId:n,obscured:o,active:d,heldElsewhere:p,controlPending:w,onSelect:h,onTake:x,onRelease:B,onOpenComputer:W}){const v=J[s],m=e?.id??null,I=e?.name??l("vm.workspace.localVm"),b=i.useRef(null),k=i.useRef(Promise.resolve()),z=i.useRef(o),[_,V]=i.useState(0),[C,N]=i.useState(null),[j,y]=i.useState({contextId:v,open:!1,status:"closed",interactive:!1}),[E,g]=i.useState(null),R=i.useCallback(async t=>{if(m)try{const a=await q(`/api/bots/${m}/local-computer`,{signal:t});t?.aborted||N(D(a))}catch{}},[m]),F=i.useRef(R);i.useEffect(()=>{F.current=R},[R]),i.useEffect(()=>{z.current=o},[o]),i.useEffect(()=>window.ogb?.desktopWorkspace?.onState(a=>{a.contextId===v&&(y(a),(a.status==="error"||a.status==="closed")&&F.current())}),[v]),i.useEffect(()=>{const t=window.ogb?.desktopWorkspace;let a=!0;const f=new AbortController;N(null),g(null),y({contextId:v,open:!1,status:"closed",interactive:!1});const M=async()=>{if(t&&await t.close(v).catch(()=>{}),!(!a||!m)){if(!t){g(l("vm.workspace.desktopRequired"));return}try{const S=await q(`/api/bots/${m}/local-computer`,{signal:f.signal});if(!a)return;const X=D(S);N(X);const Y=Ve(S);if(!X.ready||!Y||(await new Promise(pe=>{let K=!1;const Q=()=>{K||(K=!0,pe())},fe=setTimeout(Q,100);requestAnimationFrame(()=>{clearTimeout(fe),Q()})}),!a))return;const $=oe(b);if(!$)throw new Error("layout-unavailable");const G=await t.open({contextId:v,url:Y,title:l("vm.workspace.windowTitle",{name:I}),bounds:$});if(!a){await t.close(v).catch(()=>{});return}y(G),await t.layout([{contextId:v,bounds:$,visible:!z.current&&G.open}])}catch(S){if(!a||f.signal.aborted)return;g(S instanceof Error&&S.message==="layout-unavailable"?l("vm.workspace.layoutUnavailable"):l("vm.workspace.connectFailed"))}}};return k.current=k.current.catch(()=>{}).then(M),()=>{a=!1,f.abort(),t&&(k.current=k.current.catch(()=>{}).then(()=>t.close(v).then(()=>{}).catch(()=>{})))}},[m,I,v,_]),i.useEffect(()=>{if(!m)return;const t=new AbortController,a=window.setInterval(()=>{R(t.signal)},3e4);return()=>{t.abort(),window.clearInterval(a)}},[m,R]);const L=i.useCallback(()=>{const t=window.ogb?.desktopWorkspace,a=oe(b);!t||!a||!j.open||t.layout([{contextId:v,bounds:a,visible:!o}]).catch(()=>g(l("vm.workspace.positionFailed")))},[v,j.open,o]);i.useEffect(()=>{const t=b.current;if(!t)return;const a=new ResizeObserver(L);a.observe(t),window.addEventListener("resize",L);const f=requestAnimationFrame(L);return()=>{cancelAnimationFrame(f),a.disconnect(),window.removeEventListener("resize",L)}},[L]);const P=We(C,j.status),r=!!(e&&C?.ready&&j.status==="ready"&&j.open);return c.jsxs("section",{className:Z("flex min-h-0 min-w-0 flex-col overflow-hidden rounded-xl border bg-panel",d?"border-accent/80 shadow-[0_0_0_1px_rgb(var(--accent)/0.35)]":"border-hairline/50"),children:[c.jsxs("div",{className:"flex min-h-[68px] items-center gap-3 border-b border-hairline/40 px-3 py-2.5",children:[c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("label",{className:"sr-only",htmlFor:`local-vm-slot-${s}`,children:l("vm.workspace.paneLabel",{number:s+1})}),c.jsxs(ye,{size:"sm",className:"w-full",id:`local-vm-slot-${s}`,value:e?.id??"",onChange:t=>h(t.target.value||null),disabled:w,children:[c.jsx("option",{value:"",children:l("vm.workspace.chooseBot")}),u.map(t=>c.jsx("option",{value:t.id,disabled:t.id===n,children:t.name},t.id))]}),c.jsxs("div",{className:"mt-1 flex items-center gap-1.5 text-[11px] text-ink-secondary",children:[c.jsx("span",{className:Z("h-1.5 w-1.5 rounded-full",d?"bg-accent":j.status==="ready"?"bg-success":j.status==="error"?"bg-danger":"bg-ink-secondary/50")}),d?l("vm.workspace.youHaveControl"):p?l("vm.workspace.controlElsewhere"):P]})]}),e&&d?c.jsxs("button",{type:"button",onClick:B,disabled:w,className:"flex shrink-0 items-center gap-1.5 rounded-lg bg-accent px-2.5 py-2 text-[12px] font-medium text-white hover:brightness-110 disabled:opacity-50",children:[w?c.jsx(T,{size:13,className:"animate-spin"}):c.jsx(te,{size:13}),l("vm.workspace.handBack")]}):e?c.jsxs("button",{type:"button",onClick:()=>x(e.id),disabled:!r||w||p,className:"flex shrink-0 items-center gap-1.5 rounded-lg bg-raised px-2.5 py-2 text-[12px] text-ink hover:bg-raised-hover disabled:opacity-45",title:l("vm.workspace.takeControlTitle"),children:[w?c.jsx(T,{size:13,className:"animate-spin"}):c.jsx(te,{size:13}),p?l("vm.workspace.heldElsewhere"):l("vm.workspace.takeControl")]}):null]}),c.jsx("div",{ref:b,"data-native-view-host":!0,className:"relative min-h-0 flex-1 bg-[#070707]",children:c.jsx("div",{className:"absolute inset-0 flex items-center justify-center p-6 text-center",children:e?!C&&!E?c.jsxs("div",{className:"flex items-center gap-2 text-[12px] text-ink-secondary",children:[c.jsx(T,{size:15,className:"animate-spin"})," ",l("vm.workspace.checking",{name:e.name})]}):C?.ready&&j.status!=="error"&&!E?c.jsxs("div",{className:"flex items-center gap-2 text-[12px] text-ink-secondary",children:[c.jsx(T,{size:15,className:"animate-spin"})," ",l("vm.workspace.connecting")]}):c.jsxs("div",{className:"flex max-w-[300px] flex-col items-center gap-3 text-ink-secondary",children:[c.jsx(ie,{size:21,className:"text-warning"}),c.jsx("div",{className:"text-[12px] leading-relaxed",children:E??(C?.container==="missing"?l("vm.workspace.notCreated",{name:e.name}):C?.container==="stopped"?l("vm.workspace.stopped",{name:e.name}):l("vm.workspace.notReady",{name:e.name}))}),c.jsxs("div",{className:"flex gap-2",children:[c.jsxs("button",{type:"button",onClick:()=>V(t=>t+1),className:"flex items-center gap-1.5 rounded-lg bg-raised px-3 py-2 text-[12px] text-ink hover:bg-raised-hover",children:[c.jsx(je,{size:13})," ",l("vm.workspace.retryStatus")]}),c.jsx("button",{type:"button",onClick:()=>W(e.id),className:"rounded-lg bg-raised px-3 py-2 text-[12px] text-ink hover:bg-raised-hover",children:l("vm.workspace.openComputer")})]})]}):c.jsxs("div",{className:"flex max-w-[260px] flex-col items-center gap-2 text-ink-secondary",children:[c.jsx(le,{size:22}),c.jsx("span",{className:"text-[12px]",children:l("vm.workspace.chooseAnother")})]})})})]})}function He({primaryBotId:s,overlayOpen:e,onClose:u,onOpenComputer:n}){const{state:o,dispatch:d}=be(),{dragProps:p}=Ne(),w=i.useMemo(()=>o.bots.filter(r=>r.computer==="vm"&&!r.hidden),[o.bots]),[h,x]=i.useState(()=>Ee(o.bots,s)),B=i.useRef(h),[W,v]=i.useState(null),m=i.useRef(null),I=i.useRef(null),b=I.current??ke();I.current=b;const k=i.useRef(!1),z=i.useRef(!0),[_,V]=i.useState(!1),[C,N]=i.useState(null),j=Ae(e);i.useEffect(()=>{B.current=h},[h]);const y=i.useMemo(()=>({async take(r){const t=await ee({action:"take",syncNativeBrowser:!0,requestControl:a=>ne(r,a,b),setNativeBrowserControl:a=>se()});return H(d,r,t),t.held&&t.owned===!0?m.current=r:m.current===r&&(m.current=null),t},async release(r){const t=await ee({action:"release",syncNativeBrowser:!0,requestControl:a=>ne(r,a,b),setNativeBrowserControl:a=>se()});return H(d,r,t),m.current===r&&(m.current=null),t},async setInteractive(r){const t=window.ogb?.desktopWorkspace;if(!t)throw new Error(l("vm.workspace.bridgeUnavailable"));return t.setInteractive(r)}}),[b,d]);i.useEffect(()=>{x(r=>{const t=Le(r,o.bots);return t[0]===r[0]&&t[1]===r[1]?r:t})},[o.bots]),i.useEffect(()=>{let r=!0;return(async()=>{for(const a of h)if(a)try{const f=await Oe(a);r&&H(d,a,f)}catch{}})(),()=>{r=!1}},[d,h]),i.useEffect(()=>{const r=m.current;!r||h.includes(r)||U(y,r).then(()=>{v(null)}).catch(()=>{N(l("vm.workspace.handoffFailed"))})},[y,h]),i.useEffect(()=>(z.current=!0,()=>{z.current=!1;const r=m.current,t=window.ogb?.desktopWorkspace;if(!t){r&&re(r,b);return}t.setInteractive(null).catch(()=>{}).then(()=>(r&&re(r,b),t.close())).catch(()=>{})}),[b]);const E=i.useCallback(r=>{const t=B.current.indexOf(r);return t<0?null:J[t]},[]),g=i.useCallback(async()=>{const r=m.current;if(!r)return!0;if(k.current)return!1;k.current=!0,V(!0),N(null);try{return await U(y,r),v(null),!0}catch{return N(l("vm.workspace.handBackFailed",{app:he()})),!1}finally{k.current=!1,V(!1)}},[y]),R=i.useCallback(async r=>{if(k.current||m.current===r)return;const t=window.ogb?.desktopWorkspace,a=E(r);if(!(!t||!a)){k.current=!0,V(!0),N(null);try{const f={...y,async setInteractive(S){if(S&&E(r)!==S)throw new Error(l("vm.workspace.paneChanged"));return y.setInteractive(S)}},M=await Se(f,m.current,r,a);if(v(null),M.status==="held-elsewhere"){N(l("vm.workspace.alreadyControlled"));return}if(!z.current){await U(y,r).catch(()=>{});return}v(r)}catch{v(m.current),N(l("vm.workspace.switchFailed"))}finally{k.current=!1,V(!1)}}},[E,y]),F=i.useCallback(async(r,t)=>{if(k.current)return;const a=B.current[r];a!==t&&(a&&m.current===a&&!await g()||x(f=>Re(f,r,t)))},[g]),L=i.useCallback(async()=>{m.current&&!await g()||u()},[g,u]),P=i.useCallback(async r=>{m.current&&!await g()||n(r)},[g,n]);return c.jsxs("main",{className:"flex h-full min-w-0 flex-1 flex-col bg-app",children:[c.jsxs("header",{...p,className:"flex min-h-[60px] items-center gap-3 border-b border-hairline/40 px-5 py-3",children:[c.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-accent/15 text-accent",children:c.jsx(le,{size:18})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("h1",{className:"truncate text-[14px] font-semibold text-ink",children:l("vm.workspace.viewTitle")}),c.jsx("p",{className:"truncate text-[12px] text-ink-secondary",children:l("vm.workspace.viewSubtitle")})]}),c.jsx("button",{type:"button",onClick:()=>{L()},disabled:_,className:"rounded-md p-1.5 text-ink-secondary hover:bg-raised hover:text-ink disabled:opacity-50","aria-label":l("vm.workspace.closeView"),children:c.jsx(we,{size:18})})]}),C&&c.jsxs("div",{className:"mx-3 mt-3 flex items-center gap-2 rounded-lg border border-danger/30 bg-danger/10 px-3 py-2 text-[12px] text-danger",children:[c.jsx(ie,{size:14,className:"shrink-0"})," ",C]}),c.jsx("div",{className:"grid min-h-0 flex-1 grid-cols-2 gap-3 p-3",children:[0,1].map(r=>{const t=h[r],a=w.find(f=>f.id===t)??null;return c.jsx(_e,{index:r,bot:a,bots:w,otherBotId:h[r===0?1:0],obscured:j,active:!!(a&&W===a.id),heldElsewhere:!!(a&&o.computerControl[a.id]?.held&&W!==a.id),controlPending:_,onSelect:f=>{F(r,f)},onTake:f=>{R(f)},onRelease:()=>{g()},onOpenComputer:f=>{P(f)}},J[r])})})]})}export{He as LocalVmWorkspace};
|
|
1
|
+
import{t as l,h as ae,k as ce,l as O,m as A,p as ve,r as i,q as he,j as c,X as we,a as Z,u as xe}from"./styles-3g-ZPS7M.js";import{u as be,aj as ke,ak as ee,al as ie,g as q,y as ye,ai as te,am as ge}from"./App-h8WTNY4l.js";import{u as Ne,L as T}from"./PlacesRail-Df-jNTHn.js";import{M as le}from"./monitor-DMPjQDZP.js";import{R as je}from"./MenuMotion-CHp-hB40.js";import"./index-DtDQrExn.js";import"./placement-BKtVnQht.js";function Ce(s,e){const u=(n,o)=>n.left<o.right&&n.right>o.left&&n.top<o.bottom&&n.bottom>o.top;return e.some(n=>n.visible&&n.rect.width>0&&n.rect.height>0&&(n.explicit||n.zIndex!==null&&n.zIndex>=10)&&s.some(o=>u(n.rect,o)))}async function Se(s,e,u,n){e&&e!==u&&(await s.setInteractive(null),await s.release(e));const o=await s.take(u);if(!o.held)throw new Error(l("vm.workspace.holdNotAcquired"));if(o.owned!==!0)return{status:"held-elsewhere",botId:u,snapshot:o};try{await s.setInteractive(n)}catch(d){throw await s.setInteractive(null).catch(()=>{}),await s.release(u).catch(()=>{}),d}return{status:"controlled",botId:u,snapshot:o}}async function U(s,e){return e?(await s.setInteractive(null).catch(()=>{}),s.release(e)):null}function ue(s){return s.filter(e=>e.computer==="vm"&&e.hidden!==!0).map(e=>e.id)}function Ee(s,e){const u=ue(s),n=u.includes(e)?e:u[0]??null;return[n,u.find(o=>o!==n)??null]}function Re(s,e,u){const n=[...s],o=e===0?1:0;return u&&n[o]===u&&(n[o]=n[e]),n[e]=u,n}function Le(s,e){const u=ue(e),n=new Set(u),o=[null,null];for(const d of[0,1]){const p=s[d];p&&n.delete(p)&&(o[d]=p)}for(const d of[0,1]){if(o[d])continue;const p=[...n][0];p&&(o[d]=p,n.delete(p))}return o}const ze=ae({mode:A(["shared","per-bot","pool"]).optional(),max_instances:ve().int().positive().optional(),container:A(["running","stopped","missing"]).optional(),network:A(["loopback","unsafe","unknown"]).optional(),security:A(["hardened","unsafe","unknown"]).optional(),persistence:A(["durable","unsafe","unknown"]).optional(),desktopReady:O().optional(),ready:O().optional(),viewer_url:ce().min(1).optional()});function de(s){const e=ze.safeParse(s);return e.success?e.data:null}function D(s){const e=de(s),u=e?.mode??"unknown",n=e?.container??"unknown",o=e?.network??"unknown",d=e?.security??"unknown",p=e?.persistence??"unknown",w=e?.max_instances??0,h=e?.desktopReady===!0,x=!!(e?.ready===!0&&n==="running"&&o==="loopback"&&d==="hardened"&&p==="durable"&&h);return{mode:u,maxInstances:w,container:n,network:o,security:d,persistence:p,desktopReady:h,ready:x}}function Ve(s){const e=de(s);return!e||!D(s).ready?null:e.viewer_url??null}const J=["local-vm-workspace:left","local-vm-workspace:right"],me=ae({held:O(),helpReason:ce().nullable(),help:xe().optional().transform(ge),owned:O().optional(),acquired:O().optional(),released:O().optional()});async function ne(s,e,u){const n=await q(`/api/bots/${s}/computer/control`,{method:"POST",body:JSON.stringify({action:e,controlLeaseId:u})}),o=me.safeParse(n);if(!o.success)throw new Error("invalid-control-snapshot");return o.data}async function Oe(s){const e=me.safeParse(await q(`/api/bots/${s}/computer/control`));if(!e.success)throw new Error("invalid-control-snapshot");return e.data}function re(s,e){fetch(`/api/bots/${s}/computer/control`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({action:"release",controlLeaseId:e}),keepalive:!0}).then(async u=>{u.ok}).catch(()=>{})}async function se(s,e){return!0}function H(s,e,u){s({type:"computerControl",botId:e,held:u.held,helpReason:u.helpReason,help:u.help??null})}function oe(s){const e=s.current?.getBoundingClientRect();return!e||e.width<1||e.height<1?null:{x:Math.round(e.left),y:Math.round(e.top),width:Math.round(e.width),height:Math.round(e.height)}}const Be=['[aria-modal="true"]','[role="dialog"]','[role="menu"]',"[popover]","[data-native-view-overlay]",".fixed",".absolute"].join(",");function Ie(){const s=[...document.querySelectorAll("[data-native-view-host]")],e=s.map(n=>n.getBoundingClientRect()).filter(n=>n.width>0&&n.height>0);if(e.length===0)return!1;const u=[...document.querySelectorAll(Be)].filter(n=>!s.some(o=>n===o||n.contains(o)||o.contains(n))).map(n=>{const o=window.getComputedStyle(n),d=n.matches('[aria-modal="true"], [role="dialog"], [role="menu"], [popover], [data-native-view-overlay]'),p=Number.parseInt(o.zIndex,10);return{rect:n.getBoundingClientRect(),explicit:d,visible:o.display!=="none"&&o.visibility!=="hidden"&&Number(o.opacity)!==0,zIndex:Number.isFinite(p)?p:null}});return Ce(e,u)}function Ae(s){const[e,u]=i.useState(!1);return i.useEffect(()=>{let n=0;const o=()=>u(Ie()),d=()=>{n||(n=requestAnimationFrame(()=>{n=0,o()}))};o();const p=new MutationObserver(d);p.observe(document.body,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["class","style","aria-hidden","aria-modal","role","open","popover"]});const w=new ResizeObserver(d);w.observe(document.body);for(const x of document.querySelectorAll("[data-native-view-host]"))w.observe(x);const h=["toggle","animationstart","animationend","transitionstart","transitionend"];for(const x of h)document.addEventListener(x,d,!0);return window.addEventListener("resize",d),window.addEventListener("scroll",d,!0),()=>{n&&cancelAnimationFrame(n),p.disconnect(),w.disconnect();for(const x of h)document.removeEventListener(x,d,!0);window.removeEventListener("resize",d),window.removeEventListener("scroll",d,!0)}},[]),s||e}function We(s,e){return s?s.container==="missing"?l("vm.workspace.status.missing"):s.container==="stopped"?l("vm.workspace.status.stopped"):s.ready?e==="error"?l("vm.workspace.status.viewerUnavailable"):e!=="ready"?l("vm.workspace.status.connecting"):l("vm.workspace.status.live"):l("vm.workspace.status.unavailable"):l("vm.workspace.status.checking")}function _e({index:s,bot:e,bots:u,otherBotId:n,obscured:o,active:d,heldElsewhere:p,controlPending:w,onSelect:h,onTake:x,onRelease:B,onOpenComputer:W}){const v=J[s],m=e?.id??null,I=e?.name??l("vm.workspace.localVm"),b=i.useRef(null),k=i.useRef(Promise.resolve()),z=i.useRef(o),[_,V]=i.useState(0),[C,N]=i.useState(null),[j,y]=i.useState({contextId:v,open:!1,status:"closed",interactive:!1}),[E,g]=i.useState(null),R=i.useCallback(async t=>{if(m)try{const a=await q(`/api/bots/${m}/local-computer`,{signal:t});t?.aborted||N(D(a))}catch{}},[m]),F=i.useRef(R);i.useEffect(()=>{F.current=R},[R]),i.useEffect(()=>{z.current=o},[o]),i.useEffect(()=>window.ogb?.desktopWorkspace?.onState(a=>{a.contextId===v&&(y(a),(a.status==="error"||a.status==="closed")&&F.current())}),[v]),i.useEffect(()=>{const t=window.ogb?.desktopWorkspace;let a=!0;const f=new AbortController;N(null),g(null),y({contextId:v,open:!1,status:"closed",interactive:!1});const M=async()=>{if(t&&await t.close(v).catch(()=>{}),!(!a||!m)){if(!t){g(l("vm.workspace.desktopRequired"));return}try{const S=await q(`/api/bots/${m}/local-computer`,{signal:f.signal});if(!a)return;const X=D(S);N(X);const Y=Ve(S);if(!X.ready||!Y||(await new Promise(pe=>{let K=!1;const Q=()=>{K||(K=!0,pe())},fe=setTimeout(Q,100);requestAnimationFrame(()=>{clearTimeout(fe),Q()})}),!a))return;const $=oe(b);if(!$)throw new Error("layout-unavailable");const G=await t.open({contextId:v,url:Y,title:l("vm.workspace.windowTitle",{name:I}),bounds:$});if(!a){await t.close(v).catch(()=>{});return}y(G),await t.layout([{contextId:v,bounds:$,visible:!z.current&&G.open}])}catch(S){if(!a||f.signal.aborted)return;g(S instanceof Error&&S.message==="layout-unavailable"?l("vm.workspace.layoutUnavailable"):l("vm.workspace.connectFailed"))}}};return k.current=k.current.catch(()=>{}).then(M),()=>{a=!1,f.abort(),t&&(k.current=k.current.catch(()=>{}).then(()=>t.close(v).then(()=>{}).catch(()=>{})))}},[m,I,v,_]),i.useEffect(()=>{if(!m)return;const t=new AbortController,a=window.setInterval(()=>{R(t.signal)},3e4);return()=>{t.abort(),window.clearInterval(a)}},[m,R]);const L=i.useCallback(()=>{const t=window.ogb?.desktopWorkspace,a=oe(b);!t||!a||!j.open||t.layout([{contextId:v,bounds:a,visible:!o}]).catch(()=>g(l("vm.workspace.positionFailed")))},[v,j.open,o]);i.useEffect(()=>{const t=b.current;if(!t)return;const a=new ResizeObserver(L);a.observe(t),window.addEventListener("resize",L);const f=requestAnimationFrame(L);return()=>{cancelAnimationFrame(f),a.disconnect(),window.removeEventListener("resize",L)}},[L]);const P=We(C,j.status),r=!!(e&&C?.ready&&j.status==="ready"&&j.open);return c.jsxs("section",{className:Z("flex min-h-0 min-w-0 flex-col overflow-hidden rounded-xl border bg-panel",d?"border-accent/80 shadow-[0_0_0_1px_rgb(var(--accent)/0.35)]":"border-hairline/50"),children:[c.jsxs("div",{className:"flex min-h-[68px] items-center gap-3 border-b border-hairline/40 px-3 py-2.5",children:[c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("label",{className:"sr-only",htmlFor:`local-vm-slot-${s}`,children:l("vm.workspace.paneLabel",{number:s+1})}),c.jsxs(ye,{size:"sm",className:"w-full",id:`local-vm-slot-${s}`,value:e?.id??"",onChange:t=>h(t.target.value||null),disabled:w,children:[c.jsx("option",{value:"",children:l("vm.workspace.chooseBot")}),u.map(t=>c.jsx("option",{value:t.id,disabled:t.id===n,children:t.name},t.id))]}),c.jsxs("div",{className:"mt-1 flex items-center gap-1.5 text-[11px] text-ink-secondary",children:[c.jsx("span",{className:Z("h-1.5 w-1.5 rounded-full",d?"bg-accent":j.status==="ready"?"bg-success":j.status==="error"?"bg-danger":"bg-ink-secondary/50")}),d?l("vm.workspace.youHaveControl"):p?l("vm.workspace.controlElsewhere"):P]})]}),e&&d?c.jsxs("button",{type:"button",onClick:B,disabled:w,className:"flex shrink-0 items-center gap-1.5 rounded-lg bg-accent px-2.5 py-2 text-[12px] font-medium text-white hover:brightness-110 disabled:opacity-50",children:[w?c.jsx(T,{size:13,className:"animate-spin"}):c.jsx(te,{size:13}),l("vm.workspace.handBack")]}):e?c.jsxs("button",{type:"button",onClick:()=>x(e.id),disabled:!r||w||p,className:"flex shrink-0 items-center gap-1.5 rounded-lg bg-raised px-2.5 py-2 text-[12px] text-ink hover:bg-raised-hover disabled:opacity-45",title:l("vm.workspace.takeControlTitle"),children:[w?c.jsx(T,{size:13,className:"animate-spin"}):c.jsx(te,{size:13}),p?l("vm.workspace.heldElsewhere"):l("vm.workspace.takeControl")]}):null]}),c.jsx("div",{ref:b,"data-native-view-host":!0,className:"relative min-h-0 flex-1 bg-[#070707]",children:c.jsx("div",{className:"absolute inset-0 flex items-center justify-center p-6 text-center",children:e?!C&&!E?c.jsxs("div",{className:"flex items-center gap-2 text-[12px] text-ink-secondary",children:[c.jsx(T,{size:15,className:"animate-spin"})," ",l("vm.workspace.checking",{name:e.name})]}):C?.ready&&j.status!=="error"&&!E?c.jsxs("div",{className:"flex items-center gap-2 text-[12px] text-ink-secondary",children:[c.jsx(T,{size:15,className:"animate-spin"})," ",l("vm.workspace.connecting")]}):c.jsxs("div",{className:"flex max-w-[300px] flex-col items-center gap-3 text-ink-secondary",children:[c.jsx(ie,{size:21,className:"text-warning"}),c.jsx("div",{className:"text-[12px] leading-relaxed",children:E??(C?.container==="missing"?l("vm.workspace.notCreated",{name:e.name}):C?.container==="stopped"?l("vm.workspace.stopped",{name:e.name}):l("vm.workspace.notReady",{name:e.name}))}),c.jsxs("div",{className:"flex gap-2",children:[c.jsxs("button",{type:"button",onClick:()=>V(t=>t+1),className:"flex items-center gap-1.5 rounded-lg bg-raised px-3 py-2 text-[12px] text-ink hover:bg-raised-hover",children:[c.jsx(je,{size:13})," ",l("vm.workspace.retryStatus")]}),c.jsx("button",{type:"button",onClick:()=>W(e.id),className:"rounded-lg bg-raised px-3 py-2 text-[12px] text-ink hover:bg-raised-hover",children:l("vm.workspace.openComputer")})]})]}):c.jsxs("div",{className:"flex max-w-[260px] flex-col items-center gap-2 text-ink-secondary",children:[c.jsx(le,{size:22}),c.jsx("span",{className:"text-[12px]",children:l("vm.workspace.chooseAnother")})]})})})]})}function He({primaryBotId:s,overlayOpen:e,onClose:u,onOpenComputer:n}){const{state:o,dispatch:d}=be(),{dragProps:p}=Ne(),w=i.useMemo(()=>o.bots.filter(r=>r.computer==="vm"&&!r.hidden),[o.bots]),[h,x]=i.useState(()=>Ee(o.bots,s)),B=i.useRef(h),[W,v]=i.useState(null),m=i.useRef(null),I=i.useRef(null),b=I.current??ke();I.current=b;const k=i.useRef(!1),z=i.useRef(!0),[_,V]=i.useState(!1),[C,N]=i.useState(null),j=Ae(e);i.useEffect(()=>{B.current=h},[h]);const y=i.useMemo(()=>({async take(r){const t=await ee({action:"take",syncNativeBrowser:!0,requestControl:a=>ne(r,a,b),setNativeBrowserControl:a=>se()});return H(d,r,t),t.held&&t.owned===!0?m.current=r:m.current===r&&(m.current=null),t},async release(r){const t=await ee({action:"release",syncNativeBrowser:!0,requestControl:a=>ne(r,a,b),setNativeBrowserControl:a=>se()});return H(d,r,t),m.current===r&&(m.current=null),t},async setInteractive(r){const t=window.ogb?.desktopWorkspace;if(!t)throw new Error(l("vm.workspace.bridgeUnavailable"));return t.setInteractive(r)}}),[b,d]);i.useEffect(()=>{x(r=>{const t=Le(r,o.bots);return t[0]===r[0]&&t[1]===r[1]?r:t})},[o.bots]),i.useEffect(()=>{let r=!0;return(async()=>{for(const a of h)if(a)try{const f=await Oe(a);r&&H(d,a,f)}catch{}})(),()=>{r=!1}},[d,h]),i.useEffect(()=>{const r=m.current;!r||h.includes(r)||U(y,r).then(()=>{v(null)}).catch(()=>{N(l("vm.workspace.handoffFailed"))})},[y,h]),i.useEffect(()=>(z.current=!0,()=>{z.current=!1;const r=m.current,t=window.ogb?.desktopWorkspace;if(!t){r&&re(r,b);return}t.setInteractive(null).catch(()=>{}).then(()=>(r&&re(r,b),t.close())).catch(()=>{})}),[b]);const E=i.useCallback(r=>{const t=B.current.indexOf(r);return t<0?null:J[t]},[]),g=i.useCallback(async()=>{const r=m.current;if(!r)return!0;if(k.current)return!1;k.current=!0,V(!0),N(null);try{return await U(y,r),v(null),!0}catch{return N(l("vm.workspace.handBackFailed",{app:he()})),!1}finally{k.current=!1,V(!1)}},[y]),R=i.useCallback(async r=>{if(k.current||m.current===r)return;const t=window.ogb?.desktopWorkspace,a=E(r);if(!(!t||!a)){k.current=!0,V(!0),N(null);try{const f={...y,async setInteractive(S){if(S&&E(r)!==S)throw new Error(l("vm.workspace.paneChanged"));return y.setInteractive(S)}},M=await Se(f,m.current,r,a);if(v(null),M.status==="held-elsewhere"){N(l("vm.workspace.alreadyControlled"));return}if(!z.current){await U(y,r).catch(()=>{});return}v(r)}catch{v(m.current),N(l("vm.workspace.switchFailed"))}finally{k.current=!1,V(!1)}}},[E,y]),F=i.useCallback(async(r,t)=>{if(k.current)return;const a=B.current[r];a!==t&&(a&&m.current===a&&!await g()||x(f=>Re(f,r,t)))},[g]),L=i.useCallback(async()=>{m.current&&!await g()||u()},[g,u]),P=i.useCallback(async r=>{m.current&&!await g()||n(r)},[g,n]);return c.jsxs("main",{className:"flex h-full min-w-0 flex-1 flex-col bg-app",children:[c.jsxs("header",{...p,className:"flex min-h-[60px] items-center gap-3 border-b border-hairline/40 px-5 py-3",children:[c.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-accent/15 text-accent",children:c.jsx(le,{size:18})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("h1",{className:"truncate text-[14px] font-semibold text-ink",children:l("vm.workspace.viewTitle")}),c.jsx("p",{className:"truncate text-[12px] text-ink-secondary",children:l("vm.workspace.viewSubtitle")})]}),c.jsx("button",{type:"button",onClick:()=>{L()},disabled:_,className:"rounded-md p-1.5 text-ink-secondary hover:bg-raised hover:text-ink disabled:opacity-50","aria-label":l("vm.workspace.closeView"),children:c.jsx(we,{size:18})})]}),C&&c.jsxs("div",{className:"mx-3 mt-3 flex items-center gap-2 rounded-lg border border-danger/30 bg-danger/10 px-3 py-2 text-[12px] text-danger",children:[c.jsx(ie,{size:14,className:"shrink-0"})," ",C]}),c.jsx("div",{className:"grid min-h-0 flex-1 grid-cols-2 gap-3 p-3",children:[0,1].map(r=>{const t=h[r],a=w.find(f=>f.id===t)??null;return c.jsx(_e,{index:r,bot:a,bots:w,otherBotId:h[r===0?1:0],obscured:j,active:!!(a&&W===a.id),heldElsewhere:!!(a&&o.computerControl[a.id]?.held&&W!==a.id),controlPending:_,onSelect:f=>{F(r,f)},onTake:f=>{R(f)},onRelease:()=>{g()},onOpenComputer:f=>{P(f)}},J[r])})})]})}export{He as LocalVmWorkspace};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as C,r as m,j as e,t as a}from"./styles-
|
|
1
|
+
import{c as C,r as m,j as e,t as a}from"./styles-3g-ZPS7M.js";import{c as k,L as S}from"./PlacesRail-Df-jNTHn.js";import{a_ as L,a$ as E,b0 as M,al as w,b1 as y,b2 as A}from"./App-h8WTNY4l.js";const z=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],R=C("shield",z);async function q(t,o,s,r=6e4){const i=Date.now()+r;let c=t;for(;!c.ready&&c.container==="running"&&Date.now()<i;)s.throwIfAborted(),await new Promise((x,u)=>{const l=()=>{window.clearTimeout(d),u(s.reason)},d=window.setTimeout(()=>{s.removeEventListener("abort",l),x()},2e3);s.addEventListener("abort",l,{once:!0})}),c=await o();return s.throwIfAborted(),c}let g=!1;const b=new Set,T=t=>(b.add(t),()=>{b.delete(t)}),v=()=>g;function j(){g=!0;for(const t of b)t()}async function D(t=o=>window.ogb?.permOpenSettings?.(o)){await t("accessibility"),!g&&await t("screen")}function F(){const{capabilities:t}=k(),o=m.useSyncExternalStore(T,v,v),s=t.localComputer.available?null:t.localComputer.message,r=L(E(s)),[i,c]=m.useState(!1),[x,u]=m.useState(!1),[l,d]=m.useState(null),N=m.useContext(M),f=async()=>{c(!0),d(null);try{await window.ogb?.localControl?.retry()}catch(n){d(n instanceof Error?n.message:String(n))}finally{c(!1)}},h=async()=>{d(null),u(!0);try{await D()}catch(n){u(!1),d(n instanceof Error?n.message:String(n))}};return m.useEffect(()=>{if(!x||o)return;let n=!1;const p=()=>{n||document.visibilityState==="visible"&&(n=!0,u(!1),f())};return window.addEventListener("focus",p),document.addEventListener("visibilitychange",p),()=>{window.removeEventListener("focus",p),document.removeEventListener("visibilitychange",p)}},[x,o]),t.host.platform!=="darwin"||t.localComputer.reasonCode==="remote-server"||t.localComputer.available||o?null:N?e.jsxs("section",{"data-mac-control":"",className:"flex items-start gap-3",children:[e.jsx(w,{size:16,"aria-hidden":"true",className:"mt-0.5 shrink-0 text-warning"}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[e.jsx("div",{className:"text-[14px] leading-5 text-ink",children:a("computer.mac.allowTitle")}),e.jsx("p",{className:"text-[12px] leading-4 text-ink-secondary",children:r??a("computer.mac.permission.generic")}),l&&e.jsx("p",{role:"alert",className:"text-[12px] leading-4 text-danger",children:l}),e.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-2",children:[r&&s&&e.jsx(y,{reason:s}),!r&&e.jsx("button",{type:"button",onClick:()=>{h()},disabled:i,className:"ui-button ui-button-md ui-button-primary rounded-full",children:a("computer.mac.openSystemSettings")}),e.jsx("button",{type:"button",onClick:()=>{f()},disabled:i,className:"settings-quiet cursor-pointer",children:a("commandAllowlist.retry")}),!i&&e.jsx("button",{type:"button",onClick:j,className:"settings-quiet cursor-pointer",children:a("phone.intro.notNow")})]})]})]}):e.jsx("section",{className:"mt-4 rounded-xl border border-warning/25 bg-warning/10 p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(R,{size:16,className:"mt-0.5 shrink-0 text-warning"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-[14px] font-medium text-ink",children:a("computer.mac.allowTitle")}),e.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:r??a("computer.mac.permission.generic")}),s&&e.jsxs("details",{className:"mt-2 text-[12px] text-ink-secondary",children:[e.jsx("summary",{className:"cursor-pointer",children:a("computer.mac.permission.driverDetail")}),e.jsx("p",{className:"mt-1 break-words",children:s})]}),l&&e.jsxs("div",{className:"mt-2 flex gap-1.5 text-[12px] text-danger",children:[e.jsx(w,{size:13,className:"mt-0.5 shrink-0"}),e.jsx("span",{children:l})]}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[r&&s&&e.jsx(y,{reason:s}),!r&&e.jsx("button",{type:"button",onClick:()=>{h()},disabled:i,className:"inline-flex items-center gap-1.5 rounded-lg bg-accent px-3 py-1.5 text-[13px] font-medium text-white hover:brightness-110 disabled:opacity-50",children:a("computer.mac.openSystemSettings")}),e.jsxs("button",{type:"button",onClick:()=>{f()},disabled:i,className:"inline-flex items-center gap-1.5 rounded-lg border border-hairline/50 px-3 py-1.5 text-[13px] font-medium text-ink hover:bg-raised disabled:opacity-50",children:[i&&e.jsx(S,{size:13,className:"animate-spin"}),a("commandAllowlist.retry")]}),!i&&e.jsx(A,{onClick:j})]})]})]})})}export{F as M,q as w};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as d,j as e,t as a}from"./styles-
|
|
1
|
+
import{r as d,j as e,t as a}from"./styles-3g-ZPS7M.js";import{aa as v,ab as k,ac as N,a8 as g,ad as y,ae as C,af as E,ag as S}from"./App-h8WTNY4l.js";import{L as z}from"./PlacesRail-Df-jNTHn.js";import"./index-DtDQrExn.js";import"./MenuMotion-CHp-hB40.js";import"./monitor-DMPjQDZP.js";import"./placement-BKtVnQht.js";const A=2*1024*1024;function V({path:r,name:n,message:c}){const[x,p]=d.useState(0),[u,h]=d.useState(null),[l,m]=d.useState(null),[o,j]=d.useState(!1),s=v(r,n,c);d.useEffect(()=>{const i=new AbortController;return m(null),h(null),(async()=>{let f=!1;try{const t=await k(r,c,i.signal);f=!0;const w=await N(t,i.signal,A,"windows-1252");i.signal.aborted||h(w)}catch(t){if(i.signal.aborted)return;!f&&t instanceof Error&&!(t instanceof TypeError)?m({reason:t.message}):m(t instanceof Error&&(t.message==="size"||t.message==="encoding")?t.message:"load")}})(),()=>i.abort()},[r,c.threadId,c.messageId,x]);const b=e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mt-3 flex flex-wrap justify-center gap-2",children:[e.jsxs("button",{type:"button",className:"inline-flex max-w-full min-w-0 items-center gap-1.5 rounded-lg border border-hairline px-3 py-2 hover:bg-raised",disabled:s.state==="saving",onClick:()=>{s.save()},children:[e.jsx(g,{size:14,className:"shrink-0"}),e.jsx("span",{className:"min-w-0 break-all",children:a("attach.saveAria",{name:n})})]}),e.jsx("button",{type:"button",className:"rounded-lg border border-hairline px-3 py-2 hover:bg-raised",onClick:()=>p(x+1),children:a("chat.retry")})]}),s.state==="failed"&&e.jsx("p",{role:"alert",className:"mt-2 text-[12px] text-danger",children:s.reason})]});return l?e.jsxs("div",{className:"p-8 text-center text-sm",children:[e.jsx("p",{role:"alert",className:"text-ink-secondary",children:typeof l=="object"?a("markdown.refused",{reason:l.reason}):a(l==="size"?"markdown.tooLarge":l==="encoding"?"markdown.notText":"markdown.loadFailed")}),b]}):u===null?e.jsxs("div",{className:"p-12 text-center text-sm text-ink-secondary",children:[e.jsxs("span",{role:"status",className:"inline-flex items-center gap-2",children:[e.jsx(z,{size:16,className:"animate-spin"}),a("markdown.loading")]}),b]}):e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center justify-end gap-1",children:[e.jsx("button",{type:"button",className:"table-action","aria-pressed":o,"aria-label":a(o?"markdown.rendered":"html.source"),title:a(o?"markdown.rendered":"html.source"),onClick:()=>j(!o),children:o?e.jsx(y,{size:14}):e.jsx(C,{size:14})}),e.jsx("button",{type:"button",className:"table-action","aria-label":a("html.reload"),title:a("html.reload"),onClick:()=>p(x+1),children:e.jsx(E,{size:14})}),e.jsx("button",{type:"button",className:"table-action","aria-label":a("attach.saveAria",{name:n}),title:a("attach.saveAria",{name:n}),disabled:s.state==="saving",onClick:()=>{s.save()},children:e.jsx(g,{size:14})})]}),s.state==="failed"&&e.jsx("p",{role:"alert",className:"text-end text-[12px] text-danger",children:s.reason}),e.jsx(F,{source:u,showSource:o})]})}function F({source:r,showSource:n}){return n?e.jsx("pre",{className:"h-[72dvh] overflow-auto rounded-lg border border-hairline/40 bg-inset p-3 text-[12px] leading-5 whitespace-pre-wrap break-words text-ink",children:r}):e.jsx("div",{"data-markdown-file":!0,className:"h-[72dvh] overflow-auto rounded-lg border border-hairline/40 bg-panel px-5 py-4 text-[14px] leading-6 text-ink",children:e.jsx(S,{text:r})})}export{A as MARKDOWN_PREVIEW_MAX_BYTES,F as MarkdownFileView,V as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as o,t as y,f as p,r as a}from"./styles-
|
|
1
|
+
import{c as o,t as y,f as p,r as a}from"./styles-3g-ZPS7M.js";const f=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],T=o("chevron-right",f);const w=[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]],x=o("keyboard",w);const K=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],O=o("refresh-cw",K);const g=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],H=o("send",g),d=[{category:"Navigation",items:[{id:"command-palette",description:"Open command palette (switcher & transcript search)",macKeys:["⌘","K"],winKeys:["Ctrl","K"]},{id:"new-bot",description:"Create a new bot",macKeys:["⌘","N"],winKeys:["Ctrl","N"]},{id:"new-thread",description:"Start a new thread with the selected bot",macKeys:["⌘","⇧","N"],winKeys:["Ctrl","Shift","N"]},{id:"jump-bot",description:"Jump to bot 1–9 in the roster",macKeys:["⌘","1–9"],winKeys:["Ctrl","1–9"]},{id:"toggle-sidebar",description:"Collapse or expand the sidebar",macKeys:["⌘","\\"],winKeys:["Ctrl","\\"]},{id:"switch-bot",description:"Switch to previous / next bot",macKeys:["⌘","⇧","[ / ]"],winKeys:["Ctrl","Shift","[ / ]"]},{id:"find-conversation",description:"Find in conversation",macKeys:["⌘","F"],winKeys:["Ctrl","F"]}]},{category:"Chat & Composer",items:[{id:"send-message",description:"Send message",macKeys:["Return"],winKeys:["Enter"]},{id:"new-line",description:"Insert new line without sending",macKeys:["⇧","Return"],winKeys:["Shift","Enter"]},{id:"send-follow-up",description:"While a bot works: queue instead of steering, or the other way round",macKeys:["⌘","Return"],winKeys:["Ctrl","Enter"]},{id:"edit-last-message",description:"Edit last message (when composer is empty)",macKeys:["↑"],winKeys:["↑"]},{id:"close-panel",description:"Close active drawer, modal, or find bar",macKeys:["Esc"],winKeys:["Esc"]},{id:"shortcuts-cheat-sheet",description:"Show keyboard shortcuts cheat sheet",macKeys:["⌘","/"],winKeys:["Ctrl","/"]}]},{category:"Calls",items:[{id:"live-call-mute",description:"Mute or unmute a Live call",macKeys:["⌘","⇧","M"],winKeys:["Ctrl","Shift","M"]},{id:"live-call-hang-up",description:"Hang up a Live call",macKeys:["⌘","⇧","H"],winKeys:["Ctrl","Shift","H"]}]},{category:"Management & Groups",items:[{id:"save-bulletin",description:"Save group instruction changes",macKeys:["⌘","Return"],winKeys:["Ctrl","Enter"]},{id:"reorder-section",description:"Reorder sidebar sections (focus a section heading)",macKeys:["⌥","↑ / ↓"],winKeys:["Alt","↑ / ↓"]}]}],C={Navigation:"shortcuts.category.navigation","Chat & Composer":"shortcuts.category.chat",Calls:"shortcuts.category.calls","Management & Groups":"shortcuts.category.groups"},M=e=>{const t=`shortcuts.${e.id}`;return Object.hasOwn(p,t)?y(t):e.description},k=e=>{const t=C[e.category];return t?y(t):e.category},u={macKeys:["Return"],winKeys:["Enter"]},E={macKeys:["⇧","Return"],winKeys:["Shift","Enter"]},l={macKeys:["⌘","Return"],winKeys:["Ctrl","Enter"]},b={"shift-enter":[E,u,l],"mod-enter":[l,u,{macKeys:["⌘","⇧","Return"],winKeys:["Ctrl","Shift","Enter"]}]};function j(e){if(e==="enter")return d;const[t,s,n]=b[e];return d.map(r=>({...r,items:r.items.map(i=>i.id==="send-message"?{...i,...t}:i.id==="new-line"?{...i,...s}:i.id==="send-follow-up"?{...i,...n}:i)}))}function F(e){return!e.defaultPrevented&&e.key==="\\"&&(e.metaKey||e.ctrlKey)&&!e.shiftKey&&!e.altKey}function G(e){return e.key==="]"||e.key==="}"?1:e.key==="["||e.key==="{"?-1:null}function P(e){if(e.defaultPrevented||e.isComposing||e.altKey)return!1;const t=e.key==="?"&&!e.metaKey&&!e.ctrlKey,s=e.key==="/"&&(e.metaKey||e.ctrlKey)&&!e.shiftKey;if(!t&&!s)return!1;const n=e.target;return!(n instanceof HTMLElement&&(n.isContentEditable||n.closest("input, textarea, select, dialog, [role=dialog]")))}function h(){return typeof window<"u"&&window.ogb?.platform?window.ogb.platform==="darwin":typeof navigator<"u"&&navigator.userAgent?navigator.userAgent.includes("Mac"):!0}function S(e,t=h()){return t?e.macKeys:e.winKeys}function v(e,t,s=h()){const n=t.trim().toLowerCase();return n?e.map(r=>{const i=r.items.filter(c=>{const m=S(c,s).join(" ").toLowerCase();return M(c).toLowerCase().includes(n)||k(r).toLowerCase().includes(n)||m.includes(n)});return{...r,items:i}}).filter(r=>r.items.length>0):[...e]}const R=200;function N(){return typeof document>"u"?!1:document.documentElement.dataset.reducedMotion==="true"?!0:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function _(e){const[t,s]=a.useState(e);a.useLayoutEffect(()=>{if(e){s(!0);return}if(!t)return;if(N()){s(!1);return}const r=window.setTimeout(()=>s(!1),R);return()=>window.clearTimeout(r)},[e,t]);const n=!e&&t;return{shown:e||t,closing:n,className:n?"animate-pop-out pointer-events-none":"animate-pop-in",exitProps:n?{inert:!0,"aria-hidden":!0}:{}}}function I(e){const t=_(e!=null),s=a.useRef(e);return e!=null&&(s.current=e),{...t,value:e??s.current}}export{T as C,x as K,O as R,H as S,k as a,S as b,M as c,_ as d,d as e,v as f,F as g,P as h,h as i,G as j,j as s,I as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as n,j as e,r as d,x as me,y as xe,X as he,a as Q}from"./styles-DOJOOIp4.js";import{u as ee,ar as H,as as be,at as te,au as fe,g as L,av as ge,aw as se,ax as ye,y as N,ay as ve,az as je,aA as W,aB as we,aC as Se,aD as ke,aE as Ne,aF as Be,aG as G,T as ne,aH as Ce,h as Ee,aI as Re}from"./App-BIllYA_e.js";import{I as Pe,S as Ae,a as Te,A as Le,M as Oe,P as De,V as ze,v as Me,i as J}from"./VisibilitySection-Cd3TZvS_.js";import{R as Ie}from"./RoutinesPage-CLXohizn.js";import{f as Fe,g as Ue,L as X,P as Ye}from"./PlacesRail-3RaNlpug.js";import"./index-C1PEx1tc.js";import"./MenuMotion-DfjnHTCi.js";import"./monitor-DpsqT1_R.js";import"./org-library-alRyzCTE.js";import"./package-format-BFXbXHk8.js";import"./mcp-servers-DoMFsds6.js";import"./WorksOnGrid-DHo10o0j.js";import"./phones-J7mYR-fY.js";import"./memory-BR-ujoQY.js";import"./ProIntroduction-B3phUWnc.js";import"./remote-desktop-CsSfkXSy.js";import"./placement-BKtVnQht.js";function $e(t){const s=[];for(const o of t){const i=o.source==="org"?n("newBot.presetsFromOrganization",{name:o.publisherName??o.packageName}):n("newBot.presetsImported"),c=s.find(r=>r.label===i);c?c.presets.push(o):s.push({label:i,presets:[o]})}return s}function Ke(t){const s={name:t.bot.name??t.name,title:t.bot.title??"",description:t.bot.description??"",soul:t.bot.soul??""},o=t.bot.appearance;return o&&(s.color=o.color,s.mascotExpression=o.mascotExpression??null,o.mascotBody&&(s.mascotBody=o.mascotBody)),s}function Ve(t){const s=t.bot.appearance?.avatar;if(!s)return null;let o;try{o=atob(s.data)}catch{return null}const i=new Uint8Array(o.length);for(let c=0;c<o.length;c+=1)i[c]=o.charCodeAt(c);return new File([i],`preset.${s.mime.slice(6)}`,{type:s.mime})}function _e(t){const s=[t.source==="org"&&t.publisherName?n("newBot.presetFromOrg",{package:t.packageName,release:t.release,publisher:t.publisherName}):n("newBot.presetFrom",{package:t.packageName,release:t.release})];t.description&&s.push(t.description);const o=t.skills.map(i=>i.name).join(", ");return o&&s.push(n(t.skillsEnabled?"newBot.presetSkillsOn":"newBot.presetSkillsOff",{names:o})),t.notes.length&&s.push(n("newBot.presetNotes",{names:t.notes.join(", ")})),t.playbooks.length&&s.push(n("newBot.presetPlaybooks",{names:t.playbooks.join(", ")})),s.push(n("newBot.presetKeeps")),s}function qe(t){return{id:t.id,skills:t.skills.map(s=>s.name),notes:[...t.notes]}}const Z=["Identity","Soul","Skills","Memory","Routines","Access","Model","Permissions","Voice & alerts"],He={Identity:"botSettings.sections.identity",Soul:"botSettings.sections.soul",Skills:"botSettings.sections.skills",Memory:"botSettings.sections.memory",Routines:"botSettings.sections.routines",Access:"botSettings.sections.access",Model:"botSettings.sections.model",Permissions:"botSettings.sections.permissions","Voice & alerts":"botSettings.sections.voice"};function We(t){return e.jsx(Fe,{modal:!0,children:e.jsx(Ge,{...t})})}function Ge({defaultsMode:t=!1,onClose:s,onCreated:o,readyBotId:i}){const c=Ue(),r=ee(),[,v]=d.useState(0),[l,m]=d.useState(()=>new H(be,()=>v(a=>a+1))),[j,O]=d.useState("Identity"),[k,E]=d.useState(!1),[u,p]=d.useState(!1),g=u||r.state.botCreationPending,x=d.useRef(!1),w=d.useRef(!0),[B,R]=d.useState(""),[oe,D]=d.useState(null),[z,ae]=d.useState("everyone"),[F,ie]=d.useState(""),S=te(),U=r.state.config?.team?.name,[Y,re]=d.useState(null),le=fe(),ce=me(),de=xe()?Z:Z.filter(a=>a!=="Model"),[$,ue]=d.useState(!1),K=!S&&!t&&typeof window<"u"&&!window.ogb&&le===!0,P=d.useRef(null),C=d.useRef(s);C.current=s,d.useEffect(()=>{let a=!1;return L("/api/bot-defaults").then(f=>{if(a)return;const h=ge(f,!t),b=t||!i?void 0:se(i),y=new H(b?ye(h,b):h,()=>v(T=>T+1));b&&(y.role=b.id),m(y),E(!0)}).catch(f=>{a||R(String(f))}),()=>{a=!0}},[t,i]),d.useEffect(()=>(w.current=!0,()=>{w.current=!1}),[]),d.useEffect(()=>()=>l.dispose(),[l]),d.useEffect(()=>{g&&P.current?.focus()},[g]),d.useEffect(()=>{const a=document.activeElement instanceof HTMLElement?document.activeElement:null;P.current?.focus();const f=h=>{if(!c())return;const b=P.current;if(!b||h.target instanceof Node&&!b.contains(h.target))return;const y=b.querySelector('[role="dialog"], [role="alertdialog"]');if(y&&y.getClientRects().length||(h.key==="Escape"&&(h.preventDefault(),C.current()),h.key!=="Tab"))return;const T=[...b.querySelectorAll('button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), [tabindex="0"]')].filter(q=>q.getClientRects().length&&!q.closest("[hidden],fieldset:disabled")),M=T[0],I=T.at(-1);if(!M||!I){h.preventDefault(),b.focus();return}h.shiftKey&&(document.activeElement===M||document.activeElement===b)?(h.preventDefault(),I.focus()):!h.shiftKey&&(document.activeElement===I||document.activeElement===b)&&(h.preventDefault(),M.focus())};return window.addEventListener("keydown",f),()=>{window.removeEventListener("keydown",f),a?.isConnected&&a.focus()}},[c]);const V=async()=>{if(!k||x.current||r.state.botCreationPending)return;if(!t&&l.bot.approvalMode==="auto"&&l.bot.computer==="local"&&!l.consent.acknowledgeLocalAuto){D("local");return}const a=K?Me(z,F):S&&$?{ok:!0,visibility:"everyone"}:null;if(a&&!a.ok){R(n("botSettings.visibility.needPeople"));return}x.current=!0,p(!0),R(""),r.dispatch({type:"botCreationPending",on:!0});try{if(t)await L("/api/config",{method:"PATCH",body:JSON.stringify({newBotDefaults:await ke(l)})});else{const{bot:f,warnings:h,paused:b}=await Ne(l,void 0,void 0,void 0,a?.ok?a.visibility:void 0,S?W(Y,l.bot.section,r.state.bots,S)??void 0:void 0);Be(r.dispatch,f,h,{showThreads:ce,source:l.preset?"preset":l.role?"template":"blank",role:l.role,paused:b});try{await o?.(f)}catch(y){r.dispatch({type:"error",message:y instanceof Error?y.message:String(y)})}}x.current=!1,w.current&&C.current()}catch(f){w.current&&R(f instanceof Error?f.message:String(f))}finally{x.current=!1,r.dispatch({type:"botCreationPending",on:!1}),w.current&&p(!1)}},A=l.bot,pe={...r,state:{...r.state,bots:[A,...r.state.bots],routines:l.routines,routineRuns:[],routinesLoadState:"ready"},flushBotPatches:async()=>A,dispatch:a=>{a.type==="updateBot"&&a.botId===l.id?l.patch(a.patch):a.type==="setModel"&&a.botId===l.id?(l.setModel(a.selection),a.resetApprovalToAsk&&l.patch({approvalMode:"ask"})):a.type==="routinePatched"||a.type==="toggleSettings"||r.dispatch(a)}},_=t?n("newBot.defaults"):n("sidebar.newBot");return e.jsx("div",{className:"fixed inset-0 z-[70] flex items-center justify-center bg-black/60 p-3 sm:p-5",hidden:!t&&r.state.appSettingsOpen,children:e.jsxs("div",{ref:P,role:"dialog","aria-modal":"true","aria-label":_,"aria-busy":g,tabIndex:-1,className:"flex h-[min(760px,94dvh)] w-full max-w-[900px] flex-col overflow-hidden rounded-2xl border border-hairline/50 bg-panel shadow-2xl outline-none",children:[e.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-hairline/40 px-5 py-4",children:[e.jsx("h2",{className:"text-[17px] font-semibold text-ink",children:_}),e.jsx("button",{type:"button",onClick:()=>C.current(),"aria-label":n("common.close"),className:"flex size-8 shrink-0 items-center justify-center rounded-lg text-ink-secondary hover:bg-control hover:text-ink disabled:opacity-40",children:e.jsx(he,{size:18,className:"pointer-events-none"})})]}),S&&!t&&U&&e.jsx(Je,{team:U,everyone:$,disabled:g,onChange:ue}),K&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2 px-5 pt-3 text-[13px] text-ink-secondary","data-new-bot-visibility":!0,children:[e.jsxs("label",{className:"flex items-center gap-2",children:[n("botSettings.visibility.title"),e.jsxs(N,{size:"sm",value:z,disabled:g,onChange:a=>ae(a.target.value),children:[e.jsx("option",{value:"everyone",children:n("botSettings.visibility.everyone")}),e.jsx("option",{value:"admins",children:n("botSettings.visibility.admins")}),e.jsx("option",{value:"people",children:n("botSettings.visibility.people")})]})]}),z==="people"&&e.jsx("input",{value:F,disabled:g,onChange:a=>ie(a.target.value),placeholder:n("botSettings.visibility.peoplePlaceholder"),"aria-label":n("botSettings.visibility.peopleLabel"),className:"min-w-[16rem] flex-1 rounded-lg border border-hairline/40 bg-inset px-3 py-1.5 text-[13px] text-ink placeholder:text-ink-secondary focus:outline-none"})]}),e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col sm:flex-row",children:[e.jsx("nav",{"aria-label":n("newBot.sections"),className:"flex shrink-0 gap-1 overflow-x-auto border-b border-hairline/40 p-2 sm:w-40 sm:flex-col sm:border-b-0 sm:border-r",children:de.map(a=>e.jsx("button",{type:"button",onClick:()=>O(a),"aria-current":j===a?"page":void 0,className:Q("shrink-0 rounded-lg px-3 py-2 text-left text-[13px]",j===a?"bg-control text-ink":"text-ink-secondary hover:bg-control/50"),children:n(He[a])},a))}),e.jsxs("div",{className:"min-h-0 min-w-0 flex-1 overflow-y-auto p-4 sm:p-5",children:[!k&&!B&&e.jsxs("div",{role:"status",className:"flex items-center gap-2 text-[13px] text-ink-secondary",children:[e.jsx(X,{size:16,className:"animate-spin"}),n("newBot.loading")]}),k&&e.jsx("fieldset",{disabled:g,className:"min-w-0",children:e.jsx(ve,{value:pe,children:e.jsx(je.Provider,{value:{request:l.request,draft:!0,uploadAvatar:l.uploadAvatar},children:e.jsx(Xe,{active:j,draft:l,defaultsMode:t,owner:S&&!t?{value:W(Y,A.section,r.state.bots,S),choose:re}:void 0})})})})]})]}),B&&e.jsx("p",{role:"alert",className:"max-h-24 overflow-y-auto border-t border-hairline/40 px-5 py-3 text-[13px] text-danger",children:B}),e.jsxs("div",{className:"flex shrink-0 justify-end gap-2 border-t border-hairline/40 px-5 py-3",children:[e.jsx("button",{type:"button",onClick:()=>C.current(),className:"rounded-lg px-4 py-2 text-[13px] text-ink-secondary hover:bg-control",children:n("common.cancel")}),e.jsxs("button",{type:"button",disabled:!k||g||!t&&!A.name.trim(),onClick:()=>{V()},className:"ui-button-primary flex items-center gap-2 rounded-lg bg-accent px-5 py-2 text-[13px] font-medium text-white hover:brightness-110 disabled:opacity-40",children:[g&&e.jsx(X,{size:15,className:"animate-spin"}),n(t?"newBot.saveDefaults":"newBot.create")]})]}),e.jsx(we,{open:oe==="local",onCancel:()=>D(null),onConfirm:()=>{l.consent.acknowledgeLocalAuto=!0,D(null),V()}})]})})}function Je({team:t,everyone:s,disabled:o,onChange:i}){return e.jsxs("label",{"data-new-bot-shared":s?"everyone":"me",className:"flex flex-wrap items-center gap-2 border-b border-hairline/40 bg-raised/30 px-5 py-2.5 text-[13px] text-ink-secondary",children:[n("botAccess.general"),e.jsxs(N,{size:"sm",value:s?"everyone":"me",disabled:o,onChange:c=>i(c.target.value==="everyone"),children:[e.jsx("option",{value:"me",children:n("teamSide.me")}),e.jsx("option",{value:"everyone",children:n("teamSettings.everyone",{team:t})})]})]})}function Xe({active:t,draft:s,defaultsMode:o,owner:i}){const c=s.bot,{state:r}=ee(),v=te(),l=Se(c);return t==="Identity"?e.jsxs("div",{className:"space-y-4",children:[e.jsx(Ze,{draft:s,defaultsMode:o}),e.jsx(Pe,{bot:c,patch:l.patch,activeState:l.activeState,mascotMotion:null,namePlaceholder:o?n("newBot.randomName"):void 0}),e.jsxs("label",{className:"block text-[13px] text-ink-secondary",children:[n("newBot.team"),e.jsxs(N,{size:"lg",className:"mt-1.5 w-full",value:c.section??"",onChange:m=>s.patch({section:m.target.value}),children:[e.jsx("option",{value:"",children:n("teamSettings.general")}),[...new Set([...r.sections??[],...r.bots.map(m=>m.section??"")])].filter(Boolean).map(m=>e.jsx("option",{children:m},m))]})]}),i&&v&&e.jsxs("label",{className:"block text-[13px] text-ink-secondary","data-new-bot-reports-to":!0,children:[n("lookedAfter.owner"),e.jsx(N,{size:"lg",className:"mt-1.5 w-full",value:i.value??"",onChange:m=>i.choose(m.target.value),children:v.people.map(m=>e.jsx("option",{value:m.email,children:m.you?n("owner.you",{name:m.name}):m.name},m.email))}),e.jsx("span",{className:"mt-1 block text-[12px]",children:n("lookedAfter.pickHint")})]})]}):t==="Soul"?e.jsx(Ae,{bot:c,patch:l.patch}):t==="Skills"?e.jsx(Te,{bot:c}):t==="Memory"?e.jsx(Qe,{draft:s}):t==="Routines"?e.jsx(et,{draft:s}):t==="Access"?e.jsx(Le,{bot:c,derived:l}):t==="Model"?e.jsx(Oe,{bot:c}):t==="Permissions"?e.jsx(De,{bot:c,derived:l}):e.jsx(ze,{bot:c,derived:l})}function Ze({draft:t,defaultsMode:s}){const[o,i]=d.useState([]),[c,r]=d.useState(0),[v,l]=d.useState(""),m=d.useRef(!1);d.useEffect(()=>{if(s)return;let u=!1;return L("/api/bot-presets").then(p=>{u||i(p.presets)}).catch(()=>{u||i([])}),()=>{u=!0}},[s,c]);const j=t.preset?o.find(u=>u.id===t.preset.id):void 0,O=async u=>{l("");const p=u.startsWith("preset:")?o.find(x=>x.id===u.slice(7)):void 0;if(!p){t.choosePreset(void 0);const x=G.find(B=>B.id===u);t.chooseRole(x?.id);const w=x&&se(x.id)?.look;x&&t.patch({...Ce(x),...w});return}t.patch(Ke(p)),t.choosePreset(qe(p));const g=Ve(p);try{g?(t.patch({avatarUrl:await t.uploadAvatar(g),avatarCrop:p.bot.appearance.avatar.crop}),m.current=!0):m.current&&(t.patch({avatarUrl:""}),m.current=!1)}catch(x){l(x instanceof Error?x.message:String(x))}},k=async u=>{l("");try{await L(`/api/bot-presets/${encodeURIComponent(u.id)}`,{method:"DELETE"}),t.preset?.id===u.id&&t.choosePreset(void 0),r(p=>p+1)}catch(p){l(p instanceof Error?p.message:String(p))}},E=G.map(u=>e.jsx("option",{value:u.id,children:u.title},u.id));return e.jsxs("div",{children:[e.jsxs("label",{className:"block text-[13px] text-ink-secondary",children:[n("newBot.startingRole"),e.jsxs(N,{size:"lg",className:"mt-1.5 w-full",value:t.preset?`preset:${t.preset.id}`:"",onChange:u=>{O(u.target.value)},children:[e.jsx("option",{value:"",children:n("newBot.customSettings")}),$e(o).map(u=>e.jsx("optgroup",{label:u.label,children:u.presets.map(p=>e.jsx("option",{value:`preset:${p.id}`,children:p.name},p.id))},u.label)),o.length?e.jsx("optgroup",{label:n("newBot.builtInRoles"),children:E}):E]})]}),j&&e.jsxs("div",{className:"mt-2 space-y-1 rounded-lg bg-card px-3 py-2.5 text-[13px] text-ink-secondary","data-new-bot-preset":!0,children:[_e(j).map((u,p)=>e.jsx("p",{className:"break-words",children:u},p)),j.source==="file"&&e.jsx("button",{type:"button",onClick:()=>{k(j)},className:"mt-1 rounded-md px-2 py-1 text-[12px] text-ink-secondary hover:bg-control hover:text-ink",children:n("newBot.presetRemove")})]}),v&&e.jsx("p",{role:"alert",className:"mt-2 text-[13px] text-danger",children:v})]})}function Qe({draft:t}){const[s,o]=d.useState("MEMORY.md"),[i,c]=d.useState("");return e.jsxs("div",{className:"space-y-3",children:[e.jsx(N,{size:"lg",className:"w-full","aria-label":n("memory.fileLabel",{path:s}),value:s,onChange:r=>o(r.target.value),children:[...new Set(["MEMORY.md",...Object.keys(t.template.memory)])].map(r=>e.jsx("option",{children:r},r))}),e.jsx("textarea",{className:Q(J,"min-h-72 font-mono"),"aria-label":n("memory.contents"),value:t.template.memory[s]??"",onChange:r=>t.setMemory(s,r.target.value)}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{className:J,"aria-label":n("memory.newTopicLabel"),placeholder:n("memory.newTopicLabel"),value:i,onChange:r=>c(r.target.value)}),e.jsx("button",{type:"button","aria-label":n("memory.addTopic"),disabled:!/^[a-zA-Z0-9_-]+$/.test(i),className:"rounded-lg bg-control px-3 disabled:opacity-40",onClick:()=>{const r=`memory/${i}.md`;r in t.template.memory||t.setMemory(r,""),o(r),c("")},children:e.jsx(Ye,{size:16})}),s!=="MEMORY.md"&&e.jsx("button",{type:"button","aria-label":n("memory.removeTopic"),className:"rounded-lg bg-control px-3",onClick:()=>{t.setMemory(s,null),o("MEMORY.md")},children:e.jsx(ne,{size:16})})]})]})}function et({draft:t}){const[s,o]=d.useState(null);return e.jsxs("div",{className:"space-y-3",children:[e.jsx("button",{type:"button",className:"rounded-lg bg-accent px-3 py-2 text-[13px] text-white",onClick:()=>o("new"),children:n("computer.routines.create")}),t.routines.map(i=>e.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-card p-3",children:[e.jsx("button",{type:"button",className:"min-w-0 flex-1 text-left text-[13px]",onClick:()=>o(i),children:i.name}),e.jsxs("label",{className:"flex items-center gap-1.5 text-[12px] text-ink-secondary",children:[e.jsx("input",{type:"checkbox",checked:i.enabled,onChange:c=>t.setRoutineEnabled(i.id,c.target.checked)}),n("newBot.enabled")]}),e.jsx("button",{type:"button","aria-label":n("newBot.removeRoutine",{name:i.name}),onClick:()=>t.removeRoutine(i.id),className:"rounded p-1.5 hover:bg-control",children:e.jsx(ne,{size:15})})]},i.id)),s&&e.jsx(Ie,{routine:s==="new"?void 0:s,bots:[t.bot],lockedBotId:t.id,onClose:()=>o(null)})]})}function gt({simple:t=!1}){const[s,o]=d.useState(!1),i=s&&e.jsx(We,{defaultsMode:!0,onClose:()=>o(!1)});if(t)return e.jsxs(e.Fragment,{children:[e.jsx(Ee,{title:n("newBot.defaults"),subtitle:n("settings.newBot.defaultsLine"),onClick:()=>o(!0),data:{"data-new-bot-defaults":""}}),i]});const c=e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex shrink-0 gap-2",children:e.jsx("button",{type:"button",onClick:()=>o(!0),className:"cursor-pointer rounded-lg bg-control px-3 py-1.5 text-[13px] text-ink hover:bg-raised-hover",children:n("newBot.edit")})}),i]});return e.jsx(Re,{title:n("newBot.defaults"),children:c})}export{gt as DefaultBotSettings,We as NewBotDialog};
|
|
1
|
+
import{t as n,j as e,r as d,x as me,y as xe,X as he,a as Q}from"./styles-3g-ZPS7M.js";import{u as ee,ar as H,as as be,at as te,au as fe,g as L,av as ge,aw as se,ax as ye,y as N,ay as ve,az as je,aA as W,aB as we,aC as Se,aD as ke,aE as Ne,aF as Be,aG as G,T as ne,aH as Ce,h as Ee,aI as Re}from"./App-h8WTNY4l.js";import{I as Pe,S as Ae,a as Te,A as Le,M as Oe,P as De,V as ze,v as Me,i as J}from"./VisibilitySection-CFr6fOzq.js";import{R as Ie}from"./RoutinesPage-B9kKyfFp.js";import{f as Fe,g as Ue,L as X,P as Ye}from"./PlacesRail-Df-jNTHn.js";import"./index-DtDQrExn.js";import"./MenuMotion-CHp-hB40.js";import"./monitor-DMPjQDZP.js";import"./org-library-IKFXm7D6.js";import"./package-format-COujx3jP.js";import"./mcp-servers-Tb2cnkiM.js";import"./WorksOnGrid-B3wYro9M.js";import"./phones-CINpTjZv.js";import"./memory-BNaMRI5v.js";import"./ProIntroduction-D8hWm9R5.js";import"./remote-desktop-CsSfkXSy.js";import"./placement-BKtVnQht.js";function $e(t){const s=[];for(const o of t){const i=o.source==="org"?n("newBot.presetsFromOrganization",{name:o.publisherName??o.packageName}):n("newBot.presetsImported"),c=s.find(r=>r.label===i);c?c.presets.push(o):s.push({label:i,presets:[o]})}return s}function Ke(t){const s={name:t.bot.name??t.name,title:t.bot.title??"",description:t.bot.description??"",soul:t.bot.soul??""},o=t.bot.appearance;return o&&(s.color=o.color,s.mascotExpression=o.mascotExpression??null,o.mascotBody&&(s.mascotBody=o.mascotBody)),s}function Ve(t){const s=t.bot.appearance?.avatar;if(!s)return null;let o;try{o=atob(s.data)}catch{return null}const i=new Uint8Array(o.length);for(let c=0;c<o.length;c+=1)i[c]=o.charCodeAt(c);return new File([i],`preset.${s.mime.slice(6)}`,{type:s.mime})}function _e(t){const s=[t.source==="org"&&t.publisherName?n("newBot.presetFromOrg",{package:t.packageName,release:t.release,publisher:t.publisherName}):n("newBot.presetFrom",{package:t.packageName,release:t.release})];t.description&&s.push(t.description);const o=t.skills.map(i=>i.name).join(", ");return o&&s.push(n(t.skillsEnabled?"newBot.presetSkillsOn":"newBot.presetSkillsOff",{names:o})),t.notes.length&&s.push(n("newBot.presetNotes",{names:t.notes.join(", ")})),t.playbooks.length&&s.push(n("newBot.presetPlaybooks",{names:t.playbooks.join(", ")})),s.push(n("newBot.presetKeeps")),s}function qe(t){return{id:t.id,skills:t.skills.map(s=>s.name),notes:[...t.notes]}}const Z=["Identity","Soul","Skills","Memory","Routines","Access","Model","Permissions","Voice & alerts"],He={Identity:"botSettings.sections.identity",Soul:"botSettings.sections.soul",Skills:"botSettings.sections.skills",Memory:"botSettings.sections.memory",Routines:"botSettings.sections.routines",Access:"botSettings.sections.access",Model:"botSettings.sections.model",Permissions:"botSettings.sections.permissions","Voice & alerts":"botSettings.sections.voice"};function We(t){return e.jsx(Fe,{modal:!0,children:e.jsx(Ge,{...t})})}function Ge({defaultsMode:t=!1,onClose:s,onCreated:o,readyBotId:i}){const c=Ue(),r=ee(),[,v]=d.useState(0),[l,m]=d.useState(()=>new H(be,()=>v(a=>a+1))),[j,O]=d.useState("Identity"),[k,E]=d.useState(!1),[u,p]=d.useState(!1),g=u||r.state.botCreationPending,x=d.useRef(!1),w=d.useRef(!0),[B,R]=d.useState(""),[oe,D]=d.useState(null),[z,ae]=d.useState("everyone"),[F,ie]=d.useState(""),S=te(),U=r.state.config?.team?.name,[Y,re]=d.useState(null),le=fe(),ce=me(),de=xe()?Z:Z.filter(a=>a!=="Model"),[$,ue]=d.useState(!1),K=!S&&!t&&typeof window<"u"&&!window.ogb&&le===!0,P=d.useRef(null),C=d.useRef(s);C.current=s,d.useEffect(()=>{let a=!1;return L("/api/bot-defaults").then(f=>{if(a)return;const h=ge(f,!t),b=t||!i?void 0:se(i),y=new H(b?ye(h,b):h,()=>v(T=>T+1));b&&(y.role=b.id),m(y),E(!0)}).catch(f=>{a||R(String(f))}),()=>{a=!0}},[t,i]),d.useEffect(()=>(w.current=!0,()=>{w.current=!1}),[]),d.useEffect(()=>()=>l.dispose(),[l]),d.useEffect(()=>{g&&P.current?.focus()},[g]),d.useEffect(()=>{const a=document.activeElement instanceof HTMLElement?document.activeElement:null;P.current?.focus();const f=h=>{if(!c())return;const b=P.current;if(!b||h.target instanceof Node&&!b.contains(h.target))return;const y=b.querySelector('[role="dialog"], [role="alertdialog"]');if(y&&y.getClientRects().length||(h.key==="Escape"&&(h.preventDefault(),C.current()),h.key!=="Tab"))return;const T=[...b.querySelectorAll('button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), [tabindex="0"]')].filter(q=>q.getClientRects().length&&!q.closest("[hidden],fieldset:disabled")),M=T[0],I=T.at(-1);if(!M||!I){h.preventDefault(),b.focus();return}h.shiftKey&&(document.activeElement===M||document.activeElement===b)?(h.preventDefault(),I.focus()):!h.shiftKey&&(document.activeElement===I||document.activeElement===b)&&(h.preventDefault(),M.focus())};return window.addEventListener("keydown",f),()=>{window.removeEventListener("keydown",f),a?.isConnected&&a.focus()}},[c]);const V=async()=>{if(!k||x.current||r.state.botCreationPending)return;if(!t&&l.bot.approvalMode==="auto"&&l.bot.computer==="local"&&!l.consent.acknowledgeLocalAuto){D("local");return}const a=K?Me(z,F):S&&$?{ok:!0,visibility:"everyone"}:null;if(a&&!a.ok){R(n("botSettings.visibility.needPeople"));return}x.current=!0,p(!0),R(""),r.dispatch({type:"botCreationPending",on:!0});try{if(t)await L("/api/config",{method:"PATCH",body:JSON.stringify({newBotDefaults:await ke(l)})});else{const{bot:f,warnings:h,paused:b}=await Ne(l,void 0,void 0,void 0,a?.ok?a.visibility:void 0,S?W(Y,l.bot.section,r.state.bots,S)??void 0:void 0);Be(r.dispatch,f,h,{showThreads:ce,source:l.preset?"preset":l.role?"template":"blank",role:l.role,paused:b});try{await o?.(f)}catch(y){r.dispatch({type:"error",message:y instanceof Error?y.message:String(y)})}}x.current=!1,w.current&&C.current()}catch(f){w.current&&R(f instanceof Error?f.message:String(f))}finally{x.current=!1,r.dispatch({type:"botCreationPending",on:!1}),w.current&&p(!1)}},A=l.bot,pe={...r,state:{...r.state,bots:[A,...r.state.bots],routines:l.routines,routineRuns:[],routinesLoadState:"ready"},flushBotPatches:async()=>A,dispatch:a=>{a.type==="updateBot"&&a.botId===l.id?l.patch(a.patch):a.type==="setModel"&&a.botId===l.id?(l.setModel(a.selection),a.resetApprovalToAsk&&l.patch({approvalMode:"ask"})):a.type==="routinePatched"||a.type==="toggleSettings"||r.dispatch(a)}},_=t?n("newBot.defaults"):n("sidebar.newBot");return e.jsx("div",{className:"fixed inset-0 z-[70] flex items-center justify-center bg-black/60 p-3 sm:p-5",hidden:!t&&r.state.appSettingsOpen,children:e.jsxs("div",{ref:P,role:"dialog","aria-modal":"true","aria-label":_,"aria-busy":g,tabIndex:-1,className:"flex h-[min(760px,94dvh)] w-full max-w-[900px] flex-col overflow-hidden rounded-2xl border border-hairline/50 bg-panel shadow-2xl outline-none",children:[e.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-hairline/40 px-5 py-4",children:[e.jsx("h2",{className:"text-[17px] font-semibold text-ink",children:_}),e.jsx("button",{type:"button",onClick:()=>C.current(),"aria-label":n("common.close"),className:"flex size-8 shrink-0 items-center justify-center rounded-lg text-ink-secondary hover:bg-control hover:text-ink disabled:opacity-40",children:e.jsx(he,{size:18,className:"pointer-events-none"})})]}),S&&!t&&U&&e.jsx(Je,{team:U,everyone:$,disabled:g,onChange:ue}),K&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2 px-5 pt-3 text-[13px] text-ink-secondary","data-new-bot-visibility":!0,children:[e.jsxs("label",{className:"flex items-center gap-2",children:[n("botSettings.visibility.title"),e.jsxs(N,{size:"sm",value:z,disabled:g,onChange:a=>ae(a.target.value),children:[e.jsx("option",{value:"everyone",children:n("botSettings.visibility.everyone")}),e.jsx("option",{value:"admins",children:n("botSettings.visibility.admins")}),e.jsx("option",{value:"people",children:n("botSettings.visibility.people")})]})]}),z==="people"&&e.jsx("input",{value:F,disabled:g,onChange:a=>ie(a.target.value),placeholder:n("botSettings.visibility.peoplePlaceholder"),"aria-label":n("botSettings.visibility.peopleLabel"),className:"min-w-[16rem] flex-1 rounded-lg border border-hairline/40 bg-inset px-3 py-1.5 text-[13px] text-ink placeholder:text-ink-secondary focus:outline-none"})]}),e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col sm:flex-row",children:[e.jsx("nav",{"aria-label":n("newBot.sections"),className:"flex shrink-0 gap-1 overflow-x-auto border-b border-hairline/40 p-2 sm:w-40 sm:flex-col sm:border-b-0 sm:border-r",children:de.map(a=>e.jsx("button",{type:"button",onClick:()=>O(a),"aria-current":j===a?"page":void 0,className:Q("shrink-0 rounded-lg px-3 py-2 text-left text-[13px]",j===a?"bg-control text-ink":"text-ink-secondary hover:bg-control/50"),children:n(He[a])},a))}),e.jsxs("div",{className:"min-h-0 min-w-0 flex-1 overflow-y-auto p-4 sm:p-5",children:[!k&&!B&&e.jsxs("div",{role:"status",className:"flex items-center gap-2 text-[13px] text-ink-secondary",children:[e.jsx(X,{size:16,className:"animate-spin"}),n("newBot.loading")]}),k&&e.jsx("fieldset",{disabled:g,className:"min-w-0",children:e.jsx(ve,{value:pe,children:e.jsx(je.Provider,{value:{request:l.request,draft:!0,uploadAvatar:l.uploadAvatar},children:e.jsx(Xe,{active:j,draft:l,defaultsMode:t,owner:S&&!t?{value:W(Y,A.section,r.state.bots,S),choose:re}:void 0})})})})]})]}),B&&e.jsx("p",{role:"alert",className:"max-h-24 overflow-y-auto border-t border-hairline/40 px-5 py-3 text-[13px] text-danger",children:B}),e.jsxs("div",{className:"flex shrink-0 justify-end gap-2 border-t border-hairline/40 px-5 py-3",children:[e.jsx("button",{type:"button",onClick:()=>C.current(),className:"rounded-lg px-4 py-2 text-[13px] text-ink-secondary hover:bg-control",children:n("common.cancel")}),e.jsxs("button",{type:"button",disabled:!k||g||!t&&!A.name.trim(),onClick:()=>{V()},className:"ui-button-primary flex items-center gap-2 rounded-lg bg-accent px-5 py-2 text-[13px] font-medium text-white hover:brightness-110 disabled:opacity-40",children:[g&&e.jsx(X,{size:15,className:"animate-spin"}),n(t?"newBot.saveDefaults":"newBot.create")]})]}),e.jsx(we,{open:oe==="local",onCancel:()=>D(null),onConfirm:()=>{l.consent.acknowledgeLocalAuto=!0,D(null),V()}})]})})}function Je({team:t,everyone:s,disabled:o,onChange:i}){return e.jsxs("label",{"data-new-bot-shared":s?"everyone":"me",className:"flex flex-wrap items-center gap-2 border-b border-hairline/40 bg-raised/30 px-5 py-2.5 text-[13px] text-ink-secondary",children:[n("botAccess.general"),e.jsxs(N,{size:"sm",value:s?"everyone":"me",disabled:o,onChange:c=>i(c.target.value==="everyone"),children:[e.jsx("option",{value:"me",children:n("teamSide.me")}),e.jsx("option",{value:"everyone",children:n("teamSettings.everyone",{team:t})})]})]})}function Xe({active:t,draft:s,defaultsMode:o,owner:i}){const c=s.bot,{state:r}=ee(),v=te(),l=Se(c);return t==="Identity"?e.jsxs("div",{className:"space-y-4",children:[e.jsx(Ze,{draft:s,defaultsMode:o}),e.jsx(Pe,{bot:c,patch:l.patch,activeState:l.activeState,mascotMotion:null,namePlaceholder:o?n("newBot.randomName"):void 0}),e.jsxs("label",{className:"block text-[13px] text-ink-secondary",children:[n("newBot.team"),e.jsxs(N,{size:"lg",className:"mt-1.5 w-full",value:c.section??"",onChange:m=>s.patch({section:m.target.value}),children:[e.jsx("option",{value:"",children:n("teamSettings.general")}),[...new Set([...r.sections??[],...r.bots.map(m=>m.section??"")])].filter(Boolean).map(m=>e.jsx("option",{children:m},m))]})]}),i&&v&&e.jsxs("label",{className:"block text-[13px] text-ink-secondary","data-new-bot-reports-to":!0,children:[n("lookedAfter.owner"),e.jsx(N,{size:"lg",className:"mt-1.5 w-full",value:i.value??"",onChange:m=>i.choose(m.target.value),children:v.people.map(m=>e.jsx("option",{value:m.email,children:m.you?n("owner.you",{name:m.name}):m.name},m.email))}),e.jsx("span",{className:"mt-1 block text-[12px]",children:n("lookedAfter.pickHint")})]})]}):t==="Soul"?e.jsx(Ae,{bot:c,patch:l.patch}):t==="Skills"?e.jsx(Te,{bot:c}):t==="Memory"?e.jsx(Qe,{draft:s}):t==="Routines"?e.jsx(et,{draft:s}):t==="Access"?e.jsx(Le,{bot:c,derived:l}):t==="Model"?e.jsx(Oe,{bot:c}):t==="Permissions"?e.jsx(De,{bot:c,derived:l}):e.jsx(ze,{bot:c,derived:l})}function Ze({draft:t,defaultsMode:s}){const[o,i]=d.useState([]),[c,r]=d.useState(0),[v,l]=d.useState(""),m=d.useRef(!1);d.useEffect(()=>{if(s)return;let u=!1;return L("/api/bot-presets").then(p=>{u||i(p.presets)}).catch(()=>{u||i([])}),()=>{u=!0}},[s,c]);const j=t.preset?o.find(u=>u.id===t.preset.id):void 0,O=async u=>{l("");const p=u.startsWith("preset:")?o.find(x=>x.id===u.slice(7)):void 0;if(!p){t.choosePreset(void 0);const x=G.find(B=>B.id===u);t.chooseRole(x?.id);const w=x&&se(x.id)?.look;x&&t.patch({...Ce(x),...w});return}t.patch(Ke(p)),t.choosePreset(qe(p));const g=Ve(p);try{g?(t.patch({avatarUrl:await t.uploadAvatar(g),avatarCrop:p.bot.appearance.avatar.crop}),m.current=!0):m.current&&(t.patch({avatarUrl:""}),m.current=!1)}catch(x){l(x instanceof Error?x.message:String(x))}},k=async u=>{l("");try{await L(`/api/bot-presets/${encodeURIComponent(u.id)}`,{method:"DELETE"}),t.preset?.id===u.id&&t.choosePreset(void 0),r(p=>p+1)}catch(p){l(p instanceof Error?p.message:String(p))}},E=G.map(u=>e.jsx("option",{value:u.id,children:u.title},u.id));return e.jsxs("div",{children:[e.jsxs("label",{className:"block text-[13px] text-ink-secondary",children:[n("newBot.startingRole"),e.jsxs(N,{size:"lg",className:"mt-1.5 w-full",value:t.preset?`preset:${t.preset.id}`:"",onChange:u=>{O(u.target.value)},children:[e.jsx("option",{value:"",children:n("newBot.customSettings")}),$e(o).map(u=>e.jsx("optgroup",{label:u.label,children:u.presets.map(p=>e.jsx("option",{value:`preset:${p.id}`,children:p.name},p.id))},u.label)),o.length?e.jsx("optgroup",{label:n("newBot.builtInRoles"),children:E}):E]})]}),j&&e.jsxs("div",{className:"mt-2 space-y-1 rounded-lg bg-card px-3 py-2.5 text-[13px] text-ink-secondary","data-new-bot-preset":!0,children:[_e(j).map((u,p)=>e.jsx("p",{className:"break-words",children:u},p)),j.source==="file"&&e.jsx("button",{type:"button",onClick:()=>{k(j)},className:"mt-1 rounded-md px-2 py-1 text-[12px] text-ink-secondary hover:bg-control hover:text-ink",children:n("newBot.presetRemove")})]}),v&&e.jsx("p",{role:"alert",className:"mt-2 text-[13px] text-danger",children:v})]})}function Qe({draft:t}){const[s,o]=d.useState("MEMORY.md"),[i,c]=d.useState("");return e.jsxs("div",{className:"space-y-3",children:[e.jsx(N,{size:"lg",className:"w-full","aria-label":n("memory.fileLabel",{path:s}),value:s,onChange:r=>o(r.target.value),children:[...new Set(["MEMORY.md",...Object.keys(t.template.memory)])].map(r=>e.jsx("option",{children:r},r))}),e.jsx("textarea",{className:Q(J,"min-h-72 font-mono"),"aria-label":n("memory.contents"),value:t.template.memory[s]??"",onChange:r=>t.setMemory(s,r.target.value)}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{className:J,"aria-label":n("memory.newTopicLabel"),placeholder:n("memory.newTopicLabel"),value:i,onChange:r=>c(r.target.value)}),e.jsx("button",{type:"button","aria-label":n("memory.addTopic"),disabled:!/^[a-zA-Z0-9_-]+$/.test(i),className:"rounded-lg bg-control px-3 disabled:opacity-40",onClick:()=>{const r=`memory/${i}.md`;r in t.template.memory||t.setMemory(r,""),o(r),c("")},children:e.jsx(Ye,{size:16})}),s!=="MEMORY.md"&&e.jsx("button",{type:"button","aria-label":n("memory.removeTopic"),className:"rounded-lg bg-control px-3",onClick:()=>{t.setMemory(s,null),o("MEMORY.md")},children:e.jsx(ne,{size:16})})]})]})}function et({draft:t}){const[s,o]=d.useState(null);return e.jsxs("div",{className:"space-y-3",children:[e.jsx("button",{type:"button",className:"rounded-lg bg-accent px-3 py-2 text-[13px] text-white",onClick:()=>o("new"),children:n("computer.routines.create")}),t.routines.map(i=>e.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-card p-3",children:[e.jsx("button",{type:"button",className:"min-w-0 flex-1 text-left text-[13px]",onClick:()=>o(i),children:i.name}),e.jsxs("label",{className:"flex items-center gap-1.5 text-[12px] text-ink-secondary",children:[e.jsx("input",{type:"checkbox",checked:i.enabled,onChange:c=>t.setRoutineEnabled(i.id,c.target.checked)}),n("newBot.enabled")]}),e.jsx("button",{type:"button","aria-label":n("newBot.removeRoutine",{name:i.name}),onClick:()=>t.removeRoutine(i.id),className:"rounded p-1.5 hover:bg-control",children:e.jsx(ne,{size:15})})]},i.id)),s&&e.jsx(Ie,{routine:s==="new"?void 0:s,bots:[t.bot],lockedBotId:t.id,onClose:()=>o(null)})]})}function gt({simple:t=!1}){const[s,o]=d.useState(!1),i=s&&e.jsx(We,{defaultsMode:!0,onClose:()=>o(!1)});if(t)return e.jsxs(e.Fragment,{children:[e.jsx(Ee,{title:n("newBot.defaults"),subtitle:n("settings.newBot.defaultsLine"),onClick:()=>o(!0),data:{"data-new-bot-defaults":""}}),i]});const c=e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex shrink-0 gap-2",children:e.jsx("button",{type:"button",onClick:()=>o(!0),className:"cursor-pointer rounded-lg bg-control px-3 py-1.5 text-[13px] text-ink hover:bg-raised-hover",children:n("newBot.edit")})}),i]});return e.jsx(Re,{title:n("newBot.defaults"),children:c})}export{gt as DefaultBotSettings,We as NewBotDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as s,j as t,t as o}from"./styles-
|
|
1
|
+
import{r as s,j as t,t as o}from"./styles-3g-ZPS7M.js";import{r as d}from"./PlacesRail-Df-jNTHn.js";import"./placement-BKtVnQht.js";import"./monitor-DMPjQDZP.js";function f({open:l,onClose:r,connect:a=[]}){const i=s.useRef(null);if(s.useEffect(()=>{if(!l)return;i.current?.focus();const e=n=>{n.key==="Escape"&&(n.preventDefault(),r())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[l,r]),!l)return null;const c=t.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-6",onMouseDown:e=>e.target===e.currentTarget&&r(),children:t.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"phone-app-dialog-title",className:"max-h-full w-full max-w-[460px] overflow-y-auto rounded-2xl border border-hairline/50 bg-panel p-6 shadow-2xl",children:[t.jsx("h2",{id:"phone-app-dialog-title",className:"text-[17px] font-semibold text-ink",children:o("sidebar.menu.connectPhone")}),a.length?t.jsx("div",{className:"mt-4 flex flex-col gap-2",children:a.map((e,n)=>t.jsxs("button",{type:"button","data-phone-app-connect":e.key,onClick:()=>{r(),e.onSelect()},className:n===0?"flex w-full flex-col items-center rounded-xl bg-accent px-4 py-2 text-[13px] font-medium text-accent-ink hover:opacity-90":"flex w-full flex-col items-center rounded-xl border border-hairline/50 px-4 py-2 text-[13px] font-medium text-ink hover:bg-raised",children:[t.jsx("span",{children:o("sidebar.menu.connectPhone")}),t.jsx("span",{className:"text-[12px] font-normal opacity-80",children:e.subtitle})]},e.key))}):null,t.jsx("button",{ref:i,type:"button",onClick:r,className:"mt-3 w-full rounded-xl bg-raised px-4 py-2 text-[13px] font-medium text-ink hover:brightness-110",children:o("common.close")})]})});return typeof document>"u"?c:d.createPortal(c,document.body)}export{f as PhoneAppDialog};
|