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.
Files changed (304) hide show
  1. package/manifest.json +2 -2
  2. package/package.json +1 -1
  3. package/runtime/.next/BUILD_ID +1 -1
  4. package/runtime/.next/app-build-manifest.json +8 -8
  5. package/runtime/.next/app-path-routes-manifest.json +1 -1
  6. package/runtime/.next/build-manifest.json +3 -3
  7. package/runtime/.next/prerender-manifest.json +1 -1
  8. package/runtime/.next/required-server-files.json +1 -1
  9. package/runtime/.next/server/app/_not-found/page.js +1 -1
  10. package/runtime/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  11. package/runtime/.next/server/app/_not-found.html +1 -1
  12. package/runtime/.next/server/app/_not-found.rsc +1 -1
  13. package/runtime/.next/server/app/api/agent/abort/route.js +1 -1
  14. package/runtime/.next/server/app/api/agent/answer/route.js +1 -1
  15. package/runtime/.next/server/app/api/agent/codex-sharing/route.js +1 -1
  16. package/runtime/.next/server/app/api/agent/harness/status/route.js +1 -1
  17. package/runtime/.next/server/app/api/agent/model/route.js +1 -1
  18. package/runtime/.next/server/app/api/agent/models/route.js +1 -1
  19. package/runtime/.next/server/app/api/agent/run/route.js +1 -1
  20. package/runtime/.next/server/app/api/agent/runtime-health/route.js +1 -1
  21. package/runtime/.next/server/app/api/agent/steer/route.js +1 -1
  22. package/runtime/.next/server/app/api/agent/stream/route.js +3 -3
  23. package/runtime/.next/server/app/api/agent-workspaces/[workspaceId]/sessions/route.js +1 -1
  24. package/runtime/.next/server/app/api/agent-workspaces/route.js +1 -1
  25. package/runtime/.next/server/app/api/auth/verify/route.js +1 -1
  26. package/runtime/.next/server/app/api/business/route.js +1 -1
  27. package/runtime/.next/server/app/api/calendar/route.js +2 -2
  28. package/runtime/.next/server/app/api/client-logs/route.js +1 -1
  29. package/runtime/.next/server/app/api/collaboration/route.js +2 -2
  30. package/runtime/.next/server/app/api/engine-threads/route.js +1 -1
  31. package/runtime/.next/server/app/api/engine-threads.body +1 -1
  32. package/runtime/.next/server/app/api/flow/v1/catalog/route.js +1 -1
  33. package/runtime/.next/server/app/api/flow/v1/runs/[runId]/cancel/route.js +1 -1
  34. package/runtime/.next/server/app/api/flow/v1/runs/[runId]/events/route.js +2 -2
  35. package/runtime/.next/server/app/api/flow/v1/runs/route.js +1 -1
  36. package/runtime/.next/server/app/api/flow-studio/config/route.js +1 -1
  37. package/runtime/.next/server/app/api/internal/todo-bootstrap/route.js +1 -1
  38. package/runtime/.next/server/app/api/internal/todo-mcp/route.js +1 -1
  39. package/runtime/.next/server/app/api/mcp/connect/route.js +1 -1
  40. package/runtime/.next/server/app/api/mcp/disconnect/route.js +1 -1
  41. package/runtime/.next/server/app/api/mcp/servers/route.js +1 -1
  42. package/runtime/.next/server/app/api/memory/[key]/route.js +1 -1
  43. package/runtime/.next/server/app/api/memory/route.js +1 -1
  44. package/runtime/.next/server/app/api/messaging/route.js +1 -1
  45. package/runtime/.next/server/app/api/notifications/[id]/ack/route.js +1 -1
  46. package/runtime/.next/server/app/api/notifications/[id]/route.js +1 -1
  47. package/runtime/.next/server/app/api/notifications/route.js +1 -1
  48. package/runtime/.next/server/app/api/notifications/stream/route.js +2 -2
  49. package/runtime/.next/server/app/api/plugins/load/route.js +1 -1
  50. package/runtime/.next/server/app/api/projects/[id]/route.js +1 -1
  51. package/runtime/.next/server/app/api/projects/check/route.js +1 -1
  52. package/runtime/.next/server/app/api/projects/directories/route.js +1 -1
  53. package/runtime/.next/server/app/api/projects/roots/route.js +1 -1
  54. package/runtime/.next/server/app/api/projects/route.js +1 -1
  55. package/runtime/.next/server/app/api/push/subscribe/route.js +2 -2
  56. package/runtime/.next/server/app/api/push/unsubscribe/route.js +3 -3
  57. package/runtime/.next/server/app/api/push/vapid/route.js +2 -2
  58. package/runtime/.next/server/app/api/remote-tools/register/route.js +1 -1
  59. package/runtime/.next/server/app/api/session-images/[id]/route.js +1 -1
  60. package/runtime/.next/server/app/api/session-views/route.js +1 -1
  61. package/runtime/.next/server/app/api/sessions/[id]/background-jobs/[jobId]/route.js +1 -1
  62. package/runtime/.next/server/app/api/sessions/[id]/background-jobs/[jobId]/stop/route.js +1 -1
  63. package/runtime/.next/server/app/api/sessions/[id]/background-jobs/route.js +1 -1
  64. package/runtime/.next/server/app/api/sessions/[id]/changes/route.js +2 -2
  65. package/runtime/.next/server/app/api/sessions/[id]/engine-switches/route.js +1 -1
  66. package/runtime/.next/server/app/api/sessions/[id]/fork/route.js +1 -1
  67. package/runtime/.next/server/app/api/sessions/[id]/fork-at/route.js +1 -1
  68. package/runtime/.next/server/app/api/sessions/[id]/goals/route.js +1 -1
  69. package/runtime/.next/server/app/api/sessions/[id]/handoff/route.js +1 -1
  70. package/runtime/.next/server/app/api/sessions/[id]/native-goal/route.js +1 -1
  71. package/runtime/.next/server/app/api/sessions/[id]/query-index/route.js +1 -1
  72. package/runtime/.next/server/app/api/sessions/[id]/release/route.js +1 -1
  73. package/runtime/.next/server/app/api/sessions/[id]/route.js +1 -1
  74. package/runtime/.next/server/app/api/sessions/[id]/switch-engine/route.js +1 -1
  75. package/runtime/.next/server/app/api/sessions/[id]/thread-goal/route.js +1 -1
  76. package/runtime/.next/server/app/api/sessions/[id]/thread-history/route.js +1 -1
  77. package/runtime/.next/server/app/api/sessions/[id]/tool-result/route.js +1 -1
  78. package/runtime/.next/server/app/api/sessions/parallel/route.js +1 -1
  79. package/runtime/.next/server/app/api/sessions/route.js +1 -1
  80. package/runtime/.next/server/app/api/settings/route.js +1 -1
  81. package/runtime/.next/server/app/api/skills/route.js +1 -1
  82. package/runtime/.next/server/app/api/todos/[id]/commands/route.js +1 -1
  83. package/runtime/.next/server/app/api/todos/[id]/executions/route.js +1 -1
  84. package/runtime/.next/server/app/api/todos/[id]/route.js +1 -1
  85. package/runtime/.next/server/app/api/todos/route.js +1 -1
  86. package/runtime/.next/server/app/api/tool-policies/[policyId]/route.js +1 -1
  87. package/runtime/.next/server/app/api/tool-policies/route.js +1 -1
  88. package/runtime/.next/server/app/api/tools/route.js +1 -1
  89. package/runtime/.next/server/app/api/update/check/route.js +1 -1
  90. package/runtime/.next/server/app/api/update/install/route.js +1 -1
  91. package/runtime/.next/server/app/api/update/status/route.js +1 -1
  92. package/runtime/.next/server/app/api/web-auth/login/route.js +1 -1
  93. package/runtime/.next/server/app/api/web-auth/logout/route.js +1 -1
  94. package/runtime/.next/server/app/api/web-auth/revoke-all/route.js +1 -1
  95. package/runtime/.next/server/app/api/web-auth/setup/route.js +1 -1
  96. package/runtime/.next/server/app/api/web-auth/status/route.js +1 -1
  97. package/runtime/.next/server/app/api/web-console/bootstrap/route.js +1 -1
  98. package/runtime/.next/server/app/api/web-console/computer-settings/route.js +1 -1
  99. package/runtime/.next/server/app/api/web-console/computers/route.js +1 -1
  100. package/runtime/.next/server/app/api/web-console/device-state/route.js +1 -1
  101. package/runtime/.next/server/app/api/web-console/history/route.js +1 -1
  102. package/runtime/.next/server/app/api/web-console/preferences/route.js +1 -1
  103. package/runtime/.next/server/app/api/workspace-changes/route.js +1 -1
  104. package/runtime/.next/server/app/web/page.js +4 -4
  105. package/runtime/.next/server/app/web/page_client-reference-manifest.js +1 -1
  106. package/runtime/.next/server/app-paths-manifest.json +44 -44
  107. package/runtime/.next/server/chunks/1298.js +1 -1
  108. package/runtime/.next/server/chunks/5303.js +2 -2
  109. package/runtime/.next/server/chunks/6703.js +1 -1
  110. package/runtime/.next/server/chunks/9119.js +2 -2
  111. package/runtime/.next/server/chunks/9457.js +1 -1
  112. package/runtime/.next/server/middleware-build-manifest.js +1 -1
  113. package/runtime/.next/server/pages/404.html +1 -1
  114. package/runtime/.next/server/pages/500.html +1 -1
  115. package/runtime/.next/server/server-reference-manifest.json +1 -1
  116. package/runtime/.next/static/chunks/app/web/{error-828d278147a0619d.js → error-fac7681c6397fcd7.js} +1 -1
  117. package/runtime/.next/static/chunks/app/web/layout-79492e587e5930cf.js +1 -0
  118. package/runtime/.next/static/chunks/app/web/{page-bafdaa23fa1dc1c4.js → page-0f06deb6eb4d49e0.js} +1 -1
  119. package/runtime/.next/static/chunks/main-app-0c7cccb2825ad747.js +1 -0
  120. package/runtime/lib/mesh/headscale-client.mjs +81 -0
  121. package/runtime/lib/mesh/mesh-gateway.mjs +168 -0
  122. package/runtime/lib/mesh/mesh-service.mjs +158 -0
  123. package/runtime/native/Support.noindex/AgentRoam Remote Desktop.app/Contents/MacOS/agentroam-remote-desktop +0 -0
  124. package/runtime/native/Support.noindex/AgentRoam Remote Desktop.app/Contents/Resources/agentroam-component.json +1 -1
  125. package/runtime/native/Support.noindex/AgentRoam Remote Desktop.app/Contents/_CodeSignature/CodeResources +2 -2
  126. package/runtime/node_modules/.package-lock.json +17 -17
  127. package/runtime/node_modules/@agent/native-runtime/dist/index.js +46 -16
  128. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/bridge.mjs +58 -58
  129. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/browser-sdk.js +46 -46
  130. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-n0k9q0s3.mjs → core-2g5j09ba.mjs} +2 -2
  131. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-59ydwk0g.mjs +17 -0
  132. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-76wf4hmr.mjs → core-664d5mmy.mjs} +2 -2
  133. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-ypdsx2xc.mjs → core-70sfhqm6.mjs} +2 -2
  134. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-95gcz3n1.mjs +38 -0
  135. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-ew5sfvfe.mjs +39 -0
  136. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-gjhs7gf6.mjs +20 -0
  137. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-31xm3p73.mjs → core-kvdt1szx.mjs} +4 -4
  138. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-p654hjkr.mjs +22 -0
  139. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-q9bjbxkv.mjs +19 -0
  140. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-samdvsjh.mjs +33 -0
  141. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-09fdstw7.mjs → core-x6bt758j.mjs} +3 -3
  142. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core.mjs +12 -12
  143. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/manifest.json +21 -21
  144. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/manifest.zst.json +25 -25
  145. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/package.json +22 -22
  146. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs +78 -78
  147. package/runtime/node_modules/caniuse-lite/package.json +1 -1
  148. package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.cjs +17 -3
  149. package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.min.cjs +3 -3
  150. package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.min.mjs +3 -3
  151. package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.mjs +17 -3
  152. package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.node.cjs +17 -3
  153. package/runtime/node_modules/mediabunny/dist/modules/src/isobmff/isobmff-demuxer.js +4 -1
  154. package/runtime/node_modules/mediabunny/dist/modules/src/isobmff/isobmff-muxer.js +7 -2
  155. package/runtime/node_modules/mediabunny/dist/modules/src/matroska/matroska-demuxer.js +3 -0
  156. package/runtime/node_modules/mediabunny/dist/modules/src/mpeg-ts/mpeg-ts-muxer.js +2 -2
  157. package/runtime/node_modules/mediabunny/dist/modules/src/tsconfig.tsbuildinfo +1 -1
  158. package/runtime/node_modules/mediabunny/dist/modules/src/version.js +1 -1
  159. package/runtime/node_modules/mediabunny/package.json +1 -1
  160. package/runtime/node_modules/mediabunny/src/isobmff/isobmff-demuxer.ts +5 -1
  161. package/runtime/node_modules/mediabunny/src/isobmff/isobmff-muxer.ts +10 -2
  162. package/runtime/node_modules/mediabunny/src/matroska/matroska-demuxer.ts +4 -0
  163. package/runtime/node_modules/mediabunny/src/mpeg-ts/mpeg-ts-muxer.ts +2 -2
  164. package/runtime/node_modules/mediabunny/src/version.ts +1 -1
  165. package/runtime/package-lock.json +41 -41
  166. package/runtime/server.js +1 -1
  167. package/runtime/webapp/dist/assets/{AIHubView-C0eIFauh.js → AIHubView-4kqTaPjO.js} +1 -1
  168. package/runtime/webapp/dist/assets/{AgentManager-B7kG8iLS.js → AgentManager-CDgiLqF_.js} +1 -1
  169. package/runtime/webapp/dist/assets/{AiHubPane-DB6b6Via.js → AiHubPane-C070jRHe.js} +1 -1
  170. package/runtime/webapp/dist/assets/App-iZlxRHaL.js +68 -0
  171. package/runtime/webapp/dist/assets/{BrowserLivePanel-BgftwEHQ.js → BrowserLivePanel-DxjgVXXK.js} +1 -1
  172. package/runtime/webapp/dist/assets/{CalendarPage-sg7SzvUh.js → CalendarPage-CxPVBlzd.js} +1 -1
  173. package/runtime/webapp/dist/assets/{CalendarView-C5z_2esa.js → CalendarView-CS-OG-13.js} +1 -1
  174. package/runtime/webapp/dist/assets/{CollaborationCreateDialog-DuEnjSu9.js → CollaborationCreateDialog-tI6S1cha.js} +1 -1
  175. package/runtime/webapp/dist/assets/{CollaborationDashboard-O13tTlEe.js → CollaborationDashboard-DSZa3Cns.js} +1 -1
  176. package/runtime/webapp/dist/assets/{CollaborationPage-DIKDOl8G.js → CollaborationPage-COyvllTJ.js} +1 -1
  177. package/runtime/webapp/dist/assets/{FilePreview-BfkF9hjw.js → FilePreview-CcJXlLge.js} +3 -3
  178. package/runtime/webapp/dist/assets/{FileTree-pbVSSQnM.js → FileTree-BuhW-pqR.js} +1 -1
  179. package/runtime/webapp/dist/assets/{FileWorkspaceDrawer-YcKPTu23.js → FileWorkspaceDrawer-ByWXnJ0B.js} +1 -1
  180. package/runtime/webapp/dist/assets/{FlowStudioPane-D7gzm1M_.js → FlowStudioPane-CxQ-QIOf.js} +1 -1
  181. package/runtime/webapp/dist/assets/{HostProjectPicker-7zvVzftL.js → HostProjectPicker--J4_JpSW.js} +1 -1
  182. package/runtime/webapp/dist/assets/{LSPServerList-BfbJdHYJ.js → LSPServerList-fkagcDVv.js} +1 -1
  183. package/runtime/webapp/dist/assets/{MCPServerList-A1SAlHdR.js → MCPServerList-w7tetX3J.js} +1 -1
  184. package/runtime/webapp/dist/assets/{MemoryViewer-fFtBJzgz.js → MemoryViewer-Xac9EeaV.js} +1 -1
  185. package/runtime/webapp/dist/assets/{NewSessionWindow-Ce2M6IVa.js → NewSessionWindow-C460-gxX.js} +1 -1
  186. package/runtime/webapp/dist/assets/{RemoteDesktopPage-kP5Qzh6n.js → RemoteDesktopPage-BniHztmt.js} +1 -1
  187. package/runtime/webapp/dist/assets/{RemoteDesktopTabBridge-tJcxPHnZ.js → RemoteDesktopTabBridge-BF1dFltY.js} +1 -1
  188. package/runtime/webapp/dist/assets/{RunningSessionsIcon-DuoG6Hgs.js → RunningSessionsIcon-D6rY-IzV.js} +1 -1
  189. package/runtime/webapp/dist/assets/{SessionDashboard-DGfTYjbZ.js → SessionDashboard-D868NjZ_.js} +1 -1
  190. package/runtime/webapp/dist/assets/{SessionDashboardBridge-Cw8Y0s5_.js → SessionDashboardBridge-AhmhQ1Xn.js} +1 -1
  191. package/runtime/webapp/dist/assets/{SettingsPanel-DCME-IZC.js → SettingsPanel-DoDRBreZ.js} +1 -1
  192. package/runtime/webapp/dist/assets/{SkillManager-CFHcSwEr.js → SkillManager-Da7bpT-s.js} +1 -1
  193. package/runtime/webapp/dist/assets/{TaskPaneTerminal-BozZNjMj.js → TaskPaneTerminal-DTDU88Rr.js} +1 -1
  194. package/runtime/webapp/dist/assets/{TerminalPane-CPlks8Nc.js → TerminalPane-_dVVs00I.js} +1 -1
  195. package/runtime/webapp/dist/assets/TodoPage-Bqu8bqNk.js +1 -0
  196. package/runtime/webapp/dist/assets/{abnfDiagram-VCTEODGH-DoUDteiL.js → abnfDiagram-VCTEODGH-D3GW7M1R.js} +1 -1
  197. package/runtime/webapp/dist/assets/{arc-Cao4pQp2.js → arc-CkEemU1L.js} +1 -1
  198. package/runtime/webapp/dist/assets/{architectureDiagram-5GKGNRK7-BvZ3G5rB.js → architectureDiagram-5GKGNRK7-GYQtcFLY.js} +1 -1
  199. package/runtime/webapp/dist/assets/{blockDiagram-I7D4REHJ-DNv3qaVA.js → blockDiagram-I7D4REHJ-D5_bj13P.js} +1 -1
  200. package/runtime/webapp/dist/assets/{c4Diagram-7LVT6UL2-DtL8WSam.js → c4Diagram-7LVT6UL2-Cyg1YunN.js} +1 -1
  201. package/runtime/webapp/dist/assets/{calendar-days-DpxojDWK.js → calendar-days-B1Mn3x8A.js} +1 -1
  202. package/runtime/webapp/dist/assets/channel-CnNsi-lz.js +1 -0
  203. package/runtime/webapp/dist/assets/{check-CY3GCzxa.js → check-D-yTByNl.js} +1 -1
  204. package/runtime/webapp/dist/assets/{chevron-down-FeW7FcBS.js → chevron-down-hiPnZS_M.js} +1 -1
  205. package/runtime/webapp/dist/assets/{chevron-right-Bnd4FK8S.js → chevron-right-DKsui_wS.js} +1 -1
  206. package/runtime/webapp/dist/assets/{chunk-2Q5K7J3B-Jc2d8B_h.js → chunk-2Q5K7J3B-ZYdmLJUM.js} +1 -1
  207. package/runtime/webapp/dist/assets/{chunk-5VM5RSS4-BbY9artS.js → chunk-5VM5RSS4-C-zA5MxE.js} +1 -1
  208. package/runtime/webapp/dist/assets/{chunk-F27PBJKO-B9uG6DBE.js → chunk-F27PBJKO-cWERJSPb.js} +1 -1
  209. package/runtime/webapp/dist/assets/{chunk-IMKFNOWR-Dta3lxIg.js → chunk-IMKFNOWR-BDqkH2_j.js} +1 -1
  210. package/runtime/webapp/dist/assets/{chunk-JWPE2WC7-DhBjDzbj.js → chunk-JWPE2WC7-D0hOf4wm.js} +1 -1
  211. package/runtime/webapp/dist/assets/{chunk-POPQ4Y6H-D51fNP6n.js → chunk-POPQ4Y6H-bGKHqXLU.js} +1 -1
  212. package/runtime/webapp/dist/assets/{chunk-SVP7TREG-DQ8c4Knv.js → chunk-SVP7TREG-DbzwWcno.js} +1 -1
  213. package/runtime/webapp/dist/assets/{chunk-TICWLB2K-BIDOV_Vx.js → chunk-TICWLB2K-CmCx8YTb.js} +1 -1
  214. package/runtime/webapp/dist/assets/{chunk-XXDRQBXY-C-y59lCL.js → chunk-XXDRQBXY-COAufrJq.js} +1 -1
  215. package/runtime/webapp/dist/assets/classDiagram-ZZMXUADV-DVRTvUTS.js +1 -0
  216. package/runtime/webapp/dist/assets/classDiagram-v2-VYDZK3BY-DVRTvUTS.js +1 -0
  217. package/runtime/webapp/dist/assets/{client-ZvcI0WiM.js → client-5Hu1eVTX.js} +1 -1
  218. package/runtime/webapp/dist/assets/{codeSyntax-DlCdufoQ.js → codeSyntax-Jy5nWtHv.js} +1 -1
  219. package/runtime/webapp/dist/assets/{collaboration-CeiB1Ihl.js → collaboration-DRFqpcAz.js} +1 -1
  220. package/runtime/webapp/dist/assets/{composer-file-routing-CFoCNmv7.js → composer-file-routing-BtvXnu_o.js} +1 -1
  221. package/runtime/webapp/dist/assets/{cose-bilkent-JH36ORCC-Do2xoVHK.js → cose-bilkent-JH36ORCC-BU8MmGqT.js} +1 -1
  222. package/runtime/webapp/dist/assets/{cynefin-OW5HDTMX-CRC3uGN6.js → cynefin-OW5HDTMX-BHXgPQGq.js} +1 -1
  223. package/runtime/webapp/dist/assets/{cynefinDiagram-5FMLGOSQ-BD90NfUx.js → cynefinDiagram-5FMLGOSQ-DSJJ_PpM.js} +1 -1
  224. package/runtime/webapp/dist/assets/{dagre-GXQ25YYZ-BeO7O01r.js → dagre-GXQ25YYZ-pJr8jDyF.js} +1 -1
  225. package/runtime/webapp/dist/assets/{diagram-S7CK7UJ4-DGvd2V5u.js → diagram-S7CK7UJ4-BZ_7PPQn.js} +1 -1
  226. package/runtime/webapp/dist/assets/{diagram-UQ7AKVKN-_Ns2BTM0.js → diagram-UQ7AKVKN-c8pu5Rp4.js} +1 -1
  227. package/runtime/webapp/dist/assets/{diagram-VSXAHHWV-D45wsjUv.js → diagram-VSXAHHWV-D1xao_j-.js} +1 -1
  228. package/runtime/webapp/dist/assets/{diagram-VX7I27RA-B_898k8e.js → diagram-VX7I27RA-CnBWGCHa.js} +1 -1
  229. package/runtime/webapp/dist/assets/{diagram-Z3DM3KII-CdbHDj9L.js → diagram-Z3DM3KII-D-TCo4OF.js} +1 -1
  230. package/runtime/webapp/dist/assets/{download-Cy_rpjte.js → download-B2jLl85N.js} +1 -1
  231. package/runtime/webapp/dist/assets/{ebnfDiagram-PWID7BFC-eqVvfCy6.js → ebnfDiagram-PWID7BFC-BGBuf1T3.js} +1 -1
  232. package/runtime/webapp/dist/assets/{erDiagram-RLTQ6QDP-eRQEDuTP.js → erDiagram-RLTQ6QDP-D8rCYH4y.js} +1 -1
  233. package/runtime/webapp/dist/assets/{file-types-BsWJSk07.js → file-types-BZ8YZAV-.js} +1 -1
  234. package/runtime/webapp/dist/assets/{flowDiagram-HODETNUW-BLS4V7Zd.js → flowDiagram-HODETNUW-BJGQL6in.js} +1 -1
  235. package/runtime/webapp/dist/assets/{ganttDiagram-EL5Y4UJY-C1JdU9e_.js → ganttDiagram-EL5Y4UJY-K9o-Kk2M.js} +1 -1
  236. package/runtime/webapp/dist/assets/{gitGraphDiagram-WWUBYQGX-kAprA0xM.js → gitGraphDiagram-WWUBYQGX-BC2r8pLT.js} +1 -1
  237. package/runtime/webapp/dist/assets/{history-BGr6tFSR.js → history-Ci0s2eVL.js} +1 -1
  238. package/runtime/webapp/dist/assets/{image-plus-Cr9rDqvd.js → image-plus-Cx4LQVvj.js} +1 -1
  239. package/runtime/webapp/dist/assets/{index-CrjQF-VW.js → index-D1AQffdA.js} +3 -3
  240. package/runtime/webapp/dist/assets/{infoDiagram-27XIBGKW-DzUFk2zb.js → infoDiagram-27XIBGKW-bFnrh7W7.js} +1 -1
  241. package/runtime/webapp/dist/assets/{ishikawaDiagram-5VMMS53U-DETvimW1.js → ishikawaDiagram-5VMMS53U-Qun77xRt.js} +1 -1
  242. package/runtime/webapp/dist/assets/{journeyDiagram-3NMN7TZE-ZmlLOhVV.js → journeyDiagram-3NMN7TZE-DjCfoBNX.js} +1 -1
  243. package/runtime/webapp/dist/assets/{kanban-definition-UXKFOSKX-Q5j9iBkD.js → kanban-definition-UXKFOSKX-BJGlhVsx.js} +1 -1
  244. package/runtime/webapp/dist/assets/{layout-xVYWH0Cz.js → layout-CYTxygXU.js} +1 -1
  245. package/runtime/webapp/dist/assets/{linear-BD5xYHq0.js → linear-CzJGOwUm.js} +1 -1
  246. package/runtime/webapp/dist/assets/{list-todo-BJrNf0OF.js → list-todo-CP9DqU2D.js} +1 -1
  247. package/runtime/webapp/dist/assets/{loader-circle-BSDHoDXf.js → loader-circle-xEKTnlp3.js} +1 -1
  248. package/runtime/webapp/dist/assets/{locate-fixed-BBOLeIa6.js → locate-fixed-CfEojGOl.js} +1 -1
  249. package/runtime/webapp/dist/assets/{mermaid.core-XNny-og5.js → mermaid.core-BTbaaIjb.js} +5 -5
  250. package/runtime/webapp/dist/assets/{mindmap-definition-YA3MSWOX-CCuaFOfd.js → mindmap-definition-YA3MSWOX-eiKdbp4J.js} +1 -1
  251. package/runtime/webapp/dist/assets/{mobileViewport-Ckhq6eml.js → mobileViewport-DF1R6qR2.js} +1 -1
  252. package/runtime/webapp/dist/assets/{new-session-window-ThRZvGVK.js → new-session-window-BFILhYAe.js} +24 -24
  253. package/runtime/webapp/dist/assets/{page-DK2ooc8J.js → page-B-CkpInM.js} +3 -3
  254. package/runtime/webapp/dist/assets/{pause-BF1q8wFt.js → pause-C-ecDo3W.js} +1 -1
  255. package/runtime/webapp/dist/assets/{pegDiagram-XKGWAZYB-Dt2wEt-q.js → pegDiagram-XKGWAZYB-BuvePvoF.js} +1 -1
  256. package/runtime/webapp/dist/assets/{pieDiagram-E7YTZNPT-Bv5PR_0B.js → pieDiagram-E7YTZNPT-Csgh2lYE.js} +1 -1
  257. package/runtime/webapp/dist/assets/{pin-ByCe4NyB.js → pin-CjmuX5Tq.js} +1 -1
  258. package/runtime/webapp/dist/assets/{quadrantDiagram-AXDQQJYC-mUp15pA4.js → quadrantDiagram-AXDQQJYC-8Bbl_RHv.js} +1 -1
  259. package/runtime/webapp/dist/assets/{railroadDiagram-O6MQD6OU-CU79-JOl.js → railroadDiagram-O6MQD6OU-CvYQkIeK.js} +1 -1
  260. package/runtime/webapp/dist/assets/{requirementDiagram-BXWQKSXE-DosZrbGa.js → requirementDiagram-BXWQKSXE-CytOuQX4.js} +1 -1
  261. package/runtime/webapp/dist/assets/{rotate-ccw-DtSpwbK7.js → rotate-ccw-HY6j6nBt.js} +1 -1
  262. package/runtime/webapp/dist/assets/{rotate-cw-DdQZP8we.js → rotate-cw-CyYR2IEw.js} +1 -1
  263. package/runtime/webapp/dist/assets/{sankeyDiagram-P5KCCOFB-BWbz07Kw.js → sankeyDiagram-P5KCCOFB-BoyI7ZhF.js} +1 -1
  264. package/runtime/webapp/dist/assets/{send-CtGGbUpC.js → send-jSK0YaRl.js} +1 -1
  265. package/runtime/webapp/dist/assets/{sequenceDiagram-WJ2MYXX4-DeUcGtwv.js → sequenceDiagram-WJ2MYXX4-Ckvtmn2N.js} +1 -1
  266. package/runtime/webapp/dist/assets/{session-dashboard-7G2sKgmw.js → session-dashboard-B4lyuZYF.js} +1 -1
  267. package/runtime/webapp/dist/assets/{session-tree-Ck5Wp7h-.js → session-tree-CEy-pW8A.js} +1 -1
  268. package/runtime/webapp/dist/assets/{shield-check-BIxrmOwR.js → shield-check-CFebh9do.js} +1 -1
  269. package/runtime/webapp/dist/assets/{sizeCapture-INFHLROL-DPrrG2Kd.js → sizeCapture-INFHLROL-yUQjHNrI.js} +1 -1
  270. package/runtime/webapp/dist/assets/{stateDiagram-D77RDMKH-CtlmJgrm.js → stateDiagram-D77RDMKH-Dj8oPHDB.js} +1 -1
  271. package/runtime/webapp/dist/assets/stateDiagram-v2-MP3YSRHH-Csg946NK.js +1 -0
  272. package/runtime/webapp/dist/assets/{swimlanes-42K2YHIH-rMtOxOkm.js → swimlanes-42K2YHIH-GDjg8QNS.js} +1 -1
  273. package/runtime/webapp/dist/assets/swimlanesDiagram-VR7AAH4N-BUnuRfXp.js +8 -0
  274. package/runtime/webapp/dist/assets/{timeline-definition-24CTP7MA-D0C5B_7F.js → timeline-definition-24CTP7MA-DFDHsxzp.js} +1 -1
  275. package/runtime/webapp/dist/assets/{trash-2-CT_MslWu.js → trash-2-BF9eI5Bh.js} +1 -1
  276. package/runtime/webapp/dist/assets/{types-pH-pRUSS.js → types-BuPq0iQM.js} +1 -1
  277. package/runtime/webapp/dist/assets/{use-session-activity-B9xAOlzA.js → use-session-activity-Ceb8OBjB.js} +1 -1
  278. package/runtime/webapp/dist/assets/{vennDiagram-4TSXK5OY-B8iPk0Tm.js → vennDiagram-4TSXK5OY-DR5HBqo1.js} +1 -1
  279. package/runtime/webapp/dist/assets/{wardleyDiagram-VM6X3IG4-Cb60IRaS.js → wardleyDiagram-VM6X3IG4-Bb6pROnE.js} +1 -1
  280. package/runtime/webapp/dist/assets/{web-D-dNOCeI.js → web-BV7fxnr4.js} +1 -1
  281. package/runtime/webapp/dist/assets/{web-DTj73nYv.js → web-C8kCU9om.js} +1 -1
  282. package/runtime/webapp/dist/assets/{x-3I6TKNBE.js → x-uSekqXJV.js} +1 -1
  283. package/runtime/webapp/dist/assets/{xychartDiagram-S5SC5T6Z-DWXthhJz.js → xychartDiagram-S5SC5T6Z-CrpaVklx.js} +1 -1
  284. package/runtime/webapp/dist/assets/{zoom-out-417ojKB8.js → zoom-out-B59mGU6c.js} +1 -1
  285. package/runtime/webapp/dist/index.html +1 -1
  286. package/runtime/ws-server.mjs +9 -0
  287. package/runtime/.next/static/chunks/app/web/layout-1127176e7e88e395.js +0 -1
  288. package/runtime/.next/static/chunks/main-app-07d67f2d4e96ecb8.js +0 -1
  289. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-7sb5cs8h.mjs +0 -39
  290. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-cfz10gtb.mjs +0 -24
  291. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-p9759xd0.mjs +0 -22
  292. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-rszpc155.mjs +0 -17
  293. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-ttfdej7v.mjs +0 -20
  294. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-y906qay4.mjs +0 -28
  295. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-yp8w8nva.mjs +0 -38
  296. package/runtime/webapp/dist/assets/App-m33SPX0n.js +0 -68
  297. package/runtime/webapp/dist/assets/TodoPage-BuDedc75.js +0 -1
  298. package/runtime/webapp/dist/assets/channel-Dz0U21-m.js +0 -1
  299. package/runtime/webapp/dist/assets/classDiagram-ZZMXUADV-CL_0n_9Y.js +0 -1
  300. package/runtime/webapp/dist/assets/classDiagram-v2-VYDZK3BY-CL_0n_9Y.js +0 -1
  301. package/runtime/webapp/dist/assets/stateDiagram-v2-MP3YSRHH-C9bL7Wc5.js +0 -1
  302. package/runtime/webapp/dist/assets/swimlanesDiagram-VR7AAH4N-x5ntdS3v.js +0 -8
  303. /package/runtime/.next/static/{N0n_ri0ArZV5CvaOg_qnx → Ra6nQooMsDWN9-yjPL93f}/_buildManifest.js +0 -0
  304. /package/runtime/.next/static/{N0n_ri0ArZV5CvaOg_qnx → Ra6nQooMsDWN9-yjPL93f}/_ssgManifest.js +0 -0
@@ -0,0 +1,68 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./CalendarView-CS-OG-13.js","./index-D1AQffdA.js","./index-zQk0NCEB.css","./calendar-days-B1Mn3x8A.js","./x-uSekqXJV.js","./chevron-right-DKsui_wS.js","./locate-fixed-CfEojGOl.js","./list-todo-CP9DqU2D.js","./chevron-down-hiPnZS_M.js","./check-D-yTByNl.js","./pause-C-ecDo3W.js","./CalendarView-BjjC_t12.css","./CollaborationDashboard-DSZa3Cns.js","./CollaborationTabBridge-Dxq4G1Uk.js","./CollaborationCreateDialog-tI6S1cha.js","./types-BuPq0iQM.js","./HostProjectPicker--J4_JpSW.js","./file-types-BZ8YZAV-.js","./trash-2-BF9eI5Bh.js","./client-5Hu1eVTX.js","./session-tree-CEy-pW8A.js","./collaboration-DRFqpcAz.js","./collaboration-B0IRHmY_.css","./SessionDashboardBridge-AhmhQ1Xn.js","./CollaborationDashboard-CCXC6JuQ.css","./CollaborationPage-COyvllTJ.js","./artifact-links-B0ApmgK6.js","./composer-file-routing-BtvXnu_o.js","./loader-circle-xEKTnlp3.js","./shield-check-CFebh9do.js","./history-Ci0s2eVL.js","./image-plus-Cx4LQVvj.js","./SessionDashboard-D868NjZ_.js","./session-dashboard-B4lyuZYF.js","./session-dashboard-BZIyuFTU.css","./use-session-activity-Ceb8OBjB.js","./SessionDashboard-CAYVDT8Z.css","./BrowserLivePanel-DxjgVXXK.js","./RemoteDesktopTabBridge-BF1dFltY.js","./zoom-out-B59mGU6c.js","./rotate-ccw-HY6j6nBt.js","./TaskPaneTerminal-DTDU88Rr.js","./TerminalPane-_dVVs00I.js","./mobileViewport-DF1R6qR2.js","./TerminalPane-6GBZ9nXN.css","./AIHubView-4kqTaPjO.js","./new-session-window-BFILhYAe.js","./RunningSessionsIcon-D6rY-IzV.js","./download-B2jLl85N.js","./new-session-window-BtGAiW4A.css","./send-jSK0YaRl.js","./SettingsPanel-DoDRBreZ.js","./rotate-cw-CyYR2IEw.js","./pin-CjmuX5Tq.js","./MCPServerList-w7tetX3J.js","./MemoryViewer-Xac9EeaV.js","./SkillManager-Da7bpT-s.js","./AgentManager-CDgiLqF_.js","./LSPServerList-fkagcDVv.js","./FileWorkspaceDrawer-ByWXnJ0B.js","./FilePreview-CcJXlLge.js","./FilePreview-B7Ab2X_E.css","./FileTree-BuhW-pqR.js"])))=>i.map(i=>d[i]);
2
+ import{c as $e,af as ua,i as hn,r,a as Ke,j as e,k as Xt,U as pa,l as dt,ae as Ce,h as Nn,R as As,A as Pn,n as Es,t as Mt,u as Ee,ag as hs,ah as Ur,ai as Kr,aj as fa,ak as ha,al as wr,am as ga,an as ma,ao as wa}from"./index-D1AQffdA.js";import{t as ba,b as xa,d as Ss,e as ya,f as zt,g as va,h as gs,i as br,j as ka,k as xr,l as Sa,s as ja,m as Ca,n as Ia,o as Ta,p as Aa,q as ms,v as Ea,w as Na,x as ws,y as Pa,z as yr,A as vr,B as kr,c as Ra,M as La,D as Da,T as _a,E as Oa,F as za,G as Ma,H as Wa,I as Gr,L as Sr,J as $a,K as Ha,N as Ba,O as bs,Q as Fa,R as An,U as Gt,V as jr,W as qa,X as Va,u as Ua,S as Ka,C as Ga,Y as Ya,Z as Xa,_ as Ja,$ as Qa,a0 as Za,a1 as eo,a2 as to,a3 as no}from"./new-session-window-BFILhYAe.js";import{c as xt,A as Yr}from"./client-5Hu1eVTX.js";import{i as zn,m as Yt,c as fn,a as so,b as Mn,S as Xr,d as Jr,u as ro,r as io,e as ao,f as oo,o as co,g as Rn,s as Ln,h as Dn,j as Cr,k as lo}from"./session-tree-CEy-pW8A.js";import{T as Ir}from"./composer-file-routing-BtvXnu_o.js";import{u as gn,S as Qr,C as uo}from"./CollaborationCreateDialog-tI6S1cha.js";import{u as Zr,b as po}from"./use-session-activity-Ceb8OBjB.js";import{L as fo,D as ho,p as ei}from"./session-dashboard-B4lyuZYF.js";import{X as yt}from"./x-uSekqXJV.js";import{S as Wn,i as go}from"./file-types-BZ8YZAV-.js";import{C as Tr}from"./chevron-down-hiPnZS_M.js";import{L as bt}from"./loader-circle-xEKTnlp3.js";import{L as mo}from"./list-todo-CP9DqU2D.js";import{C as Ns}from"./calendar-days-B1Mn3x8A.js";import{M as wo}from"./RunningSessionsIcon-D6rY-IzV.js";import{A as bo,T as xo}from"./trash-2-BF9eI5Bh.js";import{R as ti}from"./rotate-cw-CyYR2IEw.js";import{E as ni}from"./RemoteDesktopTabBridge-BF1dFltY.js";import{P as yo}from"./pin-CjmuX5Tq.js";import{U as vo}from"./collaboration-DRFqpcAz.js";import{C as ko}from"./chevron-right-DKsui_wS.js";import{S as So,c as pn,a as jo,r as Ar}from"./SessionDashboardBridge-AhmhQ1Xn.js";import{a as Co,f as Io}from"./CollaborationTabBridge-Dxq4G1Uk.js";import{D as To}from"./download-B2jLl85N.js";import{C as Ao}from"./check-D-yTByNl.js";import{H as Eo}from"./HostProjectPicker--J4_JpSW.js";import{p as No,r as Po,i as Ro}from"./artifact-links-B0ApmgK6.js";import{H as Lo}from"./history-Ci0s2eVL.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 Do=$e("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 _o=$e("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 Oo=$e("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 zo=$e("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 Mo=$e("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 Wo=$e("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 Er=$e("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 $o=$e("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 Ho=$e("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 Bo=$e("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 Fo=$e("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 qo=$e("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 Vo=$e("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 Uo(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:Ko}=ua;function Go(n){const s=Ko();return o=>{const i=n(o);return Uo(s.current,i)?s.current:s.current=i}}const js="agentroam:task-pane-notification";function Yo(n){return!window.dispatchEvent(new CustomEvent(js,{cancelable:!0,detail:{sessionId:n}}))}const si="agentroam.all-sessions.v2",Xo=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 Jo(n,s){const o=zn(n.data.slice(0,Xo),[...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 Qo(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"&&hn(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,Nr=100;function Zo(){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 ec({rows:n,count:s}){try{window.localStorage.setItem(oi,JSON.stringify({rows:n,count:s}))}catch{}}async function tc(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:Yt(s.rows,fn(d)),count:s.count+d.data.length,cursor:d.nextCursor}}catch(d){if(!so(d))throw d}const l=Math.max(xs,s.count+(o?xs:0));let h=await c(void 0,Math.min(l,Nr));if(h.refreshing)return{...s,rows:Yt(s.rows,fn(h)),refreshing:!0};let m=h.data.length,f=fn(h);for(;m<l&&h.nextCursor;)h=await c(h.nextCursor,Math.min(l-m,Nr)),m+=h.data.length,f=Yt(f,fn(h));return{rows:f,count:m,cursor:h.nextCursor}}function Pr(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 nc(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 sc({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(Xt,{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 rc({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),j=gn(),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 Zo()??{rows:((D=_n())==null?void 0:D.data)??[],count:0}}),_=r.useRef(v),P=r.useRef({...v,cursor:null}),[F,Q]=r.useState(P.current),ce=r.useMemo(()=>Yt(F.rows,Pr(o,l)),[F.rows,o,l]),[te,M]=r.useState(!0),[W,z]=r.useState(null),K=r.useRef(null),le=r.useRef(!1),ne=r.useRef(null),se=r.useRef(),re=r.useRef(c);re.current=c;const Te=async(D,G=!1)=>{if(K.current)return;window.clearTimeout(se.current);const X=new AbortController;K.current=X,le.current=G,M(!0),z(null);try{const V=await tc((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=V,Q(V),!D&&!V.refreshing&&(_.current=V,ec(V)),V.refreshing&&(se.current=window.setTimeout(()=>{Te(D,G)},2e3))}catch(V){if(!X.signal.aborted){Q(ue=>ue.refreshing?{...ue,refreshing:!1}:ue);const R=V instanceof Error?V.message:"无法加载任务";z(/timeout|timed out/i.test(R)?"任务列表更新超时,请重试":R)}}finally{K.current===X&&(K.current=null,M(!1))}};r.useEffect(()=>{var X;const D=document.activeElement;(X=ne.current)==null||X.focus();const G=V=>{V.key==="Escape"&&(V.preventDefault(),V.stopPropagation(),re.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:Pr(G.rows,D),count:D?0:G.count,cursor:null},Q(P.current),M(!0),z(null);const X=window.setTimeout(()=>{Te(D)},D?200:0);return()=>{var V;window.clearTimeout(X),window.clearTimeout(se.current),(V=K.current)==null||V.abort(),K.current=null}},[l]);const{cursor:de,refreshing:O}=F,Z=r.useMemo(()=>Mn(ce),[ce]),Se=r.useMemo(()=>nc(Z),[Z]),Ae=({session:D,children:G})=>{const X=j.expandedIds.has(D.id),V=k.get(D.id),R=V&&(V.status==="running"||V.updated>=D.updated)?{...D,...V}:D;return e.jsxs("div",{children:[e.jsxs("div",{className:"task-picker-session-row",children:[e.jsx(sc,{session:R,currentId:n,openIds:s,onChoose:i}),G.length>0&&e.jsx(Qr,{title:D.title,expanded:X,onToggle:()=>j.toggle(D.id)})]}),X&&G.length>0&&e.jsx("div",{className:"task-picker-session-children",role:"group","aria-label":`${D.title}的子会话`,children:G.map(Ae)})]},D.id)},ve=(D,G)=>{D(X=>{const V=new Set(X);return V.has(G)?V.delete(G):V.add(G),V})};return Ke.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],V=G.at(-1);D.shiftKey&&document.activeElement===X?(D.preventDefault(),V==null||V.focus()):!D.shiftKey&&document.activeElement===V&&(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(Wo,{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(fo,{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:ne,value:l,onChange:D=>h(D.target.value),placeholder:"搜索任务、目录或 Agent","aria-label":"搜索分屏任务"})]}),W&&e.jsxs("div",{className:"task-picker-error",role:"alert",children:[W,e.jsx("button",{type:"button",onClick:()=>void Te(l.trim(),le.current),children:"重试"})]}),e.jsxs("div",{className:"task-picker-list","aria-busy":!Z.length&&(te||O),children:[m==="list"?Z.map(Ae):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(Tr,{size:15,className:`task-picker-chevron${G?" is-collapsed":""}`,"aria-hidden":"true"}),e.jsx(Xt,{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 V=y.has(X.key);return e.jsxs("section",{className:`task-picker-folder-group${V?" is-collapsed":""}`,"aria-label":`${D.label} · ${X.label}`,children:[e.jsxs("button",{type:"button",className:"task-picker-folder-header","aria-expanded":!V,onClick:()=>ve(A,X.key),children:[e.jsx(Tr,{size:14,className:`task-picker-chevron${V?" is-collapsed":""}`,"aria-hidden":"true"}),e.jsx(go,{size:15,"aria-hidden":"true"}),e.jsx("span",{title:X.label,children:X.label}),e.jsx("small",{children:X.sessions.length})]}),!V&&e.jsx("div",{className:"task-picker-folder-items",children:X.sessions.map(Ae)})]},X.key)})})]},D.key)}),!te&&!O&&!Z.length&&!W&&e.jsx("p",{className:"task-picker-empty",children:"没有找到任务,试试其他关键词"}),(te||O)&&e.jsxs("p",{className:"task-picker-empty",role:"status",children:[e.jsx(bt,{size:16,className:"task-split-spinner"}),Z.length?"显示已有任务,正在后台更新…":"正在加载任务…"]}),de&&!O&&e.jsx("button",{className:"task-picker-more",type:"button",disabled:te,onClick:()=>void Te(l.trim(),!0),children:"加载更多任务"})]})]})}),document.body)}function ic({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=ba(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 j=(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,te;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 F=v.clientX-P.left,Q=v.clientY-P.top;_.target=((te=A.panes.find(M=>M.paneId!==_.source&&F>=M.rect.x&&F<M.rect.x+M.rect.width&&Q>=M.rect.y&&Q<M.rect.y+M.rect.height))==null?void 0:te.paneId)??null,y(M=>(M==null?void 0:M.source)===_.source&&M.target===_.target?M:{source:_.source,target:_.target})},onPointerUp:v=>j(v,!0),onPointerCancel:v=>j(v,!1),onLostPointerCapture:v=>j(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,xa(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 ac={"remote-desktop":wo,groups:pa,dashboard:$o,calendar:Ns,terminal:ya};function Rr({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(mo,{size:17,"aria-hidden":"true"}),e.jsx("span",{children:"选择任务"})]}),e.jsxs("button",{type:"button",onClick:s,children:[e.jsx(qo,{size:17,"aria-hidden":"true"}),e.jsx("span",{children:"新建会话"})]}),Object.keys(Ss).map(i=>{const c=ac[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 oc=r.lazy(()=>Ce(()=>import("./CalendarView-CS-OG-13.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]),import.meta.url)),cc=r.lazy(()=>Ce(()=>import("./CollaborationDashboard-DSZa3Cns.js"),__vite__mapDeps([12,1,2,13,14,15,16,17,4,18,5,19,20,21,22,8,23,24]),import.meta.url)),lc=r.lazy(()=>Ce(()=>import("./CollaborationPage-COyvllTJ.js"),__vite__mapDeps([25,1,2,26,27,28,4,23,29,19,21,22,15,13,30,31,9]),import.meta.url)),dc=r.lazy(()=>Ce(()=>import("./SessionDashboard-D868NjZ_.js"),__vite__mapDeps([32,1,2,23,33,34,20,19,35,21,22,4,8,29,10,36]),import.meta.url)),uc=r.lazy(()=>Ce(()=>Promise.resolve().then(()=>Bc),void 0,import.meta.url)),pc=r.lazy(()=>Ce(()=>import("./BrowserLivePanel-DxjgVXXK.js"),__vite__mapDeps([37,1,2,28,8,38,39,40,4]),import.meta.url)),fc=r.lazy(()=>Ce(()=>import("./TaskPaneTerminal-DTDU88Rr.js"),__vite__mapDeps([41,1,2,42,43,38,44]),import.meta.url)),hc=async(n,s)=>{var o;if(!((o=window.agentApi)!=null&&o.calendarOverview))throw new Error("当前服务不支持日历,请更新共享服务。");return window.agentApi.calendarOverview({from:n,to:s})};function gc({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(bo,{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(lc,{groupId:u.id,initialDiscussionId:u.discussionId},`${u.id}:${u.discussionId??""}`):n==="calendar"?e.jsx(oc,{loadOverview:hc}):n==="terminal"?e.jsx(fc,{paneId:s,active:d,focused:o}):n==="remote-desktop"&&dt()?e.jsx(pc,{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(uc,{}):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(cc,{cwd:i,onOpen:j=>y({id:j.id,title:j.name}),onViewDashboard:()=>m("dashboard")}):e.jsx(dc,{onOpenGroup:j=>y({id:j.group.id,title:j.group.name,discussionId:j.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 mc(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 wc({paneId:n,url:s,visible:o=!0,onFocus:i}){const c=ci(s),l=mc(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 bc='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 xc({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(()=>{}),j=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(()=>{j()},[j]),r.useEffect(()=>{if(!l||!c||!h.current)return;const w=h.current;let k=0;const v=()=>{const Q=w.getBoundingClientRect(),ce=Math.max(0,Q.left),te=Math.max(0,Q.top),M=Math.max(0,Math.min(window.innerWidth,Q.right)-ce),W=Math.max(0,Math.min(window.innerHeight,Q.bottom)-te),z=Array.from(document.querySelectorAll(bc)).some(ne=>{if(!ne.getClientRects().length||getComputedStyle(ne).visibility==="hidden")return!1;if(ne.matches('dialog[open], [aria-modal="true"]'))return!0;const se=ne.getBoundingClientRect();return se.left<ce+M&&se.right>ce&&se.top<te+W&&se.bottom>te}),K=u.current.visible&&u.current.state==="ready"&&w.getClientRects().length>0&&getComputedStyle(w).visibility==="visible"&&!w.closest('[inert], [aria-hidden="true"]')&&M>0&&W>0&&!z?{x:ce,y:te,width:M,height:W}: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 F=new MutationObserver(_);return F.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(),F.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"){j();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:()=>{j()},children:"重试"})]})})]})}function yc(n){return dt()?e.jsx(wc,{...n}):e.jsx(xc,{...n})}function vc({enabled:n,children:s,onFocusSession:o,onNavigateSession:i,onSessionCreated:c,onOpenCalendar:l,onSplitChange:h}){var Oe,et,ut,$t;const[m,f]=r.useState(!1),[d,u]=r.useState(null),[y,A]=r.useState(null),[j,w]=r.useState(null),[k,v]=r.useState(null),_=r.useRef(null),[P,F]=r.useState(!1),[Q,ce]=r.useState(null),[te,M]=r.useState({}),W=r.useRef(new Map),z=r.useRef(d);z.current=d;const K=r.useRef(m);K.current=m;const le=r.useRef(null),ne=r.useRef(0),se=r.useRef(!1),re=r.useRef(new Map),Te=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),Z=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 Ae=g=>{if(le.current)try{g?localStorage.setItem(le.current,Ta(g)):localStorage.removeItem(le.current)}catch{}};r.useEffect(()=>{if(!n||!m||!d)return;const g=window.setTimeout(()=>Ae(d),180);return()=>window.clearTimeout(g)},[n,m,d]),r.useEffect(()=>()=>{ne.current++,re.current.clear()},[]),r.useEffect(()=>{n||(Ae(z.current),ne.current++,re.current.clear(),se.current=!1,K.current=!1,f(!1),F(!1),M({}),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 C=Array.from(document.querySelectorAll(".task-content-picker button:not(:disabled)")),T=C[0],E=C[C.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,$;if(S.defaultPrevented||se.current||!K.current||!z.current||!dt()&&!((E=window.agentApi)!=null&&E.taskPageOpen))return;const C=($=S.detail)==null?void 0:$.url;if(typeof C!="string")return;const T=Aa(z.current,C);T&&(S.preventDefault(),re.current.delete(T.activePaneId),W.current.delete(T.activePaneId),M(H=>({...H,[T.activePaneId]:!1})),z.current=T,u(T),A(null))};return window.addEventListener(Ir,g),()=>window.removeEventListener(Ir,g)},[n,m]);const ve=r.useCallback(g=>{const S=z.current,C=S==null?void 0:S.panes.find(E=>E.id===g);if(!S||!C||S.activePaneId===g)return;const T={...S,activePaneId:g};z.current=T,u(T),A(E=>E?g:null),C.session&&(O.current=C.session.id,de.current.onFocusSession(C.session))},[]),D=(g,S,C)=>{const T=z.current;if(!T||!T.panes.some(H=>H.id===g))return;const E=T.panes.find(H=>{var oe;return((oe=H.session)==null?void 0:oe.id)===S.id&&H.id!==g});if(E){ve(E.id);return}const $=za(T,g,S,C);z.current=$,u($),T.activePaneId===g&&(O.current=S.id,de.current.onFocusSession(S))},G=async(g,S,C)=>{var E;if(!K.current||se.current)return;const T=++Te.current;if(re.current.set(g,T),C){M($=>({...$,[g]:!1})),D(g,C);return}M($=>({...$,[g]:!0})),ce(null);try{const $=await ms(S);return re.current.get(g)!==T||!K.current||!$.session||!((E=z.current)!=null&&E.panes.some(H=>H.id===g))?void 0:(D(g,$.session,$.initialHistory),$.session)}catch($){K.current&&re.current.get(g)===T&&ce($ instanceof Error?$.message:"无法更换任务")}finally{re.current.get(g)===T&&M($=>({...$,[g]:!1}))}};r.useEffect(()=>{if(!n||!m)return;const g=S=>{var H;const C=(H=S.detail)==null?void 0:H.sessionId,T=z.current;if(S.defaultPrevented||!C||!T||se.current||!K.current)return;S.preventDefault();const E=T.activePaneId,$=++Te.current;re.current.set(E,$),M(oe=>({...oe,[E]:!0})),ce(null),ms({id:C}).then(oe=>{if(!K.current||re.current.get(E)!==$||!oe.session||!z.current)return;const ye=Ea(z.current,E,oe.session,oe.initialHistory);z.current=ye,u(ye),ye.activePaneId===E&&(O.current=oe.session.id,de.current.onFocusSession(oe.session))}).catch(oe=>{K.current&&re.current.get(E)===$&&ce(oe instanceof Error?oe.message:"无法打开通知会话")}).finally(()=>{re.current.get(E)===$&&M(oe=>({...oe,[E]:!1}))})};return window.addEventListener(js,g),()=>window.removeEventListener(js,g)},[n,m]);const X=async(g=!1)=>{var C,T,E,$;const S=++ne.current;se.current=!0,w(null),v(null),re.current.clear(),M({}),K.current=!0,f(!0),F(!0),ce(null),A(null),O.current=Se.current.selectedSessionId;try{if(dt())le.current=`agentroam:web-task-split:v1:${window.location.origin}${window.location.pathname}`;else{const q=await window.sharedServiceApi.status(),be=((C=q.selected)==null?void 0:C.dataDir)??((T=q.selected)==null?void 0:T.instanceId);if(!be)throw new Error("请先连接 AgentRoam 服务");le.current=`agentroam:desktop-task-split:v1:${be}`}let H=g?null:z.current;if(!g&&!H)try{H=Na(JSON.parse(localStorage.getItem(le.current)||"null"))}catch{}if(!H){const q=await xt({action:"dashboard"});if(q.discoveryError)throw new Error(q.discoveryError);const be=[...new Map(q.agents.flatMap(Ne=>Ne.sessions).filter(Ne=>Ne.status!=="completed"&&Ne.status!=="failed").map(Ne=>[Ne.id,ws(Ne)])).values()],Be=Se.current.sessionSummary;!be.length&&Be&&be.push(Be);const Me=be.map(Ne=>({id:crypto.randomUUID(),session:Ne}));for(;Me.length<2;)Me.push({id:crypto.randomUUID(),session:null});H={panes:Me,layout:xr(Me.map(Ne=>Ne.id)),activePaneId:((E=Me.find(Ne=>{var Le;return((Le=Ne.session)==null?void 0:Le.id)===(Be==null?void 0:Be.id)}))==null?void 0:E.id)??Me[0].id}}const oe=await Promise.allSettled(H.panes.map(async q=>q.session?{...q,...await ms(q.session)}:q));if(S!==ne.current||!K.current)return;let ye=0;const ee=oe.map((q,be)=>q.status==="fulfilled"?q.value:(ye++,H.panes[be])),ie={...H,panes:ee};z.current=ie,u(ie);const ze=($=ee.find(q=>q.id===ie.activePaneId))==null?void 0:$.session;ze&&de.current.onFocusSession(ze),ye&&ce(`${ye} 个任务暂未加载完成,可在对应格重试或更换任务`)}catch(H){S===ne.current&&K.current&&ce(H instanceof Error?H.message:"无法打开任务分屏")}finally{S===ne.current&&K.current&&(se.current=!1,F(!1))}},V=()=>{var S,C;Ae(z.current),ne.current++,se.current=!1,re.current.clear(),M({}),F(!1),K.current=!1,f(!1),w(null),v(null),A(null);const g=(C=(S=z.current)==null?void 0:S.panes.find(T=>{var E;return T.id===((E=z.current)==null?void 0:E.activePaneId)}))==null?void 0:C.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||!z.current)return;O.current=g;const C=z.current.panes.find(T=>{var E;return((E=T.session)==null?void 0:E.id)===g});C?ve(C.id):G(z.current.activePaneId,S,S)},[n,m,P,s.props.selectedSessionId,s.props.sessionSummary,ve]),r.useEffect(()=>{Z.current!==s.props.focusComposerNonce&&(Z.current=s.props.focusComposerNonce,m&&(Ae(z.current),ne.current++,re.current.clear(),M({}),K.current=!1,f(!1),w(null),v(null)))},[s.props.focusComposerNonce,m]),!n)return s;const R=async g=>{const S=j;if(w(null),!m||S==="single"){de.current.onNavigateSession(ws(g));return}const C=z.current;if(!C||!S)return;const T=C.panes.find(H=>{var oe;return((oe=H.session)==null?void 0:oe.id)===g.id});if(T){ve(T.id);return}let E=S;if(S==="add"){const H=Pa(C,ws(g),crypto.randomUUID());z.current=H.state,u(H.state),A(null),E=H.paneId}const $=await G(E,g);$&&ro.getState().markViewed($.id,Date.now())},ue=g=>{var T;const S=z.current;if(!S)return;const C=Ma(S,g);if(C!==S){if(re.current.delete(g),M(E=>({...E,[g]:!1})),w(E=>E===g?null:E),v(E=>E===g?null:E),z.current=C,u(C),(!C||C.layout!==S.layout)&&(W.current.delete(g),A(E=>E===g?null:E)),!C){V();return}if(Ae(C),S.activePaneId===g){const E=(T=C.panes.find($=>$.id===C.activePaneId))==null?void 0:T.session;E&&(O.current=E.id,de.current.onFocusSession(E))}}},U=s.props,He=dt(),Ie=He&&window.parent!==window,Y=d==null?void 0:d.panes.find(g=>g.id===d.activePaneId),rt=((Oe=Y==null?void 0:Y.session)==null?void 0:Oe.agentType)??((et=Y==null?void 0:Y.draft)==null?void 0:et.agentType),je=(g,S)=>u(C=>C&&kr(C,g,S)),ke=(g,S)=>{var E;if(se.current)return;if(dt()&&S&&"surface"in S&&S.surface==="remote-desktop"){const $=(E=z.current)==null?void 0:E.panes.find(H=>H.id!==g&&H.surface==="remote-desktop");if($){v(null),ve($.id);return}}re.current.delete(g),W.current.delete(g),M($=>({...$,[g]:!1}));const C=z.current;if(!C)return;const T=yr(C,g,S);z.current=T,u(T),v(null)},Re=(g,S)=>{if(se.current)return;const C=z.current,T=C==null?void 0:C.panes.find(H=>H.surface===g);if(T){ve(T.id);return}const E=C==null?void 0:C.panes.find(H=>H.id===C.activePaneId),$=E&&vr(E)?E:C==null?void 0:C.panes.find(vr);if($)ke($.id,{surface:g});else if(S)S();else if(C){const H=br(C,crypto.randomUUID()),oe=yr(H,H.activePaneId,{surface:g});z.current=oe,u(oe),A(null)}},_e=g=>{var E,$,H;const S=z.current;if(se.current||!S)return;const C=Se.current;re.current.delete(g),W.current.delete(g),M(oe=>({...oe,[g]:!1}));const T=kr(S,g,{agentType:((E=C.sessionSummary)==null?void 0:E.agentType)??C.activeAgentType??"customer-agent",projectId:(($=C.sessionSummary)==null?void 0:$.projectId)??C.selectedProjectId??null,cwd:((H=C.sessionSummary)==null?void 0:H.cwd)??C.workspacePath??"",workspaceSource:C.workspaceSource},!0);z.current=T,u(T),v(null)},Wt=g=>{var oe,ye;const S=d==null?void 0:d.panes.find(ee=>ee.id===g);if(!S)return null;let C=W.current.get(g);C||(C=Ra(),W.current.set(g,C));const T=S.session,E=S.draft,$=S.surface?Ss[S.surface]:S.webUrl?"网页":(T==null?void 0:T.title)||(E?"新建会话":"空面板"),H=e.jsxs("div",{className:"task-pane-controls",children:[e.jsx("button",{type:"button",className:"ui-icon-button",onClick:ee=>{_.current=ee.currentTarget,v(g)},title:"切换面板内容","aria-label":"切换面板内容",children:e.jsx(Er,{size:15})}),e.jsx("button",{type:"button",className:"ui-icon-button",onClick:()=>A(ee=>ee===g?null:g),title:y===g?"恢复分屏":"放大此格","aria-label":y===g?"恢复分屏":"放大此格",children:y===g?e.jsx(La,{size:15}):e.jsx(Da,{size:15})}),e.jsx("button",{type:"button",className:"ui-icon-button",onClick:()=>ue(g),title:(oe=S.history)!=null&&oe.length?"关闭当前内容,返回上一项":"移除此格(任务继续运行)","aria-label":(ye=S.history)!=null&&ye.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":$,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:$}),H]}),S.surface?e.jsx(gc,{kind:S.surface,paneId:g,focused:(d==null?void 0:d.activePaneId)===g,cwd:U.workspacePath??void 0,active:!y||y===g,onOpenSession:ee=>{G(g,ee)},onNewSession:()=>_e(g),onChangeContent:()=>v(g),onViewAgent:()=>w(g),onSelectSurface:ee=>ke(g,{surface:ee})}):e.jsx(yc,{paneId:g,url:S.webUrl,visible:!y||y===g,onFocus:()=>ve(g)})]}):T||E?e.jsx(_a,{draft:E,onDraftChange:ee=>je(g,ee),children:r.cloneElement(s,{agentStore:C,desktopTaskPane:!0,desktopTaskOwnsSession:ee=>{var ze;if(!K.current)return!1;const ie=((ze=z.current)==null?void 0:ze.panes)??[];return ie.some(q=>{var be;return q.id===g&&((be=q.session)==null?void 0:be.id)===ee})||!ie.some(q=>{var be;return((be=q.session)==null?void 0:be.id)===ee})},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:Oa(S,U.initialSessionHistory),onToggleSidebar:void 0,onReplaceTask:()=>w(g),paneControls:H,headerAppActions:void 0,onOpenTaskSplit:void 0,onSelectAgent:void 0,onSelectWorkspace:void 0,onPickWorkspaceFolder:void 0,voiceCommand:(d==null?void 0:d.activePaneId)===g?U.voiceCommand:null,focusComposerNonce:E?1:void 0,onSelectSession:(ee,ie)=>{G(g,{id:ee},ie)},onSessionCreated:(ee,ie)=>{var ze,q;G(g,{id:ee},ie),ie&&((q=(ze=de.current).onSessionCreated)==null||q.call(ze,ie))},onParallelSessionSelected:ee=>{G(g,ee,ee)}})}):e.jsxs("div",{className:"task-pane-empty",children:[e.jsx("div",{className:"task-pane-empty-controls",children:H}),e.jsx(gs,{size:24,"aria-hidden":"true"}),e.jsx("p",{children:"选择这一列要展示的内容"}),e.jsx(Rr,{onTask:()=>w(g),onDraft:()=>_e(g),onSurface:ee=>ke(g,{surface:ee})}),e.jsx("small",{children:"消息中的网页链接也会在空面板中打开"})]}),te[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:[U.onToggleSidebar&&e.jsx("button",{className:"ui-icon-button",type:"button",onClick:U.onToggleSidebar,"aria-label":"切换任务侧栏",children:e.jsx(va,{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:()=>Re("calendar",l),title:"日历与待办","aria-label":"打开日历与待办",children:[e.jsx(Ns,{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&&br(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&&ka(g,()=>crypto.randomUUID()))},disabled:P||!d,title:"四列布局,空位会保留给新任务","aria-label":"四列布局","aria-pressed":(d==null?void 0:d.layoutMode)==="four-columns",children:[e.jsx(Mo,{size:16}),e.jsx("span",{children:"四列"})]}),e.jsx("button",{type:"button",onClick:()=>{A(null),u(g=>g&&{...g,layoutMode:void 0,layout:xr(g.panes.map(S=>S.id))})},disabled:P||!d,title:"重新等分","aria-label":"重新等分任务",children:e.jsx(Er,{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:V,title:"退出任务分屏","aria-label":"退出任务分屏",children:[e.jsx(Bo,{size:16,"aria-hidden":"true"}),e.jsx("span",{children:"退出分屏"})]})]}),U.onOpenSettings&&U.onHideToBackground&&U.onToggleAppearance&&e.jsx(Sa,{appActions:U.headerAppActions,appearanceOpen:!!U.appearanceOpen,settingsOpen:!!U.settingsOpen,showSettings:!He||rt==="customer-agent",onHideToBackground:U.onHideToBackground,onToggleAppearance:U.onToggleAppearance,onOpenSettings:U.onOpenSettings,onOpenSessionDashboard:Ie?void 0:()=>Re("dashboard",U.onOpenSessionDashboard),onOpenCollaborationDashboard:Ie?void 0:()=>Re("groups",U.onOpenCollaborationDashboard),onOpenDesktopLive:Ie?void 0:()=>Re("remote-desktop",U.onOpenDesktopLive),desktopLiveOpen:U.desktopLiveOpen,onToggleFiles:U.onToggleFiles,filesOpen:U.fileDrawerOpen,onOpenHub:U.onOpenHub})]}),Q&&e.jsxs("div",{className:"task-workspace-error",role:"alert",children:[e.jsx("span",{children:Q}),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(ic,{node:d.layout,renderPane:Wt,maximizedPaneId:y,onResize:(g,S)=>u(C=>C&&{...C,layout:Ia(C.layout,g,S)}),onSwap:(g,S)=>u(C=>{if(!C)return C;const T=ja(C.layout,g,S);if(T===C.layout)return C;const E=new Map(C.panes.map($=>[$.id,$]));return{...C,layout:T,panes:Ca(T).map($=>E.get($))}})})}):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")}),j&&e.jsx(rc,{currentId:j==="single"?U.selectedSessionId??void 0:($t=(ut=d==null?void 0:d.panes.find(g=>g.id===j))==null?void 0:ut.session)==null?void 0:$t.id,openIds:new Set(m?(d==null?void 0:d.panes.flatMap(g=>g.session?[g.session.id]:[]))??[]:[]),knownSessions:[...U.sessionSummary?[U.sessionSummary]:[],...(d==null?void 0:d.panes.flatMap(g=>g.session?[g.session]:[]))??[]].map(Jr),onChoose:g=>{R(g)},onClose:()=>w(null)}),m&&k&&Ke.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(Rr,{onTask:()=>{w(k),v(null)},onDraft:()=>_e(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(Xt,{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(Wa,{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(Ho,{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(yo,{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(xo,{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 kc(n){const s=Es(),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(""),[j,w]=r.useState(""),k=gn(),[v,_]=r.useState(null),[P,F]=r.useState(!1),[Q,ce]=r.useState(!1),[te,M]=r.useState(null),W=r.useRef(null),z=r.useRef(""),K=r.useRef(`${n.revision}:${n.runningSessionId}`),le=r.useRef({query:"",rows:(c==null?void 0:c.data)??[],cursor:null,expanded:!1}),ne=r.useRef(null),se=r.useRef(null),re=r.useRef(new Map),Te=r.useRef(null);n.pendingSession&&n.pendingSession.id!==Te.current&&(Te.current=n.pendingSession.id,re.current.set(n.pendingSession.id,Jr(n.pendingSession)),re.current.size>20&&re.current.delete(re.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 He,Ie;if(!Mt()||!R&&(W.current||!le.current.cursor)||W.current&&!W.current.signal.aborted&&z.current===j)return;R&&((He=W.current)==null||He.abort());const ue=new AbortController;W.current=ue,z.current=j;const U=le.current;if(F(!0),M(null),R&&U.query!==j){const Y=j?null:_n();le.current={query:j,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=ne.current;if((ke==null?void 0:ke.query)===j)Y=await ke.promise;else{const Re=xt({action:"sessionCatalog",query:j,limit:20,backgroundRefresh:!0},{signal:ue.signal}),_e={query:j,promise:Re};ne.current=_e;try{Y=await Re}finally{ne.current===_e&&(ne.current=null)}}if(ue.signal.aborted)return}else Y=await io(ke=>xt({action:"sessionCatalog",query:j,limit:20,cursor:ke},{signal:ue.signal}),ue.signal,U.cursor??void 0);for(const ke of Y.data)re.current.delete(ke.id);const rt=fn(Y),je=R&&U.query===j?Y.refreshing?{rows:Yt(U.rows,rt),cursor:U.cursor??Y.nextCursor}:ao(U,Y):{rows:R?rt:Yt(U.rows,rt),cursor:Y.nextCursor};if(le.current={query:j,...je,expanded:!R||U.query===j&&U.expanded},h(je.rows),f(Y.total),_(je.cursor),u(!1),R&&ce(Y.refreshing===!0),R&&!j&&!Y.refreshing){const ke=new Set(o.current);Jo({...Y,data:Y.data.filter(Re=>!ke.has(Re.id)),ancestors:(Ie=Y.ancestors)==null?void 0:Ie.filter(Re=>!ke.has(Re.id))})}R&&U.query!==j&&se.current&&(se.current.scrollTop=0)}catch(Y){ue.signal.aborted||(ce(!1),M(Y instanceof Error?Y.message:"会话加载失败"))}finally{W.current===ue&&(W.current=null,F(!1))}},[j]);r.useEffect(()=>{if(!s)return;const R=`${n.revision}:${n.runningSessionId}`,ue=K.current!==R;K.current=R,(ue||le.current.query!==j||!W.current)&&de(!0);const U=()=>{Mt()&&!W.current&&de(!0)},He=window.setInterval(U,15e3);return window.addEventListener("focus",U),()=>{var Ie;(Ie=W.current)==null||Ie.abort(),ne.current=null,window.clearInterval(He),window.removeEventListener("focus",U)}},[s,de,j,n.revision,n.runningSessionId]),r.useEffect(()=>{if(!s||!Q)return;const R=window.setInterval(()=>{de(!0)},2e3);return()=>window.clearInterval(R)},[s,Q,de]),r.useEffect(()=>{const R=se.current;s&&!P&&!te&&v&&R&&R.scrollTop>0&&R.scrollHeight-R.scrollTop-R.clientHeight<120&&de(!1)},[s,te,de,P,v]);const O=[...n.needsInput,...n.runningSessionId?[n.runningSessionId]:[]],Z=po(oo(l,[...re.current.values()],j),i,j),Se=co(Z,n.pinnedIds,O),Ae=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]),V=({session:R,children:ue})=>{const U=n.needsInput.includes(R.id)?"needs-input":n.runningSessionId===R.id?"running":R.status==="failed"?"error":R.status==="completed"?"idle":R.status,He=Dn(U),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:He,statusLabel:Rn[He],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:U!=="running"&&U!=="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:rt=>n.onDelete(R,rt)}),Y&&ue.length>0&&e.jsx("div",{className:"all-sessions-children",role:"group","aria-label":`${R.title}的子会话`,children:ue.map(V)})]},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:j?m:Math.max(m,Z.length)})]}),e.jsxs("div",{className:"sidebar-project-actions",children:[e.jsx("span",{className:"all-sessions-sort-label",children:"进行中优先"}),e.jsx(li,{loading:P,error:te,subject:"所有会话",onRefresh:()=>void de(!0)})]})]}),e.jsxs("div",{ref:se,className:"app-sidebar-scroll all-sessions-list","aria-label":"所有 Agent 会话","aria-busy":(P||Q)&&!d&&!G.length,onScroll:R=>{const ue=R.currentTarget;ue.scrollTop>0&&ue.scrollHeight-ue.scrollTop-ue.clientHeight<120&&de(!1)},children:[te&&e.jsxs("div",{role:"alert",className:"sidebar-load-error",children:[e.jsx("span",{children:te}),e.jsx("button",{onClick:()=>void de(!0),children:"重试"})]}),(P||Q)&&!G.length&&!d&&e.jsx("p",{className:"all-sessions-empty",role:"status",children:"正在加载所有会话…"}),(!P||d)&&!Q&&!te&&!G.length&&e.jsx("p",{className:"all-sessions-empty",children:Ae?"没有匹配的会话":"暂无会话,开始一个新任务吧"}),G.map(V),v&&e.jsx("button",{className:"all-sessions-more",disabled:P,onClick:()=>void de(!1),children:P?"正在加载…":"加载更早的会话"}),Q&&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 Sc({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 j=new IntersectionObserver(w=>{!w.some(k=>k.isIntersecting)||f.current===n||(f.current=n,d.current())},{root:A,rootMargin:"0px 0px 80px 0px"});return j.observe(y),()=>j.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 jc({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(vo,{size:15}),e.jsx("span",{children:l.name}),e.jsx(ko,{size:14})]},l.id))]})})}function Cc({onOpen:n}){var k,v,_;const s=Es(),[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()=>{}),j=r.useRef(new Set);r.useEffect(()=>{if(!s)return;let P=!0,F=!1;try{j.current=new Set(JSON.parse(localStorage.getItem("agentroam:supervision-notifications")??"[]"))}catch{}const Q=async()=>{if(!(F||!Mt())){F=!0;try{const te=await xt({action:"supervisionAlerts"});if(!P)return;i(te.filter(W=>W.incident.status==="waiting").map(W=>W.incident.id)),y(W=>W?te.find(z=>z.incident.id===W.incident.id&&z.incident.status==="waiting")??null:null);const M=te.filter(W=>!j.current.has(`${W.incident.id}:${W.incident.status}`));if(M.length){const W=M.at(-1);d(`${W.groupName} · ${W.incident.status==="waiting"?"需要你决策":W.incident.kind==="handoff"?"交接已衔接":W.incident.kind==="delivery"?"交付已确认":"异常已恢复"}`);const z=M.find(K=>K.incident.status==="waiting"&&K.target);z&&y(K=>K??z);for(const K of M)j.current.add(`${K.incident.id}:${K.incident.status}`);j.current=new Set([...j.current].slice(-300));try{localStorage.setItem("agentroam:supervision-notifications",JSON.stringify([...j.current]))}catch{}}}catch{}finally{F=!1}}};A.current=Q,Q();const ce=setInterval(()=>{Q()},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(_o,{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(ho,{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,F)=>{await xt({action:"answerSupervision",groupId:u.incident.groupId,incidentId:u.incident.id,answer:P,selectedIndices:F}),y(null),d(""),await A.current()}})]})]})}function Ic(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:hn(l)?l:s,explicit:!!(i||o.get("newSession")==="1"||hn(l))}}function Tc(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 Ac(n,s,o,i){o.throwIfAborted();const c=await n.getSession(s.id,s.agentType==="codex"?{limit:Sr,view:"core"}:{limit:Sr},{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(F=>F.agentType===s.agentType))??[],sessions:(i==null?void 0:i.sessions.filter(F=>F.agentType===s.agentType&&F.id!==s.id))??[]},m=i==null?void 0:i.sessions.find(F=>F.id===s.id),f=c.projectId??(m==null?void 0:m.projectId)??s.projectId,d=()=>h.workspaces.find(F=>F.workspaceId===f)??h.workspaces.find(F=>F.roots.includes(c.cwd||s.cwd));let u=d(),y=null;const A=new Set;for(;!u;){const F=await n.listAgentWorkspaces(s.agentType,{cursor:y,limit:200});if(o.throwIfAborted(),F.stale)throw new Error("会话目录待刷新,请重试");if(h.workspaces=[...new Map([...h.workspaces,...F.data].map(Q=>[Q.workspaceId,Q])).values()],u=d(),y=F.nextCursor,u||!y)break;if(A.has(y))throw new Error("会话目录加载中断,请重试");A.add(y)}const j=(u==null?void 0:u.workspaceId)??f??`session-${c.id}`;u||h.workspaces.push({agentType:s.agentType,workspaceId:j,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:j};return h.sessions.push(P),{session:P,snapshot:h,initialHistory:{sessionId:P.id,detail:c}}}function Ec({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"]),Nc=new Set(["checking",...di]),Pc=6e3,Rc=24e3;function Lc(){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 j=window.setTimeout(()=>{y.checkForUpdate().then(k=>{u&&s(k)}).catch(()=>{})},Pc+Math.floor(Math.random()*(Rc+1)));return()=>{u=!1,window.clearTimeout(j),A()}},[]),r.useEffect(()=>{if(!n||!Nc.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(To,{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 Dc(){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 Ps(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 _c(n){return Ps(n,(s,o)=>o.created.localeCompare(s.created))}function Cs(n,s){return s==="codex"?[...n]:_c(n)}function Is(n,s){return Ps(n,(o,i)=>Number(s(i))-Number(s(o)))}function Oc(n,s){return Ps(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 Lr(n,s){return{projectId:Ts(n),sessionId:Ts(s)}}function zc(n){return n.agentType==="customer-agent"?`确定永久删除会话“${n.title}”吗?此操作不可恢复。`:n.agentType==="codex"?`确定归档 Codex 会话“${n.title}”并从 AgentRoam 中移除吗?可在 Codex 的已归档会话中恢复。`:`确定从 AgentRoam 中移除会话“${n.title}”吗?原生客户端中的历史记录会保留。`}function Mc(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 Wc(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 $c(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:Wc(n,c),childSessionsByParent:h,otherLocalSessions:o.filter(m=>!l.has(m.id)),removedIds:c}}const Hc={fontSize:13,fontWeight:600,color:"var(--text-secondary)",textTransform:"uppercase",letterSpacing:"0.06em",marginBottom:14},Dr={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 Q=await s.desktopLiveRecheck();v&&c(Q)}catch{}finally{_=!1}}};window.addEventListener("focus",P);const F=i!=null&&i.enabled&&(i.permissionScreen!=="granted"||i.accessibilityTrusted!==!0)?window.setInterval(P,3e3):void 0;return()=>{v=!1,window.removeEventListener("focus",P),F&&window.clearInterval(F)}},[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 j=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:Hc,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 j(),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:Dr,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:Dr,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 Bc=Object.freeze(Object.defineProperty({__proto__:null,default:ui},Symbol.toStringTag,{value:"Module"}));function Fc({onClose:n}){const s=r.useRef(null);return r.useEffect(()=>{var o;(o=s.current)==null||o.showModal()},[]),Ke.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 qc({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?Ke.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 Vc={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 Uc(n){let s=n.kind;return n.kind==="todo_execution"&&(n.title==="定时待办执行未完成"?s="todo_error":(n.title==="定时待办错过执行"||n.title==="定时待办需要核实")&&(s="todo_attention")),{type:s,...Vc[s]}}function _r(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 Kc={completion:Ha,approval:Fo,todo_reminder:Do,todo_execution:Oo,todo_attention:zo,todo_error:$a},Gc=new Set(["会话已完成","会话完成","任务完成","任务已完成","运行已结束","运行结束","已完成"]);function Yc({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}=Uc(c),m=Kc[l],f=_r(c.title,100)||h,d=c.kind!=="completion"||!Gc.has(f.replace(/[\s。.!!::]+/g,"")),u=_r(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 Or="agentroam.notification-read-pending.v1";function zr(n){if(!n.serviceId||!n.ownerId)throw new Error("通知来源缺失");return JSON.stringify([n.serviceId,n.ownerId])}function Xc(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 Jc{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(Or))??"{}");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(Or,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=zr(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)&&Xc(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(zr(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 Qc(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 Jc({list:async()=>await window.agentApi.notificationList(),read:(A,j)=>window.agentApi.notificationRead(A,j)},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 Zc=[{value:"classic",description:"横向切换 Agent,按目录浏览"},{value:"agent-rail",description:"竖向 Agent 栏,聚焦当前工作区"},{value:"all-sessions",description:"汇总所有 Agent 的会话"}],el=typeof window>"u"?r.useEffect:r.useLayoutEffect;function tl({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=Ee(u=>u.navigationLayout),s=Ee(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();el(()=>{var y,A;if(!o)return;const u=()=>{var v;const j=(v=h.current)==null?void 0:v.getBoundingClientRect();if(!j||!m.current)return;const{offsetWidth:w,offsetHeight:k}=m.current;l({top:Math.max(8,Math.min(j.bottom+8,window.innerHeight-k-8)),left:Math.max(8,Math.min(j.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 j,w;const A=y.target;!((j=h.current)!=null&&j.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),j=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;j!==null&&(u.preventDefault(),(v=y[j])==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(Vo,{size:18,"aria-hidden":"true"})}),o&&Ke.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:"侧栏布局"}),Zc.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(tl,{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(Ao,{size:16,"aria-hidden":"true"})]},u.value))]}),document.body)]})}function nl({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(Xt,{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 sl(n,s,o){async function i(u){const y=[],A=new Set;let j=null;do{o.throwIfAborted();const w=await u(j);if(o.throwIfAborted(),w.stale)throw new Error("会话列表待刷新,请重试");if(y.push(...w.data),j=w.nextCursor,j&&A.has(j))throw new Error("会话列表加载中断,请重试");j&&A.add(j)}while(j);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 rl({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,j]=r.useState(!1),[w,k]=r.useState(null),[v,_]=r.useState(""),P=gn(),[F,Q]=r.useState(0),ce=r.useRef(),te=r.useRef(null),M=r.useRef(new Map),W=()=>clearTimeout(ce.current),z=()=>{W(),d(null)},K=()=>{W(),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(M.current.get(f.agentType)??null),k(null),j(!0),sl(window.agentApi,f.agentType,O.signal).then(Z=>{O.signal.aborted||(M.current.set(f.agentType,Z),y(Z))}).catch(Z=>{O.signal.aborted||k(Z instanceof Error?Z.message:"会话加载失败,请重试")}).finally(()=>{O.signal.aborted||j(!1)}),()=>O.abort()},[f==null?void 0:f.agentType,le,n,F]);const ne=Is((u==null?void 0:u.sessions)??[],O=>{const Z=c(O);return Z==="running"||Z==="needs-input"}),se=v.trim().toLocaleLowerCase(),re=Mn(se?zn(ne.filter(O=>O.title.toLocaleLowerCase().includes(se)),ne):ne),Te=({session:O,children:Z})=>{const Se=Dn(c(O)),Ae=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:Ae},onToggleChildren:Z.length?()=>P.toggle(O.id):void 0,onSelect:()=>{u&&m(O,u),z()}}),Ae&&Z.length>0&&e.jsx("div",{className:"sidebar-session-children",role:"group","aria-label":`${O.title}的子会话`,children:Z.map(Te)})]},O.id)},de=O=>{var Se;const Z=O.relatedTarget;!O.currentTarget.contains(Z)&&!((Se=te.current)!=null&&Se.contains(Z))&&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:W,onPointerLeave:K,onBlur:de,onKeyDown:O=>{O.key==="Escape"&&z()},children:e.jsx(Kr,{vertical:!0,value:s,health:o,onChange:l,onPreview:(O,Z,Se)=>{W(),(f==null?void 0:f.agentType)!==O&&(y(null),P.collapseAll()),d({agentType:O,label:Z,top:Math.max(56,Math.min(Se.top,window.innerHeight-380))})}})}),!n&&le&&f&&Ke.createPortal(e.jsxs("div",{ref:te,className:"agent-session-flyout",style:{top:f.top,maxHeight:Math.min(600,window.innerHeight-f.top-12)},role:"dialog","aria-label":`${f.label} 会话`,onPointerEnter:W,onPointerLeave:K,onFocus:W,onBlur:de,onKeyDown:O=>{O.key==="Escape"&&z()},children:[e.jsxs("header",{children:[e.jsx(Xt,{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),z()},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:[re.map(Te),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:()=>Q(O=>O+1),children:"重试"})]}),!A&&!w&&!re.length&&e.jsx("p",{className:"agent-session-flyout-message",children:v?"没有匹配的会话":"暂无会话"})]})]}),document.body)]})}function Mr({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(Ns,{size:17,"aria-hidden":"true"})})})}const vs=264,Wr=126;function il(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+Wr<=o-8?c:Math.max(8,n.top-Wr-7);return{left:i,top:l,width:vs}}function $r({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:il(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 al({message:n,type:s}){return n?Ke.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 ol(){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 cl(){return ol()!==null||fi()!==null}function ll(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 dl(n){return n.startsWith("/")||/^[A-Za-z]:[\\/]/.test(n)||/^\\\\[^\\/]+[\\/][^\\/]+/.test(n)}function ul(n,s){if(s.webShell||s.isInvalid||!s.supported)return null;const o=n.description;return!o||/[\0\r\n]/.test(o)||!dl(o)?null:o}function pl(n){return{request:(s,o)=>n.fileWorkspaceRequest(s,o),subscribe:(s,o)=>s!=="fs:event"?()=>{}:n.onFileWorkspaceEvent(o)}}function fl({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 hl(n,s){const o=new Set;n&&o.add(n);for(const i of s)i&&o.add(i);return[...o]}function gl(n,s,o){return[...n].filter(i=>!s.has(i)&&!o.has(i))}const Hr=220,Br=480,ml=180;function wl(){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<=ml;i(_),s(_?k.startWidth:Math.min(Br,Math.max(Hr,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(Br,Math.max(Hr,k+(w.key==="ArrowLeft"?-20:20)))))},[]),j=r.useCallback(()=>i(w=>!w),[]);return{width:n,collapsed:o,dragging:c,toggle:j,resizeProps:{onPointerDown:m,onPointerMove:f,onPointerUp:y,onPointerCancel:u,onLostPointerCapture:u,onKeyDown:A}}}const bl=r.lazy(()=>Ce(()=>import("./CollaborationDashboard-DSZa3Cns.js"),__vite__mapDeps([12,1,2,13,14,15,16,17,4,18,5,19,20,21,22,8,23,24]),import.meta.url)),xl=r.lazy(()=>Ce(()=>import("./SessionDashboard-D868NjZ_.js"),__vite__mapDeps([32,1,2,23,33,34,20,19,35,21,22,4,8,29,10,36]),import.meta.url)),yl=r.lazy(()=>Ce(()=>import("./CollaborationPage-COyvllTJ.js"),__vite__mapDeps([25,1,2,26,27,28,4,23,29,19,21,22,15,13,30,31,9]),import.meta.url)),vl=r.lazy(()=>Ce(()=>import("./AIHubView-4kqTaPjO.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)),kl=r.lazy(()=>Ce(()=>import("./CalendarView-CS-OG-13.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]),import.meta.url)),Sl=async(n,s)=>{const o=window.agentApi;if(!(o!=null&&o.calendarOverview))throw new Error("当前服务不支持日历,请更新共享服务。");return o.calendarOverview({from:n,to:s})},jl=r.lazy(()=>Ce(()=>import("./SettingsPanel-DoDRBreZ.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)),Cl=r.lazy(()=>Ce(()=>import("./MCPServerList-w7tetX3J.js"),__vite__mapDeps([54,1,2]),import.meta.url)),Il=r.lazy(()=>Ce(()=>import("./MemoryViewer-Xac9EeaV.js"),__vite__mapDeps([55,1,2]),import.meta.url)),Tl=r.lazy(()=>Ce(()=>import("./SkillManager-Da7bpT-s.js"),__vite__mapDeps([56,1,2]),import.meta.url)),Al=r.lazy(()=>Ce(()=>import("./AgentManager-CDgiLqF_.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)),El=r.lazy(()=>Ce(()=>import("./LSPServerList-fkagcDVv.js"),__vite__mapDeps([58,1,2]),import.meta.url)),Nl=r.lazy(()=>Ce(()=>import("./FileWorkspaceDrawer-ByWXnJ0B.js"),__vite__mapDeps([59,1,2,60,26,40,28,18,9,48,4,61,62,17,6,8,5]),import.meta.url));function Fr(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 Pl(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 qr(){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 Vr(n,s){s&&n.detail>0&&n.currentTarget.blur()}function Rl(){const n=document.activeElement;n instanceof HTMLElement&&(n.matches("input, textarea, select")||n.isContentEditable)&&n.blur()}function Ll(){var cr,lr,dr,ur;const[n]=r.useState(Ba),[s]=r.useState(()=>Ic(typeof window>"u"?"":window.location.search,n.activeAgent)),o=s.agentType,i=n.agents[o]??bs(),[c]=r.useState(()=>Fr(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),[j,w]=r.useState(i.watermark),[k,v]=r.useState(!1),[_,P]=r.useState(!1),[F,Q]=r.useState(null),[ce,te]=r.useState(!1),[M,W]=r.useState(c.roots),[z,K]=r.useState(""),[le,ne]=r.useState(!1),[se,re]=r.useState(null),[Te,de]=r.useState(!1),[O,Z]=r.useState(null);r.useEffect(()=>{if(!le||!window.agentApi)return;let t=!1;return de(!0),Z(null),window.agentApi.listSessions().then(a=>{t||re({agentType:h,sessions:a})}).catch(a=>{t||Z(a instanceof Error?a.message:"会话搜索加载失败")}).finally(()=>{t||de(!1)}),()=>{t=!0}},[le,h]);const[Se,Ae]=r.useState(10),[ve,D]=r.useState(null),[G,X]=r.useState(!1),[V,R]=r.useState(null),[ue,U]=r.useState(!1),[He,Ie]=r.useState(0),[Y,rt]=r.useState([]),[je,ke]=r.useState([]),Re=Es(),[_e,Wt]=r.useState(c.children),Oe=r.useRef(M),et=r.useRef(_e);Oe.current=M,et.current=_e;const[ut,$t]=r.useState(c.projectIds),[g,S]=r.useState(new Set),[C,T]=r.useState({}),[E,$]=r.useState(new Set),[H,oe]=r.useState(Object.fromEntries(Object.entries(i.sessions).map(([t,a])=>[t,a.nextCursor]))),ye=r.useRef(new Map),ee=r.useRef(new Map),[ie,ze]=r.useState(i.selectedWorkspaceId),[q,be]=r.useState(()=>s.explicit||Ee.getState().navigationLayout==="all-sessions"?null:i.selectedSessionId),[Be,Me]=r.useState(null),Ne=r.useRef(null);Ne.current=Be;const[Le,hi]=r.useState(null),vt=r.useRef(null),Rs=r.useRef(0);vt.current=Le;const mn=r.useCallback(async()=>{const t=++Rs.current;try{const a=await Fa();return t!==Rs.current?vt.current:(vt.current=a,hi(a),a)}catch{return vt.current}},[]);r.useEffect(()=>{mn();let t=!1;const a=()=>{!Mt()||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(!q)return;const t=Le==null?void 0:Le.get(q);if(!t||t.currentSessionId===q)return;const a=An(t);a&&(Me(a),Jt(void 0),be(a.id))},[Le,q]);const Ge=r.useRef(ie),tt=r.useRef(q);Ge.current=ie,tt.current=q;const $n=gn(),Hn=gn(),[pt,kt]=r.useState(new Set(i.expandedWorkspaceIds)),[St,Ls]=r.useState(new Set),[Ds,wn]=r.useState(!1),[_s,Os]=r.useState(!1),[Ht,jt]=r.useState(!1),[Bt,nt]=r.useState(!1),[gi,zs]=r.useState(),[mi,Ms]=r.useState(0),Bn=()=>{jt(!1),zs(void 0),Ms(t=>t+1),nt(!0)};r.useEffect(()=>{var x,I;let t=0;const a=N=>{var J;if(!N.taskId&&!N.sessionId)return;const B=++t;if(Je(!1),Xe(!1),Ye(null),jt(!1),N.taskId)(J=We.current)==null||J.abort(),We.current=null,it.current=null,Tt(null),zs(N.taskId),nt(!0),Ms(pe=>pe+1);else if(N.sessionId){if(nt(!1),Yo(N.sessionId))return;window.agentApi.getSession(N.sessionId,{limit:1}).then(pe=>{if(B!==t)return;const he=pe;Qe.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(()=>{nt(!1)},[q,ie]);const[Ws,Fn]=r.useState([]),[Fe,Ye]=r.useState(null),[Ct,Xe]=r.useState(!1),[$s,qn]=r.useState(!1),[It,Je]=r.useState(!1),[Hs,bn]=r.useState(!1);r.useEffect(()=>{var t,a;(a=(t=window.agentApi)==null?void 0:t.setNotificationVisible)==null||a.call(t,{sessionId:!Bt&&!Ht&&!It&&!Ct&&!Fe?q??void 0:void 0})},[q,Bt,Ht,It,Ct,Fe]);const[wi,bi]=r.useState(0),[xi,yi]=r.useState(!1),[vi,Jt]=r.useState(),[Qt,Tt]=r.useState(null),Zt=r.useRef(null),[ki,Si]=r.useState({}),Qe=r.useRef(()=>{}),We=r.useRef(null),it=r.useRef(null),ji=r.useCallback((t,a)=>{const p=it.current;!p||p.sessionId!==t||p.seed!==a||We.current!==p.controller||p.controller.signal.aborted||(it.current=null,We.current=null,Tt(null),window.parent!==window&&window.parent.postMessage({type:So,sessionId:t},window.location.origin))},[]),Ci=r.useRef(`${Date.now()}-${Math.random().toString(36).slice(2)}`),Vn=Hs||$s||Ws.length>0,Un=()=>{if(nt(!1),dt()&&window.parent!==window){window.parent.postMessage({type:pn,intent:{kind:"dashboard"}},window.location.origin);return}bn(!0),Je(!0),Xe(!1),Ye(null)},Kn=()=>{nt(!1),qn(!0),Xe(!0),Ye(null),Je(!1)},[Ii,Gn]=r.useState(!1),[Bs,Fs]=r.useState(0),xn=t=>{dt()&&window.parent!==window?window.parent.postMessage({type:Co,groupId:t.id,title:t.name},window.location.origin):(Je(!1),Xe(!1),Fn(a=>a.some(p=>p.id===t.id)?a:[...a,t]),Ye(t.id))},[At,Ti]=r.useState("settings"),qs=Gt(t=>t.setTodos),en=Ee(t=>t.skin),at=Ee(t=>t.layout),Ft=Ee(t=>t.navigationLayout),Ze=Ft==="all-sessions",Et=Ee(t=>t.wakeEnabled),Nt=Ee(t=>t.wakeWord),Ai=Ee(t=>t.setSkin),tn=Ee(t=>t.setLayout),Ei=Ee(t=>t.setWakeEnabled),Ni=Ee(t=>t.setWakeWord),ft=Ee(t=>t.runningFirst),Pi=Ee(t=>t.setRunningFirst),Vs=Ee(t=>t.pinnedSessionIds),Yn=Ee(t=>t.togglePinnedSession),Ri=Ee(t=>t.removePinnedSessions),nn=new Set(Vs),Xn=Gt(t=>t.runningSessionId),Jn=Gt(Go(t=>Object.entries(t.messagesBySession).filter(([,a])=>lo(a)).map(([a])=>a))),sn=r.useCallback((t,a=t.projectId)=>fl({authoritativeStatus:t.status,locallyRunning:Xn===t.id,needsInput:Jn.includes(t.id),stale:!!(t.agentType===h&&a&&(E.has(a)||C[a]))}),[h,C,Xn,Jn,E]),Us=r.useCallback(t=>{const a=sn(t);return a==="running"||a==="needs-input"},[sn]),Li=()=>{kt(new Set),$n.collapseAll()},Di=()=>{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(qe.current.has(b))continue;const x=mt.current.has(b),I=Pl(f.current,p,x);Ve(b,{refresh:I,background:x})}},me=dt(),qt=Qc(!me);r.useEffect(()=>{if(!me||window.parent===window)return;const t=a=>{Io(a,window.location.origin,window.parent)&&Gn(!0)};return window.addEventListener("message",t),()=>window.removeEventListener("message",t)},[me]);const _i=fa(),Oi=ha(),xe=me&&_i,[Pt,ot]=r.useState(!1),[rn,Qn]=r.useState(!1),[zi,Zn]=r.useState("files"),[Ks,es]=r.useState(null),[Mi,Gs]=r.useState(null),ct=r.useMemo(()=>{var t;return!me&&typeof((t=window.agentApi)==null?void 0:t.fileWorkspaceRequest)=="function"?pl(window.agentApi):null},[me]),Wi=r.useCallback(async t=>{if(me){No(t);return}if(ct){if(t.startsWith("~/")){const{home:a}=await ct.request("hello"),p=Po(t,null,a);if(!p)return;t=p}Zn("files"),Qn(!0),es(t),Gs(a=>Ro(t)?null:{path:t,requestId:((a==null?void 0:a.requestId)??0)+1})}},[ct,me]);r.useEffect(()=>{es(null),Gs(null)},[ie]);const[yn,ts]=r.useState(!1),[vn,Ys]=r.useState(null),[$i,Xs]=r.useState(0),[Hi,Js]=r.useState(void 0),ht=r.useRef(null),Rt=r.useRef(!1),[Bi,Qs]=r.useState(null),Vt=r.useRef(null),ns=r.useRef(!1),gt=r.useRef(d);gt.current=d;const ss=r.useRef(St);ss.current=St;const mt=r.useRef(ut);mt.current=ut;const qe=r.useRef(g);qe.current=g;const an=r.useRef(null);r.useEffect(()=>{document.documentElement.setAttribute("data-skin",en)},[en]),r.useEffect(()=>{document.body.classList.toggle("layout-compact",at==="compact")},[at]),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:Cr(M[x.id]??[],_e),nextCursor:H[x.id]??null,loaded:ut.has(x.id)}])),p={...l.current,version:2,activeAgent:h,agents:{...l.current.agents,[h]:{workspaces:t,nextCursor:y,watermark:j,expandedWorkspaceIds:[...pt],selectedWorkspaceId:ie,selectedSessionId:q,sidebarScrollTop:((b=an.current)==null?void 0:b.scrollTop)??0,sessions:a}}};l.current=p,jr(p)},[h,_e,pt,ut,d,ie,q,H,M,y,j]);const kn=r.useCallback(()=>{if(!window.agentApi||!Et||Rt.current||ht.current)return;const t=()=>{cl()&&!ht.current&&(ht.current=ll({wakeWord:Nt,onWake:a=>{var p;Js(a),Xs(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,Js(a),Xs(p=>p+1)})},[]),r.useEffect(()=>{var t;if((t=window.agentApi)!=null&&t.onWakeAiHub)return window.agentApi.onWakeAiHub(()=>{nt(!1),jt(!0),tn("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=Vt.current&&Date.now()<Vt.current.until?Vt.current:null;if(b){b.until=Date.now()+9e4,be(b.sessionId),(I=window.agentApi)==null||I.wakeConversation(!0),Qs({text:p,projectId:null,sessionId:b.sessionId,nonce:Date.now()}),fe(`语音追问:${p.length>40?p.slice(0,40)+"…":p}`),Pe("success"),setTimeout(()=>fe(null),4e3);return}const x=gt.current.find(N=>N.name&&p.includes(N.name)&&!ss.current.has(N.id));x&&(ze(x.id),kt(N=>{const B=new Set(N);return B.add(x.id),B})),be(null),ns.current=!0,Qs({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})`:""}`),Pe("success"),setTimeout(()=>fe(null),4e3)})},[]);const Fi=r.useCallback(async()=>{window.agentApi&&(kn(),await window.agentApi.hideWindow())},[kn]),qi=r.useCallback(t=>{wn(!1),Ys({right:t.right,bottom:t.bottom}),ts(a=>!a)},[]),Vi=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();Ys(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)}},[at,yn]),r.useEffect(()=>{window.agentApi&&kn()},[kn]),r.useEffect(()=>{const t=()=>{var a;(a=ht.current)==null||a.stop(),ht.current=null};return window.addEventListener("focus",t),()=>window.removeEventListener("focus",t)},[]),r.useEffect(()=>{var t,a;Et||((t=ht.current)==null||t.stop(),ht.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=ht.current)==null||t.stop()},[]);const Ui=[...Object.values(M).flat(),...Object.values(_e).flat()],Zs=qa((se==null?void 0:se.agentType)===h?se.sessions:[],Ui,h).map(t=>{var a;return{...t,projectId:t.projectId??((a=d.find(p=>p.description===t.cwd))==null?void 0:a.id)}}),rs=Oc(Zs,t=>nn.has(t.id)),Ki=Object.entries(M).flatMap(([t,a])=>a.filter(p=>nn.has(p.id)).map(p=>({projectId:t,session:p,created:p.created}))),er=Cs(Ki,h),tr=ft?Is(er,({session:t})=>Us(t)):er,Gi=Zs,Yi=r.useMemo(()=>Object.fromEntries(Object.entries(M).map(([t,a])=>[t,Va(a,Le)])),[M,Le]),wt=z.trim().toLowerCase(),on=wt?rs.filter(t=>t.title.toLowerCase().includes(wt)||(t.cwd||"").toLowerCase().includes(wt)):null,cn=le?Mn(on?zn(on,rs):rs):[],Lt=q?Gi.find(t=>t.id===q)??((Be==null?void 0:Be.id)===q?Be:void 0)??(Le!=null&&Le.get(q)?An(Le.get(q)):void 0):void 0,Xi=Lt==null?void 0:Lt.title,Ut=(Lt==null?void 0:Lt.cwd)||((cr=d.find(t=>t.id===ie))==null?void 0:cr.description)||null,is=d.filter(t=>!St.has(t.id)).map(t=>t.id),Ji=[...d.filter(t=>!St.has(t.id)),...d.filter(t=>St.has(t.id))],Dt=is.length>0&&is.every(t=>!pt.has(t)),{width:Sn,collapsed:Kt,dragging:as,toggle:jn,resizeProps:Qi}=wl(),_t=!xe&&(Kt||at==="focus"),[Zi,fe]=r.useState(null),[ea,Pe]=r.useState("success"),De=t=>{var b;nt(!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},Me(p)),Ge.current=t.projectId,tt.current=t.sessionId,ze(t.projectId),be(t.sessionId),t.sessionId||qs([])},Ot=(t,a=!1)=>{var B;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:((B=an.current)==null?void 0:B.scrollTop)??b.sidebarScrollTop}}});const x=l.current.agents[t]??bs(),I=Fr(x.sessions,t),N=x.workspaces.map(ks);f.current=t,gt.current=N,m(t),u(N),A(x.nextCursor),w(x.watermark),v(!1),P(!1),Q(null),Oe.current=I.roots,et.current=I.children,W(I.roots),Wt(I.children),$t(I.projectIds),mt.current=I.projectIds,S(new Set),qe.current=new Set,T({}),$(new Set),oe(Object.fromEntries(Object.entries(x.sessions).map(([J,pe])=>[J,pe.nextCursor]))),kt(new Set(x.expandedWorkspaceIds)),Ls(new Set),De({projectId:x.selectedWorkspaceId,sessionId:x.selectedSessionId}),window.requestAnimationFrame(()=>{an.current&&(an.current.scrollTop=x.sidebarScrollTop)}),Ze||st(t,{refresh:x.workspaces.length>0,since:x.watermark,refreshLoadedSessions:!Ze})},ln=(t,a)=>{var pe,he;(pe=We.current)==null||pe.abort(),We.current=null,it.current=null,Tt(null),Jt(void 0);const p=t??f.current,b=Ut;p!==f.current&&Ot(p);const x=l.current.agents[p],I=(x==null?void 0:x.workspaces)??[],N=b?I.find(L=>{var ge;return L.canCreateSession!==!1&&((ge=L.roots)==null?void 0:ge.includes(b))}):void 0,B=x!=null&&x.selectedWorkspaceId&&I.some(L=>L.canCreateSession!==!1&&L.workspaceId===x.selectedWorkspaceId)?x.selectedWorkspaceId:void 0,J=a??(N==null?void 0:N.workspaceId)??B??((he=I.find(L=>L.canCreateSession!==!1))==null?void 0:he.workspaceId)??null;Zt.current=a||N||!b?null:{agentType:p,preferredPath:b},De({projectId:J,sessionId:null}),Gt.setState({sessionId:null,messages:[]}),Je(!1),bn(!1),Xe(!1),Ye(null),jt(!1),at==="focus"&&tn("standard"),bi(L=>L+1),xe&&ot(!1)};r.useEffect(()=>{const t=Zt.current;if(!t)return;if(q!==null){Zt.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&&(Zt.current=null,a.id!==ie&&De(En(a.id)))},[h,d,ie,q]);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(B=>B.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),Je(!1),Xe(!1),Ye(null),xe&&ot(!1)};Qe.current=t=>{var p;if(me&&window.parent!==window&&["dashboard","groups","group"].includes(t.kind)){window.parent.postMessage({type:pn,intent:t},window.location.origin);return}(p=We.current)==null||p.abort(),it.current=null;const a=new AbortController;We.current=a,Tt(t.kind==="session"?t.session:null),t.kind==="session"&&(Je(!1),Xe(!1),Ye(null),jt(!1),xe&&ot(!1)),(async()=>{if(t.kind==="dashboard"){Un();return}if(t.kind==="groups"){Kn();return}if(t.kind==="new-session"){ln();return}if(t.kind==="group"){const he=t.discussionId,L=await xt({action:"group",groupId:t.groupId});Si(ge=>({...ge,[L.id]:he})),xn(L);return}if(t.kind==="session"){const he=vt.current,L=he==null?void 0:he.get(t.session.id),ge=L?An(L):void 0;ge&&(t={...t,session:{...t.session,...ge}})}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=wr(b,x);if(I)throw new Error(I);if(t.kind==="agent"){Ot(t.agentType),Je(!1),Xe(!1),Ye(null),K(""),ne(!1),at==="focus"&&tn("standard"),Kt&&jn(),xe&&ot(!0);return}const N=l.current.agents[t.session.agentType],B=N?{workspaces:N.workspaces,sessions:Object.values(N.sessions).flatMap(he=>he.data)}:void 0,J=tt.current!==t.session.id&&Gt.getState().getMessagesForSession(t.session.id).length>0?Tc(t.session,B):void 0;if(J){Jt(void 0),it.current={controller:a,sessionId:J.session.id},os(J.session,J.snapshot,!0),Tt(null);return}const pe=await Ac(window.agentApi,t.session,a.signal,B);a.signal.aborted||(Jt(pe.initialHistory),os(pe.session,pe.snapshot,!0),it.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:"打开会话失败"),Pe("error"),setTimeout(()=>fe(null),5e3))}).finally(()=>{var b;We.current===a&&((b=it.current)==null?void 0:b.controller)!==a&&(We.current=null,Tt(null))})},r.useEffect(()=>{document.body.dataset.agentroamChatNavigation="ready";const t=I=>{const N=Ar({data:{type:pn,intent:I.detail},origin:window.location.origin,source:window},window.location.origin,window);N&&Qe.current(N)},a=I=>{const N=Ar(I,window.location.origin,window.parent!==window?window.parent:null);N&&Qe.current(N)};window.addEventListener(pn,t),window.addEventListener("message",a),window.parent!==window&&window.parent.postMessage({type:jo,instanceId:Ci.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&&hn(N.agentType)&&Qe.current({kind:"session",session:N})}).catch(I=>{fe(I instanceof Error?I.message:"原会话不可访问"),Pe("error")}):p.get("newSession")==="1"?ln():hn(x)&&Qe.current({kind:"agent",agentType:x}),()=>{var I;delete document.body.dataset.agentroamChatNavigation,(I=We.current)==null||I.abort(),window.removeEventListener(pn,t),window.removeEventListener("message",a)}},[]);const[nr,sr]=r.useState([]),Cn=r.useCallback(t=>{sr(a=>a.filter(p=>p.id!==t))},[]),cs=r.useCallback(t=>{const a=crypto.randomUUID();sr(p=>[...p,{...t,id:a}]),setTimeout(()=>Cn(a),12e3)},[Cn]);async function st(t=f.current,a={}){if(!window.agentApi)return;const p=(ee.current.get(t)??0)+1;ee.current.set(t,p),v(!0),Q(null);try{const b=await window.agentApi.listAgentWorkspaces(t,{cursor:a.cursor,limit:50,refresh:a.refresh,since:a.refresh?a.since??j:null});if(f.current!==t||ee.current.get(t)!==p)return;const x=gt.current.map((L,ge)=>({agentType:t,workspaceId:L.id,name:L.name,roots:L.description?[L.description]:[],order:ge,updatedAt:L.updated,source:L.source??(t==="claude-code"?"derived":"native"),canCreateSession:L.canCreateSession})),N=Xa(x,b,!a.cursor,tt.current?Ge.current:null).map(ks);gt.current=N,u(N),A(b.nextCursor),w(b.watermark),P(b.stale===!0);const B=new Set(N.map(L=>L.id)),J=Ge.current;J&&!B.has(J)&&De(ys);const pe=new Set([...mt.current].filter(L=>B.has(L)));if(J&&B.has(J)&&pe.add(J),W(L=>Object.fromEntries(Object.entries(L).filter(([ge])=>B.has(ge)))),$t(L=>{const ge=new Set([...L].filter(ae=>B.has(ae)));return mt.current=ge,ge}),S(L=>{const ge=new Set([...L].filter(ae=>B.has(ae)));return qe.current=ge,ge}),T(L=>Object.fromEntries(Object.entries(L).filter(([ge])=>B.has(ge)))),Ze)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||ee.current.get(t)!==p)return;if(Ls(he),a.refreshLoadedSessions!==!1&&!Ze)for(const L of pe)he.has(L)||qe.current.has(L)||Ve(L,{refresh:!0,background:!0})}catch(b){if(f.current!==t||ee.current.get(t)!==p)return;gt.current.length>0&&P(!0),Q(b instanceof Error?b.message:"目录加载失败")}finally{f.current===t&&ee.current.get(t)===p&&v(!1)}}async function Ve(t,a={}){var N;const p=window.agentApi;if(!p||Ja((N=l.current.agents[f.current])==null?void 0:N.workspaces.find(B=>B.workspaceId===t))||!a.force&&(a.cursor||a.background)&&qe.current.has(t))return;const b=f.current,x=`${b}:${t}`,I=(ye.current.get(x)??0)+1;ye.current.set(x,I),S(B=>{const J=new Set(B).add(t);return qe.current=J,J}),T(B=>{if(!(t in B))return B;const J={...B};return delete J[t],J});try{const B=await p.listAgentWorkspaceSessions(b,t,{cursor:a.cursor,limit:20,refresh:a.refresh});if(f.current!==b||ye.current.get(x)!==I)return;const J=Oe.current[t]??[],pe=a.pendingSession?{...a.pendingSession,projectId:t}:void 0,he=pe?[pe,...J.filter(ae=>ae.id!==pe.id)]:J,L=Cr(he,et.current),ge=ae=>{var hr,gr,mr;if(f.current!==b||ye.current.get(x)!==I)return;const lt=Qa(L,ae,!a.cursor,Ge.current===t?tt.current:null).map(we=>({...we,projectId:we.projectId??t})),fs=Cs(lt.filter(we=>!we.parentSessionId),b),In=Ge.current,dn=tt.current,pr=Za(fs,pe);In===t&&dn&&((hr=Ne.current)==null?void 0:hr.id)!==dn&&!((gr=vt.current)!=null&&gr.has(dn))&&!lt.some(we=>we.id===dn)&&!pr.some(we=>we.id===dn)&&De(ys);const un={};for(const we of lt.filter(Ue=>Ue.parentSessionId))(un[mr=we.parentSessionId]??(un[mr]=[])).push(we);for(const we of Object.values(un))we.sort((Ue,da)=>Ue.created.localeCompare(da.created));oe(we=>({...we,[t]:eo(L,ae,!a.cursor,we[t])})),$(we=>{const Ue=new Set(we);return ae.stale?Ue.add(t):Ue.delete(t),Ue});const fr={...Oe.current,[t]:pr},Tn={...et.current};for(const we of L)delete Tn[we.id];for(const[we,Ue]of Object.entries(un))Tn[we]=Ue;Oe.current=fr,et.current=Tn,W(fr),Wt(Tn),$t(we=>{const Ue=new Set(we).add(t);return mt.current=Ue,Ue})};if(ge(B),a.refresh&&!a.cursor){const ae=await to(L,B,lt=>p.listAgentWorkspaceSessions(b,t,{cursor:lt,limit:200,refresh:!1}),pe==null?void 0:pe.id);ae!==B&&ge(ae)}}catch(B){if(ye.current.get(x)!==I)return;$(J=>new Set(J).add(t)),T(J=>({...J,[t]:B instanceof Error?B.message:"会话加载失败"}))}finally{ye.current.get(x)===I&&S(B=>{const J=new Set(B);return J.delete(t),qe.current=J,J})}}const ta=async t=>{if(!window.agentApi)return;const a=await window.agentApi.listChildSessions(t);Wt(p=>({...p,[t]:a.sort((b,x)=>b.created<x.created?-1:1)}))},ls=xi&&!Ht&&!Bt&&!It&&!Ct&&!Fe,na=(t,a)=>{const p=gt.current.find(b=>b.id===t);if(!(!p||p.canCreateSession===!1)){if(ls){ds(a,p.description||void 0);return}ln(a,t)}},ds=(t=f.current,a=Ut||void 0)=>{no({agentType:t,workspacePath:a}).catch(p=>{fe(p instanceof Error?p.message:"无法打开新会话窗口,请重试"),Pe("error")})},rr=()=>{ls?ds():ei({kind:"new-session"})};r.useEffect(()=>{var t;window.agentApi&&(st(f.current,{refresh:(((t=l.current.agents[f.current])==null?void 0:t.workspaces.length)??0)>0}),Ua.getState().loadFromSystem())},[]),r.useEffect(()=>{if(!Re||!window.agentApi)return;let t=!1,a;const p=async()=>{let b=3e4;try{const x=await window.agentApi.getRuntimeHealth();t||ke(x)}catch{b=3e3}finally{t||(a=window.setTimeout(p,b))}};return p(),()=>{t=!0,window.clearTimeout(a)}},[Re]),r.useEffect(()=>{if(!je.length||tt.current||!wr(f.current,je))return;const[t]=Ur(je);t&&Ot(t)},[je]),r.useEffect(()=>{if(Ze)return;const t=window.setInterval(()=>{!Mt()||k||st(h,{refresh:!0,since:j,refreshLoadedSessions:!1})},15e3);return()=>window.clearInterval(t)},[h,Ze,k,j]),r.useEffect(()=>{if(!window.agentApi||Ze)return;let t=!1;const a=()=>{if(t||!Mt())return;const I=hl(ie,pt),N=gl(I,ss.current,qe.current);for(const B of N)Ve(B,{refresh:!0,background:mt.current.has(B)})},p=()=>{Mt()&&a()};xe&&Pt&&a();const b=window.setInterval(a,1e4);window.addEventListener("focus",a),window.addEventListener("pageshow",a),document.addEventListener("visibilitychange",p);const x=me&&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,Ze,pt,ie,xe,Pt,me]),r.useEffect(()=>{if(!ie||!window.agentApi)return;const t=d.find(p=>p.id===ie),a=t==null?void 0:t.description;a&&window.agentApi.setProjectWorkingDir(a)},[ie,d]);const sa=t=>{De(En(t));const a=!pt.has(t);if(kt(p=>{const b=new Set(p);return a?b.add(t):b.delete(t),b}),a){const p=mt.current.has(t);Ve(t,{refresh:!0,background:p,force:!0})}},ir=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 st(f.current,{refresh:!0,refreshLoadedSessions:!1}),De(En(x.workspace.workspaceId)),await Ve(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}`),Pe(x.existing?"info":"success"),setTimeout(()=>fe(null),3e3)},ar=async()=>{try{if(!window.agentApi){fe("agentApi 未就绪,请重启应用"),Pe("error");return}if(me){te(!0);return}const t=await window.agentApi.openFileDialog();if(console.log("[import] selectedPath:",t),!t)return;await ir(t)}catch(t){console.error("[import] error:",t),fe(t instanceof Error?t.message:String(t)),Pe("error"),setTimeout(()=>fe(null),5e3)}},ra=async t=>{if(window.agentApi)try{await window.agentApi.deleteProject(t),ie===t&&(ze(null),be(null),qs([])),fe("项目删除成功"),Pe("success"),setTimeout(()=>fe(null),2500),await st()}catch(a){fe(a instanceof Error?a.message:"项目删除失败"),Pe("error"),setTimeout(()=>fe(null),4e3)}},ia=(t,a,p)=>{var I;const b=(I=window.agentApi)==null?void 0:I.showDirectoryContextMenu,x=ul(a,{isInvalid:p,supported:typeof b=="function",webShell:me});!x||!b||(t.preventDefault(),b(x).catch(N=>{fe(N instanceof Error?N.message:"无法打开当前文件夹"),Pe("error"),setTimeout(()=>fe(null),4e3)}))},us=(t,a)=>{D({session:t,anchor:a})},aa=(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}})},oa=async()=>{if(!window.agentApi||!V||ue)return;const{project:t,agentType:a}=V;U(!0);try{await window.agentApi.removeInvalidAgentWorkspace(a,t.id),f.current===a&&Ge.current===t.id&&De(ys),fe(`已移除失效目录「${t.name}」`),Pe("success"),setTimeout(()=>fe(null),2500),f.current===a&&await st(a,{refresh:!0})}catch(p){fe(p instanceof Error?p.message:"目录删除失败"),Pe("error"),setTimeout(()=>fe(null),4e3)}finally{U(!1),R(null)}},ca=async()=>{if(!window.agentApi||!ve||G)return;const{session:t}=ve;X(!0);try{await window.agentApi.deleteSession(t.id);const a=t.projectId??Ge.current,p=t.agentType;if(a){const I=`${p}:${a}`;ye.current.set(I,(ye.current.get(I)??0)+1)}const b=$c(Oe.current,et.current,[],t.id);rt(I=>[...new Set([...I,...b.removedIds])]),Qo(b.removedIds),Oe.current=b.sessionsByProject,et.current=b.childSessionsByParent,W(b.sessionsByProject),Wt(b.childSessionsByParent),Ri(b.removedIds);const x=l.current.agents[p];if(x){const I={...l.current,agents:{...l.current.agents,[p]:Mc(x,b.removedIds)}};l.current=I,jr(I)}tt.current&&b.removedIds.includes(tt.current)&&De({projectId:Ge.current,sessionId:null}),fe("会话删除成功"),Pe("success"),setTimeout(()=>fe(null),2500),D(null),Ie(I=>I+1),a&&p===f.current&&Ve(a,{refresh:!0,background:!0})}catch(a){fe(a instanceof Error?a.message:"会话删除失败"),Pe("error"),setTimeout(()=>fe(null),4e3)}finally{X(!1)}},la=[{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=q===t.id,b=Dn(sn(t,a)),x=_e[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:nn.has(t.id)},onSelect:()=>{xe&&ot(!1),De(Lr(a,t.id))},onToggleChildren:x.length?()=>$n.toggle(t.id):void 0,onPin:I?void 0:()=>Yn(t.id),deleteLabel:I?"删除子会话":void 0,onDelete:B=>us(t,B)}),N&&x.length>0&&e.jsx("div",{className:"sidebar-session-children",role:"group","aria-label":`${t.title}的子会话`,children:x.map(B=>ps(B,a))})]},t.id)},or=({session:t,children:a})=>{const p=Dn(sn(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:q===t.id,child:!!t.parentSessionId,expanded:b,compatibility:t.compatibility,pinned:nn.has(t.id)},onSelect:()=>{const x=t.projectId&&d.some(I=>I.id===t.projectId)?t.projectId:null;De(Lr(x,t.id)),ne(!1),xe&&ot(!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(or)})]},t.id)};return e.jsxs("div",{className:`app-shell${_t?" is-sidebar-collapsed":""}${as?" is-sidebar-dragging":""}${Vn?" has-workspace-tabs":""}`,"data-desktop-platform":!me&&/Mac/.test(navigator.platform)?"darwin":void 0,style:{display:"flex",height:me?"100dvh":"100vh",width:"100vw",background:"var(--bg-deepest)",position:"relative",overflow:"hidden",boxSizing:"border-box",paddingTop:Vn?52:0},children:[e.jsx(Lc,{}),e.jsx(Cc,{onOpen:Un}),Ii&&Ke.createPortal(e.jsx(uo,{cwd:Ut||void 0,health:je,onClose:()=>Gn(!1),onCreated:t=>{Gn(!1),Fs(a=>a+1),xn(t)}}),document.body),Vn&&e.jsx(Ec,{groups:Ws,dashboardVisible:$s,sessionDashboardVisible:Hs,activeId:It?"sessions":Ct?"dashboard":Fe??"assistant",onSelect:t=>{Je(t==="sessions"),Xe(t==="dashboard"),Ye(["assistant","dashboard","sessions"].includes(t)?null:t)},onClose:t=>{t==="sessions"?(bn(!1),Je(!1)):t==="dashboard"?(qn(!1),Xe(!1)):(Fn(a=>a.filter(p=>p.id!==t)),Fe===t&&Ye(null))}}),(Fe||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(xl,{onNewSession:rr,onOpenGroup:t=>Qe.current({kind:"group",groupId:t.group.id,title:t.group.name,discussionId:t.discussionId}),onOpenSession:t=>Qe.current({kind:"session",session:t}),onViewAgent:t=>Qe.current({kind:"agent",agentType:t}),onViewGroups:Kn,onClose:()=>{Je(!1),bn(!1)}}):Ct?e.jsx(bl,{cwd:Ut||void 0,onOpen:xn,onClose:()=>{Xe(!1),qn(!1)},onChanged:(t,a)=>{Fs(p=>p+1),Fn(p=>a?p.map(b=>b.id===t?a:b):p.filter(b=>b.id!==t)),!a&&Fe===t&&Ye(null)}}):Fe&&e.jsx(yl,{groupId:Fe,initialDiscussionId:ki[Fe]},`${Fe}-${Bs}`)})})}),e.jsx(Dc,{}),!xe&&e.jsx(rl,{hidden:!_t,value:h,health:je,selectedSessionId:q,getActivity:sn,onChange:Ot,onSelect:os,onNewSession:t=>{ls?ds(t):ln(t)}}),xe&&Pt&&e.jsx("div",{className:"mobile-drawer-scrim",onClick:()=>ot(!1),style:{position:"fixed",inset:0,background:"rgba(0,0,0,.45)",zIndex:1150}}),xe&&!Pt&&e.jsx("button",{className:"mobile-drawer-toggle",onClick:()=>ot(!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}}),at!=="focus"&&e.jsxs(e.Fragment,{children:[e.jsxs("aside",{className:`app-sidebar${Ft==="agent-rail"?" has-agent-navigation":""}${Ze?" 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:me?"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:[!me&&e.jsx("div",{className:"sidebar-window-drag-region","aria-hidden":"true"}),Ft==="agent-rail"?e.jsx(nl,{value:h,health:je,onClose:()=>{xe?ot(!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(Xt,{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,{}),!me&&Ft==="classic"&&e.jsx(Mr,{onOpenCalendar:Bn})]})]})}),Ze?e.jsx(kc,{deletedSessionIds:Y,selectedSessionId:q,pendingSession:Be,runningSessionId:Xn,needsInput:Jn,pinnedIds:Vs,revision:He,onSelect:t=>Qe.current({kind:"session",session:t}),onPin:Yn,onDelete:us}):e.jsxs(e.Fragment,{children:[e.jsx(Kr,{vertical:Ft==="agent-rail",value:h,health:je,onChange:Ot}),e.jsxs("button",{type:"button",className:"sidebar-search-field",onClick:()=>{Hn.collapseAll(),ne(!0),Ae(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?Di():Li(),Vr(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=>{Pi(!ft),Vr(t,ft)},title:ft?"按新建时间排序":"进行中会话优先","aria-label":ft?"按新建时间排序":"进行中会话优先","aria-pressed":ft,className:`ui-icon-button sidebar-session-sort${ft?" 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:F,onRefresh:()=>void st(h,{refresh:!0})}),e.jsx("button",{type:"button",onClick:()=>void ar(),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:an,className:"app-sidebar-scroll",onPointerDownCapture:Rl,onScroll:t=>{const a=t.currentTarget;if(a.scrollHeight-a.scrollTop-a.clientHeight<120&&y&&!k&&st(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||!pt.has(N))continue;const B=I.getBoundingClientRect();if(B.bottom<b.top||B.bottom>b.bottom+120)continue;const J=H[N];J&&!qe.current.has(N)&&Ve(N,{cursor:J})}}},style:{minHeight:0,flex:1,overflow:"auto",padding:"0 10px"},children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2,marginBottom:12},children:[tr.length>0&&e.jsxs("section",{className:"sidebar-pinned-section","aria-label":"置顶会话",children:[e.jsx("div",{className:"sidebar-pinned-heading",children:"置顶"}),tr.map(({projectId:t,session:a})=>ps(a,t))]}),Ji.map(t=>{var ge;const a=ie===t.id&&q===null,p=pt.has(t.id),b=ut.has(t.id),x=g.has(t.id),I=C[t.id],N=Yi[t.id]??[],B=N.filter(ae=>!nn.has(ae.id)),pe=ft?Is(B,Us):B,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:ae=>ia(ae,t,L),style:{paddingRight:4},children:[e.jsxs("button",{className:"sidebar-project-button",onClick:()=>{L||sa(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(Lo,{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"&&!me&&!L&&t.canCreateSession!==!1?e.jsx("button",{onClick:ae=>{ae.stopPropagation(),ra(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(qr,{})}):L?e.jsx("button",{onClick:ae=>{ae.stopPropagation(),aa(t,ae.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(qr,{})}):null,!L&&t.canCreateSession!==!1&&e.jsx("button",{type:"button",onClick:ae=>{ae.stopPropagation(),na(t.id,h)},title:`在 ${t.name} 中新建会话`,"aria-label":`在 ${t.name} 中新建会话`,disabled:L||((ge=je.find(ae=>ae.agentType===h))==null?void 0:ge.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:ae=>{const lt=ae.currentTarget,fs=lt.scrollHeight-lt.scrollTop-lt.clientHeight<80,In=H[t.id];fs&&In&&!x&&Ve(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(ae=>ps(ae,t.id)),x&&!b&&e.jsx("div",{style:{color:"var(--text-muted)",fontSize:11,padding:"4px 10px",opacity:.7},children:"正在加载会话..."}),I&&!H[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 Ve(t.id,{refresh:b,background:b}),style:{border:0,background:"transparent",color:"inherit",fontSize:11,cursor:"pointer",padding:0},children:"重试"})]}),E.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(Sc,{cursor:H[t.id]??null,expanded:p&&b&&!L,loading:x,error:I,nestedScroll:he&&!xe,projectName:t.name,onLoadMore:()=>{const ae=H[t.id];ae&&Ve(t.id,{cursor:ae})}})]})})]},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&&!F&&e.jsx("div",{style:{color:"var(--text-muted)",fontSize:12,padding:"24px 10px",textAlign:"center",opacity:.7},children:"暂无目录"}),F&&d.length>0&&e.jsxs("div",{className:"sidebar-cache-state sidebar-cache-state--action",role:"status",title:F,children:[e.jsx("span",{children:"当前显示缓存目录"}),!k&&e.jsx("button",{type:"button",onClick:()=>void st(h,{refresh:!0}),children:"重试"})]}),_&&!F&&e.jsx("div",{className:"sidebar-cache-state",children:"当前显示缓存目录"}),F&&d.length===0&&e.jsxs("div",{className:"sidebar-load-error",title:F,children:[e.jsx("span",{children:"目录加载失败"}),e.jsx("button",{type:"button",onClick:()=>void st(h,{refresh:!1}),children:"重试"})]})]})})]}),e.jsxs("div",{className:"sidebar-bottom-action",children:[!Ze&&e.jsx(jc,{refreshKey:Bs,onOpen:xn}),e.jsxs("button",{type:"button",className:"sidebar-new-session-primary",title:"新建会话",onClick:rr,children:[e.jsx(Nn,{size:16,"aria-hidden":"true"}),e.jsx("span",{children:"新建会话"})]})]})]}),ve&&e.jsx($r,{message:zc(ve.session),anchor:ve.anchor,mobile:xe,pending:G,onCancel:()=>D(null),onConfirm:()=>void ca()}),V&&e.jsx($r,{title:"删除失效目录",message:`目录「${V.project.name}」的路径(${V.project.description||"未知"})已不存在。确定从目录列表移除?历史会话记录会保留。`,anchor:V.anchor,mobile:xe,pending:ue,onCancel:()=>R(null),onConfirm:()=>void oa()}),!xe&&e.jsx("div",{className:`app-sidebar-resizer${as?" is-dragging":""}`,...Qi,role:"separator","aria-label":"调整目录与会话列表宽度","aria-controls":"workspace-sidebar","aria-orientation":"vertical","aria-valuemin":220,"aria-valuemax":480,"aria-valuenow":Sn,tabIndex:Kt?-1:0,hidden:Kt&&!as,style:{left:Kt?0:Sn}}),le&&e.jsx("div",{onClick:()=>ne(!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:z,onChange:t=>K(t.target.value),onKeyDown:t=>{t.key==="Escape"&&ne(!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:[Te&&e.jsx("div",{role:"status",children:"正在加载所有会话"}),O&&e.jsx("div",{role:"alert",children:O}),wt&&on&&on.length>0&&e.jsxs("div",{style:{padding:"4px 10px 3px",fontSize:9,fontWeight:700,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-muted)"},children:[on.length," 个结果"]}),!Te&&!O&&wt&&cn.length===0&&e.jsx("div",{style:{color:"var(--text-muted)",fontSize:12,padding:"16px 10px",textAlign:"center",opacity:.7},children:"无匹配会话"}),!Te&&!O&&!wt&&cn.length===0&&e.jsx("div",{style:{color:"var(--text-muted)",fontSize:12,padding:"16px 10px",textAlign:"center",opacity:.7},children:"暂无会话"}),(wt?cn:cn.slice(0,Se)).map(or),!wt&&cn.length>Se&&e.jsx("button",{type:"button",onClick:()=>Ae(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(al,{message:Zi,type:ea}),e.jsx(Ka,{viewedSessionId:Bt||Ht||It||Ct||Fe||Qt?null:q}),e.jsxs("main",{className:`app-main${ct?" file-workspace-capable":""}${rn&&ct?" file-workspace-open":""}${rn&&ct&&Ks?" 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":Qt?!0:void 0,ref:t=>{t&&(t.inert=!!Qt)},style:{height:"100%",paddingTop:0,display:Ht||Bt?"none":void 0,background:"var(--chat-history-bg)"},children:e.jsx(vc,{onSplitChange:yi,enabled:Oi||!me&&!ga(),onOpenCalendar:Bn,onFocusSession:t=>{tt.current=t.id,Ge.current=t.projectId??null,Me(t),be(t.id),ze(t.projectId??null)},onNavigateSession:t=>Qe.current({kind:"session",session:t}),onSessionCreated:t=>{if(t.projectId&&t.agentType===f.current){const a=t.projectId;W(p=>({...p,[a]:[t,...(p[a]??[]).filter(b=>b.id!==t.id)]}))}Ie(a=>a+1)},children:e.jsx(Ga,{sidebarCollapsed:_t,onToggleSidebar:xe?void 0:()=>{at==="focus"?(tn("standard"),Kt&&jn()):jn()},onOpenCollaborationDashboard:me?void 0:Kn,onOpenSessionDashboard:me?void 0:Un,activeAgentType:h,selectedProjectId:ie,selectedSessionId:q,sessionTitle:Xi,sessionSummary:Lt,initialSessionHistory:vi,sessionNavigationPending:!!Qt,onSessionHistorySettled:ji,workspacePath:Ut,workspaceSource:(lr=d.find(t=>t.id===ie))==null?void 0:lr.source,runtimeHealth:je,onSelectAgent:ln,workspaces:d.map(t=>({id:t.id,name:t.name,path:t.description,canCreateSession:t.canCreateSession})),onSelectWorkspace:t=>{Zt.current=null,De(En(t)),kt(a=>new Set(a).add(t))},onPickWorkspaceFolder:()=>void ar(),focusComposerNonce:wi,voiceCommand:Bi,onOpenSettings:Vi,settingsOpen:Ds,desktopLiveOpen:_s,fileDrawerOpen:rn,onOpenArtifact:Wi,onToggleFiles:ct?()=>{Qn(t=>!t),Zn("files")}:void 0,onOpenDesktopLive:!me&&((dr=window.agentApi)!=null&&dr.desktopLiveGetStatus)?()=>Os(!0):void 0,onHideToBackground:()=>void Fi(),onOpenHub:(ur=window.agentApi)!=null&&ur.hubGetConfig?()=>{nt(!1),jt(!0)}:void 0,headerAppActions:!me&&Ft!=="classic"?e.jsx(Mr,{onOpenCalendar:Bn}):void 0,onToggleAppearance:qi,appearanceOpen:yn,hideToBackgroundTitle:Et?`隐藏到后台(说“${Nt}”唤醒)`:"隐藏到后台",onSessionCreated:(t,a)=>{var b;Me(a??null);const p=Ge.current;if(p&&a){const x=`${a.agentType}:${p}`;ye.current.set(x,(ye.current.get(x)??0)+1),qe.current.delete(p),S(new Set(qe.current));const I={...Oe.current,[p]:[{...a,projectId:p},...(Oe.current[p]??[]).filter(N=>N.id!==t)]};Oe.current=I,W(I)}De({projectId:p,sessionId:t}),Ie(x=>x+1),ns.current&&(ns.current=!1,Vt.current={sessionId:t,until:Date.now()+9e4},(b=window.agentApi)==null||b.wakeConversation(!0)),p&&f.current==="customer-agent"&&Ve(p,{pendingSession:a,background:!0})},onSubSessionCreated:async t=>{await ta(t)},onSelectSession:(t,a)=>{a&&Me(a),be(t),mn()},onParallelSessionSelected:t=>{var p;(p=We.current)==null||p.abort(),We.current=null,it.current=null,Tt(null),Jt(void 0),f.current!==t.agentType&&Ot(t.agentType),Me(t);const a=t.projectId&&gt.current.some(b=>b.id===t.projectId)?t.projectId:null;De({projectId:a,sessionId:t.id}),Gt.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)=>{W(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=Vt.current,b=Ya(p,a);Vt.current=b,b!==p&&((I=window.agentApi)==null||I.wakeConversation(!0));const x=t||ie;x&&await Ve(x,{refresh:!0,background:!0})}})})}),Bt&&e.jsx(r.Suspense,{fallback:e.jsx(zt,{label:"正在打开日历"}),children:e.jsx(kl,{loadOverview:Sl,onClose:()=>nt(!1),initialTaskId:gi,focusKey:mi})}),Qt&&e.jsx(zt,{className:"session-navigation-loading"}),Ht&&e.jsx(r.Suspense,{fallback:e.jsx(zt,{label:"正在打开 AI Hub"}),children:e.jsx(vl,{conversationId:q,onExit:()=>jt(!1)})}),ct&&rn&&e.jsx(r.Suspense,{fallback:e.jsx(zt,{label:"正在打开文件"}),children:e.jsx(Nl,{open:rn,tab:zi,gateway:ct,cwd:Ut,selectedPath:Ks,revealRequest:Mi,onTabChange:Zn,onSelectPath:es,onClose:()=>Qn(!1)})})]}),_s&&e.jsx(Fc,{onClose:()=>Os(!1)}),Ds&&Ke.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:la.map(t=>e.jsx("button",{onClick:()=>Ti(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(jl,{}),At==="mcp"&&e.jsx(Cl,{}),At==="memory"&&e.jsx(Il,{}),At==="skill"&&e.jsx(Tl,{}),At==="agent"&&e.jsx(Al,{}),At==="lsp"&&e.jsx(El,{})]})})]})}),document.body),e.jsx("div",{className:"noise-overlay"}),yn&&vn&&Ke.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:ma.map(t=>e.jsxs("button",{onClick:()=>Ai(t.id),className:`appearance-choice ${en===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:en===t.id?600:400},children:t.label}),en===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:wa.map(t=>e.jsx("button",{onClick:()=>tn(t.id),title:t.description,className:`appearance-segment ${at===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=>Ei(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=>Ni(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(Eo,{open:ce,onCancel:()=>te(!1),onConfirm:async t=>{await ir(t),te(!1)}}),e.jsx(qc,{trigger:$i,heardText:Hi}),qt.items.length>0&&Ke.createPortal(e.jsx(Yc,{items:qt.items,onDismiss:qt.consume,onClearAll:qt.clearAll,onOpen:t=>{qt.consume(t),window.dispatchEvent(new CustomEvent("agentroam:notification-open",{detail:t}))}}),document.body),nr.length>0&&qt.items.length===0&&Ke.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:nr.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:()=>{be(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 cd=Object.freeze(Object.defineProperty({__proto__:null,default:Ll},Symbol.toStringTag,{value:"Module"}));export{al as A,cd as a};
@@ -1,4 +1,4 @@
1
- var ri=t=>{throw TypeError(t)};var Li=(t,e,r)=>e.has(t)||ri("Cannot "+r);var ii=(t,e,r)=>e.has(t)?ri("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r);var yr=(t,e,r)=>(Li(t,e,"access private method"),r);import{c as je,j as h,r as d,B as zi,a as br,z as ni}from"./index-CrjQF-VW.js";import{L as Ae}from"./loader-circle-BSDHoDXf.js";import{C as Fi}from"./chevron-down-FeW7FcBS.js";import{d as Vi,E as Bi}from"./RemoteDesktopTabBridge-tJcxPHnZ.js";import{M as si,Z as Oi,a as Ui}from"./zoom-out-417ojKB8.js";import{R as Wi}from"./rotate-ccw-DtSpwbK7.js";import{X as $i}from"./x-3I6TKNBE.js";/**
1
+ var ri=t=>{throw TypeError(t)};var Li=(t,e,r)=>e.has(t)||ri("Cannot "+r);var ii=(t,e,r)=>e.has(t)?ri("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r);var yr=(t,e,r)=>(Li(t,e,"access private method"),r);import{c as je,j as h,r as d,B as zi,a as br,z as ni}from"./index-D1AQffdA.js";import{L as Ae}from"./loader-circle-xEKTnlp3.js";import{C as Fi}from"./chevron-down-hiPnZS_M.js";import{d as Vi,E as Bi}from"./RemoteDesktopTabBridge-BF1dFltY.js";import{M as si,Z as Oi,a as Ui}from"./zoom-out-B59mGU6c.js";import{R as Wi}from"./rotate-ccw-HY6j6nBt.js";import{X as $i}from"./x-uSekqXJV.js";/**
2
2
  * @license lucide-react v0.468.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{r,u as i,j as n}from"./index-CrjQF-VW.js";import m from"./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";function x(){const[a,o]=r.useState(i.getState().skin);return r.useEffect(()=>i.subscribe(t=>o(t.skin)),[]),r.useEffect(()=>{document.documentElement.dataset.skin=a},[a]),n.jsx(m,{initialTaskId:new URLSearchParams(location.search).get("task")??void 0,loadOverview:async(t,s)=>{const e=window.agentApi;if(!(e!=null&&e.calendarOverview))throw new Error("当前环境不支持日历视图");return e.calendarOverview({from:t,to:s})}})}export{x as default};
1
+ import{r,u as i,j as n}from"./index-D1AQffdA.js";import m from"./CalendarView-CS-OG-13.js";import"./calendar-days-B1Mn3x8A.js";import"./x-uSekqXJV.js";import"./chevron-right-DKsui_wS.js";import"./locate-fixed-CfEojGOl.js";import"./list-todo-CP9DqU2D.js";import"./chevron-down-hiPnZS_M.js";import"./check-D-yTByNl.js";import"./pause-C-ecDo3W.js";function x(){const[a,o]=r.useState(i.getState().skin);return r.useEffect(()=>i.subscribe(t=>o(t.skin)),[]),r.useEffect(()=>{document.documentElement.dataset.skin=a},[a]),n.jsx(m,{initialTaskId:new URLSearchParams(location.search).get("task")??void 0,loadOverview:async(t,s)=>{const e=window.agentApi;if(!(e!=null&&e.calendarOverview))throw new Error("当前环境不支持日历视图");return e.calendarOverview({from:t,to:s})}})}export{x as default};
@@ -1,4 +1,4 @@
1
- import{c as $,r as l,j as e,v as me,N as Ae,A as pe,w as De,R as Ee}from"./index-CrjQF-VW.js";import{C as $e}from"./calendar-days-DpxojDWK.js";import{X as xe}from"./x-3I6TKNBE.js";import{C as Te}from"./chevron-right-Bnd4FK8S.js";import{L as Me}from"./locate-fixed-BBOLeIa6.js";import{L as ge}from"./list-todo-BJrNf0OF.js";import{C as Le}from"./chevron-down-FeW7FcBS.js";import{C as fe}from"./check-CY3GCzxa.js";import{P as ze}from"./pause-BF1q8wFt.js";/**
1
+ import{c as $,r as l,j as e,v as me,N as Ae,A as pe,w as De,R as Ee}from"./index-D1AQffdA.js";import{C as $e}from"./calendar-days-B1Mn3x8A.js";import{X as xe}from"./x-uSekqXJV.js";import{C as Te}from"./chevron-right-DKsui_wS.js";import{L as Me}from"./locate-fixed-CfEojGOl.js";import{L as ge}from"./list-todo-CP9DqU2D.js";import{C as Le}from"./chevron-down-hiPnZS_M.js";import{C as fe}from"./check-D-yTByNl.js";import{P as ze}from"./pause-C-ecDo3W.js";/**
2
2
  * @license lucide-react v0.468.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.