limixbot 0.3.24 → 0.3.26
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-BjjmX49M.js → ActivityPanel-DkwIh-YJ.js} +1 -1
- package/dist/assets/{App-BWtQhGWp.js → App-DCe3hDbm.js} +119 -119
- package/dist/assets/{AppEventEditor-Bq1-MGxi.js → AppEventEditor-25dBAYiN.js} +1 -1
- package/dist/assets/BotSettingsDialog-DJxZo-ro.js +16 -0
- package/dist/assets/{BrowserPanel-CPLcno_m.js → BrowserPanel-DVji4pZh.js} +1 -1
- package/dist/assets/{BrowserProfilesManager-D9JsCp1k.js → BrowserProfilesManager-C4rCEedT.js} +1 -1
- package/dist/assets/{CloudAddDialog-DcmN7A5a.js → CloudAddDialog-BybF9Mcz.js} +1 -1
- package/dist/assets/{ComputerFilesPane-Bjx6TGmM.js → ComputerFilesPane-D-EgbYKM.js} +1 -1
- package/dist/assets/{ComputerPanel-C9Xx4Ifs.js → ComputerPanel-CGKdVGz4.js} +2 -2
- package/dist/assets/{DataPanel-IfpQCi3b.js → DataPanel-BXh6perv.js} +1 -1
- package/dist/assets/{DesktopViewer-RjjUUlrQ.js → DesktopViewer-CRcjWYHe.js} +1 -1
- package/dist/assets/{FilesView-D_0GwHAN.js → FilesView-B67sskTN.js} +1 -1
- package/dist/assets/{GrokMoveDialog-CUie-0en.js → GrokMoveDialog-DNJckF5G.js} +1 -1
- package/dist/assets/{InspectorPanel-BuFL6wWf.js → InspectorPanel-CjtRMfJu.js} +1 -1
- package/dist/assets/{KeyboardShortcutsModal-uOhXagTA.js → KeyboardShortcutsModal-znw4NkA5.js} +1 -1
- package/dist/assets/{LiveDesktop-BwpZa-Ri.js → LiveDesktop-BgFrQKAC.js} +1 -1
- package/dist/assets/{LocalVmWorkspace-CousHKOb.js → LocalVmWorkspace-Dk61S9xg.js} +1 -1
- package/dist/assets/{MacLocalControl-BKDzplO2.js → MacLocalControl-DjyhCaWB.js} +1 -1
- package/dist/assets/{MarkdownFilePreview-CCwc1Tek.js → MarkdownFilePreview-Btb--ZSy.js} +1 -1
- package/dist/assets/{MenuMotion-CSgaJLc2.js → MenuMotion-BOUToDZz.js} +1 -1
- package/dist/assets/{NewBotDialog-BtvoCpqN.js → NewBotDialog-CsQPMX7F.js} +1 -1
- package/dist/assets/{PhoneAppDialog-C1hIwyT8.js → PhoneAppDialog-4OG210md.js} +1 -1
- package/dist/assets/{PlacesRail-PP97GpM6.js → PlacesRail-dslg5RRJ.js} +1 -1
- package/dist/assets/{PluginsPanel-DpUEC1zc.js → PluginsPanel-CaWk4eSi.js} +1 -1
- package/dist/assets/{ProIntroduction-C-7uexIW.js → ProIntroduction-BuOIgmKa.js} +1 -1
- package/dist/assets/{RemoteAgentSettingsPanel-DtofJtgF.js → RemoteAgentSettingsPanel-Drk4pPKT.js} +1 -1
- package/dist/assets/{RoomPanel-CHbgQ0xd.js → RoomPanel-BGLIvmBz.js} +1 -1
- package/dist/assets/{RoutinesPage-ZdFTYQc-.js → RoutinesPage-BuAEX1fg.js} +2 -2
- package/dist/assets/SettingsModal-CwK4KFqq.js +19 -0
- package/dist/assets/{ShareTeamDialog-CNu6Kwet.js → ShareTeamDialog-C5Fv8jWl.js} +1 -1
- package/dist/assets/{SignedInSites-CyWcDbLW.js → SignedInSites-BQ2QP4YA.js} +1 -1
- package/dist/assets/TeamLibraryPanel-B0HAAvLv.js +1 -0
- package/dist/assets/{TeamMapPage-C2PnNdil.js → TeamMapPage-DCkx9eov.js} +1 -1
- package/dist/assets/{TriggersPage-B_br6xBZ.js → TriggersPage-B2sqDFfI.js} +1 -1
- package/dist/assets/{VisibilitySection-DH0WrBCn.js → VisibilitySection-CqL-TbZp.js} +1 -1
- package/dist/assets/{WebhookTrigger-BASBoMb_.js → WebhookTrigger-CorVaJKR.js} +1 -1
- package/dist/assets/{WorksOnGrid-CboITAAs.js → WorksOnGrid-1tMl62nD.js} +1 -1
- package/dist/assets/{abnfDiagram-YUKMZFIV-CJ69o_vp.js → abnfDiagram-YUKMZFIV-UeQ15ljp.js} +1 -1
- package/dist/assets/{activity-BdRjGS2C.js → activity-Rykx5lZJ.js} +1 -1
- package/dist/assets/{architectureDiagram-47P4ROYG-BH57AmKC.js → architectureDiagram-47P4ROYG-Cb42ilBV.js} +1 -1
- package/dist/assets/{blockDiagram-E7TT5TSB-D3ebMs_o.js → blockDiagram-E7TT5TSB-BF1yg64q.js} +1 -1
- package/dist/assets/{c4Diagram-CRA5TL53-6TrdcGZR.js → c4Diagram-CRA5TL53-VaNJpISp.js} +1 -1
- package/dist/assets/{calendar-days-DiMBTH2e.js → calendar-days-kC634hX1.js} +1 -1
- package/dist/assets/channel-Di74R1Kh.js +1 -0
- package/dist/assets/{chunk-2Q5K7J3B-BemwHdji.js → chunk-2Q5K7J3B-NtXjlfnQ.js} +1 -1
- package/dist/assets/{chunk-5VM5RSS4-CQZbLBld.js → chunk-5VM5RSS4-CYWCBb40.js} +1 -1
- package/dist/assets/{chunk-7TKQ45FW-Dy6EXFTX.js → chunk-7TKQ45FW-CTx1wLnU.js} +1 -1
- package/dist/assets/{chunk-AW2ZBBNX-BbKGGyK8.js → chunk-AW2ZBBNX-PDrwpbhk.js} +1 -1
- package/dist/assets/{chunk-FVRAUYC3-DHqUalc2.js → chunk-FVRAUYC3-CqIp8Ubp.js} +2 -2
- package/dist/assets/{chunk-HTAEGDNF-B66Vjlwq.js → chunk-HTAEGDNF-yA6riuIr.js} +1 -1
- package/dist/assets/{chunk-JWPE2WC7-DrtdT6L3.js → chunk-JWPE2WC7-DEE_S031.js} +1 -1
- package/dist/assets/{chunk-KQW6MTUR-t7RW8fFT.js → chunk-KQW6MTUR-QybxNtsY.js} +1 -1
- package/dist/assets/{chunk-XXDRQBXY-CntyS42N.js → chunk-XXDRQBXY-BjchQyqU.js} +1 -1
- package/dist/assets/{classDiagram-v2-K4WV4PDN-KlNCgeTt.js → classDiagram-v2-K4WV4PDN-DtOc8Abr.js} +1 -1
- package/dist/assets/{coins-BHKpT34i.js → coins-D0wNJCPg.js} +1 -1
- package/dist/assets/{core-DEy6KDLR.js → core-Blwbk7ct.js} +1 -1
- package/dist/assets/{cose-bilkent-JH36ORCC-C_cXoOGT.js → cose-bilkent-JH36ORCC-CWHsqn7M.js} +1 -1
- package/dist/assets/{cynefin-EF2NZ3EQ-DGuwW5zt.js → cynefin-EF2NZ3EQ-BqS-D9jN.js} +1 -1
- package/dist/assets/{cynefinDiagram-3GCD6N5R-qMzxXkVk.js → cynefinDiagram-3GCD6N5R-Fc51YETb.js} +1 -1
- package/dist/assets/{dagre-W4DXFKR2-Q-osY3Yi.js → dagre-W4DXFKR2-So1kz52t.js} +1 -1
- package/dist/assets/{diagram-2UJZ2QOL-DyVJSBOF.js → diagram-2UJZ2QOL-DpdA_Lk0.js} +1 -1
- package/dist/assets/{diagram-OVF4WLC6-C5qBFdpm.js → diagram-OVF4WLC6-BqSu7ih2.js} +1 -1
- package/dist/assets/{diagram-PFPMY2P6-C1PW3U2P.js → diagram-PFPMY2P6-BoM6YcIG.js} +1 -1
- package/dist/assets/{diagram-UMYRVEAY-D2pa0Mzi.js → diagram-UMYRVEAY-B7wKoLi9.js} +1 -1
- package/dist/assets/{diagram-YEKJPTXX-BIzOA1li.js → diagram-YEKJPTXX-BEXKw540.js} +1 -1
- package/dist/assets/{diagram-ZIFT7M5P-B1UL3O8m.js → diagram-ZIFT7M5P-BAD7sJRi.js} +1 -1
- package/dist/assets/{ebnfDiagram-VR2GEFS7-Cxu-kU8s.js → ebnfDiagram-VR2GEFS7-DILoqvy-.js} +1 -1
- package/dist/assets/{elk-IJKZMXRS-DJS39Bm9.js → elk-IJKZMXRS-BHW-Cxin.js} +1 -1
- package/dist/assets/{erDiagram-O2IAPWRE-Cb31BS5L.js → erDiagram-O2IAPWRE-Blp0Wwq0.js} +1 -1
- package/dist/assets/{file-up-DWGlVRGP.js → file-up-CEuHjVBK.js} +1 -1
- package/dist/assets/{flowDiagram-OXPTDLAJ-BaPTzS6m.js → flowDiagram-OXPTDLAJ-6SkVmYje.js} +1 -1
- package/dist/assets/{ganttDiagram-R7TSEDQI-B_Lr-26i.js → ganttDiagram-R7TSEDQI-DFDwj8QX.js} +1 -1
- package/dist/assets/{gitGraphDiagram-XJZIOB7I-UHyDFX6a.js → gitGraphDiagram-XJZIOB7I-mtJG-sis.js} +1 -1
- package/dist/assets/{import-name-Cxwtm5XO.js → import-name-B3mVDURb.js} +1 -1
- package/dist/assets/{index-BME9PdWM.js → index-BZOGYABm.js} +1 -1
- package/dist/assets/{index-BSrb6nsc.js → index-D2Jm8LAf.js} +2 -2
- package/dist/assets/{infoDiagram-5W2HQ5XZ-B7ovBJYA.js → infoDiagram-5W2HQ5XZ-CmyXB17U.js} +1 -1
- package/dist/assets/{ishikawaDiagram-K3B6WC7H-BYS-TlrF.js → ishikawaDiagram-K3B6WC7H-BKFtIESa.js} +1 -1
- package/dist/assets/{journeyDiagram-COXZFDF6-jJxKYEtT.js → journeyDiagram-COXZFDF6-DuXMREdz.js} +1 -1
- package/dist/assets/{kanban-definition-P3RFRI5V-DyiFYaIK.js → kanban-definition-P3RFRI5V-B9mWvKdh.js} +1 -1
- package/dist/assets/{mcp-servers-DXFuhTlS.js → mcp-servers-D3PCWkFu.js} +1 -1
- package/dist/assets/{mermaid.core-D3YJgsiB.js → mermaid.core-3c-Lql2y.js} +4 -4
- package/dist/assets/{mindmap-definition-LZFPQGKD-DnbWodUY.js → mindmap-definition-LZFPQGKD-BmLt9bkD.js} +1 -1
- package/dist/assets/{minimize-Af1aU3Tz.js → minimize-BfKI3Nbu.js} +1 -1
- package/dist/assets/{monitor-DuYHWIyw.js → monitor-C-EBTsrK.js} +1 -1
- package/dist/assets/{new-bot-TwOnvVO1.js → new-bot-3sQib6nJ.js} +1 -1
- package/dist/assets/{org-library-BLD6YHcM.js → org-library-DHuACSMf.js} +1 -1
- package/dist/assets/{package-format-72bbOy2w.js → package-format-CAZ-xCP-.js} +1 -1
- package/dist/assets/{pegDiagram-BGZESJAR-CcOuP6zx.js → pegDiagram-BGZESJAR-5w1MTtLg.js} +1 -1
- package/dist/assets/{pieDiagram-CAPJLFHJ-DhCU7Sfy.js → pieDiagram-CAPJLFHJ-C4etNvsK.js} +1 -1
- package/dist/assets/{quadrantDiagram-GDMTTRAM-7OziX26h.js → quadrantDiagram-GDMTTRAM-k4cDUeIN.js} +1 -1
- package/dist/assets/{rail-DI2iZJYt.js → rail-C6qkoJbO.js} +1 -1
- package/dist/assets/{railroadDiagram-SM67HX2B-rg44R4U2.js → railroadDiagram-SM67HX2B-B9d0qasL.js} +1 -1
- package/dist/assets/{remote-desktop-panel-BPKKvcHT.js → remote-desktop-panel-sCBdOaQh.js} +1 -1
- package/dist/assets/{requirementDiagram-X7JNWC4A-DFNvg72O.js → requirementDiagram-X7JNWC4A-BlYV4z86.js} +1 -1
- package/dist/assets/{sankeyDiagram-UM26HJRW-CUOrQF2i.js → sankeyDiagram-UM26HJRW-DaIVWJEd.js} +1 -1
- package/dist/assets/{sequenceDiagram-ZO4K6R2Y-4HKsH1wt.js → sequenceDiagram-ZO4K6R2Y-CAnXpud0.js} +1 -1
- package/dist/assets/{sizeCapture-INFHLROL-BEXQDTx-.js → sizeCapture-INFHLROL-BIeqIcHi.js} +1 -1
- package/dist/assets/{stateDiagram-v2-TBUQTH76-BYBLUqiy.js → stateDiagram-v2-TBUQTH76-7ql5dn9y.js} +1 -1
- package/dist/assets/{styles-C2_XZv1s.js → styles-BRMaHK08.js} +3 -3
- package/dist/assets/{swimlanes-N4OXWK64-D-bp8wWN.js → swimlanes-N4OXWK64-CItt-UlU.js} +1 -1
- package/dist/assets/swimlanesDiagram-K3J5GTZL-DAZsljU6.js +8 -0
- package/dist/assets/{team-share-Dpu1nJNz.js → team-share-2OjfOHsk.js} +1 -1
- package/dist/assets/{timeline-definition-YOQAKGHF-CtLFkcud.js → timeline-definition-YOQAKGHF-8Xn9QBNo.js} +1 -1
- package/dist/assets/{usecaseDiagram-VIAY4XPW-AWOhUKvG.js → usecaseDiagram-VIAY4XPW-B6LxotkO.js} +1 -1
- package/dist/assets/{vennDiagram-BLWOH2XV-C_OYDBvp.js → vennDiagram-BLWOH2XV-Ciex0LDC.js} +1 -1
- package/dist/assets/{vi-P4zxF4j0.js → vi-C-E3a4Tv.js} +2 -2
- package/dist/assets/{wardleyDiagram-YMQ3BMBF-CdxMh8tE.js → wardleyDiagram-YMQ3BMBF-B_TbpQlN.js} +1 -1
- package/dist/assets/{xychartDiagram-TAQBALBS-BL2spC5z.js → xychartDiagram-TAQBALBS-Dz_iIYt1.js} +1 -1
- package/dist/index.html +2 -2
- package/dist/rail.html +4 -4
- package/dist-server/index.js +272 -252
- package/dist-server/openmausbot.js +1 -1
- package/dist-server/package.json +1 -1
- package/dist-server/pair-cli.js +1 -1
- package/dist-server/server/imported-skills.js +7 -2
- package/dist-server/server/index.js +7 -5
- package/dist-server/server/limix-bot-library.js +15 -8
- package/dist-server/server/limix-lang.js +2 -0
- package/dist-server/server/limix-skill-hub.js +20 -19
- package/dist-server/server/limix-skill-store.js +180 -0
- package/dist-server/server/routes/bot-skills.js +15 -4
- package/dist-server/shared/first-reply-rescue.js +4 -3
- package/package.json +1 -1
- package/skills/windows-computer-automation/SKILL.md +53 -0
- package/skills/windows-computer-automation/assets/HERIONIX-LEADER-PROMPT.md +25 -0
- package/skills/windows-computer-automation/assets/control-policy.example.json +25 -0
- package/skills/windows-computer-automation/assets/mcp-servers.example.json +19 -0
- package/skills/windows-computer-automation/manifest.json +27 -0
- package/skills/windows-computer-automation/references/herionix-integration.md +72 -0
- package/skills/windows-computer-automation/references/routing.md +26 -0
- package/skills/windows-computer-automation/references/scenarios.md +44 -0
- package/skills/windows-computer-automation/references/security.md +24 -0
- package/skills/windows-computer-automation/scripts/policy_engine.py +235 -0
- package/skills/windows-computer-automation/scripts/test_policy_engine.py +107 -0
- package/dist/assets/BotSettingsDialog-CVlvG4Rb.js +0 -16
- package/dist/assets/SettingsModal-Cdz3bEYZ.js +0 -15
- package/dist/assets/TeamLibraryPanel-DMhdlaSH.js +0 -1
- package/dist/assets/channel-k2J2GMwv.js +0 -1
- package/dist/assets/swimlanesDiagram-K3J5GTZL-DTQBdgKt.js +0 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as W,r as s,t,j as e,a as d,C as X,X as $}from"./styles-
|
|
1
|
+
import{c as W,r as s,t,j as e,a as d,C as X,X as $}from"./styles-BRMaHK08.js";import{c as G,D as J,t as Q}from"./desktop-connection-Dfaq6k5a.js";import{u as Y,a as Z,K as ee,R as te,C as ne,S as se}from"./MenuMotion-BOUToDZz.js";import{M as oe}from"./monitor-C-EBTsrK.js";import{M as ie,a as re}from"./minimize-BfKI3Nbu.js";import"./desktop-viewer-CF-OpSo0.js";const ae=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]],le=W("clipboard",ae);function ce(u){return window.addEventListener("hashchange",u),()=>window.removeEventListener("hashchange",u)}const de=()=>location.hash;function me(){const u=s.useRef(null),o=s.useRef(null),[v,m]=s.useState(0),[x,p]=s.useState("connecting"),i=x==="connected",L=t(`desktopViewer.${x}`),[a,w]=s.useState(null),[b,S]=s.useState(!0),[f,B]=s.useState(!1),[M,P]=s.useState(""),[H,k]=s.useState(""),g=Y(a),y=Z(!b),r=g.value==="keyboard",R=s.useRef(a);R.current=a;const[j,C]=s.useState(""),O=s.useSyncExternalStore(ce,de),D=new URLSearchParams(O.slice(1)),N=D.get("target"),V=D.get("threadId");s.useEffect(()=>{k(""),C(""),w(null)},[N,V]),s.useEffect(()=>{const n=new AbortController;let l;const q=document.title;document.title=t("desktopViewer.title"),p("connecting"),G(u.current,N??"",{threadId:V,signal:n.signal,events:{connected:()=>p("connected"),disconnected:()=>p("disconnected"),clipboard:k}}).then(c=>{if(n.signal.aborted)return c.disconnect();l=c,o.current=c,c.focusOnClick=R.current===null},c=>{n.signal.aborted||p(c instanceof J&&c.invalid?"invalid":"disconnected")});const z=()=>{n.abort(),l?.disconnect()},K=c=>{c.persisted&&m(U=>U+1)};return window.addEventListener("pagehide",z),window.addEventListener("pageshow",K),()=>{z(),o.current===l&&(o.current=null),window.removeEventListener("pagehide",z),window.removeEventListener("pageshow",K),document.title=q}},[N,V,v]),s.useEffect(()=>{o.current&&(o.current.focusOnClick=a===null)},[a]),s.useEffect(()=>{const n=()=>B(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",n),()=>document.removeEventListener("fullscreenchange",n)},[]);const _=async()=>{P("");try{document.fullscreenElement?await document.exitFullscreen():await document.documentElement.requestFullscreen()}catch{P(t("desktopViewer.fullscreenFailed"))}},F=()=>{w(null),a&&document.getElementById(a)?.focus()},I=n=>requestAnimationFrame(()=>document.getElementById(n)?.focus()),T=n=>w(l=>l===n?null:n),A="transition-[width,translate,opacity] duration-[240ms] ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:transition-none",E="ui-button min-h-11 rounded-xl focus-visible:outline-2 focus-visible:outline-focus";return e.jsxs("div",{className:"relative flex h-dvh overflow-hidden bg-app text-sm text-ink",style:{paddingLeft:"env(safe-area-inset-left)",paddingRight:"env(safe-area-inset-right)"},children:[e.jsx("aside",{"aria-label":t("desktopViewer.controls"),"aria-hidden":!b,inert:!b,className:d("z-10 flex shrink-0 items-center justify-center py-3",A,b?"w-[72px]":"w-0"),children:e.jsxs("div",{className:d("flex max-h-full w-14 shrink-0 flex-col items-center gap-1 overflow-y-auto rounded-2xl border border-hairline bg-panel p-1 shadow-xl",A,b?"translate-x-0 opacity-100":"-translate-x-12 opacity-0"),children:[e.jsxs("div",{className:"relative flex h-11 w-11 shrink-0 items-center justify-center text-ink-secondary",title:L,children:[e.jsx(oe,{size:20,"aria-hidden":"true"}),e.jsx("span",{className:d("absolute right-2 bottom-2 size-2 rounded-full ring-2 ring-panel",i?"bg-success":"bg-warning")})]}),e.jsx("div",{className:"my-1 h-px w-7 shrink-0 bg-hairline"}),e.jsx(h,{id:"keyboard",label:t("desktopViewer.keyboard"),icon:ee,disabled:!i,active:a==="keyboard",expanded:a==="keyboard",onClick:()=>T("keyboard")}),e.jsx(h,{id:"clipboard",label:t("desktopViewer.clipboard"),icon:le,disabled:!i,active:a==="clipboard",expanded:a==="clipboard",onClick:()=>T("clipboard")}),document.fullscreenEnabled&&e.jsx(h,{id:"fullscreen",label:t(f?"desktopViewer.exitFullscreen":"desktopViewer.fullscreen"),icon:f?ie:re,onClick:()=>{_()}}),e.jsx("div",{className:"my-1 h-px w-7 shrink-0 bg-hairline"}),e.jsx(h,{id:"retry",label:t("desktopViewer.reconnect"),icon:te,onClick:()=>{k(""),m(n=>n+1)}}),e.jsx(h,{id:"hide-controls",label:t("desktopViewer.hideControls"),icon:X,onClick:()=>{S(!1),w(null),I("show-controls")}})]})}),y.shown&&e.jsx("div",{...y.exitProps,className:d("absolute left-0 top-1/2 z-10 -translate-y-1/2 rounded-r-2xl border border-l-0 border-hairline bg-panel p-1 shadow-xl",y.className),children:e.jsx(h,{id:"show-controls",label:t("desktopViewer.showControls"),icon:ne,onClick:()=>{S(!0),I("hide-controls")}})}),e.jsxs("main",{className:d("relative flex min-w-0 flex-1 items-center justify-center overflow-hidden bg-inset",!f&&"my-2 mr-2 rounded-2xl border border-hairline",!f&&!b&&"ml-2"),children:[e.jsx("div",{id:"screen",ref:u,role:"application","aria-label":t("desktopViewer.title"),className:d("overflow-hidden",f?"h-full w-full":"h-[95%] w-[95%]")}),e.jsx("div",{className:i?"sr-only":"pointer-events-none absolute inset-x-3 top-3 flex justify-center",children:e.jsx("span",{id:"status",role:"status",className:"max-w-full rounded-full border border-hairline bg-panel/95 px-3 py-1.5 text-center text-xs text-ink-secondary shadow-sm",children:L})}),M&&e.jsx("p",{role:"alert",className:"absolute inset-x-3 bottom-3 rounded-xl border border-hairline bg-panel p-3 text-ink",children:M})]}),e.jsx("a",{id:"viewer-notice",href:"/novnc-NOTICE.txt",target:"_blank",rel:"license noopener noreferrer",title:t("desktopViewer.notice"),"aria-label":t("desktopViewer.notice"),className:"absolute bottom-2 right-2 z-10 flex min-h-6 w-11 items-center justify-center rounded-lg bg-app/80 text-[10px] text-ink-secondary hover:text-ink hover:underline",style:{marginRight:"env(safe-area-inset-right)",marginBottom:"env(safe-area-inset-bottom)"},children:"noVNC"}),g.shown&&e.jsxs("section",{...g.exitProps,"aria-label":t(r?"desktopViewer.keyboard":"desktopViewer.clipboard"),onKeyDown:n=>{n.key==="Escape"&&(n.stopPropagation(),F())},className:d("absolute left-[72px] top-1/2 z-20 max-h-[calc(100dvh-24px)] w-[min(320px,calc(100%-84px))] -translate-y-1/2 overflow-y-auto rounded-2xl border border-hairline bg-panel p-4 shadow-2xl",g.className),style:{marginLeft:"env(safe-area-inset-left)"},children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between gap-2",children:[e.jsx("h1",{className:"font-medium",children:t(r?"desktopViewer.keyboard":"desktopViewer.clipboard")}),e.jsx("button",{type:"button",title:t("desktopViewer.closePanel"),"aria-label":t("desktopViewer.closePanel"),onClick:F,className:"ui-icon-button shrink-0",children:e.jsx($,{size:18,"aria-hidden":"true"})})]}),e.jsxs("form",{onSubmit:n=>{n.preventDefault(),!(!o.current||!i||!r)&&(Q(o.current,j),C(""))},children:[e.jsx("label",{className:"mb-2 block text-xs leading-relaxed text-ink-secondary",htmlFor:r?"text":"clipboard-text",children:t(r?"desktopViewer.text":"desktopViewer.clipboardHint")}),e.jsx("textarea",{id:r?"text":"clipboard-text",className:"w-full resize-y rounded-xl border border-hairline bg-inset p-3 text-base text-ink outline-none focus:border-focus",rows:4,maxLength:r?4096:65536,autoComplete:"off",autoCapitalize:"off",spellCheck:!1,value:r?j:H,disabled:!r&&!i,onChange:n=>{const l=n.target.value;r?C(l):(k(l),i&&o.current?.clipboardPasteFrom(l))}}),r&&e.jsxs("button",{id:"send",type:"submit",className:"mt-3 flex min-h-11 w-full items-center justify-center gap-2 rounded-xl bg-accent px-3 font-medium text-accent-ink transition-opacity hover:opacity-90 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus disabled:opacity-40",disabled:!i||!j,children:[e.jsx(se,{size:16,"aria-hidden":"true"}),t("desktopViewer.send")]})]}),r&&e.jsxs("div",{className:"mt-4 grid grid-cols-2 gap-2 border-t border-hairline pt-4",children:[e.jsx("button",{className:E,disabled:!i,onClick:()=>o.current?.sendKey(65289,"Tab"),children:t("desktopViewer.keyTab")}),e.jsx("button",{className:E,disabled:!i,onClick:()=>o.current?.sendKey(65307,"Escape"),children:t("desktopViewer.keyEscape")}),e.jsx("button",{id:"ctrl-alt-del",className:d(E,"col-span-2"),disabled:!i,onClick:()=>o.current?.sendCtrlAltDel(),children:t("desktopViewer.keyCtrlAltDel")})]})]})]})}function h({id:u,label:o,icon:v,disabled:m,active:x,expanded:p,onClick:i}){return e.jsx("button",{id:u,type:"button",title:o,"aria-label":o,"aria-pressed":x,"aria-expanded":p,disabled:m,onClick:i,className:d("ui-icon-button size-11 min-h-11 shrink-0 rounded-xl focus-visible:outline-2 focus-visible:outline-focus",x?"bg-accent/15 text-accent-text hover:bg-accent/25":"text-ink-secondary hover:bg-raised-hover hover:text-ink"),children:e.jsx(v,{size:19,strokeWidth:1.75,"aria-hidden":"true"})})}export{me as DesktopViewer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{j as e,t,r as m,a as j,b as D}from"./styles-
|
|
1
|
+
import{j as e,t,r as m,a as j,b as D}from"./styles-BRMaHK08.js";import{u as $,r as A,E as R,M as I}from"./PlacesRail-dslg5RRJ.js";import{c as K,F as L,u as M,b as H,S as U,C as S,d as _}from"./App-DCe3hDbm.js";import"./monitor-C-EBTsrK.js";import"./index-D2Jm8LAf.js";import"./MenuMotion-BOUToDZz.js";const G={"too-broad":"files.refusal.tooBroad","app-data":"files.refusal.appData","already-shared":"files.refusal.alreadyShared","not-a-folder":"files.refusal.notAFolder",private:"files.refusal.private"},z={type:"toggleAppSettings",open:!0,section:"cloudAccount"},y=s=>new Intl.NumberFormat(D()).format(s),N=s=>{const i=s>=1073741824?3:s>=1048576?2:1;return`${new Intl.NumberFormat(D(),{maximumFractionDigits:i===3?1:0}).format(s/1024**i)} ${["","KB","MB","GB"][i]}`};function F(s){return`${s.partial?t("files.countMore",{count:y(s.files)}):s.files===1?t("files.countOne"):t("files.count",{count:y(s.files)})} · ${N(s.bytes)}`}function E(s,i=!1){return t(i&&s==="not-a-folder"?"files.refusal.notAFolderListed":G[s]??"files.refusal.other")}const W=10080*6e4;function V(s,i=Date.now()){const o=s.kept?.[0];return o&&i-o.at<W&&(s.status==="synced"||s.status==="copying")?t("files.status.keptBoth",{file:o.path,copy:o.beside}):s.status==="copying"?t("files.status.copying",{done:y(s.done),files:y(s.files)}):s.status==="confirm-deletes"?t(s.pendingDeletes===1?"files.status.deletesOne":"files.status.deletes",{count:y(s.pendingDeletes)}):s.status==="problem"?s.problem||t("files.status.problem"):t(s.status==="waiting"?"files.status.waiting":s.status==="missing"?"files.status.missing":"files.status.synced")}function C(s){const o=(s instanceof Error?s.message:String(s??"")).replace(/^Error invoking remote method '[^']*': (?:\w*Error: )?/,"").split(`
|
|
2
2
|
`)[0].trim();return o?t("files.failedWith",{reason:o}):t("files.failed")}function ne(){const{dragProps:s}=$(),i=K();return e.jsxs("main",{className:"flex min-w-0 flex-1 flex-col overflow-hidden bg-app text-ink",children:[e.jsxs("header",{...s,className:"flex shrink-0 items-center gap-2.5 border-b border-hairline/40 px-6 py-4 max-md:pl-12",children:[e.jsx(L,{size:18,className:"text-ink-secondary"}),e.jsx("h1",{className:"text-[17px] font-semibold",children:t("files.title")})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:e.jsx("div",{className:"mx-auto flex w-full max-w-2xl flex-col gap-8 px-6 py-6",children:i?e.jsx(q,{bridge:i}):e.jsx(O,{})})})]})}function O(){const{dispatch:s}=M();return e.jsxs("div",{className:"flex flex-col items-start gap-3",children:[e.jsx("p",{className:"text-[14px] text-ink",children:t("files.unavailable")}),e.jsx("button",{type:"button",className:"ui-button",onClick:()=>s(z),children:t("files.openSettings")})]})}function q({bridge:s}){const{state:i,dispatch:o}=M(),[n,u]=H(s),[a,c]=m.useState(null),[p,d]=m.useState(!1),[f,x]=m.useState(null),w=i.filesSuggest,k=n!==null&&n.phase!=="unavailable";m.useEffect(()=>{if(!k||!w)return;let l=!0;return s.checkFolders(w).then(r=>{l&&r.length&&c({kind:"suggest",checks:r,chosen:r.filter(g=>!g.refusal).map(g=>g.token)})}).catch(r=>{l&&x(C(r))}),()=>{l=!1}},[s,w,k]);const b=async l=>{d(!0),x(null);try{const r=await l();r&&u(r)}catch(r){x(C(r))}finally{d(!1)}},h=()=>c(null),v=l=>{h(),b(async()=>{let r;for(const g of l)r=await s.share(g);return r})},P=()=>{b(()=>s.moreSpace())};return n?n.phase==="unavailable"?e.jsx(O,{}):e.jsxs(e.Fragment,{children:[(n.phase==="offline"||n.phase==="asleep")&&e.jsx("p",{role:"status","data-files-phase":n.phase,className:"rounded-xl bg-card px-4 py-3 text-[13px] text-ink-secondary",children:t(n.phase==="asleep"?"files.asleep":"files.offline")}),n.phase==="signed-out"&&e.jsxs("div",{role:"status",className:"flex flex-wrap items-center justify-between gap-3 rounded-xl bg-card px-4 py-3",children:[e.jsx("p",{className:"text-[13px] text-ink",children:t("files.signedOut")}),e.jsx("button",{type:"button",className:"ui-button",onClick:()=>o(z),children:t("files.openSettings")})]}),f&&e.jsx("p",{role:"alert",className:"text-[13px] text-danger",children:f}),e.jsxs("section",{"aria-labelledby":"files-shared",className:"flex flex-col gap-3",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"files-shared",className:"text-[15px] font-medium text-ink",children:t("files.shared.title")}),e.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:t("files.shared.help")})]}),n.shared.length>0?e.jsx("ul",{className:"flex flex-col divide-y divide-hairline/40 rounded-xl bg-card",children:n.shared.map(l=>e.jsx(J,{folder:l,bridge:s,busy:p,run:b,onStop:()=>c({kind:"stop",folder:l})},l.id))}):e.jsx("p",{className:"text-[13px] text-ink-secondary",children:t("files.empty")}),e.jsx("button",{type:"button",disabled:p,className:"ui-button self-start",onClick:()=>{b(async()=>{const l=await s.pickFolder();l&&c({kind:"share",check:l})})},children:t("files.add")}),n.disk&&e.jsx(X,{disk:n.disk,busy:p,onMore:P})]}),e.jsxs("section",{"aria-labelledby":"files-outputs",className:"flex flex-col gap-3",children:[e.jsx("h2",{id:"files-outputs",className:"text-[15px] font-medium text-ink",children:t("files.outputs.title")}),e.jsxs("div",{className:"flex flex-col items-start gap-3 rounded-xl bg-card p-4",children:[e.jsxs("div",{className:"flex w-full items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{id:"files-outputs-switch",className:"text-[14px] text-ink",children:t("files.outputs.switch")}),e.jsx("p",{className:"mt-1 text-[12px] text-ink-secondary",children:t("files.outputs.help")})]}),e.jsx(U,{checked:n.outputs.enabled,disabled:p,"aria-labelledby":"files-outputs-switch",onClick:()=>{b(()=>s.setOutputs(!n.outputs.enabled))}})]}),n.outputs.problem&&e.jsx("p",{className:"text-[12px] text-danger",children:n.outputs.problem}),n.outputs.enabled&&e.jsx("button",{type:"button",className:"ui-button",onClick:()=>{b(()=>s.open({outputs:!0}))},children:t("files.outputs.open")})]})]}),a?.kind==="share"&&(a.check.refusal?e.jsx(B,{label:E(a.check.refusal),onClose:h,actions:e.jsx("button",{type:"button",autoFocus:!0,className:"ui-button ui-button-primary",onClick:h,children:t("files.ok")})}):e.jsx(S,{open:!0,tone:"neutral",icon:e.jsx(L,{size:18}),title:t("files.share.title",{name:a.check.name}),body:t("files.share.body",{size:F(a.check)}),confirmLabel:t("files.share.confirm"),onCancel:h,onConfirm:()=>v([a.check.token])})),a?.kind==="stop"&&e.jsx(S,{open:!0,title:t("files.stop.title",{name:a.folder.name}),body:t("files.stop.body"),confirmLabel:t("files.stop"),onCancel:h,onConfirm:()=>{h(),b(()=>s.stopSharing(a.folder.id))}}),a?.kind==="suggest"&&e.jsxs(B,{label:t("files.suggest.title"),onClose:h,actions:e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",autoFocus:!0,className:"ui-button",onClick:h,children:t("files.cancel")}),e.jsx("button",{type:"button",disabled:!a.chosen.length,className:"ui-button ui-button-primary",onClick:()=>v(a.chosen),children:t("files.share.confirm")})]}),children:[e.jsx("p",{className:"mt-1.5 text-[13px] leading-relaxed text-ink-secondary",children:t("files.suggest.body")}),e.jsx("ul",{className:"mt-3 flex max-h-72 flex-col gap-1 overflow-y-auto",children:a.checks.map((l,r)=>e.jsx("li",{children:e.jsxs("label",{className:j("flex items-start gap-3 rounded-lg px-2 py-2",l.refusal&&"opacity-50"),children:[e.jsx("input",{type:"checkbox",className:"mt-1",disabled:!!l.refusal,checked:!l.refusal&&a.chosen.includes(l.token),onChange:g=>c({...a,chosen:g.target.checked?[...a.chosen,l.token]:a.chosen.filter(T=>T!==l.token)})}),e.jsxs("span",{className:"flex min-w-0 flex-col",children:[e.jsx("span",{className:"truncate text-[14px] text-ink",title:l.pcPath,children:l.name}),e.jsx("span",{className:"text-[12px] text-ink-secondary",children:l.refusal?E(l.refusal,!0):F(l)})]})]})},`${r}:${l.pcPath}`))})]})]}):null}function J({folder:s,bridge:i,busy:o,run:n,onStop:u}){const a=(p,d,f=!1)=>e.jsx("button",{type:"button",disabled:o,className:j("ui-button ui-button-sm",f&&"ui-button-primary"),onClick:d,children:p}),c=s.status==="waiting"?a(t("files.moreSpace"),()=>{n(()=>i.moreSpace())}):s.status==="confirm-deletes"?e.jsxs(e.Fragment,{children:[a(t("files.deletes.remove"),()=>{n(()=>i.answerDeletes(s.id,!0))}),a(t("files.deletes.keep"),()=>{n(()=>i.answerDeletes(s.id,!1))})]}):s.status==="missing"?e.jsxs(e.Fragment,{children:[a(t("files.locate"),()=>{n(()=>i.locate(s.id))},!0),a(t("files.stop"),u)]}):null;return e.jsxs("li",{"data-files-folder":s.status,className:"flex items-start gap-3 px-4 py-3",children:[e.jsx(_,{size:18,className:"mt-0.5 shrink-0 text-ink-secondary"}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[e.jsx("span",{className:"truncate text-[14px] text-ink",title:s.pcPath,children:s.name}),e.jsx("span",{className:j("text-[12px]",s.status==="problem"||s.status==="missing"?"text-danger":"text-ink-secondary"),children:V(s)}),c&&e.jsx("div",{className:"mt-1.5 flex flex-wrap gap-2",children:c})]}),e.jsx(Q,{name:s.name,busy:o,onOpen:()=>{n(()=>i.open({folderId:s.id}))},onStop:u})]})}function Q({name:s,busy:i,onOpen:o,onStop:n}){const[u,a]=m.useState(!1),c=m.useRef(null);m.useEffect(()=>{if(!u)return;const d=x=>{x.key==="Escape"&&(x.stopPropagation(),a(!1))},f=x=>{x.target instanceof Node&&!c.current?.contains(x.target)&&a(!1)};return window.addEventListener("keydown",d,!0),window.addEventListener("pointerdown",f),()=>{window.removeEventListener("keydown",d,!0),window.removeEventListener("pointerdown",f)}},[u]);const p=(d,f,x=!1)=>e.jsx("button",{type:"button",role:"menuitem",disabled:i,className:j("ui-menu-row w-full text-left",x?"text-danger":"text-ink"),onClick:()=>{a(!1),f()},children:d});return e.jsxs("div",{ref:c,className:"relative shrink-0",children:[e.jsx("button",{type:"button","aria-haspopup":"menu","aria-expanded":u,"aria-label":t("files.more",{name:s}),className:"ui-icon-button hover:bg-control hover:text-ink",onClick:()=>a(d=>!d),children:e.jsx(R,{size:16})}),u&&e.jsxs("div",{role:"menu",className:j("absolute right-0 top-full z-40 mt-1 w-[220px] overflow-hidden text-[13px]",I),children:[p(t("files.openHere"),o),p(t("files.stop"),n,!0)]})]})}function X({disk:s,busy:i,onMore:o}){const n=s.totalBytes>0?Math.min(100,Math.round(s.usedBytes/s.totalBytes*100)):0;return e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("span",{className:"text-[12px] text-ink-secondary",children:t("files.storage",{used:N(s.usedBytes),total:N(s.totalBytes)})}),e.jsx("div",{className:"h-1 w-full overflow-hidden rounded-full bg-control","aria-hidden":"true",children:e.jsx("div",{className:j("h-full rounded-full",s.warn?"bg-warning":"bg-accent"),style:{width:`${n}%`}})}),s.warn&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"text-[12px] text-warning",children:t("files.almostFull")}),e.jsx("button",{type:"button",disabled:i,className:"ui-button ui-button-sm",onClick:o,children:t("files.moreSpace")})]})]})}function B({label:s,children:i,actions:o,onClose:n}){const u=m.useRef(n);return u.current=n,m.useEffect(()=>{const a=c=>{c.key==="Escape"&&(c.preventDefault(),u.current())};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[]),A.createPortal(e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/55 p-6",onMouseDown:a=>a.target===a.currentTarget&&n(),children:e.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"files-dialog-label",className:"w-full max-w-[440px] rounded-2xl border border-hairline/50 bg-panel p-5 shadow-2xl",children:[e.jsx("h2",{id:"files-dialog-label",className:"text-[15px] font-semibold text-ink",children:s}),i,e.jsx("div",{className:"mt-5 flex justify-end gap-2",children:o})]})}),document.body)}export{ne as FilesView,C as failureText,F as folderSize,V as folderStatus,E as refusalText};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as c,r as y,j as i,X as ke,a as G,f as xe}from"./styles-
|
|
1
|
+
import{t as c,r as y,j as i,X as ke,a as G,f as xe}from"./styles-BRMaHK08.js";import{L as ye,x as be,C as ve,y as we}from"./PlacesRail-dslg5RRJ.js";import{t as je,a as Me}from"./import-name-B3mVDURb.js";import{bd as ue,be as Ne,bf as ee,bg as Ee,bh as Ae,bi as Se,B as _e,n as q,u as Oe,bj as $e}from"./App-DCe3hDbm.js";import{A as Ce,u as T,S as te,b as Le,a as Re,P as Ie,c as Te}from"./package-format-CAZ-xCP-.js";import{F as Fe}from"./file-up-CEuHjVBK.js";import"./monitor-C-EBTsrK.js";import"./index-D2Jm8LAf.js";import"./MenuMotion-BOUToDZz.js";const de="grok-bot-export",Pe="openmaus.grok/1",me=4*1024*1024,Be=50,ne=["green","blue","red","orange","purple","cyan","pink","yellow","teal","coral"],Ge=50,ze=`I'm moving to another assistant and need a complete, machine-readable copy of your setup. Do not change, pause or delete anything.
|
|
2
2
|
|
|
3
3
|
Write one JSON document with exactly this shape, then save it as grok-bot-export-<your name>.json (your name in lowercase, spaces as hyphens): in my Downloads folder if you can write to my computer, otherwise in your workspace, and attach it to your reply. If you cannot attach files, put the whole document in a single \`\`\`json code block instead.
|
|
4
4
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{r as f,j as o,t as d,f as te,a as j,a8 as ne,X as se,b as J,a9 as re}from"./styles-
|
|
1
|
+
import{r as f,j as o,t as d,f as te,a as j,a8 as ne,X as se,b as J,a9 as re}from"./styles-BRMaHK08.js";import{bo as ae,bp as ie,bq as oe,bd as D,br as ce,bs as le,bt as ue,u as de,ak as pe,l as me,bu as fe,bv as xe}from"./App-DCe3hDbm.js";import{C as he,L as ge,K as ye,u as be}from"./PlacesRail-dslg5RRJ.js";import{R as ke,C as $e}from"./MenuMotion-BOUToDZz.js";import"./index-D2Jm8LAf.js";import"./monitor-C-EBTsrK.js";const $=(e,n=120)=>e.length>n?`${e.slice(0,n-1)}…`:e,v=e=>e.replace(/\s+/g," ").trim(),F=119;function H(e,n){const a=e?{...e}:{text:"",pendingSpace:!1,overflow:!1};if(a.overflow)return a;for(const i of n){if(/\s/.test(i)){a.text&&(a.pendingSpace=!0);continue}if(a.pendingSpace){if(a.text.length>=F){a.overflow=!0;break}a.text+=" ",a.pendingSpace=!1}if(a.text.length>=F){a.overflow=!0;break}a.text+=i}return a}const B=e=>`${e.text}${e.overflow?"…":""}`;function ve(e){switch(e.type){case"session.started":return{summary:`session ${e.sessionId??"(none)"}${e.model?` · ${e.model}`:""}`,tone:"plain"};case"session.exited":return{summary:`session exited${e.reason?` · ${e.reason}`:""}`,tone:"plain"};case"turn.started":return{summary:`turn started${e.turnId?` · ${e.turnId.slice(0,8)}`:""}`,tone:"boundary"};case"turn.retrying":return{summary:`retrying (${e.reason}) · attempt ${e.attempt} · ${Math.round(e.delayMs/1e3)}s`,tone:"plain"};case"turn.completed":{const n=[e.ok?"turn ok":"turn failed"];return e.stopReason&&n.push(e.stopReason),typeof e.cost=="number"&&n.push(ae(e.cost,4)),e.denials?.length&&n.push(`${e.denials.length} denied`),{summary:n.join(" · "),tone:e.ok?"boundary":"error"}}case"turn.wait_started":return{summary:`waiting for ${e.resource.startsWith("browser:")?"browser":"computer"} — ${e.holder?`${e.holder.name}${e.holder.task?` (${e.holder.task})`:""}`:"holder unknown"}`,tone:"plain"};case"turn.wait_ended":{const n=Math.round(e.waitedMs/1e3),a=e.waitedMs<1e3?"under a second":`${n}s`;return e.outcome==="acquired"?{summary:`${e.resource.startsWith("browser:")?"browser":"computer"} acquired after ${a}`,tone:"boundary"}:e.outcome==="parked"?{summary:`computer wait parked after ${a}`,tone:"plain"}:e.outcome==="gave_up"?{summary:`computer wait gave up after ${a}`,tone:"error"}:{summary:`computer wait stopped after ${a}`,tone:"plain"}}case"item.started":return{summary:`${e.itemType}${e.title?`: ${$(v(e.title))}`:" started"}`,tone:"plain"};case"item.updated":return{summary:`${e.itemType} updated${typeof e.tokens=="number"?` · ${e.tokens} tok`:""}`,tone:"plain"};case"turn.progress":return{summary:`live: ${[e.activity,e.tool,e.file,typeof e.bytes=="number"?`${e.bytes} bytes`:void 0].filter(Boolean).join(" · ")}`,tone:"plain"};case"item.completed":return e.itemType==="assistant_text"?{summary:`assistant: ${$(v(e.text))}`,tone:"plain"}:e.itemType==="assistant_image"?{summary:"assistant image generated",tone:"plain"}:{summary:`tool ${e.ok?"ok":"failed"}`,tone:e.ok?"plain":"error"};case"content.delta":return{summary:`${e.streamKind}: ${$(v(e.delta))}`,tone:"plain"};case"request.opened":return{summary:`${e.requestType}${e.origin==="output"?" (agent-composed)":""}: ${e.tool} — ${$(v(e.summary))}`,tone:"plain"};case"request.resolved":return{summary:`resolved ${e.behavior} · ${e.source}`,tone:"plain"};case"thread.token-usage.updated":return{summary:`tokens in ${e.input} · out ${e.output}`,tone:"plain"};case"runtime.error":return{summary:`${e.setup?"setup: ":""}${$(v(e.message))}`,tone:"error"};case"runtime.notice":return{summary:`notice: ${$(v(e.message))}`,tone:"plain"};default:return{summary:e.type,tone:"plain"}}}function we(e){const n=e.msg;if(!n||typeof n!="object")return String(e.msg);const a=typeof n.method=="string"?n.method:void 0,i=typeof n.type=="string"?n.type:void 0,s=n.id!==void 0?` #${String(n.id)}`:"";if(a)return`${a}${s}`;if(typeof n.event=="string"){const t=n.result?.status;return typeof t=="string"?`${n.event} · ${t}`:n.event}if(i){const t=n.message,x=typeof t?.role=="string"?` · ${t.role}`:"",l=typeof n.subtype=="string"?` · ${n.subtype}`:"";return`${i}${l}${x}`}return n.result!==void 0?`result${s}`:n.error!==void 0?`error${s}`:$(v(JSON.stringify(n)))}function U(e){const n=[];for(const[a,i]of e.entries()){if(i.kind==="native"){n.push({key:`n${a}`,kind:"native",at:i.at,tag:i.data.dir==="out"?"→ out":"← in",summary:`${i.data.source} · ${we(i.data)}`,tone:"plain",data:i.data,count:1});continue}const s=i.data,t=n.at(-1);if(s.type==="content.delta"&&t?.kind==="runtime"&&t.tag==="content.delta"&&t.data[0]?.type==="content.delta"&&t.data[0].streamKind===s.streamKind){const y=t.data;y.push(s),t.count=y.length,t.preview=H(t.preview,s.delta),t.summary=`${s.streamKind}: ${B(t.preview)}`;continue}const{summary:x,tone:l}=ve(s),u=s.type==="content.delta"?H(void 0,s.delta):void 0,b=s.type==="content.delta"?s.streamKind:void 0;n.push({key:s.eventId||`r${a}`,kind:"runtime",at:i.at,tag:s.type,summary:u&&b?`${b}: ${B(u)}`:x,tone:l,data:s.type==="content.delta"?[s]:s,count:1,preview:u})}return n}function je(e){const n=new Date(e);if(Number.isNaN(n.getTime()))return"--:--:--";const a=String(n.getHours()).padStart(2,"0"),i=String(n.getMinutes()).padStart(2,"0"),s=String(n.getSeconds()).padStart(2,"0"),t=String(n.getMilliseconds()).padStart(3,"0");return`${a}:${i}:${s}.${t}`}function Se(e,n){const a=ie(e,n),i=[];let s=!1;for(const t of e)if(t.kind==="text"&&t.role==="user"&&t.text?.trim())i.push({id:t.id,at:t.at,label:s?"User input":"Task started",state:"observed",kind:"task"}),s=!0;else if(t.kind==="activity"&&t.tool){const x=oe(t.tool.name),l=t.tool.ok===!1||x!==null;i.push({id:t.id,at:t.at,label:D(x??t.tool.name),...t.tool.summary?{command:D(t.tool.summary)}:{},state:l?"failed":t.tool.ok===!0?"complete":a.has(t.id)?"running":"unverified",kind:"tool"})}else t.kind==="screen"?i.push({id:t.id,at:t.at,label:"Screen observed",state:"observed",kind:"screen"}):t.kind==="text"&&t.role==="bot"&&t.text?.trim()&&i.push({id:t.id,at:t.at,label:"Response recorded",state:"complete",kind:"result"});return i}function Ne(e){return D(e.map(n=>`[${new Date(n.at).toISOString()}] ${n.state} · ${n.label}${n.command?`
|
|
2
2
|
${n.command}`:""}`).join(`
|
|
3
3
|
`))}const Ie={running:"inspector.run.running",complete:"inspector.run.complete",failed:"inspector.run.failed",observed:"inspector.run.observed",unverified:"inspector.run.unverified"};function Te({events:e}){const[n,a]=f.useState("idle"),i=e.slice(-200),s=async()=>{const t=await ye(Ne(i));t!=="empty"&&a(t)};return o.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto",children:[o.jsxs("div",{className:"flex items-start gap-3 px-4 py-3",children:[o.jsx("p",{className:"min-w-0 flex-1 text-[12px] leading-relaxed text-ink-secondary",children:d("inspector.run.hint")}),i.length>0&&o.jsx("button",{type:"button",onClick:()=>{s()},"aria-label":d("inspector.run.copy"),title:d("inspector.run.copy"),className:"rounded-md p-1.5 text-ink-secondary hover:bg-raised hover:text-ink focus-visible:outline-2 focus-visible:outline-accent",children:n==="copied"?o.jsx(te,{size:14}):o.jsx(he,{size:14})})]}),n!=="idle"&&o.jsx("p",{role:"status",className:"px-4 pb-2 text-[12px] text-ink-secondary",children:d(n==="copied"?"inspector.run.copied":"inspector.run.copyFailed")}),e.length>i.length&&o.jsx("p",{className:"px-4 pb-2 text-[12px] text-ink-secondary",children:d("inspector.run.recent",{count:i.length})}),i.length===0?o.jsx("p",{className:"px-4 py-6 text-[13px] text-ink-secondary",children:d("inspector.run.empty")}):o.jsx("ol",{"aria-label":d("inspector.run.title"),className:"px-4 pb-4",children:i.map(t=>{const x=t.state==="failed"?ce:t.state==="complete"?le:t.state==="running"?ge:ue,l=t.kind==="task"?d("inspector.run.userInput"):t.kind==="screen"?d("inspector.run.screen"):t.kind==="result"?d("inspector.run.response"):t.label;return o.jsxs("li",{className:"border-t border-hairline/30 py-3",children:[o.jsxs("div",{className:"flex items-start gap-2 text-[12px]",children:[o.jsx(x,{size:14,"aria-hidden":"true",className:j("mt-0.5 shrink-0",t.state==="failed"?"text-danger":t.state==="running"?"animate-spin text-accent":"text-ink-secondary")}),o.jsx("span",{className:"min-w-0 flex-1 break-words font-medium text-ink",children:l}),o.jsx("time",{dateTime:new Date(t.at).toISOString(),className:"shrink-0 tabular-nums text-ink-secondary",children:ne(t.at)})]}),t.command&&o.jsx("pre",{className:"mt-2 whitespace-pre-wrap break-all rounded-lg bg-inset p-2 font-mono text-[12px] leading-relaxed text-ink",children:t.command}),t.kind==="tool"&&o.jsx("p",{className:j("mt-1 pl-[22px] text-[11px]",t.state==="failed"?"text-danger":"text-ink-secondary"),children:d(Ie[t.state])})]},t.id)})})]})}const K=400,T=new WeakMap;function X(e){const n={runtime:0,native:0},a=[];for(let i=e.length-1;i>=0;i--){const s=e[i];++n[s.kind]<=K&&a.push(s)}return a.length===e.length?e:a.reverse()}function G(e,n){if(!n.length)return e;const a=e??{entries:[],total:{runtime:0,native:0}},i=new Set(a.entries.flatMap(u=>u.kind==="runtime"?[u.data.eventId]:[])),s=[];for(const u of n)i.has(u.eventId)||(i.add(u.eventId),s.push({kind:"runtime",at:u.createdAt,data:u}));if(!s.length)return e;const t=X([...a.entries,...s]),x=new Set([...T.get(a)??[],...s.map(u=>u.data.eventId)]),l={entries:t,total:{...a.total,runtime:a.total.runtime+s.length}};return T.set(l,new Set(t.flatMap(u=>u.kind==="runtime"&&x.has(u.data.eventId)?[u.data.eventId]:[]))),l}function Re(e,n){const a={...n,entries:X(n.entries)};if(!e)return a;const i=e.entries.flatMap(m=>m.kind==="runtime"?[m.data]:[]),s=T.get(e)??new Set,t=a.entries.filter(m=>m.kind==="runtime"),x=new Set(t.map(m=>m.data.eventId)),l=i.findLastIndex(m=>x.has(m.eventId)),u=t.at(-1)?.at,b=(l>=0?i.slice(l+1):i.filter(m=>u===void 0||m.createdAt>=u)).filter(m=>s.has(m.eventId)),y=G(a,b),R={...y,total:{...y.total,runtime:Math.max(e.total.runtime,y.total.runtime)}};return T.set(R,T.get(y)??new Set),R}const Ce=e=>J()==="en"?d(e):xe(d(e));function qe({bot:e}){const{dispatch:n}=de(),{dragProps:a}=be(),i=e.threadId,[s,t]=f.useState("run"),x=f.useMemo(()=>Se(pe(e),e),[e]),[l,u]=f.useState(null),[b,y]=f.useState(null),[R,m]=f.useState(()=>new Set),E=f.useRef(null),z=f.useRef(!0),S=f.useRef(null),C=f.useRef(()=>{}),L=f.useCallback(async()=>{S.current?.abort();const r=new AbortController;S.current=r;try{const c=await fetch(`/api/threads/${i}/events?limit=${K}`,{signal:r.signal});if(!c.ok)throw new Error(`${c.status}`);const p=await c.json();if(r.signal.aborted)return;u(h=>Re(h,p)),m(h=>new Set([...h].filter(M=>M.startsWith("runtime:")))),y(null)}catch(c){if(r.signal.aborted)return;y(c instanceof Error?c.message:String(c))}finally{S.current===r&&(S.current=null)}},[i]);f.useEffect(()=>(u(null),m(new Set),z.current=!0,()=>S.current?.abort()),[L]),f.useEffect(()=>{let r=!0,c=null,p=0,h=!1;const M=[];let N=[],w=null;const q=()=>{w&&clearTimeout(w),w=null;const g=N;N=[],g.length&&u(k=>G(k,g))},W=g=>{N.push(g),N.length>=K?q():w??=setTimeout(q,16)},Y=()=>{for(const g of M.splice(0))W(g)},Z=async()=>{q();const g=++p;h=!0,await L(),!(!r||g!==p)&&(h=!1,Y())},I=()=>{Z()};C.current=I;const ee=me({onMissedFrames:I,onFrame:g=>{if(g.kind!=="runtime")return;const k=g.event;k.threadId===i&&(h?M.push(k):W(k),(k.type==="turn.completed"||k.type==="runtime.error")&&(c&&clearTimeout(c),c=setTimeout(I,400)))}});return I(),()=>{r=!1,C.current===I&&(C.current=()=>{}),ee(),c&&clearTimeout(c),w&&clearTimeout(w),N=[]}},[i,L]);const A=f.useMemo(()=>l?l.entries.filter(r=>s==="raw"?r.kind==="native":r.kind==="runtime"):[],[l,s]),O=f.useMemo(()=>U(A),[A]);f.useEffect(()=>{const r=new Set(["runtime","native"].flatMap(c=>U(l?.entries.filter(p=>p.kind===c)??[]).map(p=>`${p.kind}:${p.key}`)));m(c=>{const p=new Set([...c].filter(h=>r.has(h)));return p.size===c.size?c:p})},[l]),f.useEffect(()=>{const r=E.current;r&&z.current&&(r.scrollTop=r.scrollHeight)},[l,O.length,s]);const V=()=>{const r=E.current;r&&(z.current=r.scrollHeight-r.scrollTop-r.clientHeight<40)},Q=r=>m(c=>{const p=new Set(c);return p.has(r)?p.delete(r):p.add(r),p}),_=A.length,P=s==="raw"?l?.total.native??0:l?.total.runtime??0;return o.jsxs("aside",{"aria-label":d("inspector.title"),className:"animate-panel-in absolute inset-0 z-40 flex h-full min-w-0 flex-col border-l border-hairline/40 bg-panel md:static md:z-auto md:w-[min(460px,45vw)] md:shrink-0",children:[o.jsxs("div",{...a,className:"flex items-center justify-between px-4 py-3",children:[o.jsxs("span",{className:"flex items-center gap-2 text-[15px] font-semibold text-ink",children:[o.jsx(fe,{size:16,className:"text-ink-secondary"})," ",d("inspector.title")]}),o.jsx("button",{onClick:()=>n({type:"toggleInspector",open:!1}),"aria-label":d("inspector.close"),title:d("inspector.close"),className:"rounded-md p-1 text-ink-secondary hover:bg-raised hover:text-ink",children:o.jsx(se,{size:18})})]}),o.jsxs("div",{className:"flex items-center gap-2 border-b border-hairline/40 px-4 pb-3",children:[o.jsx("div",{role:"tablist","aria-label":d("inspector.views"),className:"flex rounded-lg bg-inset p-0.5",onKeyDown:r=>{const c=Array.from(r.currentTarget.querySelectorAll('[role="tab"]')),p=c.indexOf(document.activeElement),h=r.key==="ArrowRight"?(p+1)%c.length:r.key==="ArrowLeft"?(p+c.length-1)%c.length:r.key==="Home"?0:r.key==="End"?c.length-1:-1;h<0||(r.preventDefault(),c[h].focus(),c[h].click())},children:["run","events","raw"].map(r=>o.jsx("button",{type:"button",role:"tab",id:`inspector-tab-${r}`,"aria-selected":s===r,"aria-controls":`inspector-panel-${r}`,tabIndex:s===r?0:-1,onClick:()=>t(r),className:j("rounded-md px-2.5 py-1 text-[12px] font-medium",J()==="en"&&"capitalize",s===r?"bg-raised text-ink":"text-ink-secondary hover:text-ink"),children:Ce(r==="run"?"inspector.run.title":r==="events"?"inspector.tab.events":"inspector.tab.raw")},r))}),s!=="run"&&o.jsx("span",{className:"ml-auto text-[11px] text-ink-secondary",children:l?_<P?d("inspector.entries.lastOf",{shown:_,total:P}):d("inspector.entries.count",{count:_}):d("inspector.entries.loading")}),s!=="run"&&o.jsx("button",{onClick:()=>C.current(),className:"rounded-md p-1 text-ink-secondary hover:bg-raised hover:text-ink",title:d("inspector.reload"),children:o.jsx(ke,{size:14})})]}),o.jsx("div",{role:"tabpanel",id:`inspector-panel-${s}`,"aria-labelledby":`inspector-tab-${s}`,tabIndex:0,className:"flex min-h-0 flex-1 flex-col outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent/60",children:s==="run"?o.jsx(Te,{events:x},i):o.jsxs("div",{ref:E,onScroll:V,className:"min-h-0 flex-1 overflow-y-auto font-mono text-[12px]",children:[b&&o.jsx("div",{className:"px-4 py-3 text-danger",children:d("inspector.loadFailed",{error:b})}),l&&O.length===0&&!b&&o.jsx("div",{className:"px-4 py-6 text-ink-secondary",children:d(s==="raw"?"inspector.emptyRaw":"inspector.emptyEvents")}),O.map(r=>o.jsx(Me,{row:r,open:R.has(`${r.kind}:${r.key}`),onToggle:()=>Q(`${r.kind}:${r.key}`)},r.key))]})})]})}function Me({row:e,open:n,onToggle:a}){return o.jsxs("div",{className:j("border-b border-hairline/20",e.tone==="boundary"&&"bg-raised/40",e.tone==="error"&&"bg-danger/10"),children:[o.jsxs("button",{onClick:a,className:"flex w-full items-start gap-2 px-3 py-1.5 text-left hover:bg-raised/60",children:[o.jsx("span",{className:"mt-[1px] shrink-0 text-ink-secondary",children:n?o.jsx(re,{size:12}):o.jsx($e,{size:12})}),o.jsx("span",{className:"shrink-0 tabular-nums text-ink-secondary",children:je(e.at)}),o.jsxs("span",{className:j("shrink-0 rounded px-1 text-[11px]",e.kind==="native"?"bg-accent/15 text-accent":e.tone==="error"?"bg-danger/20 text-danger":"bg-inset text-ink-secondary"),children:[e.tag,e.count>1?` ×${e.count}`:""]}),o.jsx("span",{className:j("min-w-0 flex-1 truncate",e.tone==="error"?"text-danger":"text-ink"),children:e.summary})]}),n&&o.jsx("pre",{className:"max-h-[50vh] overflow-auto whitespace-pre-wrap break-all border-t border-hairline/20 bg-app px-3 py-2 text-[11px] leading-relaxed text-ink",children:JSON.stringify(e.data,null,2)})]})}export{qe as InspectorPanel};
|
package/dist/assets/{KeyboardShortcutsModal-uOhXagTA.js → KeyboardShortcutsModal-znw4NkA5.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as c,j as e,t as s,X as p,S as m}from"./styles-
|
|
1
|
+
import{r as c,j as e,t as s,X as p,S as m}from"./styles-BRMaHK08.js";import{i as b,e as f,f as y,s as j,g,h as k,j as v}from"./App-DCe3hDbm.js";import{K as N}from"./MenuMotion-BOUToDZz.js";import"./PlacesRail-dslg5RRJ.js";import"./monitor-C-EBTsrK.js";import"./index-D2Jm8LAf.js";function w({item:r,isMac:n}){const a=k(r,n);return e.jsxs("div",{className:"flex items-center justify-between gap-4 py-1.5",children:[e.jsx("span",{className:"text-[13px] text-ink",children:v(r)}),e.jsx("div",{className:"flex shrink-0 items-center gap-1",children:a.map((i,o)=>e.jsx("kbd",{className:"inline-flex min-w-[22px] items-center justify-center rounded-md border border-hairline/60 bg-control px-1.5 py-0.5 font-mono text-[12px] font-semibold text-ink shadow-xs",children:i},o))})]})}function P({open:r,onClose:n}){const[a,i]=c.useState(""),o=c.useRef(null),l=c.useRef(null),d=b(),h=f();if(c.useLayoutEffect(()=>{const t=o.current;if(!(!r||!t))return i(""),t.showModal(),l.current?.focus(),()=>t.close()},[r]),!r)return null;const x=y(j(h),a,d);return e.jsx("dialog",{ref:o,"aria-labelledby":"shortcuts-dialog-title",className:"m-auto w-[min(500px,calc(100%-32px))] max-h-[85vh] overflow-hidden rounded-2xl border border-hairline/50 bg-panel p-0 text-ink shadow-2xl backdrop:bg-black/60 backdrop:backdrop-blur-xs",onCancel:t=>{t.preventDefault(),n()},onKeyDown:t=>t.stopPropagation(),onMouseDown:t=>t.target===t.currentTarget&&n(),children:e.jsxs("div",{className:"flex max-h-[85vh] flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-hairline/40 px-5 py-4",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("span",{className:"flex size-8 shrink-0 items-center justify-center rounded-lg bg-accent/15 text-accent",children:e.jsx(N,{size:18})}),e.jsxs("div",{children:[e.jsx("h2",{id:"shortcuts-dialog-title",className:"text-[16px] font-semibold text-ink",children:s("shortcuts.title")}),e.jsx("p",{className:"text-[12px] text-ink-secondary",children:s("shortcuts.subtitle")})]})]}),e.jsx("button",{type:"button",onClick:n,"aria-label":s("shortcuts.close"),className:"rounded-lg p-1.5 text-ink-secondary hover:bg-raised hover:text-ink",children:e.jsx(p,{size:18})})]}),e.jsx("div",{className:"border-b border-hairline/30 px-5 py-2.5",children:e.jsxs("div",{className:"flex items-center gap-2 rounded-xl border border-hairline/40 bg-inset px-3 py-1.5 focus-within:border-focus",children:[e.jsx(m,{size:14,className:"shrink-0 text-ink-secondary"}),e.jsx("input",{ref:l,value:a,onChange:t=>i(t.target.value),placeholder:s("shortcuts.searchPlaceholder"),"aria-label":s("shortcuts.search"),className:"w-full bg-transparent text-[13px] text-ink placeholder:text-ink-secondary focus:outline-none"})]})}),e.jsx("div",{className:"flex-1 overflow-y-auto px-5 py-3 space-y-4",children:x.length===0?e.jsx("div",{className:"py-8 text-center text-[13px] text-ink-secondary",children:s("shortcuts.noMatch",{query:a})}):x.map(t=>e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider text-ink-tertiary",children:g(t)}),e.jsx("div",{className:"divide-y divide-hairline/20 rounded-xl bg-card/40 px-3 py-1 border border-hairline/30",children:t.items.map(u=>e.jsx(w,{item:u,isMac:d},u.id))})]},t.category))}),e.jsxs("div",{className:"flex items-center justify-between border-t border-hairline/40 bg-card/30 px-5 py-2.5 text-[12px] text-ink-secondary",children:[e.jsxs("span",{children:[s("shortcuts.openHintBefore")," ",e.jsx("kbd",{className:"rounded bg-control px-1 py-0.5 font-mono text-[11px]",children:"?"})," ",s("shortcuts.openHintAfter")]}),e.jsx("button",{type:"button",onClick:n,className:"ui-button ui-button-md",children:s("common.done")})]})]})})}export{P as KeyboardShortcutsModal};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as n,t as s,j as e,a as o}from"./styles-
|
|
1
|
+
import{r as n,t as s,j as e,a as o}from"./styles-BRMaHK08.js";import{c as H,t as M}from"./desktop-connection-Dfaq6k5a.js";import{u as B,d as F,L as D}from"./PlacesRail-dslg5RRJ.js";import{S as K,R as O}from"./MenuMotion-BOUToDZz.js";import{Y as P,Z as Y}from"./App-DCe3hDbm.js";import"./desktop-viewer-CF-OpSo0.js";import"./monitor-C-EBTsrK.js";import"./index-D2Jm8LAf.js";function _({target:x,threadId:f,name:R,poster:b,expanded:r,onExpandedChange:h,onHandBack:E,handingBack:g,onUnreachable:v}){const j=n.useRef(null),a=n.useRef(null),[i,c]=n.useState("connecting"),[k,w]=n.useState(0),[l,y]=n.useState(""),N=n.useRef(!1),{dragProps:L,noDragStyle:u}=B(),T=F().capabilities.windowChrome==="mac-inset",C=n.useRef(v);C.current=v,n.useEffect(()=>{const t=new AbortController;let p,S;const V=()=>{c("disconnected"),N.current?k===0&&(S=setTimeout(()=>w(1),1e3)):C.current()};return c("connecting"),H(j.current,x,{threadId:f,signal:t.signal,events:{connected:()=>{N.current=!0,c("connected")},disconnected:V}}).then(m=>{if(t.signal.aborted)return m.disconnect();p=m,a.current=m},()=>{t.signal.aborted||V()}),()=>{t.abort(),clearTimeout(S),p?.disconnect(),a.current===p&&(a.current=null)}},[x,f,k]),n.useEffect(()=>{i==="connected"&&a.current?.focus({preventScroll:!0})},[r,i]);const z=s("computer.viewerTitle",{name:R}),A=e.jsxs("span",{className:"pointer-events-none flex items-center gap-1.5 rounded-full bg-black/70 px-2.5 py-1 text-[11px] font-medium text-white shadow-sm",children:[e.jsx("span",{className:"size-1.5 rounded-full bg-success","aria-hidden":"true"}),s("computer.inControl")]}),d="flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-[12px] focus-visible:outline-2 focus-visible:outline-focus disabled:opacity-50";return e.jsxs("div",{"data-live-desktop":!0,"data-state":i,"data-expanded":r?"true":void 0,className:o(r?"fixed inset-0 z-[65] flex flex-col bg-app":"relative h-full w-full"),onKeyDown:t=>{r&&t.key==="Escape"&&!(t.target instanceof HTMLCanvasElement)&&h(!1)},children:[r&&e.jsxs("header",{...L,className:o("flex shrink-0 flex-wrap items-center gap-2 border-b border-hairline/40 bg-panel px-3 py-2",T&&"pl-[86px]"),children:[e.jsx("span",{className:"min-w-0 truncate text-[13px] font-medium text-ink",children:z}),A,e.jsxs("form",{style:u,className:"ml-auto flex min-w-0 items-center gap-1",onSubmit:t=>{t.preventDefault(),!(!a.current||i!=="connected"||!l)&&(M(a.current,l),y(""))},children:[e.jsx("input",{value:l,onChange:t=>y(t.target.value),maxLength:4096,autoComplete:"off",autoCapitalize:"off",spellCheck:!1,placeholder:s("desktopViewer.text"),"aria-label":s("desktopViewer.text"),className:"w-44 min-w-0 rounded-lg border border-hairline bg-inset px-2.5 py-1.5 text-[12px] text-ink outline-none focus:border-focus max-sm:w-28"}),e.jsx("button",{type:"submit",disabled:i!=="connected"||!l,title:s("desktopViewer.send"),"aria-label":s("desktopViewer.send"),className:o(d,"bg-control text-ink hover:bg-raised-hover"),children:e.jsx(K,{size:14,"aria-hidden":"true"})})]}),e.jsxs("button",{type:"button",style:u,onClick:()=>h(!1),className:o(d,"bg-control text-ink hover:bg-raised-hover"),children:[e.jsx(P,{size:14,"aria-hidden":"true"}),e.jsx("span",{className:"max-sm:hidden",children:s("desktopViewer.exitFullscreen")})]}),e.jsxs("button",{type:"button",style:u,onClick:E,disabled:g,className:o(d,"bg-accent font-medium text-accent-ink hover:brightness-110"),children:[g?e.jsx(D,{size:14,className:"animate-spin","aria-hidden":"true"}):e.jsx(Y,{size:14,"aria-hidden":"true"}),s("computer.handBack")]})]}),e.jsxs("div",{className:o("relative overflow-hidden bg-inset",r?"min-h-0 flex-1":"h-full w-full"),children:[b&&i!=="connected"&&e.jsx("img",{src:b,alt:"","aria-hidden":"true",className:"absolute inset-0 h-full w-full object-contain opacity-50"}),e.jsx("div",{ref:j,role:"application","aria-label":z,className:"absolute inset-0"}),i==="connecting"&&e.jsxs("div",{role:"status",className:"pointer-events-none absolute inset-0 flex items-center justify-center gap-2 text-[12px] text-ink-secondary",children:[e.jsx(D,{size:16,className:"animate-spin","aria-hidden":"true"}),s("desktopViewer.connecting")]}),i==="disconnected"&&e.jsxs("div",{role:"alert",className:"absolute inset-x-0 bottom-0 flex flex-col items-center gap-2 bg-card/95 p-3 text-center text-[12px] text-ink-secondary",children:[e.jsx("span",{children:s("desktopViewer.disconnected")}),e.jsxs("button",{type:"button",onClick:()=>w(t=>t+1),className:"flex items-center gap-1.5 rounded-md bg-control px-3 py-1.5 text-ink hover:bg-raised-hover",children:[e.jsx(O,{size:13,"aria-hidden":"true"}),s("desktopViewer.reconnect")]})]})]})]})}export{_ as LiveDesktop};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as l,r as i,p as ve,j as c,X as he,a as Q}from"./styles-C2_XZv1s.js";import{u as we,_ as xe,$ as ee,a0 as ae,n as q,D as be,Z as te,a1 as ke}from"./App-BWtQhGWp.js";import{o as ce,s as ie,e as O,_ as I,n as ye,u as ge,L as T,f as Ne}from"./PlacesRail-PP97GpM6.js";import{M as le}from"./monitor-DuYHWIyw.js";import{R as Ce}from"./MenuMotion-CSgaJLc2.js";import"./index-BSrb6nsc.js";function je(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 m=s[d];m&&n.delete(m)&&(o[d]=m)}for(const d of[0,1]){if(o[d])continue;const m=[...n][0];m&&(o[d]=m,n.delete(m))}return o}const ze=ce({mode:I(["shared","per-bot","pool"]).optional(),max_instances:ye().int().positive().optional(),container:I(["running","stopped","missing"]).optional(),network:I(["loopback","unsafe","unknown"]).optional(),security:I(["hardened","unsafe","unknown"]).optional(),persistence:I(["durable","unsafe","unknown"]).optional(),desktopReady:O().optional(),ready:O().optional(),viewer_url:ie().min(1).optional()});function de(s){const e=ze.safeParse(s);return e.success?e.data:null}function H(s){const e=de(s),u=e?.mode??"unknown",n=e?.container??"unknown",o=e?.network??"unknown",d=e?.security??"unknown",m=e?.persistence??"unknown",w=e?.max_instances??0,h=e?.desktopReady===!0,x=!!(e?.ready===!0&&n==="running"&&o==="loopback"&&d==="hardened"&&m==="durable"&&h);return{mode:u,maxInstances:w,container:n,network:o,security:d,persistence:m,desktopReady:h,ready:x}}function Ve(s){const e=de(s);return!e||!H(s).ready?null:e.viewer_url??null}const J=["local-vm-workspace:left","local-vm-workspace:right"],pe=ce({held:O(),helpReason:ie().nullable(),help:Ne().optional().transform(ke),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=pe.safeParse(n);if(!o.success)throw new Error("invalid-control-snapshot");return o.data}async function Oe(s){const e=pe.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 D(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 _e(){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]'),m=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(m)?m:null}});return je(e,u)}function Ie(s){const[e,u]=i.useState(!1);return i.useEffect(()=>{let n=0;const o=()=>u(_e()),d=()=>{n||(n=requestAnimationFrame(()=>{n=0,o()}))};o();const m=new MutationObserver(d);m.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),m.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 Ae(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 We({index:s,bot:e,bots:u,otherBotId:n,obscured:o,active:d,heldElsewhere:m,controlPending:w,onSelect:h,onTake:x,onRelease:B,onOpenComputer:A}){const v=J[s],p=e?.id??null,_=e?.name??l("vm.workspace.localVm"),b=i.useRef(null),k=i.useRef(Promise.resolve()),z=i.useRef(o),[W,V]=i.useState(0),[j,N]=i.useState(null),[C,y]=i.useState({contextId:v,open:!1,status:"closed",interactive:!1}),[E,g]=i.useState(null),R=i.useCallback(async t=>{if(p)try{const a=await q(`/api/bots/${p}/local-computer`,{signal:t});t?.aborted||N(H(a))}catch{}},[p]),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||!p)){if(!t){g(l("vm.workspace.desktopRequired"));return}try{const S=await q(`/api/bots/${p}/local-computer`,{signal:f.signal});if(!a)return;const X=H(S);N(X);const Y=Ve(S);if(!X.ready||!Y||(await new Promise(me=>{let G=!1;const K=()=>{G||(G=!0,me())},fe=setTimeout(K,100);requestAnimationFrame(()=>{clearTimeout(fe),K()})}),!a))return;const $=oe(b);if(!$)throw new Error("layout-unavailable");const Z=await t.open({contextId:v,url:Y,title:l("vm.workspace.windowTitle",{name:_}),bounds:$});if(!a){await t.close(v).catch(()=>{});return}y(Z),await t.layout([{contextId:v,bounds:$,visible:!z.current&&Z.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(()=>{})))}},[p,_,v,W]),i.useEffect(()=>{if(!p)return;const t=new AbortController,a=window.setInterval(()=>{R(t.signal)},3e4);return()=>{t.abort(),window.clearInterval(a)}},[p,R]);const L=i.useCallback(()=>{const t=window.ogb?.desktopWorkspace,a=oe(b);!t||!a||!C.open||t.layout([{contextId:v,bounds:a,visible:!o}]).catch(()=>g(l("vm.workspace.positionFailed")))},[v,C.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=Ae(j,C.status),r=!!(e&&j?.ready&&C.status==="ready"&&C.open);return c.jsxs("section",{className:Q("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(be,{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:Q("h-1.5 w-1.5 rounded-full",d?"bg-accent":C.status==="ready"?"bg-success":C.status==="error"?"bg-danger":"bg-ink-secondary/50")}),d?l("vm.workspace.youHaveControl"):m?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||m,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}),m?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?!j&&!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})]}):j?.ready&&C.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(ae,{size:21,className:"text-warning"}),c.jsx("div",{className:"text-[12px] leading-relaxed",children:E??(j?.container==="missing"?l("vm.workspace.notCreated",{name:e.name}):j?.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(Ce,{size:13})," ",l("vm.workspace.retryStatus")]}),c.jsx("button",{type:"button",onClick:()=>A(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 Ue({primaryBotId:s,overlayOpen:e,onClose:u,onOpenComputer:n}){const{state:o,dispatch:d}=we(),{dragProps:m}=ge(),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),[A,v]=i.useState(null),p=i.useRef(null),_=i.useRef(null),b=_.current??xe();_.current=b;const k=i.useRef(!1),z=i.useRef(!0),[W,V]=i.useState(!1),[j,N]=i.useState(null),C=Ie(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 D(d,r,t),t.held&&t.owned===!0?p.current=r:p.current===r&&(p.current=null),t},async release(r){const t=await ee({action:"release",syncNativeBrowser:!0,requestControl:a=>ne(r,a,b),setNativeBrowserControl:a=>se()});return D(d,r,t),p.current===r&&(p.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&&D(d,a,f)}catch{}})(),()=>{r=!1}},[d,h]),i.useEffect(()=>{const r=p.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=p.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=p.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:ve()})),!1}finally{k.current=!1,V(!1)}},[y]),R=i.useCallback(async r=>{if(k.current||p.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,p.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(p.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&&p.current===a&&!await g()||x(f=>Re(f,r,t)))},[g]),L=i.useCallback(async()=>{p.current&&!await g()||u()},[g,u]),P=i.useCallback(async r=>{p.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",{...m,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:W,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(he,{size:18})})]}),j&&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(ae,{size:14,className:"shrink-0"})," ",j]}),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(We,{index:r,bot:a,bots:w,otherBotId:h[r===0?1:0],obscured:C,active:!!(a&&A===a.id),heldElsewhere:!!(a&&o.computerControl[a.id]?.held&&A!==a.id),controlPending:W,onSelect:f=>{F(r,f)},onTake:f=>{R(f)},onRelease:()=>{g()},onOpenComputer:f=>{P(f)}},J[r])})})]})}export{Ue as LocalVmWorkspace};
|
|
1
|
+
import{t as l,r as i,p as ve,j as c,X as he,a as Q}from"./styles-BRMaHK08.js";import{u as we,_ as xe,$ as ee,a0 as ae,n as q,D as be,Z as te,a1 as ke}from"./App-DCe3hDbm.js";import{o as ce,s as ie,e as O,_ as I,n as ye,u as ge,L as T,f as Ne}from"./PlacesRail-dslg5RRJ.js";import{M as le}from"./monitor-C-EBTsrK.js";import{R as Ce}from"./MenuMotion-BOUToDZz.js";import"./index-D2Jm8LAf.js";function je(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 m=s[d];m&&n.delete(m)&&(o[d]=m)}for(const d of[0,1]){if(o[d])continue;const m=[...n][0];m&&(o[d]=m,n.delete(m))}return o}const ze=ce({mode:I(["shared","per-bot","pool"]).optional(),max_instances:ye().int().positive().optional(),container:I(["running","stopped","missing"]).optional(),network:I(["loopback","unsafe","unknown"]).optional(),security:I(["hardened","unsafe","unknown"]).optional(),persistence:I(["durable","unsafe","unknown"]).optional(),desktopReady:O().optional(),ready:O().optional(),viewer_url:ie().min(1).optional()});function de(s){const e=ze.safeParse(s);return e.success?e.data:null}function H(s){const e=de(s),u=e?.mode??"unknown",n=e?.container??"unknown",o=e?.network??"unknown",d=e?.security??"unknown",m=e?.persistence??"unknown",w=e?.max_instances??0,h=e?.desktopReady===!0,x=!!(e?.ready===!0&&n==="running"&&o==="loopback"&&d==="hardened"&&m==="durable"&&h);return{mode:u,maxInstances:w,container:n,network:o,security:d,persistence:m,desktopReady:h,ready:x}}function Ve(s){const e=de(s);return!e||!H(s).ready?null:e.viewer_url??null}const J=["local-vm-workspace:left","local-vm-workspace:right"],pe=ce({held:O(),helpReason:ie().nullable(),help:Ne().optional().transform(ke),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=pe.safeParse(n);if(!o.success)throw new Error("invalid-control-snapshot");return o.data}async function Oe(s){const e=pe.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 D(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 _e(){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]'),m=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(m)?m:null}});return je(e,u)}function Ie(s){const[e,u]=i.useState(!1);return i.useEffect(()=>{let n=0;const o=()=>u(_e()),d=()=>{n||(n=requestAnimationFrame(()=>{n=0,o()}))};o();const m=new MutationObserver(d);m.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),m.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 Ae(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 We({index:s,bot:e,bots:u,otherBotId:n,obscured:o,active:d,heldElsewhere:m,controlPending:w,onSelect:h,onTake:x,onRelease:B,onOpenComputer:A}){const v=J[s],p=e?.id??null,_=e?.name??l("vm.workspace.localVm"),b=i.useRef(null),k=i.useRef(Promise.resolve()),z=i.useRef(o),[W,V]=i.useState(0),[j,N]=i.useState(null),[C,y]=i.useState({contextId:v,open:!1,status:"closed",interactive:!1}),[E,g]=i.useState(null),R=i.useCallback(async t=>{if(p)try{const a=await q(`/api/bots/${p}/local-computer`,{signal:t});t?.aborted||N(H(a))}catch{}},[p]),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||!p)){if(!t){g(l("vm.workspace.desktopRequired"));return}try{const S=await q(`/api/bots/${p}/local-computer`,{signal:f.signal});if(!a)return;const X=H(S);N(X);const Y=Ve(S);if(!X.ready||!Y||(await new Promise(me=>{let G=!1;const K=()=>{G||(G=!0,me())},fe=setTimeout(K,100);requestAnimationFrame(()=>{clearTimeout(fe),K()})}),!a))return;const $=oe(b);if(!$)throw new Error("layout-unavailable");const Z=await t.open({contextId:v,url:Y,title:l("vm.workspace.windowTitle",{name:_}),bounds:$});if(!a){await t.close(v).catch(()=>{});return}y(Z),await t.layout([{contextId:v,bounds:$,visible:!z.current&&Z.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(()=>{})))}},[p,_,v,W]),i.useEffect(()=>{if(!p)return;const t=new AbortController,a=window.setInterval(()=>{R(t.signal)},3e4);return()=>{t.abort(),window.clearInterval(a)}},[p,R]);const L=i.useCallback(()=>{const t=window.ogb?.desktopWorkspace,a=oe(b);!t||!a||!C.open||t.layout([{contextId:v,bounds:a,visible:!o}]).catch(()=>g(l("vm.workspace.positionFailed")))},[v,C.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=Ae(j,C.status),r=!!(e&&j?.ready&&C.status==="ready"&&C.open);return c.jsxs("section",{className:Q("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(be,{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:Q("h-1.5 w-1.5 rounded-full",d?"bg-accent":C.status==="ready"?"bg-success":C.status==="error"?"bg-danger":"bg-ink-secondary/50")}),d?l("vm.workspace.youHaveControl"):m?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||m,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}),m?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?!j&&!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})]}):j?.ready&&C.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(ae,{size:21,className:"text-warning"}),c.jsx("div",{className:"text-[12px] leading-relaxed",children:E??(j?.container==="missing"?l("vm.workspace.notCreated",{name:e.name}):j?.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(Ce,{size:13})," ",l("vm.workspace.retryStatus")]}),c.jsx("button",{type:"button",onClick:()=>A(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 Ue({primaryBotId:s,overlayOpen:e,onClose:u,onOpenComputer:n}){const{state:o,dispatch:d}=we(),{dragProps:m}=ge(),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),[A,v]=i.useState(null),p=i.useRef(null),_=i.useRef(null),b=_.current??xe();_.current=b;const k=i.useRef(!1),z=i.useRef(!0),[W,V]=i.useState(!1),[j,N]=i.useState(null),C=Ie(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 D(d,r,t),t.held&&t.owned===!0?p.current=r:p.current===r&&(p.current=null),t},async release(r){const t=await ee({action:"release",syncNativeBrowser:!0,requestControl:a=>ne(r,a,b),setNativeBrowserControl:a=>se()});return D(d,r,t),p.current===r&&(p.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&&D(d,a,f)}catch{}})(),()=>{r=!1}},[d,h]),i.useEffect(()=>{const r=p.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=p.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=p.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:ve()})),!1}finally{k.current=!1,V(!1)}},[y]),R=i.useCallback(async r=>{if(k.current||p.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,p.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(p.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&&p.current===a&&!await g()||x(f=>Re(f,r,t)))},[g]),L=i.useCallback(async()=>{p.current&&!await g()||u()},[g,u]),P=i.useCallback(async r=>{p.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",{...m,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:W,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(he,{size:18})})]}),j&&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(ae,{size:14,className:"shrink-0"})," ",j]}),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(We,{index:r,bot:a,bots:w,otherBotId:h[r===0?1:0],obscured:C,active:!!(a&&A===a.id),heldElsewhere:!!(a&&o.computerControl[a.id]?.held&&A!==a.id),controlPending:W,onSelect:f=>{F(r,f)},onTake:f=>{R(f)},onRelease:()=>{g()},onOpenComputer:f=>{P(f)}},J[r])})})]})}export{Ue as LocalVmWorkspace};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as v,t as n,r as u,j as t}from"./styles-
|
|
1
|
+
import{c as v,t as n,r as u,j as t}from"./styles-BRMaHK08.js";import{d as L,L as k}from"./PlacesRail-dslg5RRJ.js";import{bk as C,bl as j,a0 as N,bm as M,bn as S}from"./App-DCe3hDbm.js";const E=[["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"}]],T=v("shield",E);async function I(e,r,s,a=6e4){const o=Date.now()+a;let c=e;for(;!c.ready&&c.container==="running"&&Date.now()<o;)s.throwIfAborted(),await new Promise((p,d)=>{const m=()=>{window.clearTimeout(l),d(s.reason)},l=window.setTimeout(()=>{s.removeEventListener("abort",m),p()},2e3);s.addEventListener("abort",m,{once:!0})}),c=await r();return s.throwIfAborted(),c}function g(e){if(!e)return e??null;const s={"Create the Local VM":"computer.problem.createVm","The Local VM is stopped; start it to continue":"computer.problem.vmStopped","The Local VM started, but Cua Driver is not ready yet":"computer.problem.cuaNotReady","The existing Local VM uses an older desktop or Cua Driver; recreate it":"computer.problem.oldImage","The existing container was not created by Limix Bot; recreate it":"computer.problem.unmanaged","The existing Local VM exposes its viewer publicly; recreate it":"computer.problem.publicViewer","The existing Local VM is missing safety limits; recreate it":"computer.problem.missingLimits","The existing Local VM is missing its durable folder; recreate it":"computer.problem.missingDurableFolder","Per-bot Local VMs require Docker or Podman because Apple container requires a fixed host port":"computer.problem.perBotRuntime","Install a supported container runtime first":"computer.problem.noRuntime"}[e];if(s)return n(s);const a=/^Start (\S+) first$/.exec(e);if(a)return n("computer.problem.startRuntime",{runtime:a[1]});const o=/^The Local VM desktop failed to start: (.+)$/.exec(e);return o?n("computer.problem.desktopFailed",{detail:o[1]}):e}class V extends Error{constructor(r,s,a){super(r),this.key=r,this.problem=s,this.fallbackKey=a}key;problem;fallbackKey}function K(e){return e instanceof V?n(e.key,e.fallbackKey?{problem:g(e.problem)??n(e.fallbackKey)}:void 0):g(e instanceof Error?e.message:e)}let f=!1;const b=new Set,R=e=>(b.add(e),()=>{b.delete(e)}),w=()=>f;function D(){f=!0;for(const e of b)e()}async function P(e=r=>window.ogb?.permOpenSettings?.(r)){await e("accessibility"),!f&&await e("screen")}function B(){const{capabilities:e}=L(),r=u.useSyncExternalStore(R,w,w),s=e.localComputer.available?null:e.localComputer.message,a=C(j(s)),[o,c]=u.useState(!1),[p,d]=u.useState(!1),[m,l]=u.useState(null),h=async()=>{c(!0),l(null);try{await window.ogb?.localControl?.retry()}catch(i){l(i instanceof Error?i.message:String(i))}finally{c(!1)}},y=async()=>{l(null),d(!0);try{await P()}catch(i){d(!1),l(i instanceof Error?i.message:String(i))}};return u.useEffect(()=>{if(!p||r)return;let i=!1;const x=()=>{i||document.visibilityState==="visible"&&(i=!0,d(!1),h())};return window.addEventListener("focus",x),document.addEventListener("visibilitychange",x),()=>{window.removeEventListener("focus",x),document.removeEventListener("visibilitychange",x)}},[p,r]),e.host.platform!=="darwin"||e.localComputer.reasonCode==="remote-server"||e.localComputer.available||r?null:t.jsx("section",{className:"mt-4 rounded-xl border border-warning/25 bg-warning/10 p-4",children:t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx(T,{size:16,className:"mt-0.5 shrink-0 text-warning"}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("div",{className:"text-[14px] font-medium text-ink",children:n("computer.mac.allowTitle")}),t.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-ink-secondary",children:a??n("computer.mac.permission.generic")}),s&&t.jsxs("details",{className:"mt-2 text-[12px] text-ink-secondary",children:[t.jsx("summary",{className:"cursor-pointer",children:n("computer.mac.permission.driverDetail")}),t.jsx("p",{className:"mt-1 break-words",children:s})]}),m&&t.jsxs("div",{className:"mt-2 flex gap-1.5 text-[12px] text-danger",children:[t.jsx(N,{size:13,className:"mt-0.5 shrink-0"}),t.jsx("span",{children:m})]}),t.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[a&&s&&t.jsx(M,{reason:s}),!a&&t.jsx("button",{type:"button",onClick:()=>{y()},disabled:o,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:n("computer.mac.openSystemSettings")}),t.jsxs("button",{type:"button",onClick:()=>{h()},disabled:o,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:[o&&t.jsx(k,{size:13,className:"animate-spin"}),n("commandAllowlist.retry")]}),!o&&t.jsx(S,{onClick:D})]})]})]})})}export{V as L,B as M,g as l,K as p,I as w};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as i,j as e,t}from"./styles-
|
|
1
|
+
import{r as i,j as e,t}from"./styles-BRMaHK08.js";import{M as w,N as v,O as k,P as j,R as N,U as y,W as C,X as S}from"./App-DCe3hDbm.js";import{L as z}from"./PlacesRail-dslg5RRJ.js";import"./index-D2Jm8LAf.js";import"./monitor-C-EBTsrK.js";import"./MenuMotion-BOUToDZz.js";const E=2*1024*1024;function X({path:s,name:r,message:o}){const[c,x]=i.useState(0),[m,p]=i.useState(null),[u,h]=i.useState(null),[l,f]=i.useState(!1),a=w(s,r,o);i.useEffect(()=>{const n=new AbortController;return h(null),p(null),(async()=>{try{const d=await v(s,o,n.signal),g=await k(d,n.signal,E);n.signal.aborted||p(g)}catch(d){n.signal.aborted||h(d instanceof Error&&d.message==="size"?"size":"load")}})(),()=>n.abort()},[s,o.threadId,o.messageId,c]);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:a.state==="saving",onClick:()=>{a.save()},children:[e.jsx(j,{size:14,className:"shrink-0"}),e.jsx("span",{className:"min-w-0 break-all",children:t("attach.saveAria",{name:r})})]}),e.jsx("button",{type:"button",className:"rounded-lg border border-hairline px-3 py-2 hover:bg-raised",onClick:()=>x(c+1),children:t("chat.retry")})]}),a.state==="failed"&&e.jsx("p",{role:"alert",className:"mt-2 text-[12px] text-danger",children:a.reason})]});return u?e.jsxs("div",{className:"p-8 text-center text-sm",children:[e.jsx("p",{role:"alert",className:"text-ink-secondary",children:t(u==="size"?"markdown.tooLarge":"markdown.loadFailed")}),b]}):m===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"}),t("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":l,"aria-label":t(l?"markdown.rendered":"html.source"),title:t(l?"markdown.rendered":"html.source"),onClick:()=>f(!l),children:l?e.jsx(N,{size:14}):e.jsx(y,{size:14})}),e.jsx("button",{type:"button",className:"table-action","aria-label":t("html.reload"),title:t("html.reload"),onClick:()=>x(c+1),children:e.jsx(C,{size:14})}),e.jsx("button",{type:"button",className:"table-action","aria-label":t("attach.saveAria",{name:r}),title:t("attach.saveAria",{name:r}),disabled:a.state==="saving",onClick:()=>{a.save()},children:e.jsx(j,{size:14})})]}),a.state==="failed"&&e.jsx("p",{role:"alert",className:"text-end text-[12px] text-danger",children:a.reason}),e.jsx(A,{source:m,showSource:l})]})}function A({source:s,showSource:r}){return r?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:s}):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:s})})}export{E as MARKDOWN_PREVIEW_MAX_BYTES,A as MarkdownFileView,X as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as o,r as a}from"./styles-
|
|
1
|
+
import{c as o,r as a}from"./styles-BRMaHK08.js";const d=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],M=o("chevron-right",d);const i=[["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"}]],y=o("keyboard",i);const s=[["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"}]],k=o("refresh-cw",s);const u=[["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"}]],l=o("send",u),h=200;function p(){return typeof document>"u"?!1:document.documentElement.dataset.reducedMotion==="true"?!0:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function f(e){const[t,n]=a.useState(e);a.useLayoutEffect(()=>{if(e){n(!0);return}if(!t)return;if(p()){n(!1);return}const c=window.setTimeout(()=>n(!1),h);return()=>window.clearTimeout(c)},[e,t]);const r=!e&&t;return{shown:e||t,closing:r,className:r?"animate-pop-out pointer-events-none":"animate-pop-in",exitProps:r?{inert:!0,"aria-hidden":!0}:{}}}function w(e){const t=f(e!=null),n=a.useRef(e);return e!=null&&(n.current=e),{...t,value:e??n.current}}export{M as C,y as K,k as R,l as S,f as a,w as u};
|