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
@@ -1 +1 @@
1
- import{j as e,r as n,k as H,h as U,l as K}from"./index-CrjQF-VW.js";import{C as V,a as Y}from"./types-pH-pRUSS.js";import{H as Z}from"./HostProjectPicker-7zvVzftL.js";import{c as L,A as P}from"./client-ZvcI0WiM.js";import{C as G}from"./chevron-right-Bnd4FK8S.js";import{c as q,b as ee,S as _}from"./session-tree-Ck5Wp7h-.js";import{X as O}from"./x-3I6TKNBE.js";import{S as te}from"./file-types-BsWJSk07.js";import{U as ae}from"./collaboration-CeiB1Ihl.js";import{F as se}from"./trash-2-CT_MslWu.js";import{C as Q}from"./chevron-down-FeW7FcBS.js";function le({title:r,expanded:s,onToggle:c}){const g=`${s?"收起":"展开"}子会话:${r}`;return e.jsx("button",{type:"button",className:"sidebar-session-toggle ui-icon-button ui-icon-button--small","aria-label":g,title:g,"aria-expanded":s,onClick:c,children:e.jsx(G,{size:15,className:`sidebar-session-disclosure${s?" is-expanded":""}`,"aria-hidden":"true"})})}function re(){const[r,s]=n.useState(()=>new Set);function c(g){s(S=>{const h=new Set(S);return h.has(g)?h.delete(g):h.add(g),h})}return{expandedIds:r,toggle:c,collapseAll:()=>s(new Set)}}function ne(r,s){return[...new Map([...r,...s].map(c=>[c.id,c])).values()]}function oe({value:r,onChange:s}){const[c,g]=n.useState(""),S=re(),[h,w]=n.useState({data:[],nextCursor:null,total:0}),[x,v]=n.useState(!0),[u,b]=n.useState(""),[l,d]=n.useState(0),i=n.useRef(0),j=n.useRef(!1);n.useEffect(()=>{const t=++i.current;let o=!0;j.current=!0,v(!0),b(""),w({data:[],nextCursor:null,total:0});const p=setTimeout(()=>{L({action:"sessionCatalog",query:c,limit:20}).then(f=>{o&&t===i.current&&w({...f,data:q(f)})}).catch(f=>{o&&t===i.current&&b(f instanceof Error?f.message:"无法加载会话")}).finally(()=>{o&&t===i.current&&(j.current=!1,v(!1))})},c?200:0);return()=>{o=!1,clearTimeout(p)}},[c,l]);const y=async()=>{if(j.current||!h.nextCursor)return;const t=i.current;j.current=!0,v(!0),b("");try{const o=await L({action:"sessionCatalog",query:c,limit:20,cursor:h.nextCursor});t===i.current&&w(p=>({...o,data:ne(p.data,q(o))}))}catch(o){t===i.current&&b(o instanceof Error?o.message:"加载更多失败")}finally{t===i.current&&(j.current=!1,v(!1))}},A=new Set(r.map(t=>t.id)),C=ee(h.data),z=new Map(h.data.map(t=>[t.id,t])),N=({session:t,children:o})=>{const p=S.expandedIds.has(t.id);return e.jsxs("div",{children:[e.jsxs("div",{className:"collab-monitor-entry",children:[e.jsxs("label",{className:"collab-monitor-row",children:[e.jsx("input",{type:"checkbox","aria-label":`关联${t.title}`,checked:A.has(t.id),disabled:!A.has(t.id)&&r.length>=200,onChange:f=>s(f.target.checked?[...r,{id:t.id,agentType:t.agentType,title:t.title,cwd:t.cwd,projectId:t.projectId}]:r.filter(D=>D.id!==t.id))}),e.jsx(H,{agentType:t.agentType,size:18}),e.jsx(_,{session:t}),e.jsxs("span",{className:"collab-monitor-row-text",children:[e.jsx("strong",{children:t.title}),e.jsxs("small",{children:[P[t.agentType]," · ",t.cwd]})]}),e.jsx("em",{className:t.status==="running"?"is-running":"",children:t.status==="running"?"运行中":t.status==="failed"?"异常":t.status==="completed"?"已完成":"空闲"})]}),o.length>0&&e.jsx(le,{title:t.title,expanded:p,onToggle:()=>S.toggle(t.id)})]}),p&&o.length>0&&e.jsx("div",{className:"collab-monitor-children",role:"group","aria-label":`${t.title}的子会话`,children:o.map(N)})]},t.id)};return e.jsxs("section",{className:"collab-monitor-picker","aria-label":"关联原始会话",children:[e.jsx("div",{className:"collab-monitor-heading",children:e.jsxs("strong",{children:["关联原始会话 ",e.jsxs("small",{children:["选填 · 已选 ",r.length]})]})}),e.jsx("p",{className:"collab-muted",children:"运行中的在前。关联后作为监控对象,恢复或交接时才介入。"}),r.length>0&&e.jsx("div",{className:"collab-monitor-selected","aria-label":"已选会话",children:r.map(t=>e.jsxs("span",{title:`${P[t.agentType]} · ${t.cwd}`,children:[e.jsx(H,{agentType:t.agentType,size:14}),e.jsx(_,{session:z.get(t.id)??t}),e.jsx("span",{children:t.title}),e.jsx("button",{type:"button","aria-label":`取消关联${t.title}`,onClick:()=>s(r.filter(o=>o.id!==t.id)),children:e.jsx(O,{size:13})})]},t.id))}),e.jsxs("label",{className:"collab-monitor-search",children:[e.jsx(te,{size:15}),e.jsx("input",{"aria-label":"搜索所有原始会话",placeholder:"搜索所有会话的标题、目录或 Agent",value:c,onChange:t=>g(t.target.value)})]}),e.jsxs("div",{className:"collab-monitor-results","aria-label":"原始会话候选","aria-busy":x,onScroll:t=>{const o=t.currentTarget;o.scrollHeight-o.scrollTop-o.clientHeight<64&&y()},children:[C.map(N),!x&&!u&&!C.length&&e.jsx("p",{className:"collab-muted",children:c?"没有匹配的会话":"暂无可接入会话"}),x&&e.jsx("p",{className:"collab-muted",role:"status",children:"正在加载会话…"}),h.nextCursor&&!u&&e.jsx("button",{type:"button",className:"collab-monitor-more",disabled:x,onClick:()=>void y(),children:"加载更多会话"})]}),u&&e.jsxs("p",{className:"collab-error",role:"alert",children:[u," ",e.jsx("button",{type:"button",onClick:()=>d(t=>t+1),children:"重新加载"})]})]})}function I({children:r,...s}){return e.jsxs("span",{className:"collab-select",children:[e.jsx("select",{...s,children:r}),e.jsx(Q,{size:16,"aria-hidden":"true"})]})}function M(r){return{id:crypto.randomUUID(),name:r===0?"群主":`成员 ${r}`,agentType:"codex",role:""}}function ce({member:r,index:s,owner:c,supervisor:g,health:S,onChange:h,onRemove:w}){const[x,v]=n.useState([]),[u,b]=n.useState([]);return n.useEffect(()=>{let l=!0;return v([]),b([]),r.agentType==="customer-agent"?(window.agentApi.getSettings().then(d=>{l&&b(d.profiles.map(({id:i,name:j,modelId:y})=>({id:i,name:j,modelId:y})))}).catch(()=>{}),()=>{l=!1}):(window.agentApi.listAgentModels(r.agentType).then(d=>{l&&v(d.models)}).catch(()=>{}),()=>{l=!1})},[r.agentType]),e.jsxs("fieldset",{className:"collab-member-editor",children:[e.jsxs("legend",{children:[c?e.jsx(V,{size:14}):e.jsx(ae,{size:14}),c?"群主":`成员 ${s}`,g?" · 监工":""]}),w&&e.jsx("button",{type:"button",className:"collab-remove","aria-label":`移除${r.name}`,onClick:w,children:e.jsx(O,{size:16})}),e.jsxs("div",{className:"collab-editor-fields",children:[e.jsxs("label",{children:["名称",e.jsx("input",{value:r.name,maxLength:100,onChange:l=>h({...r,name:l.target.value}),required:!0})]}),e.jsxs("label",{children:["Agent",e.jsx(I,{value:r.agentType,onChange:l=>h({...r,agentType:l.target.value,model:void 0,profileId:void 0}),children:Y.map(l=>{var d,i;return e.jsxs("option",{value:l,disabled:((d=S.find(j=>j.agentType===l))==null?void 0:d.available)===!1,children:[P[l],((i=S.find(j=>j.agentType===l))==null?void 0:i.available)===!1?" · 不可用":""]},l)})})]}),e.jsxs("label",{className:"collab-model-field",children:["模型",r.agentType==="customer-agent"?e.jsxs(I,{value:r.profileId||"",onChange:l=>{const d=u.find(i=>i.id===l.target.value);h({...r,profileId:d==null?void 0:d.id,model:d?{id:d.modelId}:void 0})},children:[e.jsx("option",{value:"",children:"沿用默认模型"}),u.map(l=>e.jsxs("option",{value:l.id,children:[l.name," · ",l.modelId]},l.id))]}):e.jsxs(I,{value:r.model?`${r.model.providerID||""}|${r.model.id}`:"",onChange:l=>{const d=x.find(i=>`${i.providerID||""}|${i.id}`===l.target.value);h({...r,model:d?{id:d.id,...d.providerID?{providerID:d.providerID}:{}}:void 0})},children:[e.jsx("option",{value:"",children:"沿用默认模型"}),x.map(l=>e.jsxs("option",{value:`${l.providerID||""}|${l.id}`,children:[l.displayName||l.id,l.providerDisplayName?` · ${l.providerDisplayName}`:""]},`${l.providerID}|${l.id}`))]})]})]}),e.jsxs("details",{className:"collab-role-options",open:g||void 0,children:[e.jsxs("summary",{children:[e.jsx("span",{children:"定位与职责"}),e.jsx("span",{className:"collab-muted",children:r.role.trim()?"已设置":c?"默认安排与汇总":"留空由群主分配"}),e.jsx(Q,{size:14})]}),e.jsx("textarea",{"aria-label":`${c?"群主":`成员 ${s}`}的定位与职责(选填)`,rows:2,maxLength:8e3,value:r.role,placeholder:g?"重点看什么:异常暂停、任务交接和交付。允许怎么处理:原任务内自动恢复、继续、协调交接;业务取舍或无法恢复时提醒我决策。":c?"负责拆解目标、分配任务、验收和汇总成果":"例如:负责实现接口;留空由群主自动分配",onChange:l=>h({...r,role:l.target.value})}),g&&e.jsx("p",{className:"collab-muted",children:"在职责中写明关注内容、判断标准、允许的恢复与交接,以及何时提醒你或等待决策。"})]})]})}function ve({cwd:r,initialGroup:s,health:c,onClose:g,onCreated:S}){var F;const[h,w]=n.useState((s==null?void 0:s.name)||""),[x,v]=n.useState((s==null?void 0:s.cwd)||r||""),[u,b]=n.useState(()=>s?structuredClone(s.members):[M(0),M(1)]),[l,d]=n.useState((s==null?void 0:s.ownerId)||u[0].id),[i,j]=n.useState((s==null?void 0:s.maxParallel)||3),[y,A]=n.useState(()=>{var a;return structuredClone(((a=s==null?void 0:s.monitoring)==null?void 0:a.targets)??[])}),[C,z]=n.useState(s?((F=s.monitoring)==null?void 0:F.supervisorId)??"":u[0].id),[N,t]=n.useState(!1),[o,p]=n.useState(""),[f,D]=n.useState(!1),[W,R]=n.useState(!!(s!=null&&s.cwd)),[k,B]=n.useState(!1),X=async()=>{if(p(""),K()){D(!0);return}B(!0);try{const a=await window.agentApi.openFileDialog();a&&(v(a),R(!0))}catch(a){p(a instanceof Error?a.message:"无法选择工作目录")}finally{B(!1)}};return n.useEffect(()=>{const a=m=>{m.key==="Escape"&&!N&&!f&&!k&&g()};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[g,N,f,k]),e.jsxs("div",{className:"collab-modal-backdrop",onMouseDown:a=>{a.target===a.currentTarget&&!N&&g()},children:[e.jsxs("form",{className:"collab-create",role:"dialog","aria-modal":"true","aria-labelledby":"collab-create-title",onSubmit:async a=>{a.preventDefault(),t(!0),p("");try{if(!x.trim())throw new Error("请先选择工作目录");const m=u.find($=>{var E;return((E=c.find(J=>J.agentType===$.agentType))==null?void 0:E.available)===!1});if(m&&!s)throw new Error(`${m.name} 选择的 Agent 当前不可用`);const T=await L({...s?{action:"updateGroup",groupId:s.id}:{action:"createGroup"},group:{name:h.trim()||"协作群",cwd:x.trim(),ownerId:l,members:u,maxParallel:Math.min(i,u.length),...y.length?{monitoring:{targets:y,...C?{supervisorId:C}:{}}}:{}}});S(T)}catch(m){p(m instanceof Error?m.message:String(m))}finally{t(!1)}},children:[e.jsxs("header",{children:[e.jsxs("div",{children:[e.jsx("span",{className:"collab-eyebrow",children:"一起完成一件事"}),e.jsx("h2",{id:"collab-create-title",children:s?"修改协作群":"拉个协作群"})]}),e.jsx("button",{type:"button","aria-label":"关闭群设置",onClick:g,disabled:N,children:e.jsx(O,{size:20})})]}),e.jsxs("div",{className:"collab-create-scroll",children:[e.jsxs("div",{className:"collab-group-fields",children:[e.jsxs("label",{children:[e.jsx("span",{children:"群名称"}),e.jsx("input",{autoFocus:!0,value:h,maxLength:100,placeholder:"例如:产品开发小组",onChange:a=>w(a.target.value)})]}),e.jsxs("label",{children:[e.jsx("span",{children:"工作目录"}),e.jsxs("button",{type:"button",className:"collab-directory-picker","aria-label":"选择工作目录","aria-haspopup":"dialog","aria-expanded":f,title:x||"选择工作目录",disabled:N||k,onClick:()=>void X(),children:[e.jsx(se,{size:16,"aria-hidden":"true"}),e.jsx("span",{className:x?void 0:"collab-muted",children:k?"正在选择…":x||"选择工作目录"}),e.jsx(U,{size:16,"aria-hidden":"true"})]})]})]}),e.jsx("p",{className:"collab-create-hint collab-muted",children:s?"配置保存后用于新讨论,已有讨论和聊天记录保留。":"Agent 可重复加入,职责留空由群主分配。"}),u.map((a,m)=>e.jsx(ce,{member:a,index:m,owner:a.id===l,supervisor:y.length>0&&a.id===C,health:c,onChange:T=>b($=>$.map(E=>E.id===T.id?T:E)),onRemove:a.id!==l&&u.length>2?()=>{a.id===C&&z(""),b(T=>T.filter($=>$.id!==a.id))}:void 0},a.id)),e.jsxs("div",{className:"collab-create-actions",children:[e.jsxs("label",{children:["群主",e.jsx(I,{value:l,onChange:a=>d(a.target.value),children:u.map(a=>e.jsx("option",{value:a.id,children:a.name},a.id))})]}),e.jsxs("button",{type:"button",disabled:u.length>=20,onClick:()=>b(a=>[...a,M(a.length)]),children:[e.jsx(U,{size:16}),"添加成员"]}),e.jsxs("label",{children:["最多同时工作",e.jsx(I,{value:Math.min(i,u.length),onChange:a=>j(Number(a.target.value)),children:u.map((a,m)=>e.jsxs("option",{value:m+1,children:[m+1," 人"]},m+1))})]})]}),e.jsx(oe,{value:y,onChange:A}),y.length>0&&e.jsxs("label",{className:"collab-supervisor-select",children:["监工",e.jsxs(I,{"aria-label":"选择监工成员",value:C,onChange:a=>z(a.target.value),children:[e.jsx("option",{value:"",children:"仅关联,不启用监工"}),u.map(a=>e.jsxs("option",{value:a.id,children:[a.name," · ",P[a.agentType]]},a.id))]}),e.jsx("small",{className:"collab-muted",children:"复用该成员的 Agent、模型和职责,关闭看板后继续监管。"})]})]}),o&&e.jsx("p",{className:"collab-error",role:"alert",children:o}),e.jsxs("footer",{children:[e.jsx("span",{className:"collab-muted",children:"职责可以留空,发送任务后由群主分配。"}),e.jsx("button",{className:"collab-primary",disabled:N||k||!x.trim(),type:"submit",children:N?"正在保存…":s?"保存修改":"创建并打开群"})]})]}),e.jsx(Z,{open:f,initialPath:W?x:void 0,onCancel:()=>D(!1),onConfirm:a=>{v(a),R(!0),D(!1),p("")}})]})}export{ve as C,le as S,re as u};
1
+ import{j as e,r as n,k as H,h as U,l as K}from"./index-D1AQffdA.js";import{C as V,a as Y}from"./types-BuPq0iQM.js";import{H as Z}from"./HostProjectPicker--J4_JpSW.js";import{c as L,A as P}from"./client-5Hu1eVTX.js";import{C as G}from"./chevron-right-DKsui_wS.js";import{c as q,b as ee,S as _}from"./session-tree-CEy-pW8A.js";import{X as O}from"./x-uSekqXJV.js";import{S as te}from"./file-types-BZ8YZAV-.js";import{U as ae}from"./collaboration-DRFqpcAz.js";import{F as se}from"./trash-2-BF9eI5Bh.js";import{C as Q}from"./chevron-down-hiPnZS_M.js";function le({title:r,expanded:s,onToggle:c}){const g=`${s?"收起":"展开"}子会话:${r}`;return e.jsx("button",{type:"button",className:"sidebar-session-toggle ui-icon-button ui-icon-button--small","aria-label":g,title:g,"aria-expanded":s,onClick:c,children:e.jsx(G,{size:15,className:`sidebar-session-disclosure${s?" is-expanded":""}`,"aria-hidden":"true"})})}function re(){const[r,s]=n.useState(()=>new Set);function c(g){s(S=>{const h=new Set(S);return h.has(g)?h.delete(g):h.add(g),h})}return{expandedIds:r,toggle:c,collapseAll:()=>s(new Set)}}function ne(r,s){return[...new Map([...r,...s].map(c=>[c.id,c])).values()]}function oe({value:r,onChange:s}){const[c,g]=n.useState(""),S=re(),[h,w]=n.useState({data:[],nextCursor:null,total:0}),[x,v]=n.useState(!0),[u,b]=n.useState(""),[l,d]=n.useState(0),i=n.useRef(0),j=n.useRef(!1);n.useEffect(()=>{const t=++i.current;let o=!0;j.current=!0,v(!0),b(""),w({data:[],nextCursor:null,total:0});const p=setTimeout(()=>{L({action:"sessionCatalog",query:c,limit:20}).then(f=>{o&&t===i.current&&w({...f,data:q(f)})}).catch(f=>{o&&t===i.current&&b(f instanceof Error?f.message:"无法加载会话")}).finally(()=>{o&&t===i.current&&(j.current=!1,v(!1))})},c?200:0);return()=>{o=!1,clearTimeout(p)}},[c,l]);const y=async()=>{if(j.current||!h.nextCursor)return;const t=i.current;j.current=!0,v(!0),b("");try{const o=await L({action:"sessionCatalog",query:c,limit:20,cursor:h.nextCursor});t===i.current&&w(p=>({...o,data:ne(p.data,q(o))}))}catch(o){t===i.current&&b(o instanceof Error?o.message:"加载更多失败")}finally{t===i.current&&(j.current=!1,v(!1))}},A=new Set(r.map(t=>t.id)),C=ee(h.data),z=new Map(h.data.map(t=>[t.id,t])),N=({session:t,children:o})=>{const p=S.expandedIds.has(t.id);return e.jsxs("div",{children:[e.jsxs("div",{className:"collab-monitor-entry",children:[e.jsxs("label",{className:"collab-monitor-row",children:[e.jsx("input",{type:"checkbox","aria-label":`关联${t.title}`,checked:A.has(t.id),disabled:!A.has(t.id)&&r.length>=200,onChange:f=>s(f.target.checked?[...r,{id:t.id,agentType:t.agentType,title:t.title,cwd:t.cwd,projectId:t.projectId}]:r.filter(D=>D.id!==t.id))}),e.jsx(H,{agentType:t.agentType,size:18}),e.jsx(_,{session:t}),e.jsxs("span",{className:"collab-monitor-row-text",children:[e.jsx("strong",{children:t.title}),e.jsxs("small",{children:[P[t.agentType]," · ",t.cwd]})]}),e.jsx("em",{className:t.status==="running"?"is-running":"",children:t.status==="running"?"运行中":t.status==="failed"?"异常":t.status==="completed"?"已完成":"空闲"})]}),o.length>0&&e.jsx(le,{title:t.title,expanded:p,onToggle:()=>S.toggle(t.id)})]}),p&&o.length>0&&e.jsx("div",{className:"collab-monitor-children",role:"group","aria-label":`${t.title}的子会话`,children:o.map(N)})]},t.id)};return e.jsxs("section",{className:"collab-monitor-picker","aria-label":"关联原始会话",children:[e.jsx("div",{className:"collab-monitor-heading",children:e.jsxs("strong",{children:["关联原始会话 ",e.jsxs("small",{children:["选填 · 已选 ",r.length]})]})}),e.jsx("p",{className:"collab-muted",children:"运行中的在前。关联后作为监控对象,恢复或交接时才介入。"}),r.length>0&&e.jsx("div",{className:"collab-monitor-selected","aria-label":"已选会话",children:r.map(t=>e.jsxs("span",{title:`${P[t.agentType]} · ${t.cwd}`,children:[e.jsx(H,{agentType:t.agentType,size:14}),e.jsx(_,{session:z.get(t.id)??t}),e.jsx("span",{children:t.title}),e.jsx("button",{type:"button","aria-label":`取消关联${t.title}`,onClick:()=>s(r.filter(o=>o.id!==t.id)),children:e.jsx(O,{size:13})})]},t.id))}),e.jsxs("label",{className:"collab-monitor-search",children:[e.jsx(te,{size:15}),e.jsx("input",{"aria-label":"搜索所有原始会话",placeholder:"搜索所有会话的标题、目录或 Agent",value:c,onChange:t=>g(t.target.value)})]}),e.jsxs("div",{className:"collab-monitor-results","aria-label":"原始会话候选","aria-busy":x,onScroll:t=>{const o=t.currentTarget;o.scrollHeight-o.scrollTop-o.clientHeight<64&&y()},children:[C.map(N),!x&&!u&&!C.length&&e.jsx("p",{className:"collab-muted",children:c?"没有匹配的会话":"暂无可接入会话"}),x&&e.jsx("p",{className:"collab-muted",role:"status",children:"正在加载会话…"}),h.nextCursor&&!u&&e.jsx("button",{type:"button",className:"collab-monitor-more",disabled:x,onClick:()=>void y(),children:"加载更多会话"})]}),u&&e.jsxs("p",{className:"collab-error",role:"alert",children:[u," ",e.jsx("button",{type:"button",onClick:()=>d(t=>t+1),children:"重新加载"})]})]})}function I({children:r,...s}){return e.jsxs("span",{className:"collab-select",children:[e.jsx("select",{...s,children:r}),e.jsx(Q,{size:16,"aria-hidden":"true"})]})}function M(r){return{id:crypto.randomUUID(),name:r===0?"群主":`成员 ${r}`,agentType:"codex",role:""}}function ce({member:r,index:s,owner:c,supervisor:g,health:S,onChange:h,onRemove:w}){const[x,v]=n.useState([]),[u,b]=n.useState([]);return n.useEffect(()=>{let l=!0;return v([]),b([]),r.agentType==="customer-agent"?(window.agentApi.getSettings().then(d=>{l&&b(d.profiles.map(({id:i,name:j,modelId:y})=>({id:i,name:j,modelId:y})))}).catch(()=>{}),()=>{l=!1}):(window.agentApi.listAgentModels(r.agentType).then(d=>{l&&v(d.models)}).catch(()=>{}),()=>{l=!1})},[r.agentType]),e.jsxs("fieldset",{className:"collab-member-editor",children:[e.jsxs("legend",{children:[c?e.jsx(V,{size:14}):e.jsx(ae,{size:14}),c?"群主":`成员 ${s}`,g?" · 监工":""]}),w&&e.jsx("button",{type:"button",className:"collab-remove","aria-label":`移除${r.name}`,onClick:w,children:e.jsx(O,{size:16})}),e.jsxs("div",{className:"collab-editor-fields",children:[e.jsxs("label",{children:["名称",e.jsx("input",{value:r.name,maxLength:100,onChange:l=>h({...r,name:l.target.value}),required:!0})]}),e.jsxs("label",{children:["Agent",e.jsx(I,{value:r.agentType,onChange:l=>h({...r,agentType:l.target.value,model:void 0,profileId:void 0}),children:Y.map(l=>{var d,i;return e.jsxs("option",{value:l,disabled:((d=S.find(j=>j.agentType===l))==null?void 0:d.available)===!1,children:[P[l],((i=S.find(j=>j.agentType===l))==null?void 0:i.available)===!1?" · 不可用":""]},l)})})]}),e.jsxs("label",{className:"collab-model-field",children:["模型",r.agentType==="customer-agent"?e.jsxs(I,{value:r.profileId||"",onChange:l=>{const d=u.find(i=>i.id===l.target.value);h({...r,profileId:d==null?void 0:d.id,model:d?{id:d.modelId}:void 0})},children:[e.jsx("option",{value:"",children:"沿用默认模型"}),u.map(l=>e.jsxs("option",{value:l.id,children:[l.name," · ",l.modelId]},l.id))]}):e.jsxs(I,{value:r.model?`${r.model.providerID||""}|${r.model.id}`:"",onChange:l=>{const d=x.find(i=>`${i.providerID||""}|${i.id}`===l.target.value);h({...r,model:d?{id:d.id,...d.providerID?{providerID:d.providerID}:{}}:void 0})},children:[e.jsx("option",{value:"",children:"沿用默认模型"}),x.map(l=>e.jsxs("option",{value:`${l.providerID||""}|${l.id}`,children:[l.displayName||l.id,l.providerDisplayName?` · ${l.providerDisplayName}`:""]},`${l.providerID}|${l.id}`))]})]})]}),e.jsxs("details",{className:"collab-role-options",open:g||void 0,children:[e.jsxs("summary",{children:[e.jsx("span",{children:"定位与职责"}),e.jsx("span",{className:"collab-muted",children:r.role.trim()?"已设置":c?"默认安排与汇总":"留空由群主分配"}),e.jsx(Q,{size:14})]}),e.jsx("textarea",{"aria-label":`${c?"群主":`成员 ${s}`}的定位与职责(选填)`,rows:2,maxLength:8e3,value:r.role,placeholder:g?"重点看什么:异常暂停、任务交接和交付。允许怎么处理:原任务内自动恢复、继续、协调交接;业务取舍或无法恢复时提醒我决策。":c?"负责拆解目标、分配任务、验收和汇总成果":"例如:负责实现接口;留空由群主自动分配",onChange:l=>h({...r,role:l.target.value})}),g&&e.jsx("p",{className:"collab-muted",children:"在职责中写明关注内容、判断标准、允许的恢复与交接,以及何时提醒你或等待决策。"})]})]})}function ve({cwd:r,initialGroup:s,health:c,onClose:g,onCreated:S}){var F;const[h,w]=n.useState((s==null?void 0:s.name)||""),[x,v]=n.useState((s==null?void 0:s.cwd)||r||""),[u,b]=n.useState(()=>s?structuredClone(s.members):[M(0),M(1)]),[l,d]=n.useState((s==null?void 0:s.ownerId)||u[0].id),[i,j]=n.useState((s==null?void 0:s.maxParallel)||3),[y,A]=n.useState(()=>{var a;return structuredClone(((a=s==null?void 0:s.monitoring)==null?void 0:a.targets)??[])}),[C,z]=n.useState(s?((F=s.monitoring)==null?void 0:F.supervisorId)??"":u[0].id),[N,t]=n.useState(!1),[o,p]=n.useState(""),[f,D]=n.useState(!1),[W,R]=n.useState(!!(s!=null&&s.cwd)),[k,B]=n.useState(!1),X=async()=>{if(p(""),K()){D(!0);return}B(!0);try{const a=await window.agentApi.openFileDialog();a&&(v(a),R(!0))}catch(a){p(a instanceof Error?a.message:"无法选择工作目录")}finally{B(!1)}};return n.useEffect(()=>{const a=m=>{m.key==="Escape"&&!N&&!f&&!k&&g()};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[g,N,f,k]),e.jsxs("div",{className:"collab-modal-backdrop",onMouseDown:a=>{a.target===a.currentTarget&&!N&&g()},children:[e.jsxs("form",{className:"collab-create",role:"dialog","aria-modal":"true","aria-labelledby":"collab-create-title",onSubmit:async a=>{a.preventDefault(),t(!0),p("");try{if(!x.trim())throw new Error("请先选择工作目录");const m=u.find($=>{var E;return((E=c.find(J=>J.agentType===$.agentType))==null?void 0:E.available)===!1});if(m&&!s)throw new Error(`${m.name} 选择的 Agent 当前不可用`);const T=await L({...s?{action:"updateGroup",groupId:s.id}:{action:"createGroup"},group:{name:h.trim()||"协作群",cwd:x.trim(),ownerId:l,members:u,maxParallel:Math.min(i,u.length),...y.length?{monitoring:{targets:y,...C?{supervisorId:C}:{}}}:{}}});S(T)}catch(m){p(m instanceof Error?m.message:String(m))}finally{t(!1)}},children:[e.jsxs("header",{children:[e.jsxs("div",{children:[e.jsx("span",{className:"collab-eyebrow",children:"一起完成一件事"}),e.jsx("h2",{id:"collab-create-title",children:s?"修改协作群":"拉个协作群"})]}),e.jsx("button",{type:"button","aria-label":"关闭群设置",onClick:g,disabled:N,children:e.jsx(O,{size:20})})]}),e.jsxs("div",{className:"collab-create-scroll",children:[e.jsxs("div",{className:"collab-group-fields",children:[e.jsxs("label",{children:[e.jsx("span",{children:"群名称"}),e.jsx("input",{autoFocus:!0,value:h,maxLength:100,placeholder:"例如:产品开发小组",onChange:a=>w(a.target.value)})]}),e.jsxs("label",{children:[e.jsx("span",{children:"工作目录"}),e.jsxs("button",{type:"button",className:"collab-directory-picker","aria-label":"选择工作目录","aria-haspopup":"dialog","aria-expanded":f,title:x||"选择工作目录",disabled:N||k,onClick:()=>void X(),children:[e.jsx(se,{size:16,"aria-hidden":"true"}),e.jsx("span",{className:x?void 0:"collab-muted",children:k?"正在选择…":x||"选择工作目录"}),e.jsx(U,{size:16,"aria-hidden":"true"})]})]})]}),e.jsx("p",{className:"collab-create-hint collab-muted",children:s?"配置保存后用于新讨论,已有讨论和聊天记录保留。":"Agent 可重复加入,职责留空由群主分配。"}),u.map((a,m)=>e.jsx(ce,{member:a,index:m,owner:a.id===l,supervisor:y.length>0&&a.id===C,health:c,onChange:T=>b($=>$.map(E=>E.id===T.id?T:E)),onRemove:a.id!==l&&u.length>2?()=>{a.id===C&&z(""),b(T=>T.filter($=>$.id!==a.id))}:void 0},a.id)),e.jsxs("div",{className:"collab-create-actions",children:[e.jsxs("label",{children:["群主",e.jsx(I,{value:l,onChange:a=>d(a.target.value),children:u.map(a=>e.jsx("option",{value:a.id,children:a.name},a.id))})]}),e.jsxs("button",{type:"button",disabled:u.length>=20,onClick:()=>b(a=>[...a,M(a.length)]),children:[e.jsx(U,{size:16}),"添加成员"]}),e.jsxs("label",{children:["最多同时工作",e.jsx(I,{value:Math.min(i,u.length),onChange:a=>j(Number(a.target.value)),children:u.map((a,m)=>e.jsxs("option",{value:m+1,children:[m+1," 人"]},m+1))})]})]}),e.jsx(oe,{value:y,onChange:A}),y.length>0&&e.jsxs("label",{className:"collab-supervisor-select",children:["监工",e.jsxs(I,{"aria-label":"选择监工成员",value:C,onChange:a=>z(a.target.value),children:[e.jsx("option",{value:"",children:"仅关联,不启用监工"}),u.map(a=>e.jsxs("option",{value:a.id,children:[a.name," · ",P[a.agentType]]},a.id))]}),e.jsx("small",{className:"collab-muted",children:"复用该成员的 Agent、模型和职责,关闭看板后继续监管。"})]})]}),o&&e.jsx("p",{className:"collab-error",role:"alert",children:o}),e.jsxs("footer",{children:[e.jsx("span",{className:"collab-muted",children:"职责可以留空,发送任务后由群主分配。"}),e.jsx("button",{className:"collab-primary",disabled:N||k||!x.trim(),type:"submit",children:N?"正在保存…":s?"保存修改":"创建并打开群"})]})]}),e.jsx(Z,{open:f,initialPath:W?x:void 0,onCancel:()=>D(!1),onConfirm:a=>{v(a),R(!0),D(!1),p("")}})]})}export{ve as C,le as S,re as u};
@@ -1 +1 @@
1
- import{r as t,u as O,j as e,R as P,h as S,k as $,a as g}from"./index-CrjQF-VW.js";import{C as _,a as B,b as G}from"./CollaborationTabBridge-Dxq4G1Uk.js";import{C as M}from"./CollaborationCreateDialog-DuEnjSu9.js";import{c as R,A as z}from"./client-ZvcI0WiM.js";import{p as H}from"./SessionDashboardBridge-Cw8Y0s5_.js";import{U as T}from"./collaboration-CeiB1Ihl.js";import{X as U}from"./x-3I6TKNBE.js";import{S as Y,i as q}from"./file-types-BsWJSk07.js";import{P as F,T as Q}from"./trash-2-CT_MslWu.js";import{C as X}from"./types-pH-pRUSS.js";import{A as J}from"./session-tree-Ck5Wp7h-.js";import"./HostProjectPicker-7zvVzftL.js";import"./chevron-right-Bnd4FK8S.js";import"./chevron-down-FeW7FcBS.js";function K(){const[u,m]=t.useState([]),[x,h]=t.useState(!0),[f,o]=t.useState(""),l=t.useRef(0),r=t.useCallback(async()=>{const n=++l.current;h(!0);try{const i=await R({action:"groups"});l.current===n&&(m(i),o(""))}catch(i){l.current===n&&o(i instanceof Error?i.message:String(i))}finally{l.current===n&&h(!1)}},[]);return t.useEffect(()=>{r();const n=()=>{r()};return window.addEventListener("focus",n),()=>{l.current++,window.removeEventListener("focus",n)}},[r]),{groups:u,loading:x,error:f,refresh:r}}function me({onOpen:u,onChanged:m,onClose:x,onViewDashboard:h,cwd:f}){const{groups:o,loading:l,error:r,refresh:n}=K(),[i,L]=t.useState(""),[c,b]=t.useState(null),[j,w]=t.useState(null),[p,y]=t.useState(!1),[v,N]=t.useState(""),[D,I]=t.useState([]),E=O(s=>s.skin);t.useEffect(()=>{!l&&window.parent!==window&&window.parent.postMessage({type:_},window.location.origin)},[l]),t.useEffect(()=>{document.documentElement.setAttribute("data-skin",E)},[E]),t.useEffect(()=>{let s=!0;return window.agentApi.getRuntimeHealth().then(a=>{s&&I(a)}).catch(()=>{}),()=>{s=!1}},[]);const C=s=>{u?u(s):window.parent!==window?window.parent.postMessage({type:B,groupId:s.id,title:s.name},window.location.origin):location.assign(`?view=collaboration&groupId=${encodeURIComponent(s.id)}`)},A=(s,a)=>{m==null||m(s,a),window.parent!==window&&window.parent.postMessage({type:G,groupId:s,...a?{title:a.name}:{deleted:!0}},window.location.origin),n()},k=o.filter(s=>`${s.name} ${s.cwd} ${s.members.map(a=>a.name).join(" ")}`.toLowerCase().includes(i.trim().toLowerCase()));return e.jsxs("main",{className:"collab-dashboard",children:[e.jsxs("header",{className:"collab-dashboard-heading",children:[e.jsxs("div",{children:[e.jsx("span",{className:"collab-eyebrow",children:"协作空间"}),e.jsxs("h1",{children:["群聊列表 ",e.jsx("small",{children:o.length})]}),e.jsx("p",{className:"collab-muted",children:"找到你的群,继续上次的协作。"})]}),e.jsxs("div",{className:"collab-dashboard-tools",children:[e.jsx("button",{onClick:()=>h?h():H({kind:"dashboard"}),children:"Dashboard"}),e.jsx("button",{"aria-label":"刷新群列表",title:"刷新群列表",disabled:l,onClick:()=>void n(),children:e.jsx(P,{size:17})}),e.jsxs("button",{className:"collab-primary",onClick:()=>b("new"),children:[e.jsx(S,{size:17}),"新增群聊"]}),x&&e.jsx("button",{"aria-label":"关闭群看板",onClick:x,children:e.jsx(U,{size:18})})]})]}),e.jsxs("label",{className:"collab-dashboard-search",children:[e.jsx(Y,{size:17}),e.jsx("input",{"aria-label":"搜索群聊",placeholder:"搜索群名、成员或工作目录",value:i,onChange:s=>L(s.target.value)})]}),r&&e.jsxs("div",{className:"collab-error",role:"alert",children:[r,e.jsx("button",{onClick:()=>void n(),children:"重试"})]}),l&&o.length===0?e.jsx("div",{className:"collab-dashboard-empty",role:"status",children:"正在加载已保存的群…"}):!r&&k.length===0?e.jsxs("div",{className:"collab-dashboard-empty",children:[e.jsx(T,{size:32}),e.jsx("h2",{children:i?"没有找到匹配的群":"还没有协作群"}),e.jsx("p",{children:i?"换个关键词试试。":"选一位群主和成员,一起完成任务。"}),!i&&e.jsxs("button",{className:"collab-primary",onClick:()=>b("new"),children:[e.jsx(S,{size:16}),"新建第一个群"]})]}):e.jsx("section",{className:"collab-dashboard-grid","aria-label":"已保存的群聊","aria-busy":l,children:k.map(s=>{const a=s.members.find(d=>d.id===s.ownerId);return e.jsxs("article",{className:"collab-group-card",children:[e.jsxs("div",{className:"collab-card-heading",children:[e.jsxs("button",{className:"collab-card-title",onClick:()=>C(s),title:s.name,children:[e.jsx(T,{size:20}),e.jsx("h2",{children:s.name})]}),e.jsxs("div",{className:"collab-card-actions",children:[e.jsx("button",{"aria-label":`修改${s.name}`,title:"修改群设置",onClick:()=>b(s),children:e.jsx(F,{size:16})}),e.jsx("button",{"aria-label":`删除${s.name}`,title:"删除群聊",onClick:()=>{N(""),w(s)},children:e.jsx(Q,{size:16})})]})]}),e.jsxs("p",{className:"collab-card-owner",children:[e.jsx(X,{size:14}),e.jsxs("span",{children:["群主 · ",a==null?void 0:a.name]}),e.jsx("span",{className:"collab-muted",children:a&&z[a.agentType]})]}),e.jsxs("div",{className:"collab-card-members","aria-label":`${s.members.length} 名群成员`,children:[s.members.slice(0,7).map(d=>e.jsx("span",{title:`${d.name} · ${z[d.agentType]}`,children:e.jsx($,{agentType:d.agentType,size:18})},d.id)),e.jsxs("small",{children:[s.members.length," 人 · 最多 ",s.maxParallel," 人并行"]})]}),e.jsxs("p",{className:"collab-card-path",title:s.cwd,children:[e.jsx(q,{size:14}),e.jsx("span",{children:s.cwd})]}),e.jsxs("footer",{children:[e.jsxs("time",{dateTime:s.createdAt,children:[new Date(s.createdAt).toLocaleDateString("zh-CN")," 创建"]}),e.jsxs("button",{onClick:()=>C(s),children:["进入群聊",e.jsx(J,{size:16})]})]})]},s.id)})}),c&&g.createPortal(e.jsx(M,{cwd:f,initialGroup:c==="new"?void 0:c,health:D,onClose:()=>b(null),onCreated:s=>{const a=c==="new";b(null),A(s.id,s),a&&C(s)}},c==="new"?"new":c.id),document.body),j&&g.createPortal(e.jsx("div",{className:"collab-modal-backdrop",children:e.jsxs("section",{className:"collab-delete-dialog",role:"alertdialog","aria-modal":"true","aria-labelledby":"collab-delete-title","aria-describedby":"collab-delete-description",children:[e.jsxs("h2",{id:"collab-delete-title",children:["删除“",j.name,"”?"]}),e.jsx("p",{id:"collab-delete-description",children:"删除后将停止监工并取消关联定时任务,原始业务会话和工作目录文件会保留。进行中的协作需要先停止。"}),v&&e.jsx("p",{className:"collab-error",role:"alert",children:v}),e.jsxs("footer",{children:[e.jsx("button",{autoFocus:!0,disabled:p,onClick:()=>w(null),children:"取消"}),e.jsx("button",{className:"collab-delete-confirm",disabled:p,onClick:async()=>{y(!0),N("");try{await R({action:"deleteGroup",groupId:j.id}),A(j.id),w(null)}catch(s){N(s instanceof Error?s.message:String(s))}finally{y(!1)}},children:p?"正在删除…":"确认删除"})]})]})}),document.body)]})}export{me as default};
1
+ import{r as t,u as O,j as e,R as P,h as S,k as $,a as g}from"./index-D1AQffdA.js";import{C as _,a as B,b as G}from"./CollaborationTabBridge-Dxq4G1Uk.js";import{C as M}from"./CollaborationCreateDialog-tI6S1cha.js";import{c as R,A as z}from"./client-5Hu1eVTX.js";import{p as H}from"./SessionDashboardBridge-AhmhQ1Xn.js";import{U as T}from"./collaboration-DRFqpcAz.js";import{X as U}from"./x-uSekqXJV.js";import{S as Y,i as q}from"./file-types-BZ8YZAV-.js";import{P as F,T as Q}from"./trash-2-BF9eI5Bh.js";import{C as X}from"./types-BuPq0iQM.js";import{A as J}from"./session-tree-CEy-pW8A.js";import"./HostProjectPicker--J4_JpSW.js";import"./chevron-right-DKsui_wS.js";import"./chevron-down-hiPnZS_M.js";function K(){const[u,m]=t.useState([]),[x,h]=t.useState(!0),[f,o]=t.useState(""),l=t.useRef(0),r=t.useCallback(async()=>{const n=++l.current;h(!0);try{const i=await R({action:"groups"});l.current===n&&(m(i),o(""))}catch(i){l.current===n&&o(i instanceof Error?i.message:String(i))}finally{l.current===n&&h(!1)}},[]);return t.useEffect(()=>{r();const n=()=>{r()};return window.addEventListener("focus",n),()=>{l.current++,window.removeEventListener("focus",n)}},[r]),{groups:u,loading:x,error:f,refresh:r}}function me({onOpen:u,onChanged:m,onClose:x,onViewDashboard:h,cwd:f}){const{groups:o,loading:l,error:r,refresh:n}=K(),[i,L]=t.useState(""),[c,b]=t.useState(null),[j,w]=t.useState(null),[p,y]=t.useState(!1),[v,N]=t.useState(""),[D,I]=t.useState([]),E=O(s=>s.skin);t.useEffect(()=>{!l&&window.parent!==window&&window.parent.postMessage({type:_},window.location.origin)},[l]),t.useEffect(()=>{document.documentElement.setAttribute("data-skin",E)},[E]),t.useEffect(()=>{let s=!0;return window.agentApi.getRuntimeHealth().then(a=>{s&&I(a)}).catch(()=>{}),()=>{s=!1}},[]);const C=s=>{u?u(s):window.parent!==window?window.parent.postMessage({type:B,groupId:s.id,title:s.name},window.location.origin):location.assign(`?view=collaboration&groupId=${encodeURIComponent(s.id)}`)},A=(s,a)=>{m==null||m(s,a),window.parent!==window&&window.parent.postMessage({type:G,groupId:s,...a?{title:a.name}:{deleted:!0}},window.location.origin),n()},k=o.filter(s=>`${s.name} ${s.cwd} ${s.members.map(a=>a.name).join(" ")}`.toLowerCase().includes(i.trim().toLowerCase()));return e.jsxs("main",{className:"collab-dashboard",children:[e.jsxs("header",{className:"collab-dashboard-heading",children:[e.jsxs("div",{children:[e.jsx("span",{className:"collab-eyebrow",children:"协作空间"}),e.jsxs("h1",{children:["群聊列表 ",e.jsx("small",{children:o.length})]}),e.jsx("p",{className:"collab-muted",children:"找到你的群,继续上次的协作。"})]}),e.jsxs("div",{className:"collab-dashboard-tools",children:[e.jsx("button",{onClick:()=>h?h():H({kind:"dashboard"}),children:"Dashboard"}),e.jsx("button",{"aria-label":"刷新群列表",title:"刷新群列表",disabled:l,onClick:()=>void n(),children:e.jsx(P,{size:17})}),e.jsxs("button",{className:"collab-primary",onClick:()=>b("new"),children:[e.jsx(S,{size:17}),"新增群聊"]}),x&&e.jsx("button",{"aria-label":"关闭群看板",onClick:x,children:e.jsx(U,{size:18})})]})]}),e.jsxs("label",{className:"collab-dashboard-search",children:[e.jsx(Y,{size:17}),e.jsx("input",{"aria-label":"搜索群聊",placeholder:"搜索群名、成员或工作目录",value:i,onChange:s=>L(s.target.value)})]}),r&&e.jsxs("div",{className:"collab-error",role:"alert",children:[r,e.jsx("button",{onClick:()=>void n(),children:"重试"})]}),l&&o.length===0?e.jsx("div",{className:"collab-dashboard-empty",role:"status",children:"正在加载已保存的群…"}):!r&&k.length===0?e.jsxs("div",{className:"collab-dashboard-empty",children:[e.jsx(T,{size:32}),e.jsx("h2",{children:i?"没有找到匹配的群":"还没有协作群"}),e.jsx("p",{children:i?"换个关键词试试。":"选一位群主和成员,一起完成任务。"}),!i&&e.jsxs("button",{className:"collab-primary",onClick:()=>b("new"),children:[e.jsx(S,{size:16}),"新建第一个群"]})]}):e.jsx("section",{className:"collab-dashboard-grid","aria-label":"已保存的群聊","aria-busy":l,children:k.map(s=>{const a=s.members.find(d=>d.id===s.ownerId);return e.jsxs("article",{className:"collab-group-card",children:[e.jsxs("div",{className:"collab-card-heading",children:[e.jsxs("button",{className:"collab-card-title",onClick:()=>C(s),title:s.name,children:[e.jsx(T,{size:20}),e.jsx("h2",{children:s.name})]}),e.jsxs("div",{className:"collab-card-actions",children:[e.jsx("button",{"aria-label":`修改${s.name}`,title:"修改群设置",onClick:()=>b(s),children:e.jsx(F,{size:16})}),e.jsx("button",{"aria-label":`删除${s.name}`,title:"删除群聊",onClick:()=>{N(""),w(s)},children:e.jsx(Q,{size:16})})]})]}),e.jsxs("p",{className:"collab-card-owner",children:[e.jsx(X,{size:14}),e.jsxs("span",{children:["群主 · ",a==null?void 0:a.name]}),e.jsx("span",{className:"collab-muted",children:a&&z[a.agentType]})]}),e.jsxs("div",{className:"collab-card-members","aria-label":`${s.members.length} 名群成员`,children:[s.members.slice(0,7).map(d=>e.jsx("span",{title:`${d.name} · ${z[d.agentType]}`,children:e.jsx($,{agentType:d.agentType,size:18})},d.id)),e.jsxs("small",{children:[s.members.length," 人 · 最多 ",s.maxParallel," 人并行"]})]}),e.jsxs("p",{className:"collab-card-path",title:s.cwd,children:[e.jsx(q,{size:14}),e.jsx("span",{children:s.cwd})]}),e.jsxs("footer",{children:[e.jsxs("time",{dateTime:s.createdAt,children:[new Date(s.createdAt).toLocaleDateString("zh-CN")," 创建"]}),e.jsxs("button",{onClick:()=>C(s),children:["进入群聊",e.jsx(J,{size:16})]})]})]},s.id)})}),c&&g.createPortal(e.jsx(M,{cwd:f,initialGroup:c==="new"?void 0:c,health:D,onClose:()=>b(null),onCreated:s=>{const a=c==="new";b(null),A(s.id,s),a&&C(s)}},c==="new"?"new":c.id),document.body),j&&g.createPortal(e.jsx("div",{className:"collab-modal-backdrop",children:e.jsxs("section",{className:"collab-delete-dialog",role:"alertdialog","aria-modal":"true","aria-labelledby":"collab-delete-title","aria-describedby":"collab-delete-description",children:[e.jsxs("h2",{id:"collab-delete-title",children:["删除“",j.name,"”?"]}),e.jsx("p",{id:"collab-delete-description",children:"删除后将停止监工并取消关联定时任务,原始业务会话和工作目录文件会保留。进行中的协作需要先停止。"}),v&&e.jsx("p",{className:"collab-error",role:"alert",children:v}),e.jsxs("footer",{children:[e.jsx("button",{autoFocus:!0,disabled:p,onClick:()=>w(null),children:"取消"}),e.jsx("button",{className:"collab-delete-confirm",disabled:p,onClick:async()=>{y(!0),N("");try{await R({action:"deleteGroup",groupId:j.id}),A(j.id),w(null)}catch(s){N(s instanceof Error?s.message:String(s))}finally{y(!1)}},children:p?"正在删除…":"确认删除"})]})]})}),document.body)]})}export{me as default};
@@ -1,4 +1,4 @@
1
- import{c as Re,r as c,j as e,k as W,n as Ce,t as Ae,x as Le,u as Pe,h as xe,M as Oe,y as Fe}from"./index-CrjQF-VW.js";import{r as Ie,p as Be}from"./artifact-links-B0ApmgK6.js";import{i as _e,r as Ue,p as Ge,a as He,M as We,S as Ye}from"./composer-file-routing-CFoCNmv7.js";import{p as Ke}from"./SessionDashboardBridge-Cw8Y0s5_.js";import{S as Ve}from"./shield-check-BIxrmOwR.js";import{A as Z,c as R,D as je}from"./client-ZvcI0WiM.js";import{U as X}from"./collaboration-CeiB1Ihl.js";import{X as Te}from"./x-3I6TKNBE.js";import{b as ie,C as Ze}from"./types-pH-pRUSS.js";import{c as Je}from"./CollaborationTabBridge-Dxq4G1Uk.js";import{L as ve}from"./loader-circle-BSDHoDXf.js";import{H as Qe}from"./history-BGr6tFSR.js";import{I as Xe}from"./image-plus-Cr9rDqvd.js";import{C as et}from"./check-CY3GCzxa.js";/**
1
+ import{c as Re,r as c,j as e,k as W,n as Ce,t as Ae,x as Le,u as Pe,h as xe,M as Oe,y as Fe}from"./index-D1AQffdA.js";import{r as Ie,p as Be}from"./artifact-links-B0ApmgK6.js";import{i as _e,r as Ue,p as Ge,a as He,M as We,S as Ye}from"./composer-file-routing-BtvXnu_o.js";import{p as Ke}from"./SessionDashboardBridge-AhmhQ1Xn.js";import{S as Ve}from"./shield-check-CFebh9do.js";import{A as Z,c as R,D as je}from"./client-5Hu1eVTX.js";import{U as X}from"./collaboration-DRFqpcAz.js";import{X as Te}from"./x-uSekqXJV.js";import{b as ie,C as Ze}from"./types-BuPq0iQM.js";import{c as Je}from"./CollaborationTabBridge-Dxq4G1Uk.js";import{L as ve}from"./loader-circle-xEKTnlp3.js";import{H as Qe}from"./history-Ci0s2eVL.js";import{I as Xe}from"./image-plus-Cx4LQVvj.js";import{C as et}from"./check-D-yTByNl.js";/**
2
2
  * @license lucide-react v0.468.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./codeSyntax-DlCdufoQ.js","./index-CrjQF-VW.js","./index-zQk0NCEB.css","./artifact-links-B0ApmgK6.js","./rotate-ccw-DtSpwbK7.js","./loader-circle-BSDHoDXf.js","./trash-2-CT_MslWu.js","./check-CY3GCzxa.js","./download-Cy_rpjte.js","./x-3I6TKNBE.js"])))=>i.map(i=>d[i]);
2
- import{c as De,r,ae as _t,j as t,R as Te}from"./index-CrjQF-VW.js";import{i as de}from"./artifact-links-B0ApmgK6.js";import{R as Dt}from"./rotate-ccw-DtSpwbK7.js";import{L as Z}from"./loader-circle-BSDHoDXf.js";import{P as It}from"./trash-2-CT_MslWu.js";import{C as rt}from"./check-CY3GCzxa.js";import{D as Ht}from"./download-Cy_rpjte.js";import{X as Wt}from"./x-3I6TKNBE.js";/**
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./codeSyntax-Jy5nWtHv.js","./index-D1AQffdA.js","./index-zQk0NCEB.css","./artifact-links-B0ApmgK6.js","./rotate-ccw-HY6j6nBt.js","./loader-circle-xEKTnlp3.js","./trash-2-BF9eI5Bh.js","./check-D-yTByNl.js","./download-B2jLl85N.js","./x-uSekqXJV.js"])))=>i.map(i=>d[i]);
2
+ import{c as De,r,ae as _t,j as t,R as Te}from"./index-D1AQffdA.js";import{i as de}from"./artifact-links-B0ApmgK6.js";import{R as Dt}from"./rotate-ccw-HY6j6nBt.js";import{L as Z}from"./loader-circle-xEKTnlp3.js";import{P as It}from"./trash-2-BF9eI5Bh.js";import{C as rt}from"./check-D-yTByNl.js";import{D as Ht}from"./download-B2jLl85N.js";import{X as Wt}from"./x-uSekqXJV.js";/**
3
3
  * @license lucide-react v0.468.0 - ISC
4
4
  *
5
5
  * This source code is licensed under the ISC license.
@@ -16,6 +16,6 @@ import{c as De,r,ae as _t,j as t,R as Te}from"./index-CrjQF-VW.js";import{i as d
16
16
  * See the LICENSE file in the root directory of this source tree.
17
17
  */const Ft=De("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]),At=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/;function Ot(e){if(!e.trim())return{rows:[],added:0,removed:0};const n=[];let l=0,a=0,x=!1,g=0,c=0;for(const f of e.replace(/\n$/,"").split(`
18
18
  `)){const k=f.match(At);if(k){l=Number(k[1]),a=Number(k[2]),x=!0,n.push({kind:"hunk",text:f,oldLine:null,newLine:null});continue}if(!x){!f.startsWith("diff --git ")&&!f.startsWith("index ")&&!f.startsWith("--- ")&&!f.startsWith("+++ ")&&n.push({kind:"meta",text:f,oldLine:null,newLine:null});continue}f.startsWith("+")?(n.push({kind:"added",text:f.slice(1),oldLine:null,newLine:a}),a+=1,g+=1):f.startsWith("-")?(n.push({kind:"removed",text:f.slice(1),oldLine:l,newLine:null}),l+=1,c+=1):f.startsWith(" ")?(n.push({kind:"context",text:f.slice(1),oldLine:l,newLine:a}),l+=1,a+=1):n.push({kind:"note",text:f,oldLine:null,newLine:null})}return{rows:n,added:g,removed:c}}const it=256*1024,hn=16*1024,Bt={java:"java",js:"javascript",jsx:"javascript",mjs:"javascript",cjs:"javascript",ts:"typescript",tsx:"typescript",json:"json",py:"python",sh:"bash",bash:"bash",zsh:"bash",css:"css",scss:"scss",html:"xml",htm:"xml",xml:"xml",vue:"xml",svelte:"xml",astro:"xml",yml:"yaml",yaml:"yaml",toml:"ini",env:"ini",sql:"sql",c:"c",h:"c",cpp:"cpp",hpp:"cpp",go:"go",rs:"rust",kt:"kotlin",rb:"ruby",md:"markdown",markdown:"markdown",mdown:"markdown",mkdn:"markdown",mdx:"markdown",dockerfile:"dockerfile",gradle:"groovy",properties:"properties",graphql:"graphql",proto:"protobuf"};function Ut(e){var a;const n=((a=e.split(/[/\\]/).pop())==null?void 0:a.toLowerCase())??"";if(n==="dockerfile"||n.startsWith("dockerfile."))return"dockerfile";if(n===".env"||n.startsWith(".env."))return"ini";if(n===".bashrc"||n===".zshrc")return"bash";const l=n.includes(".")?n.slice(n.lastIndexOf(".")+1):"";return Bt[l]??null}function Xt(e){const n=[""];for(const l of e){const a=l.split(`
19
- `);n[n.length-1]+=a[0];for(let x=1;x<a.length;x+=1)n.push(a[x])}return n}function $t({path:e,chunks:n,fileSize:l}){const[a,x]=r.useState(null),g=Ut(e),c=n.length>0&&g!==null&&(l===void 0||l<=it)&&n.reduce((y,u)=>y+u.length,0)<=it;r.useEffect(()=>{if(!c)return;let y=!1;return _t(async()=>{const{highlightCodeLines:u}=await import("./codeSyntax-DlCdufoQ.js");return{highlightCodeLines:u}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]),import.meta.url).then(({highlightCodeLines:u})=>{y||x(()=>u)}).catch(()=>{}),()=>{y=!0}},[c]);const f=r.useMemo(()=>Xt(n),[n]),k=r.useMemo(()=>c&&a?a(e,n.join("")):null,[n,c,a,e]);return t.jsx("code",{className:"file-code-preview","data-language":g??void 0,children:f.map((y,u)=>{const C=u<f.length-1?`
19
+ `);n[n.length-1]+=a[0];for(let x=1;x<a.length;x+=1)n.push(a[x])}return n}function $t({path:e,chunks:n,fileSize:l}){const[a,x]=r.useState(null),g=Ut(e),c=n.length>0&&g!==null&&(l===void 0||l<=it)&&n.reduce((y,u)=>y+u.length,0)<=it;r.useEffect(()=>{if(!c)return;let y=!1;return _t(async()=>{const{highlightCodeLines:u}=await import("./codeSyntax-Jy5nWtHv.js");return{highlightCodeLines:u}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]),import.meta.url).then(({highlightCodeLines:u})=>{y||x(()=>u)}).catch(()=>{}),()=>{y=!0}},[c]);const f=r.useMemo(()=>Xt(n),[n]),k=r.useMemo(()=>c&&a?a(e,n.join("")):null,[n,c,a,e]);return t.jsx("code",{className:"file-code-preview","data-language":g??void 0,children:f.map((y,u)=>{const C=u<f.length-1?`
20
20
  `:"";return t.jsxs(r.Fragment,{children:[t.jsx("span",{className:"file-code-line-number","aria-hidden":"true","data-line-number":u+1}),k?t.jsx("span",{className:"file-code-line-content",dangerouslySetInnerHTML:{__html:k[u]+C}}):t.jsxs("span",{className:"file-code-line-content",children:[y,C]})]},u)})})}const at=new Set(["ts","tsx","js","jsx","mjs","cjs","json","md","markdown","mdown","mkdn","mdx","css","scss","html","htm","xml","yml","yaml","toml","sh","zsh","bash","py","rb","go","rs","java","kt","c","h","cpp","hpp","sql","env","gitignore","dockerfile","txt","log","conf","properties","gradle","lock","csv","vue","svelte","astro","graphql","prisma","proto"]),qt=new Set(["png","jpg","jpeg","gif","webp","bmp","ico","svg"]),Gt=new Set(["html","htm"]),Yt=new Set(["md","markdown","mdown","mkdn","mdx"]),Vt=new Set(at),Jt="allow-scripts allow-popups allow-forms allow-modals",Qt=new Set(["mp4","webm","mov","m4v"]),Zt=new Set(["mp3","wav","m4a","aac","ogg","flac"]),Kt=new Set(["pdf"]),en=8*1024*1024,tn=4096,nn=512*1024,lt=256*1024*1024,rn={aac:"audio/aac",csv:"text/csv",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",gif:"image/gif",html:"text/html",jpeg:"image/jpeg",jpg:"image/jpeg",json:"application/json",m4a:"audio/mp4",m4v:"video/mp4",md:"text/markdown",mov:"video/quicktime",mp3:"audio/mpeg",mp4:"video/mp4",ogg:"audio/ogg",pdf:"application/pdf",png:"image/png",ppt:"application/vnd.ms-powerpoint",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",svg:"image/svg+xml",tar:"application/x-tar",txt:"text/plain",wav:"audio/wav",webm:"video/webm",webp:"image/webp",xls:"application/vnd.ms-excel",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",xml:"application/xml",zip:"application/zip"};function ct(e,n){return n?!e.share||!e.canShare?"unsupported-browser":"ready":"insecure-context"}function dt(e){const n=ut(e);return rn[n]??"application/octet-stream"}function ut(e){var l;return((l=(de(e)?new URL(e).pathname:e).split(".").pop())==null?void 0:l.toLowerCase())??""}async function ft(e,n){var l;if(!n.share||!((l=n.canShare)!=null&&l.call(n,{files:[e]})))return"unsupported";try{return await n.share({files:[e],title:e.name}),"shared"}catch(a){if(a&&typeof a=="object"&&"name"in a&&a.name==="AbortError")return"cancelled";throw a}}function Ie(e){return Uint8Array.from(atob(e),n=>n.charCodeAt(0))}function mt(e,n,l){return e.decode(Ie(n),{stream:!l})}async function Me(e,n,l=()=>{},a=nn){const x=await n("fs:stat",{path:e});if(x.dir)throw new Error("文件夹不能下载");if(x.size>lt)throw new Error("文件超过 256M,请通过终端传输");const g=[];let c=0;do{const f=await n("fs:read",{path:e,offset:c,length:a},6e4),k=Ie(f.data);if(k.byteLength!==f.bytes)throw new Error("文件分块长度不一致,请重试");g.push(k.slice().buffer);const y=f.offset+f.bytes;if(!f.eof&&y<=c)throw new Error("文件下载未取得进展,请重试");if(c=y,l(x.size===0?100:Math.min(100,Math.round(c/x.size*100))),f.eof)break}while(c<x.size);return new Blob(g,{type:"application/octet-stream"})}function pt(e){var l;const n=((l=e.split(".").pop())==null?void 0:l.toLowerCase())??"";return Gt.has(n)}function xt(e){var l;const n=((l=e.split(".").pop())==null?void 0:l.toLowerCase())??"";return Yt.has(n)}function Re(e){var l;const n=((l=e.split(".").pop())==null?void 0:l.toLowerCase())??"";return Vt.has(n)}function ht(e){const n=ut(e);return at.has(n)||!e.includes(".")?"text":qt.has(n)?"image":Qt.has(n)?"video":Zt.has(n)?"audio":Kt.has(n)?"pdf":"hex"}function sn({path:e,gateway:n,onClose:l}){const a=n.request,[x,g]=r.useState([]),[c,f]=r.useState(null),[k,y]=r.useState(""),[u,C]=r.useState(null),[z,b]=r.useState("initial-loading"),[gt,He]=r.useState(!1),[We,K]=r.useState(0),[ue,fe]=r.useState(null),[S,T]=r.useState(null),[Pe,ee]=r.useState(null),[v,te]=r.useState(null),[bt,ne]=r.useState(!1),[Ne,I]=r.useState(null),[j,re]=r.useState(null),[vt,ie]=r.useState(!1),[me,pe]=r.useState(!0),[se,Fe]=r.useState(null),[Ae,xe]=r.useState("unavailable"),[he,ge]=r.useState(!1),[Oe,be]=r.useState(null),[F,ve]=r.useState("file"),[M,Be]=r.useState(!1),[Ue,we]=r.useState(!1),[ye,ke]=r.useState(!1),[w,O]=r.useState(!1),[L,A]=r.useState(""),[_,Xe]=r.useState(!1),[$e,H]=r.useState(null),[wt,B]=r.useState(!1),qe=r.useRef(null),Ge=r.useRef(null),oe=r.useRef(0),W=r.useRef(!1),p=r.useRef(0),U=r.useRef(!1),Se=r.useRef(new TextDecoder("utf-8",{fatal:!1})),je=r.useRef(null),X=r.useRef(null),Ee=r.useRef(!1),m=e?ht(e):"unsupported",Ce=e?de(e):!1,Ye=e?pt(e):!1,Ve=e?xt(e):!1,yt=Ye||Ve,Je=e?Re(e):!1,D=r.useMemo(()=>x.join(""),[x]),P=r.useCallback(()=>{const i=je.current;je.current=null,i&&a("fs:preview-close",{ticketId:i}).catch(()=>{})},[a]),$=r.useCallback(async(i,o=!1,s=p.current)=>{if(!U.current){U.current=!0,b(o?"initial-loading":"loading-more"),fe(null);try{const d=o?0:oe.current,h=await a("fs:read",{path:i,offset:d,length:256*1024});if(s!==p.current)return;const J=h.offset+h.bytes;if(!h.eof&&J<=d)throw new Error("文件加载未取得进展,请重试");o&&(Se.current=new TextDecoder("utf-8",{fatal:!1}));const le=mt(Se.current,h.data,h.eof);oe.current=J,pe(h.eof),K(J),g(E=>o?[le]:[...E,le]),C(E=>({size:h.size,mtime:(E==null?void 0:E.mtime)??0})),T(null),b("ready")}catch(d){if(s!==p.current)return;const h=d.message??String(d);o?(T(h),b("error")):(fe(h),b("ready"))}finally{s===p.current&&(U.current=!1)}}},[a]),Qe=r.useCallback(async(i,o)=>{try{const s=await a("fs:inspect-text-status",{path:i});if(o!==p.current)return;C({size:s.size,mtime:s.mtime}),xe(s.diffStatus),we(!s.tooLarge),B(!1),H(null)}catch{}},[a]),q=r.useCallback(async(i,o=p.current)=>{P(),b("initial-loading"),T(null);try{const s=await a("fs:preview-open",{path:i});if(o!==p.current){a("fs:preview-close",{ticketId:s.ticketId}).catch(()=>{});return}je.current=s.ticketId,X.current=s.url,f(s.url),C({size:s.size,mtime:s.mtime})}catch(s){if(o!==p.current)return;T(s.message??String(s)),b("error")}},[P,a]),Ze=r.useCallback(async(i,o=p.current)=>{b("initial-loading"),T(null);try{const s=await a("fs:read",{path:i,offset:0,length:tn});if(o!==p.current)return;kt(s.data),K(s.bytes),C(d=>({size:s.size,mtime:(d==null?void 0:d.mtime)??0})),b("ready")}catch(s){if(o!==p.current)return;T(s.message??String(s)),b("error")}},[a]);function kt(i){const o=atob(i),s=[];for(let d=0;d+16<=o.length||d===0;d+=16){const h=o.slice(d,d+16),J=[...h].map(E=>E.charCodeAt(0).toString(16).padStart(2,"0")).join(" ").padEnd(47," "),le=[...h].map(E=>E.charCodeAt(0)>=32&&E.charCodeAt(0)<127?E:".").join("");if(s.push(`${d.toString(16).padStart(8,"0")} ${J} |${le}|`),d+16>o.length)break}y(s.join(`
21
21
  `))}const R=r.useCallback((i,o)=>{const s=++p.current,d=Re(i);if(U.current=!1,P(),X.current=null,g([]),f(null),y(""),C(null),T(null),fe(null),K(0),ee(null),te(null),ne(!1),I(null),re(null),ie(!1),pe(!0),Fe(null),xe("unavailable"),ge(!1),be(null),ve("file"),we(!1),ke(!1),O(!1),A(""),H(null),B(!1),b("initial-loading"),W.current=!1,oe.current=0,Se.current=new TextDecoder("utf-8",{fatal:!1}),de(i)){X.current=i,f(i);return}a("fs:watch",{path:on(i)}).catch(()=>{}),o==="text"?(Qe(i,s),$(i,!0,s),d&&Ee.current&&q(i,s)):o==="image"||o==="video"||o==="audio"||o==="pdf"?q(i,s):o==="hex"&&(a("fs:stat",{path:i}).then(h=>{s===p.current&&C(h)}).catch(()=>{}),Ze(i,s))},[$,Ze,q,Qe,P,a]);r.useEffect(()=>{if(e)return Ee.current=!1,Be(!1),R(e,m),()=>{p.current++,U.current=!1,P()}},[e]),r.useEffect(()=>{let i=null;const o=s=>{const d=s.detail;!d||d!==e||(i!==null&&window.clearTimeout(i),i=window.setTimeout(()=>{m==="text"&&W.current?B(!0):e&&R(e,m)},350))};return window.addEventListener("file-changed",o),()=>{window.removeEventListener("file-changed",o),i!==null&&window.clearTimeout(i)}},[e,m,R]),r.useEffect(()=>{W.current=w},[w]),r.useEffect(()=>{if(z!=="initial-loading"){He(!1);return}const i=window.setTimeout(()=>He(!0),120);return()=>window.clearTimeout(i)},[e,z]),r.useEffect(()=>{const i=Ge.current,o=qe.current;if(!i||!o||!e||m!=="text"||me||w||F!=="file"||z!=="ready"||ue)return;const s=new IntersectionObserver(d=>{d.some(h=>h.isIntersecting)&&$(e)},{root:o,rootMargin:"0px 0px 360px 0px"});return s.observe(i),()=>s.disconnect()},[w,me,m,$,ue,e,z,F]);const Ke=r.useCallback((i,o)=>{const s=URL.createObjectURL(i),d=document.createElement("a");d.href=s,d.download=Q(o),d.style.display="none",document.body.appendChild(d),d.click(),d.remove(),window.setTimeout(()=>URL.revokeObjectURL(s),1e3)},[]),St=r.useCallback(async()=>{if(!e||v!==null||j!==null)return;if(de(e)){window.open(e,"_blank","noopener,noreferrer");return}const i=e;ee(null),I(null),ne(!1),te(0);try{const o=await Me(i,a,te);Ke(o,i),ne(!0),window.setTimeout(()=>ne(!1),1500)}catch(o){ee((o==null?void 0:o.message)??String(o))}finally{te(null)}},[Ke,v,e,a,j]),jt=r.useCallback(async()=>{if(!e||j!==null||v!==null)return;const i=e;ee(null),I(null),ie(!1);const o=ct(navigator,window.isSecureContext);if(o==="insecure-context"){I("当前页面是 HTTP,手机 Chrome 仅允许 HTTPS 页面分享文件,请改用 HTTPS 地址后重试");return}if(o==="unsupported-browser"){I("当前浏览器不支持分享文件,请使用最新版手机 Chrome 或系统浏览器");return}re(0);try{const s=await Me(i,a,re),d=new File([s],Q(i),{type:dt(i),lastModified:(u==null?void 0:u.mtime)??Date.now()}),h=await ft(d,navigator);h==="unsupported"?I("当前浏览器不支持分享此文件类型,请使用下载按钮"):h==="shared"&&(ie(!0),window.setTimeout(()=>ie(!1),1500))}catch(s){I((s==null?void 0:s.message)??String(s))}finally{re(null)}},[v,u==null?void 0:u.mtime,e,a,j]),ae=r.useCallback(async(i,o)=>{const s=await a("fs:inspect-text",{path:i},6e4);return o!==p.current?null:(C({size:s.size,mtime:s.mtime}),xe(s.diffStatus),Fe(s.patch),we(!s.tooLarge&&s.validUtf8),s)},[a]),Et=r.useCallback(async()=>{if(!e||ye)return;const i=p.current;ke(!0),H(null);try{const o=await ae(e,i);if(!o)return;if(o.tooLarge||o.data===null)throw new Error("文件超过 8M,无法在线编辑");if(!o.validUtf8)throw new Error("此文件不是有效的 UTF-8 文本,无法在线编辑");const s=new TextDecoder("utf-8",{fatal:!1}).decode(Ie(o.data));g([s]),K(o.size),oe.current=o.size,pe(!0),A(s),B(!1),W.current=!0,O(!0)}catch(o){i===p.current&&H(o.message??String(o))}finally{i===p.current&&ke(!1)}},[ye,ae,e]),et=r.useCallback(async()=>{if(!e||he||(ve("diff"),se!==null))return;const i=p.current;ge(!0),be(null);try{await ae(e,i)}catch(o){i===p.current&&be(o.message??String(o))}finally{i===p.current&&ge(!1)}},[he,ae,se,e]),Ct=r.useCallback(()=>{if(!e)return;const i=!M;Ee.current=i,Be(i),i&&!c&&q(e,p.current)},[q,c,e,M]),G=r.useCallback(i=>{X.current===i&&(T(null),b("ready"))},[]),Y=r.useCallback(i=>{X.current===i&&(T("文件预览加载失败,请重试"),b("error"))},[]),Lt=r.useCallback(()=>{e&&R(e,m)},[m,e,R]),zt=r.useCallback(()=>{L!==D&&!window.confirm("放弃未保存的修改?")||(W.current=!1,O(!1),A(""),H(null),B(!1))},[L,D]),Tt=r.useCallback(()=>{w&&L!==D&&!window.confirm("放弃未保存的修改并关闭预览?")||(p.current++,P(),l())},[L,w,l,P,D]),Mt=r.useCallback(()=>{e&&(W.current=!1,O(!1),A(""),R(e,"text"))},[e,R]),Rt=r.useCallback(async()=>{if(!(!e||!u||_||L===D)){Xe(!0),H(null);try{await a("fs:write-text",{path:e,content:L,expectedSize:u.size,expectedMtime:u.mtime},6e4),W.current=!1,O(!1),A(""),R(e,"text")}catch(i){H((i==null?void 0:i.message)??String(i))}finally{Xe(!1)}}},[L,u,e,a,_,R,D]),V=r.useMemo(()=>Ot(se??""),[se]);if(!e)return null;const tt=((u==null?void 0:u.size)??0)>en,Le=!tt&&(Ae==="changed"||Ae==="untracked"),nt=m==="text"&&Ue&&z!=="initial-loading"&&!ye&&!S;return t.jsxs("div",{style:{height:"100%",display:"flex",flexDirection:"column",background:"var(--ui-term-col-bg, #101014)",color:"var(--ui-text, #e8e8ee)",colorScheme:"var(--ui-color-scheme, dark)",accentColor:"var(--ui-tab-accent, #7aa2f7)"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"9px 12px",borderBottom:"1px solid var(--ui-tree-border, #222)",background:"var(--ui-tree-bg, #121218)",flexShrink:0},children:[t.jsx("span",{className:"pv-name",style:{minWidth:0,flex:"1 1 auto",fontSize:12.5,color:"var(--ui-text, #e8e8ee)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:Q(e)}),u&&t.jsx("span",{style:{fontSize:10.5,color:"var(--ui-history-meta, #666)",flexShrink:0},children:ze(u.size)}),w?t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",onClick:zt,disabled:_,style:N,"aria-label":"取消编辑",title:"取消编辑",children:t.jsx(Dt,{size:15,strokeWidth:1.8,"aria-hidden":"true"})}),t.jsx("button",{type:"button",onClick:Rt,disabled:_||L===D,style:{...N,color:"var(--ui-tab-accent, #7aa2f7)",opacity:_||L===D?.55:1},"aria-label":_?"正在保存":"保存修改",title:_?"正在保存":"保存修改",children:_?t.jsx(Z,{className:"tree-spin",size:15,strokeWidth:1.8,"aria-hidden":"true"}):t.jsx(Nt,{size:15,strokeWidth:1.8,"aria-hidden":"true"})})]}):t.jsxs(t.Fragment,{children:[m==="text"&&t.jsx("button",{type:"button",onClick:Et,disabled:!nt,style:{...N,opacity:nt?1:.45},"aria-label":"编辑文件",title:tt?"文件超过 8M,无法在线编辑":Ue?"编辑文件":"此文件不可编辑",children:t.jsx(It,{size:15,strokeWidth:1.8,"aria-hidden":"true"})}),t.jsx("button",{type:"button",onClick:St,disabled:v!==null||j!==null,style:{...N,opacity:v!==null||j!==null?.72:1},"aria-label":Ce?"打开原始地址":v===null?"下载到当前设备":`正在下载 ${v}%`,title:Ce?"打开原始地址":v===null?"下载到当前设备":`正在下载 ${v}%`,children:v!==null?t.jsx(Z,{className:"tree-spin",size:15,strokeWidth:1.8,"aria-hidden":"true"}):bt?t.jsx(rt,{size:15,strokeWidth:1.8,"aria-hidden":"true"}):t.jsx(Ht,{size:15,strokeWidth:1.8,"aria-hidden":"true"})}),!Ce&&t.jsx("button",{type:"button",onClick:jt,disabled:j!==null||v!==null,style:{...N,opacity:j!==null||v!==null?.72:1},"aria-label":"分享文件",title:j===null?"分享文件":`正在准备 ${j}%`,children:j!==null?t.jsx(Z,{className:"tree-spin",size:15,strokeWidth:1.8,"aria-hidden":"true"}):vt?t.jsx(rt,{size:15,strokeWidth:1.8,"aria-hidden":"true"}):t.jsx(Ft,{size:15,strokeWidth:1.8,"aria-hidden":"true"})}),Je&&t.jsx("button",{type:"button",onClick:Ct,"aria-pressed":M,style:{...N,...M?{color:"var(--ui-tab-accent, #7aa2f7)",borderColor:"var(--ui-tab-accent, #7aa2f7)"}:{}},"aria-label":M?"退出浏览器预览":"浏览器预览",title:M?"退出浏览器预览":Ye?"在浏览器中预览渲染效果":Ve?"预览 Markdown 排版效果":"在浏览器中查看原始文件",children:t.jsx(Pt,{size:15,strokeWidth:1.8,"aria-hidden":"true"})})]}),t.jsx("button",{type:"button",onClick:Tt,style:N,"aria-label":"关闭预览",title:"关闭预览",children:t.jsx(Wt,{size:15,strokeWidth:1.8,"aria-hidden":"true"})})]}),m==="text"&&Le&&!w&&!M&&t.jsxs("div",{style:{display:"flex",alignItems:"center",minHeight:34,padding:"0 12px",borderBottom:"1px solid var(--ui-tree-border, #222)",background:"var(--ui-tree-bg, #121218)",flexShrink:0},children:[t.jsxs("div",{role:"tablist","aria-label":"文件预览模式",style:{display:"inline-flex",gap:2,padding:2,border:"1px solid var(--ui-panel-input-border, #333)",borderRadius:6,background:"var(--ui-muted-surface, #1b1b22)"},children:[t.jsx(st,{active:F==="diff",onClick:et,children:"变更"}),t.jsx(st,{active:F==="file",onClick:()=>ve("file"),children:"文件"})]}),t.jsxs("span",{style:{marginLeft:9,display:"inline-flex",gap:7,fontFamily:'"SF Mono", Menlo, Consolas, monospace',fontSize:10.5},children:[V.added>0&&t.jsxs("span",{style:{color:"var(--ui-success, #059669)"},children:["+",V.added]}),V.removed>0&&t.jsxs("span",{style:{color:"var(--ui-error, #dc2626)"},children:["-",V.removed]})]})]}),Ne&&t.jsxs("div",{role:"alert",style:{flexShrink:0,padding:"8px 12px",borderBottom:"1px solid var(--ui-tree-border, #222)",background:"var(--ui-tree-bg, #121218)",color:"var(--ui-error, #f7768e)",fontSize:12.5,lineHeight:1.5},children:["分享失败:",Ne]}),t.jsxs("div",{ref:qe,className:"pv-body",style:{position:"relative",flex:1,minHeight:0,overflow:"auto",background:"var(--ui-term-col-bg, #101014)",WebkitOverflowScrolling:"touch"},children:[Pe&&t.jsxs("div",{style:{padding:"10px 14px 0",color:"var(--ui-error, #f7768e)",fontSize:12.5},children:["下载失败:",Pe]}),$e&&t.jsx("div",{role:"alert",style:{padding:"10px 14px",color:"var(--ui-error, #f7768e)",fontSize:12.5},children:$e}),wt&&w&&t.jsxs("div",{role:"alert",style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px",borderBottom:"1px solid var(--ui-tree-border, #222)",color:"var(--ui-error, #f7768e)",fontSize:12},children:[t.jsx("span",{style:{flex:1},children:"文件已在其他位置更新"}),t.jsxs("button",{type:"button",onClick:Mt,style:_e,children:[t.jsx(Te,{size:13,strokeWidth:1.8,"aria-hidden":"true"}),"重新加载"]})]}),c&&!S&&m==="image"&&t.jsx("img",{src:c,alt:e,onLoad:()=>G(c),onError:()=>Y(c),style:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain",display:"block",margin:"0 auto"}}),c&&!S&&m==="video"&&t.jsx("video",{src:c,controls:!0,playsInline:!0,preload:"metadata",onLoadedMetadata:()=>G(c),onError:()=>Y(c),style:{maxWidth:"100%",maxHeight:"100%",display:"block",margin:"0 auto"}}),c&&!S&&m==="audio"&&t.jsx("div",{style:{display:"grid",placeItems:"center",height:"100%"},children:t.jsx("audio",{src:c,controls:!0,autoPlay:!0,onLoadedMetadata:()=>G(c),onError:()=>Y(c),style:{width:"min(420px, 88%)"}})}),c&&!S&&m==="pdf"&&t.jsx("iframe",{src:c,title:e,onLoad:()=>G(c),onError:()=>Y(c),style:{width:"100%",height:"100%",border:"none"}}),c&&!S&&m==="text"&&Je&&M&&!w&&t.jsx("iframe",{src:yt?`${c}/${encodeURIComponent(Q(e))}`:c,sandbox:Jt,title:e,onLoad:()=>G(c),onError:()=>Y(c),style:{width:"100%",height:"100%",border:"none",background:"#fff"}}),m==="text"&&w&&!S&&t.jsx("textarea",{value:L,onChange:i=>A(i.target.value),spellCheck:!1,autoCapitalize:"off",autoCorrect:"off","aria-label":`编辑 ${Q(e)}`,style:{width:"100%",minHeight:"100%",boxSizing:"border-box",resize:"none",margin:0,padding:"12px 14px calc(env(safe-area-inset-bottom) + 36px)",border:0,outline:0,background:"var(--ui-term-col-bg, #101014)",color:"var(--ui-history-item-text, var(--ui-text, #d6d6de))",fontFamily:'"SF Mono", Menlo, Consolas, monospace',fontSize:12,lineHeight:1.5,tabSize:2}}),m==="text"&&!w&&!S&&Le&&F==="diff"&&(Oe?t.jsx(ce,{label:Oe,actionLabel:"重试",onAction:()=>void et(),tone:"error"}):he?t.jsx(ce,{label:"正在加载变更"}):t.jsx(an,{rows:V.rows})),(m==="hex"||m==="text"&&!w&&!M&&(!Le||F==="file"))&&!S&&t.jsxs(t.Fragment,{children:[t.jsx("pre",{style:{margin:0,padding:"11px 13px calc(env(safe-area-inset-bottom) + 36px)",fontFamily:'"SF Mono", Menlo, Consolas, monospace',fontSize:m==="hex"?10.5:12,lineHeight:1.45,color:m==="hex"?"var(--ui-muted-text, #9aa)":"var(--ui-history-item-text, var(--ui-text, #d6d6de))",whiteSpace:m==="hex"?"pre":"pre-wrap",wordBreak:m==="hex"?"normal":"break-word"},children:m==="hex"?k:t.jsx($t,{path:e,chunks:x,fileSize:u==null?void 0:u.size})}),m==="text"&&!me&&t.jsxs("div",{ref:Ge,role:"status","aria-live":"polite",style:{minHeight:44,padding:"0 14px calc(env(safe-area-inset-bottom) + 8px)",display:"flex",alignItems:"center",justifyContent:"center",gap:7,color:"var(--ui-history-meta, #666)",fontSize:11.5},children:[z==="loading-more"&&t.jsx(Z,{className:"tree-spin",size:14,strokeWidth:1.8,"aria-hidden":"true",style:{color:"var(--ui-tab-accent, #7aa2f7)"}}),ue?t.jsxs(t.Fragment,{children:[t.jsx("span",{children:"加载失败"}),t.jsxs("button",{type:"button",onClick:()=>$(e),style:_e,children:[t.jsx(Te,{size:13,strokeWidth:1.8,"aria-hidden":"true"}),"重试"]})]}):t.jsx("span",{children:z==="loading-more"?"正在加载更多":`${ze(We)} / ${ze((u==null?void 0:u.size)??We)}`})]})]}),gt&&z==="initial-loading"&&t.jsx(ce,{label:"正在加载文件"}),S&&z==="error"&&t.jsx(ce,{label:S,actionLabel:"重试",onAction:Lt,tone:"error"})]})]})}function Q(e){return e.slice(e.lastIndexOf("/")+1)||e}function on(e){const n=e.lastIndexOf("/");return n>0?e.slice(0,n):"/"}function ze(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}K`:`${(e/1024/1024).toFixed(1)}M`}const N={width:28,height:28,borderRadius:7,border:"1px solid var(--ui-panel-input-border, #333)",display:"inline-flex",alignItems:"center",justifyContent:"center",background:"var(--ui-muted-surface, #1b1b22)",color:"var(--ui-muted-text, #ccc)",flexShrink:0,cursor:"pointer",WebkitAppRegion:"no-drag"},_e={minHeight:28,padding:"0 9px",borderRadius:6,border:"1px solid var(--ui-panel-input-border, #333)",display:"inline-flex",alignItems:"center",justifyContent:"center",gap:5,background:"var(--ui-muted-surface, #1b1b22)",color:"var(--ui-muted-text, #ccc)",cursor:"pointer",fontSize:11};function ce({label:e,actionLabel:n,onAction:l,tone:a="muted"}){return t.jsxs("div",{role:a==="error"?"alert":"status",style:{position:"absolute",inset:0,minHeight:120,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:10,color:a==="error"?"var(--ui-error, #f7768e)":"var(--ui-muted-text, #9aa)",fontSize:12.5},children:[a!=="error"&&t.jsx(Z,{className:"tree-spin",size:18,strokeWidth:1.8,"aria-hidden":"true",style:{color:"var(--ui-tab-accent, #7aa2f7)"}}),t.jsx("span",{children:e}),n&&l&&t.jsxs("button",{type:"button",onClick:l,style:_e,children:[t.jsx(Te,{size:13,strokeWidth:1.8,"aria-hidden":"true"}),n]})]})}function st({active:e,onClick:n,children:l}){return t.jsx("button",{type:"button",role:"tab","aria-selected":e,onClick:n,style:{minWidth:48,height:24,padding:"0 9px",border:0,borderRadius:4,background:e?"var(--ui-tab-accent, #7aa2f7)":"transparent",color:e?"var(--ui-tab-active-text, #fff)":"var(--ui-muted-text, #9aa)",fontSize:11,fontWeight:600,cursor:"pointer"},children:l})}function an({rows:e}){return t.jsx("div",{style:{minWidth:"100%",width:"max-content",paddingBottom:"calc(env(safe-area-inset-bottom) + 36px)",fontFamily:'"SF Mono", Menlo, Consolas, monospace',fontSize:11.5,lineHeight:1.55},children:e.map((n,l)=>{const a=n.kind==="added",x=n.kind==="removed",g=n.kind==="hunk"||n.kind==="meta"||n.kind==="note",c=a?"color-mix(in srgb, var(--ui-success, #059669) 12%, transparent)":x?"color-mix(in srgb, var(--ui-error, #dc2626) 11%, transparent)":n.kind==="hunk"?"color-mix(in srgb, var(--ui-tab-accent, #7aa2f7) 10%, transparent)":"transparent",f=a?"var(--ui-success, #059669)":x?"var(--ui-error, #dc2626)":g?"var(--ui-muted-text, #9aa)":"var(--ui-history-item-text, var(--ui-text, #d6d6de))";return t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"42px 42px 22px minmax(0, 1fr)",minHeight:18,background:c,color:f},children:[t.jsx("span",{style:ot,children:n.oldLine??""}),t.jsx("span",{style:ot,children:n.newLine??""}),t.jsx("span",{style:{textAlign:"center",userSelect:"none",color:f},children:a?"+":x?"-":" "}),t.jsx("span",{style:{padding:"0 12px 0 6px",whiteSpace:"pre-wrap",overflowWrap:"anywhere"},children:n.text||" "})]},`${n.kind}-${l}`)})})}const ot={padding:"0 6px",borderRight:"1px solid var(--ui-tree-border, #222)",color:"var(--ui-history-meta, #666)",textAlign:"right",userSelect:"none"},gn=Object.freeze(Object.defineProperty({__proto__:null,MAX_CLIENT_DOWNLOAD_BYTES:lt,decodeTextChunk:mt,default:sn,isBrowserPreviewPath:Re,isHtmlPreviewPath:pt,isMarkdownPreviewPath:xt,kindOf:ht,mimeTypeForPath:dt,nativeFileShareReadiness:ct,readFileForClientDownload:Me,shareFileWithNativePicker:ft},Symbol.toStringTag,{value:"Module"}));export{sn as F,it as M,hn as a,gn as b,Ut as c};
@@ -1,4 +1,4 @@
1
- import{c as ue,r as o,j as t,P as fe}from"./index-CrjQF-VW.js";import{S as pe,i as _,F as me,D as he,P as xe,a as je,b as be,c as ze,d as ve,N as ge,e as Fe,f as Ne,g as ke,h as ye,j as $e}from"./file-types-BsWJSk07.js";import{L as Ie}from"./locate-fixed-BBOLeIa6.js";import{X as Le}from"./x-3I6TKNBE.js";import{L as T}from"./loader-circle-BSDHoDXf.js";import{C as S}from"./chevron-down-FeW7FcBS.js";import{C as ee}from"./chevron-right-Bnd4FK8S.js";import{F as te}from"./trash-2-CT_MslWu.js";/**
1
+ import{c as ue,r as o,j as t,P as fe}from"./index-D1AQffdA.js";import{S as pe,i as _,F as me,D as he,P as xe,a as je,b as be,c as ze,d as ve,N as ge,e as Fe,f as Ne,g as ke,h as ye,j as $e}from"./file-types-BZ8YZAV-.js";import{L as Ie}from"./locate-fixed-CfEojGOl.js";import{X as Le}from"./x-uSekqXJV.js";import{L as T}from"./loader-circle-xEKTnlp3.js";import{C as S}from"./chevron-down-hiPnZS_M.js";import{C as ee}from"./chevron-right-DKsui_wS.js";import{F as te}from"./trash-2-BF9eI5Bh.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{j as e}from"./index-CrjQF-VW.js";import{F as d}from"./FilePreview-BfkF9hjw.js";import m from"./FileTree-pbVSSQnM.js";import{X as f}from"./x-3I6TKNBE.js";import"./artifact-links-B0ApmgK6.js";import"./rotate-ccw-DtSpwbK7.js";import"./loader-circle-BSDHoDXf.js";import"./trash-2-CT_MslWu.js";import"./check-CY3GCzxa.js";import"./download-Cy_rpjte.js";import"./file-types-BsWJSk07.js";import"./locate-fixed-BBOLeIa6.js";import"./chevron-down-FeW7FcBS.js";import"./chevron-right-Bnd4FK8S.js";function z({open:a,tab:s,gateway:r,cwd:l,selectedPath:i,revealRequest:p,onTabChange:o,onSelectPath:t,onClose:n}){return a?e.jsxs("section",{className:`desktop-file-workspace${i?" has-preview":""}`,"aria-label":"我的文件",children:[e.jsxs("aside",{className:"desktop-file-drawer",children:[e.jsxs("header",{className:"desktop-file-drawer-header",children:[e.jsxs("div",{className:"desktop-file-drawer-tabs",role:"tablist","aria-label":"文件工作区视图",children:[e.jsx("button",{type:"button",role:"tab","aria-selected":s==="files",className:s==="files"?"is-active":"",onClick:()=>o("files"),children:"文件"}),e.jsx("button",{type:"button",role:"tab","aria-selected":s==="history",className:s==="history"?"is-active":"",onClick:()=>o("history"),children:"历史"})]}),e.jsx("button",{type:"button",className:"desktop-file-workspace-close ui-icon-button ui-icon-button--small",onClick:n,"aria-label":"关闭我的文件",title:"关闭",children:e.jsx(f,{size:15,"aria-hidden":"true"})})]}),s==="files"?l?e.jsx(m,{gateway:r,ready:!0,followCwd:!0,cwd:l,onOpenFile:c=>t(c),selectedPath:i,revealRequest:p}):e.jsx("div",{className:"desktop-file-workspace-empty",children:"请先选择一个项目目录"}):e.jsxs("div",{className:"desktop-file-workspace-empty",children:[e.jsx("strong",{children:"终端历史在 Web 控制台中可用"}),e.jsx("span",{children:"Electron 当前没有终端上下文,因此不会提供填入或执行操作。"})]}),e.jsxs("footer",{className:"desktop-file-drawer-footer",children:[e.jsx("span",{}),"实时同步"]})]}),i&&e.jsx("div",{className:"desktop-file-preview",children:e.jsx(d,{path:i,gateway:r,onClose:()=>t(null)})})]}):null}export{z as default};
1
+ import{j as e}from"./index-D1AQffdA.js";import{F as d}from"./FilePreview-CcJXlLge.js";import m from"./FileTree-BuhW-pqR.js";import{X as f}from"./x-uSekqXJV.js";import"./artifact-links-B0ApmgK6.js";import"./rotate-ccw-HY6j6nBt.js";import"./loader-circle-xEKTnlp3.js";import"./trash-2-BF9eI5Bh.js";import"./check-D-yTByNl.js";import"./download-B2jLl85N.js";import"./file-types-BZ8YZAV-.js";import"./locate-fixed-CfEojGOl.js";import"./chevron-down-hiPnZS_M.js";import"./chevron-right-DKsui_wS.js";function z({open:a,tab:s,gateway:r,cwd:l,selectedPath:i,revealRequest:p,onTabChange:o,onSelectPath:t,onClose:n}){return a?e.jsxs("section",{className:`desktop-file-workspace${i?" has-preview":""}`,"aria-label":"我的文件",children:[e.jsxs("aside",{className:"desktop-file-drawer",children:[e.jsxs("header",{className:"desktop-file-drawer-header",children:[e.jsxs("div",{className:"desktop-file-drawer-tabs",role:"tablist","aria-label":"文件工作区视图",children:[e.jsx("button",{type:"button",role:"tab","aria-selected":s==="files",className:s==="files"?"is-active":"",onClick:()=>o("files"),children:"文件"}),e.jsx("button",{type:"button",role:"tab","aria-selected":s==="history",className:s==="history"?"is-active":"",onClick:()=>o("history"),children:"历史"})]}),e.jsx("button",{type:"button",className:"desktop-file-workspace-close ui-icon-button ui-icon-button--small",onClick:n,"aria-label":"关闭我的文件",title:"关闭",children:e.jsx(f,{size:15,"aria-hidden":"true"})})]}),s==="files"?l?e.jsx(m,{gateway:r,ready:!0,followCwd:!0,cwd:l,onOpenFile:c=>t(c),selectedPath:i,revealRequest:p}):e.jsx("div",{className:"desktop-file-workspace-empty",children:"请先选择一个项目目录"}):e.jsxs("div",{className:"desktop-file-workspace-empty",children:[e.jsx("strong",{children:"终端历史在 Web 控制台中可用"}),e.jsx("span",{children:"Electron 当前没有终端上下文,因此不会提供填入或执行操作。"})]}),e.jsxs("footer",{className:"desktop-file-drawer-footer",children:[e.jsx("span",{}),"实时同步"]})]}),i&&e.jsx("div",{className:"desktop-file-preview",children:e.jsx(d,{path:i,gateway:r,onClose:()=>t(null)})})]}):null}export{z as default};
@@ -1,4 +1,4 @@
1
- import{r as a,e as p,j as e}from"./index-CrjQF-VW.js";import{F as w}from"./page-DK2ooc8J.js";import{R as y}from"./rotate-cw-DdQZP8we.js";import"./RunningSessionsIcon-DuoG6Hgs.js";import"./x-3I6TKNBE.js";import"./chevron-down-FeW7FcBS.js";import"./check-CY3GCzxa.js";import"./trash-2-CT_MslWu.js";import"./RemoteDesktopTabBridge-tJcxPHnZ.js";import"./chevron-right-Bnd4FK8S.js";import"./calendar-days-DpxojDWK.js";import"./artifact-links-B0ApmgK6.js";import"./mobileViewport-Ckhq6eml.js";import"./pin-ByCe4NyB.js";import"./CollaborationTabBridge-Dxq4G1Uk.js";import"./SessionDashboardBridge-Cw8Y0s5_.js";const g=new Set(["127.0.0.1","localhost","[::1]"]);function h(s,t){const o=new URL(s),r=new URL(t);return g.has(o.hostname)&&o.hostname!==r.hostname&&(o.hostname=r.hostname),o.toString()}function A({visible:s}){const[t,o]=a.useState(null),[r,n]=a.useState("loading"),[u,m]=a.useState(0);a.useEffect(()=>{if(!s||t)return;let i=!1;return n("loading"),fetch("/api/flow-studio/config",{credentials:"same-origin"}).then(async c=>{if(!c.ok)throw new Error("Flow Studio config request failed");const d=await c.json();if(!d.entryUrl)throw new Error("Flow Studio entry is not configured");const l=new URL(d.entryUrl);if(l.protocol!=="http:"&&l.protocol!=="https:")throw new Error("Flow Studio entry URL is invalid");i||o(h(l.toString(),p()))}).catch(()=>{i||n("error")}),()=>{i=!0}},[u,t,s]),a.useEffect(()=>{if(!t||r!=="loading")return;const i=window.setTimeout(()=>n("error"),3e4);return()=>window.clearTimeout(i)},[t,r]);const f=()=>{o(null),n("loading"),m(i=>i+1)};return e.jsxs("div",{style:{position:"absolute",inset:0,background:"var(--ui-term-col-bg, #101014)"},"aria-busy":r==="loading",children:[t&&e.jsx("iframe",{src:t,title:"Flow Studio 数字人",referrerPolicy:"no-referrer",allow:"camera; microphone; autoplay; clipboard-read; clipboard-write; fullscreen",allowFullScreen:!0,onLoad:()=>n("ready"),onError:()=>n("error"),className:r==="ready"?"flow-frame flow-frame-ready":"flow-frame",style:{display:"block",width:"100%",height:"100%",border:0,background:"var(--ui-term-col-bg, #101014)"}},t),r==="loading"&&e.jsx(w,{}),r==="error"&&e.jsxs("div",{role:r==="error"?"alert":"status","aria-live":"polite",style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:10,color:"var(--ui-text, #e5e7eb)",background:"var(--ui-term-col-bg, #101014)"},children:[e.jsx("strong",{children:r==="error"?"无法打开 Flow Studio":"正在打开 Flow Studio"}),r==="error"&&e.jsxs("button",{type:"button","aria-label":"重试加载 Flow Studio",onClick:f,title:"重新加载 Flow Studio",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",gap:6,width:"auto",height:32,padding:"0 10px",border:"1px solid var(--ui-muted-border, #3b3d46)",borderRadius:6,background:"transparent",color:"inherit",cursor:"pointer"},children:[e.jsx(y,{size:16,"aria-hidden":"true"}),e.jsx("span",{children:"重试"})]})]}),e.jsx("style",{jsx:!0,children:`
1
+ import{r as a,e as p,j as e}from"./index-D1AQffdA.js";import{F as w}from"./page-B-CkpInM.js";import{R as y}from"./rotate-cw-CyYR2IEw.js";import"./RunningSessionsIcon-D6rY-IzV.js";import"./x-uSekqXJV.js";import"./chevron-down-hiPnZS_M.js";import"./check-D-yTByNl.js";import"./trash-2-BF9eI5Bh.js";import"./RemoteDesktopTabBridge-BF1dFltY.js";import"./chevron-right-DKsui_wS.js";import"./calendar-days-B1Mn3x8A.js";import"./artifact-links-B0ApmgK6.js";import"./mobileViewport-DF1R6qR2.js";import"./pin-CjmuX5Tq.js";import"./CollaborationTabBridge-Dxq4G1Uk.js";import"./SessionDashboardBridge-AhmhQ1Xn.js";const g=new Set(["127.0.0.1","localhost","[::1]"]);function h(s,t){const o=new URL(s),r=new URL(t);return g.has(o.hostname)&&o.hostname!==r.hostname&&(o.hostname=r.hostname),o.toString()}function A({visible:s}){const[t,o]=a.useState(null),[r,n]=a.useState("loading"),[u,m]=a.useState(0);a.useEffect(()=>{if(!s||t)return;let i=!1;return n("loading"),fetch("/api/flow-studio/config",{credentials:"same-origin"}).then(async c=>{if(!c.ok)throw new Error("Flow Studio config request failed");const d=await c.json();if(!d.entryUrl)throw new Error("Flow Studio entry is not configured");const l=new URL(d.entryUrl);if(l.protocol!=="http:"&&l.protocol!=="https:")throw new Error("Flow Studio entry URL is invalid");i||o(h(l.toString(),p()))}).catch(()=>{i||n("error")}),()=>{i=!0}},[u,t,s]),a.useEffect(()=>{if(!t||r!=="loading")return;const i=window.setTimeout(()=>n("error"),3e4);return()=>window.clearTimeout(i)},[t,r]);const f=()=>{o(null),n("loading"),m(i=>i+1)};return e.jsxs("div",{style:{position:"absolute",inset:0,background:"var(--ui-term-col-bg, #101014)"},"aria-busy":r==="loading",children:[t&&e.jsx("iframe",{src:t,title:"Flow Studio 数字人",referrerPolicy:"no-referrer",allow:"camera; microphone; autoplay; clipboard-read; clipboard-write; fullscreen",allowFullScreen:!0,onLoad:()=>n("ready"),onError:()=>n("error"),className:r==="ready"?"flow-frame flow-frame-ready":"flow-frame",style:{display:"block",width:"100%",height:"100%",border:0,background:"var(--ui-term-col-bg, #101014)"}},t),r==="loading"&&e.jsx(w,{}),r==="error"&&e.jsxs("div",{role:r==="error"?"alert":"status","aria-live":"polite",style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:10,color:"var(--ui-text, #e5e7eb)",background:"var(--ui-term-col-bg, #101014)"},children:[e.jsx("strong",{children:r==="error"?"无法打开 Flow Studio":"正在打开 Flow Studio"}),r==="error"&&e.jsxs("button",{type:"button","aria-label":"重试加载 Flow Studio",onClick:f,title:"重新加载 Flow Studio",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",gap:6,width:"auto",height:32,padding:"0 10px",border:"1px solid var(--ui-muted-border, #3b3d46)",borderRadius:6,background:"transparent",color:"inherit",cursor:"pointer"},children:[e.jsx(y,{size:16,"aria-hidden":"true"}),e.jsx("span",{children:"重试"})]})]}),e.jsx("style",{jsx:!0,children:`
2
2
  .flow-frame { opacity: 0; transform: translateY(8px) scale(.995); transition: opacity 420ms ease, transform 520ms cubic-bezier(.2,.8,.2,1); }
3
3
  .flow-frame-ready { opacity: 1; transform: none; }
4
4
  @media (prefers-reduced-motion: reduce) { .flow-frame { transform: none; transition: none; } }
@@ -1 +1 @@
1
- import{r as n,a as D,j as e,R,P as z}from"./index-CrjQF-VW.js";import{F as B,D as H,P as I,a as K,b as M,c as T,d as J,N as W,e as O,f as V,g as X,h as q,i as G,j as Q}from"./file-types-BsWJSk07.js";import{X as U}from"./x-3I6TKNBE.js";import{A as Y}from"./trash-2-CT_MslWu.js";import{C as Z}from"./chevron-right-Bnd4FK8S.js";const _={folder:{icon:G,label:"文件夹"},code:{icon:q,label:"代码文件"},style:{icon:z,label:"样式文件"},image:{icon:X,label:"图片文件"},video:{icon:V,label:"视频文件"},audio:{icon:O,label:"音频文件"},markdown:{icon:W,label:"Markdown 文件"},text:{icon:J,label:"文本文件"},json:{icon:T,label:"JSON 文件"},archive:{icon:M,label:"压缩文件"},spreadsheet:{icon:K,label:"表格文件"},presentation:{icon:I,label:"演示文件"},database:{icon:H,label:"数据库文件"},file:{icon:B,label:"文件"}};function ee(a,d){return d==="directory"?"folder":Q(a)}const x=a=>a.replace(/\\/g,"/").replace(/\/+$/,"")||"/";function te(a,d){for(const l of d){if(!(l!=null&&l.trim()))continue;const h=x(l);if(h.split("/").some(o=>o==="."||o===".."))continue;const p=a.map(x).filter(o=>h===o||h.startsWith(o==="/"?"/":`${o}/`)).sort((o,c)=>c.length-o.length)[0];if(p)return{root:p,current:h}}const s=a[0]?x(a[0]):"";return{root:s,current:s}}function se(a,d){const s=x(a),l=x(d),p=[{label:s==="/"?"/":s.split("/").filter(Boolean).pop()||s,path:s}];if(l===s)return p;const o=l.slice(s==="/"?1:s.length+1);let c=s;for(const i of o.split("/").filter(Boolean))c=c==="/"?`/${i}`:`${c}/${i}`,p.push({label:i,path:c});return p}function ce({open:a,initialPath:d,onCancel:s,onConfirm:l}){const[h,p]=n.useState([]),[o,c]=n.useState(""),[i,y]=n.useState(""),[E,g]=n.useState([]),[b,k]=n.useState(!1),[F,u]=n.useState(""),[v,P]=n.useState(!1),[C,w]=n.useState(!1),m=n.useMemo(()=>o&&i?se(o,i):[],[o,i]),j=async t=>{if(window.agentApi){k(!0),w(!1),u(""),y(t),g([]);try{const r=await window.agentApi.listProjectDirectories(t);g(r),w(!0)}catch(r){u(r instanceof Error?r.message:"无法读取目录")}finally{k(!1)}}};if(n.useEffect(()=>{if(!a||!window.agentApi)return;let t=!1;return k(!0),u(""),c(""),y(""),w(!1),g([]),window.agentApi.getProjectPickerLocation().then(async({roots:r,initialPath:N})=>{if(t)return;p(r);const f=te(r,[d,N]);c(f.root),f.current?await j(f.current):u("未配置可用的宿主机目录")}).catch(r=>{t||u(r instanceof Error?r.message:"无法读取宿主机目录")}).finally(()=>{t||k(!1)}),()=>{t=!0}},[a,d]),n.useEffect(()=>{if(!a)return;const t=r=>{r.key==="Escape"&&s()};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[a,s]),!a)return null;const S=t=>{c(t),j(t)},$=()=>{m.length<=1||j(m[m.length-2].path)},A=async()=>{if(!(!i||!C||v)){P(!0),u("");try{await l(i)}catch(t){u(t instanceof Error?t.message:"项目导入失败")}finally{P(!1)}}};return D.createPortal(e.jsx("div",{className:"host-project-picker-backdrop",role:"presentation",onMouseDown:t=>{t.target===t.currentTarget&&s()},children:e.jsxs("section",{className:"host-project-picker",role:"dialog","aria-modal":"true","aria-labelledby":"host-project-picker-title",children:[e.jsxs("header",{className:"host-project-picker-header",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"host-project-picker-title",children:"选择宿主机项目"}),e.jsx("p",{children:"文件将直接在运行 AgentRoam 的机器上读写"})]}),e.jsx("button",{type:"button",className:"ui-icon-button",onClick:s,"aria-label":"关闭目录选择器",title:"关闭",children:e.jsx(U,{size:16,"aria-hidden":"true"})})]}),h.length>1&&e.jsxs("label",{className:"host-project-picker-root",children:[e.jsx("span",{children:"根目录"}),e.jsx("select",{value:o,onChange:t=>S(t.target.value),children:h.map(t=>e.jsx("option",{value:t,children:t},t))})]}),e.jsxs("nav",{className:"host-project-picker-nav","aria-label":"当前目录",children:[e.jsx("button",{type:"button",className:"ui-icon-button",onClick:$,disabled:m.length<=1,"aria-label":"返回上级目录",title:"返回上级目录",children:e.jsx(Y,{size:16,"aria-hidden":"true"})}),e.jsxs("div",{className:"host-project-picker-breadcrumbs",children:[!i&&e.jsx("span",{children:b?"正在定位工作目录…":"未能加载工作目录"}),m.map((t,r)=>e.jsxs("span",{children:[r>0&&e.jsx("i",{children:"/"}),e.jsx("button",{type:"button",onClick:()=>void j(t.path),children:t.label})]},t.path))]}),e.jsx("button",{type:"button",className:"ui-icon-button",onClick:()=>i&&void j(i),disabled:!i||b,"aria-label":"刷新目录",title:"刷新目录",children:e.jsx(R,{size:15,"aria-hidden":"true"})})]}),o==="/"&&e.jsx("div",{className:"host-project-picker-warning",children:"当前允许访问宿主机根目录,请谨慎选择项目。"}),e.jsx("div",{className:"host-project-picker-list","aria-busy":b,children:b?e.jsx("div",{className:"host-project-picker-state",children:"正在读取目录…"}):F?e.jsx("div",{className:"host-project-picker-state is-error",children:F}):E.length===0?e.jsx("div",{className:"host-project-picker-state",children:"此目录为空"}):E.map(t=>{const r=ee(t.name,t.kind),{icon:N,label:f}=_[r],L=e.jsxs(e.Fragment,{children:[e.jsx("span",{className:`host-project-picker-entry-icon is-${r}`,"aria-hidden":"true",children:e.jsx(N,{size:18,strokeWidth:1.8})}),e.jsx("span",{className:"host-project-picker-name",children:t.name})]});return t.kind==="file"?e.jsx("div",{className:"host-project-picker-row is-file",title:f,children:L},`${t.name}:${t.path}`):e.jsxs("button",{type:"button",className:"host-project-picker-row is-directory",onClick:()=>void j(t.path),title:f,children:[L,t.hasChildren&&e.jsx("span",{className:"host-project-picker-chevron","aria-hidden":"true",children:e.jsx(Z,{size:16})})]},`${t.name}:${t.path}`)})}),e.jsxs("footer",{className:"host-project-picker-footer",children:[e.jsx("code",{title:i,children:i}),e.jsxs("div",{children:[e.jsx("button",{type:"button",className:"host-project-picker-cancel",onClick:s,children:"取消"}),e.jsx("button",{type:"button",className:"host-project-picker-confirm",disabled:!i||!C||b||v,onClick:()=>void A(),children:v?"正在导入…":"选择此文件夹"})]})]})]})}),document.body)}export{ce as H};
1
+ import{r as n,a as D,j as e,R,P as z}from"./index-D1AQffdA.js";import{F as B,D as H,P as I,a as K,b as M,c as T,d as J,N as W,e as O,f as V,g as X,h as q,i as G,j as Q}from"./file-types-BZ8YZAV-.js";import{X as U}from"./x-uSekqXJV.js";import{A as Y}from"./trash-2-BF9eI5Bh.js";import{C as Z}from"./chevron-right-DKsui_wS.js";const _={folder:{icon:G,label:"文件夹"},code:{icon:q,label:"代码文件"},style:{icon:z,label:"样式文件"},image:{icon:X,label:"图片文件"},video:{icon:V,label:"视频文件"},audio:{icon:O,label:"音频文件"},markdown:{icon:W,label:"Markdown 文件"},text:{icon:J,label:"文本文件"},json:{icon:T,label:"JSON 文件"},archive:{icon:M,label:"压缩文件"},spreadsheet:{icon:K,label:"表格文件"},presentation:{icon:I,label:"演示文件"},database:{icon:H,label:"数据库文件"},file:{icon:B,label:"文件"}};function ee(a,d){return d==="directory"?"folder":Q(a)}const x=a=>a.replace(/\\/g,"/").replace(/\/+$/,"")||"/";function te(a,d){for(const l of d){if(!(l!=null&&l.trim()))continue;const h=x(l);if(h.split("/").some(o=>o==="."||o===".."))continue;const p=a.map(x).filter(o=>h===o||h.startsWith(o==="/"?"/":`${o}/`)).sort((o,c)=>c.length-o.length)[0];if(p)return{root:p,current:h}}const s=a[0]?x(a[0]):"";return{root:s,current:s}}function se(a,d){const s=x(a),l=x(d),p=[{label:s==="/"?"/":s.split("/").filter(Boolean).pop()||s,path:s}];if(l===s)return p;const o=l.slice(s==="/"?1:s.length+1);let c=s;for(const i of o.split("/").filter(Boolean))c=c==="/"?`/${i}`:`${c}/${i}`,p.push({label:i,path:c});return p}function ce({open:a,initialPath:d,onCancel:s,onConfirm:l}){const[h,p]=n.useState([]),[o,c]=n.useState(""),[i,y]=n.useState(""),[E,g]=n.useState([]),[b,k]=n.useState(!1),[F,u]=n.useState(""),[v,P]=n.useState(!1),[C,w]=n.useState(!1),m=n.useMemo(()=>o&&i?se(o,i):[],[o,i]),j=async t=>{if(window.agentApi){k(!0),w(!1),u(""),y(t),g([]);try{const r=await window.agentApi.listProjectDirectories(t);g(r),w(!0)}catch(r){u(r instanceof Error?r.message:"无法读取目录")}finally{k(!1)}}};if(n.useEffect(()=>{if(!a||!window.agentApi)return;let t=!1;return k(!0),u(""),c(""),y(""),w(!1),g([]),window.agentApi.getProjectPickerLocation().then(async({roots:r,initialPath:N})=>{if(t)return;p(r);const f=te(r,[d,N]);c(f.root),f.current?await j(f.current):u("未配置可用的宿主机目录")}).catch(r=>{t||u(r instanceof Error?r.message:"无法读取宿主机目录")}).finally(()=>{t||k(!1)}),()=>{t=!0}},[a,d]),n.useEffect(()=>{if(!a)return;const t=r=>{r.key==="Escape"&&s()};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[a,s]),!a)return null;const S=t=>{c(t),j(t)},$=()=>{m.length<=1||j(m[m.length-2].path)},A=async()=>{if(!(!i||!C||v)){P(!0),u("");try{await l(i)}catch(t){u(t instanceof Error?t.message:"项目导入失败")}finally{P(!1)}}};return D.createPortal(e.jsx("div",{className:"host-project-picker-backdrop",role:"presentation",onMouseDown:t=>{t.target===t.currentTarget&&s()},children:e.jsxs("section",{className:"host-project-picker",role:"dialog","aria-modal":"true","aria-labelledby":"host-project-picker-title",children:[e.jsxs("header",{className:"host-project-picker-header",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"host-project-picker-title",children:"选择宿主机项目"}),e.jsx("p",{children:"文件将直接在运行 AgentRoam 的机器上读写"})]}),e.jsx("button",{type:"button",className:"ui-icon-button",onClick:s,"aria-label":"关闭目录选择器",title:"关闭",children:e.jsx(U,{size:16,"aria-hidden":"true"})})]}),h.length>1&&e.jsxs("label",{className:"host-project-picker-root",children:[e.jsx("span",{children:"根目录"}),e.jsx("select",{value:o,onChange:t=>S(t.target.value),children:h.map(t=>e.jsx("option",{value:t,children:t},t))})]}),e.jsxs("nav",{className:"host-project-picker-nav","aria-label":"当前目录",children:[e.jsx("button",{type:"button",className:"ui-icon-button",onClick:$,disabled:m.length<=1,"aria-label":"返回上级目录",title:"返回上级目录",children:e.jsx(Y,{size:16,"aria-hidden":"true"})}),e.jsxs("div",{className:"host-project-picker-breadcrumbs",children:[!i&&e.jsx("span",{children:b?"正在定位工作目录…":"未能加载工作目录"}),m.map((t,r)=>e.jsxs("span",{children:[r>0&&e.jsx("i",{children:"/"}),e.jsx("button",{type:"button",onClick:()=>void j(t.path),children:t.label})]},t.path))]}),e.jsx("button",{type:"button",className:"ui-icon-button",onClick:()=>i&&void j(i),disabled:!i||b,"aria-label":"刷新目录",title:"刷新目录",children:e.jsx(R,{size:15,"aria-hidden":"true"})})]}),o==="/"&&e.jsx("div",{className:"host-project-picker-warning",children:"当前允许访问宿主机根目录,请谨慎选择项目。"}),e.jsx("div",{className:"host-project-picker-list","aria-busy":b,children:b?e.jsx("div",{className:"host-project-picker-state",children:"正在读取目录…"}):F?e.jsx("div",{className:"host-project-picker-state is-error",children:F}):E.length===0?e.jsx("div",{className:"host-project-picker-state",children:"此目录为空"}):E.map(t=>{const r=ee(t.name,t.kind),{icon:N,label:f}=_[r],L=e.jsxs(e.Fragment,{children:[e.jsx("span",{className:`host-project-picker-entry-icon is-${r}`,"aria-hidden":"true",children:e.jsx(N,{size:18,strokeWidth:1.8})}),e.jsx("span",{className:"host-project-picker-name",children:t.name})]});return t.kind==="file"?e.jsx("div",{className:"host-project-picker-row is-file",title:f,children:L},`${t.name}:${t.path}`):e.jsxs("button",{type:"button",className:"host-project-picker-row is-directory",onClick:()=>void j(t.path),title:f,children:[L,t.hasChildren&&e.jsx("span",{className:"host-project-picker-chevron","aria-hidden":"true",children:e.jsx(Z,{size:16})})]},`${t.name}:${t.path}`)})}),e.jsxs("footer",{className:"host-project-picker-footer",children:[e.jsx("code",{title:i,children:i}),e.jsxs("div",{children:[e.jsx("button",{type:"button",className:"host-project-picker-cancel",onClick:s,children:"取消"}),e.jsx("button",{type:"button",className:"host-project-picker-confirm",disabled:!i||!C||b||v,onClick:()=>void A(),children:v?"正在导入…":"选择此文件夹"})]})]})]})}),document.body)}export{ce as H};
@@ -1,4 +1,4 @@
1
- import{r as l,j as e}from"./index-CrjQF-VW.js";const L=[{label:"TypeScript / JavaScript",language:"typescript",fileTypes:".ts,.tsx,.js,.jsx",command:"typescript-language-server",args:"--stdio"},{label:"Python (pylsp)",language:"python",fileTypes:".py",command:"pylsp",args:""},{label:"Python (pyright)",language:"python",fileTypes:".py",command:"pyright-langserver",args:"--stdio"},{label:"Rust (rust-analyzer)",language:"rust",fileTypes:".rs",command:"rust-analyzer",args:""},{label:"Go (gopls)",language:"go",fileTypes:".go",command:"gopls",args:""},{label:"C/C++ (clangd)",language:"cpp",fileTypes:".c,.cpp,.cc,.h,.hpp",command:"clangd",args:""},{label:"Java (jdtls via brew)",language:"java",fileTypes:".java",command:"jdtls",args:"--data /tmp/jdtls-workspace"}],y={id:"",name:"",language:"",fileTypes:"",command:"",args:"",envRaw:""};function P(){const[v,w]=l.useState([]),[t,o]=l.useState(y),[x,h]=l.useState(!1),[d,m]=l.useState(null),[f,b]=l.useState(null),g=async()=>{var n;if((n=window.agentApi)!=null&&n.lspList)try{const a=await window.agentApi.lspList();w(a)}catch(a){console.error("[LSP] load error",a)}};l.useEffect(()=>{g()},[]);const k=n=>{o(a=>({...a,name:n.label,language:n.language,fileTypes:n.fileTypes,command:n.command,args:n.args}))},T=n=>{m(n.id),o({id:n.id,name:n.name,language:n.language,fileTypes:n.fileTypes.join(","),command:n.command,args:n.args.join(" "),envRaw:n.env?Object.entries(n.env).map(([a,r])=>`${a}=${r}`).join(`
1
+ import{r as l,j as e}from"./index-D1AQffdA.js";const L=[{label:"TypeScript / JavaScript",language:"typescript",fileTypes:".ts,.tsx,.js,.jsx",command:"typescript-language-server",args:"--stdio"},{label:"Python (pylsp)",language:"python",fileTypes:".py",command:"pylsp",args:""},{label:"Python (pyright)",language:"python",fileTypes:".py",command:"pyright-langserver",args:"--stdio"},{label:"Rust (rust-analyzer)",language:"rust",fileTypes:".rs",command:"rust-analyzer",args:""},{label:"Go (gopls)",language:"go",fileTypes:".go",command:"gopls",args:""},{label:"C/C++ (clangd)",language:"cpp",fileTypes:".c,.cpp,.cc,.h,.hpp",command:"clangd",args:""},{label:"Java (jdtls via brew)",language:"java",fileTypes:".java",command:"jdtls",args:"--data /tmp/jdtls-workspace"}],y={id:"",name:"",language:"",fileTypes:"",command:"",args:"",envRaw:""};function P(){const[v,w]=l.useState([]),[t,o]=l.useState(y),[x,h]=l.useState(!1),[d,m]=l.useState(null),[f,b]=l.useState(null),g=async()=>{var n;if((n=window.agentApi)!=null&&n.lspList)try{const a=await window.agentApi.lspList();w(a)}catch(a){console.error("[LSP] load error",a)}};l.useEffect(()=>{g()},[]);const k=n=>{o(a=>({...a,name:n.label,language:n.language,fileTypes:n.fileTypes,command:n.command,args:n.args}))},T=n=>{m(n.id),o({id:n.id,name:n.name,language:n.language,fileTypes:n.fileTypes.join(","),command:n.command,args:n.args.join(" "),envRaw:n.env?Object.entries(n.env).map(([a,r])=>`${a}=${r}`).join(`
2
2
  `):""}),b(null)},j=()=>{m(null),o(y)},R=async()=>{var S;if(!((S=window.agentApi)!=null&&S.lspSave))return;const n=t.name.trim(),a=t.command.trim();if(!n||!a)return;let r;if(t.envRaw.trim()){r={};for(const p of t.envRaw.split(`
3
3
  `)){const u=p.indexOf("=");u>0&&(r[p.slice(0,u).trim()]=p.slice(u+1).trim())}}const F={id:d??crypto.randomUUID(),name:n,language:t.language.trim(),fileTypes:t.fileTypes.split(",").map(p=>p.trim()).filter(Boolean),command:a,args:t.args.trim()?t.args.trim().split(/\s+/):[],env:r,enabled:!0};h(!0);try{await window.agentApi.lspSave(F),await g(),j()}finally{h(!1)}},z=async n=>{var a;(a=window.agentApi)!=null&&a.lspDelete&&confirm("删除此 LSP 服务器配置?")&&(await window.agentApi.lspDelete(n),await g())},C=async n=>{var a;(a=window.agentApi)!=null&&a.lspSetEnabled&&(await window.agentApi.lspSetEnabled(n.id,!n.enabled),await g())},c=d!==null;return c&&d===null||!d&&t.name,e.jsxs("div",{style:{padding:"40px 48px",maxWidth:720,animation:"fadeInUp 0.4s var(--ease-out)"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:24},children:[e.jsxs("div",{children:[e.jsx("h2",{style:{fontSize:20,fontWeight:600,color:"var(--text-primary)",margin:0},children:"LSP 服务器"}),e.jsxs("p",{style:{fontSize:13,color:"var(--text-muted)",margin:"4px 0 0"},children:["配置 Language Server Protocol 服务器,让 Agent 可通过"," ",e.jsx("code",{style:{fontFamily:"var(--font-mono, monospace)",fontSize:12,color:"var(--text-secondary)",background:"var(--bg-deep)",padding:"1px 5px",borderRadius:4},children:"lsp_diagnostics"}),"、",e.jsx("code",{style:{fontFamily:"var(--font-mono, monospace)",fontSize:12,color:"var(--text-secondary)",background:"var(--bg-deep)",padding:"1px 5px",borderRadius:4},children:"lsp_hover"}),"、",e.jsx("code",{style:{fontFamily:"var(--font-mono, monospace)",fontSize:12,color:"var(--text-secondary)",background:"var(--bg-deep)",padding:"1px 5px",borderRadius:4},children:"lsp_definition"})," ","等工具进行代码分析。"]})]}),!c&&e.jsx("button",{onClick:()=>{m(""),o(y)},style:{padding:"8px 16px",borderRadius:"var(--radius-sm)",border:"none",background:"var(--accent)",color:"#fff",fontSize:13,fontWeight:600,cursor:"pointer",flexShrink:0},children:"+ 添加服务器"})]}),v.length===0&&!c&&e.jsx("div",{style:{color:"var(--text-muted)",fontSize:14,padding:"40px 0",textAlign:"center"},children:"尚未配置任何 LSP 服务器"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8,marginBottom:c?24:0},children:v.map(n=>e.jsxs("div",{style:{background:"var(--bg-glass)",border:"1px solid var(--border-subtle)",borderRadius:"var(--radius-md)",overflow:"hidden"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"12px 16px",cursor:"pointer"},onClick:()=>b(f===n.id?null:n.id),children:[e.jsx("div",{onClick:a=>{a.stopPropagation(),C(n)},style:{width:32,height:18,borderRadius:9,background:n.enabled?"var(--success, #34d399)":"var(--border-default)",position:"relative",cursor:"pointer",flexShrink:0,transition:"background 0.2s"},children:e.jsx("div",{style:{position:"absolute",top:2,left:n.enabled?16:2,width:14,height:14,borderRadius:"50%",background:"#fff",transition:"left 0.2s"}})}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontWeight:500,fontSize:13,color:"var(--text-primary)"},children:n.name}),e.jsxs("div",{style:{fontSize:11,color:"var(--text-muted)",marginTop:2},children:[n.language,n.fileTypes.length>0?` · ${n.fileTypes.join(", ")}`:""]})]}),e.jsxs("div",{style:{fontSize:11,color:"var(--text-muted)",fontFamily:"var(--font-mono, monospace)",flexShrink:0},children:[n.command,n.args.length?" "+n.args.join(" "):""]}),e.jsx("button",{onClick:a=>{a.stopPropagation(),T(n)},style:{background:"none",border:"none",cursor:"pointer",color:"var(--text-muted)",fontSize:13,padding:"2px 8px",fontFamily:"var(--font-body)"},children:"编辑"}),e.jsx("button",{onClick:a=>{a.stopPropagation(),z(n.id)},style:{background:"none",border:"none",cursor:"pointer",color:"var(--danger, #f43f5e)",fontSize:13,padding:"2px 8px",fontFamily:"var(--font-body)"},children:"删除"}),e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-muted)",strokeWidth:"2.5",strokeLinecap:"round",style:{flexShrink:0,transition:"transform 0.2s",transform:f===n.id?"rotate(180deg)":"none"},children:e.jsx("path",{d:"M6 9l6 6 6-6"})})]}),f===n.id&&e.jsxs("div",{style:{padding:"12px 16px",fontSize:12,color:"var(--text-muted)",borderTop:"1px solid var(--border-subtle)",display:"flex",flexDirection:"column",gap:6},children:[e.jsxs("div",{children:[e.jsx("span",{style:{color:"var(--text-secondary)",fontWeight:500},children:"命令:"}),e.jsxs("code",{style:{fontFamily:"var(--font-mono, monospace)",background:"var(--bg-deep)",padding:"1px 5px",borderRadius:4},children:[n.command," ",n.args.join(" ")]})]}),n.fileTypes.length>0&&e.jsxs("div",{children:[e.jsx("span",{style:{color:"var(--text-secondary)",fontWeight:500},children:"文件类型:"}),n.fileTypes.join(", ")]}),n.env&&Object.keys(n.env).length>0&&e.jsxs("div",{children:[e.jsx("span",{style:{color:"var(--text-secondary)",fontWeight:500},children:"环境变量:"}),Object.entries(n.env).map(([a,r])=>`${a}=${r}`).join(", ")]})]})]},n.id))}),c&&e.jsxs("div",{style:{padding:"20px 24px",borderRadius:"var(--radius-md)",border:"1px solid var(--border-glow)",background:"var(--bg-glass)"},children:[e.jsx("h3",{style:{margin:"0 0 16px",fontSize:14,fontWeight:600,color:"var(--text-primary)"},children:d?"编辑 LSP 服务器":"添加 LSP 服务器"}),e.jsxs("div",{style:{marginBottom:16},children:[e.jsx("label",{style:i,children:"快速预设"}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:L.map(n=>e.jsx("button",{onClick:()=>k(n),style:{background:"var(--bg-deep)",border:"1px solid var(--border-default)",borderRadius:"var(--radius-sm)",padding:"4px 10px",fontSize:11,cursor:"pointer",color:"var(--text-secondary)",fontFamily:"var(--font-body)"},children:n.label},n.label))})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12},children:[e.jsxs("div",{children:[e.jsxs("label",{style:i,children:["名称 ",e.jsx("span",{style:{color:"var(--danger, #f43f5e)",textTransform:"none"},children:"*"})]}),e.jsx("input",{value:t.name,onChange:n=>o(a=>({...a,name:n.target.value})),placeholder:"TypeScript Language Server",style:s})]}),e.jsxs("div",{children:[e.jsx("label",{style:i,children:"语言"}),e.jsx("input",{value:t.language,onChange:n=>o(a=>({...a,language:n.target.value})),placeholder:"typescript",style:s})]})]}),e.jsxs("div",{children:[e.jsxs("label",{style:i,children:["文件类型",e.jsx("span",{style:{textTransform:"none",letterSpacing:0,fontWeight:400,marginLeft:6,color:"var(--text-muted)"},children:"逗号分隔,如 .ts,.tsx"})]}),e.jsx("input",{value:t.fileTypes,onChange:n=>o(a=>({...a,fileTypes:n.target.value})),placeholder:".ts,.tsx,.js,.jsx",style:s})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12},children:[e.jsxs("div",{children:[e.jsxs("label",{style:i,children:["命令 ",e.jsx("span",{style:{color:"var(--danger, #f43f5e)",textTransform:"none"},children:"*"})]}),e.jsx("input",{value:t.command,onChange:n=>o(a=>({...a,command:n.target.value})),placeholder:"typescript-language-server",style:{...s,fontFamily:"var(--font-mono, monospace)"}})]}),e.jsxs("div",{children:[e.jsxs("label",{style:i,children:["参数",e.jsx("span",{style:{textTransform:"none",letterSpacing:0,fontWeight:400,marginLeft:6,color:"var(--text-muted)"},children:"空格分隔"})]}),e.jsx("input",{value:t.args,onChange:n=>o(a=>({...a,args:n.target.value})),placeholder:"--stdio",style:{...s,fontFamily:"var(--font-mono, monospace)"}})]})]}),e.jsxs("div",{children:[e.jsxs("label",{style:i,children:["环境变量",e.jsx("span",{style:{textTransform:"none",letterSpacing:0,fontWeight:400,marginLeft:6,color:"var(--text-muted)"},children:"每行 KEY=VALUE"})]}),e.jsx("textarea",{value:t.envRaw,onChange:n=>o(a=>({...a,envRaw:n.target.value})),placeholder:`NODE_ENV=production
4
4
  TSPROTOCOL_LOG=verbose`,rows:3,style:{...s,fontFamily:"var(--font-mono, monospace)",resize:"vertical"}})]}),t.language==="java"&&e.jsxs("div",{style:{background:"rgba(234,179,8,0.08)",border:"1px solid rgba(234,179,8,0.3)",borderRadius:"var(--radius-sm)",padding:"10px 14px",fontSize:12,color:"var(--text-secondary)",lineHeight:1.65},children:[e.jsx("strong",{style:{color:"rgba(202,138,4,1)"},children:"Java 提示:"})," ","使用 ",e.jsx("code",{style:{fontFamily:"var(--font-mono, monospace)",background:"var(--bg-deep)",padding:"1px 5px",borderRadius:3},children:"jdtls"})," 预设需先通过"," ",e.jsx("code",{style:{fontFamily:"var(--font-mono, monospace)",background:"var(--bg-deep)",padding:"1px 5px",borderRadius:3},children:"brew install jdtls"})," ","安装包装脚本。若手动安装,请将命令改为"," ",e.jsx("code",{style:{fontFamily:"var(--font-mono, monospace)",background:"var(--bg-deep)",padding:"1px 5px",borderRadius:3},children:"java"}),", 并在参数中填入完整的 JVM 参数和"," ",e.jsx("code",{style:{fontFamily:"var(--font-mono, monospace)",background:"var(--bg-deep)",padding:"1px 5px",borderRadius:3},children:"-jar .../launcher.jar -data /path/to/workspace"}),"。"]})]}),e.jsxs("div",{style:{display:"flex",gap:8,marginTop:20},children:[e.jsx("button",{onClick:()=>void R(),disabled:x||!t.name.trim()||!t.command.trim(),style:{padding:"8px 20px",borderRadius:"var(--radius-sm)",border:"none",background:"var(--accent)",color:"#fff",fontSize:13,fontWeight:600,cursor:"pointer",opacity:x||!t.name.trim()||!t.command.trim()?.45:1,fontFamily:"var(--font-body)"},children:x?"保存中…":"保存"}),e.jsx("button",{onClick:j,style:{padding:"8px 20px",borderRadius:"var(--radius-sm)",border:"1px solid var(--border-default)",background:"transparent",color:"var(--text-secondary)",fontSize:13,fontWeight:600,cursor:"pointer",fontFamily:"var(--font-body)"},children:"取消"})]})]})]})}const s={width:"100%",padding:"8px 10px",borderRadius:"var(--radius-sm)",border:"1px solid var(--border-default)",background:"var(--bg-glass)",color:"var(--text-primary)",fontSize:13,fontFamily:"var(--font-body)",outline:"none",boxSizing:"border-box"},i={fontSize:11,color:"var(--text-muted)",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",marginBottom:4,display:"block"};export{P as default};
@@ -1,4 +1,4 @@
1
- import{r as d,j as t}from"./index-CrjQF-VW.js";const B={id:"",name:"",command:"",args:"",url:"",headersRaw:""};function oe(){const[S,f]=d.useState([]),[s,U]=d.useState("stdio"),[a,u]=d.useState(B),[T,I]=d.useState(!1),[g,b]=d.useState({id:!1,command:!1,url:!1}),[j,W]=d.useState({}),[E,H]=d.useState({}),[_,P]=d.useState(new Set),[p,v]=d.useState(null),[x,w]=d.useState(""),[k,D]=d.useState(!1),y=async e=>{var i;if(!((i=window.agentApi)!=null&&i.mcpProbe))return;P(n=>new Set([...n,e.id])),H(n=>{const o={...n};return delete o[e.id],o});const r=new Promise((n,o)=>setTimeout(()=>o(new Error("连接超时(15s)")),15e3));try{const n=await Promise.race([window.agentApi.mcpProbe(e),r]);W(o=>({...o,[e.id]:n}))}catch(n){const o=n instanceof Error?n.message:String(n);console.warn(`[MCP] probe failed for ${e.id}:`,o),W(l=>{const F={...l};return delete F[e.id],F}),H(l=>({...l,[e.id]:o})),(e.transport==="sse"||/401|403|unauthorized|forbidden|需要认证|访问被拒绝/i.test(o))&&(w(""),v({server:e}))}finally{P(n=>{const o=new Set(n);return o.delete(e.id),o})}};d.useEffect(()=>{window.agentApi&&window.agentApi.mcpList().then(e=>{f(e),e.filter(r=>r.enabled!==!1).forEach(r=>y(r))}).catch(console.error)},[]);const[h,L]=d.useState(""),[M,z]=d.useState(""),[C,O]=d.useState(!1),V=async()=>{z("");let e;try{e=JSON.parse(h.trim());const r=e.mcpServers??e,i=Object.entries(r);if(i.length===0){z("未找到任何服务器");return}O(!0);const n=[];for(const[l,F]of i){const c=F,J=c.name||l,N=c.disabled!==!0;let R;if(c.url||c.type==="streamableHttp"||c.type==="sse"){const re=c.type==="sse"?"sse":"streamableHttp";R={id:l,name:J,transport:re,url:c.url,headers:c.headers??{},env:c.env??{},enabled:N}}else R={id:l,name:J,transport:"stdio",command:c.command,args:c.args??[],env:c.env??{},enabled:N};await window.agentApi.mcpSave(R),n.push(R)}const o=await window.agentApi.mcpList();f(o),L(""),n.filter(l=>l.enabled!==!1).forEach(l=>y(l))}catch(r){z(r instanceof Error?r.message:"JSON 解析失败")}finally{O(!1)}},K=()=>a.id.trim()!==""&&a.command.trim()!=="",Y=()=>a.id.trim()!==""&&a.url.trim()!=="",q=e=>{const r={};for(const i of e.split(`
1
+ import{r as d,j as t}from"./index-D1AQffdA.js";const B={id:"",name:"",command:"",args:"",url:"",headersRaw:""};function oe(){const[S,f]=d.useState([]),[s,U]=d.useState("stdio"),[a,u]=d.useState(B),[T,I]=d.useState(!1),[g,b]=d.useState({id:!1,command:!1,url:!1}),[j,W]=d.useState({}),[E,H]=d.useState({}),[_,P]=d.useState(new Set),[p,v]=d.useState(null),[x,w]=d.useState(""),[k,D]=d.useState(!1),y=async e=>{var i;if(!((i=window.agentApi)!=null&&i.mcpProbe))return;P(n=>new Set([...n,e.id])),H(n=>{const o={...n};return delete o[e.id],o});const r=new Promise((n,o)=>setTimeout(()=>o(new Error("连接超时(15s)")),15e3));try{const n=await Promise.race([window.agentApi.mcpProbe(e),r]);W(o=>({...o,[e.id]:n}))}catch(n){const o=n instanceof Error?n.message:String(n);console.warn(`[MCP] probe failed for ${e.id}:`,o),W(l=>{const F={...l};return delete F[e.id],F}),H(l=>({...l,[e.id]:o})),(e.transport==="sse"||/401|403|unauthorized|forbidden|需要认证|访问被拒绝/i.test(o))&&(w(""),v({server:e}))}finally{P(n=>{const o=new Set(n);return o.delete(e.id),o})}};d.useEffect(()=>{window.agentApi&&window.agentApi.mcpList().then(e=>{f(e),e.filter(r=>r.enabled!==!1).forEach(r=>y(r))}).catch(console.error)},[]);const[h,L]=d.useState(""),[M,z]=d.useState(""),[C,O]=d.useState(!1),V=async()=>{z("");let e;try{e=JSON.parse(h.trim());const r=e.mcpServers??e,i=Object.entries(r);if(i.length===0){z("未找到任何服务器");return}O(!0);const n=[];for(const[l,F]of i){const c=F,J=c.name||l,N=c.disabled!==!0;let R;if(c.url||c.type==="streamableHttp"||c.type==="sse"){const re=c.type==="sse"?"sse":"streamableHttp";R={id:l,name:J,transport:re,url:c.url,headers:c.headers??{},env:c.env??{},enabled:N}}else R={id:l,name:J,transport:"stdio",command:c.command,args:c.args??[],env:c.env??{},enabled:N};await window.agentApi.mcpSave(R),n.push(R)}const o=await window.agentApi.mcpList();f(o),L(""),n.filter(l=>l.enabled!==!1).forEach(l=>y(l))}catch(r){z(r instanceof Error?r.message:"JSON 解析失败")}finally{O(!1)}},K=()=>a.id.trim()!==""&&a.command.trim()!=="",Y=()=>a.id.trim()!==""&&a.url.trim()!=="",q=e=>{const r={};for(const i of e.split(`
2
2
  `)){const n=i.indexOf(":");if(n<1)continue;const o=i.slice(0,n).trim(),l=i.slice(n+1).trim();o&&(r[o]=l)}return r},G=async()=>{if(b({id:!0,command:!0,url:!0}),!(s==="stdio"&&!K())&&!((s==="sse"||s==="streamableHttp")&&!Y())){I(!0);try{const e=s==="sse"||s==="streamableHttp"?q(a.headersRaw):{},r=s==="stdio"?{id:a.id,name:a.name||a.id,transport:"stdio",command:a.command,args:a.args.split(" ").filter(Boolean),enabled:!0}:{id:a.id,name:a.name||a.id,transport:s,url:a.url,headers:e,enabled:!0};await window.agentApi.mcpSave(r);const i=await window.agentApi.mcpList();f(i),u(B),b({id:!1,command:!1,url:!1}),y(r)}catch(e){console.error("Failed to save MCP server",e)}finally{I(!1)}}},Q=async e=>{await window.agentApi.mcpDelete(e),f(S.filter(r=>r.id!==e))},X=async(e,r)=>{await window.agentApi.mcpSetEnabled(e,r),f(S.map(i=>i.id===e?{...i,enabled:r}:i))},$=async()=>{if(!(!p||!x.trim())){D(!0);try{const e=p.server.transport==="streamableHttp"?{...p.server,headers:{...p.server.headers??{},Authorization:`Bearer ${x.trim()}`}}:{...p.server,env:{...p.server.env??{},Authorization:`Bearer ${x.trim()}`}};await window.agentApi.mcpSave(e);const r=await window.agentApi.mcpList();f(r),v(null),w("");const i=r.find(n=>n.id===e.id)??e;y(i)}finally{D(!1)}}},Z=e=>e==="stdio"?"本地":e==="streamableHttp"?"HTTP":"SSE",ee=e=>e==="stdio"?"#68d391":e==="streamableHttp"?"#f6ad55":"#63b3ed",te=e=>e==="stdio"?"rgba(154,230,180,0.15)":e==="streamableHttp"?"rgba(246,173,85,0.15)":"rgba(99,179,237,0.15)";return t.jsxs("div",{style:{padding:"40px 48px",maxWidth:660,animation:"fadeInUp 0.4s var(--ease-out)"},children:[t.jsx("h2",{style:{fontFamily:"var(--font-display)",fontSize:28,color:"var(--text-primary)",fontWeight:400,marginBottom:8,letterSpacing:"-0.02em"},children:"MCP 服务器"}),t.jsx("p",{style:{color:"var(--text-muted)",fontSize:14,marginBottom:32},children:"通过模型上下文协议连接外部工具。"}),t.jsxs("div",{style:{padding:20,background:"var(--bg-glass)",borderRadius:"var(--radius-md)",border:"1px solid var(--border-subtle)",marginBottom:28,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:16},children:[t.jsx("h3",{style:{fontSize:14,fontWeight:600,color:"var(--text-primary)",margin:0},children:"添加服务器"}),t.jsx("div",{style:{display:"flex",background:"var(--bg-surface)",borderRadius:"var(--radius-sm)",border:"1px solid var(--border-default)",overflow:"hidden"},children:["stdio","sse","streamableHttp"].map(e=>t.jsx("button",{onClick:()=>{U(e),b({id:!1,command:!1,url:!1}),u(r=>({...B,id:r.id,name:r.name}))},style:{padding:"5px 14px",border:"none",fontSize:12,fontWeight:500,cursor:"pointer",fontFamily:"var(--font-body)",transition:"background 0.15s",background:s===e?"var(--accent)":"transparent",color:s===e?"var(--text-inverse)":"var(--text-muted)"},children:e==="stdio"?"本地 stdio":e==="sse"?"远程 SSE":"HTTP"},e))})]}),t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[t.jsxs("div",{style:{display:"flex",gap:10},children:[t.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:4},children:[t.jsx("input",{value:a.id,onChange:e=>u(r=>({...r,id:e.target.value})),onBlur:()=>b(e=>({...e,id:!0})),placeholder:"服务器 ID *",style:{...m,...g.id&&!a.id?A:{}}}),g.id&&!a.id&&t.jsx("span",{style:{fontSize:11,color:"var(--danger)"},children:"必填"})]}),t.jsx("input",{value:a.name,onChange:e=>u(r=>({...r,name:e.target.value})),placeholder:"显示名称",style:{...m,flex:1}})]}),s==="stdio"?t.jsxs("div",{style:{display:"flex",gap:10},children:[t.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:4},children:[t.jsx("input",{value:a.command,onChange:e=>u(r=>({...r,command:e.target.value})),onBlur:()=>b(e=>({...e,command:!0})),placeholder:"命令(如 npx)*",style:{...m,...g.command&&!a.command?A:{}}}),g.command&&!a.command&&t.jsx("span",{style:{fontSize:11,color:"var(--danger)"},children:"必填"})]}),t.jsx("input",{value:a.args,onChange:e=>u(r=>({...r,args:e.target.value})),placeholder:"参数(如 -y @anthropic/mcp-server)",style:{...m,flex:2}})]}):t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[t.jsx("input",{value:a.url,onChange:e=>u(r=>({...r,url:e.target.value})),onBlur:()=>b(e=>({...e,url:!0})),placeholder:s==="streamableHttp"?"HTTP URL(如 http://host/mcp)*":"SSE URL(如 https://mcp.example.com/sse)*",style:{...m,...g.url&&!a.url?A:{}}}),g.url&&!a.url&&t.jsx("span",{style:{fontSize:11,color:"var(--danger)"},children:"必填"})]}),t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[t.jsx("label",{style:{fontSize:12,color:"var(--text-muted)"},children:"请求头(每行 key: value)"}),t.jsx("textarea",{value:a.headersRaw,onChange:e=>u(r=>({...r,headersRaw:e.target.value})),placeholder:`access_token: abc123
3
3
  Authorization: Bearer sk-...`,rows:3,style:{...m,fontFamily:"var(--font-mono)",fontSize:12,resize:"vertical"}})]})]}),t.jsx("button",{onClick:G,disabled:T,style:{alignSelf:"flex-start",padding:"10px 22px",borderRadius:"var(--radius-sm)",border:"none",background:"var(--accent)",color:"var(--text-inverse)",fontSize:13,fontWeight:600,cursor:T?"not-allowed":"pointer",fontFamily:"var(--font-body)"},children:T?"保存中…":"添加服务器"})]})]}),t.jsxs("div",{style:{marginBottom:28,padding:20,background:"var(--bg-glass)",borderRadius:"var(--radius-md)",border:"1px solid var(--border-subtle)",backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)"},children:[t.jsx("h3",{style:{fontSize:14,fontWeight:600,color:"var(--text-primary)",margin:"0 0 8px"},children:"导入 JSON 配置"}),t.jsx("p",{style:{fontSize:12,color:"var(--text-muted)",margin:"0 0 10px"},children:"兼容 Claude Desktop / Cursor 格式,粘贴后点导入。"}),t.jsx("textarea",{value:h,onChange:e=>{L(e.target.value),z("")},placeholder:`{
4
4
  "my-server": {
@@ -1 +1 @@
1
- import{r,j as t}from"./index-CrjQF-VW.js";function E(){const[f,m]=r.useState([]),[g,B]=r.useState(""),[n,b]=r.useState(null),[h,o]=r.useState(!1),[y,a]=r.useState(""),[S,s]=r.useState(""),[j,i]=r.useState("user"),[w,d]=r.useState(""),[k,l]=r.useState(null),[v,c]=r.useState("success"),p=async()=>{if(window.agentApi){const e=await window.agentApi.listMemories();m(e)}};r.useEffect(()=>{p()},[]);const z=async()=>{if(!g.trim()){p();return}if(window.agentApi){const e=await window.agentApi.searchMemories(g);m(e.map(u=>u.entry))}},R=async()=>{if(!(!y.trim()||!window.agentApi))try{await window.agentApi.setMemory({name:y.trim(),description:S,type:j,content:w,created:(n==null?void 0:n.created)??new Date().toISOString(),updated:new Date().toISOString()}),o(!1),b(null),a(""),s(""),d(""),i("user"),l("保存成功"),c("success"),await p()}catch(e){l(e instanceof Error?e.message:"保存失败"),c("error")}},W=e=>{b(e),a(e.name),s(e.description),i(e.type),d(e.content),o(!0)};return t.jsxs("div",{style:{padding:"40px 48px",maxWidth:720,animation:"fadeInUp 0.4s var(--ease-out)"},children:[t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:24},children:[t.jsxs("div",{children:[t.jsx("h2",{style:{fontFamily:"var(--font-display)",fontSize:28,color:"var(--text-primary)",fontWeight:400,letterSpacing:"-0.02em"},children:"记忆"}),t.jsx("p",{style:{color:"var(--text-muted)",fontSize:14,marginTop:4},children:"跨会话的持久化知识库。"})]}),t.jsx("button",{onClick:()=>{o(!0),b(null),a(""),s(""),d(""),i("user")},style:{padding:"10px 20px",borderRadius:"var(--radius-sm)",border:"none",background:"var(--accent)",color:"var(--text-inverse)",fontSize:13,fontWeight:600,cursor:"pointer",fontFamily:"var(--font-body)"},children:"+ 新建"})]}),t.jsxs("div",{style:{display:"flex",gap:8,marginBottom:24},children:[t.jsx("input",{value:g,onChange:e=>B(e.target.value),onKeyDown:e=>e.key==="Enter"&&z(),placeholder:"搜索记忆...",style:{flex:1,padding:"10px 14px",borderRadius:"var(--radius-sm)",border:"1px solid var(--border-default)",background:"var(--bg-glass)",color:"var(--text-primary)",fontSize:14,outline:"none",fontFamily:"var(--font-body)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"}}),t.jsx("button",{onClick:z,style:C,children:"搜索"})]}),k&&t.jsx("div",{style:{padding:"10px 12px",borderRadius:"var(--radius-sm)",border:v==="success"?"1px solid rgba(52,211,153,0.35)":"1px solid rgba(244,63,94,0.35)",background:v==="success"?"rgba(52,211,153,0.08)":"rgba(244,63,94,0.08)",color:v==="success"?"var(--success)":"var(--danger)",fontSize:13,marginBottom:16},children:k}),h&&t.jsxs("div",{style:{padding:20,marginBottom:24,background:"var(--bg-glass)",borderRadius:"var(--radius-md)",border:"1px solid var(--border-subtle)",backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)"},children:[t.jsx("input",{value:y,onChange:e=>a(e.target.value),placeholder:"名称",style:{...x,marginBottom:10},disabled:!!n}),t.jsx("input",{value:S,onChange:e=>s(e.target.value),placeholder:"描述",style:{...x,marginBottom:10}}),t.jsxs("select",{value:j,onChange:e=>i(e.target.value),style:{...x,marginBottom:10},children:[t.jsx("option",{value:"user",children:"用户"}),t.jsx("option",{value:"feedback",children:"反馈"}),t.jsx("option",{value:"project",children:"项目"}),t.jsx("option",{value:"reference",children:"参考"})]}),t.jsx("textarea",{value:w,onChange:e=>d(e.target.value),placeholder:"内容",rows:5,style:{...x,marginBottom:12,resize:"vertical"}}),t.jsxs("div",{style:{display:"flex",gap:8},children:[t.jsx("button",{onClick:R,style:{padding:"9px 20px",borderRadius:"var(--radius-sm)",border:"none",background:"var(--success)",color:"#000",fontSize:13,fontWeight:600,cursor:"pointer",fontFamily:"var(--font-body)"},children:"保存"}),t.jsx("button",{onClick:()=>o(!1),style:C,children:"取消"})]})]}),f.map(e=>t.jsxs("div",{style:{padding:"14px 16px",marginBottom:8,background:"var(--bg-glass)",borderRadius:"var(--radius-sm)",border:"1px solid var(--border-subtle)",backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",transition:"border-color 0.2s"},children:[t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[t.jsx("span",{style:{color:"var(--text-primary)",fontWeight:600,fontSize:14},children:e.name}),t.jsx("span",{style:{fontSize:10,padding:"2px 8px",borderRadius:10,background:"rgba(255,255,255,0.04)",color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.06em",fontWeight:500},children:e.type})]}),t.jsxs("div",{style:{display:"flex",gap:6},children:[t.jsx("button",{onClick:()=>W(e),style:F,children:"编辑"}),t.jsx("button",{onClick:async()=>{if(window.agentApi)try{await window.agentApi.deleteMemory(e.name),l("删除成功"),c("success"),await p()}catch(u){l(u instanceof Error?u.message:"删除失败"),c("error")}},style:{...F,color:"var(--danger)"},children:"删除"})]})]}),e.description&&t.jsx("div",{style:{fontSize:12,color:"var(--text-secondary)",marginTop:4},children:e.description}),t.jsxs("div",{style:{fontSize:12,color:"var(--text-muted)",marginTop:4,lineHeight:1.5},children:[e.content.slice(0,180),e.content.length>180?"…":""]})]},e.name)),f.length===0&&!h&&t.jsx("div",{style:{color:"var(--text-muted)",fontSize:14,padding:"60px 0",textAlign:"center"},children:"暂无记忆,点击「新建」创建一条。"})]})}const x={width:"100%",padding:"11px 14px",borderRadius:"var(--radius-sm)",border:"1px solid var(--border-default)",background:"var(--bg-surface)",color:"var(--text-primary)",fontSize:14,outline:"none",fontFamily:"var(--font-body)",boxSizing:"border-box"},C={padding:"10px 16px",borderRadius:"var(--radius-sm)",border:"1px solid var(--border-default)",background:"var(--bg-glass)",color:"var(--text-secondary)",fontSize:13,fontWeight:500,cursor:"pointer",fontFamily:"var(--font-body)"},F={padding:"4px 10px",borderRadius:6,fontSize:11,border:"none",background:"rgba(255,255,255,0.05)",color:"var(--text-secondary)",cursor:"pointer",fontFamily:"var(--font-body)",fontWeight:500};export{E as default};
1
+ import{r,j as t}from"./index-D1AQffdA.js";function E(){const[f,m]=r.useState([]),[g,B]=r.useState(""),[n,b]=r.useState(null),[h,o]=r.useState(!1),[y,a]=r.useState(""),[S,s]=r.useState(""),[j,i]=r.useState("user"),[w,d]=r.useState(""),[k,l]=r.useState(null),[v,c]=r.useState("success"),p=async()=>{if(window.agentApi){const e=await window.agentApi.listMemories();m(e)}};r.useEffect(()=>{p()},[]);const z=async()=>{if(!g.trim()){p();return}if(window.agentApi){const e=await window.agentApi.searchMemories(g);m(e.map(u=>u.entry))}},R=async()=>{if(!(!y.trim()||!window.agentApi))try{await window.agentApi.setMemory({name:y.trim(),description:S,type:j,content:w,created:(n==null?void 0:n.created)??new Date().toISOString(),updated:new Date().toISOString()}),o(!1),b(null),a(""),s(""),d(""),i("user"),l("保存成功"),c("success"),await p()}catch(e){l(e instanceof Error?e.message:"保存失败"),c("error")}},W=e=>{b(e),a(e.name),s(e.description),i(e.type),d(e.content),o(!0)};return t.jsxs("div",{style:{padding:"40px 48px",maxWidth:720,animation:"fadeInUp 0.4s var(--ease-out)"},children:[t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:24},children:[t.jsxs("div",{children:[t.jsx("h2",{style:{fontFamily:"var(--font-display)",fontSize:28,color:"var(--text-primary)",fontWeight:400,letterSpacing:"-0.02em"},children:"记忆"}),t.jsx("p",{style:{color:"var(--text-muted)",fontSize:14,marginTop:4},children:"跨会话的持久化知识库。"})]}),t.jsx("button",{onClick:()=>{o(!0),b(null),a(""),s(""),d(""),i("user")},style:{padding:"10px 20px",borderRadius:"var(--radius-sm)",border:"none",background:"var(--accent)",color:"var(--text-inverse)",fontSize:13,fontWeight:600,cursor:"pointer",fontFamily:"var(--font-body)"},children:"+ 新建"})]}),t.jsxs("div",{style:{display:"flex",gap:8,marginBottom:24},children:[t.jsx("input",{value:g,onChange:e=>B(e.target.value),onKeyDown:e=>e.key==="Enter"&&z(),placeholder:"搜索记忆...",style:{flex:1,padding:"10px 14px",borderRadius:"var(--radius-sm)",border:"1px solid var(--border-default)",background:"var(--bg-glass)",color:"var(--text-primary)",fontSize:14,outline:"none",fontFamily:"var(--font-body)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"}}),t.jsx("button",{onClick:z,style:C,children:"搜索"})]}),k&&t.jsx("div",{style:{padding:"10px 12px",borderRadius:"var(--radius-sm)",border:v==="success"?"1px solid rgba(52,211,153,0.35)":"1px solid rgba(244,63,94,0.35)",background:v==="success"?"rgba(52,211,153,0.08)":"rgba(244,63,94,0.08)",color:v==="success"?"var(--success)":"var(--danger)",fontSize:13,marginBottom:16},children:k}),h&&t.jsxs("div",{style:{padding:20,marginBottom:24,background:"var(--bg-glass)",borderRadius:"var(--radius-md)",border:"1px solid var(--border-subtle)",backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)"},children:[t.jsx("input",{value:y,onChange:e=>a(e.target.value),placeholder:"名称",style:{...x,marginBottom:10},disabled:!!n}),t.jsx("input",{value:S,onChange:e=>s(e.target.value),placeholder:"描述",style:{...x,marginBottom:10}}),t.jsxs("select",{value:j,onChange:e=>i(e.target.value),style:{...x,marginBottom:10},children:[t.jsx("option",{value:"user",children:"用户"}),t.jsx("option",{value:"feedback",children:"反馈"}),t.jsx("option",{value:"project",children:"项目"}),t.jsx("option",{value:"reference",children:"参考"})]}),t.jsx("textarea",{value:w,onChange:e=>d(e.target.value),placeholder:"内容",rows:5,style:{...x,marginBottom:12,resize:"vertical"}}),t.jsxs("div",{style:{display:"flex",gap:8},children:[t.jsx("button",{onClick:R,style:{padding:"9px 20px",borderRadius:"var(--radius-sm)",border:"none",background:"var(--success)",color:"#000",fontSize:13,fontWeight:600,cursor:"pointer",fontFamily:"var(--font-body)"},children:"保存"}),t.jsx("button",{onClick:()=>o(!1),style:C,children:"取消"})]})]}),f.map(e=>t.jsxs("div",{style:{padding:"14px 16px",marginBottom:8,background:"var(--bg-glass)",borderRadius:"var(--radius-sm)",border:"1px solid var(--border-subtle)",backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",transition:"border-color 0.2s"},children:[t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[t.jsx("span",{style:{color:"var(--text-primary)",fontWeight:600,fontSize:14},children:e.name}),t.jsx("span",{style:{fontSize:10,padding:"2px 8px",borderRadius:10,background:"rgba(255,255,255,0.04)",color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:"0.06em",fontWeight:500},children:e.type})]}),t.jsxs("div",{style:{display:"flex",gap:6},children:[t.jsx("button",{onClick:()=>W(e),style:F,children:"编辑"}),t.jsx("button",{onClick:async()=>{if(window.agentApi)try{await window.agentApi.deleteMemory(e.name),l("删除成功"),c("success"),await p()}catch(u){l(u instanceof Error?u.message:"删除失败"),c("error")}},style:{...F,color:"var(--danger)"},children:"删除"})]})]}),e.description&&t.jsx("div",{style:{fontSize:12,color:"var(--text-secondary)",marginTop:4},children:e.description}),t.jsxs("div",{style:{fontSize:12,color:"var(--text-muted)",marginTop:4,lineHeight:1.5},children:[e.content.slice(0,180),e.content.length>180?"…":""]})]},e.name)),f.length===0&&!h&&t.jsx("div",{style:{color:"var(--text-muted)",fontSize:14,padding:"60px 0",textAlign:"center"},children:"暂无记忆,点击「新建」创建一条。"})]})}const x={width:"100%",padding:"11px 14px",borderRadius:"var(--radius-sm)",border:"1px solid var(--border-default)",background:"var(--bg-surface)",color:"var(--text-primary)",fontSize:14,outline:"none",fontFamily:"var(--font-body)",boxSizing:"border-box"},C={padding:"10px 16px",borderRadius:"var(--radius-sm)",border:"1px solid var(--border-default)",background:"var(--bg-glass)",color:"var(--text-secondary)",fontSize:13,fontWeight:500,cursor:"pointer",fontFamily:"var(--font-body)"},F={padding:"4px 10px",borderRadius:6,fontSize:11,border:"none",background:"rgba(255,255,255,0.05)",color:"var(--text-secondary)",cursor:"pointer",fontFamily:"var(--font-body)",fontWeight:500};export{E as default};
@@ -1 +1 @@
1
- import{r,u as f,j as a}from"./index-CrjQF-VW.js";import{c as g,r as h,u as j,S as v,T as x,C as k}from"./new-session-window-ThRZvGVK.js";import{X as y}from"./x-3I6TKNBE.js";import"./artifact-links-B0ApmgK6.js";import"./composer-file-routing-CFoCNmv7.js";import"./loader-circle-BSDHoDXf.js";import"./RemoteDesktopTabBridge-tJcxPHnZ.js";import"./check-CY3GCzxa.js";import"./RunningSessionsIcon-DuoG6Hgs.js";import"./trash-2-CT_MslWu.js";import"./download-Cy_rpjte.js";import"./file-types-BsWJSk07.js";import"./list-todo-BJrNf0OF.js";import"./chevron-right-Bnd4FK8S.js";import"./chevron-down-FeW7FcBS.js";import"./session-tree-Ck5Wp7h-.js";import"./zoom-out-417ojKB8.js";import"./rotate-ccw-DtSpwbK7.js";import"./use-session-activity-B9xAOlzA.js";import"./client-ZvcI0WiM.js";import"./HostProjectPicker-7zvVzftL.js";function J(){const[m]=r.useState(()=>g()),[i,u]=r.useState(()=>{const t=h(window.location.search);return{agentType:(t==null?void 0:t.agentType)??"customer-agent",projectId:null,cwd:(t==null?void 0:t.workspacePath)??""}}),[e,n]=r.useState(null),[p,w]=r.useState([]),[s,c]=r.useState(""),l=f(t=>t.skin);r.useEffect(()=>{document.documentElement.setAttribute("data-skin",l)},[l]),r.useEffect(()=>{document.title=e!=null&&e.title?`${e.title} · AgentRoam`:"新建会话 · AgentRoam"},[e==null?void 0:e.title]),r.useEffect(()=>{let t=!0;return j.getState().loadFromSystem(),window.agentApi.getRuntimeHealth().then(o=>{t&&w(o)}).catch(()=>{}),()=>{t=!1}},[]);const d=async(t,o)=>{if(o){n(o);return}try{const S=await window.agentApi.getSession(t,{limit:1,view:"core"});n(S),c("")}catch{c("无法打开会话,请重试")}};return a.jsxs("main",{className:"new-session-window","aria-label":"会话小窗",children:[a.jsx(v,{viewedSessionId:(e==null?void 0:e.id)??null}),s&&a.jsx("div",{className:"new-session-window-error",role:"alert",children:s}),a.jsx(x,{draft:e?void 0:i,onDraftChange:u,children:a.jsx(k,{agentStore:m,desktopTaskPane:!0,activeAgentType:(e==null?void 0:e.agentType)??i.agentType,selectedProjectId:(e==null?void 0:e.projectId)??i.projectId,selectedSessionId:(e==null?void 0:e.id)??null,sessionSummary:e??void 0,sessionTitle:(e==null?void 0:e.title)??"新建会话",paneControls:a.jsx("button",{type:"button",className:"ui-icon-button new-session-window-close","aria-label":"关闭会话小窗",title:"关闭会话小窗",onClick:()=>window.close(),children:a.jsx(y,{size:17,"aria-hidden":"true"})}),workspacePath:(e==null?void 0:e.cwd)??i.cwd,runtimeHealth:p,focusComposerNonce:1,sessionCreationPending:!e&&!i.projectId,onSessionCreated:(t,o)=>d(t,o),onSelectSession:(t,o)=>{d(t,o)},onParallelSessionSelected:t=>{n(t)}})})]})}export{J as default};
1
+ import{r,u as f,j as a}from"./index-D1AQffdA.js";import{c as g,r as h,u as j,S as v,T as x,C as k}from"./new-session-window-BFILhYAe.js";import{X as y}from"./x-uSekqXJV.js";import"./artifact-links-B0ApmgK6.js";import"./composer-file-routing-BtvXnu_o.js";import"./loader-circle-xEKTnlp3.js";import"./RemoteDesktopTabBridge-BF1dFltY.js";import"./check-D-yTByNl.js";import"./RunningSessionsIcon-D6rY-IzV.js";import"./trash-2-BF9eI5Bh.js";import"./download-B2jLl85N.js";import"./file-types-BZ8YZAV-.js";import"./list-todo-CP9DqU2D.js";import"./chevron-right-DKsui_wS.js";import"./chevron-down-hiPnZS_M.js";import"./session-tree-CEy-pW8A.js";import"./zoom-out-B59mGU6c.js";import"./rotate-ccw-HY6j6nBt.js";import"./use-session-activity-Ceb8OBjB.js";import"./client-5Hu1eVTX.js";import"./HostProjectPicker--J4_JpSW.js";function J(){const[m]=r.useState(()=>g()),[i,u]=r.useState(()=>{const t=h(window.location.search);return{agentType:(t==null?void 0:t.agentType)??"customer-agent",projectId:null,cwd:(t==null?void 0:t.workspacePath)??""}}),[e,n]=r.useState(null),[p,w]=r.useState([]),[s,c]=r.useState(""),l=f(t=>t.skin);r.useEffect(()=>{document.documentElement.setAttribute("data-skin",l)},[l]),r.useEffect(()=>{document.title=e!=null&&e.title?`${e.title} · AgentRoam`:"新建会话 · AgentRoam"},[e==null?void 0:e.title]),r.useEffect(()=>{let t=!0;return j.getState().loadFromSystem(),window.agentApi.getRuntimeHealth().then(o=>{t&&w(o)}).catch(()=>{}),()=>{t=!1}},[]);const d=async(t,o)=>{if(o){n(o);return}try{const S=await window.agentApi.getSession(t,{limit:1,view:"core"});n(S),c("")}catch{c("无法打开会话,请重试")}};return a.jsxs("main",{className:"new-session-window","aria-label":"会话小窗",children:[a.jsx(v,{viewedSessionId:(e==null?void 0:e.id)??null}),s&&a.jsx("div",{className:"new-session-window-error",role:"alert",children:s}),a.jsx(x,{draft:e?void 0:i,onDraftChange:u,children:a.jsx(k,{agentStore:m,desktopTaskPane:!0,activeAgentType:(e==null?void 0:e.agentType)??i.agentType,selectedProjectId:(e==null?void 0:e.projectId)??i.projectId,selectedSessionId:(e==null?void 0:e.id)??null,sessionSummary:e??void 0,sessionTitle:(e==null?void 0:e.title)??"新建会话",paneControls:a.jsx("button",{type:"button",className:"ui-icon-button new-session-window-close","aria-label":"关闭会话小窗",title:"关闭会话小窗",onClick:()=>window.close(),children:a.jsx(y,{size:17,"aria-hidden":"true"})}),workspacePath:(e==null?void 0:e.cwd)??i.cwd,runtimeHealth:p,focusComposerNonce:1,sessionCreationPending:!e&&!i.projectId,onSessionCreated:(t,o)=>d(t,o),onSelectSession:(t,o)=>{d(t,o)},onParallelSessionSelected:t=>{n(t)}})})]})}export{J as default};
@@ -1 +1 @@
1
- import{r as t,u as r,j as u}from"./index-CrjQF-VW.js";import l from"./BrowserLivePanel-BgftwEHQ.js";import{R as f,a as d,b as w,r as g}from"./RemoteDesktopTabBridge-tJcxPHnZ.js";import"./loader-circle-BSDHoDXf.js";import"./chevron-down-FeW7FcBS.js";import"./zoom-out-417ojKB8.js";import"./rotate-ccw-DtSpwbK7.js";import"./x-3I6TKNBE.js";function v(){const[s,n]=t.useState(!1),[c,i]=t.useState(!1),[a,m]=t.useState(r.getState().skin);t.useEffect(()=>r.subscribe(e=>m(e.skin)),[]),t.useEffect(()=>{document.documentElement.dataset.skin=a,document.body.dataset.remoteDesktop="1"},[a]),t.useEffect(()=>{const e=E=>{const o=g(E,location.origin,window.parent);o!==null&&(n(o),o&&i(!0))};return window.addEventListener("message",e),()=>window.removeEventListener("message",e)},[]),t.useEffect(()=>{if(!s)return;const e=requestAnimationFrame(()=>{window.parent.postMessage({type:f},location.origin)});return()=>cancelAnimationFrame(e)},[s]);const p=t.useCallback(e=>{window.parent.postMessage({type:d,fullscreen:e},location.origin)},[]);return u.jsx(l,{onFullscreenChange:p,open:c,active:s,onClose:()=>{i(!1),n(!1),window.parent.postMessage({type:w},location.origin)}})}export{v as default};
1
+ import{r as t,u as r,j as u}from"./index-D1AQffdA.js";import l from"./BrowserLivePanel-DxjgVXXK.js";import{R as f,a as d,b as w,r as g}from"./RemoteDesktopTabBridge-BF1dFltY.js";import"./loader-circle-xEKTnlp3.js";import"./chevron-down-hiPnZS_M.js";import"./zoom-out-B59mGU6c.js";import"./rotate-ccw-HY6j6nBt.js";import"./x-uSekqXJV.js";function v(){const[s,n]=t.useState(!1),[c,i]=t.useState(!1),[a,m]=t.useState(r.getState().skin);t.useEffect(()=>r.subscribe(e=>m(e.skin)),[]),t.useEffect(()=>{document.documentElement.dataset.skin=a,document.body.dataset.remoteDesktop="1"},[a]),t.useEffect(()=>{const e=E=>{const o=g(E,location.origin,window.parent);o!==null&&(n(o),o&&i(!0))};return window.addEventListener("message",e),()=>window.removeEventListener("message",e)},[]),t.useEffect(()=>{if(!s)return;const e=requestAnimationFrame(()=>{window.parent.postMessage({type:f},location.origin)});return()=>cancelAnimationFrame(e)},[s]);const p=t.useCallback(e=>{window.parent.postMessage({type:d,fullscreen:e},location.origin)},[]);return u.jsx(l,{onFullscreenChange:p,open:c,active:s,onClose:()=>{i(!1),n(!1),window.parent.postMessage({type:w},location.origin)}})}export{v as default};
@@ -1,4 +1,4 @@
1
- import{c as a}from"./index-CrjQF-VW.js";/**
1
+ import{c as a}from"./index-D1AQffdA.js";/**
2
2
  * @license lucide-react v0.468.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as e}from"./index-CrjQF-VW.js";/**
1
+ import{c as e}from"./index-D1AQffdA.js";/**
2
2
  * @license lucide-react v0.468.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as R,r as u,a as M,j as s,n as O,t as S,u as I,R as P,h as U,k as A}from"./index-CrjQF-VW.js";import{b as G}from"./SessionDashboardBridge-Cw8Y0s5_.js";import{p as y,L as q,D as $}from"./session-dashboard-7G2sKgmw.js";import{A as N,S as B}from"./session-tree-Ck5Wp7h-.js";import{c as k,A as v,D as _}from"./client-ZvcI0WiM.js";import{u as V,a as X,P as Y}from"./use-session-activity-B9xAOlzA.js";import{U as C}from"./collaboration-CeiB1Ihl.js";import{X as H}from"./x-3I6TKNBE.js";import{C as z}from"./chevron-down-FeW7FcBS.js";import{S as F}from"./shield-check-BIxrmOwR.js";import{P as J}from"./pause-BF1q8wFt.js";/**
1
+ import{c as R,r as u,a as M,j as s,n as O,t as S,u as I,R as P,h as U,k as A}from"./index-D1AQffdA.js";import{b as G}from"./SessionDashboardBridge-AhmhQ1Xn.js";import{p as y,L as q,D as $}from"./session-dashboard-B4lyuZYF.js";import{A as N,S as B}from"./session-tree-CEy-pW8A.js";import{c as k,A as v,D as _}from"./client-5Hu1eVTX.js";import{u as V,a as X,P as Y}from"./use-session-activity-Ceb8OBjB.js";import{U as C}from"./collaboration-DRFqpcAz.js";import{X as H}from"./x-uSekqXJV.js";import{C as z}from"./chevron-down-hiPnZS_M.js";import{S as F}from"./shield-check-CFebh9do.js";import{P as J}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.
@@ -1 +1 @@
1
- import{i as d}from"./index-CrjQF-VW.js";const n="agentroam:session-dashboard-navigate:v1",p="agentroam:session-dashboard-ready:v1",c="agentroam:session-dashboard-chat-ready:v1",l="agentroam:session-dashboard-applied:v1",a=o=>typeof o=="string"&&/^[\w-]{1,200}$/.test(o);function I(o,r,i){var t;if(!i||o.source!==i||o.origin!==r||((t=o.data)==null?void 0:t.type)!==n)return null;const s=o.data.intent;if(!s)return null;if(s.kind==="dashboard"||s.kind==="groups"||s.kind==="new-session")return{kind:s.kind};if(s.kind==="agent"&&d(s.agentType))return{kind:"agent",agentType:s.agentType};if(s.kind==="group"&&a(s.groupId)&&typeof s.title=="string"&&s.title.length>0&&s.title.length<=100&&(s.discussionId===void 0||a(s.discussionId)))return{kind:"group",groupId:s.groupId,title:s.title,...s.discussionId?{discussionId:s.discussionId}:{}};if(s.kind==="session"&&s.session&&typeof s.session=="object"){const e=s.session;if(typeof e.id=="string"&&e.id.length>0&&e.id.length<=400&&d(e.agentType)&&typeof e.title=="string"&&e.title.length<=1e3&&typeof e.cwd=="string"&&e.cwd.length<=4e3&&(e.projectId===void 0||typeof e.projectId=="string"&&e.projectId.length<=400))return{kind:"session",session:{id:e.id,agentType:e.agentType,title:e.title,cwd:e.cwd,...e.projectId?{projectId:e.projectId}:{}}}}return null}function u(o){document.body.dataset.agentroamChatNavigation==="ready"?window.dispatchEvent(new CustomEvent(n,{detail:o})):window.parent!==window?window.parent.postMessage({type:n,intent:o},window.location.origin):o.kind==="group"?location.assign(`?view=collaboration&groupId=${encodeURIComponent(o.groupId)}${o.discussionId?`&discussionId=${encodeURIComponent(o.discussionId)}`:""}`):o.kind==="groups"?location.assign("?view=collaboration-dashboard"):o.kind==="dashboard"?location.assign("?view=session-dashboard"):o.kind==="agent"?location.assign(`?agent=${encodeURIComponent(o.agentType)}`):o.kind==="new-session"?location.assign("/app/?newSession=1"):location.assign(`?agent=${encodeURIComponent(o.session.agentType)}&session=${encodeURIComponent(o.session.id)}`)}export{l as S,c as a,p as b,n as c,u as p,I as r};
1
+ import{i as d}from"./index-D1AQffdA.js";const n="agentroam:session-dashboard-navigate:v1",p="agentroam:session-dashboard-ready:v1",c="agentroam:session-dashboard-chat-ready:v1",l="agentroam:session-dashboard-applied:v1",a=o=>typeof o=="string"&&/^[\w-]{1,200}$/.test(o);function I(o,r,i){var t;if(!i||o.source!==i||o.origin!==r||((t=o.data)==null?void 0:t.type)!==n)return null;const s=o.data.intent;if(!s)return null;if(s.kind==="dashboard"||s.kind==="groups"||s.kind==="new-session")return{kind:s.kind};if(s.kind==="agent"&&d(s.agentType))return{kind:"agent",agentType:s.agentType};if(s.kind==="group"&&a(s.groupId)&&typeof s.title=="string"&&s.title.length>0&&s.title.length<=100&&(s.discussionId===void 0||a(s.discussionId)))return{kind:"group",groupId:s.groupId,title:s.title,...s.discussionId?{discussionId:s.discussionId}:{}};if(s.kind==="session"&&s.session&&typeof s.session=="object"){const e=s.session;if(typeof e.id=="string"&&e.id.length>0&&e.id.length<=400&&d(e.agentType)&&typeof e.title=="string"&&e.title.length<=1e3&&typeof e.cwd=="string"&&e.cwd.length<=4e3&&(e.projectId===void 0||typeof e.projectId=="string"&&e.projectId.length<=400))return{kind:"session",session:{id:e.id,agentType:e.agentType,title:e.title,cwd:e.cwd,...e.projectId?{projectId:e.projectId}:{}}}}return null}function u(o){document.body.dataset.agentroamChatNavigation==="ready"?window.dispatchEvent(new CustomEvent(n,{detail:o})):window.parent!==window?window.parent.postMessage({type:n,intent:o},window.location.origin):o.kind==="group"?location.assign(`?view=collaboration&groupId=${encodeURIComponent(o.groupId)}${o.discussionId?`&discussionId=${encodeURIComponent(o.discussionId)}`:""}`):o.kind==="groups"?location.assign("?view=collaboration-dashboard"):o.kind==="dashboard"?location.assign("?view=session-dashboard"):o.kind==="agent"?location.assign(`?agent=${encodeURIComponent(o.agentType)}`):o.kind==="new-session"?location.assign("/app/?newSession=1"):location.assign(`?agent=${encodeURIComponent(o.session.agentType)}&session=${encodeURIComponent(o.session.id)}`)}export{l as S,c as a,p as b,n as c,u as p,I as r};