agentroam-runtime-darwin-arm64 0.2.0-preview.78 → 0.2.0-preview.79
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/manifest.json +2 -2
- package/package.json +1 -1
- package/runtime/.next/BUILD_ID +1 -1
- package/runtime/.next/app-build-manifest.json +8 -8
- package/runtime/.next/app-path-routes-manifest.json +1 -1
- package/runtime/.next/build-manifest.json +3 -3
- package/runtime/.next/prerender-manifest.json +1 -1
- package/runtime/.next/required-server-files.json +1 -1
- package/runtime/.next/server/app/_not-found/page.js +1 -1
- package/runtime/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/runtime/.next/server/app/_not-found.html +1 -1
- package/runtime/.next/server/app/_not-found.rsc +1 -1
- package/runtime/.next/server/app/api/agent/abort/route.js +1 -1
- package/runtime/.next/server/app/api/agent/answer/route.js +1 -1
- package/runtime/.next/server/app/api/agent/codex-sharing/route.js +1 -1
- package/runtime/.next/server/app/api/agent/harness/status/route.js +1 -1
- package/runtime/.next/server/app/api/agent/model/route.js +1 -1
- package/runtime/.next/server/app/api/agent/models/route.js +1 -1
- package/runtime/.next/server/app/api/agent/run/route.js +1 -1
- package/runtime/.next/server/app/api/agent/runtime-health/route.js +1 -1
- package/runtime/.next/server/app/api/agent/steer/route.js +1 -1
- package/runtime/.next/server/app/api/agent/stream/route.js +3 -3
- package/runtime/.next/server/app/api/agent-workspaces/[workspaceId]/sessions/route.js +1 -1
- package/runtime/.next/server/app/api/agent-workspaces/route.js +1 -1
- package/runtime/.next/server/app/api/auth/verify/route.js +1 -1
- package/runtime/.next/server/app/api/business/route.js +1 -1
- package/runtime/.next/server/app/api/calendar/route.js +2 -2
- package/runtime/.next/server/app/api/client-logs/route.js +1 -1
- package/runtime/.next/server/app/api/collaboration/route.js +2 -2
- package/runtime/.next/server/app/api/engine-threads/route.js +1 -1
- package/runtime/.next/server/app/api/engine-threads.body +1 -1
- package/runtime/.next/server/app/api/flow/v1/catalog/route.js +1 -1
- package/runtime/.next/server/app/api/flow/v1/runs/[runId]/cancel/route.js +1 -1
- package/runtime/.next/server/app/api/flow/v1/runs/[runId]/events/route.js +2 -2
- package/runtime/.next/server/app/api/flow/v1/runs/route.js +1 -1
- package/runtime/.next/server/app/api/flow-studio/config/route.js +1 -1
- package/runtime/.next/server/app/api/internal/todo-bootstrap/route.js +1 -1
- package/runtime/.next/server/app/api/internal/todo-mcp/route.js +1 -1
- package/runtime/.next/server/app/api/mcp/connect/route.js +1 -1
- package/runtime/.next/server/app/api/mcp/disconnect/route.js +1 -1
- package/runtime/.next/server/app/api/mcp/servers/route.js +1 -1
- package/runtime/.next/server/app/api/memory/[key]/route.js +1 -1
- package/runtime/.next/server/app/api/memory/route.js +1 -1
- package/runtime/.next/server/app/api/messaging/route.js +1 -1
- package/runtime/.next/server/app/api/notifications/[id]/ack/route.js +1 -1
- package/runtime/.next/server/app/api/notifications/[id]/route.js +1 -1
- package/runtime/.next/server/app/api/notifications/route.js +1 -1
- package/runtime/.next/server/app/api/notifications/stream/route.js +2 -2
- package/runtime/.next/server/app/api/plugins/load/route.js +1 -1
- package/runtime/.next/server/app/api/projects/[id]/route.js +1 -1
- package/runtime/.next/server/app/api/projects/check/route.js +1 -1
- package/runtime/.next/server/app/api/projects/directories/route.js +1 -1
- package/runtime/.next/server/app/api/projects/roots/route.js +1 -1
- package/runtime/.next/server/app/api/projects/route.js +1 -1
- package/runtime/.next/server/app/api/push/subscribe/route.js +2 -2
- package/runtime/.next/server/app/api/push/unsubscribe/route.js +3 -3
- package/runtime/.next/server/app/api/push/vapid/route.js +2 -2
- package/runtime/.next/server/app/api/remote-tools/register/route.js +1 -1
- package/runtime/.next/server/app/api/session-images/[id]/route.js +1 -1
- package/runtime/.next/server/app/api/session-views/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/background-jobs/[jobId]/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/background-jobs/[jobId]/stop/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/background-jobs/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/changes/route.js +2 -2
- package/runtime/.next/server/app/api/sessions/[id]/engine-switches/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/fork/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/fork-at/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/goals/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/handoff/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/native-goal/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/query-index/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/release/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/switch-engine/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/thread-goal/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/thread-history/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/[id]/tool-result/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/parallel/route.js +1 -1
- package/runtime/.next/server/app/api/sessions/route.js +1 -1
- package/runtime/.next/server/app/api/settings/route.js +1 -1
- package/runtime/.next/server/app/api/skills/route.js +1 -1
- package/runtime/.next/server/app/api/todos/[id]/commands/route.js +1 -1
- package/runtime/.next/server/app/api/todos/[id]/executions/route.js +1 -1
- package/runtime/.next/server/app/api/todos/[id]/route.js +1 -1
- package/runtime/.next/server/app/api/todos/route.js +1 -1
- package/runtime/.next/server/app/api/tool-policies/[policyId]/route.js +1 -1
- package/runtime/.next/server/app/api/tool-policies/route.js +1 -1
- package/runtime/.next/server/app/api/tools/route.js +1 -1
- package/runtime/.next/server/app/api/update/check/route.js +1 -1
- package/runtime/.next/server/app/api/update/install/route.js +1 -1
- package/runtime/.next/server/app/api/update/status/route.js +1 -1
- package/runtime/.next/server/app/api/web-auth/login/route.js +1 -1
- package/runtime/.next/server/app/api/web-auth/logout/route.js +1 -1
- package/runtime/.next/server/app/api/web-auth/revoke-all/route.js +1 -1
- package/runtime/.next/server/app/api/web-auth/setup/route.js +1 -1
- package/runtime/.next/server/app/api/web-auth/status/route.js +1 -1
- package/runtime/.next/server/app/api/web-console/bootstrap/route.js +1 -1
- package/runtime/.next/server/app/api/web-console/computer-settings/route.js +1 -1
- package/runtime/.next/server/app/api/web-console/computers/route.js +1 -1
- package/runtime/.next/server/app/api/web-console/device-state/route.js +1 -1
- package/runtime/.next/server/app/api/web-console/history/route.js +1 -1
- package/runtime/.next/server/app/api/web-console/preferences/route.js +1 -1
- package/runtime/.next/server/app/api/workspace-changes/route.js +1 -1
- package/runtime/.next/server/app/web/page.js +4 -4
- package/runtime/.next/server/app/web/page_client-reference-manifest.js +1 -1
- package/runtime/.next/server/app-paths-manifest.json +44 -44
- package/runtime/.next/server/chunks/1298.js +1 -1
- package/runtime/.next/server/chunks/5303.js +2 -2
- package/runtime/.next/server/chunks/6703.js +1 -1
- package/runtime/.next/server/chunks/9119.js +2 -2
- package/runtime/.next/server/chunks/9457.js +1 -1
- package/runtime/.next/server/middleware-build-manifest.js +1 -1
- package/runtime/.next/server/pages/404.html +1 -1
- package/runtime/.next/server/pages/500.html +1 -1
- package/runtime/.next/server/server-reference-manifest.json +1 -1
- package/runtime/.next/static/chunks/app/web/{error-828d278147a0619d.js → error-fac7681c6397fcd7.js} +1 -1
- package/runtime/.next/static/chunks/app/web/layout-79492e587e5930cf.js +1 -0
- package/runtime/.next/static/chunks/app/web/{page-bafdaa23fa1dc1c4.js → page-0f06deb6eb4d49e0.js} +1 -1
- package/runtime/.next/static/chunks/main-app-0c7cccb2825ad747.js +1 -0
- package/runtime/lib/mesh/headscale-client.mjs +81 -0
- package/runtime/lib/mesh/mesh-gateway.mjs +168 -0
- package/runtime/lib/mesh/mesh-service.mjs +158 -0
- package/runtime/native/Support.noindex/AgentRoam Remote Desktop.app/Contents/MacOS/agentroam-remote-desktop +0 -0
- package/runtime/native/Support.noindex/AgentRoam Remote Desktop.app/Contents/Resources/agentroam-component.json +1 -1
- package/runtime/native/Support.noindex/AgentRoam Remote Desktop.app/Contents/_CodeSignature/CodeResources +2 -2
- package/runtime/node_modules/.package-lock.json +17 -17
- package/runtime/node_modules/@agent/native-runtime/dist/index.js +46 -16
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/bridge.mjs +58 -58
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/browser-sdk.js +46 -46
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-n0k9q0s3.mjs → core-2g5j09ba.mjs} +2 -2
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-59ydwk0g.mjs +17 -0
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-76wf4hmr.mjs → core-664d5mmy.mjs} +2 -2
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-ypdsx2xc.mjs → core-70sfhqm6.mjs} +2 -2
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-95gcz3n1.mjs +38 -0
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-ew5sfvfe.mjs +39 -0
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-gjhs7gf6.mjs +20 -0
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-31xm3p73.mjs → core-kvdt1szx.mjs} +4 -4
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-p654hjkr.mjs +22 -0
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-q9bjbxkv.mjs +19 -0
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-samdvsjh.mjs +33 -0
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-09fdstw7.mjs → core-x6bt758j.mjs} +3 -3
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core.mjs +12 -12
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/manifest.json +21 -21
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/manifest.zst.json +25 -25
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/package.json +22 -22
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs +78 -78
- package/runtime/node_modules/caniuse-lite/package.json +1 -1
- package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.cjs +17 -3
- package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.min.cjs +3 -3
- package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.min.mjs +3 -3
- package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.mjs +17 -3
- package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.node.cjs +17 -3
- package/runtime/node_modules/mediabunny/dist/modules/src/isobmff/isobmff-demuxer.js +4 -1
- package/runtime/node_modules/mediabunny/dist/modules/src/isobmff/isobmff-muxer.js +7 -2
- package/runtime/node_modules/mediabunny/dist/modules/src/matroska/matroska-demuxer.js +3 -0
- package/runtime/node_modules/mediabunny/dist/modules/src/mpeg-ts/mpeg-ts-muxer.js +2 -2
- package/runtime/node_modules/mediabunny/dist/modules/src/tsconfig.tsbuildinfo +1 -1
- package/runtime/node_modules/mediabunny/dist/modules/src/version.js +1 -1
- package/runtime/node_modules/mediabunny/package.json +1 -1
- package/runtime/node_modules/mediabunny/src/isobmff/isobmff-demuxer.ts +5 -1
- package/runtime/node_modules/mediabunny/src/isobmff/isobmff-muxer.ts +10 -2
- package/runtime/node_modules/mediabunny/src/matroska/matroska-demuxer.ts +4 -0
- package/runtime/node_modules/mediabunny/src/mpeg-ts/mpeg-ts-muxer.ts +2 -2
- package/runtime/node_modules/mediabunny/src/version.ts +1 -1
- package/runtime/package-lock.json +41 -41
- package/runtime/server.js +1 -1
- package/runtime/webapp/dist/assets/{AIHubView-C0eIFauh.js → AIHubView-4kqTaPjO.js} +1 -1
- package/runtime/webapp/dist/assets/{AgentManager-B7kG8iLS.js → AgentManager-CDgiLqF_.js} +1 -1
- package/runtime/webapp/dist/assets/{AiHubPane-DB6b6Via.js → AiHubPane-C070jRHe.js} +1 -1
- package/runtime/webapp/dist/assets/App-iZlxRHaL.js +68 -0
- package/runtime/webapp/dist/assets/{BrowserLivePanel-BgftwEHQ.js → BrowserLivePanel-DxjgVXXK.js} +1 -1
- package/runtime/webapp/dist/assets/{CalendarPage-sg7SzvUh.js → CalendarPage-CxPVBlzd.js} +1 -1
- package/runtime/webapp/dist/assets/{CalendarView-C5z_2esa.js → CalendarView-CS-OG-13.js} +1 -1
- package/runtime/webapp/dist/assets/{CollaborationCreateDialog-DuEnjSu9.js → CollaborationCreateDialog-tI6S1cha.js} +1 -1
- package/runtime/webapp/dist/assets/{CollaborationDashboard-O13tTlEe.js → CollaborationDashboard-DSZa3Cns.js} +1 -1
- package/runtime/webapp/dist/assets/{CollaborationPage-DIKDOl8G.js → CollaborationPage-COyvllTJ.js} +1 -1
- package/runtime/webapp/dist/assets/{FilePreview-BfkF9hjw.js → FilePreview-CcJXlLge.js} +3 -3
- package/runtime/webapp/dist/assets/{FileTree-pbVSSQnM.js → FileTree-BuhW-pqR.js} +1 -1
- package/runtime/webapp/dist/assets/{FileWorkspaceDrawer-YcKPTu23.js → FileWorkspaceDrawer-ByWXnJ0B.js} +1 -1
- package/runtime/webapp/dist/assets/{FlowStudioPane-D7gzm1M_.js → FlowStudioPane-CxQ-QIOf.js} +1 -1
- package/runtime/webapp/dist/assets/{HostProjectPicker-7zvVzftL.js → HostProjectPicker--J4_JpSW.js} +1 -1
- package/runtime/webapp/dist/assets/{LSPServerList-BfbJdHYJ.js → LSPServerList-fkagcDVv.js} +1 -1
- package/runtime/webapp/dist/assets/{MCPServerList-A1SAlHdR.js → MCPServerList-w7tetX3J.js} +1 -1
- package/runtime/webapp/dist/assets/{MemoryViewer-fFtBJzgz.js → MemoryViewer-Xac9EeaV.js} +1 -1
- package/runtime/webapp/dist/assets/{NewSessionWindow-Ce2M6IVa.js → NewSessionWindow-C460-gxX.js} +1 -1
- package/runtime/webapp/dist/assets/{RemoteDesktopPage-kP5Qzh6n.js → RemoteDesktopPage-BniHztmt.js} +1 -1
- package/runtime/webapp/dist/assets/{RemoteDesktopTabBridge-tJcxPHnZ.js → RemoteDesktopTabBridge-BF1dFltY.js} +1 -1
- package/runtime/webapp/dist/assets/{RunningSessionsIcon-DuoG6Hgs.js → RunningSessionsIcon-D6rY-IzV.js} +1 -1
- package/runtime/webapp/dist/assets/{SessionDashboard-DGfTYjbZ.js → SessionDashboard-D868NjZ_.js} +1 -1
- package/runtime/webapp/dist/assets/{SessionDashboardBridge-Cw8Y0s5_.js → SessionDashboardBridge-AhmhQ1Xn.js} +1 -1
- package/runtime/webapp/dist/assets/{SettingsPanel-DCME-IZC.js → SettingsPanel-DoDRBreZ.js} +1 -1
- package/runtime/webapp/dist/assets/{SkillManager-CFHcSwEr.js → SkillManager-Da7bpT-s.js} +1 -1
- package/runtime/webapp/dist/assets/{TaskPaneTerminal-BozZNjMj.js → TaskPaneTerminal-DTDU88Rr.js} +1 -1
- package/runtime/webapp/dist/assets/{TerminalPane-CPlks8Nc.js → TerminalPane-_dVVs00I.js} +1 -1
- package/runtime/webapp/dist/assets/TodoPage-Bqu8bqNk.js +1 -0
- package/runtime/webapp/dist/assets/{abnfDiagram-VCTEODGH-DoUDteiL.js → abnfDiagram-VCTEODGH-D3GW7M1R.js} +1 -1
- package/runtime/webapp/dist/assets/{arc-Cao4pQp2.js → arc-CkEemU1L.js} +1 -1
- package/runtime/webapp/dist/assets/{architectureDiagram-5GKGNRK7-BvZ3G5rB.js → architectureDiagram-5GKGNRK7-GYQtcFLY.js} +1 -1
- package/runtime/webapp/dist/assets/{blockDiagram-I7D4REHJ-DNv3qaVA.js → blockDiagram-I7D4REHJ-D5_bj13P.js} +1 -1
- package/runtime/webapp/dist/assets/{c4Diagram-7LVT6UL2-DtL8WSam.js → c4Diagram-7LVT6UL2-Cyg1YunN.js} +1 -1
- package/runtime/webapp/dist/assets/{calendar-days-DpxojDWK.js → calendar-days-B1Mn3x8A.js} +1 -1
- package/runtime/webapp/dist/assets/channel-CnNsi-lz.js +1 -0
- package/runtime/webapp/dist/assets/{check-CY3GCzxa.js → check-D-yTByNl.js} +1 -1
- package/runtime/webapp/dist/assets/{chevron-down-FeW7FcBS.js → chevron-down-hiPnZS_M.js} +1 -1
- package/runtime/webapp/dist/assets/{chevron-right-Bnd4FK8S.js → chevron-right-DKsui_wS.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-2Q5K7J3B-Jc2d8B_h.js → chunk-2Q5K7J3B-ZYdmLJUM.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-5VM5RSS4-BbY9artS.js → chunk-5VM5RSS4-C-zA5MxE.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-F27PBJKO-B9uG6DBE.js → chunk-F27PBJKO-cWERJSPb.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-IMKFNOWR-Dta3lxIg.js → chunk-IMKFNOWR-BDqkH2_j.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-JWPE2WC7-DhBjDzbj.js → chunk-JWPE2WC7-D0hOf4wm.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-POPQ4Y6H-D51fNP6n.js → chunk-POPQ4Y6H-bGKHqXLU.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-SVP7TREG-DQ8c4Knv.js → chunk-SVP7TREG-DbzwWcno.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-TICWLB2K-BIDOV_Vx.js → chunk-TICWLB2K-CmCx8YTb.js} +1 -1
- package/runtime/webapp/dist/assets/{chunk-XXDRQBXY-C-y59lCL.js → chunk-XXDRQBXY-COAufrJq.js} +1 -1
- package/runtime/webapp/dist/assets/classDiagram-ZZMXUADV-DVRTvUTS.js +1 -0
- package/runtime/webapp/dist/assets/classDiagram-v2-VYDZK3BY-DVRTvUTS.js +1 -0
- package/runtime/webapp/dist/assets/{client-ZvcI0WiM.js → client-5Hu1eVTX.js} +1 -1
- package/runtime/webapp/dist/assets/{codeSyntax-DlCdufoQ.js → codeSyntax-Jy5nWtHv.js} +1 -1
- package/runtime/webapp/dist/assets/{collaboration-CeiB1Ihl.js → collaboration-DRFqpcAz.js} +1 -1
- package/runtime/webapp/dist/assets/{composer-file-routing-CFoCNmv7.js → composer-file-routing-BtvXnu_o.js} +1 -1
- package/runtime/webapp/dist/assets/{cose-bilkent-JH36ORCC-Do2xoVHK.js → cose-bilkent-JH36ORCC-BU8MmGqT.js} +1 -1
- package/runtime/webapp/dist/assets/{cynefin-OW5HDTMX-CRC3uGN6.js → cynefin-OW5HDTMX-BHXgPQGq.js} +1 -1
- package/runtime/webapp/dist/assets/{cynefinDiagram-5FMLGOSQ-BD90NfUx.js → cynefinDiagram-5FMLGOSQ-DSJJ_PpM.js} +1 -1
- package/runtime/webapp/dist/assets/{dagre-GXQ25YYZ-BeO7O01r.js → dagre-GXQ25YYZ-pJr8jDyF.js} +1 -1
- package/runtime/webapp/dist/assets/{diagram-S7CK7UJ4-DGvd2V5u.js → diagram-S7CK7UJ4-BZ_7PPQn.js} +1 -1
- package/runtime/webapp/dist/assets/{diagram-UQ7AKVKN-_Ns2BTM0.js → diagram-UQ7AKVKN-c8pu5Rp4.js} +1 -1
- package/runtime/webapp/dist/assets/{diagram-VSXAHHWV-D45wsjUv.js → diagram-VSXAHHWV-D1xao_j-.js} +1 -1
- package/runtime/webapp/dist/assets/{diagram-VX7I27RA-B_898k8e.js → diagram-VX7I27RA-CnBWGCHa.js} +1 -1
- package/runtime/webapp/dist/assets/{diagram-Z3DM3KII-CdbHDj9L.js → diagram-Z3DM3KII-D-TCo4OF.js} +1 -1
- package/runtime/webapp/dist/assets/{download-Cy_rpjte.js → download-B2jLl85N.js} +1 -1
- package/runtime/webapp/dist/assets/{ebnfDiagram-PWID7BFC-eqVvfCy6.js → ebnfDiagram-PWID7BFC-BGBuf1T3.js} +1 -1
- package/runtime/webapp/dist/assets/{erDiagram-RLTQ6QDP-eRQEDuTP.js → erDiagram-RLTQ6QDP-D8rCYH4y.js} +1 -1
- package/runtime/webapp/dist/assets/{file-types-BsWJSk07.js → file-types-BZ8YZAV-.js} +1 -1
- package/runtime/webapp/dist/assets/{flowDiagram-HODETNUW-BLS4V7Zd.js → flowDiagram-HODETNUW-BJGQL6in.js} +1 -1
- package/runtime/webapp/dist/assets/{ganttDiagram-EL5Y4UJY-C1JdU9e_.js → ganttDiagram-EL5Y4UJY-K9o-Kk2M.js} +1 -1
- package/runtime/webapp/dist/assets/{gitGraphDiagram-WWUBYQGX-kAprA0xM.js → gitGraphDiagram-WWUBYQGX-BC2r8pLT.js} +1 -1
- package/runtime/webapp/dist/assets/{history-BGr6tFSR.js → history-Ci0s2eVL.js} +1 -1
- package/runtime/webapp/dist/assets/{image-plus-Cr9rDqvd.js → image-plus-Cx4LQVvj.js} +1 -1
- package/runtime/webapp/dist/assets/{index-CrjQF-VW.js → index-D1AQffdA.js} +3 -3
- package/runtime/webapp/dist/assets/{infoDiagram-27XIBGKW-DzUFk2zb.js → infoDiagram-27XIBGKW-bFnrh7W7.js} +1 -1
- package/runtime/webapp/dist/assets/{ishikawaDiagram-5VMMS53U-DETvimW1.js → ishikawaDiagram-5VMMS53U-Qun77xRt.js} +1 -1
- package/runtime/webapp/dist/assets/{journeyDiagram-3NMN7TZE-ZmlLOhVV.js → journeyDiagram-3NMN7TZE-DjCfoBNX.js} +1 -1
- package/runtime/webapp/dist/assets/{kanban-definition-UXKFOSKX-Q5j9iBkD.js → kanban-definition-UXKFOSKX-BJGlhVsx.js} +1 -1
- package/runtime/webapp/dist/assets/{layout-xVYWH0Cz.js → layout-CYTxygXU.js} +1 -1
- package/runtime/webapp/dist/assets/{linear-BD5xYHq0.js → linear-CzJGOwUm.js} +1 -1
- package/runtime/webapp/dist/assets/{list-todo-BJrNf0OF.js → list-todo-CP9DqU2D.js} +1 -1
- package/runtime/webapp/dist/assets/{loader-circle-BSDHoDXf.js → loader-circle-xEKTnlp3.js} +1 -1
- package/runtime/webapp/dist/assets/{locate-fixed-BBOLeIa6.js → locate-fixed-CfEojGOl.js} +1 -1
- package/runtime/webapp/dist/assets/{mermaid.core-XNny-og5.js → mermaid.core-BTbaaIjb.js} +5 -5
- package/runtime/webapp/dist/assets/{mindmap-definition-YA3MSWOX-CCuaFOfd.js → mindmap-definition-YA3MSWOX-eiKdbp4J.js} +1 -1
- package/runtime/webapp/dist/assets/{mobileViewport-Ckhq6eml.js → mobileViewport-DF1R6qR2.js} +1 -1
- package/runtime/webapp/dist/assets/{new-session-window-ThRZvGVK.js → new-session-window-BFILhYAe.js} +24 -24
- package/runtime/webapp/dist/assets/{page-DK2ooc8J.js → page-B-CkpInM.js} +3 -3
- package/runtime/webapp/dist/assets/{pause-BF1q8wFt.js → pause-C-ecDo3W.js} +1 -1
- package/runtime/webapp/dist/assets/{pegDiagram-XKGWAZYB-Dt2wEt-q.js → pegDiagram-XKGWAZYB-BuvePvoF.js} +1 -1
- package/runtime/webapp/dist/assets/{pieDiagram-E7YTZNPT-Bv5PR_0B.js → pieDiagram-E7YTZNPT-Csgh2lYE.js} +1 -1
- package/runtime/webapp/dist/assets/{pin-ByCe4NyB.js → pin-CjmuX5Tq.js} +1 -1
- package/runtime/webapp/dist/assets/{quadrantDiagram-AXDQQJYC-mUp15pA4.js → quadrantDiagram-AXDQQJYC-8Bbl_RHv.js} +1 -1
- package/runtime/webapp/dist/assets/{railroadDiagram-O6MQD6OU-CU79-JOl.js → railroadDiagram-O6MQD6OU-CvYQkIeK.js} +1 -1
- package/runtime/webapp/dist/assets/{requirementDiagram-BXWQKSXE-DosZrbGa.js → requirementDiagram-BXWQKSXE-CytOuQX4.js} +1 -1
- package/runtime/webapp/dist/assets/{rotate-ccw-DtSpwbK7.js → rotate-ccw-HY6j6nBt.js} +1 -1
- package/runtime/webapp/dist/assets/{rotate-cw-DdQZP8we.js → rotate-cw-CyYR2IEw.js} +1 -1
- package/runtime/webapp/dist/assets/{sankeyDiagram-P5KCCOFB-BWbz07Kw.js → sankeyDiagram-P5KCCOFB-BoyI7ZhF.js} +1 -1
- package/runtime/webapp/dist/assets/{send-CtGGbUpC.js → send-jSK0YaRl.js} +1 -1
- package/runtime/webapp/dist/assets/{sequenceDiagram-WJ2MYXX4-DeUcGtwv.js → sequenceDiagram-WJ2MYXX4-Ckvtmn2N.js} +1 -1
- package/runtime/webapp/dist/assets/{session-dashboard-7G2sKgmw.js → session-dashboard-B4lyuZYF.js} +1 -1
- package/runtime/webapp/dist/assets/{session-tree-Ck5Wp7h-.js → session-tree-CEy-pW8A.js} +1 -1
- package/runtime/webapp/dist/assets/{shield-check-BIxrmOwR.js → shield-check-CFebh9do.js} +1 -1
- package/runtime/webapp/dist/assets/{sizeCapture-INFHLROL-DPrrG2Kd.js → sizeCapture-INFHLROL-yUQjHNrI.js} +1 -1
- package/runtime/webapp/dist/assets/{stateDiagram-D77RDMKH-CtlmJgrm.js → stateDiagram-D77RDMKH-Dj8oPHDB.js} +1 -1
- package/runtime/webapp/dist/assets/stateDiagram-v2-MP3YSRHH-Csg946NK.js +1 -0
- package/runtime/webapp/dist/assets/{swimlanes-42K2YHIH-rMtOxOkm.js → swimlanes-42K2YHIH-GDjg8QNS.js} +1 -1
- package/runtime/webapp/dist/assets/swimlanesDiagram-VR7AAH4N-BUnuRfXp.js +8 -0
- package/runtime/webapp/dist/assets/{timeline-definition-24CTP7MA-D0C5B_7F.js → timeline-definition-24CTP7MA-DFDHsxzp.js} +1 -1
- package/runtime/webapp/dist/assets/{trash-2-CT_MslWu.js → trash-2-BF9eI5Bh.js} +1 -1
- package/runtime/webapp/dist/assets/{types-pH-pRUSS.js → types-BuPq0iQM.js} +1 -1
- package/runtime/webapp/dist/assets/{use-session-activity-B9xAOlzA.js → use-session-activity-Ceb8OBjB.js} +1 -1
- package/runtime/webapp/dist/assets/{vennDiagram-4TSXK5OY-B8iPk0Tm.js → vennDiagram-4TSXK5OY-DR5HBqo1.js} +1 -1
- package/runtime/webapp/dist/assets/{wardleyDiagram-VM6X3IG4-Cb60IRaS.js → wardleyDiagram-VM6X3IG4-Bb6pROnE.js} +1 -1
- package/runtime/webapp/dist/assets/{web-D-dNOCeI.js → web-BV7fxnr4.js} +1 -1
- package/runtime/webapp/dist/assets/{web-DTj73nYv.js → web-C8kCU9om.js} +1 -1
- package/runtime/webapp/dist/assets/{x-3I6TKNBE.js → x-uSekqXJV.js} +1 -1
- package/runtime/webapp/dist/assets/{xychartDiagram-S5SC5T6Z-DWXthhJz.js → xychartDiagram-S5SC5T6Z-CrpaVklx.js} +1 -1
- package/runtime/webapp/dist/assets/{zoom-out-417ojKB8.js → zoom-out-B59mGU6c.js} +1 -1
- package/runtime/webapp/dist/index.html +1 -1
- package/runtime/ws-server.mjs +9 -0
- package/runtime/.next/static/chunks/app/web/layout-1127176e7e88e395.js +0 -1
- package/runtime/.next/static/chunks/main-app-07d67f2d4e96ecb8.js +0 -1
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-7sb5cs8h.mjs +0 -39
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-cfz10gtb.mjs +0 -24
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-p9759xd0.mjs +0 -22
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-rszpc155.mjs +0 -17
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-ttfdej7v.mjs +0 -20
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-y906qay4.mjs +0 -28
- package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-yp8w8nva.mjs +0 -38
- package/runtime/webapp/dist/assets/App-m33SPX0n.js +0 -68
- package/runtime/webapp/dist/assets/TodoPage-BuDedc75.js +0 -1
- package/runtime/webapp/dist/assets/channel-Dz0U21-m.js +0 -1
- package/runtime/webapp/dist/assets/classDiagram-ZZMXUADV-CL_0n_9Y.js +0 -1
- package/runtime/webapp/dist/assets/classDiagram-v2-VYDZK3BY-CL_0n_9Y.js +0 -1
- package/runtime/webapp/dist/assets/stateDiagram-v2-MP3YSRHH-C9bL7Wc5.js +0 -1
- package/runtime/webapp/dist/assets/swimlanesDiagram-VR7AAH4N-x5ntdS3v.js +0 -8
- /package/runtime/.next/static/{N0n_ri0ArZV5CvaOg_qnx → Ra6nQooMsDWN9-yjPL93f}/_buildManifest.js +0 -0
- /package/runtime/.next/static/{N0n_ri0ArZV5CvaOg_qnx → Ra6nQooMsDWN9-yjPL93f}/_ssgManifest.js +0 -0
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./CalendarView-C5z_2esa.js","./index-CrjQF-VW.js","./index-zQk0NCEB.css","./calendar-days-DpxojDWK.js","./x-3I6TKNBE.js","./chevron-right-Bnd4FK8S.js","./locate-fixed-BBOLeIa6.js","./list-todo-BJrNf0OF.js","./chevron-down-FeW7FcBS.js","./check-CY3GCzxa.js","./pause-BF1q8wFt.js","./CalendarView-BjjC_t12.css","./CollaborationDashboard-O13tTlEe.js","./CollaborationTabBridge-Dxq4G1Uk.js","./CollaborationCreateDialog-DuEnjSu9.js","./types-pH-pRUSS.js","./HostProjectPicker-7zvVzftL.js","./file-types-BsWJSk07.js","./trash-2-CT_MslWu.js","./client-ZvcI0WiM.js","./session-tree-Ck5Wp7h-.js","./collaboration-CeiB1Ihl.js","./collaboration-B0IRHmY_.css","./SessionDashboardBridge-Cw8Y0s5_.js","./CollaborationDashboard-CCXC6JuQ.css","./CollaborationPage-DIKDOl8G.js","./artifact-links-B0ApmgK6.js","./composer-file-routing-CFoCNmv7.js","./loader-circle-BSDHoDXf.js","./shield-check-BIxrmOwR.js","./history-BGr6tFSR.js","./image-plus-Cr9rDqvd.js","./SessionDashboard-DGfTYjbZ.js","./session-dashboard-7G2sKgmw.js","./session-dashboard-BZIyuFTU.css","./use-session-activity-B9xAOlzA.js","./SessionDashboard-CAYVDT8Z.css","./BrowserLivePanel-BgftwEHQ.js","./RemoteDesktopTabBridge-tJcxPHnZ.js","./zoom-out-417ojKB8.js","./rotate-ccw-DtSpwbK7.js","./TaskPaneTerminal-BozZNjMj.js","./TerminalPane-CPlks8Nc.js","./mobileViewport-Ckhq6eml.js","./TerminalPane-6GBZ9nXN.css","./AIHubView-C0eIFauh.js","./new-session-window-ThRZvGVK.js","./RunningSessionsIcon-DuoG6Hgs.js","./download-Cy_rpjte.js","./new-session-window-BtGAiW4A.css","./send-CtGGbUpC.js","./SettingsPanel-DCME-IZC.js","./rotate-cw-DdQZP8we.js","./pin-ByCe4NyB.js","./MCPServerList-A1SAlHdR.js","./MemoryViewer-fFtBJzgz.js","./SkillManager-CFHcSwEr.js","./AgentManager-B7kG8iLS.js","./LSPServerList-BfbJdHYJ.js","./FileWorkspaceDrawer-YcKPTu23.js","./FilePreview-BfkF9hjw.js","./FilePreview-B7Ab2X_E.css","./FileTree-pbVSSQnM.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{c as Oe,af as da,i as fn,r,a as qe,j as e,k as Yt,U as ua,l as lt,ae as Ce,h as Nn,R as As,A as Pn,n as Vr,t as wt,u as Re,ag as hs,ah as Ur,ai as Kr,aj as pa,ak as fa,al as mr,am as ha,an as ga,ao as ma}from"./index-CrjQF-VW.js";import{t as wa,b as ba,d as Ss,e as xa,f as zt,g as ya,h as gs,i as wr,j as va,k as br,l as ka,s as Sa,m as ja,n as Ca,o as Ia,p as Ta,q as ms,v as Aa,w as Ea,x as ws,y as Na,z as xr,A as yr,B as vr,c as Pa,M as Ra,D as La,T as Da,E as _a,F as Oa,G as za,H as Ma,I as Gr,L as kr,J as Wa,K as $a,N as Ha,O as bs,Q as Ba,R as An,U as Kt,V as Sr,W as Fa,X as qa,u as Va,S as Ua,C as Ka,Y as Ga,Z as Ya,_ as Xa,$ as Ja,a0 as Qa,a1 as Za,a2 as eo,a3 as to}from"./new-session-window-ThRZvGVK.js";import{c as xt,A as Yr}from"./client-ZvcI0WiM.js";import{i as zn,m as Gt,c as pn,a as no,b as Mn,S as Xr,d as Jr,u as so,r as ro,e as io,f as ao,o as oo,g as Rn,s as Ln,h as Dn,j as jr,k as co}from"./session-tree-Ck5Wp7h-.js";import{T as Cr}from"./composer-file-routing-CFoCNmv7.js";import{u as hn,S as Qr,C as lo}from"./CollaborationCreateDialog-DuEnjSu9.js";import{u as Zr,b as uo}from"./use-session-activity-B9xAOlzA.js";import{L as po,D as fo,p as ei}from"./session-dashboard-7G2sKgmw.js";import{X as yt}from"./x-3I6TKNBE.js";import{S as Wn,i as ho}from"./file-types-BsWJSk07.js";import{C as Ir}from"./chevron-down-FeW7FcBS.js";import{L as bt}from"./loader-circle-BSDHoDXf.js";import{L as go}from"./list-todo-BJrNf0OF.js";import{C as Es}from"./calendar-days-DpxojDWK.js";import{M as mo}from"./RunningSessionsIcon-DuoG6Hgs.js";import{A as wo,T as bo}from"./trash-2-CT_MslWu.js";import{R as ti}from"./rotate-cw-DdQZP8we.js";import{E as ni}from"./RemoteDesktopTabBridge-tJcxPHnZ.js";import{P as xo}from"./pin-ByCe4NyB.js";import{U as yo}from"./collaboration-CeiB1Ihl.js";import{C as vo}from"./chevron-right-Bnd4FK8S.js";import{S as ko,c as un,a as So,r as Tr}from"./SessionDashboardBridge-Cw8Y0s5_.js";import{a as jo,f as Co}from"./CollaborationTabBridge-Dxq4G1Uk.js";import{D as Io}from"./download-Cy_rpjte.js";import{C as To}from"./check-CY3GCzxa.js";import{H as Ao}from"./HostProjectPicker-7zvVzftL.js";import{p as Eo,r as No,i as Po}from"./artifact-links-B0ApmgK6.js";import{H as Ro}from"./history-BGr6tFSR.js";/**
|
|
3
|
-
* @license lucide-react v0.468.0 - ISC
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the ISC license.
|
|
6
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/const Lo=Oe("BellRing",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M22 8c0-2.3-.8-4.3-2-6",key:"5bb3ad"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}],["path",{d:"M4 2C2.8 3.7 2 5.7 2 8",key:"tap9e0"}]]);/**
|
|
8
|
-
* @license lucide-react v0.468.0 - ISC
|
|
9
|
-
*
|
|
10
|
-
* This source code is licensed under the ISC license.
|
|
11
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
12
|
-
*/const Do=Oe("Bell",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]]);/**
|
|
13
|
-
* @license lucide-react v0.468.0 - ISC
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the ISC license.
|
|
16
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/const _o=Oe("CalendarCheck2",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 14V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8",key:"bce9hv"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"m16 20 2 2 4-4",key:"13tcca"}]]);/**
|
|
18
|
-
* @license lucide-react v0.468.0 - ISC
|
|
19
|
-
*
|
|
20
|
-
* This source code is licensed under the ISC license.
|
|
21
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
22
|
-
*/const Oo=Oe("ClockAlert",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["path",{d:"M16 21.16a10 10 0 1 1 5-13.516",key:"cxo92l"}],["path",{d:"M20 11.5v6",key:"2ei3xq"}],["path",{d:"M20 21.5h.01",key:"1r2dzp"}]]);/**
|
|
23
|
-
* @license lucide-react v0.468.0 - ISC
|
|
24
|
-
*
|
|
25
|
-
* This source code is licensed under the ISC license.
|
|
26
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
27
|
-
*/const zo=Oe("Columns4",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7.5 3v18",key:"w0wo6v"}],["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"M16.5 3v18",key:"10tjh1"}]]);/**
|
|
28
|
-
* @license lucide-react v0.468.0 - ISC
|
|
29
|
-
*
|
|
30
|
-
* This source code is licensed under the ISC license.
|
|
31
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
32
|
-
*/const Mo=Oe("FolderTree",[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]);/**
|
|
33
|
-
* @license lucide-react v0.468.0 - ISC
|
|
34
|
-
*
|
|
35
|
-
* This source code is licensed under the ISC license.
|
|
36
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
37
|
-
*/const Ar=Oe("Grid2x2",[["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"M3 12h18",key:"1i2n21"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]);/**
|
|
38
|
-
* @license lucide-react v0.468.0 - ISC
|
|
39
|
-
*
|
|
40
|
-
* This source code is licensed under the ISC license.
|
|
41
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
42
|
-
*/const Wo=Oe("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/**
|
|
43
|
-
* @license lucide-react v0.468.0 - ISC
|
|
44
|
-
*
|
|
45
|
-
* This source code is licensed under the ISC license.
|
|
46
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
47
|
-
*/const $o=Oe("LockKeyhole",[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]]);/**
|
|
48
|
-
* @license lucide-react v0.468.0 - ISC
|
|
49
|
-
*
|
|
50
|
-
* This source code is licensed under the ISC license.
|
|
51
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
52
|
-
*/const Ho=Oe("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/**
|
|
53
|
-
* @license lucide-react v0.468.0 - ISC
|
|
54
|
-
*
|
|
55
|
-
* This source code is licensed under the ISC license.
|
|
56
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
57
|
-
*/const Bo=Oe("MessageCircleQuestion",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
|
|
58
|
-
* @license lucide-react v0.468.0 - ISC
|
|
59
|
-
*
|
|
60
|
-
* This source code is licensed under the ISC license.
|
|
61
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
62
|
-
*/const Fo=Oe("MessageSquarePlus",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);/**
|
|
63
|
-
* @license lucide-react v0.468.0 - ISC
|
|
64
|
-
*
|
|
65
|
-
* This source code is licensed under the ISC license.
|
|
66
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
67
|
-
*/const qo=Oe("PanelsTopLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]]);function Vo(n,s){if(Object.is(n,s))return!0;if(typeof n!="object"||n===null||typeof s!="object"||s===null)return!1;if(n instanceof Map&&s instanceof Map){if(n.size!==s.size)return!1;for(const[i,c]of n)if(!Object.is(c,s.get(i)))return!1;return!0}if(n instanceof Set&&s instanceof Set){if(n.size!==s.size)return!1;for(const i of n)if(!s.has(i))return!1;return!0}const o=Object.keys(n);if(o.length!==Object.keys(s).length)return!1;for(const i of o)if(!Object.prototype.hasOwnProperty.call(s,i)||!Object.is(n[i],s[i]))return!1;return!0}const{useRef:Uo}=da;function Ko(n){const s=Uo();return o=>{const i=n(o);return Vo(s.current,i)?s.current:s.current=i}}const js="agentroam:task-pane-notification";function Go(n){return!window.dispatchEvent(new CustomEvent(js,{cancelable:!0,detail:{sessionId:n}}))}const si="agentroam.all-sessions.v2",Yo=20;function _n(n){try{const s=n??(typeof window>"u"?void 0:window.localStorage),o=JSON.parse((s==null?void 0:s.getItem(si))??"null");return!ii(o)||o.version!==2||!Array.isArray(o.data)||!o.data.every(ai)||typeof o.total!="number"||!Number.isSafeInteger(o.total)||o.total<o.data.length?null:{data:o.data,total:o.total}}catch{return null}}function Xo(n,s){const o=zn(n.data.slice(0,Yo),[...n.data,...n.ancestors??[]]);ri({data:o,total:n.total},s)}function ri(n,s){try{const o=s??(typeof window>"u"?void 0:window.localStorage);o==null||o.setItem(si,JSON.stringify({version:2,...n}))}catch{}}function Jo(n,s){const o=_n(s);if(!o)return;const i=new Set(n),c=o.data.filter(l=>!i.has(l.id));ri({data:c,total:Math.max(c.length,o.total-i.size)},s)}function ii(n){return n!==null&&typeof n=="object"&&!Array.isArray(n)}function ai(n){return ii(n)&&typeof n.id=="string"&&fn(n.agentType)&&typeof n.title=="string"&&typeof n.cwd=="string"&&typeof n.updated=="string"&&(n.completedAt===void 0||typeof n.completedAt=="string")&&typeof n.status=="string"&&["idle","running","completed","failed"].includes(n.status)&&typeof n.canResume=="boolean"&&(n.projectId===void 0||typeof n.projectId=="string")&&(n.parentSessionId===void 0||typeof n.parentSessionId=="string")&&(n.readOnly===void 0||typeof n.readOnly=="boolean")&&(n.occupancy===void 0||typeof n.occupancy=="string"&&["available","owned-by-customer-agent","owned-externally"].includes(n.occupancy))}const oi="agentroam.task-session-catalog.v1",xs=30,Er=100;function Qo(){try{const n=JSON.parse(window.localStorage.getItem(oi)??"null");return!n||!Array.isArray(n.rows)||!n.rows.every(ai)||!Number.isSafeInteger(n.count)||n.count<0||n.count>n.rows.length?null:{rows:n.rows,count:n.count}}catch{return null}}function Zo({rows:n,count:s}){try{window.localStorage.setItem(oi,JSON.stringify({rows:n,count:s}))}catch{}}async function ec(n,s,o,i){const c=async(d,u)=>{i.throwIfAborted();const y=await n(d,u);if(i.throwIfAborted(),d&&(y.nextCursor===d||y.nextCursor&&!y.data.length))throw new Error("会话分页标记无效,请刷新");return y};if(o&&s.cursor)try{const d=await c(s.cursor,xs);return{rows:Gt(s.rows,pn(d)),count:s.count+d.data.length,cursor:d.nextCursor}}catch(d){if(!no(d))throw d}const l=Math.max(xs,s.count+(o?xs:0));let h=await c(void 0,Math.min(l,Er));if(h.refreshing)return{...s,rows:Gt(s.rows,pn(h)),refreshing:!0};let m=h.data.length,f=pn(h);for(;m<l&&h.nextCursor;)h=await c(h.nextCursor,Math.min(l-m,Er)),m+=h.data.length,f=Gt(f,pn(h));return{rows:f,count:m,cursor:h.nextCursor}}function Nr(n,s){const o=s.trim().toLocaleLowerCase(),i=n.filter(c=>`${c.title} ${c.cwd} ${c.agentType}`.toLocaleLowerCase().includes(o));return zn(i,n)}function tc(n){var o,i;const s=new Map;for(const c of n){const{session:l}=c,h=s.get(l.agentType)??{folders:new Map,sessionCount:0},m=((o=l.cwd)==null?void 0:o.trim())||"未指定文件夹",f=((i=l.cwd)==null?void 0:i.trim())||"__unknown__",d=h.folders.get(f);d?d.sessions.push(c):h.folders.set(f,{key:`${l.agentType}:${f}`,label:m,sessions:[c]}),h.sessionCount+=1,s.set(l.agentType,h)}return[...s].map(([c,l])=>({key:c,label:Yr[c]??c,folders:[...l.folders.values()],sessionCount:l.sessionCount}))}function nc({session:n,currentId:s,openIds:o,onChoose:i}){return e.jsxs("button",{type:"button",className:"task-picker-item",disabled:n.id===s,onClick:()=>i(n),children:[e.jsx(Xr,{session:n,active:n.id===s}),e.jsx(Yt,{agentType:n.agentType,size:20}),e.jsxs("span",{className:"task-picker-item-text",children:[e.jsx("strong",{children:n.title||"未命名任务"}),e.jsxs("small",{children:[Yr[n.agentType]," · ",n.cwd||"未指定目录"]})]}),e.jsx("em",{children:n.id===s?"当前任务":o.has(n.id)?"已在分屏":n.status==="running"?"进行中":""})]})}function sc({currentId:n,openIds:s,knownSessions:o=[],onChoose:i,onClose:c}){const[l,h]=r.useState(""),[m,f]=r.useState("grouped"),[d,u]=r.useState(new Set),[y,A]=r.useState(new Set),C=hn(),w=Zr(),k=r.useMemo(()=>new Map(w==null?void 0:w.sessions.map(D=>[D.id,D])),[w]),[v]=r.useState(()=>{var D;return Qo()??{rows:((D=_n())==null?void 0:D.data)??[],count:0}}),_=r.useRef(v),P=r.useRef({...v,cursor:null}),[B,Z]=r.useState(P.current),ce=r.useMemo(()=>Gt(B.rows,Nr(o,l)),[B.rows,o,l]),[se,W]=r.useState(!0),[$,M]=r.useState(null),K=r.useRef(null),le=r.useRef(!1),re=r.useRef(null),ie=r.useRef(),ae=r.useRef(c);ae.current=c;const Ae=async(D,G=!1)=>{if(K.current)return;window.clearTimeout(ie.current);const X=new AbortController;K.current=X,le.current=G,W(!0),M(null);try{const F=await ec((R,ue)=>xt({action:"sessionCatalog",query:D,cursor:R,limit:ue,backgroundRefresh:!R},{signal:X.signal}),P.current,G,X.signal);if(X.signal.aborted)return;P.current=F,Z(F),!D&&!F.refreshing&&(_.current=F,Zo(F)),F.refreshing&&(ie.current=window.setTimeout(()=>{Ae(D,G)},2e3))}catch(F){if(!X.signal.aborted){Z(ue=>ue.refreshing?{...ue,refreshing:!1}:ue);const R=F instanceof Error?F.message:"无法加载任务";M(/timeout|timed out/i.test(R)?"任务列表更新超时,请重试":R)}}finally{K.current===X&&(K.current=null,W(!1))}};r.useEffect(()=>{var X;const D=document.activeElement;(X=re.current)==null||X.focus();const G=F=>{F.key==="Escape"&&(F.preventDefault(),F.stopPropagation(),ae.current())};return document.addEventListener("keydown",G,!0),()=>{document.removeEventListener("keydown",G,!0),D!=null&&D.isConnected&&D.focus()}},[]),r.useEffect(()=>{const D=l.trim(),G=_.current;P.current={rows:Nr(G.rows,D),count:D?0:G.count,cursor:null},Z(P.current),W(!0),M(null);const X=window.setTimeout(()=>{Ae(D)},D?200:0);return()=>{var F;window.clearTimeout(X),window.clearTimeout(ie.current),(F=K.current)==null||F.abort(),K.current=null}},[l]);const{cursor:de,refreshing:O}=B,te=r.useMemo(()=>Mn(ce),[ce]),Se=r.useMemo(()=>tc(te),[te]),Ee=({session:D,children:G})=>{const X=C.expandedIds.has(D.id),F=k.get(D.id),R=F&&(F.status==="running"||F.updated>=D.updated)?{...D,...F}:D;return e.jsxs("div",{children:[e.jsxs("div",{className:"task-picker-session-row",children:[e.jsx(nc,{session:R,currentId:n,openIds:s,onChoose:i}),G.length>0&&e.jsx(Qr,{title:D.title,expanded:X,onToggle:()=>C.toggle(D.id)})]}),X&&G.length>0&&e.jsx("div",{className:"task-picker-session-children",role:"group","aria-label":`${D.title}的子会话`,children:G.map(Ee)})]},D.id)},ve=(D,G)=>{D(X=>{const F=new Set(X);return F.has(G)?F.delete(G):F.add(G),F})};return qe.createPortal(e.jsx("div",{className:"task-picker-backdrop",onPointerDown:D=>{D.target===D.currentTarget&&c()},children:e.jsxs("section",{className:"task-picker",role:"dialog","aria-modal":"true","aria-label":"选择分屏任务",onKeyDown:D=>{if(D.key!=="Tab")return;const G=Array.from(D.currentTarget.querySelectorAll("button:not(:disabled), input")),X=G[0],F=G.at(-1);D.shiftKey&&document.activeElement===X?(D.preventDefault(),F==null||F.focus()):!D.shiftKey&&document.activeElement===F&&(D.preventDefault(),X==null||X.focus())},children:[e.jsxs("header",{children:[e.jsx("h2",{children:"选择任务"}),e.jsxs("div",{className:"task-picker-header-actions",children:[e.jsxs("div",{className:"task-picker-view-toggle",role:"group","aria-label":"任务排列方式",children:[e.jsxs("button",{type:"button",className:`task-picker-view-button${m==="grouped"?" is-active":""}`,"aria-pressed":m==="grouped",onClick:()=>f("grouped"),children:[e.jsx(Mo,{size:14,"aria-hidden":"true"}),"分组"]}),e.jsxs("button",{type:"button",className:`task-picker-view-button${m==="list"?" is-active":""}`,"aria-pressed":m==="list",onClick:()=>f("list"),children:[e.jsx(po,{size:14,"aria-hidden":"true"}),"列表"]})]}),e.jsx("button",{type:"button",className:"ui-icon-button",onClick:c,"aria-label":"关闭任务选择",children:e.jsx(yt,{size:18})})]})]}),e.jsxs("label",{className:"task-picker-search",children:[e.jsx(Wn,{size:16,"aria-hidden":"true"}),e.jsx("input",{ref:re,value:l,onChange:D=>h(D.target.value),placeholder:"搜索任务、目录或 Agent","aria-label":"搜索分屏任务"})]}),$&&e.jsxs("div",{className:"task-picker-error",role:"alert",children:[$,e.jsx("button",{type:"button",onClick:()=>void Ae(l.trim(),le.current),children:"重试"})]}),e.jsxs("div",{className:"task-picker-list","aria-busy":!te.length&&(se||O),children:[m==="list"?te.map(Ee):Se.map(D=>{const G=d.has(D.key);return e.jsxs("section",{className:`task-picker-agent-group${G?" is-collapsed":""}`,"aria-label":`${D.label}任务`,children:[e.jsxs("button",{type:"button",className:"task-picker-group-header","aria-expanded":!G,onClick:()=>ve(u,D.key),children:[e.jsx(Ir,{size:15,className:`task-picker-chevron${G?" is-collapsed":""}`,"aria-hidden":"true"}),e.jsx(Yt,{agentType:D.key,size:18}),e.jsx("strong",{children:D.label}),e.jsxs("small",{children:[D.sessionCount," 个任务"]})]}),!G&&e.jsx("div",{className:"task-picker-agent-content",children:D.folders.map(X=>{const F=y.has(X.key);return e.jsxs("section",{className:`task-picker-folder-group${F?" is-collapsed":""}`,"aria-label":`${D.label} · ${X.label}`,children:[e.jsxs("button",{type:"button",className:"task-picker-folder-header","aria-expanded":!F,onClick:()=>ve(A,X.key),children:[e.jsx(Ir,{size:14,className:`task-picker-chevron${F?" is-collapsed":""}`,"aria-hidden":"true"}),e.jsx(ho,{size:15,"aria-hidden":"true"}),e.jsx("span",{title:X.label,children:X.label}),e.jsx("small",{children:X.sessions.length})]}),!F&&e.jsx("div",{className:"task-picker-folder-items",children:X.sessions.map(Ee)})]},X.key)})})]},D.key)}),!se&&!O&&!te.length&&!$&&e.jsx("p",{className:"task-picker-empty",children:"没有找到任务,试试其他关键词"}),(se||O)&&e.jsxs("p",{className:"task-picker-empty",role:"status",children:[e.jsx(bt,{size:16,className:"task-split-spinner"}),te.length?"显示已有任务,正在后台更新…":"正在加载任务…"]}),de&&!O&&e.jsx("button",{className:"task-picker-more",type:"button",disabled:se,onClick:()=>void Ae(l.trim(),!0),children:"加载更多任务"})]})]})}),document.body)}function rc({node:n,renderPane:s,onResize:o,onSwap:i,maximizedPaneId:c}){const l=r.useRef(null),[h,m]=r.useState({width:0,height:0}),f=r.useRef(null),d=r.useRef(null),[u,y]=r.useState(null),A=wa(n,h.width,h.height);r.useLayoutEffect(()=>{const w=l.current;if(!w)return;const k=()=>m(_=>_.width===w.clientWidth&&_.height===w.clientHeight?_:{width:w.clientWidth,height:w.clientHeight});k();const v=new ResizeObserver(k);return v.observe(w),window.addEventListener("resize",k),()=>{v.disconnect(),window.removeEventListener("resize",k)}},[]);const C=(w,k)=>{const v=d.current;!v||v.pointerId!==w.pointerId||(d.current=null,y(null),w.currentTarget.hasPointerCapture(w.pointerId)&&w.currentTarget.releasePointerCapture(w.pointerId),k&&v.moved&&v.target&&(i==null||i(v.source,v.target)))};return e.jsxs("div",{ref:l,className:`task-split-layout${u?" is-reordering":""}`,onKeyDown:w=>{if(w.key!=="Escape"||!d.current)return;const k=d.current;d.current=null,y(null),w.stopPropagation(),k.element.hasPointerCapture(k.pointerId)&&k.element.releasePointerCapture(k.pointerId)},children:[A.panes.map(({paneId:w,rect:k})=>e.jsxs("div",{"data-task-slot":w,className:`task-split-pane${(u==null?void 0:u.source)===w?" is-moving":""}${(u==null?void 0:u.target)===w?" is-drop-target":""}`,style:c?{left:0,top:0,width:"100%",height:"100%",display:c===w?"flex":"none"}:{left:k.x,top:k.y,width:k.width,height:k.height},onPointerDownCapture:v=>{const _=v.target;v.button!==0||!i||c||A.panes.length<2||!_.closest(".chat-top-bar")||_.closest("button, input, textarea, select, a, [role='button'], [contenteditable='true']")||(v.preventDefault(),d.current={source:w,target:null,pointerId:v.pointerId,x:v.clientX,y:v.clientY,moved:!1,element:v.currentTarget},v.currentTarget.setPointerCapture(v.pointerId))},onPointerMove:v=>{var ce,se;const _=d.current,P=(ce=l.current)==null?void 0:ce.getBoundingClientRect();if(!_||_.pointerId!==v.pointerId||!P||!_.moved&&Math.hypot(v.clientX-_.x,v.clientY-_.y)<6)return;_.moved=!0;const B=v.clientX-P.left,Z=v.clientY-P.top;_.target=((se=A.panes.find(W=>W.paneId!==_.source&&B>=W.rect.x&&B<W.rect.x+W.rect.width&&Z>=W.rect.y&&Z<W.rect.y+W.rect.height))==null?void 0:se.paneId)??null,y(W=>(W==null?void 0:W.source)===_.source&&W.target===_.target?W:{source:_.source,target:_.target})},onPointerUp:v=>C(v,!0),onPointerCancel:v=>C(v,!1),onLostPointerCapture:v=>C(v,!1),children:[s(w),(u==null?void 0:u.target)===w&&e.jsx("span",{className:"task-pane-swap-hint",role:"status",children:"松开交换位置"})]},w)),A.separators.map(w=>e.jsx("div",{className:`task-split-separator task-split-separator--${w.axis}`,style:{left:w.rect.x,top:w.rect.y,width:w.rect.width,height:w.rect.height,display:c?"none":void 0},role:"separator",tabIndex:0,"aria-label":w.axis==="columns"?"调整左右任务宽度":"调整上下任务高度","aria-orientation":w.axis==="columns"?"vertical":"horizontal","aria-valuemin":10,"aria-valuemax":90,"aria-valuenow":Math.round(w.ratio*100),onPointerDown:k=>{if(k.button!==0)return;k.preventDefault();const v=w.axis==="columns";f.current={id:w.id,coordinate:v?k.clientX:k.clientY,ratio:w.ratio,extent:w.extent,columns:v},k.currentTarget.setPointerCapture(k.pointerId)},onPointerMove:k=>{const v=f.current;v&&o(v.id,ba(v.ratio,(v.columns?k.clientX:k.clientY)-v.coordinate,v.extent))},onPointerUp:k=>{f.current=null,k.currentTarget.hasPointerCapture(k.pointerId)&&k.currentTarget.releasePointerCapture(k.pointerId)},onPointerCancel:()=>{f.current=null},onLostPointerCapture:()=>{f.current=null},onDoubleClick:()=>o(w.id,.5),onKeyDown:k=>{const v=w.axis==="columns"?["ArrowLeft","ArrowRight"]:["ArrowUp","ArrowDown"];k.key===v[0]||k.key===v[1]?(k.preventDefault(),o(w.id,w.ratio+(k.key===v[0]?-.05:.05))):(k.key==="Home"||k.key==="End")&&(k.preventDefault(),o(w.id,k.key==="Home"?.1:.9))}},w.id))]})}const ic={"remote-desktop":mo,groups:ua,dashboard:Wo,calendar:Es,terminal:xa};function Pr({onTask:n,onDraft:s,onSurface:o}){return e.jsxs("div",{className:"task-pane-choices",children:[e.jsxs("button",{type:"button",onClick:n,children:[e.jsx(go,{size:17,"aria-hidden":"true"}),e.jsx("span",{children:"选择任务"})]}),e.jsxs("button",{type:"button",onClick:s,children:[e.jsx(Fo,{size:17,"aria-hidden":"true"}),e.jsx("span",{children:"新建会话"})]}),Object.keys(Ss).map(i=>{const c=ic[i];return e.jsxs("button",{type:"button",onClick:()=>o(i),children:[e.jsx(c,{size:17,"aria-hidden":"true"}),e.jsx("span",{children:Ss[i]})]},i)})]})}const ac=r.lazy(()=>Ce(()=>import("./CalendarView-C5z_2esa.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]),import.meta.url)),oc=r.lazy(()=>Ce(()=>import("./CollaborationDashboard-O13tTlEe.js"),__vite__mapDeps([12,1,2,13,14,15,16,17,4,18,5,19,20,21,22,8,23,24]),import.meta.url)),cc=r.lazy(()=>Ce(()=>import("./CollaborationPage-DIKDOl8G.js"),__vite__mapDeps([25,1,2,26,27,28,4,23,29,19,21,22,15,13,30,31,9]),import.meta.url)),lc=r.lazy(()=>Ce(()=>import("./SessionDashboard-DGfTYjbZ.js"),__vite__mapDeps([32,1,2,23,33,34,20,19,35,21,22,4,8,29,10,36]),import.meta.url)),dc=r.lazy(()=>Ce(()=>Promise.resolve().then(()=>Hc),void 0,import.meta.url)),uc=r.lazy(()=>Ce(()=>import("./BrowserLivePanel-BgftwEHQ.js"),__vite__mapDeps([37,1,2,28,8,38,39,40,4]),import.meta.url)),pc=r.lazy(()=>Ce(()=>import("./TaskPaneTerminal-BozZNjMj.js"),__vite__mapDeps([41,1,2,42,43,38,44]),import.meta.url)),fc=async(n,s)=>{var o;if(!((o=window.agentApi)!=null&&o.calendarOverview))throw new Error("当前服务不支持日历,请更新共享服务。");return window.agentApi.calendarOverview({from:n,to:s})};function hc({kind:n,paneId:s,focused:o,cwd:i,onOpenSession:c,onNewSession:l,onChangeContent:h,onSelectSurface:m,onViewAgent:f,active:d=!0}){var A;const[u,y]=r.useState(null);return r.useEffect(()=>{y(null)},[n]),e.jsxs("div",{className:"task-pane-surface","data-pane-surface":n,children:[u&&e.jsxs("nav",{className:"task-pane-group-navigation","aria-label":"群聊导航",children:[e.jsxs("button",{type:"button",onClick:()=>y(null),children:[e.jsx(wo,{size:14,"aria-hidden":"true"}),n==="dashboard"?"返回 Dashboard":"返回群聊列表"]}),e.jsx("span",{title:u.title,children:u.title})]}),e.jsx("div",{className:"task-pane-surface-body",children:e.jsx(r.Suspense,{fallback:e.jsx(zt,{label:"正在打开面板"}),children:u?e.jsx(cc,{groupId:u.id,initialDiscussionId:u.discussionId},`${u.id}:${u.discussionId??""}`):n==="calendar"?e.jsx(ac,{loadOverview:fc}):n==="terminal"?e.jsx(pc,{paneId:s,active:d,focused:o}):n==="remote-desktop"&<()?e.jsx(uc,{open:!0,active:d,embedded:!0,onClose:h}):n==="remote-desktop"?e.jsx("div",{className:"task-pane-remote-desktop",children:typeof window<"u"&&typeof((A=window.agentApi)==null?void 0:A.desktopLiveGetStatus)=="function"?e.jsx(dc,{}):e.jsxs("div",{className:"task-pane-surface-unavailable",children:[e.jsx("p",{children:"当前客户端不支持远程桌面。"}),e.jsx("button",{type:"button",onClick:h,children:"选择其他内容"})]})}):n==="groups"?e.jsx(oc,{cwd:i,onOpen:C=>y({id:C.id,title:C.name}),onViewDashboard:()=>m("dashboard")}):e.jsx(lc,{onOpenGroup:C=>y({id:C.group.id,title:C.group.name,discussionId:C.discussionId}),onOpenSession:c,onNewSession:l,onViewAgent:f,onViewGroups:()=>m("groups")})})})]})}function ci(n){try{const s=new URL(n);return s.protocol==="http:"||s.protocol==="https:"?s.toString():null}catch{return null}}function gc(n,s){const o="allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox",i=ci(n);return i&&s&&s!=="null"&&new URL(i).origin!==s?`${o} allow-same-origin`:o}function mc({paneId:n,url:s,visible:o=!0,onFocus:i}){const c=ci(s),l=gc(s,typeof window>"u"?void 0:window.location.origin),[h,m]=r.useState(0),[f,d]=r.useState("loading");r.useEffect(()=>{d("loading");const y=window.setTimeout(()=>d(A=>A==="loading"?"waiting":A),15e3);return()=>window.clearTimeout(y)},[s,h]);const u=()=>m(y=>y+1);return e.jsxs("div",{className:"task-pane-web-page task-pane-web-page--browser","aria-label":"网页","aria-hidden":!o,style:{visibility:o?void 0:"hidden"},onFocusCapture:i,onPointerDownCapture:i,children:[e.jsxs("div",{className:"task-pane-web-address",children:[e.jsx("span",{title:s,children:s}),e.jsx("button",{type:"button",className:"ui-icon-button","aria-label":"刷新网页",title:"刷新网页",disabled:!c,onClick:u,children:e.jsx(ti,{size:14})}),c&&e.jsx("a",{className:"ui-icon-button",href:c,target:"_blank",rel:"noopener noreferrer","aria-label":"在新标签页打开",title:"在新标签页打开",children:e.jsx(ni,{size:14})})]}),e.jsx("div",{className:"task-pane-web-embedding-note",children:"若网站限制内嵌或页面无法登录,请在新标签页打开。"}),e.jsxs("div",{className:"task-pane-web-content","aria-busy":!!(c&&f==="loading"),children:[c&&e.jsx("iframe",{className:"task-pane-web-frame",src:c,title:`网页:${s}`,sandbox:l,referrerPolicy:"no-referrer",onLoad:()=>d("loaded"),onError:()=>d("error")},`${n}:${s}:${h}`),(!c||f==="error")&&e.jsxs("div",{className:"task-pane-web-status",role:"alert",children:[e.jsx("span",{children:c?"网页未能载入,请重试或在新标签页打开。":"只能预览 HTTP 或 HTTPS 网页。"}),c&&e.jsx("button",{type:"button",onClick:u,children:"重试"})]}),c&&f==="loading"&&e.jsxs("div",{className:"task-pane-web-status task-pane-web-status--loading",role:"status",children:[e.jsx(bt,{className:"task-split-spinner",size:20}),e.jsx("span",{children:"正在载入网页…"})]}),c&&f==="waiting"&&e.jsxs("div",{className:"task-pane-web-waiting",role:"status",children:[e.jsx("span",{children:"网页仍在载入,可继续等待或重试。"}),e.jsx("button",{type:"button",onClick:u,children:"重试"})]})]})]})}const wc='dialog[open], [aria-modal="true"], [data-task-page-overlay], .collab-desktop-overlay, .appearance-panel, .header-action-menu-panel, .composer-workspace-picker-menu--portal, .composer-agent-picker-menu, .composer-model-menu';function bc({paneId:n,url:s,visible:o=!0,onFocus:i}){const c=typeof window>"u"?void 0:window.agentApi,l=typeof(c==null?void 0:c.taskPageOpen)=="function",h=r.useRef(null),m=r.useRef(i);m.current=i;const[f,d]=r.useState("loading"),u=r.useRef({visible:o,state:f});u.current={visible:o,state:f};const y=r.useRef(""),A=r.useRef(()=>{}),C=r.useCallback(async()=>{if(!l||!c){d("error");return}d("loading");const w=await c.taskPageOpen(n,s).catch(()=>({ok:!1}));d(w.ok?"ready":"error")},[c,l,n,s]);return r.useEffect(()=>{if(!l||!c){d("error");return}const w=c.onHubEvent(k=>{var v;k.siteId===`task-pane-${n}`&&(k.type==="focused"&&((v=m.current)==null||v.call(m)),k.type==="loading"&&d("loading"),k.type==="loaded"&&d("ready"),k.type==="load-failed"&&d("error"))});return()=>{w(),c.taskPageClose(n)}},[c,l,n]),r.useEffect(()=>{C()},[C]),r.useEffect(()=>{if(!l||!c||!h.current)return;const w=h.current;let k=0;const v=()=>{const Z=w.getBoundingClientRect(),ce=Math.max(0,Z.left),se=Math.max(0,Z.top),W=Math.max(0,Math.min(window.innerWidth,Z.right)-ce),$=Math.max(0,Math.min(window.innerHeight,Z.bottom)-se),M=Array.from(document.querySelectorAll(wc)).some(re=>{if(!re.getClientRects().length||getComputedStyle(re).visibility==="hidden")return!1;if(re.matches('dialog[open], [aria-modal="true"]'))return!0;const ie=re.getBoundingClientRect();return ie.left<ce+W&&ie.right>ce&&ie.top<se+$&&ie.bottom>se}),K=u.current.visible&&u.current.state==="ready"&&w.getClientRects().length>0&&getComputedStyle(w).visibility==="visible"&&!w.closest('[inert], [aria-hidden="true"]')&&W>0&&$>0&&!M?{x:ce,y:se,width:W,height:$}:null,le=JSON.stringify(K);y.current!==le&&(y.current=le,c.taskPageSetBounds(n,K))},_=()=>{cancelAnimationFrame(k),k=requestAnimationFrame(v)};A.current=_;const P=new ResizeObserver(_);P.observe(w);const B=new MutationObserver(_);return B.observe(document.body,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["style","class","open","aria-hidden","hidden","inert"]}),window.addEventListener("resize",_),window.addEventListener("scroll",_,!0),_(),()=>{P.disconnect(),B.disconnect(),cancelAnimationFrame(k),window.removeEventListener("resize",_),window.removeEventListener("scroll",_,!0),A.current=()=>{},y.current="",c.taskPageSetBounds(n,null)}},[c,l,n]),r.useEffect(()=>{A.current()},[f,o]),e.jsxs("div",{className:"task-pane-web-page","aria-label":"网页","aria-busy":f==="loading",children:[e.jsxs("div",{className:"task-pane-web-address",children:[e.jsx("span",{title:s,children:s}),e.jsx("button",{type:"button",className:"ui-icon-button","aria-label":"刷新网页",title:"刷新网页",onClick:()=>{if(f==="error"){C();return}c==null||c.taskPageReload(n)},children:e.jsx(ti,{size:14})}),e.jsx("button",{type:"button",className:"ui-icon-button","aria-label":"在浏览器中打开",title:"在浏览器中打开",onClick:()=>{c==null||c.openExternal(s)},children:e.jsx(ni,{size:14})})]}),e.jsx("div",{ref:h,className:"task-pane-web-content",children:f!=="ready"&&e.jsxs("div",{className:"task-pane-web-status",role:f==="error"?"alert":"status",children:[f==="loading"?e.jsx(bt,{className:"task-split-spinner",size:20}):null,e.jsx("span",{children:f==="loading"?"正在打开网页…":l?"无法打开网页":"请重启桌面端以启用内嵌网页"}),f==="error"&&l&&e.jsx("button",{type:"button",onClick:()=>{C()},children:"重试"})]})})]})}function xc(n){return lt()?e.jsx(mc,{...n}):e.jsx(bc,{...n})}function yc({enabled:n,children:s,onFocusSession:o,onNavigateSession:i,onSessionCreated:c,onOpenCalendar:l,onSplitChange:h}){var Qe,dt,Mt,Wt;const[m,f]=r.useState(!1),[d,u]=r.useState(null),[y,A]=r.useState(null),[C,w]=r.useState(null),[k,v]=r.useState(null),_=r.useRef(null),[P,B]=r.useState(!1),[Z,ce]=r.useState(null),[se,W]=r.useState({}),$=r.useRef(new Map),M=r.useRef(d);M.current=d;const K=r.useRef(m);K.current=m;const le=r.useRef(null),re=r.useRef(0),ie=r.useRef(!1),ae=r.useRef(new Map),Ae=r.useRef(0),de=r.useRef({onFocusSession:o,onNavigateSession:i,onSessionCreated:c});de.current={onFocusSession:o,onNavigateSession:i,onSessionCreated:c};const O=r.useRef(s.props.selectedSessionId),te=r.useRef(s.props.focusComposerNonce),Se=r.useRef(s.props);Se.current=s.props,r.useEffect(()=>{h==null||h(n&&m)},[n,m,h]);const Ee=g=>{if(le.current)try{g?localStorage.setItem(le.current,Ia(g)):localStorage.removeItem(le.current)}catch{}};r.useEffect(()=>{if(!n||!m||!d)return;const g=window.setTimeout(()=>Ee(d),180);return()=>window.clearTimeout(g)},[n,m,d]),r.useEffect(()=>()=>{re.current++,ae.current.clear()},[]),r.useEffect(()=>{n||(Ee(M.current),re.current++,ae.current.clear(),ie.current=!1,K.current=!1,f(!1),B(!1),W({}),w(null),v(null),A(null))},[n]),r.useEffect(()=>{if(!k)return;const g=S=>{if(S.key==="Escape"){S.preventDefault(),v(null);return}if(S.key!=="Tab")return;const j=Array.from(document.querySelectorAll(".task-content-picker button:not(:disabled)")),T=j[0],E=j[j.length-1];S.shiftKey&&document.activeElement===T?(S.preventDefault(),E==null||E.focus()):!S.shiftKey&&document.activeElement===E&&(S.preventDefault(),T==null||T.focus())};return document.addEventListener("keydown",g),()=>{var S;document.removeEventListener("keydown",g),(S=_.current)!=null&&S.isConnected&&_.current.focus({preventScroll:!0})}},[k]),r.useEffect(()=>{if(!n||!m)return;const g=S=>{var E,z;if(S.defaultPrevented||ie.current||!K.current||!M.current||!lt()&&!((E=window.agentApi)!=null&&E.taskPageOpen))return;const j=(z=S.detail)==null?void 0:z.url;if(typeof j!="string")return;const T=Ta(M.current,j);T&&(S.preventDefault(),ae.current.delete(T.activePaneId),$.current.delete(T.activePaneId),W(q=>({...q,[T.activePaneId]:!1})),M.current=T,u(T),A(null))};return window.addEventListener(Cr,g),()=>window.removeEventListener(Cr,g)},[n,m]);const ve=r.useCallback(g=>{const S=M.current,j=S==null?void 0:S.panes.find(E=>E.id===g);if(!S||!j||S.activePaneId===g)return;const T={...S,activePaneId:g};M.current=T,u(T),A(E=>E?g:null),j.session&&(O.current=j.session.id,de.current.onFocusSession(j.session))},[]),D=(g,S,j)=>{const T=M.current;if(!T||!T.panes.some(q=>q.id===g))return;const E=T.panes.find(q=>{var J;return((J=q.session)==null?void 0:J.id)===S.id&&q.id!==g});if(E){ve(E.id);return}const z=Oa(T,g,S,j);M.current=z,u(z),T.activePaneId===g&&(O.current=S.id,de.current.onFocusSession(S))},G=async(g,S,j)=>{var E;if(!K.current||ie.current)return;const T=++Ae.current;if(ae.current.set(g,T),j){W(z=>({...z,[g]:!1})),D(g,j);return}W(z=>({...z,[g]:!0})),ce(null);try{const z=await ms(S);return ae.current.get(g)!==T||!K.current||!z.session||!((E=M.current)!=null&&E.panes.some(q=>q.id===g))?void 0:(D(g,z.session,z.initialHistory),z.session)}catch(z){K.current&&ae.current.get(g)===T&&ce(z instanceof Error?z.message:"无法更换任务")}finally{ae.current.get(g)===T&&W(z=>({...z,[g]:!1}))}};r.useEffect(()=>{if(!n||!m)return;const g=S=>{var q;const j=(q=S.detail)==null?void 0:q.sessionId,T=M.current;if(S.defaultPrevented||!j||!T||ie.current||!K.current)return;S.preventDefault();const E=T.activePaneId,z=++Ae.current;ae.current.set(E,z),W(J=>({...J,[E]:!0})),ce(null),ms({id:j}).then(J=>{if(!K.current||ae.current.get(E)!==z||!J.session||!M.current)return;const Ne=Aa(M.current,E,J.session,J.initialHistory);M.current=Ne,u(Ne),Ne.activePaneId===E&&(O.current=J.session.id,de.current.onFocusSession(J.session))}).catch(J=>{K.current&&ae.current.get(E)===z&&ce(J instanceof Error?J.message:"无法打开通知会话")}).finally(()=>{ae.current.get(E)===z&&W(J=>({...J,[E]:!1}))})};return window.addEventListener(js,g),()=>window.removeEventListener(js,g)},[n,m]);const X=async(g=!1)=>{var j,T,E,z;const S=++re.current;ie.current=!0,w(null),v(null),ae.current.clear(),W({}),K.current=!0,f(!0),B(!0),ce(null),A(null),O.current=Se.current.selectedSessionId;try{if(lt())le.current=`agentroam:web-task-split:v1:${window.location.origin}${window.location.pathname}`;else{const ne=await window.sharedServiceApi.status(),ye=((j=ne.selected)==null?void 0:j.dataDir)??((T=ne.selected)==null?void 0:T.instanceId);if(!ye)throw new Error("请先连接 AgentRoam 服务");le.current=`agentroam:desktop-task-split:v1:${ye}`}let q=g?null:M.current;if(!g&&!q)try{q=Ea(JSON.parse(localStorage.getItem(le.current)||"null"))}catch{}if(!q){const ne=await xt({action:"dashboard"});if(ne.discoveryError)throw new Error(ne.discoveryError);const ye=[...new Map(ne.agents.flatMap(ge=>ge.sessions).filter(ge=>ge.status!=="completed"&&ge.status!=="failed").map(ge=>[ge.id,ws(ge)])).values()],We=Se.current.sessionSummary;!ye.length&&We&&ye.push(We);const st=ye.map(ge=>({id:crypto.randomUUID(),session:ge}));for(;st.length<2;)st.push({id:crypto.randomUUID(),session:null});q={panes:st,layout:br(st.map(ge=>ge.id)),activePaneId:((E=st.find(ge=>{var gn;return((gn=ge.session)==null?void 0:gn.id)===(We==null?void 0:We.id)}))==null?void 0:E.id)??st[0].id}}const J=await Promise.allSettled(q.panes.map(async ne=>ne.session?{...ne,...await ms(ne.session)}:ne));if(S!==re.current||!K.current)return;let Ne=0;const U=J.map((ne,ye)=>ne.status==="fulfilled"?ne.value:(Ne++,q.panes[ye])),Pe={...q,panes:U};M.current=Pe,u(Pe);const ee=(z=U.find(ne=>ne.id===Pe.activePaneId))==null?void 0:z.session;ee&&de.current.onFocusSession(ee),Ne&&ce(`${Ne} 个任务暂未加载完成,可在对应格重试或更换任务`)}catch(q){S===re.current&&K.current&&ce(q instanceof Error?q.message:"无法打开任务分屏")}finally{S===re.current&&K.current&&(ie.current=!1,B(!1))}},F=()=>{var S,j;Ee(M.current),re.current++,ie.current=!1,ae.current.clear(),W({}),B(!1),K.current=!1,f(!1),w(null),v(null),A(null);const g=(j=(S=M.current)==null?void 0:S.panes.find(T=>{var E;return T.id===((E=M.current)==null?void 0:E.activePaneId)}))==null?void 0:j.session;g&&de.current.onNavigateSession(g)};if(r.useEffect(()=>{if(!n||!m||P)return;const g=s.props.selectedSessionId,S=s.props.sessionSummary;if(!g||g===O.current||(S==null?void 0:S.id)!==g||!M.current)return;O.current=g;const j=M.current.panes.find(T=>{var E;return((E=T.session)==null?void 0:E.id)===g});j?ve(j.id):G(M.current.activePaneId,S,S)},[n,m,P,s.props.selectedSessionId,s.props.sessionSummary,ve]),r.useEffect(()=>{te.current!==s.props.focusComposerNonce&&(te.current=s.props.focusComposerNonce,m&&(Ee(M.current),re.current++,ae.current.clear(),W({}),K.current=!1,f(!1),w(null),v(null)))},[s.props.focusComposerNonce,m]),!n)return s;const R=async g=>{const S=C;if(w(null),!m||S==="single"){de.current.onNavigateSession(ws(g));return}const j=M.current;if(!j||!S)return;const T=j.panes.find(q=>{var J;return((J=q.session)==null?void 0:J.id)===g.id});if(T){ve(T.id);return}let E=S;if(S==="add"){const q=Na(j,ws(g),crypto.randomUUID());M.current=q.state,u(q.state),A(null),E=q.paneId}const z=await G(E,g);z&&so.getState().markViewed(z.id,Date.now())},ue=g=>{var T;const S=M.current;if(!S)return;const j=za(S,g);if(j!==S){if(ae.current.delete(g),W(E=>({...E,[g]:!1})),w(E=>E===g?null:E),v(E=>E===g?null:E),M.current=j,u(j),(!j||j.layout!==S.layout)&&($.current.delete(g),A(E=>E===g?null:E)),!j){F();return}if(Ee(j),S.activePaneId===g){const E=(T=j.panes.find(z=>z.id===j.activePaneId))==null?void 0:T.session;E&&(O.current=E.id,de.current.onFocusSession(E))}}},V=s.props,ze=lt(),Ie=ze&&window.parent!==window,Y=d==null?void 0:d.panes.find(g=>g.id===d.activePaneId),nt=((Qe=Y==null?void 0:Y.session)==null?void 0:Qe.agentType)??((dt=Y==null?void 0:Y.draft)==null?void 0:dt.agentType),je=(g,S)=>u(j=>j&&vr(j,g,S)),ke=(g,S)=>{var E;if(ie.current)return;if(lt()&&S&&"surface"in S&&S.surface==="remote-desktop"){const z=(E=M.current)==null?void 0:E.panes.find(q=>q.id!==g&&q.surface==="remote-desktop");if(z){v(null),ve(z.id);return}}ae.current.delete(g),$.current.delete(g),W(z=>({...z,[g]:!1}));const j=M.current;if(!j)return;const T=xr(j,g,S);M.current=T,u(T),v(null)},Te=(g,S)=>{if(ie.current)return;const j=M.current,T=j==null?void 0:j.panes.find(q=>q.surface===g);if(T){ve(T.id);return}const E=j==null?void 0:j.panes.find(q=>q.id===j.activePaneId),z=E&&yr(E)?E:j==null?void 0:j.panes.find(yr);if(z)ke(z.id,{surface:g});else if(S)S();else if(j){const q=wr(j,crypto.randomUUID()),J=xr(q,q.activePaneId,{surface:g});M.current=J,u(J),A(null)}},Ve=g=>{var E,z,q;const S=M.current;if(ie.current||!S)return;const j=Se.current;ae.current.delete(g),$.current.delete(g),W(J=>({...J,[g]:!1}));const T=vr(S,g,{agentType:((E=j.sessionSummary)==null?void 0:E.agentType)??j.activeAgentType??"customer-agent",projectId:((z=j.sessionSummary)==null?void 0:z.projectId)??j.selectedProjectId??null,cwd:((q=j.sessionSummary)==null?void 0:q.cwd)??j.workspacePath??"",workspaceSource:j.workspaceSource},!0);M.current=T,u(T),v(null)},Me=g=>{var J,Ne;const S=d==null?void 0:d.panes.find(U=>U.id===g);if(!S)return null;let j=$.current.get(g);j||(j=Pa(),$.current.set(g,j));const T=S.session,E=S.draft,z=S.surface?Ss[S.surface]:S.webUrl?"网页":(T==null?void 0:T.title)||(E?"新建会话":"空面板"),q=e.jsxs("div",{className:"task-pane-controls",children:[e.jsx("button",{type:"button",className:"ui-icon-button",onClick:U=>{_.current=U.currentTarget,v(g)},title:"切换面板内容","aria-label":"切换面板内容",children:e.jsx(Ar,{size:15})}),e.jsx("button",{type:"button",className:"ui-icon-button",onClick:()=>A(U=>U===g?null:g),title:y===g?"恢复分屏":"放大此格","aria-label":y===g?"恢复分屏":"放大此格",children:y===g?e.jsx(Ra,{size:15}):e.jsx(La,{size:15})}),e.jsx("button",{type:"button",className:"ui-icon-button",onClick:()=>ue(g),title:(J=S.history)!=null&&J.length?"关闭当前内容,返回上一项":"移除此格(任务继续运行)","aria-label":(Ne=S.history)!=null&&Ne.length?"关闭当前内容,返回上一项":"移除此格",children:e.jsx(yt,{size:16})})]});return e.jsxs("section",{className:`task-pane${(d==null?void 0:d.activePaneId)===g?" is-active":""}${y===g?" is-maximized":""}`,"data-task-pane":g,"data-task-session":(T==null?void 0:T.id)??"","data-pane-content":S.surface??(S.webUrl?"web":T||E?"task":"empty"),"aria-label":z,onPointerDownCapture:()=>ve(g),onFocusCapture:()=>ve(g),children:[S.surface||S.webUrl?e.jsxs("div",{className:"task-pane-feature",children:[e.jsxs("header",{className:"chat-top-bar task-pane-feature-header",children:[e.jsx("strong",{children:z}),q]}),S.surface?e.jsx(hc,{kind:S.surface,paneId:g,focused:(d==null?void 0:d.activePaneId)===g,cwd:V.workspacePath??void 0,active:!y||y===g,onOpenSession:U=>{G(g,U)},onNewSession:()=>Ve(g),onChangeContent:()=>v(g),onViewAgent:()=>w(g),onSelectSurface:U=>ke(g,{surface:U})}):e.jsx(xc,{paneId:g,url:S.webUrl,visible:!y||y===g,onFocus:()=>ve(g)})]}):T||E?e.jsx(Da,{draft:E,onDraftChange:U=>je(g,U),children:r.cloneElement(s,{agentStore:j,desktopTaskPane:!0,desktopTaskOwnsSession:U=>{var ee;if(!K.current)return!1;const Pe=((ee=M.current)==null?void 0:ee.panes)??[];return Pe.some(ne=>{var ye;return ne.id===g&&((ye=ne.session)==null?void 0:ye.id)===U})||!Pe.some(ne=>{var ye;return((ye=ne.session)==null?void 0:ye.id)===U})},activeAgentType:(T==null?void 0:T.agentType)??E.agentType,selectedProjectId:(T==null?void 0:T.projectId)??(E==null?void 0:E.projectId)??null,selectedSessionId:(T==null?void 0:T.id)??null,sessionSummary:T??void 0,sessionTitle:(T==null?void 0:T.title)??"新建会话",workspacePath:(T==null?void 0:T.cwd)??E.cwd,workspaceSource:void 0,initialSessionHistory:_a(S,V.initialSessionHistory),onToggleSidebar:void 0,onReplaceTask:()=>w(g),paneControls:q,headerAppActions:void 0,onOpenTaskSplit:void 0,onSelectAgent:void 0,onSelectWorkspace:void 0,onPickWorkspaceFolder:void 0,voiceCommand:(d==null?void 0:d.activePaneId)===g?V.voiceCommand:null,focusComposerNonce:E?1:void 0,onSelectSession:(U,Pe)=>{G(g,{id:U},Pe)},onSessionCreated:(U,Pe)=>{var ee,ne;G(g,{id:U},Pe),Pe&&((ne=(ee=de.current).onSessionCreated)==null||ne.call(ee,Pe))},onParallelSessionSelected:U=>{G(g,U,U)}})}):e.jsxs("div",{className:"task-pane-empty",children:[e.jsx("div",{className:"task-pane-empty-controls",children:q}),e.jsx(gs,{size:24,"aria-hidden":"true"}),e.jsx("p",{children:"选择这一列要展示的内容"}),e.jsx(Pr,{onTask:()=>w(g),onDraft:()=>Ve(g),onSurface:U=>ke(g,{surface:U})}),e.jsx("small",{children:"消息中的网页链接也会在空面板中打开"})]}),se[g]&&e.jsxs("div",{className:"task-pane-loading",role:"status",children:[e.jsx(bt,{size:20,className:"task-split-spinner"}),"正在更换任务…"]})]},g)};return e.jsxs(e.Fragment,{children:[m?e.jsxs("div",{className:"desktop-task-workspace",children:[e.jsxs("header",{className:"task-workspace-toolbar",children:[V.onToggleSidebar&&e.jsx("button",{className:"ui-icon-button",type:"button",onClick:V.onToggleSidebar,"aria-label":"切换任务侧栏",children:e.jsx(ya,{size:17})}),e.jsxs("span",{className:"task-workspace-label",children:[e.jsx(gs,{size:16}),"任务分屏",d?e.jsx("small",{children:d.panes.length}):null]}),e.jsxs("div",{className:"task-workspace-tools",children:[l&&e.jsxs("button",{type:"button",onClick:()=>Te("calendar",l),title:"日历与待办","aria-label":"打开日历与待办",children:[e.jsx(Es,{size:16,"aria-hidden":"true"}),e.jsx("span",{children:"日历 / 待办"})]}),e.jsxs("button",{type:"button",onClick:()=>w("add"),disabled:P||!d,title:"添加任务","aria-label":"添加分屏任务",children:[e.jsx(Nn,{size:16}),e.jsx("span",{children:"添加任务"})]}),e.jsxs("button",{type:"button",onClick:()=>{A(null),u(g=>g&&wr(g,crypto.randomUUID()))},disabled:P||!d,title:"在最右侧新增一列,保留现有布局比例","aria-label":"新增一列",children:[e.jsx(gs,{size:16}),e.jsx("span",{children:"新增一列"})]}),e.jsxs("button",{type:"button",onClick:()=>{A(null),u(g=>g&&va(g,()=>crypto.randomUUID()))},disabled:P||!d,title:"四列布局,空位会保留给新任务","aria-label":"四列布局","aria-pressed":(d==null?void 0:d.layoutMode)==="four-columns",children:[e.jsx(zo,{size:16}),e.jsx("span",{children:"四列"})]}),e.jsx("button",{type:"button",onClick:()=>{A(null),u(g=>g&&{...g,layoutMode:void 0,layout:br(g.panes.map(S=>S.id))})},disabled:P||!d,title:"重新等分","aria-label":"重新等分任务",children:e.jsx(Ar,{size:16})}),e.jsx("button",{type:"button",onClick:()=>{X(!0)},disabled:P,title:"重新载入进行中任务","aria-label":"重新载入进行中任务",children:e.jsx(As,{size:16,className:P?"task-split-spinner":void 0})}),e.jsxs("button",{type:"button",onClick:F,title:"退出任务分屏","aria-label":"退出任务分屏",children:[e.jsx(Ho,{size:16,"aria-hidden":"true"}),e.jsx("span",{children:"退出分屏"})]})]}),V.onOpenSettings&&V.onHideToBackground&&V.onToggleAppearance&&e.jsx(ka,{appActions:V.headerAppActions,appearanceOpen:!!V.appearanceOpen,settingsOpen:!!V.settingsOpen,showSettings:!ze||nt==="customer-agent",onHideToBackground:V.onHideToBackground,onToggleAppearance:V.onToggleAppearance,onOpenSettings:V.onOpenSettings,onOpenSessionDashboard:Ie?void 0:()=>Te("dashboard",V.onOpenSessionDashboard),onOpenCollaborationDashboard:Ie?void 0:()=>Te("groups",V.onOpenCollaborationDashboard),onOpenDesktopLive:Ie?void 0:()=>Te("remote-desktop",V.onOpenDesktopLive),desktopLiveOpen:V.desktopLiveOpen,onToggleFiles:V.onToggleFiles,filesOpen:V.fileDrawerOpen,onOpenHub:V.onOpenHub})]}),Z&&e.jsxs("div",{className:"task-workspace-error",role:"alert",children:[e.jsx("span",{children:Z}),e.jsx("button",{type:"button",onClick:()=>{X()},children:"重试"})]}),e.jsxs("div",{className:"task-workspace-layout",children:[P&&!d?e.jsxs("div",{className:"task-workspace-loading",role:"status",children:[e.jsx(bt,{className:"task-split-spinner",size:22}),"正在载入任务分屏…"]}):d?e.jsx("div",{className:`task-workspace-tree${y?" has-maximized-task":""}`,"data-maximized-pane":y??void 0,ref:g=>{g&&(g.inert=P)},"aria-hidden":P||void 0,children:e.jsx(rc,{node:d.layout,renderPane:Me,maximizedPaneId:y,onResize:(g,S)=>u(j=>j&&{...j,layout:Ca(j.layout,g,S)}),onSwap:(g,S)=>u(j=>{if(!j)return j;const T=Sa(j.layout,g,S);if(T===j.layout)return j;const E=new Map(j.panes.map(z=>[z.id,z]));return{...j,layout:T,panes:ja(T).map(z=>E.get(z))}})})}):null,P&&d&&e.jsxs("div",{className:"task-workspace-loading task-workspace-loading--overlay",role:"status",children:[e.jsx(bt,{className:"task-split-spinner",size:22}),"正在重新载入…"]})]})]}):r.cloneElement(s,{onOpenTaskSplit:()=>{X()},onReplaceTask:()=>w("single")}),C&&e.jsx(sc,{currentId:C==="single"?V.selectedSessionId??void 0:(Wt=(Mt=d==null?void 0:d.panes.find(g=>g.id===C))==null?void 0:Mt.session)==null?void 0:Wt.id,openIds:new Set(m?(d==null?void 0:d.panes.flatMap(g=>g.session?[g.session.id]:[]))??[]:[]),knownSessions:[...V.sessionSummary?[V.sessionSummary]:[],...(d==null?void 0:d.panes.flatMap(g=>g.session?[g.session]:[]))??[]].map(Jr),onChoose:g=>{R(g)},onClose:()=>w(null)}),m&&k&&qe.createPortal(e.jsx("div",{className:"task-picker-backdrop",onClick:g=>{g.target===g.currentTarget&&v(null)},children:e.jsxs("section",{className:"task-picker task-content-picker",role:"dialog","aria-modal":"true","aria-label":"选择面板内容",onKeyDown:g=>{g.key==="Escape"&&v(null)},children:[e.jsxs("header",{children:[e.jsx("h2",{children:"选择面板内容"}),e.jsx("button",{type:"button",className:"ui-icon-button","aria-label":"关闭内容选择",autoFocus:!0,onClick:()=>v(null),children:e.jsx(yt,{size:18})})]}),e.jsx(Pr,{onTask:()=>{w(k),v(null)},onDraft:()=>Ve(k),onSurface:g=>ke(k,{surface:g})}),e.jsx("button",{type:"button",className:"task-pane-clear",onClick:()=>ke(k,null),children:"清空此面板"})]})}),document.body)]})}function On({session:n,deleteLabel:s="删除会话",onSelect:o,onToggleChildren:i,onPin:c,onDelete:l}){var h,m;return e.jsxs("div",{className:`sidebar-row sidebar-session-row${n.child?" sidebar-session-row--child":""}${n.active?" sidebar-row-active":""}`,children:[e.jsxs("button",{type:"button",className:"sidebar-session-button",onClick:o,"aria-pressed":n.active,title:[n.title,n.workspacePath].filter(Boolean).join(`
|
|
68
|
-
`),children:[e.jsx(Xr,{session:n,visualState:n.visualState,statusLabel:n.statusLabel,active:n.active}),e.jsx("span",{className:"sidebar-session-title",children:n.title}),n.agentType&&e.jsx("span",{className:"sidebar-session-agent",role:"img","aria-label":Pn[n.agentType],title:Pn[n.agentType],children:e.jsx(Yt,{agentType:n.agentType,size:18})}),((h=n.compatibility)==null?void 0:h.status)==="checking"&&e.jsx("span",{className:"sidebar-session-compatibility",title:`Codex ${n.compatibility.producerVersion??"未知版本"} 会话兼容性待验证,打开会话时检查`,"aria-label":"会话兼容性待验证,打开会话时检查",children:e.jsx(Ma,{size:13,"aria-hidden":"true"})}),((m=n.compatibility)==null?void 0:m.status)==="incompatible"&&e.jsx("span",{className:"sidebar-session-compatibility",title:n.compatibility.reason??"Codex 版本不兼容","aria-label":"Codex 版本不兼容",children:e.jsx(Gr,{size:13,"aria-hidden":"true"})}),n.occupiedExternally&&e.jsx("span",{className:"sidebar-session-lock",title:"原客户端正在使用,只读","aria-label":"原客户端正在使用,只读",children:e.jsx($o,{size:13,"aria-hidden":"true"})})]}),i&&e.jsx(Qr,{title:n.title,expanded:!!n.expanded,onToggle:i}),c&&!n.child&&e.jsx("button",{type:"button",onClick:f=>{f.stopPropagation(),c()},title:n.pinned?"取消置顶":"置顶会话","aria-label":`${n.pinned?"取消置顶":"置顶会话"}:${n.title}`,"aria-pressed":!!n.pinned,className:`sidebar-session-pin sidebar-row-action ui-icon-button ui-icon-button--small${n.pinned?" sidebar-row-action--accent":""}`,children:e.jsx(xo,{size:14,"aria-hidden":"true"})}),n.canDelete&&l&&e.jsx("button",{type:"button",onClick:f=>{f.stopPropagation();const d=f.currentTarget.getBoundingClientRect();l({top:d.top,left:d.left,width:d.width,height:d.height})},title:s,"aria-label":`${s}:${n.title}`,className:"sidebar-session-delete sidebar-row-action ui-icon-button ui-icon-button--small ui-icon-button--danger",children:e.jsx(bo,{size:14,"aria-hidden":"true"})})]})}function li({loading:n,error:s,onRefresh:o,subject:i="目录"}){const c=n?`正在加载${i}`:s?`${i}加载失败,点击重试`:`刷新${i}`;return e.jsxs("button",{type:"button",disabled:n,onClick:o,title:s&&!n?`${c}:${s}`:c,"aria-label":c,"aria-busy":n,className:"ui-icon-button sidebar-directory-refresh",children:[e.jsx(As,{size:17,className:n?"animate-spin":void 0,"aria-hidden":"true"}),s&&!n&&e.jsx(Gr,{size:10,className:"sidebar-directory-refresh-error","aria-hidden":"true"})]})}function vc(n){const s=Vr(),o=r.useRef(n.deletedSessionIds);o.current=n.deletedSessionIds;const i=Zr(),[c]=r.useState(()=>_n()),[l,h]=r.useState((c==null?void 0:c.data)??[]),[m,f]=r.useState((c==null?void 0:c.total)??0),[d,u]=r.useState(c!==null),[y,A]=r.useState(""),[C,w]=r.useState(""),k=hn(),[v,_]=r.useState(null),[P,B]=r.useState(!1),[Z,ce]=r.useState(!1),[se,W]=r.useState(null),$=r.useRef(null),M=r.useRef(""),K=r.useRef(`${n.revision}:${n.runningSessionId}`),le=r.useRef({query:"",rows:(c==null?void 0:c.data)??[],cursor:null,expanded:!1}),re=r.useRef(null),ie=r.useRef(null),ae=r.useRef(new Map),Ae=r.useRef(null);n.pendingSession&&n.pendingSession.id!==Ae.current&&(Ae.current=n.pendingSession.id,ae.current.set(n.pendingSession.id,Jr(n.pendingSession)),ae.current.size>20&&ae.current.delete(ae.current.keys().next().value)),r.useEffect(()=>{const R=window.setTimeout(()=>w(y.trim()),250);return()=>window.clearTimeout(R)},[y]);const de=r.useCallback(async R=>{var ze,Ie;if(!wt()||!R&&($.current||!le.current.cursor)||$.current&&!$.current.signal.aborted&&M.current===C)return;R&&((ze=$.current)==null||ze.abort());const ue=new AbortController;$.current=ue,M.current=C;const V=le.current;if(B(!0),W(null),R&&V.query!==C){const Y=C?null:_n();le.current={query:C,rows:(Y==null?void 0:Y.data)??[],cursor:null,expanded:!1},h((Y==null?void 0:Y.data)??[]),f((Y==null?void 0:Y.total)??0),_(null),u(Y!==null)}try{let Y;if(R){const ke=re.current;if((ke==null?void 0:ke.query)===C)Y=await ke.promise;else{const Te=xt({action:"sessionCatalog",query:C,limit:20,backgroundRefresh:!0},{signal:ue.signal}),Ve={query:C,promise:Te};re.current=Ve;try{Y=await Te}finally{re.current===Ve&&(re.current=null)}}if(ue.signal.aborted)return}else Y=await ro(ke=>xt({action:"sessionCatalog",query:C,limit:20,cursor:ke},{signal:ue.signal}),ue.signal,V.cursor??void 0);for(const ke of Y.data)ae.current.delete(ke.id);const nt=pn(Y),je=R&&V.query===C?Y.refreshing?{rows:Gt(V.rows,nt),cursor:V.cursor??Y.nextCursor}:io(V,Y):{rows:R?nt:Gt(V.rows,nt),cursor:Y.nextCursor};if(le.current={query:C,...je,expanded:!R||V.query===C&&V.expanded},h(je.rows),f(Y.total),_(je.cursor),u(!1),R&&ce(Y.refreshing===!0),R&&!C&&!Y.refreshing){const ke=new Set(o.current);Xo({...Y,data:Y.data.filter(Te=>!ke.has(Te.id)),ancestors:(Ie=Y.ancestors)==null?void 0:Ie.filter(Te=>!ke.has(Te.id))})}R&&V.query!==C&&ie.current&&(ie.current.scrollTop=0)}catch(Y){ue.signal.aborted||(ce(!1),W(Y instanceof Error?Y.message:"会话加载失败"))}finally{$.current===ue&&($.current=null,B(!1))}},[C]);r.useEffect(()=>{if(!s)return;const R=`${n.revision}:${n.runningSessionId}`,ue=K.current!==R;K.current=R,(ue||le.current.query!==C||!$.current)&&de(!0);const V=()=>{wt()&&!$.current&&de(!0)},ze=window.setInterval(V,15e3);return window.addEventListener("focus",V),()=>{var Ie;(Ie=$.current)==null||Ie.abort(),re.current=null,window.clearInterval(ze),window.removeEventListener("focus",V)}},[s,de,C,n.revision,n.runningSessionId]),r.useEffect(()=>{if(!s||!Z)return;const R=window.setInterval(()=>{de(!0)},2e3);return()=>window.clearInterval(R)},[s,Z,de]),r.useEffect(()=>{const R=ie.current;s&&!P&&!se&&v&&R&&R.scrollTop>0&&R.scrollHeight-R.scrollTop-R.clientHeight<120&&de(!1)},[s,se,de,P,v]);const O=[...n.needsInput,...n.runningSessionId?[n.runningSessionId]:[]],te=uo(ao(l,[...ae.current.values()],C),i,C),Se=oo(te,n.pinnedIds,O),Ee=y.trim().toLocaleLowerCase(),ve=r.useMemo(()=>new Set(n.deletedSessionIds),[n.deletedSessionIds]),D=Se.filter(R=>!ve.has(R.id)),G=Mn(D),X=r.useMemo(()=>new Set(n.pinnedIds),[n.pinnedIds]),F=({session:R,children:ue})=>{const V=n.needsInput.includes(R.id)?"needs-input":n.runningSessionId===R.id?"running":R.status==="failed"?"error":R.status==="completed"?"idle":R.status,ze=Dn(V),Ie=!!R.parentSessionId,Y=k.expandedIds.has(R.id);return e.jsxs("div",{className:"sidebar-session-tree",children:[e.jsx(On,{session:{id:R.id,title:R.title,agentType:R.agentType,workspacePath:R.cwd,visualState:ze,statusLabel:Rn[ze],completedAt:Ln(R),active:n.selectedSessionId===R.id,pinned:X.has(R.id),child:Ie,expanded:Y,occupiedExternally:R.agentType!=="codex"&&R.occupancy==="owned-externally",canDelete:V!=="running"&&V!=="needs-input"},onSelect:()=>n.onSelect(R),onPin:Ie?void 0:()=>n.onPin(R.id),onToggleChildren:ue.length?()=>k.toggle(R.id):void 0,deleteLabel:Ie?"删除子会话":void 0,onDelete:nt=>n.onDelete(R,nt)}),Y&&ue.length>0&&e.jsx("div",{className:"all-sessions-children",role:"group","aria-label":`${R.title}的子会话`,children:ue.map(F)})]},R.id)};return e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"sidebar-search-field all-sessions-search",children:[e.jsx(Wn,{size:15,"aria-hidden":"true"}),e.jsx("input",{"aria-label":"搜索所有 Agent 的会话",placeholder:"搜索会话或目录",value:y,onChange:R=>A(R.target.value)})]}),e.jsxs("div",{className:"sidebar-project-toolbar",children:[e.jsxs("div",{className:"sidebar-project-heading",children:[e.jsx("span",{className:"sidebar-project-title",children:"所有会话"}),e.jsx("span",{className:"sidebar-project-count",children:C?m:Math.max(m,te.length)})]}),e.jsxs("div",{className:"sidebar-project-actions",children:[e.jsx("span",{className:"all-sessions-sort-label",children:"进行中优先"}),e.jsx(li,{loading:P,error:se,subject:"所有会话",onRefresh:()=>void de(!0)})]})]}),e.jsxs("div",{ref:ie,className:"app-sidebar-scroll all-sessions-list","aria-label":"所有 Agent 会话","aria-busy":(P||Z)&&!d&&!G.length,onScroll:R=>{const ue=R.currentTarget;ue.scrollTop>0&&ue.scrollHeight-ue.scrollTop-ue.clientHeight<120&&de(!1)},children:[se&&e.jsxs("div",{role:"alert",className:"sidebar-load-error",children:[e.jsx("span",{children:se}),e.jsx("button",{onClick:()=>void de(!0),children:"重试"})]}),(P||Z)&&!G.length&&!d&&e.jsx("p",{className:"all-sessions-empty",role:"status",children:"正在加载所有会话…"}),(!P||d)&&!Z&&!se&&!G.length&&e.jsx("p",{className:"all-sessions-empty",children:Ee?"没有匹配的会话":"暂无会话,开始一个新任务吧"}),G.map(F),v&&e.jsx("button",{className:"all-sessions-more",disabled:P,onClick:()=>void de(!1),children:P?"正在加载…":"加载更早的会话"}),Z&&G.length>0?e.jsx("p",{className:"sidebar-cache-state",role:"status",children:"正在后台同步会话…"}):d&&e.jsx("p",{className:"sidebar-cache-state",role:"status",children:P?"显示缓存,正在后台更新…":"当前显示缓存"})]})]})}function kc({cursor:n,expanded:s,loading:o,error:i,nestedScroll:c,projectName:l,onLoadMore:h}){const m=r.useRef(null),f=r.useRef(null),d=r.useRef(h);if(d.current=h,r.useEffect(()=>{const y=m.current;if(!y||!n||!s||o||i||typeof IntersectionObserver>"u")return;const A=y.closest(c?".sidebar-project-sessions":".app-sidebar-scroll");if(!A)return;const C=new IntersectionObserver(w=>{!w.some(k=>k.isIntersecting)||f.current===n||(f.current=n,d.current())},{root:A,rootMargin:"0px 0px 80px 0px"});return C.observe(y),()=>C.disconnect()},[n,s,o,i,c]),!n)return null;const u=o?"正在加载历史会话...":i?"重试加载历史会话":"加载更早的会话";return e.jsxs("button",{ref:m,type:"button",className:"sidebar-session-load-more","aria-label":`${l}:${u}`,"aria-busy":o,disabled:o,title:i,onClick:()=>{f.current=n,h()},style:{display:"flex",alignItems:"center",justifyContent:"center",gap:6,flexShrink:0,minHeight:36,padding:"6px 10px",border:0,background:"transparent",color:i?"var(--danger)":"var(--text-muted)",fontSize:11,cursor:o?"default":"pointer"},children:[o&&e.jsx(bt,{size:12,className:"animate-spin","aria-hidden":"true"}),u]})}function Sc({refreshKey:n,onOpen:s}){const[o,i]=r.useState([]),c=r.useCallback(()=>{xt({action:"groups"}).then(i).catch(()=>{})},[]);return r.useEffect(()=>{c()},[c,n]),e.jsx(e.Fragment,{children:o.length>0&&e.jsxs("div",{className:"collab-group-list","aria-label":"协作群",children:[e.jsx("span",{className:"collab-eyebrow",children:"协作群"}),o.map(l=>e.jsxs("button",{title:l.name,onClick:()=>s(l),children:[e.jsx(yo,{size:15}),e.jsx("span",{children:l.name}),e.jsx(vo,{size:14})]},l.id))]})})}function jc({onOpen:n}){var k,v,_;const s=Vr(),[o,i]=r.useState([]),[c,l]=r.useState(()=>new Set),h=o.length,m=o.some(P=>!c.has(P)),[f,d]=r.useState(""),[u,y]=r.useState(null),A=r.useRef(async()=>{}),C=r.useRef(new Set);r.useEffect(()=>{if(!s)return;let P=!0,B=!1;try{C.current=new Set(JSON.parse(localStorage.getItem("agentroam:supervision-notifications")??"[]"))}catch{}const Z=async()=>{if(!(B||!wt())){B=!0;try{const se=await xt({action:"supervisionAlerts"});if(!P)return;i(se.filter($=>$.incident.status==="waiting").map($=>$.incident.id)),y($=>$?se.find(M=>M.incident.id===$.incident.id&&M.incident.status==="waiting")??null:null);const W=se.filter($=>!C.current.has(`${$.incident.id}:${$.incident.status}`));if(W.length){const $=W.at(-1);d(`${$.groupName} · ${$.incident.status==="waiting"?"需要你决策":$.incident.kind==="handoff"?"交接已衔接":$.incident.kind==="delivery"?"交付已确认":"异常已恢复"}`);const M=W.find(K=>K.incident.status==="waiting"&&K.target);M&&y(K=>K??M);for(const K of W)C.current.add(`${K.incident.id}:${K.incident.status}`);C.current=new Set([...C.current].slice(-300));try{localStorage.setItem("agentroam:supervision-notifications",JSON.stringify([...C.current]))}catch{}}}catch{}finally{B=!1}}};A.current=Z,Z();const ce=setInterval(()=>{Z()},7e3);return()=>{P=!1,clearInterval(ce)}},[s]),r.useEffect(()=>{if(!f||m)return;const P=setTimeout(()=>d(""),1e4);return()=>clearTimeout(P)},[f,m]);const w=()=>{l(P=>new Set([...P,...o])),y(null),d("")};return!m&&!f?null:e.jsxs("aside",{className:`supervision-notice${u?" is-expanded":""}`,"aria-label":"监工提醒",role:"status",children:[e.jsxs("div",{className:"supervision-notice-heading",children:[e.jsxs("button",{onClick:n,children:[e.jsx(Do,{size:16}),e.jsx("span",{children:m?`监工有 ${h} 项待你决策`:f})]}),e.jsx("button",{"aria-label":"关闭监工提醒",onClick:w,children:e.jsx(yt,{size:14})})]}),(u==null?void 0:u.target)&&e.jsxs("div",{className:"session-dashboard supervision-notice-content",children:[e.jsxs("strong",{children:[u.groupName," · ",u.incident.sessionTitle]}),e.jsx(fo,{text:u.incident.message,options:((k=u.incident.question)==null?void 0:k.options)??u.incident.options,recommendation:u.incident.recommendation,multiSelect:(v=u.incident.question)==null?void 0:v.multiSelect,sourceOnly:(_=u.incident.question)==null?void 0:_.requiresSource,onSource:()=>ei({kind:"session",session:u.target}),onAnswer:async(P,B)=>{await xt({action:"answerSupervision",groupId:u.incident.groupId,incidentId:u.incident.id,answer:P,selectedIndices:B}),y(null),d(""),await A.current()}})]})]})}function Cc(n,s){const o=new URLSearchParams(n),i=o.get("session"),l=(i!=null&&i.startsWith("runtime:")?i.split(":")[1]:void 0)??o.get("agent");return{agentType:fn(l)?l:s,explicit:!!(i||o.get("newSession")==="1"||fn(l))}}function Ic(n,s){const o=s==null?void 0:s.sessions.find(l=>l.id===n.id&&l.agentType===n.agentType);if(!o||!s)return;const i=s.workspaces.find(l=>l.agentType===n.agentType&&(l.workspaceId===o.projectId||l.roots.includes(o.cwd)));if(!i)return;const c={...o,title:n.title||o.title,projectId:i.workspaceId};return{session:c,snapshot:{workspaces:s.workspaces.filter(l=>l.agentType===n.agentType),sessions:[...s.sessions.filter(l=>l.agentType===n.agentType&&l.id!==n.id),c]}}}async function Tc(n,s,o,i){o.throwIfAborted();const c=await n.getSession(s.id,s.agentType==="codex"?{limit:kr,view:"core"}:{limit:kr},{signal:o});o.throwIfAborted();const l=c;if(l!=null&&l.threadKey&&l.activeSessionId===c.id&&(s={...s,id:c.id,agentType:c.agentType}),!(c!=null&&c.id)||c.id!==s.id||c.agentType!==s.agentType)throw new Error("原会话身份不匹配,请刷新看板后重试");const h={workspaces:(i==null?void 0:i.workspaces.filter(B=>B.agentType===s.agentType))??[],sessions:(i==null?void 0:i.sessions.filter(B=>B.agentType===s.agentType&&B.id!==s.id))??[]},m=i==null?void 0:i.sessions.find(B=>B.id===s.id),f=c.projectId??(m==null?void 0:m.projectId)??s.projectId,d=()=>h.workspaces.find(B=>B.workspaceId===f)??h.workspaces.find(B=>B.roots.includes(c.cwd||s.cwd));let u=d(),y=null;const A=new Set;for(;!u;){const B=await n.listAgentWorkspaces(s.agentType,{cursor:y,limit:200});if(o.throwIfAborted(),B.stale)throw new Error("会话目录待刷新,请重试");if(h.workspaces=[...new Map([...h.workspaces,...B.data].map(Z=>[Z.workspaceId,Z])).values()],u=d(),y=B.nextCursor,u||!y)break;if(A.has(y))throw new Error("会话目录加载中断,请重试");A.add(y)}const C=(u==null?void 0:u.workspaceId)??f??`session-${c.id}`;u||h.workspaces.push({agentType:s.agentType,workspaceId:C,roots:[c.cwd||s.cwd],name:(c.cwd||s.cwd).split(/[\\/]/).filter(Boolean).at(-1)||"会话工作区",order:h.workspaces.length,source:"derived",canCreateSession:!1});const{messages:w,events:k,history:v,..._}=c,P={..._,cwd:c.cwd||s.cwd,projectId:C};return h.sessions.push(P),{session:P,snapshot:h,initialHistory:{sessionId:P.id,detail:c}}}function Ac({groups:n,dashboardVisible:s,sessionDashboardVisible:o,activeId:i,onSelect:c,onClose:l}){const h=[{id:"assistant",name:"智能助手",closable:!1},...o?[{id:"sessions",name:"Dashboard",closable:!0}]:[],...s?[{id:"dashboard",name:"群聊列表",closable:!0}]:[],...n.map(m=>({id:m.id,name:m.name,closable:!0}))];return e.jsxs("nav",{className:"collab-desktop-tabs","aria-label":"工作页签",children:[h.map(m=>e.jsxs("div",{className:`collab-desktop-tab${i===m.id?" is-active":""}`,children:[e.jsx("button",{type:"button","aria-current":i===m.id?"page":void 0,onClick:()=>c(m.id),children:m.name}),m.closable&&e.jsx("button",{type:"button",className:"collab-desktop-tab-close","aria-label":`关闭${m.name}`,title:`关闭${m.name}页签`,onClick:()=>l(m.id),children:e.jsx(yt,{size:13,"aria-hidden":"true"})})]},m.id)),e.jsx("div",{className:"collab-desktop-tabs-drag-space","aria-hidden":"true"})]})}const di=new Set(["downloading","installing","reconnecting"]),Ec=new Set(["checking",...di]),Nc=6e3,Pc=24e3;function Rc(){const[n,s]=r.useState(null),[o,i]=r.useState(()=>sessionStorage.getItem("agentroam.dismissed-update"));if(r.useEffect(()=>{var w;let u=!0;const y=window.agentApi,A=((w=y.onUpdateStatus)==null?void 0:w.call(y,k=>{u&&s(k)}))??(()=>{});y.getUpdateStatus().then(k=>{u&&s(k)}).catch(()=>{});const C=window.setTimeout(()=>{y.checkForUpdate().then(k=>{u&&s(k)}).catch(()=>{})},Nc+Math.floor(Math.random()*(Pc+1)));return()=>{u=!1,window.clearTimeout(C),A()}},[]),r.useEffect(()=>{if(!n||!Ec.has(n.phase))return;const u=window.setInterval(()=>{window.agentApi.getUpdateStatus().then(s).catch(()=>{})},1500);return()=>window.clearInterval(u)},[n==null?void 0:n.phase]),!n||["idle","checking","up-to-date","unavailable"].includes(n.phase)||n.phase==="available"&&n.targetVersion===o)return null;const c=di.has(n.phase),l=n.phase==="failed",h=n.phase==="complete",m=c?n.phase==="downloading"?`正在下载${n.progress!==void 0?` ${n.progress}%`:""}`:n.phase==="installing"?"正在安装":"正在重连":l?"更新失败,重试":h?n.message??"更新已就绪":`发现 AgentRoam ${n.targetVersion}`,f=async()=>{try{s(await window.agentApi.installUpdate())}catch(u){s({...n,phase:"failed",message:u instanceof Error?u.message:"更新失败"})}},d=()=>{n.targetVersion&&(sessionStorage.setItem("agentroam.dismissed-update",n.targetVersion),i(n.targetVersion))};return e.jsxs("aside",{className:`update-notice${l?" update-notice--failed":""}`,"aria-live":"polite",children:[e.jsxs("div",{className:"update-notice__content",children:[e.jsx("strong",{children:m}),!c&&!h&&e.jsx("span",{children:"点击后才会下载安装文件"}),l&&n.message&&e.jsx("span",{children:n.message})]}),!c&&!h&&e.jsxs("button",{className:"update-notice__action",type:"button",onClick:()=>void f(),title:l?"重试更新":"下载更新",children:[l?e.jsx(As,{size:16}):e.jsx(Io,{size:16}),e.jsx("span",{children:l?"重试":"更新"})]}),!c&&e.jsx("button",{className:"update-notice__close",type:"button",onClick:d,title:"关闭更新提醒","aria-label":"关闭更新提醒",children:e.jsx(yt,{size:16})})]})}function Lc(){const[n,s]=r.useState(null);r.useEffect(()=>{const l=window.agentApi;if(!(l!=null&&l.desktopLiveGetStatus)||!(l!=null&&l.onDesktopLiveStatus))return;let h=!0;l.desktopLiveGetStatus().then(f=>{h&&s(f)}).catch(()=>{});const m=l.onDesktopLiveStatus(f=>s(f));return()=>{h=!1,m()}},[]);const o=n==null?void 0:n.controlState;if(!((n==null?void 0:n.enabled)&&o!==null&&o!==void 0&&o!=="agent-controlled"))return null;const c=o==="return-requested"||o==="resyncing";return e.jsxs("div",{className:"desktop-live-control-banner",role:"status",style:{position:"fixed",top:"calc(env(safe-area-inset-top) + 10px)",left:"50%",transform:"translateX(-50%)",zIndex:1300,display:"flex",alignItems:"center",gap:8,padding:"7px 14px",borderRadius:999,border:"1px solid rgba(251,191,36,0.45)",background:"rgba(69,49,10,0.92)",color:"#fcd34d",fontSize:13,fontWeight:600,backdropFilter:"blur(8px)",pointerEvents:"none"},children:[e.jsx("span",{"aria-hidden":"true",children:"●"}),c?"正在结束远程控制":"正在被远程控制"]})}function Ns(n,s){return n.map((o,i)=>({session:o,index:i})).sort((o,i)=>s(o.session,i.session)||o.index-i.index).map(({session:o})=>o)}function Dc(n){return Ns(n,(s,o)=>o.created.localeCompare(s.created))}function Cs(n,s){return s==="codex"?[...n]:Dc(n)}function Is(n,s){return Ns(n,(o,i)=>Number(s(i))-Number(s(o)))}function _c(n,s){return Ns(n,(o,i)=>Number(s(i))-Number(s(o)))}const ys={projectId:null,sessionId:null};function Ts(n){return typeof n=="string"&&n.trim()?n.trim():null}function En(n){return{projectId:Ts(n),sessionId:null}}function Rr(n,s){return{projectId:Ts(n),sessionId:Ts(s)}}function Oc(n){return n.agentType==="customer-agent"?`确定永久删除会话“${n.title}”吗?此操作不可恢复。`:n.agentType==="codex"?`确定归档 Codex 会话“${n.title}”并从 AgentRoam 中移除吗?可在 Codex 的已归档会话中恢复。`:`确定从 AgentRoam 中移除会话“${n.title}”吗?原生客户端中的历史记录会保留。`}function zc(n,s){const o=new Set(s);return{...n,selectedSessionId:n.selectedSessionId&&o.has(n.selectedSessionId)?null:n.selectedSessionId,sessions:Object.fromEntries(Object.entries(n.sessions).map(([i,c])=>[i,{...c,data:c.data.filter(l=>!o.has(l.id))}]))}}function Mc(n,s){const o=new Set(s);let i=!1;const c=Object.fromEntries(Object.entries(n).map(([l,h])=>{const m=h.filter(f=>!o.has(f.id));return m.length!==h.length&&(i=!0),[l,m.length===h.length?h:m]}));return i?c:n}function Wc(n,s,o,i){const c=[i,...(s[i]??[]).map(m=>m.id)],l=new Set(c),h=Object.fromEntries(Object.entries(s).flatMap(([m,f])=>{if(l.has(m))return[];const d=f.filter(u=>!l.has(u.id));return[[m,d.length===f.length?f:d]]}));return{sessionsByProject:Mc(n,c),childSessionsByParent:h,otherLocalSessions:o.filter(m=>!l.has(m.id)),removedIds:c}}const $c={fontSize:13,fontWeight:600,color:"var(--text-secondary)",textTransform:"uppercase",letterSpacing:"0.06em",marginBottom:14},Lr={display:"flex",alignItems:"center",justifyContent:"space-between",gap:10,padding:"8px 12px",borderRadius:"var(--radius-sm)",border:"1px solid var(--border-subtle)",background:"var(--bg-surface)",fontSize:13};function ui({onboarding:n=!1}){const s=typeof window>"u"?void 0:window.agentApi,o=!!(s!=null&&s.desktopLiveGetStatus),[i,c]=r.useState(null),[l,h]=r.useState(!1),[m,f]=r.useState(null),[d,u]=r.useState(!0);r.useEffect(()=>{if(!(s!=null&&s.desktopLiveGetStatus)||!(s!=null&&s.onDesktopLiveStatus))return;let v=!0;s.desktopLiveSetup().then(P=>{v&&(c(P.status),u(P.supported))}).catch(()=>{});const _=s.onDesktopLiveStatus(P=>c(P));return()=>{v=!1,_()}},[s]);const y=async()=>{if(s!=null&&s.desktopLiveRecheck)try{c(await s.desktopLiveRecheck()),f(null)}catch(v){f(v instanceof Error?v.message:String(v))}};r.useEffect(()=>{if(!o||!d)return;let v=!0,_=!1;const P=async()=>{if(!_){_=!0;try{const Z=await s.desktopLiveRecheck();v&&c(Z)}catch{}finally{_=!1}}};window.addEventListener("focus",P);const B=i!=null&&i.enabled&&(i.permissionScreen!=="granted"||i.accessibilityTrusted!==!0)?window.setInterval(P,3e3):void 0;return()=>{v=!1,window.removeEventListener("focus",P),B&&window.clearInterval(B)}},[s,o,d,i==null?void 0:i.enabled,i==null?void 0:i.permissionScreen,i==null?void 0:i.accessibilityTrusted]);const A=async v=>{if(s){h(!0);try{c(await s.desktopLiveSetEnabled(!0)),await s.desktopLiveOpenPermission(v),f(null)}catch(_){f(_ instanceof Error?_.message:String(_))}finally{h(!1)}}};if(!o)return null;const C=async()=>{if(s!=null&&s.desktopLiveSetEnabled){h(!0);try{c(await s.desktopLiveSetEnabled(!(i!=null&&i.enabled))),f(null)}catch(v){f(v instanceof Error?v.message:String(v))}finally{h(!1)}}},w=(i==null?void 0:i.permissionScreen)==="granted",k=(i==null?void 0:i.accessibilityTrusted)===!0;return e.jsxs("section",{className:"desktop-permission-settings",children:[e.jsx("h3",{style:$c,children:n?"设置桌面端权限":"桌面直播与远程控制"}),e.jsx("p",{style:{fontSize:13,color:"var(--text-muted)",margin:"0 0 14px",lineHeight:1.6},children:n?"欢迎使用 AgentRoam。请为桌面端开启以下系统权限,完成后手机即可查看电脑画面;允许辅助功能后还可操作鼠标和键盘。":"开启后,已配对手机可查看电脑画面,并在授予辅助功能权限后操作鼠标和键盘。"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,marginBottom:12},children:[e.jsx("button",{type:"button",onClick:()=>void C(),disabled:l||!d,style:{padding:"7px 16px",borderRadius:"var(--radius-sm)",border:`1px solid ${i!=null&&i.enabled?"rgba(244,63,94,0.35)":"var(--accent)"}`,background:i!=null&&i.enabled?"rgba(244,63,94,0.1)":"var(--accent-dim)",color:i!=null&&i.enabled?"var(--danger)":"var(--accent)",fontSize:13,fontWeight:600,cursor:"pointer"},children:l?"处理中…":i!=null&&i.enabled?n?"暂停手机查看":"关闭桌面直播":n?"开启手机查看":"开启桌面直播"}),(i==null?void 0:i.enabled)&&e.jsx("span",{style:{fontSize:12,color:i.sessionOnline?"var(--success)":"var(--text-muted)"},children:i.sessionOnline?"● 已连接,可从手机查看":"○ 未连接"})]}),!d&&e.jsx("p",{role:"status",children:"当前远程桌面仅支持 macOS,其他桌面功能可正常使用。"}),d&&e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[e.jsxs("div",{className:"desktop-permission-row",style:Lr,children:[e.jsx("span",{children:"屏幕录制(画面采集)"}),e.jsx("span",{style:{color:w?"var(--success)":"var(--danger)",fontWeight:600},children:w?"已授权":"未授权"}),!w&&e.jsx("button",{type:"button",className:"ui-quiet-button desktop-permission-button",disabled:l,onClick:()=>void A("screen"),children:"去授权"})]}),e.jsxs("div",{className:"desktop-permission-row",style:Lr,children:[e.jsx("span",{children:"辅助功能(键鼠控制)"}),e.jsx("span",{style:{color:k?"var(--success)":"var(--danger)",fontWeight:600},children:(i==null?void 0:i.accessibilityTrusted)===null?"待检测":k?"已授权":"未授权"}),!k&&e.jsx("button",{type:"button",className:"ui-quiet-button desktop-permission-button",disabled:l,onClick:()=>void A("accessibility"),children:"去授权"})]})]}),d&&e.jsxs(e.Fragment,{children:[e.jsx("p",{style:{marginTop:14,fontSize:12,color:"var(--text-muted)",lineHeight:1.6},children:"点击对应权限的「去授权」,在系统设置中允许 AgentRoam,返回后自动检测。"}),e.jsxs("details",{className:"desktop-permission-more",children:[e.jsx("summary",{children:"更多操作"}),e.jsxs("div",{style:{display:"flex",gap:8,marginTop:8},children:[e.jsx("button",{type:"button",className:"ui-quiet-button",onClick:()=>void y(),children:"重新检测"}),!w&&e.jsx("button",{type:"button",className:"ui-quiet-button",onClick:()=>void(s==null?void 0:s.desktopLiveRestart()),children:"重启桌面端"})]})]})]}),m&&e.jsx("p",{role:"alert",style:{color:"var(--danger)"},children:m}),(i==null?void 0:i.error)&&e.jsx("div",{style:{marginTop:10,fontSize:12,color:"var(--danger)"},role:"alert",children:i.error})]})}const Hc=Object.freeze(Object.defineProperty({__proto__:null,default:ui},Symbol.toStringTag,{value:"Module"}));function Bc({onClose:n}){const s=r.useRef(null);return r.useEffect(()=>{var o;(o=s.current)==null||o.showModal()},[]),qe.createPortal(e.jsx("dialog",{ref:s,"aria-label":"桌面直播与远程控制",onCancel:n,onClick:o=>{o.target===o.currentTarget&&n()},style:{width:"min(680px, calc(100vw - 48px))",maxHeight:"calc(100vh - 48px)",padding:0,margin:"auto",inset:0,overflowY:"auto",color:"var(--text-primary)",background:"var(--bg-surface)",border:"1px solid var(--border-default)",borderRadius:"var(--radius-md)",boxShadow:"var(--shadow-md)"},children:e.jsxs("div",{style:{padding:24},children:[e.jsx("div",{style:{display:"flex",justifyContent:"flex-end",marginBottom:8},children:e.jsx("button",{type:"button",onClick:n,"aria-label":"关闭桌面直播设置",className:"ui-icon-button ui-icon-button--close",children:"×"})}),e.jsx(ui,{}),e.jsx("div",{className:"desktop-permission-footer",children:e.jsx("button",{type:"button",className:"ui-quiet-button",onClick:n,children:"关闭"})})]})}),document.body)}function Fc({trigger:n,heardText:s}){const[o,i]=r.useState(!1);return r.useEffect(()=>{if(n<=0)return;i(!0);const c=setTimeout(()=>i(!1),2400);return()=>clearTimeout(c)},[n]),o?qe.createPortal(e.jsxs("div",{style:{position:"fixed",inset:0,zIndex:3e4,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:22,background:"radial-gradient(circle at 50% 50%, var(--accent-glow), transparent 60%)",backdropFilter:"blur(2px)",WebkitBackdropFilter:"blur(2px)",animation:"fadeIn 0.3s var(--ease-out)",pointerEvents:"none",WebkitAppRegion:"no-drag"},children:[e.jsxs("div",{style:{position:"relative",width:120,height:120},children:[[0,.45,.9].map(c=>e.jsx("div",{style:{position:"absolute",inset:0,borderRadius:"50%",border:"2px solid var(--accent)",animation:`wakeRing 1.6s ${c}s var(--ease-out) infinite`}},c)),e.jsx("div",{style:{position:"absolute",inset:30,borderRadius:"50%",background:"var(--accent)",display:"flex",alignItems:"center",justifyContent:"center",animation:"wakeCore 1.6s var(--ease-out) infinite"},children:e.jsxs("svg",{width:"26",height:"26",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-inverse)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3z"}),e.jsx("path",{d:"M19 10v2a7 7 0 0 1-14 0v-2"}),e.jsx("line",{x1:"12",y1:"19",x2:"12",y2:"22"})]})})]}),e.jsx("div",{style:{fontSize:16,fontWeight:600,color:"var(--text-primary)",letterSpacing:"0.12em",animation:"wakeText 0.9s var(--ease-out) both",fontFamily:"var(--font-display)"},children:"已唤醒 · 随时待命"}),s&&e.jsxs("div",{style:{fontSize:12,color:"var(--text-muted)",maxWidth:320,textAlign:"center",animation:"fadeIn 0.6s var(--ease-out) 0.3s both"},children:["“",s.slice(0,40),"”"]})]},n),document.body):null}const qc={completion:{label:"会话已完成",sound:"completion.wav"},approval:{label:"需要确认",sound:"approval.wav"},todo_reminder:{label:"待办提醒",sound:"reminder.wav"},todo_execution:{label:"定时待办",sound:"scheduled.wav"},todo_attention:{label:"待办需关注",sound:"attention.wav"},todo_error:{label:"待办执行异常",sound:"error.wav"}};function Vc(n){let s=n.kind;return n.kind==="todo_execution"&&(n.title==="定时待办执行未完成"?s="todo_error":(n.title==="定时待办错过执行"||n.title==="定时待办需要核实")&&(s="todo_attention")),{type:s,...qc[s]}}function Dr(n,s=180){const o=n.replace(/```[^\n]*\n?[\s\S]*?(?:```|$)/g," ").replace(/~~~[^\n]*\n?[\s\S]*?(?:~~~|$)/g," ").replace(/!\[[^\]]*\]\([^)]*\)/g," ").replace(/\[([^\]]+)\]\((?:[^)(]|\([^)]*\))*\)/g,"$1").replace(/`(?:\/|~\/|[A-Za-z]:\\)[^`]*`/g," ").replace(/(?:file:\/\/\/|\/(?:Users|home|tmp|private|var|Applications|Volumes)\/|~\/|[A-Za-z]:\\)[^\s<>`"',。;、))]+/g," ").replace(/^\s{0,3}(?:#{1,6}\s+|>\s*|[-*+]\s+|\d+[.)]\s+)/gm,"").replace(/(\*\*|__|~~)([\s\S]*?)\1/g,"$2").replace(/(^|\s)[*_]([^\s*_][^*_]*?)[*_](?=\s|[,。!?,.!?]|$)/g,"$1$2").replace(/`+/g,"").replace(/\s+/g," ").replace(/\s+([,。;、)])/g,"$1").trim(),i=Array.from(o);return i.length>s?`${i.slice(0,s-1).join("")}…`:o}const Uc={completion:$a,approval:Bo,todo_reminder:Lo,todo_execution:_o,todo_attention:Oo,todo_error:Wa},Kc=new Set(["会话已完成","会话完成","任务完成","任务已完成","运行已结束","运行结束","已完成"]);function Gc({items:n,onOpen:s,onDismiss:o,onClearAll:i}){return n.length===0?null:e.jsxs("aside",{className:"notification-toasts","aria-label":"通知",children:[n.length>1&&i&&e.jsx("button",{type:"button",className:"notification-toasts__clear",title:"全部标为已读并清除",onClick:c=>{c.stopPropagation(),i()},children:"全部清除"}),n.slice(0,3).map(c=>{const{type:l,label:h}=Vc(c),m=Uc[l],f=Dr(c.title,100)||h,d=c.kind!=="completion"||!Kc.has(f.replace(/[\s。.!!::]+/g,"")),u=Dr(c.body)||"点击查看详细内容";return e.jsxs("article",{className:`notification-toast notification-toast--${l}`,"data-notification-id":c.id,"data-notification-type":l,children:[e.jsxs("button",{type:"button",className:"notification-toast__content","aria-label":`${d?f:h},打开查看`,onClick:()=>s(c),children:[e.jsx("span",{className:"notification-toast__icon","aria-hidden":"true",children:e.jsx(m,{size:15,strokeWidth:1.8})}),e.jsxs("span",{className:"notification-toast__body",role:"status",children:[e.jsxs("span",{className:"notification-toast__meta",children:[e.jsx("span",{children:h}),e.jsx("span",{className:"notification-toast__dot","aria-hidden":"true"}),e.jsx("span",{className:"notification-toast__unread",children:"未读"})]}),d&&e.jsx("strong",{className:"notification-toast__title",children:f}),e.jsx("span",{className:"notification-toast__summary",children:u})]})]}),e.jsx("button",{type:"button",className:"notification-toast__close","aria-label":"关闭通知并标为已读",title:"关闭并标为已读",onClick:y=>{y.stopPropagation(),o(c)},children:e.jsx(yt,{size:14,"aria-hidden":"true"})})]},c.id)})]})}const _r="agentroam.notification-read-pending.v1";function Or(n){if(!n.serviceId||!n.ownerId)throw new Error("通知来源缺失");return JSON.stringify([n.serviceId,n.ownerId])}function Yc(n,s){return n.kind==="completion"?(s==null?void 0:s.completionEnabled)!==!1:n.kind==="approval"?(s==null?void 0:s.approvalEnabled)!==!1:(s==null?void 0:s.todoEnabled)!==!1}class Xc{constructor(s,o,i=()=>{}){this.api=s,this.storage=o,this.warn=i,this.scope="",this.items=[],this.consumed=new Map,this.listeners=new Set,this.pending={};try{const c=JSON.parse((o==null?void 0:o.getItem(_r))??"{}");if(c&&typeof c=="object"&&!Array.isArray(c))for(const[l,h]of Object.entries(c))Array.isArray(h)&&(this.pending[l]=h.filter(m=>typeof m=="string"))}catch(c){this.warn(c)}}subscribe(s){return this.listeners.add(s),s(this.items),()=>{this.listeners.delete(s)}}publish(s){this.items=s,this.listeners.forEach(o=>o(s))}save(){var s;try{(s=this.storage)==null||s.setItem(_r,JSON.stringify(this.pending))}catch(o){this.warn(o)}}refresh(){return this.refreshing?this.refreshing:(this.refreshing=this.refreshOnce().finally(()=>{this.refreshing=void 0}),this.refreshing)}async refreshOnce(){try{const s=await this.api.list();this.scope=Or(s);const o=new Set([...this.pending[this.scope]??[],...this.consumed.get(this.scope)??[]]);this.publish(s.items.filter(i=>i.ownerId===s.ownerId&&!i.readAt&&!i.dismissedAt&&!o.has(i.id)&&Yc(i,s.preferences)).sort((i,c)=>c.createdAt-i.createdAt)),await this.syncReads(this.scope)}catch(s){this.warn(s)}}consume(s){return this.consumeItems([s])}consumeAll(){return this.consumeItems(this.items)}consumeItems(s){var l;if(!this.scope||!s.length)return Promise.resolve();const o=new Set(s.filter(h=>this.items.some(m=>m.id===h.id&&m.ownerId===h.ownerId)).map(h=>h.id));if(!o.size)return Promise.resolve();const i=this.scope,c=(l=this.pending)[i]??(l[i]=[]);for(const h of o)c.includes(h)||c.push(h);return this.save(),this.publish(this.items.filter(h=>!o.has(h.id))),this.syncReads(i)}syncReads(s){return this.syncing?this.syncing:(this.syncing=this.flushReads(s).finally(()=>{this.syncing=void 0}),this.syncing)}async flushReads(s){var o;try{for(;(o=this.pending[s])!=null&&o.length;){const i=await this.api.list();if(Or(i)!==s)return;const c=this.pending[s][0];i.items.some(m=>m.id===c&&(m.readAt||m.dismissedAt))||await this.api.read(c,{serviceId:i.serviceId,ownerId:i.ownerId});const h=this.consumed.get(s)??new Set;h.add(c),this.consumed.set(s,h),this.pending[s]=this.pending[s].filter(m=>m!==c),this.pending[s].length||delete this.pending[s],this.save()}}catch(i){this.warn(i)}}}function Jc(n){const[s,o]=r.useState([]),i=r.useRef();r.useEffect(()=>{var y;if(!n||!((y=window.agentApi)!=null&&y.notificationList)||!window.agentApi.notificationRead)return;let h;try{h=window.localStorage}catch{}const m=new Xc({list:async()=>await window.agentApi.notificationList(),read:(A,C)=>window.agentApi.notificationRead(A,C)},h,A=>console.warn("[notifications] read synchronization failed",A));i.current=m;const f=m.subscribe(o),d=()=>{m.refresh()};d();const u=window.setInterval(d,3e3);return window.addEventListener("focus",d),()=>{window.clearInterval(u),window.removeEventListener("focus",d),f(),i.current===m&&(i.current=void 0)}},[n]);const c=r.useCallback(h=>{var m;(m=i.current)==null||m.consume(h)},[]),l=r.useCallback(()=>{var h;(h=i.current)==null||h.consumeAll()},[]);return{items:s,consume:c,clearAll:l}}const Qc=[{value:"classic",description:"横向切换 Agent,按目录浏览"},{value:"agent-rail",description:"竖向 Agent 栏,聚焦当前工作区"},{value:"all-sessions",description:"汇总所有 Agent 的会话"}],Zc=typeof window>"u"?r.useEffect:r.useLayoutEffect;function el({value:n}){return e.jsxs("svg",{className:"sidebar-layout-preview",viewBox:"0 0 48 36",fill:"none","aria-hidden":"true",children:[e.jsx("rect",{x:"1",y:"1",width:"46",height:"34",rx:"5",stroke:"currentColor",strokeOpacity:".3"}),n==="classic"?e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M6 8h16M6 20h13M6 25h10M6 30h12",stroke:"currentColor",strokeOpacity:".55",strokeWidth:"2",strokeLinecap:"round"}),[7,13,19,25,31,37].map(s=>e.jsx("rect",{x:s,y:"12",width:"4",height:"4",rx:"1",fill:"currentColor",opacity:".7"},s))]}):n==="agent-rail"?e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M6 8h28M14 13v21",stroke:"currentColor",strokeOpacity:".3",strokeWidth:"2",strokeLinecap:"round"}),[16,22,28].map(s=>e.jsx("rect",{x:"6",y:s,width:"4",height:"4",rx:"1",fill:"currentColor",opacity:".7"},s)),e.jsx("path",{d:"M20 17h18M20 23h12M20 29h15",stroke:"currentColor",strokeOpacity:".55",strokeWidth:"2",strokeLinecap:"round"})]}):e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M6 8h22",stroke:"currentColor",strokeOpacity:".55",strokeWidth:"2",strokeLinecap:"round"}),[16,22,28].map((s,o)=>e.jsxs("g",{children:[e.jsx("circle",{cx:"7",cy:s,r:"1.5",fill:"currentColor",opacity:".7"}),e.jsx("path",{d:`M12 ${s}h${o===1?18:25}`,stroke:"currentColor",strokeOpacity:".55",strokeWidth:"2",strokeLinecap:"round"})]},s))]})]})}function pi(){const n=Re(u=>u.navigationLayout),s=Re(u=>u.setNavigationLayout),[o,i]=r.useState(!1),[c,l]=r.useState({top:0,left:0}),h=r.useRef(null),m=r.useRef(null),f=r.useId();Zc(()=>{var y,A;if(!o)return;const u=()=>{var v;const C=(v=h.current)==null?void 0:v.getBoundingClientRect();if(!C||!m.current)return;const{offsetWidth:w,offsetHeight:k}=m.current;l({top:Math.max(8,Math.min(C.bottom+8,window.innerHeight-k-8)),left:Math.max(8,Math.min(C.right-w,window.innerWidth-w-8))})};return u(),(A=(y=m.current)==null?void 0:y.querySelector('[aria-checked="true"]'))==null||A.focus(),window.addEventListener("resize",u),window.addEventListener("scroll",u,!0),()=>{window.removeEventListener("resize",u),window.removeEventListener("scroll",u,!0)}},[o]),r.useEffect(()=>{if(!o)return;const u=y=>{var C,w;const A=y.target;!((C=h.current)!=null&&C.contains(A))&&!((w=m.current)!=null&&w.contains(A))&&i(!1)};return document.addEventListener("pointerdown",u),()=>document.removeEventListener("pointerdown",u)},[o]);const d=u=>{var w,k,v;u.key==="Escape"&&(u.preventDefault(),u.stopPropagation(),i(!1),(w=h.current)==null||w.focus());const y=Array.from(((k=m.current)==null?void 0:k.querySelectorAll('[role="menuitemradio"]'))??[]),A=y.indexOf(document.activeElement),C=u.key==="ArrowDown"?(A+1)%y.length:u.key==="ArrowUp"?(A+y.length-1)%y.length:u.key==="Home"?0:u.key==="End"?y.length-1:null;C!==null&&(u.preventDefault(),(v=y[C])==null||v.focus())};return e.jsxs(e.Fragment,{children:[e.jsx("button",{ref:h,type:"button",className:"sidebar-layout-trigger","aria-label":"切换侧栏布局",title:`切换布局 · 当前:${hs[n]}`,"aria-haspopup":"menu","aria-expanded":o,"aria-controls":o?f:void 0,onClick:()=>i(u=>!u),onKeyDown:u=>{(u.key==="ArrowDown"||u.key==="ArrowUp")&&(u.preventDefault(),i(!0))},children:e.jsx(qo,{size:18,"aria-hidden":"true"})}),o&&qe.createPortal(e.jsxs("div",{ref:m,id:f,role:"menu","aria-label":"侧栏布局",className:"sidebar-layout-menu",style:{position:"fixed",...c},onKeyDown:d,onBlur:u=>{var A;const y=u.relatedTarget;y&&!u.currentTarget.contains(y)&&!((A=h.current)!=null&&A.contains(y))&&i(!1)},children:[e.jsx("div",{className:"sidebar-layout-menu-title","aria-hidden":"true",children:"侧栏布局"}),Qc.map(u=>e.jsxs("button",{type:"button",role:"menuitemradio","aria-label":hs[u.value],"aria-checked":n===u.value,className:"sidebar-layout-option",onClick:()=>{i(!1),s(u.value),requestAnimationFrame(()=>{var y;return(y=document.querySelector(".sidebar-layout-trigger"))==null?void 0:y.focus()})},children:[e.jsx(el,{value:u.value}),e.jsxs("span",{className:"sidebar-layout-option-copy",children:[e.jsx("span",{children:hs[u.value]}),e.jsx("small",{children:u.description})]}),n===u.value&&e.jsx(To,{size:16,"aria-hidden":"true"})]},u.value))]}),document.body)]})}function tl({value:n,health:s,onClose:o}){const i=s.find(h=>h.agentType===n),c=(i==null?void 0:i.available)===!1?"unavailable":i!=null&&i.available||n==="customer-agent"?"ready":"checking",l=c==="ready"?"本机已连接":c==="checking"?"正在检查运行时":"运行时暂不可用";return e.jsxs("header",{className:"sidebar-agent-header",children:[e.jsx("span",{className:"sidebar-agent-header-icon",children:e.jsx(Yt,{agentType:n,size:23})}),e.jsxs("div",{className:"sidebar-agent-header-identity",children:[e.jsx("span",{className:"sidebar-agent-header-name",title:Pn[n],children:Pn[n]}),e.jsxs("span",{className:`sidebar-agent-header-status is-${c}`,title:i==null?void 0:i.error,children:[e.jsx("i",{"aria-hidden":"true"}),l]})]}),e.jsxs("div",{className:"sidebar-agent-header-actions",children:[e.jsx(pi,{}),e.jsx("button",{type:"button",className:"ui-icon-button sidebar-agent-header-close",onClick:o,"aria-label":"收起会话列表",title:"收起会话列表",children:e.jsx(yt,{size:18,"aria-hidden":"true"})})]})]})}async function nl(n,s,o){async function i(u){const y=[],A=new Set;let C=null;do{o.throwIfAborted();const w=await u(C);if(o.throwIfAborted(),w.stale)throw new Error("会话列表待刷新,请重试");if(y.push(...w.data),C=w.nextCursor,C&&A.has(C))throw new Error("会话列表加载中断,请重试");C&&A.add(C)}while(C);return y}const c=await i(u=>n.listAgentWorkspaces(s,{cursor:u,limit:200})),l=[...new Map(c.map(u=>[u.workspaceId,u])).values()],h=new Array(l.length);let m=0;await Promise.all(Array.from({length:Math.min(4,l.length)},async()=>{for(;m<l.length;){const u=m++,y=l[u];h[u]=(await i(A=>n.listAgentWorkspaceSessions(s,y.workspaceId,{cursor:A,limit:200}))).map(A=>({...A,projectId:y.workspaceId}))}}));const f=new Set,d=h.flat().filter(u=>f.has(u.id)?!1:(f.add(u.id),!0));return{workspaces:l,sessions:d}}function sl({hidden:n,value:s,health:o,selectedSessionId:i,getActivity:c,onChange:l,onNewSession:h,onSelect:m}){const[f,d]=r.useState(null),[u,y]=r.useState(null),[A,C]=r.useState(!1),[w,k]=r.useState(null),[v,_]=r.useState(""),P=hn(),[B,Z]=r.useState(0),ce=r.useRef(),se=r.useRef(null),W=r.useRef(new Map),$=()=>clearTimeout(ce.current),M=()=>{$(),d(null)},K=()=>{$(),ce.current=setTimeout(()=>d(null),180)};r.useEffect(()=>()=>clearTimeout(ce.current),[]);const le=!!(f&&Ur(o).includes(f.agentType));r.useEffect(()=>{(n||!le)&&d(null)},[n,le]),r.useEffect(()=>{if(!f||n||!le)return;const O=new AbortController;return _(""),y(W.current.get(f.agentType)??null),k(null),C(!0),nl(window.agentApi,f.agentType,O.signal).then(te=>{O.signal.aborted||(W.current.set(f.agentType,te),y(te))}).catch(te=>{O.signal.aborted||k(te instanceof Error?te.message:"会话加载失败,请重试")}).finally(()=>{O.signal.aborted||C(!1)}),()=>O.abort()},[f==null?void 0:f.agentType,le,n,B]);const re=Is((u==null?void 0:u.sessions)??[],O=>{const te=c(O);return te==="running"||te==="needs-input"}),ie=v.trim().toLocaleLowerCase(),ae=Mn(ie?zn(re.filter(O=>O.title.toLocaleLowerCase().includes(ie)),re):re),Ae=({session:O,children:te})=>{const Se=Dn(c(O)),Ee=P.expandedIds.has(O.id);return e.jsxs("div",{children:[e.jsx(On,{session:{id:O.id,title:O.title,visualState:Se,statusLabel:Rn[Se],occupiedExternally:O.occupancy==="owned-externally",completedAt:Ln(O),canDelete:!1,active:s===(f==null?void 0:f.agentType)&&i===O.id,compatibility:O.compatibility,child:!!O.parentSessionId,expanded:Ee},onToggleChildren:te.length?()=>P.toggle(O.id):void 0,onSelect:()=>{u&&m(O,u),M()}}),Ee&&te.length>0&&e.jsx("div",{className:"sidebar-session-children",role:"group","aria-label":`${O.title}的子会话`,children:te.map(Ae)})]},O.id)},de=O=>{var Se;const te=O.relatedTarget;!O.currentTarget.contains(te)&&!((Se=se.current)!=null&&Se.contains(te))&&K()};return e.jsxs(e.Fragment,{children:[e.jsx("aside",{className:"sidebar-agent-rail","aria-label":"Agent 快捷栏","aria-hidden":n,ref:O=>{O&&(O.inert=n)},onPointerEnter:$,onPointerLeave:K,onBlur:de,onKeyDown:O=>{O.key==="Escape"&&M()},children:e.jsx(Kr,{vertical:!0,value:s,health:o,onChange:l,onPreview:(O,te,Se)=>{$(),(f==null?void 0:f.agentType)!==O&&(y(null),P.collapseAll()),d({agentType:O,label:te,top:Math.max(56,Math.min(Se.top,window.innerHeight-380))})}})}),!n&&le&&f&&qe.createPortal(e.jsxs("div",{ref:se,className:"agent-session-flyout",style:{top:f.top,maxHeight:Math.min(600,window.innerHeight-f.top-12)},role:"dialog","aria-label":`${f.label} 会话`,onPointerEnter:$,onPointerLeave:K,onFocus:$,onBlur:de,onKeyDown:O=>{O.key==="Escape"&&M()},children:[e.jsxs("header",{children:[e.jsx(Yt,{agentType:f.agentType,size:20}),e.jsx("strong",{children:f.label}),e.jsxs("span",{children:["会话 ",(u==null?void 0:u.sessions.length)??""]}),e.jsxs("button",{type:"button",className:"agent-session-flyout-new","aria-label":`新建 ${f.label} 会话`,title:"在小窗口中新建会话",onClick:()=>{h(f.agentType),M()},children:[e.jsx(Nn,{size:14,"aria-hidden":"true"}),e.jsx("span",{children:"新建会话"})]})]}),e.jsxs("label",{className:"agent-session-flyout-search",children:[e.jsx(Wn,{size:15,"aria-hidden":"true"}),e.jsx("input",{"aria-label":`搜索 ${f.label} 会话`,placeholder:"搜索会话",value:v,onChange:O=>_(O.target.value)})]}),e.jsxs("div",{className:"agent-session-flyout-list","aria-busy":A,children:[ae.map(Ae),A&&e.jsxs("p",{className:"agent-session-flyout-message",role:"status",children:[e.jsx(bt,{size:15,className:"spin"}),"正在加载会话…"]}),w&&e.jsxs("p",{className:"agent-session-flyout-message",role:"alert",children:[w,e.jsx("button",{type:"button",onClick:()=>Z(O=>O+1),children:"重试"})]}),!A&&!w&&!ae.length&&e.jsx("p",{className:"agent-session-flyout-message",children:v?"没有匹配的会话":"暂无会话"})]})]}),document.body)]})}function zr({onOpenCalendar:n}){return e.jsx("div",{className:"desktop-app-actions",role:"toolbar","aria-label":"应用快捷操作",children:e.jsx("button",{type:"button",className:"ui-icon-button desktop-app-action desktop-app-action--calendar",onClick:n,title:"智能体日历","aria-label":"打开日历",children:e.jsx(Es,{size:17,"aria-hidden":"true"})})})}const vs=264,Mr=126;function rl(n){const s=typeof window>"u"?1024:window.innerWidth,o=typeof window>"u"?768:window.innerHeight,i=Math.max(8,Math.min(n.left+n.width-vs,s-vs-8)),c=n.top+n.height+7,l=c+Mr<=o-8?c:Math.max(8,n.top-Mr-7);return{left:i,top:l,width:vs}}function Wr({title:n,message:s,anchor:o,mobile:i,pending:c,onCancel:l,onConfirm:h}){const m=f=>f.stopPropagation();return e.jsx("div",{className:`sidebar-delete-confirmation-layer${i?" is-mobile":""}`,onClick:c?void 0:l,children:e.jsxs("div",{className:"sidebar-delete-confirmation",role:"alertdialog","aria-modal":"true","aria-labelledby":"sidebar-delete-confirmation-title","aria-describedby":"sidebar-delete-confirmation-message",style:i?void 0:rl(o),onClick:m,children:[e.jsx("strong",{id:"sidebar-delete-confirmation-title",children:n??"删除会话"}),e.jsx("p",{id:"sidebar-delete-confirmation-message",children:s}),e.jsxs("div",{className:"sidebar-delete-confirmation-actions",children:[e.jsx("button",{type:"button",onClick:l,disabled:c,children:"取消"}),e.jsx("button",{type:"button",className:"is-danger",onClick:h,disabled:c,children:c?"正在删除...":"删除"})]})]})})}function il({message:n,type:s}){return n?qe.createPortal(e.jsxs("div",{className:`app-action-notice is-${s}`,role:s==="error"?"alert":"status","aria-live":s==="error"?"assertive":"polite",children:[e.jsx("span",{className:"app-action-notice-mark","aria-hidden":"true",children:s==="success"?"✓":s==="info"?"i":"!"}),e.jsx("span",{children:n})]}),document.body):null}function fi(){const n=window;return n.SpeechRecognition??n.webkitSpeechRecognition??null}function al(){if(typeof window>"u")return null;const n=window.agentApi;return typeof(n==null?void 0:n.dictationStart)!="function"||typeof n.dictationStop!="function"||typeof n.onDictation!="function"||typeof n.onDictationError!="function"?null:n}function ol(){return al()!==null||fi()!==null}function cl(n){var h;const s=fi();if(!s)return(h=n.onError)==null||h.call(n,"当前环境不支持语音唤醒"),null;let o=!1,i=null,c=null;const l=()=>{if(!o){i=new s,i.lang=n.lang??"zh-CN",i.continuous=!0,i.interimResults=!0,i.onresult=m=>{var u,y,A;const f=m.results[m.results.length-1],d=(y=(u=f==null?void 0:f[0])==null?void 0:u.transcript)==null?void 0:y.trim();d&&(f.isFinal&&((A=n.onHeard)==null||A.call(n,d)),d.includes(n.wakeWord)&&n.onWake(d))},i.onerror=m=>{var f;m.error==="not-allowed"&&((f=n.onError)==null||f.call(n,"麦克风权限被拒绝,语音唤醒已停用"),o=!0)},i.onend=()=>{o||(c=setTimeout(l,400))};try{i.start()}catch{c=setTimeout(l,800)}}};return l(),{stop:()=>{o=!0,c&&clearTimeout(c);try{i==null||i.abort()}catch{}}}}function ll(n){return n.startsWith("/")||/^[A-Za-z]:[\\/]/.test(n)||/^\\\\[^\\/]+[\\/][^\\/]+/.test(n)}function dl(n,s){if(s.webShell||s.isInvalid||!s.supported)return null;const o=n.description;return!o||/[\0\r\n]/.test(o)||!ll(o)?null:o}function ul(n){return{request:(s,o)=>n.fileWorkspaceRequest(s,o),subscribe:(s,o)=>s!=="fs:event"?()=>{}:n.onFileWorkspaceEvent(o)}}function pl({authoritativeStatus:n,locallyRunning:s,needsInput:o,stale:i}){return n==="failed"||n==="error"?"error":i&&!s?"stale":s||n==="running"?o?"needs-input":"running":"idle"}function fl(n,s){const o=new Set;n&&o.add(n);for(const i of s)i&&o.add(i);return[...o]}function hl(n,s,o){return[...n].filter(i=>!s.has(i)&&!o.has(i))}const $r=220,Hr=480,gl=180;function ml(){const[n,s]=r.useState(300),[o,i]=r.useState(!1),[c,l]=r.useState(!1),h=r.useRef(null),m=r.useCallback(w=>{w.button!==0||!w.isPrimary||(w.preventDefault(),w.currentTarget.setPointerCapture(w.pointerId),h.current={pointerId:w.pointerId,startX:w.clientX,startWidth:n,target:w.currentTarget},l(!0))},[n]),f=r.useCallback(w=>{const k=h.current;if(!k||w.pointerId!==k.pointerId)return;const v=k.startWidth+w.clientX-k.startX,_=v<=gl;i(_),s(_?k.startWidth:Math.min(Hr,Math.max($r,v)))},[]),d=r.useCallback(()=>{const w=h.current;w&&(h.current=null,l(!1),w.target.hasPointerCapture(w.pointerId)&&w.target.releasePointerCapture(w.pointerId))},[]),u=r.useCallback(w=>{var k;w.pointerId===((k=h.current)==null?void 0:k.pointerId)&&d()},[d]),y=r.useCallback(w=>{f(w),u(w)},[f,u]);r.useEffect(()=>{if(c)return window.addEventListener("pointerup",y),window.addEventListener("pointercancel",u),window.addEventListener("blur",d),()=>{window.removeEventListener("pointerup",y),window.removeEventListener("pointercancel",u),window.removeEventListener("blur",d)}},[c,y,u,d]);const A=r.useCallback(w=>{w.key==="Enter"?(w.preventDefault(),i(!0)):(w.key==="ArrowLeft"||w.key==="ArrowRight")&&(w.preventDefault(),s(k=>Math.min(Hr,Math.max($r,k+(w.key==="ArrowLeft"?-20:20)))))},[]),C=r.useCallback(()=>i(w=>!w),[]);return{width:n,collapsed:o,dragging:c,toggle:C,resizeProps:{onPointerDown:m,onPointerMove:f,onPointerUp:y,onPointerCancel:u,onLostPointerCapture:u,onKeyDown:A}}}const wl=r.lazy(()=>Ce(()=>import("./CollaborationDashboard-O13tTlEe.js"),__vite__mapDeps([12,1,2,13,14,15,16,17,4,18,5,19,20,21,22,8,23,24]),import.meta.url)),bl=r.lazy(()=>Ce(()=>import("./SessionDashboard-DGfTYjbZ.js"),__vite__mapDeps([32,1,2,23,33,34,20,19,35,21,22,4,8,29,10,36]),import.meta.url)),xl=r.lazy(()=>Ce(()=>import("./CollaborationPage-DIKDOl8G.js"),__vite__mapDeps([25,1,2,26,27,28,4,23,29,19,21,22,15,13,30,31,9]),import.meta.url)),yl=r.lazy(()=>Ce(()=>import("./AIHubView-C0eIFauh.js"),__vite__mapDeps([45,1,2,46,26,27,28,4,38,9,47,18,48,17,7,5,8,20,39,40,35,19,16,49,50]),import.meta.url)),vl=r.lazy(()=>Ce(()=>import("./CalendarView-C5z_2esa.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]),import.meta.url)),kl=async(n,s)=>{const o=window.agentApi;if(!(o!=null&&o.calendarOverview))throw new Error("当前服务不支持日历,请更新共享服务。");return o.calendarOverview({from:n,to:s})},Sl=r.lazy(()=>Ce(()=>import("./SettingsPanel-DCME-IZC.js"),__vite__mapDeps([51,1,2,46,26,27,28,4,38,9,47,18,48,17,7,5,8,20,39,40,35,19,16,49,14,15,21,22,33,23,34,3,52,53,13,30]),import.meta.url)),jl=r.lazy(()=>Ce(()=>import("./MCPServerList-A1SAlHdR.js"),__vite__mapDeps([54,1,2]),import.meta.url)),Cl=r.lazy(()=>Ce(()=>import("./MemoryViewer-fFtBJzgz.js"),__vite__mapDeps([55,1,2]),import.meta.url)),Il=r.lazy(()=>Ce(()=>import("./SkillManager-CFHcSwEr.js"),__vite__mapDeps([56,1,2]),import.meta.url)),Tl=r.lazy(()=>Ce(()=>import("./AgentManager-B7kG8iLS.js"),__vite__mapDeps([57,1,2,46,26,27,28,4,38,9,47,18,48,17,7,5,8,20,39,40,35,19,16,49]),import.meta.url)),Al=r.lazy(()=>Ce(()=>import("./LSPServerList-BfbJdHYJ.js"),__vite__mapDeps([58,1,2]),import.meta.url)),El=r.lazy(()=>Ce(()=>import("./FileWorkspaceDrawer-YcKPTu23.js"),__vite__mapDeps([59,1,2,60,26,40,28,18,9,48,4,61,62,17,6,8,5]),import.meta.url));function Br(n,s){var c;const o={},i={};for(const[l,h]of Object.entries(n)){const m=h.data;o[l]=Cs(m.filter(f=>!f.parentSessionId),s);for(const f of m.filter(d=>d.parentSessionId))(i[c=f.parentSessionId]??(i[c]=[])).push(f)}for(const l of Object.values(i))l.sort((h,m)=>h.created.localeCompare(m.created));return{roots:o,children:i,projectIds:new Set(Object.entries(n).filter(([,l])=>l.loaded).map(([l])=>l))}}function Nl(n,s,o){return n==="codex"&&(s==null?void 0:s.canCreateSession)!==!1?!0:o}function ks(n){return{id:n.workspaceId,name:n.name,description:n.roots[0]??"",created:n.updatedAt??"",updated:n.updatedAt??"",agentType:n.agentType,source:n.source,canCreateSession:n.canCreateSession}}function Fr(){return e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"M3 6h18"}),e.jsx("path",{d:"M8 6V4h8v2"}),e.jsx("path",{d:"M19 6l-1 14H6L5 6"}),e.jsx("path",{d:"M10 11v5M14 11v5"})]})}function qr(n,s){s&&n.detail>0&&n.currentTarget.blur()}function Pl(){const n=document.activeElement;n instanceof HTMLElement&&(n.matches("input, textarea, select")||n.isContentEditable)&&n.blur()}function Rl(){var or,cr,lr,dr;const[n]=r.useState(Ha),[s]=r.useState(()=>Cc(typeof window>"u"?"":window.location.search,n.activeAgent)),o=s.agentType,i=n.agents[o]??bs(),[c]=r.useState(()=>Br(i.sessions,o)),l=r.useRef(n),[h,m]=r.useState(o),f=r.useRef(h);f.current=h;const[d,u]=r.useState(i.workspaces.map(ks)),[y,A]=r.useState(i.nextCursor),[C,w]=r.useState(i.watermark),[k,v]=r.useState(!1),[_,P]=r.useState(!1),[B,Z]=r.useState(null),[ce,se]=r.useState(!1),[W,$]=r.useState(c.roots),[M,K]=r.useState(""),[le,re]=r.useState(!1),[ie,ae]=r.useState(null),[Ae,de]=r.useState(!1),[O,te]=r.useState(null);r.useEffect(()=>{if(!le||!window.agentApi)return;let t=!1;return de(!0),te(null),window.agentApi.listSessions().then(a=>{t||ae({agentType:h,sessions:a})}).catch(a=>{t||te(a instanceof Error?a.message:"会话搜索加载失败")}).finally(()=>{t||de(!1)}),()=>{t=!0}},[le,h]);const[Se,Ee]=r.useState(10),[ve,D]=r.useState(null),[G,X]=r.useState(!1),[F,R]=r.useState(null),[ue,V]=r.useState(!1),[ze,Ie]=r.useState(0),[Y,nt]=r.useState([]),[je,ke]=r.useState([]),[Te,Ve]=r.useState(c.children),Me=r.useRef(W),Qe=r.useRef(Te);Me.current=W,Qe.current=Te;const[dt,Mt]=r.useState(c.projectIds),[Wt,g]=r.useState(new Set),[S,j]=r.useState({}),[T,E]=r.useState(new Set),[z,q]=r.useState(Object.fromEntries(Object.entries(i.sessions).map(([t,a])=>[t,a.nextCursor]))),J=r.useRef(new Map),Ne=r.useRef(new Map),[U,Pe]=r.useState(i.selectedWorkspaceId),[ee,ne]=r.useState(()=>s.explicit||Re.getState().navigationLayout==="all-sessions"?null:i.selectedSessionId),[ye,We]=r.useState(null),st=r.useRef(null);st.current=ye;const[ge,gn]=r.useState(null),vt=r.useRef(null),Ps=r.useRef(0);vt.current=ge;const mn=r.useCallback(async()=>{const t=++Ps.current;try{const a=await Ba();return t!==Ps.current?vt.current:(vt.current=a,gn(a),a)}catch{return vt.current}},[]);r.useEffect(()=>{mn();let t=!1;const a=()=>{!wt()||t||(t=!0,mn().finally(()=>{t=!1}))},p=window.setInterval(a,3e4);return window.addEventListener("focus",a),()=>{window.clearInterval(p),window.removeEventListener("focus",a)}},[mn]),r.useEffect(()=>{if(!ee)return;const t=ge==null?void 0:ge.get(ee);if(!t||t.currentSessionId===ee)return;const a=An(t);a&&(We(a),Xt(void 0),ne(a.id))},[ge,ee]);const Ue=r.useRef(U),Ze=r.useRef(ee);Ue.current=U,Ze.current=ee;const $n=hn(),Hn=hn(),[ut,kt]=r.useState(new Set(i.expandedWorkspaceIds)),[St,Rs]=r.useState(new Set),[Ls,wn]=r.useState(!1),[Ds,_s]=r.useState(!1),[$t,jt]=r.useState(!1),[Ht,et]=r.useState(!1),[hi,Os]=r.useState(),[gi,zs]=r.useState(0),Bn=()=>{jt(!1),Os(void 0),zs(t=>t+1),et(!0)};r.useEffect(()=>{var x,I;let t=0;const a=N=>{var Q;if(!N.taskId&&!N.sessionId)return;const H=++t;if(Ye(!1),Ge(!1),Ke(null),jt(!1),N.taskId)(Q=_e.current)==null||Q.abort(),_e.current=null,rt.current=null,Tt(null),Os(N.taskId),et(!0),zs(pe=>pe+1);else if(N.sessionId){if(et(!1),Go(N.sessionId))return;window.agentApi.getSession(N.sessionId,{limit:1}).then(pe=>{if(H!==t)return;const he=pe;Xe.current({kind:"session",session:{id:he.id,agentType:he.agentType??"customer-agent",title:he.title,cwd:he.cwd??"",projectId:he.projectId??void 0}})}).catch(()=>{})}},p=N=>a(N.detail);window.addEventListener("agentroam:notification-open",p);const b=(I=(x=window.agentApi)==null?void 0:x.onNotificationOpen)==null?void 0:I.call(x,a);return()=>{t++,window.removeEventListener("agentroam:notification-open",p),b==null||b()}},[]),r.useEffect(()=>{et(!1)},[ee,U]);const[Ms,Fn]=r.useState([]),[$e,Ke]=r.useState(null),[Ct,Ge]=r.useState(!1),[Ws,qn]=r.useState(!1),[It,Ye]=r.useState(!1),[$s,bn]=r.useState(!1);r.useEffect(()=>{var t,a;(a=(t=window.agentApi)==null?void 0:t.setNotificationVisible)==null||a.call(t,{sessionId:!Ht&&!$t&&!It&&!Ct&&!$e?ee??void 0:void 0})},[ee,Ht,$t,It,Ct,$e]);const[mi,wi]=r.useState(0),[bi,xi]=r.useState(!1),[yi,Xt]=r.useState(),[Jt,Tt]=r.useState(null),Qt=r.useRef(null),[vi,ki]=r.useState({}),Xe=r.useRef(()=>{}),_e=r.useRef(null),rt=r.useRef(null),Si=r.useCallback((t,a)=>{const p=rt.current;!p||p.sessionId!==t||p.seed!==a||_e.current!==p.controller||p.controller.signal.aborted||(rt.current=null,_e.current=null,Tt(null),window.parent!==window&&window.parent.postMessage({type:ko,sessionId:t},window.location.origin))},[]),ji=r.useRef(`${Date.now()}-${Math.random().toString(36).slice(2)}`),Vn=$s||Ws||Ms.length>0,Un=()=>{if(et(!1),lt()&&window.parent!==window){window.parent.postMessage({type:un,intent:{kind:"dashboard"}},window.location.origin);return}bn(!0),Ye(!0),Ge(!1),Ke(null)},Kn=()=>{et(!1),qn(!0),Ge(!0),Ke(null),Ye(!1)},[Ci,Gn]=r.useState(!1),[Hs,Bs]=r.useState(0),xn=t=>{lt()&&window.parent!==window?window.parent.postMessage({type:jo,groupId:t.id,title:t.name},window.location.origin):(Ye(!1),Ge(!1),Fn(a=>a.some(p=>p.id===t.id)?a:[...a,t]),Ke(t.id))},[At,Ii]=r.useState("settings"),Fs=Kt(t=>t.setTodos),Zt=Re(t=>t.skin),it=Re(t=>t.layout),Bt=Re(t=>t.navigationLayout),Je=Bt==="all-sessions",Et=Re(t=>t.wakeEnabled),Nt=Re(t=>t.wakeWord),Ti=Re(t=>t.setSkin),en=Re(t=>t.setLayout),Ai=Re(t=>t.setWakeEnabled),Ei=Re(t=>t.setWakeWord),pt=Re(t=>t.runningFirst),Ni=Re(t=>t.setRunningFirst),qs=Re(t=>t.pinnedSessionIds),Yn=Re(t=>t.togglePinnedSession),Pi=Re(t=>t.removePinnedSessions),tn=new Set(qs),Xn=Kt(t=>t.runningSessionId),Jn=Kt(Ko(t=>Object.entries(t.messagesBySession).filter(([,a])=>co(a)).map(([a])=>a))),nn=r.useCallback((t,a=t.projectId)=>pl({authoritativeStatus:t.status,locallyRunning:Xn===t.id,needsInput:Jn.includes(t.id),stale:!!(t.agentType===h&&a&&(T.has(a)||S[a]))}),[h,S,Xn,Jn,T]),Vs=r.useCallback(t=>{const a=nn(t);return a==="running"||a==="needs-input"},[nn]),Ri=()=>{kt(new Set),$n.collapseAll()},Li=()=>{const t=d.filter(p=>!St.has(p.id)),a=t.map(p=>p.id);kt(new Set(a));for(const p of t){const b=p.id;if(He.current.has(b))continue;const x=gt.current.has(b),I=Nl(f.current,p,x);Be(b,{refresh:I,background:x})}},we=lt(),Ft=Jc(!we);r.useEffect(()=>{if(!we||window.parent===window)return;const t=a=>{Co(a,window.location.origin,window.parent)&&Gn(!0)};return window.addEventListener("message",t),()=>window.removeEventListener("message",t)},[we]);const Di=pa(),_i=fa(),xe=we&&Di,[Pt,at]=r.useState(!1),[sn,Qn]=r.useState(!1),[Oi,Zn]=r.useState("files"),[Us,es]=r.useState(null),[zi,Ks]=r.useState(null),ot=r.useMemo(()=>{var t;return!we&&typeof((t=window.agentApi)==null?void 0:t.fileWorkspaceRequest)=="function"?ul(window.agentApi):null},[we]),Mi=r.useCallback(async t=>{if(we){Eo(t);return}if(ot){if(t.startsWith("~/")){const{home:a}=await ot.request("hello"),p=No(t,null,a);if(!p)return;t=p}Zn("files"),Qn(!0),es(t),Ks(a=>Po(t)?null:{path:t,requestId:((a==null?void 0:a.requestId)??0)+1})}},[ot,we]);r.useEffect(()=>{es(null),Ks(null)},[U]);const[yn,ts]=r.useState(!1),[vn,Gs]=r.useState(null),[Wi,Ys]=r.useState(0),[$i,Xs]=r.useState(void 0),ft=r.useRef(null),Rt=r.useRef(!1),[Hi,Js]=r.useState(null),qt=r.useRef(null),ns=r.useRef(!1),ht=r.useRef(d);ht.current=d;const ss=r.useRef(St);ss.current=St;const gt=r.useRef(dt);gt.current=dt;const He=r.useRef(Wt);He.current=Wt;const rn=r.useRef(null);r.useEffect(()=>{document.documentElement.setAttribute("data-skin",Zt)},[Zt]),r.useEffect(()=>{document.body.classList.toggle("layout-compact",it==="compact")},[it]),r.useEffect(()=>{var b;const t=d.map((x,I)=>({agentType:h,workspaceId:x.id,name:x.name,roots:x.description?[x.description]:[],order:I,updatedAt:x.updated||void 0,source:x.source??(x.agentType==="claude-code"?"derived":"native"),canCreateSession:x.canCreateSession})),a=Object.fromEntries(d.map(x=>[x.id,{data:jr(W[x.id]??[],Te),nextCursor:z[x.id]??null,loaded:dt.has(x.id)}])),p={...l.current,version:2,activeAgent:h,agents:{...l.current.agents,[h]:{workspaces:t,nextCursor:y,watermark:C,expandedWorkspaceIds:[...ut],selectedWorkspaceId:U,selectedSessionId:ee,sidebarScrollTop:((b=rn.current)==null?void 0:b.scrollTop)??0,sessions:a}}};l.current=p,Sr(p)},[h,Te,ut,dt,d,U,ee,z,W,y,C]);const kn=r.useCallback(()=>{if(!window.agentApi||!Et||Rt.current||ft.current)return;const t=()=>{ol()&&!ft.current&&(ft.current=cl({wakeWord:Nt,onWake:a=>{var p;Xs(a),Ys(b=>b+1),(p=window.agentApi)==null||p.showWindow()},onError:a=>console.warn("[wake]",a)}))};typeof window.agentApi.wakeStart=="function"?(Rt.current=!0,window.agentApi.wakeStart(Nt).then(a=>{a.ok||(Rt.current=!1,t())}).catch(()=>{Rt.current=!1,t()})):t()},[Et,Nt]);r.useEffect(()=>{var t;if((t=window.agentApi)!=null&&t.onWake)return window.agentApi.onWake(a=>{Rt.current=!1,Xs(a),Ys(p=>p+1)})},[]),r.useEffect(()=>{var t;if((t=window.agentApi)!=null&&t.onWakeAiHub)return window.agentApi.onWakeAiHub(()=>{et(!1),jt(!0),en("focus")})},[]),r.useEffect(()=>{var t;if((t=window.agentApi)!=null&&t.onWakeCommand)return window.agentApi.onWakeCommand(a=>{var I;const p=((a==null?void 0:a.text)||"").trim();if(!p)return;const b=qt.current&&Date.now()<qt.current.until?qt.current:null;if(b){b.until=Date.now()+9e4,ne(b.sessionId),(I=window.agentApi)==null||I.wakeConversation(!0),Js({text:p,projectId:null,sessionId:b.sessionId,nonce:Date.now()}),fe(`语音追问:${p.length>40?p.slice(0,40)+"…":p}`),Le("success"),setTimeout(()=>fe(null),4e3);return}const x=ht.current.find(N=>N.name&&p.includes(N.name)&&!ss.current.has(N.id));x&&(Pe(x.id),kt(N=>{const H=new Set(N);return H.add(x.id),H})),ne(null),ns.current=!0,Js({text:p,projectId:(x==null?void 0:x.id)??null,nonce:Date.now()}),fe(`语音指令:${p.length>40?p.slice(0,40)+"…":p}${x?`(项目:${x.name})`:""}`),Le("success"),setTimeout(()=>fe(null),4e3)})},[]);const Bi=r.useCallback(async()=>{window.agentApi&&(kn(),await window.agentApi.hideWindow())},[kn]),Fi=r.useCallback(t=>{wn(!1),Gs({right:t.right,bottom:t.bottom}),ts(a=>!a)},[]),qi=r.useCallback(()=>{ts(!1),wn(t=>!t)},[]);r.useEffect(()=>{if(!yn)return;const t=()=>{const p=document.querySelector(".chat-header-action--appearance");if(!p)return;const b=p.getBoundingClientRect();Gs(x=>(x==null?void 0:x.right)===b.right&&x.bottom===b.bottom?x:{right:b.right,bottom:b.bottom})},a=window.requestAnimationFrame(t);return window.addEventListener("resize",t),()=>{window.cancelAnimationFrame(a),window.removeEventListener("resize",t)}},[it,yn]),r.useEffect(()=>{window.agentApi&&kn()},[kn]),r.useEffect(()=>{const t=()=>{var a;(a=ft.current)==null||a.stop(),ft.current=null};return window.addEventListener("focus",t),()=>window.removeEventListener("focus",t)},[]),r.useEffect(()=>{var t,a;Et||((t=ft.current)==null||t.stop(),ft.current=null,Rt.current=!1,(a=window.agentApi)==null||a.wakeStop())},[Et]),r.useEffect(()=>{!Et||!window.agentApi||Rt.current&&window.agentApi.wakeStart(Nt)},[Nt]),r.useEffect(()=>()=>{var t;(t=ft.current)==null||t.stop()},[]);const Vi=[...Object.values(W).flat(),...Object.values(Te).flat()],Qs=Fa((ie==null?void 0:ie.agentType)===h?ie.sessions:[],Vi,h).map(t=>{var a;return{...t,projectId:t.projectId??((a=d.find(p=>p.description===t.cwd))==null?void 0:a.id)}}),rs=_c(Qs,t=>tn.has(t.id)),Ui=Object.entries(W).flatMap(([t,a])=>a.filter(p=>tn.has(p.id)).map(p=>({projectId:t,session:p,created:p.created}))),Zs=Cs(Ui,h),er=pt?Is(Zs,({session:t})=>Vs(t)):Zs,Ki=Qs,Gi=r.useMemo(()=>Object.fromEntries(Object.entries(W).map(([t,a])=>[t,qa(a,ge)])),[W,ge]),mt=M.trim().toLowerCase(),an=mt?rs.filter(t=>t.title.toLowerCase().includes(mt)||(t.cwd||"").toLowerCase().includes(mt)):null,on=le?Mn(an?zn(an,rs):rs):[],Lt=ee?Ki.find(t=>t.id===ee)??((ye==null?void 0:ye.id)===ee?ye:void 0)??(ge!=null&&ge.get(ee)?An(ge.get(ee)):void 0):void 0,Yi=Lt==null?void 0:Lt.title,Vt=(Lt==null?void 0:Lt.cwd)||((or=d.find(t=>t.id===U))==null?void 0:or.description)||null,is=d.filter(t=>!St.has(t.id)).map(t=>t.id),Xi=[...d.filter(t=>!St.has(t.id)),...d.filter(t=>St.has(t.id))],Dt=is.length>0&&is.every(t=>!ut.has(t)),{width:Sn,collapsed:Ut,dragging:as,toggle:jn,resizeProps:Ji}=ml(),_t=!xe&&(Ut||it==="focus"),[Qi,fe]=r.useState(null),[Zi,Le]=r.useState("success"),De=t=>{var b;et(!1);const a=t.sessionId?(b=vt.current)==null?void 0:b.get(t.sessionId):void 0,p=a?An(a):void 0;p&&(t={...t,sessionId:p.id},We(p)),Ue.current=t.projectId,Ze.current=t.sessionId,Pe(t.projectId),ne(t.sessionId),t.sessionId||Fs([])},Ot=(t,a=!1)=>{var H;if(t===f.current&&!a)return;const p=f.current,b=l.current.agents[p];b&&(l.current={...l.current,agents:{...l.current.agents,[p]:{...b,sidebarScrollTop:((H=rn.current)==null?void 0:H.scrollTop)??b.sidebarScrollTop}}});const x=l.current.agents[t]??bs(),I=Br(x.sessions,t),N=x.workspaces.map(ks);f.current=t,ht.current=N,m(t),u(N),A(x.nextCursor),w(x.watermark),v(!1),P(!1),Z(null),Me.current=I.roots,Qe.current=I.children,$(I.roots),Ve(I.children),Mt(I.projectIds),gt.current=I.projectIds,g(new Set),He.current=new Set,j({}),E(new Set),q(Object.fromEntries(Object.entries(x.sessions).map(([Q,pe])=>[Q,pe.nextCursor]))),kt(new Set(x.expandedWorkspaceIds)),Rs(new Set),De({projectId:x.selectedWorkspaceId,sessionId:x.selectedSessionId}),window.requestAnimationFrame(()=>{rn.current&&(rn.current.scrollTop=x.sidebarScrollTop)}),Je||tt(t,{refresh:x.workspaces.length>0,since:x.watermark,refreshLoadedSessions:!Je})},cn=(t,a)=>{var pe,he;(pe=_e.current)==null||pe.abort(),_e.current=null,rt.current=null,Tt(null),Xt(void 0);const p=t??f.current,b=Vt;p!==f.current&&Ot(p);const x=l.current.agents[p],I=(x==null?void 0:x.workspaces)??[],N=b?I.find(L=>{var me;return L.canCreateSession!==!1&&((me=L.roots)==null?void 0:me.includes(b))}):void 0,H=x!=null&&x.selectedWorkspaceId&&I.some(L=>L.canCreateSession!==!1&&L.workspaceId===x.selectedWorkspaceId)?x.selectedWorkspaceId:void 0,Q=a??(N==null?void 0:N.workspaceId)??H??((he=I.find(L=>L.canCreateSession!==!1))==null?void 0:he.workspaceId)??null;Qt.current=a||N||!b?null:{agentType:p,preferredPath:b},De({projectId:Q,sessionId:null}),Kt.setState({sessionId:null,messages:[]}),Ye(!1),bn(!1),Ge(!1),Ke(null),jt(!1),it==="focus"&&en("standard"),wi(L=>L+1),xe&&at(!1)};r.useEffect(()=>{const t=Qt.current;if(!t)return;if(ee!==null){Qt.current=null;return}if(h!==t.agentType)return;const a=t.preferredPath?d.find(p=>p.canCreateSession!==!1&&p.description===t.preferredPath):void 0;a&&(Qt.current=null,a.id!==U&&De(En(a.id)))},[h,d,U,ee]);const os=(t,a,p=!1)=>{const b=l.current.agents[t.agentType]??bs();l.current={...l.current,agents:{...l.current.agents,[t.agentType]:{...b,workspaces:a.workspaces,nextCursor:p?b.nextCursor:null,selectedWorkspaceId:t.projectId??null,selectedSessionId:t.id,expandedWorkspaceIds:[...new Set([...b.expandedWorkspaceIds,...t.projectId?[t.projectId]:[]])],sessions:Object.fromEntries(a.workspaces.map(x=>{var I,N;return[x.workspaceId,{data:a.sessions.filter(H=>H.projectId===x.workspaceId),loaded:p?((I=b.sessions[x.workspaceId])==null?void 0:I.loaded)??!1:!0,nextCursor:p?((N=b.sessions[x.workspaceId])==null?void 0:N.nextCursor)??null:null}]}))}}},Ot(t.agentType,!0),Ye(!1),Ge(!1),Ke(null),xe&&at(!1)};Xe.current=t=>{var p;if(we&&window.parent!==window&&["dashboard","groups","group"].includes(t.kind)){window.parent.postMessage({type:un,intent:t},window.location.origin);return}(p=_e.current)==null||p.abort(),rt.current=null;const a=new AbortController;_e.current=a,Tt(t.kind==="session"?t.session:null),t.kind==="session"&&(Ye(!1),Ge(!1),Ke(null),jt(!1),xe&&at(!1)),(async()=>{if(t.kind==="dashboard"){Un();return}if(t.kind==="groups"){Kn();return}if(t.kind==="new-session"){cn();return}if(t.kind==="group"){const he=t.discussionId,L=await xt({action:"group",groupId:t.groupId});ki(me=>({...me,[L.id]:he})),xn(L);return}if(t.kind==="session"){const he=vt.current,L=he==null?void 0:he.get(t.session.id),me=L?An(L):void 0;me&&(t={...t,session:{...t.session,...me}})}const b=t.kind==="agent"?t.agentType:t.session.agentType,x=je.some(he=>he.agentType===b)?je:await window.agentApi.getRuntimeHealth();if(a.signal.aborted)return;x!==je&&ke(x);const I=mr(b,x);if(I)throw new Error(I);if(t.kind==="agent"){Ot(t.agentType),Ye(!1),Ge(!1),Ke(null),K(""),re(!1),it==="focus"&&en("standard"),Ut&&jn(),xe&&at(!0);return}const N=l.current.agents[t.session.agentType],H=N?{workspaces:N.workspaces,sessions:Object.values(N.sessions).flatMap(he=>he.data)}:void 0,Q=Ze.current!==t.session.id&&Kt.getState().getMessagesForSession(t.session.id).length>0?Ic(t.session,H):void 0;if(Q){Xt(void 0),rt.current={controller:a,sessionId:Q.session.id},os(Q.session,Q.snapshot,!0),Tt(null);return}const pe=await Tc(window.agentApi,t.session,a.signal,H);a.signal.aborted||(Xt(pe.initialHistory),os(pe.session,pe.snapshot,!0),rt.current={controller:a,sessionId:pe.session.id,seed:pe.initialHistory})})().catch(b=>{a.signal.aborted||b instanceof Error&&b.name==="AbortError"||(fe(b instanceof Error?b.message:"打开会话失败"),Le("error"),setTimeout(()=>fe(null),5e3))}).finally(()=>{var b;_e.current===a&&((b=rt.current)==null?void 0:b.controller)!==a&&(_e.current=null,Tt(null))})},r.useEffect(()=>{document.body.dataset.agentroamChatNavigation="ready";const t=I=>{const N=Tr({data:{type:un,intent:I.detail},origin:window.location.origin,source:window},window.location.origin,window);N&&Xe.current(N)},a=I=>{const N=Tr(I,window.location.origin,window.parent!==window?window.parent:null);N&&Xe.current(N)};window.addEventListener(un,t),window.addEventListener("message",a),window.parent!==window&&window.parent.postMessage({type:So,instanceId:ji.current},window.location.origin);const p=new URLSearchParams(location.search),b=p.get("session"),x=p.get("agent");return b?window.agentApi.getSession(b,b.startsWith("runtime:codex:")?{limit:1,view:"core"}:{limit:1}).then(I=>{const N=I;N.id&&fn(N.agentType)&&Xe.current({kind:"session",session:N})}).catch(I=>{fe(I instanceof Error?I.message:"原会话不可访问"),Le("error")}):p.get("newSession")==="1"?cn():fn(x)&&Xe.current({kind:"agent",agentType:x}),()=>{var I;delete document.body.dataset.agentroamChatNavigation,(I=_e.current)==null||I.abort(),window.removeEventListener(un,t),window.removeEventListener("message",a)}},[]);const[tr,nr]=r.useState([]),Cn=r.useCallback(t=>{nr(a=>a.filter(p=>p.id!==t))},[]),cs=r.useCallback(t=>{const a=crypto.randomUUID();nr(p=>[...p,{...t,id:a}]),setTimeout(()=>Cn(a),12e3)},[Cn]);async function tt(t=f.current,a={}){if(!window.agentApi)return;const p=(Ne.current.get(t)??0)+1;Ne.current.set(t,p),v(!0),Z(null);try{const b=await window.agentApi.listAgentWorkspaces(t,{cursor:a.cursor,limit:50,refresh:a.refresh,since:a.refresh?a.since??C:null});if(f.current!==t||Ne.current.get(t)!==p)return;const x=ht.current.map((L,me)=>({agentType:t,workspaceId:L.id,name:L.name,roots:L.description?[L.description]:[],order:me,updatedAt:L.updated,source:L.source??(t==="claude-code"?"derived":"native"),canCreateSession:L.canCreateSession})),N=Ya(x,b,!a.cursor,Ze.current?Ue.current:null).map(ks);ht.current=N,u(N),A(b.nextCursor),w(b.watermark),P(b.stale===!0);const H=new Set(N.map(L=>L.id)),Q=Ue.current;Q&&!H.has(Q)&&De(ys);const pe=new Set([...gt.current].filter(L=>H.has(L)));if(Q&&H.has(Q)&&pe.add(Q),$(L=>Object.fromEntries(Object.entries(L).filter(([me])=>H.has(me)))),Mt(L=>{const me=new Set([...L].filter(oe=>H.has(oe)));return gt.current=me,me}),g(L=>{const me=new Set([...L].filter(oe=>H.has(oe)));return He.current=me,me}),j(L=>Object.fromEntries(Object.entries(L).filter(([me])=>H.has(me)))),Je)return;const he=new Set;if(await Promise.all(N.map(async L=>{L.description&&!await window.agentApi.checkProjectPath(L.description)&&he.add(L.id)})),f.current!==t||Ne.current.get(t)!==p)return;if(Rs(he),a.refreshLoadedSessions!==!1&&!Je)for(const L of pe)he.has(L)||He.current.has(L)||Be(L,{refresh:!0,background:!0})}catch(b){if(f.current!==t||Ne.current.get(t)!==p)return;ht.current.length>0&&P(!0),Z(b instanceof Error?b.message:"目录加载失败")}finally{f.current===t&&Ne.current.get(t)===p&&v(!1)}}async function Be(t,a={}){var N;const p=window.agentApi;if(!p||Xa((N=l.current.agents[f.current])==null?void 0:N.workspaces.find(H=>H.workspaceId===t))||!a.force&&(a.cursor||a.background)&&He.current.has(t))return;const b=f.current,x=`${b}:${t}`,I=(J.current.get(x)??0)+1;J.current.set(x,I),g(H=>{const Q=new Set(H).add(t);return He.current=Q,Q}),j(H=>{if(!(t in H))return H;const Q={...H};return delete Q[t],Q});try{const H=await p.listAgentWorkspaceSessions(b,t,{cursor:a.cursor,limit:20,refresh:a.refresh});if(f.current!==b||J.current.get(x)!==I)return;const Q=Me.current[t]??[],pe=a.pendingSession?{...a.pendingSession,projectId:t}:void 0,he=pe?[pe,...Q.filter(oe=>oe.id!==pe.id)]:Q,L=jr(he,Qe.current),me=oe=>{var fr,hr,gr;if(f.current!==b||J.current.get(x)!==I)return;const ct=Ja(L,oe,!a.cursor,Ue.current===t?Ze.current:null).map(be=>({...be,projectId:be.projectId??t})),fs=Cs(ct.filter(be=>!be.parentSessionId),b),In=Ue.current,ln=Ze.current,ur=Qa(fs,pe);In===t&&ln&&((fr=st.current)==null?void 0:fr.id)!==ln&&!((hr=vt.current)!=null&&hr.has(ln))&&!ct.some(be=>be.id===ln)&&!ur.some(be=>be.id===ln)&&De(ys);const dn={};for(const be of ct.filter(Fe=>Fe.parentSessionId))(dn[gr=be.parentSessionId]??(dn[gr]=[])).push(be);for(const be of Object.values(dn))be.sort((Fe,la)=>Fe.created.localeCompare(la.created));q(be=>({...be,[t]:Za(L,oe,!a.cursor,be[t])})),E(be=>{const Fe=new Set(be);return oe.stale?Fe.add(t):Fe.delete(t),Fe});const pr={...Me.current,[t]:ur},Tn={...Qe.current};for(const be of L)delete Tn[be.id];for(const[be,Fe]of Object.entries(dn))Tn[be]=Fe;Me.current=pr,Qe.current=Tn,$(pr),Ve(Tn),Mt(be=>{const Fe=new Set(be).add(t);return gt.current=Fe,Fe})};if(me(H),a.refresh&&!a.cursor){const oe=await eo(L,H,ct=>p.listAgentWorkspaceSessions(b,t,{cursor:ct,limit:200,refresh:!1}),pe==null?void 0:pe.id);oe!==H&&me(oe)}}catch(H){if(J.current.get(x)!==I)return;E(Q=>new Set(Q).add(t)),j(Q=>({...Q,[t]:H instanceof Error?H.message:"会话加载失败"}))}finally{J.current.get(x)===I&&g(H=>{const Q=new Set(H);return Q.delete(t),He.current=Q,Q})}}const ea=async t=>{if(!window.agentApi)return;const a=await window.agentApi.listChildSessions(t);Ve(p=>({...p,[t]:a.sort((b,x)=>b.created<x.created?-1:1)}))},ls=bi&&!$t&&!Ht&&!It&&!Ct&&!$e,ta=(t,a)=>{const p=ht.current.find(b=>b.id===t);if(!(!p||p.canCreateSession===!1)){if(ls){ds(a,p.description||void 0);return}cn(a,t)}},ds=(t=f.current,a=Vt||void 0)=>{to({agentType:t,workspacePath:a}).catch(p=>{fe(p instanceof Error?p.message:"无法打开新会话窗口,请重试"),Le("error")})},sr=()=>{ls?ds():ei({kind:"new-session"})};r.useEffect(()=>{var t;window.agentApi&&(tt(f.current,{refresh:(((t=l.current.agents[f.current])==null?void 0:t.workspaces.length)??0)>0}),Va.getState().loadFromSystem())},[]),r.useEffect(()=>{let t=!1,a;const p=async()=>{try{if(!wt())return;const b=await window.agentApi.getRuntimeHealth();t||ke(b)}catch{}finally{t||(a=window.setTimeout(p,3e4))}};return window.agentApi&&p(),()=>{t=!0,window.clearTimeout(a)}},[]),r.useEffect(()=>{if(!je.length||Ze.current||!mr(f.current,je))return;const[t]=Ur(je);t&&Ot(t)},[je]),r.useEffect(()=>{if(Je)return;const t=window.setInterval(()=>{!wt()||k||tt(h,{refresh:!0,since:C,refreshLoadedSessions:!1})},15e3);return()=>window.clearInterval(t)},[h,Je,k,C]),r.useEffect(()=>{if(!window.agentApi||Je)return;let t=!1;const a=()=>{if(t||!wt())return;const I=fl(U,ut),N=hl(I,ss.current,He.current);for(const H of N)Be(H,{refresh:!0,background:gt.current.has(H)})},p=()=>{wt()&&a()};xe&&Pt&&a();const b=window.setInterval(a,1e4);window.addEventListener("focus",a),window.addEventListener("pageshow",a),document.addEventListener("visibilitychange",p);const x=we&&window.parent!==window?window.parent:null;return x==null||x.addEventListener("focus",a),x==null||x.addEventListener("pageshow",a),()=>{t=!0,window.clearInterval(b),window.removeEventListener("focus",a),window.removeEventListener("pageshow",a),document.removeEventListener("visibilitychange",p),x==null||x.removeEventListener("focus",a),x==null||x.removeEventListener("pageshow",a)}},[h,Je,ut,U,xe,Pt,we]),r.useEffect(()=>{if(!U||!window.agentApi)return;const t=d.find(p=>p.id===U),a=t==null?void 0:t.description;a&&window.agentApi.setProjectWorkingDir(a)},[U,d]);const na=t=>{De(En(t));const a=!ut.has(t);if(kt(p=>{const b=new Set(p);return a?b.add(t):b.delete(t),b}),a){const p=gt.current.has(t);Be(t,{refresh:!0,background:p,force:!0})}},rr=async t=>{if(!window.agentApi)throw new Error("agentApi 未就绪,请重启应用");const a=t.replace(/\\/g,"/"),p=a.split("/").filter(Boolean),b=p[p.length-1]||a||"导入的项目",x=await window.agentApi.importAgentWorkspace(f.current,a,b);await tt(f.current,{refresh:!0,refreshLoadedSessions:!1}),De(En(x.workspace.workspaceId)),await Be(x.workspace.workspaceId,{refresh:!0}),kt(I=>{const N=new Set(I);return N.add(x.workspace.workspaceId),N}),fe(x.existing?"该文件夹已在当前 Agent 的目录中":`已导入:${x.workspace.name}`),Le(x.existing?"info":"success"),setTimeout(()=>fe(null),3e3)},ir=async()=>{try{if(!window.agentApi){fe("agentApi 未就绪,请重启应用"),Le("error");return}if(we){se(!0);return}const t=await window.agentApi.openFileDialog();if(console.log("[import] selectedPath:",t),!t)return;await rr(t)}catch(t){console.error("[import] error:",t),fe(t instanceof Error?t.message:String(t)),Le("error"),setTimeout(()=>fe(null),5e3)}},sa=async t=>{if(window.agentApi)try{await window.agentApi.deleteProject(t),U===t&&(Pe(null),ne(null),Fs([])),fe("项目删除成功"),Le("success"),setTimeout(()=>fe(null),2500),await tt()}catch(a){fe(a instanceof Error?a.message:"项目删除失败"),Le("error"),setTimeout(()=>fe(null),4e3)}},ra=(t,a,p)=>{var I;const b=(I=window.agentApi)==null?void 0:I.showDirectoryContextMenu,x=dl(a,{isInvalid:p,supported:typeof b=="function",webShell:we});!x||!b||(t.preventDefault(),b(x).catch(N=>{fe(N instanceof Error?N.message:"无法打开当前文件夹"),Le("error"),setTimeout(()=>fe(null),4e3)}))},us=(t,a)=>{D({session:t,anchor:a})},ia=(t,a)=>{const p=a.getBoundingClientRect();R({project:t,agentType:f.current,anchor:{top:p.top,left:p.left,width:p.width,height:p.height}})},aa=async()=>{if(!window.agentApi||!F||ue)return;const{project:t,agentType:a}=F;V(!0);try{await window.agentApi.removeInvalidAgentWorkspace(a,t.id),f.current===a&&Ue.current===t.id&&De(ys),fe(`已移除失效目录「${t.name}」`),Le("success"),setTimeout(()=>fe(null),2500),f.current===a&&await tt(a,{refresh:!0})}catch(p){fe(p instanceof Error?p.message:"目录删除失败"),Le("error"),setTimeout(()=>fe(null),4e3)}finally{V(!1),R(null)}},oa=async()=>{if(!window.agentApi||!ve||G)return;const{session:t}=ve;X(!0);try{await window.agentApi.deleteSession(t.id);const a=t.projectId??Ue.current,p=t.agentType;if(a){const I=`${p}:${a}`;J.current.set(I,(J.current.get(I)??0)+1)}const b=Wc(Me.current,Qe.current,[],t.id);nt(I=>[...new Set([...I,...b.removedIds])]),Jo(b.removedIds),Me.current=b.sessionsByProject,Qe.current=b.childSessionsByParent,$(b.sessionsByProject),Ve(b.childSessionsByParent),Pi(b.removedIds);const x=l.current.agents[p];if(x){const I={...l.current,agents:{...l.current.agents,[p]:zc(x,b.removedIds)}};l.current=I,Sr(I)}Ze.current&&b.removedIds.includes(Ze.current)&&De({projectId:Ue.current,sessionId:null}),fe("会话删除成功"),Le("success"),setTimeout(()=>fe(null),2500),D(null),Ie(I=>I+1),a&&p===f.current&&Be(a,{refresh:!0,background:!0})}catch(a){fe(a instanceof Error?a.message:"会话删除失败"),Le("error"),setTimeout(()=>fe(null),4e3)}finally{X(!1)}},ca=[{id:"settings",label:"设置"},{id:"mcp",label:"MCP"},{id:"memory",label:"记忆"},{id:"skill",label:"技能"},{id:"agent",label:"智能体"},{id:"lsp",label:"LSP"}],ps=(t,a)=>{const p=ee===t.id,b=Dn(nn(t,a)),x=Te[t.id]??[],I=!!t.parentSessionId,N=$n.expandedIds.has(t.id);return e.jsxs("div",{className:"sidebar-session-tree",children:[e.jsx(On,{session:{id:t.id,title:t.title,visualState:b,statusLabel:Rn[b],completedAt:Ln(t),occupiedExternally:t.agentType!=="codex"&&t.occupancy==="owned-externally",canDelete:t.canDelete,active:p,child:I,expanded:N,compatibility:t.compatibility,pinned:tn.has(t.id)},onSelect:()=>{xe&&at(!1),De(Rr(a,t.id))},onToggleChildren:x.length?()=>$n.toggle(t.id):void 0,onPin:I?void 0:()=>Yn(t.id),deleteLabel:I?"删除子会话":void 0,onDelete:H=>us(t,H)}),N&&x.length>0&&e.jsx("div",{className:"sidebar-session-children",role:"group","aria-label":`${t.title}的子会话`,children:x.map(H=>ps(H,a))})]},t.id)},ar=({session:t,children:a})=>{const p=Dn(nn(t)),b=Hn.expandedIds.has(t.id);return e.jsxs("div",{children:[e.jsx(On,{session:{id:t.id,title:t.title,visualState:p,statusLabel:Rn[p],completedAt:Ln(t),occupiedExternally:t.agentType!=="codex"&&t.occupancy==="owned-externally",canDelete:t.canDelete,active:ee===t.id,child:!!t.parentSessionId,expanded:b,compatibility:t.compatibility,pinned:tn.has(t.id)},onSelect:()=>{const x=t.projectId&&d.some(I=>I.id===t.projectId)?t.projectId:null;De(Rr(x,t.id)),re(!1),xe&&at(!1)},onPin:t.parentSessionId?void 0:()=>Yn(t.id),onToggleChildren:a.length?()=>Hn.toggle(t.id):void 0,onDelete:x=>us(t,x)}),b&&a.length>0&&e.jsx("div",{className:"sidebar-session-children",role:"group","aria-label":`${t.title}的子会话`,children:a.map(ar)})]},t.id)};return e.jsxs("div",{className:`app-shell${_t?" is-sidebar-collapsed":""}${as?" is-sidebar-dragging":""}${Vn?" has-workspace-tabs":""}`,"data-desktop-platform":!we&&/Mac/.test(navigator.platform)?"darwin":void 0,style:{display:"flex",height:we?"100dvh":"100vh",width:"100vw",background:"var(--bg-deepest)",position:"relative",overflow:"hidden",boxSizing:"border-box",paddingTop:Vn?52:0},children:[e.jsx(Rc,{}),e.jsx(jc,{onOpen:Un}),Ci&&qe.createPortal(e.jsx(lo,{cwd:Vt||void 0,health:je,onClose:()=>Gn(!1),onCreated:t=>{Gn(!1),Bs(a=>a+1),xn(t)}}),document.body),Vn&&e.jsx(Ac,{groups:Ms,dashboardVisible:Ws,sessionDashboardVisible:$s,activeId:It?"sessions":Ct?"dashboard":$e??"assistant",onSelect:t=>{Ye(t==="sessions"),Ge(t==="dashboard"),Ke(["assistant","dashboard","sessions"].includes(t)?null:t)},onClose:t=>{t==="sessions"?(bn(!1),Ye(!1)):t==="dashboard"?(qn(!1),Ge(!1)):(Fn(a=>a.filter(p=>p.id!==t)),$e===t&&Ke(null))}}),($e||Ct||It)&&e.jsx("div",{className:"collab-desktop-overlay",children:e.jsx("div",{className:"collab-desktop-body",children:e.jsx(r.Suspense,{fallback:e.jsx(zt,{label:"正在打开工作区"}),children:It?e.jsx(bl,{onNewSession:sr,onOpenGroup:t=>Xe.current({kind:"group",groupId:t.group.id,title:t.group.name,discussionId:t.discussionId}),onOpenSession:t=>Xe.current({kind:"session",session:t}),onViewAgent:t=>Xe.current({kind:"agent",agentType:t}),onViewGroups:Kn,onClose:()=>{Ye(!1),bn(!1)}}):Ct?e.jsx(wl,{cwd:Vt||void 0,onOpen:xn,onClose:()=>{Ge(!1),qn(!1)},onChanged:(t,a)=>{Bs(p=>p+1),Fn(p=>a?p.map(b=>b.id===t?a:b):p.filter(b=>b.id!==t)),!a&&$e===t&&Ke(null)}}):$e&&e.jsx(xl,{groupId:$e,initialDiscussionId:vi[$e]},`${$e}-${Hs}`)})})}),e.jsx(Lc,{}),!xe&&e.jsx(sl,{hidden:!_t,value:h,health:je,selectedSessionId:ee,getActivity:nn,onChange:Ot,onSelect:os,onNewSession:t=>{ls?ds(t):cn(t)}}),xe&&Pt&&e.jsx("div",{className:"mobile-drawer-scrim",onClick:()=>at(!1),style:{position:"fixed",inset:0,background:"rgba(0,0,0,.45)",zIndex:1150}}),xe&&!Pt&&e.jsx("button",{className:"mobile-drawer-toggle",onClick:()=>at(!0),"aria-label":"会话列表","aria-expanded":!1,style:{position:"fixed",top:"calc(env(safe-area-inset-top) + 8px)",left:10,zIndex:1250,width:34,height:34,borderRadius:9,border:"1px solid var(--border-default)",background:"var(--bg-glass, rgba(18,20,28,.82))",color:"var(--text-secondary)",display:"grid",placeItems:"center",backdropFilter:"blur(8px)",WebkitAppRegion:"no-drag",cursor:"pointer"},children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:e.jsx("path",{d:"M3 6h18M3 12h18M3 18h18"})})}),e.jsx("div",{className:"app-accent-glow",style:{position:"absolute",top:"-120px",left:"-80px",width:320,height:320,borderRadius:"50%",background:"radial-gradient(circle, var(--accent-glow) 0%, transparent 70%)",pointerEvents:"none",zIndex:0}}),it!=="focus"&&e.jsxs(e.Fragment,{children:[e.jsxs("aside",{className:`app-sidebar${Bt==="agent-rail"?" has-agent-navigation":""}${Je?" has-all-sessions":""}`,id:"workspace-sidebar","aria-hidden":_t||xe&&!Pt,ref:t=>{t&&(t.inert=_t||xe&&!Pt)},style:{width:Sn,flexShrink:0,marginLeft:_t?-Sn:0,display:"flex",flexDirection:"column",background:"var(--bg-surface)",borderRight:"1px solid var(--border-subtle)",padding:we?"12px 0 0":"56px 0 0",position:"relative",zIndex:10,overflow:"hidden",...xe?{position:"fixed",top:0,bottom:0,left:0,width:"min(82vw, 320px)",zIndex:1200,transform:Pt?"translateX(0)":"translateX(-103%)",transition:"transform .24s ease",boxShadow:"12px 0 32px rgba(0,0,0,.5)",padding:"calc(env(safe-area-inset-top) + 12px) 0 0"}:{}},children:[!we&&e.jsx("div",{className:"sidebar-window-drag-region","aria-hidden":"true"}),Bt==="agent-rail"?e.jsx(tl,{value:h,health:je,onClose:()=>{xe?at(!1):jn()}}):e.jsx("div",{className:"app-sidebar-brand",style:{padding:"0 20px 10px"},children:e.jsxs("div",{className:"sidebar-brand-row",children:[e.jsx("div",{className:"sidebar-brand-mark","aria-hidden":"true",children:e.jsx(Yt,{agentType:"customer-agent",size:24})}),e.jsx("span",{className:"sidebar-brand-name",children:"AgentRoam"}),e.jsxs("div",{className:"sidebar-brand-actions",children:[e.jsx(pi,{}),!we&&Bt==="classic"&&e.jsx(zr,{onOpenCalendar:Bn})]})]})}),Je?e.jsx(vc,{deletedSessionIds:Y,selectedSessionId:ee,pendingSession:ye,runningSessionId:Xn,needsInput:Jn,pinnedIds:qs,revision:ze,onSelect:t=>Xe.current({kind:"session",session:t}),onPin:Yn,onDelete:us}):e.jsxs(e.Fragment,{children:[e.jsx(Kr,{vertical:Bt==="agent-rail",value:h,health:je,onChange:Ot}),e.jsxs("button",{type:"button",className:"sidebar-search-field",onClick:()=>{Hn.collapseAll(),re(!0),Ee(10)},title:"搜索会话","aria-label":"搜索会话",children:[e.jsx(Wn,{size:15,"aria-hidden":"true"}),e.jsx("span",{children:"搜索会话"}),e.jsx("kbd",{children:"⌘ K"})]}),e.jsxs("div",{className:"sidebar-project-toolbar",children:[e.jsxs("div",{className:"sidebar-project-heading",children:[e.jsx("span",{className:"sidebar-project-title",children:"目录"}),e.jsx("span",{className:"sidebar-project-count","aria-label":`${d.length} 个目录`,children:d.length})]}),e.jsxs("div",{className:"sidebar-project-actions",children:[e.jsx("button",{type:"button",onClick:t=>{Dt?Li():Ri(),qr(t,Dt)},title:Dt?"展开全部目录":"折叠全部目录","aria-label":Dt?"展开全部目录":"折叠全部目录","aria-pressed":Dt,disabled:is.length===0,className:`ui-icon-button sidebar-collapse-all${Dt?" is-active":""}`,children:e.jsx("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:Dt?e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"m7 6 5 5 5-5"}),e.jsx("path",{d:"m7 13 5 5 5-5"})]}):e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"m17 11-5-5-5 5"}),e.jsx("path",{d:"m17 18-5-5-5 5"})]})})}),e.jsx("button",{type:"button",onClick:t=>{Ni(!pt),qr(t,pt)},title:pt?"按新建时间排序":"进行中会话优先","aria-label":pt?"按新建时间排序":"进行中会话优先","aria-pressed":pt,className:`ui-icon-button sidebar-session-sort${pt?" is-active":""}`,children:e.jsxs("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"M3 6h10M3 12h7M3 18h4"}),e.jsx("path",{d:"m15 9 3-3 3 3M18 6v12"})]})}),e.jsx(li,{loading:k,error:d.length>0?null:B,onRefresh:()=>void tt(h,{refresh:!0})}),e.jsx("button",{type:"button",onClick:()=>void ir(),title:"导入目录","aria-label":"导入目录",className:"ui-icon-button",children:e.jsx("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("path",{d:"M12 5v14M5 12h14"})})})]})]}),e.jsx("div",{ref:rn,className:"app-sidebar-scroll",onPointerDownCapture:Pl,onScroll:t=>{const a=t.currentTarget;if(a.scrollHeight-a.scrollTop-a.clientHeight<120&&y&&!k&&tt(h,{cursor:y}),xe){const b=a.getBoundingClientRect(),x=a.querySelectorAll("[data-sidebar-project-id]");for(const I of x){const N=I.dataset.sidebarProjectId;if(!N||!ut.has(N))continue;const H=I.getBoundingClientRect();if(H.bottom<b.top||H.bottom>b.bottom+120)continue;const Q=z[N];Q&&!He.current.has(N)&&Be(N,{cursor:Q})}}},style:{minHeight:0,flex:1,overflow:"auto",padding:"0 10px"},children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2,marginBottom:12},children:[er.length>0&&e.jsxs("section",{className:"sidebar-pinned-section","aria-label":"置顶会话",children:[e.jsx("div",{className:"sidebar-pinned-heading",children:"置顶"}),er.map(({projectId:t,session:a})=>ps(a,t))]}),Xi.map(t=>{var me;const a=U===t.id&&ee===null,p=ut.has(t.id),b=dt.has(t.id),x=Wt.has(t.id),I=S[t.id],N=Gi[t.id]??[],H=N.filter(oe=>!tn.has(oe.id)),pe=pt?Is(H,Vs):H,he=pe.length>10,L=St.has(t.id);return e.jsxs("div",{className:"sidebar-project-block","data-sidebar-project-id":t.id,"aria-busy":x,children:[e.jsxs("div",{className:`sidebar-row sidebar-project-row${L?" sidebar-project-row--invalid":""} ${a&&!L?"sidebar-row-active":""}`,onContextMenu:oe=>ra(oe,t,L),style:{paddingRight:4},children:[e.jsxs("button",{className:"sidebar-project-button",onClick:()=>{L||na(t.id)},disabled:L,"aria-expanded":p,"aria-pressed":a,title:L?`路径不存在:${t.description}`:t.name,style:{flex:1,display:"flex",alignItems:"center",gap:8,minWidth:0,padding:"8px 10px",border:"none",background:"transparent",color:L?"var(--text-muted)":a?"var(--accent)":"var(--text-secondary)",fontSize:13,fontWeight:a&&!L?600:400,cursor:L?"not-allowed":"pointer",textAlign:"left",transition:"color 0.15s"},children:[L?e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0,opacity:.6},children:[e.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),e.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),e.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}):t.canCreateSession===!1?e.jsx(Ro,{size:13,"aria-hidden":"true",style:{flexShrink:0,opacity:a?1:.5}}):e.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0,opacity:a?1:.5},children:p?e.jsx("path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6A2 2 0 0 1 18.46 20H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2"}):e.jsx("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})}),e.jsx("span",{style:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:t.name})]}),h==="customer-agent"&&!we&&!L&&t.canCreateSession!==!1?e.jsx("button",{onClick:oe=>{oe.stopPropagation(),sa(t.id)},title:"删除目录","aria-label":`删除目录:${t.name}`,className:"sidebar-project-delete sidebar-row-action ui-icon-button ui-icon-button--small ui-icon-button--danger",style:{flexShrink:0},children:e.jsx(Fr,{})}):L?e.jsx("button",{onClick:oe=>{oe.stopPropagation(),ia(t,oe.currentTarget)},title:"删除失效目录","aria-label":`删除失效目录:${t.name}`,className:"sidebar-project-delete sidebar-row-action ui-icon-button ui-icon-button--small ui-icon-button--danger",style:{flexShrink:0},children:e.jsx(Fr,{})}):null,!L&&t.canCreateSession!==!1&&e.jsx("button",{type:"button",onClick:oe=>{oe.stopPropagation(),ta(t.id,h)},title:`在 ${t.name} 中新建会话`,"aria-label":`在 ${t.name} 中新建会话`,disabled:L||((me=je.find(oe=>oe.agentType===h))==null?void 0:me.available)===!1,className:"sidebar-runtime-create sidebar-project-add-action ui-icon-button ui-icon-button--small",children:e.jsx(Nn,{size:13,"aria-hidden":"true"})})]}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gridTemplateRows:p?"minmax(0, 1fr)":"minmax(0, 0fr)",overflow:"clip",opacity:p?1:0,transition:"grid-template-rows 0.45s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease"},children:e.jsxs("div",{className:"sidebar-project-sessions",onScroll:oe=>{const ct=oe.currentTarget,fs=ct.scrollHeight-ct.scrollTop-ct.clientHeight<80,In=z[t.id];fs&&In&&!x&&Be(t.id,{cursor:In})},style:{display:"flex",flexDirection:"column",minHeight:0,gap:1,marginTop:2,paddingLeft:10,paddingBottom:4,...he&&!xe?{maxHeight:280,overflowY:"auto"}:{}},children:[pe.map(oe=>ps(oe,t.id)),x&&!b&&e.jsx("div",{style:{color:"var(--text-muted)",fontSize:11,padding:"4px 10px",opacity:.7},children:"正在加载会话..."}),I&&!z[t.id]&&e.jsxs("div",{title:I,style:{display:"flex",alignItems:"center",gap:8,color:"var(--danger)",fontSize:11,padding:"4px 10px"},children:[e.jsx("span",{style:{flex:1},children:"会话加载失败"}),e.jsx("button",{type:"button",onClick:()=>void Be(t.id,{refresh:b,background:b}),style:{border:0,background:"transparent",color:"inherit",fontSize:11,cursor:"pointer",padding:0},children:"重试"})]}),T.has(t.id)&&!I&&e.jsx("div",{className:"sidebar-cache-state",children:"显示缓存,会话将在下次刷新时更新"}),N.length===0&&b&&!x&&!I&&e.jsx("div",{style:{color:"var(--text-muted)",fontSize:11,padding:"4px 10px",opacity:.7},children:"暂无会话"}),e.jsx(kc,{cursor:z[t.id]??null,expanded:p&&b&&!L,loading:x,error:I,nestedScroll:he&&!xe,projectName:t.name,onLoadMore:()=>{const oe=z[t.id];oe&&Be(t.id,{cursor:oe})}})]})})]},t.id)}),d.length===0&&k&&e.jsx("div",{className:"sidebar-directory-skeleton","aria-hidden":"true",children:[0,1,2].map(t=>e.jsxs("div",{children:[e.jsx("span",{}),e.jsx("span",{})]},t))}),d.length===0&&!k&&!B&&e.jsx("div",{style:{color:"var(--text-muted)",fontSize:12,padding:"24px 10px",textAlign:"center",opacity:.7},children:"暂无目录"}),B&&d.length>0&&e.jsxs("div",{className:"sidebar-cache-state sidebar-cache-state--action",role:"status",title:B,children:[e.jsx("span",{children:"当前显示缓存目录"}),!k&&e.jsx("button",{type:"button",onClick:()=>void tt(h,{refresh:!0}),children:"重试"})]}),_&&!B&&e.jsx("div",{className:"sidebar-cache-state",children:"当前显示缓存目录"}),B&&d.length===0&&e.jsxs("div",{className:"sidebar-load-error",title:B,children:[e.jsx("span",{children:"目录加载失败"}),e.jsx("button",{type:"button",onClick:()=>void tt(h,{refresh:!1}),children:"重试"})]})]})})]}),e.jsxs("div",{className:"sidebar-bottom-action",children:[!Je&&e.jsx(Sc,{refreshKey:Hs,onOpen:xn}),e.jsxs("button",{type:"button",className:"sidebar-new-session-primary",title:"新建会话",onClick:sr,children:[e.jsx(Nn,{size:16,"aria-hidden":"true"}),e.jsx("span",{children:"新建会话"})]})]})]}),ve&&e.jsx(Wr,{message:Oc(ve.session),anchor:ve.anchor,mobile:xe,pending:G,onCancel:()=>D(null),onConfirm:()=>void oa()}),F&&e.jsx(Wr,{title:"删除失效目录",message:`目录「${F.project.name}」的路径(${F.project.description||"未知"})已不存在。确定从目录列表移除?历史会话记录会保留。`,anchor:F.anchor,mobile:xe,pending:ue,onCancel:()=>R(null),onConfirm:()=>void aa()}),!xe&&e.jsx("div",{className:`app-sidebar-resizer${as?" is-dragging":""}`,...Ji,role:"separator","aria-label":"调整目录与会话列表宽度","aria-controls":"workspace-sidebar","aria-orientation":"vertical","aria-valuemin":220,"aria-valuemax":480,"aria-valuenow":Sn,tabIndex:Ut?-1:0,hidden:Ut&&!as,style:{left:Ut?0:Sn}}),le&&e.jsx("div",{onClick:()=>re(!1),style:{position:"fixed",inset:0,zIndex:1300,background:"rgba(17,24,39,0.34)",backdropFilter:"blur(2px)",WebkitBackdropFilter:"blur(2px)",display:"flex",alignItems:"flex-start",justifyContent:"center",padding:"12vh 16px 16px"},children:e.jsxs("div",{onClick:t=>t.stopPropagation(),style:{width:"min(560px, 100%)",maxHeight:"64vh",display:"flex",flexDirection:"column",borderRadius:12,border:"1px solid var(--border-default)",background:"var(--bg-surface)",boxShadow:"0 18px 48px rgba(17,24,39,0.28)",overflow:"hidden"},children:[e.jsx("div",{style:{padding:10,borderBottom:"1px solid var(--border-subtle)"},children:e.jsx("input",{autoFocus:!0,value:M,onChange:t=>K(t.target.value),onKeyDown:t=>{t.key==="Escape"&&re(!1)},placeholder:"搜索所有会话(标题或目录)…","aria-label":"搜索所有会话",style:{width:"100%",padding:"9px 12px",borderRadius:8,border:"1px solid var(--border-default)",background:"var(--bg-glass)",color:"var(--text-primary)",fontSize:14,outline:"none",fontFamily:"var(--font-body)",boxSizing:"border-box"}})}),e.jsxs("div",{style:{overflowY:"auto",padding:8},children:[Ae&&e.jsx("div",{role:"status",children:"正在加载所有会话"}),O&&e.jsx("div",{role:"alert",children:O}),mt&&an&&an.length>0&&e.jsxs("div",{style:{padding:"4px 10px 3px",fontSize:9,fontWeight:700,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-muted)"},children:[an.length," 个结果"]}),!Ae&&!O&&mt&&on.length===0&&e.jsx("div",{style:{color:"var(--text-muted)",fontSize:12,padding:"16px 10px",textAlign:"center",opacity:.7},children:"无匹配会话"}),!Ae&&!O&&!mt&&on.length===0&&e.jsx("div",{style:{color:"var(--text-muted)",fontSize:12,padding:"16px 10px",textAlign:"center",opacity:.7},children:"暂无会话"}),(mt?on:on.slice(0,Se)).map(ar),!mt&&on.length>Se&&e.jsx("button",{type:"button",onClick:()=>Ee(t=>t+10),style:{width:"100%",padding:"8px 10px",border:0,borderTop:"1px solid var(--border-subtle)",background:"transparent",color:"var(--text-muted)",fontSize:12,cursor:"pointer",textAlign:"center"},children:"更多…"})]})]})})]}),e.jsx(il,{message:Qi,type:Zi}),e.jsx(Ua,{viewedSessionId:Ht||$t||It||Ct||$e||Jt?null:ee}),e.jsxs("main",{className:`app-main${ot?" file-workspace-capable":""}${sn&&ot?" file-workspace-open":""}${sn&&ot&&Us?" file-workspace-preview-open":""}`,style:{flex:1,minWidth:0,marginLeft:_t?56:0,overflow:"hidden",background:"var(--bg-workspace)",position:"relative",zIndex:5},children:[e.jsx("div",{className:"app-chat-surface","aria-hidden":Jt?!0:void 0,ref:t=>{t&&(t.inert=!!Jt)},style:{height:"100%",paddingTop:0,display:$t||Ht?"none":void 0,background:"var(--chat-history-bg)"},children:e.jsx(yc,{onSplitChange:xi,enabled:_i||!we&&!ha(),onOpenCalendar:Bn,onFocusSession:t=>{Ze.current=t.id,Ue.current=t.projectId??null,We(t),ne(t.id),Pe(t.projectId??null)},onNavigateSession:t=>Xe.current({kind:"session",session:t}),onSessionCreated:t=>{if(t.projectId&&t.agentType===f.current){const a=t.projectId;$(p=>({...p,[a]:[t,...(p[a]??[]).filter(b=>b.id!==t.id)]}))}Ie(a=>a+1)},children:e.jsx(Ka,{sidebarCollapsed:_t,onToggleSidebar:xe?void 0:()=>{it==="focus"?(en("standard"),Ut&&jn()):jn()},onOpenCollaborationDashboard:we?void 0:Kn,onOpenSessionDashboard:we?void 0:Un,activeAgentType:h,selectedProjectId:U,selectedSessionId:ee,sessionTitle:Yi,sessionSummary:Lt,initialSessionHistory:yi,sessionNavigationPending:!!Jt,onSessionHistorySettled:Si,workspacePath:Vt,workspaceSource:(cr=d.find(t=>t.id===U))==null?void 0:cr.source,runtimeHealth:je,onSelectAgent:cn,workspaces:d.map(t=>({id:t.id,name:t.name,path:t.description,canCreateSession:t.canCreateSession})),onSelectWorkspace:t=>{Qt.current=null,De(En(t)),kt(a=>new Set(a).add(t))},onPickWorkspaceFolder:()=>void ir(),focusComposerNonce:mi,voiceCommand:Hi,onOpenSettings:qi,settingsOpen:Ls,desktopLiveOpen:Ds,fileDrawerOpen:sn,onOpenArtifact:Mi,onToggleFiles:ot?()=>{Qn(t=>!t),Zn("files")}:void 0,onOpenDesktopLive:!we&&((lr=window.agentApi)!=null&&lr.desktopLiveGetStatus)?()=>_s(!0):void 0,onHideToBackground:()=>void Bi(),onOpenHub:(dr=window.agentApi)!=null&&dr.hubGetConfig?()=>{et(!1),jt(!0)}:void 0,headerAppActions:!we&&Bt!=="classic"?e.jsx(zr,{onOpenCalendar:Bn}):void 0,onToggleAppearance:Fi,appearanceOpen:yn,hideToBackgroundTitle:Et?`隐藏到后台(说“${Nt}”唤醒)`:"隐藏到后台",onSessionCreated:(t,a)=>{var b;We(a??null);const p=Ue.current;if(p&&a){const x=`${a.agentType}:${p}`;J.current.set(x,(J.current.get(x)??0)+1),He.current.delete(p),g(new Set(He.current));const I={...Me.current,[p]:[{...a,projectId:p},...(Me.current[p]??[]).filter(N=>N.id!==t)]};Me.current=I,$(I)}De({projectId:p,sessionId:t}),Ie(x=>x+1),ns.current&&(ns.current=!1,qt.current={sessionId:t,until:Date.now()+9e4},(b=window.agentApi)==null||b.wakeConversation(!0)),p&&f.current==="customer-agent"&&Be(p,{pendingSession:a,background:!0})},onSubSessionCreated:async t=>{await ea(t)},onSelectSession:(t,a)=>{a&&We(a),ne(t),mn()},onParallelSessionSelected:t=>{var p;(p=_e.current)==null||p.abort(),_e.current=null,rt.current=null,Tt(null),Xt(void 0),f.current!==t.agentType&&Ot(t.agentType),We(t);const a=t.projectId&&ht.current.some(b=>b.id===t.projectId)?t.projectId:null;De({projectId:a,sessionId:t.id}),Kt.getState().setSessionId(t.id),Ie(b=>b+1)},onSubAgentEvent:t=>{t.type==="started"?cs({type:"info",title:"子会话已启动",body:`${t.agentName}:${t.task.slice(0,60)}`,sessionId:t.subSessionId}):t.type==="completed"?cs({type:"success",title:"子会话已完成",body:`${t.agentName}:${t.task.slice(0,60)}`,sessionId:t.subSessionId}):cs({type:"error",title:"子会话出错",body:`${t.agentName}:${t.task.slice(0,60)}`,sessionId:t.subSessionId})},onMessageSent:(t,a)=>{$(p=>{const b={};for(const[x,I]of Object.entries(p))b[x]=I.map(N=>N.id===t?{...N,title:a.slice(0,60)||N.title}:N);return b})},onRunComplete:async(t,a)=>{var I;const p=qt.current,b=Ga(p,a);qt.current=b,b!==p&&((I=window.agentApi)==null||I.wakeConversation(!0));const x=t||U;x&&await Be(x,{refresh:!0,background:!0})}})})}),Ht&&e.jsx(r.Suspense,{fallback:e.jsx(zt,{label:"正在打开日历"}),children:e.jsx(vl,{loadOverview:kl,onClose:()=>et(!1),initialTaskId:hi,focusKey:gi})}),Jt&&e.jsx(zt,{className:"session-navigation-loading"}),$t&&e.jsx(r.Suspense,{fallback:e.jsx(zt,{label:"正在打开 AI Hub"}),children:e.jsx(yl,{conversationId:ee,onExit:()=>jt(!1)})}),ot&&sn&&e.jsx(r.Suspense,{fallback:e.jsx(zt,{label:"正在打开文件"}),children:e.jsx(El,{open:sn,tab:Oi,gateway:ot,cwd:Vt,selectedPath:Us,revealRequest:zi,onTabChange:Zn,onSelectPath:es,onClose:()=>Qn(!1)})})]}),Ds&&e.jsx(Bc,{onClose:()=>_s(!1)}),Ls&&qe.createPortal(e.jsx("div",{"data-task-page-overlay":"",onClick:()=>wn(!1),style:{position:"fixed",inset:0,zIndex:10001,background:"rgba(17,24,39,0.18)",display:"flex",alignItems:"center",justifyContent:"center",animation:"fadeIn 0.2s var(--ease-out)",WebkitAppRegion:"no-drag"},children:e.jsxs("div",{onClick:t=>t.stopPropagation(),style:{width:"min(920px, calc(100vw - 48px))",height:"min(760px, calc(100vh - 48px))",background:"var(--bg-surface)",border:"1px solid var(--border-default)",borderRadius:"var(--radius-md)",backdropFilter:"blur(14px)",WebkitBackdropFilter:"blur(14px)",boxShadow:"var(--shadow-md)",overflow:"hidden",display:"flex",flexDirection:"column",animation:"fadeInUp 0.25s var(--ease-out)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderBottom:"1px solid var(--border-subtle)",padding:"8px 10px",background:"var(--bg-deepest)"},children:[e.jsx("div",{style:{display:"flex",gap:6},children:ca.map(t=>e.jsx("button",{onClick:()=>Ii(t.id),className:`settings-tab ${At===t.id?"settings-tab-active":""}`,children:t.label},t.id))}),e.jsx("button",{onClick:()=>wn(!1),title:"关闭",className:"ui-icon-button ui-icon-button--close ui-icon-button--danger",children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",children:e.jsx("path",{d:"M18 6 6 18M6 6l12 12"})})})]}),e.jsx("div",{style:{flex:1,overflow:"auto"},children:e.jsxs(r.Suspense,{fallback:e.jsx(zt,{label:"正在打开设置"}),children:[At==="settings"&&e.jsx(Sl,{}),At==="mcp"&&e.jsx(jl,{}),At==="memory"&&e.jsx(Cl,{}),At==="skill"&&e.jsx(Il,{}),At==="agent"&&e.jsx(Tl,{}),At==="lsp"&&e.jsx(Al,{})]})})]})}),document.body),e.jsx("div",{className:"noise-overlay"}),yn&&vn&&qe.createPortal(e.jsx("div",{"data-task-page-overlay":"",onClick:()=>ts(!1),style:{position:"fixed",inset:0,zIndex:1e4,WebkitAppRegion:"no-drag"},children:e.jsxs("div",{onClick:t=>t.stopPropagation(),className:"appearance-panel",style:{position:"absolute",left:Math.max(12,Math.min(vn.right-320,window.innerWidth-332)),top:vn.bottom+8,width:320,maxHeight:`calc(100vh - ${vn.bottom+20}px)`,overflowY:"auto",background:"var(--bg-surface)",border:"1px solid var(--border-default)",borderRadius:"var(--radius-md)",boxShadow:"var(--shadow-md)",padding:"16px",display:"flex",flexDirection:"column",gap:16,animation:"fadeInUp 0.2s var(--ease-out)",backdropFilter:"blur(14px)",WebkitBackdropFilter:"blur(14px)"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:11,fontWeight:600,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.08em",marginBottom:8},children:"皮肤"}),e.jsx("div",{className:"appearance-choices",children:ga.map(t=>e.jsxs("button",{onClick:()=>Ti(t.id),className:`appearance-choice ${Zt===t.id?"appearance-choice-active":""}`,children:[e.jsx("span",{className:"appearance-swatch",style:{background:`linear-gradient(135deg, ${t.preview[0]} 55%, ${t.preview[1]} 55%)`}}),e.jsx("span",{className:"appearance-choice-label",style:{fontWeight:Zt===t.id?600:400},children:t.label}),Zt===t.id&&e.jsx("svg",{className:"appearance-choice-check",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("path",{d:"m5 12 4 4L19 6"})})]},t.id))})]}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:11,fontWeight:600,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.08em",marginBottom:8},children:"布局"}),e.jsx("div",{className:"appearance-segmented",children:ma.map(t=>e.jsx("button",{onClick:()=>en(t.id),title:t.description,className:`appearance-segment ${it===t.id?"appearance-segment-active":""}`,children:t.label},t.id))})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10,borderTop:"1px solid var(--border-subtle)",paddingTop:12},children:[e.jsx("div",{style:{fontSize:11,fontWeight:600,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.08em"},children:"语音"}),e.jsxs("label",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",fontSize:12,color:"var(--text-secondary)",cursor:"pointer"},children:["隐藏后语音唤醒",e.jsx("input",{className:"appearance-switch",type:"checkbox",checked:Et,onChange:t=>Ai(t.target.checked)})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12,color:"var(--text-secondary)"},children:[e.jsx("span",{style:{flexShrink:0},children:"唤醒词"}),e.jsx("input",{value:Nt,onChange:t=>Ei(t.target.value||"小智"),style:{flex:1,padding:"4px 8px",borderRadius:6,border:"1px solid var(--border-default)",background:"var(--bg-deep)",color:"var(--text-primary)",fontSize:12}})]})]})]})}),document.body),e.jsx(Ao,{open:ce,onCancel:()=>se(!1),onConfirm:async t=>{await rr(t),se(!1)}}),e.jsx(Fc,{trigger:Wi,heardText:$i}),Ft.items.length>0&&qe.createPortal(e.jsx(Gc,{items:Ft.items,onDismiss:Ft.consume,onClearAll:Ft.clearAll,onOpen:t=>{Ft.consume(t),window.dispatchEvent(new CustomEvent("agentroam:notification-open",{detail:t}))}}),document.body),tr.length>0&&Ft.items.length===0&&qe.createPortal(e.jsx("div",{style:{position:"fixed",bottom:24,right:24,zIndex:2e4,display:"flex",flexDirection:"column",gap:10,alignItems:"flex-end",pointerEvents:"none"},children:tr.map(t=>e.jsxs("div",{style:{pointerEvents:"auto",width:320,background:"var(--bg-surface)",border:`1px solid ${t.type==="error"?"rgba(220,38,38,0.25)":t.type==="success"?"rgba(5,150,105,0.25)":"var(--border-default)"}`,borderLeft:`3px solid ${t.type==="error"?"var(--danger)":t.type==="success"?"var(--success)":"var(--accent)"}`,borderRadius:"var(--radius-md)",boxShadow:"var(--shadow-md)",padding:"12px 14px",animation:"fadeInUp 0.22s var(--ease-out)",backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:4},children:[e.jsxs("span",{style:{fontSize:12,fontWeight:600,color:t.type==="error"?"var(--danger)":t.type==="success"?"var(--success)":"var(--accent)",display:"flex",alignItems:"center",gap:5},children:[t.type==="error"?"✕":t.type==="success"?"✓":"◎"," ",t.title]}),e.jsx("button",{onClick:()=>Cn(t.id),title:"关闭",style:{background:"none",border:"none",cursor:"pointer",color:"var(--text-muted)",fontSize:14,lineHeight:1,padding:"2px 4px",borderRadius:4,transition:"color 0.15s"},onMouseEnter:a=>a.currentTarget.style.color="var(--text-primary)",onMouseLeave:a=>a.currentTarget.style.color="var(--text-muted)",children:"×"})]}),e.jsx("p",{style:{margin:0,fontSize:12,color:"var(--text-secondary)",lineHeight:1.5,wordBreak:"break-all"},children:t.body}),t.sessionId&&e.jsx("button",{onClick:()=>{ne(t.sessionId),Cn(t.id)},style:{marginTop:8,padding:"4px 10px",fontSize:11,fontWeight:500,background:"var(--accent-dim)",color:"var(--accent)",border:"1px solid var(--border-glow)",borderRadius:6,cursor:"pointer",transition:"background 0.15s",WebkitAppRegion:"no-drag"},onMouseEnter:a=>a.currentTarget.style.background="var(--accent-glow)",onMouseLeave:a=>a.currentTarget.style.background="var(--accent-dim)",children:"进入会话 →"})]},t.id))}),document.body)]})}const od=Object.freeze(Object.defineProperty({__proto__:null,default:Rl},Symbol.toStringTag,{value:"Module"}));export{il as A,od as a};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import o from"./CalendarPage-sg7SzvUh.js";import"./index-CrjQF-VW.js";import"./CalendarView-C5z_2esa.js";import"./calendar-days-DpxojDWK.js";import"./x-3I6TKNBE.js";import"./chevron-right-Bnd4FK8S.js";import"./locate-fixed-BBOLeIa6.js";import"./list-todo-BJrNf0OF.js";import"./chevron-down-FeW7FcBS.js";import"./check-CY3GCzxa.js";import"./pause-BF1q8wFt.js";export{o as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{U as a,C as n}from"./mermaid.core-XNny-og5.js";const t=(r,o)=>a.lang.round(n.parse(r)[o]);export{t as c};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{s as a,c as s,a as e,C as t}from"./chunk-TICWLB2K-BIDOV_Vx.js";import{_ as i}from"./mermaid.core-XNny-og5.js";import"./chunk-5VM5RSS4-BbY9artS.js";import"./chunk-XXDRQBXY-C-y59lCL.js";import"./chunk-POPQ4Y6H-D51fNP6n.js";import"./chunk-F27PBJKO-B9uG6DBE.js";import"./index-CrjQF-VW.js";var n={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{n as diagram};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{s as a,c as s,a as e,C as t}from"./chunk-TICWLB2K-BIDOV_Vx.js";import{_ as i}from"./mermaid.core-XNny-og5.js";import"./chunk-5VM5RSS4-BbY9artS.js";import"./chunk-XXDRQBXY-C-y59lCL.js";import"./chunk-POPQ4Y6H-D51fNP6n.js";import"./chunk-F27PBJKO-B9uG6DBE.js";import"./index-CrjQF-VW.js";var n={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{n as diagram};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{s as r,b as e,a,S as s}from"./chunk-IMKFNOWR-Dta3lxIg.js";import{_ as i}from"./mermaid.core-XNny-og5.js";import"./chunk-XXDRQBXY-C-y59lCL.js";import"./chunk-POPQ4Y6H-D51fNP6n.js";import"./chunk-F27PBJKO-B9uG6DBE.js";import"./index-CrjQF-VW.js";var u={parser:a,get db(){return new s(2)},renderer:e,styles:r,init:i(t=>{t.state||(t.state={}),t.state.arrowMarkerAbsolute=t.arrowMarkerAbsolute},"init")};export{u as diagram};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{c as r,s as e}from"./flowDiagram-HODETNUW-BLS4V7Zd.js";import{_ as a}from"./mermaid.core-XNny-og5.js";import"./chunk-5VM5RSS4-BbY9artS.js";import"./chunk-XXDRQBXY-C-y59lCL.js";import"./chunk-POPQ4Y6H-D51fNP6n.js";import"./chunk-F27PBJKO-B9uG6DBE.js";import"./channel-Dz0U21-m.js";import"./index-CrjQF-VW.js";var o=a(t=>`${e(t)}
|
|
2
|
-
.swimlane.cluster rect {
|
|
3
|
-
stroke: ${t.clusterBorder} !important;
|
|
4
|
-
}
|
|
5
|
-
[data-look="neo"].cluster rect {
|
|
6
|
-
filter: none;
|
|
7
|
-
}
|
|
8
|
-
`,"getStyles"),s=o,n=r({defaultLayout:"swimlane",styles:s});export{n as diagram};
|
/package/runtime/.next/static/{N0n_ri0ArZV5CvaOg_qnx → Ra6nQooMsDWN9-yjPL93f}/_buildManifest.js
RENAMED
|
File without changes
|
/package/runtime/.next/static/{N0n_ri0ArZV5CvaOg_qnx → Ra6nQooMsDWN9-yjPL93f}/_ssgManifest.js
RENAMED
|
File without changes
|