agentroam-runtime-darwin-arm64 0.2.0-preview.73 → 0.2.0-preview.75

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 (268) hide show
  1. package/manifest.json +2 -3
  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 +5 -5
  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 +2 -2
  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 +3 -0
  28. package/runtime/.next/server/app/api/calendar/route.js.nft.json +1 -0
  29. package/runtime/.next/server/app/api/client-logs/route.js +1 -1
  30. package/runtime/.next/server/app/api/collaboration/route.js +2 -2
  31. package/runtime/.next/server/app/api/engine-threads/route.js +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/mcp/connect/route.js +1 -1
  38. package/runtime/.next/server/app/api/mcp/disconnect/route.js +1 -1
  39. package/runtime/.next/server/app/api/mcp/servers/route.js +1 -1
  40. package/runtime/.next/server/app/api/memory/[key]/route.js +1 -1
  41. package/runtime/.next/server/app/api/memory/route.js +1 -1
  42. package/runtime/.next/server/app/api/messaging/route.js +1 -1
  43. package/runtime/.next/server/app/api/plugins/load/route.js +1 -1
  44. package/runtime/.next/server/app/api/projects/[id]/route.js +1 -1
  45. package/runtime/.next/server/app/api/projects/check/route.js +1 -1
  46. package/runtime/.next/server/app/api/projects/directories/route.js +1 -1
  47. package/runtime/.next/server/app/api/projects/roots/route.js +1 -1
  48. package/runtime/.next/server/app/api/projects/route.js +1 -1
  49. package/runtime/.next/server/app/api/push/subscribe/route.js +2 -2
  50. package/runtime/.next/server/app/api/push/unsubscribe/route.js +2 -2
  51. package/runtime/.next/server/app/api/push/vapid/route.js +2 -2
  52. package/runtime/.next/server/app/api/push/vapid.body +1 -1
  53. package/runtime/.next/server/app/api/remote-tools/register/route.js +1 -1
  54. package/runtime/.next/server/app/api/sessions/[id]/background-jobs/[jobId]/route.js +1 -1
  55. package/runtime/.next/server/app/api/sessions/[id]/background-jobs/[jobId]/stop/route.js +1 -1
  56. package/runtime/.next/server/app/api/sessions/[id]/background-jobs/route.js +1 -1
  57. package/runtime/.next/server/app/api/sessions/[id]/changes/route.js +2 -2
  58. package/runtime/.next/server/app/api/sessions/[id]/engine-switches/route.js +1 -1
  59. package/runtime/.next/server/app/api/sessions/[id]/fork/route.js +1 -1
  60. package/runtime/.next/server/app/api/sessions/[id]/fork-at/route.js +1 -1
  61. package/runtime/.next/server/app/api/sessions/[id]/goals/route.js +1 -1
  62. package/runtime/.next/server/app/api/sessions/[id]/handoff/route.js +1 -1
  63. package/runtime/.next/server/app/api/sessions/[id]/native-goal/route.js +1 -1
  64. package/runtime/.next/server/app/api/sessions/[id]/query-index/route.js +1 -1
  65. package/runtime/.next/server/app/api/sessions/[id]/release/route.js +1 -1
  66. package/runtime/.next/server/app/api/sessions/[id]/route.js +1 -1
  67. package/runtime/.next/server/app/api/sessions/[id]/switch-engine/route.js +1 -1
  68. package/runtime/.next/server/app/api/sessions/[id]/thread-goal/route.js +1 -1
  69. package/runtime/.next/server/app/api/sessions/[id]/thread-history/route.js +1 -1
  70. package/runtime/.next/server/app/api/sessions/[id]/tool-result/route.js +1 -1
  71. package/runtime/.next/server/app/api/sessions/parallel/route.js +1 -1
  72. package/runtime/.next/server/app/api/sessions/route.js +1 -1
  73. package/runtime/.next/server/app/api/settings/route.js +1 -1
  74. package/runtime/.next/server/app/api/skills/route.js +1 -1
  75. package/runtime/.next/server/app/api/tool-policies/[policyId]/route.js +1 -1
  76. package/runtime/.next/server/app/api/tool-policies/route.js +1 -1
  77. package/runtime/.next/server/app/api/tools/route.js +1 -1
  78. package/runtime/.next/server/app/api/update/check/route.js +1 -1
  79. package/runtime/.next/server/app/api/update/install/route.js +1 -1
  80. package/runtime/.next/server/app/api/update/status/route.js +1 -1
  81. package/runtime/.next/server/app/api/web-auth/login/route.js +1 -1
  82. package/runtime/.next/server/app/api/web-auth/logout/route.js +1 -1
  83. package/runtime/.next/server/app/api/web-auth/revoke-all/route.js +1 -1
  84. package/runtime/.next/server/app/api/web-auth/setup/route.js +1 -1
  85. package/runtime/.next/server/app/api/web-auth/status/route.js +1 -1
  86. package/runtime/.next/server/app/api/web-console/bootstrap/route.js +1 -1
  87. package/runtime/.next/server/app/api/web-console/computer-settings/route.js +1 -1
  88. package/runtime/.next/server/app/api/web-console/computers/route.js +1 -1
  89. package/runtime/.next/server/app/api/web-console/device-state/route.js +1 -1
  90. package/runtime/.next/server/app/api/web-console/history/route.js +1 -1
  91. package/runtime/.next/server/app/api/web-console/preferences/route.js +1 -1
  92. package/runtime/.next/server/app/web/page.js +2 -2
  93. package/runtime/.next/server/app/web/page_client-reference-manifest.js +1 -1
  94. package/runtime/.next/server/app-paths-manifest.json +37 -36
  95. package/runtime/.next/server/chunks/5303.js +1 -1
  96. package/runtime/.next/server/middleware-build-manifest.js +1 -1
  97. package/runtime/.next/server/pages/404.html +1 -1
  98. package/runtime/.next/server/pages/500.html +1 -1
  99. package/runtime/.next/server/server-reference-manifest.json +1 -1
  100. package/runtime/.next/static/chunks/app/web/{error-077f54cd48d5a6c2.js → error-3cae58f0f14f0b4f.js} +1 -1
  101. package/runtime/.next/static/chunks/app/web/layout-d5d7d1c5c74eef3c.js +1 -0
  102. package/runtime/.next/static/chunks/app/web/page-7afa4cb0119e90b7.js +1 -0
  103. package/runtime/.next/static/chunks/{main-app-20135c1d85680f16.js → main-app-7a6902a607752446.js} +1 -1
  104. package/runtime/.next/static/chunks/{main-93c452d518291b1c.js → main-d8ef9def37924b01.js} +1 -1
  105. package/runtime/lib/device-pairing-gateway.mjs +6 -1
  106. package/runtime/native/Support.noindex/AgentRoam Remote Desktop.app/Contents/MacOS/agentroam-remote-desktop +0 -0
  107. package/runtime/native/Support.noindex/AgentRoam Remote Desktop.app/Contents/Resources/agentroam-component.json +1 -1
  108. package/runtime/native/Support.noindex/AgentRoam Remote Desktop.app/Contents/_CodeSignature/CodeResources +2 -2
  109. package/runtime/node_modules/.package-lock.json +125 -125
  110. package/runtime/node_modules/@agent/core/dist/index.js +86 -9
  111. package/runtime/node_modules/@agent/native-runtime/dist/index.js +49 -19
  112. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/README.md +1 -1
  113. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/bridge.mjs +96 -96
  114. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/browser-sdk.js +73 -71
  115. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-2h2qc9qv.mjs +18 -0
  116. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-9sxfsmzx.mjs +18 -0
  117. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-zg882d22.mjs → core-ba5rrckm.mjs} +2 -2
  118. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-dnsvg8nc.mjs +53 -0
  119. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-9je8ee1j.mjs → core-h6r54bwv.mjs} +2 -2
  120. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-k67vj6j9.mjs +20 -0
  121. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-qbjntcdf.mjs +18 -0
  122. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-qj4dtgyt.mjs +17 -0
  123. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-rn7tc54w.mjs +17 -0
  124. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-sstebd83.mjs +18 -0
  125. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-td7rt8zt.mjs +17 -0
  126. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-x3hc9abc.mjs → core-tf03rfab.mjs} +3 -3
  127. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-x4kwpwv9.mjs +16 -0
  128. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-y6bhrwmk.mjs +47 -0
  129. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-fxa8mwbm.mjs → core-ya1m7gzj.mjs} +3 -3
  130. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core.mjs +11 -11
  131. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/manifest.json +21 -21
  132. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/manifest.zst.json +25 -25
  133. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/package.json +25 -21
  134. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs +88 -85
  135. package/runtime/package-lock.json +182 -158
  136. package/runtime/server.js +1 -1
  137. package/runtime/webapp/dist/assets/{AIHubView-BQKD1oRa.js → AIHubView-BMeOfqfm.js} +1 -1
  138. package/runtime/webapp/dist/assets/{AgentManager-eTCpLsYc.js → AgentManager-CrN2B-tH.js} +1 -1
  139. package/runtime/webapp/dist/assets/{AiHubPane-LnfAKHOH.js → AiHubPane-Du6ajSsx.js} +1 -1
  140. package/runtime/webapp/dist/assets/App-zihaYk1L.js +179 -0
  141. package/runtime/webapp/dist/assets/{BrowserLivePanel-BvXuMltx.js → BrowserLivePanel-CU_X6OU2.js} +1 -1
  142. package/runtime/webapp/dist/assets/{CollaborationCreateDialog-0xwWJVAB.js → CollaborationCreateDialog-BmgYdwe7.js} +1 -1
  143. package/runtime/webapp/dist/assets/{CollaborationDashboard-CDuqbRZZ.js → CollaborationDashboard-mHU8iJYg.js} +1 -1
  144. package/runtime/webapp/dist/assets/{CollaborationPage-BLv1g5Ke.js → CollaborationPage-Br5fhNce.js} +1 -1
  145. package/runtime/webapp/dist/assets/{FilePreview-DIsjFx4f.js → FilePreview-CevPpP6E.js} +3 -3
  146. package/runtime/webapp/dist/assets/{FileTree-BJe67ELr.js → FileTree-CagcHV1N.js} +1 -1
  147. package/runtime/webapp/dist/assets/{FileWorkspaceDrawer-PtNe21oN.js → FileWorkspaceDrawer-CWVndCXp.js} +1 -1
  148. package/runtime/webapp/dist/assets/{FlowStudioPane-DGv9czqf.js → FlowStudioPane-BZA-qvBj.js} +1 -1
  149. package/runtime/webapp/dist/assets/{LSPServerList-DZkbA5NX.js → LSPServerList-BMY6dFfG.js} +1 -1
  150. package/runtime/webapp/dist/assets/{MCPServerList-DLJUT0j8.js → MCPServerList-c91QNM-g.js} +1 -1
  151. package/runtime/webapp/dist/assets/{MemoryViewer-B4synV6O.js → MemoryViewer-C9IfWwzW.js} +1 -1
  152. package/runtime/webapp/dist/assets/{RemoteDesktopPage-Db8WVCjo.js → RemoteDesktopPage-w8aL061W.js} +1 -1
  153. package/runtime/webapp/dist/assets/{RunningSessionsIcon-DRhO-CVq.js → RunningSessionsIcon-B8Cr2-hp.js} +1 -1
  154. package/runtime/webapp/dist/assets/{SessionDashboard-C6En31sg.js → SessionDashboard-CFXXTm_4.js} +1 -1
  155. package/runtime/webapp/dist/assets/{SessionDashboardBridge--lNIU1u6.js → SessionDashboardBridge-Bx4EXtos.js} +1 -1
  156. package/runtime/webapp/dist/assets/{SettingsPanel-mJ5Ggwlp.js → SettingsPanel-CS4XL2sd.js} +1 -1
  157. package/runtime/webapp/dist/assets/{SkillManager-C_mt62Rc.js → SkillManager-5FZnR9My.js} +1 -1
  158. package/runtime/webapp/dist/assets/{TerminalPane-D121NsSc.js → TerminalPane-CRrbd0i4.js} +1 -1
  159. package/runtime/webapp/dist/assets/{abnfDiagram-VCTEODGH-CSTtPfA-.js → abnfDiagram-VCTEODGH-DBioGYiE.js} +1 -1
  160. package/runtime/webapp/dist/assets/{arc-pE43fNGK.js → arc-BRj_RXHL.js} +1 -1
  161. package/runtime/webapp/dist/assets/{architectureDiagram-5GKGNRK7-BlExjf1L.js → architectureDiagram-5GKGNRK7-CoCdq67U.js} +1 -1
  162. package/runtime/webapp/dist/assets/{arrow-right-CED95s1t.js → arrow-right-Cqqb1zqH.js} +1 -1
  163. package/runtime/webapp/dist/assets/{artifact-links-BWD7xpfV.js → artifact-links-73OZyi5W.js} +1 -1
  164. package/runtime/webapp/dist/assets/{blockDiagram-I7D4REHJ-4pzU0s_A.js → blockDiagram-I7D4REHJ-CLisIPjq.js} +1 -1
  165. package/runtime/webapp/dist/assets/{c4Diagram-7LVT6UL2-DBoJHf0c.js → c4Diagram-7LVT6UL2-BoLCIVW8.js} +1 -1
  166. package/runtime/webapp/dist/assets/channel-JGVZzkSo.js +1 -0
  167. package/runtime/webapp/dist/assets/{chevron-down-DuxUTH_N.js → chevron-down-DhZV290h.js} +1 -1
  168. package/runtime/webapp/dist/assets/{chunk-2Q5K7J3B-Bu1Sc-w9.js → chunk-2Q5K7J3B-CIQxwzU0.js} +1 -1
  169. package/runtime/webapp/dist/assets/{chunk-5VM5RSS4-COwAF0w2.js → chunk-5VM5RSS4-Buiv0MCN.js} +1 -1
  170. package/runtime/webapp/dist/assets/{chunk-F27PBJKO-FLl8DRP2.js → chunk-F27PBJKO-XBMwIl6X.js} +1 -1
  171. package/runtime/webapp/dist/assets/{chunk-IMKFNOWR-BL8M_b-w.js → chunk-IMKFNOWR-C0NrkJOc.js} +1 -1
  172. package/runtime/webapp/dist/assets/{chunk-JWPE2WC7-Bm0OpXaO.js → chunk-JWPE2WC7-CGON_UvB.js} +1 -1
  173. package/runtime/webapp/dist/assets/{chunk-POPQ4Y6H-Be_mjw7_.js → chunk-POPQ4Y6H-BXvOsc9g.js} +1 -1
  174. package/runtime/webapp/dist/assets/{chunk-SVP7TREG-Dijp9l1U.js → chunk-SVP7TREG-ZD_qn-NK.js} +1 -1
  175. package/runtime/webapp/dist/assets/{chunk-TICWLB2K-CJDtjon2.js → chunk-TICWLB2K-DrB8f6RG.js} +1 -1
  176. package/runtime/webapp/dist/assets/{chunk-XXDRQBXY-BLWOMtvS.js → chunk-XXDRQBXY-CYgLMn5t.js} +1 -1
  177. package/runtime/webapp/dist/assets/classDiagram-ZZMXUADV-BnctJ00R.js +1 -0
  178. package/runtime/webapp/dist/assets/classDiagram-v2-VYDZK3BY-BnctJ00R.js +1 -0
  179. package/runtime/webapp/dist/assets/{codeSyntax-BnmCqa8x.js → codeSyntax-DfQ5rLir.js} +1 -1
  180. package/runtime/webapp/dist/assets/{collaboration-B0sTZDns.js → collaboration-CQhzjwS_.js} +1 -1
  181. package/runtime/webapp/dist/assets/{composer-file-routing-BrWLenKF.js → composer-file-routing-D9orqwzY.js} +1 -1
  182. package/runtime/webapp/dist/assets/{cose-bilkent-JH36ORCC-cA67vOKJ.js → cose-bilkent-JH36ORCC-CDPnTlcy.js} +1 -1
  183. package/runtime/webapp/dist/assets/{cynefin-OW5HDTMX-BPeSii-l.js → cynefin-OW5HDTMX-DDCxhkA5.js} +1 -1
  184. package/runtime/webapp/dist/assets/{cynefinDiagram-5FMLGOSQ-B9f094pg.js → cynefinDiagram-5FMLGOSQ-CIJ1KBPA.js} +1 -1
  185. package/runtime/webapp/dist/assets/{dagre-GXQ25YYZ-C_xejuzH.js → dagre-GXQ25YYZ-CFX8O3IJ.js} +1 -1
  186. package/runtime/webapp/dist/assets/{diagram-S7CK7UJ4-0f77MjI_.js → diagram-S7CK7UJ4-B8UX2IBH.js} +1 -1
  187. package/runtime/webapp/dist/assets/{diagram-UQ7AKVKN-B7qqB6UY.js → diagram-UQ7AKVKN-Ce34DNrv.js} +1 -1
  188. package/runtime/webapp/dist/assets/{diagram-VSXAHHWV-eS0I06tX.js → diagram-VSXAHHWV-CVL_erWD.js} +1 -1
  189. package/runtime/webapp/dist/assets/{diagram-VX7I27RA-BzaPvwZL.js → diagram-VX7I27RA-DBFHI7Dk.js} +1 -1
  190. package/runtime/webapp/dist/assets/{diagram-Z3DM3KII-C_EAUyuK.js → diagram-Z3DM3KII-Bw_QcSQY.js} +1 -1
  191. package/runtime/webapp/dist/assets/{download-DNa5KRtu.js → download-D3xZPWnZ.js} +1 -1
  192. package/runtime/webapp/dist/assets/{ebnfDiagram-PWID7BFC-CpSazgmq.js → ebnfDiagram-PWID7BFC-DRly04dj.js} +1 -1
  193. package/runtime/webapp/dist/assets/{erDiagram-RLTQ6QDP-BbAq4dnX.js → erDiagram-RLTQ6QDP-DTm817hG.js} +1 -1
  194. package/runtime/webapp/dist/assets/{external-link-D0ZU8y72.js → external-link-Cwu5rEgp.js} +1 -1
  195. package/runtime/webapp/dist/assets/{file-types-Bv8xIlsm.js → file-types-DKkhMnUV.js} +1 -1
  196. package/runtime/webapp/dist/assets/{flowDiagram-HODETNUW-FxtiM8S_.js → flowDiagram-HODETNUW-tc8ygZtG.js} +1 -1
  197. package/runtime/webapp/dist/assets/{ganttDiagram-EL5Y4UJY-vbQAmYA_.js → ganttDiagram-EL5Y4UJY-CsQFf1IN.js} +1 -1
  198. package/runtime/webapp/dist/assets/{gitGraphDiagram-WWUBYQGX-CoH-vS6p.js → gitGraphDiagram-WWUBYQGX-DAIxbmPX.js} +1 -1
  199. package/runtime/webapp/dist/assets/{image-plus-CMQPwQ1a.js → image-plus-nplydLA5.js} +1 -1
  200. package/runtime/webapp/dist/assets/index-B-d1Vs9E.css +1 -0
  201. package/runtime/webapp/dist/assets/{index-B_qrzBSm.js → index-DKm9ESDq.js} +50 -50
  202. package/runtime/webapp/dist/assets/{infoDiagram-27XIBGKW-BhQjKjwI.js → infoDiagram-27XIBGKW-CVcMW4UM.js} +1 -1
  203. package/runtime/webapp/dist/assets/{ishikawaDiagram-5VMMS53U-Do6164Lq.js → ishikawaDiagram-5VMMS53U-zzlEtZ1l.js} +1 -1
  204. package/runtime/webapp/dist/assets/{journeyDiagram-3NMN7TZE-DU9terNG.js → journeyDiagram-3NMN7TZE-q7NuIMSl.js} +1 -1
  205. package/runtime/webapp/dist/assets/{kanban-definition-UXKFOSKX-PIi78bMz.js → kanban-definition-UXKFOSKX-DLYFZlKO.js} +1 -1
  206. package/runtime/webapp/dist/assets/{layout-kIcBLq12.js → layout-PFWssIkE.js} +1 -1
  207. package/runtime/webapp/dist/assets/{linear-DuoGw6Ne.js → linear-ZRVcojb1.js} +1 -1
  208. package/runtime/webapp/dist/assets/{loader-circle-CkN6rr8Q.js → loader-circle-DIW9tlEz.js} +1 -1
  209. package/runtime/webapp/dist/assets/{mermaid.core-CMSVAwDO.js → mermaid.core-C8Dl0Nah.js} +5 -5
  210. package/runtime/webapp/dist/assets/{mindmap-definition-YA3MSWOX-BqXezPt8.js → mindmap-definition-YA3MSWOX-BcbqtwVk.js} +1 -1
  211. package/runtime/webapp/dist/assets/{page-BJynASYd.js → page-BG97oPXr.js} +4 -4
  212. package/runtime/webapp/dist/assets/{pegDiagram-XKGWAZYB-CfhSiKuL.js → pegDiagram-XKGWAZYB-BQN3zQuy.js} +1 -1
  213. package/runtime/webapp/dist/assets/{pieDiagram-E7YTZNPT-D6dTu0HJ.js → pieDiagram-E7YTZNPT-pOgxh3os.js} +1 -1
  214. package/runtime/webapp/dist/assets/{quadrantDiagram-AXDQQJYC-B6Nk3my2.js → quadrantDiagram-AXDQQJYC-BOg7ujzG.js} +1 -1
  215. package/runtime/webapp/dist/assets/{railroadDiagram-O6MQD6OU-9HdWlkSi.js → railroadDiagram-O6MQD6OU-CWsN3juJ.js} +1 -1
  216. package/runtime/webapp/dist/assets/{requirementDiagram-BXWQKSXE-CJ72A4ch.js → requirementDiagram-BXWQKSXE-B0yrO7Oy.js} +1 -1
  217. package/runtime/webapp/dist/assets/{rotate-ccw-CFOlggPt.js → rotate-ccw-O4wnfQP7.js} +1 -1
  218. package/runtime/webapp/dist/assets/{rotate-cw-CV6TU7ho.js → rotate-cw-CCJtlAtB.js} +1 -1
  219. package/runtime/webapp/dist/assets/{sankeyDiagram-P5KCCOFB-B0k_-2GA.js → sankeyDiagram-P5KCCOFB-5MS_e-3E.js} +1 -1
  220. package/runtime/webapp/dist/assets/{send-Br8F4frT.js → send-Cdg4ZVlp.js} +1 -1
  221. package/runtime/webapp/dist/assets/{sequenceDiagram-WJ2MYXX4-D-Vubzl4.js → sequenceDiagram-WJ2MYXX4-C1w8qYSu.js} +1 -1
  222. package/runtime/webapp/dist/assets/{session-dashboard-B_G9IZRa.js → session-dashboard-BigU92sz.js} +1 -1
  223. package/runtime/webapp/dist/assets/{shield-check-C_XCddHW.js → shield-check-CrjI2wPR.js} +1 -1
  224. package/runtime/webapp/dist/assets/{sizeCapture-INFHLROL-CDLZ64va.js → sizeCapture-INFHLROL-BonKTynC.js} +1 -1
  225. package/runtime/webapp/dist/assets/{stateDiagram-D77RDMKH-D55B47_M.js → stateDiagram-D77RDMKH-D3mn6ZK5.js} +1 -1
  226. package/runtime/webapp/dist/assets/stateDiagram-v2-MP3YSRHH-WEfEW-mH.js +1 -0
  227. package/runtime/webapp/dist/assets/{swimlanes-42K2YHIH-FSX6VCzY.js → swimlanes-42K2YHIH-Bn9KWChU.js} +1 -1
  228. package/runtime/webapp/dist/assets/swimlanesDiagram-VR7AAH4N-D26_Nmko.js +8 -0
  229. package/runtime/webapp/dist/assets/{timeline-definition-24CTP7MA-DGmgxtYO.js → timeline-definition-24CTP7MA-BfuhI7EF.js} +1 -1
  230. package/runtime/webapp/dist/assets/{trash-2-Drt7yRIe.js → trash-2-BrfgMjfL.js} +1 -1
  231. package/runtime/webapp/dist/assets/{types-BOD4WqhS.js → types-VnQ_cKrp.js} +1 -1
  232. package/runtime/webapp/dist/assets/{vennDiagram-4TSXK5OY-XbldOddh.js → vennDiagram-4TSXK5OY-CUFs5JyR.js} +1 -1
  233. package/runtime/webapp/dist/assets/{wardleyDiagram-VM6X3IG4-DrGMS-oH.js → wardleyDiagram-VM6X3IG4-C27HHz1A.js} +1 -1
  234. package/runtime/webapp/dist/assets/{web-Crv8v2xB.js → web-BOzkL-0Z.js} +1 -1
  235. package/runtime/webapp/dist/assets/{web-DQg6oOed.js → web-CeCHmdwO.js} +1 -1
  236. package/runtime/webapp/dist/assets/{x-8eDWe1V2.js → x-DP1nC4qG.js} +1 -1
  237. package/runtime/webapp/dist/assets/{xychartDiagram-S5SC5T6Z-BClf-jGf.js → xychartDiagram-S5SC5T6Z-CQwRrSTf.js} +1 -1
  238. package/runtime/webapp/dist/assets/{zoom-out-CKWUyj9b.js → zoom-out-Dg7YyzcP.js} +1 -1
  239. package/runtime/webapp/dist/index.html +18 -3
  240. package/runtime/.next/static/chunks/app/web/layout-ebfc3a207c355453.js +0 -1
  241. package/runtime/.next/static/chunks/app/web/page-b456468be8e8e8fa.js +0 -1
  242. package/runtime/native/Support.noindex/WeComSendBridge.app/Contents/Info.plist +0 -13
  243. package/runtime/native/Support.noindex/WeComSendBridge.app/Contents/MacOS/NativeAXBridge +0 -0
  244. package/runtime/native/Support.noindex/WeComSendBridge.app/Contents/Resources/agentroam-component.json +0 -4
  245. package/runtime/native/Support.noindex/WeComSendBridge.app/Contents/_CodeSignature/CodeResources +0 -128
  246. package/runtime/node_modules/@agent/messaging/dist/assets/wecom/NativeAXBridge.swift +0 -240
  247. package/runtime/node_modules/@agent/messaging/dist/assets/wecom/codec.py +0 -133
  248. package/runtime/node_modules/@agent/messaging/dist/assets/wecom/native_sender.py +0 -445
  249. package/runtime/node_modules/@agent/messaging/dist/assets/wecom/reader.py +0 -479
  250. package/runtime/node_modules/@agent/messaging/dist/assets/wecom//351/235/231/346/200/201/350/265/204/346/226/231/350/257/273/345/217/226/350/257/264/346/230/216.md +0 -34
  251. package/runtime/node_modules/@agent/messaging/dist/index.js +0 -1219
  252. package/runtime/node_modules/@agent/messaging/package.json +0 -7
  253. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-0a66n3e7.mjs +0 -16
  254. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-0bmnpbz2.mjs +0 -45
  255. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-ds2jqcef.mjs +0 -19
  256. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-gbbw9cgm.mjs +0 -17
  257. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-msnqqcc2.mjs +0 -42
  258. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-wadgcjfh.mjs +0 -18
  259. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-x20yarwf.mjs +0 -17
  260. package/runtime/webapp/dist/assets/App-Cm4c_ukZ.js +0 -177
  261. package/runtime/webapp/dist/assets/channel-C029kbz3.js +0 -1
  262. package/runtime/webapp/dist/assets/classDiagram-ZZMXUADV-DjlcT9EO.js +0 -1
  263. package/runtime/webapp/dist/assets/classDiagram-v2-VYDZK3BY-DjlcT9EO.js +0 -1
  264. package/runtime/webapp/dist/assets/index-DFMBt4EW.css +0 -1
  265. package/runtime/webapp/dist/assets/stateDiagram-v2-MP3YSRHH-DhVWnu4U.js +0 -1
  266. package/runtime/webapp/dist/assets/swimlanesDiagram-VR7AAH4N-B677Rs5I.js +0 -8
  267. /package/runtime/.next/static/{fg72y0mrQ518VXPNOLU1t → xuZ1UJWVNJ-rxb5YgETmd}/_buildManifest.js +0 -0
  268. /package/runtime/.next/static/{fg72y0mrQ518VXPNOLU1t → xuZ1UJWVNJ-rxb5YgETmd}/_ssgManifest.js +0 -0
@@ -1,4 +1,4 @@
1
- var Ur=t=>{throw TypeError(t)};var xi=(t,e,r)=>e.has(t)||Ur("Cannot "+r);var Wr=(t,e,r)=>e.has(t)?Ur("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r);var Hr=(t,e,r)=>(xi(t,e,"access private method"),r);import{c as Te,j as u,r as h,B as Ci,d as ar,n as $r}from"./index-B_qrzBSm.js";import{L as Se}from"./loader-circle-CkN6rr8Q.js";import{C as Ri}from"./chevron-down-DuxUTH_N.js";import{r as Ei}from"./clipboard-BvwmdR4z.js";import{R as ji}from"./rotate-ccw-CFOlggPt.js";import{X as Mi}from"./x-8eDWe1V2.js";import{M as Kr,V as Si,Z as Ti,a as Ii}from"./zoom-out-CKWUyj9b.js";import{E as Di}from"./external-link-D0ZU8y72.js";/**
1
+ var Ur=t=>{throw TypeError(t)};var xi=(t,e,r)=>e.has(t)||Ur("Cannot "+r);var Wr=(t,e,r)=>e.has(t)?Ur("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r);var Hr=(t,e,r)=>(xi(t,e,"access private method"),r);import{c as Te,j as u,r as h,B as Ci,d as ar,n as $r}from"./index-DKm9ESDq.js";import{L as Se}from"./loader-circle-DIW9tlEz.js";import{C as Ri}from"./chevron-down-DhZV290h.js";import{r as Ei}from"./clipboard-BvwmdR4z.js";import{R as ji}from"./rotate-ccw-O4wnfQP7.js";import{X as Mi}from"./x-DP1nC4qG.js";import{M as Kr,V as Si,Z as Ti,a as Ii}from"./zoom-out-Dg7YyzcP.js";import{E as Di}from"./external-link-Cwu5rEgp.js";/**
2
2
  * @license lucide-react v0.468.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{r as c,d as Q,j as e,R as V,e as X,A as K,P as W,f as Y}from"./index-B_qrzBSm.js";import{C as Z,a as G}from"./types-BOD4WqhS.js";import{a as ee,D as te,P as ae,b as se,c as re,d as le,e as ne,N as oe,f as ce,g as ie,h as de,i as he,F as ue,j as pe,S as je}from"./file-types-Bv8xIlsm.js";import{X as B}from"./x-8eDWe1V2.js";import{A as xe,C as fe,F as ge}from"./trash-2-Drt7yRIe.js";import{c as U,A as O,U as me}from"./collaboration-B0sTZDns.js";import{C as _}from"./chevron-down-DuxUTH_N.js";const be={folder:{icon:ue,label:"文件夹"},code:{icon:he,label:"代码文件"},style:{icon:X,label:"样式文件"},image:{icon:de,label:"图片文件"},video:{icon:ie,label:"视频文件"},audio:{icon:ce,label:"音频文件"},markdown:{icon:oe,label:"Markdown 文件"},text:{icon:ne,label:"文本文件"},json:{icon:le,label:"JSON 文件"},archive:{icon:re,label:"压缩文件"},spreadsheet:{icon:se,label:"表格文件"},presentation:{icon:ae,label:"演示文件"},database:{icon:te,label:"数据库文件"},file:{icon:ee,label:"文件"}};function ve(t,s){return s==="directory"?"folder":pe(t)}const M=t=>t.replace(/\\/g,"/").replace(/\/+$/,"")||"/";function ye(t,s){for(const f of s){if(!(f!=null&&f.trim()))continue;const g=M(f);if(g.split("/").some(u=>u==="."||u===".."))continue;const m=t.map(M).filter(u=>g===u||g.startsWith(u==="/"?"/":`${u}/`)).sort((u,p)=>p.length-u.length)[0];if(m)return{root:m,current:g}}const o=t[0]?M(t[0]):"";return{root:o,current:o}}function Ne(t,s){const o=M(t),f=M(s),m=[{label:o==="/"?"/":o.split("/").filter(Boolean).pop()||o,path:o}];if(f===o)return m;const u=f.slice(o==="/"?1:o.length+1);let p=o;for(const d of u.split("/").filter(Boolean))p=p==="/"?`/${d}`:`${p}/${d}`,m.push({label:d,path:p});return m}function ke({open:t,initialPath:s,onCancel:o,onConfirm:f}){const[g,m]=c.useState([]),[u,p]=c.useState(""),[d,j]=c.useState(""),[w,l]=c.useState([]),[i,x]=c.useState(!1),[k,v]=c.useState(""),[a,h]=c.useState(!1),[C,y]=c.useState(!1),D=c.useMemo(()=>u&&d?Ne(u,d):[],[u,d]),S=async n=>{if(window.agentApi){x(!0),y(!1),v(""),j(n),l([]);try{const b=await window.agentApi.listProjectDirectories(n);l(b),y(!0)}catch(b){v(b instanceof Error?b.message:"无法读取目录")}finally{x(!1)}}};if(c.useEffect(()=>{if(!t||!window.agentApi)return;let n=!1;return x(!0),v(""),p(""),j(""),y(!1),l([]),window.agentApi.getProjectPickerLocation().then(async({roots:b,initialPath:E})=>{if(n)return;m(b);const T=ye(b,[s,E]);p(T.root),T.current?await S(T.current):v("未配置可用的宿主机目录")}).catch(b=>{n||v(b instanceof Error?b.message:"无法读取宿主机目录")}).finally(()=>{n||x(!1)}),()=>{n=!0}},[t,s]),c.useEffect(()=>{if(!t)return;const n=b=>{b.key==="Escape"&&o()};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[t,o]),!t)return null;const $=n=>{p(n),S(n)},I=()=>{D.length<=1||S(D[D.length-2].path)},z=async()=>{if(!(!d||!C||a)){h(!0),v("");try{await f(d)}catch(n){v(n instanceof Error?n.message:"项目导入失败")}finally{h(!1)}}};return Q.createPortal(e.jsx("div",{className:"host-project-picker-backdrop",role:"presentation",onMouseDown:n=>{n.target===n.currentTarget&&o()},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:o,"aria-label":"关闭目录选择器",title:"关闭",children:e.jsx(B,{size:16,"aria-hidden":"true"})})]}),g.length>1&&e.jsxs("label",{className:"host-project-picker-root",children:[e.jsx("span",{children:"根目录"}),e.jsx("select",{value:u,onChange:n=>$(n.target.value),children:g.map(n=>e.jsx("option",{value:n,children:n},n))})]}),e.jsxs("nav",{className:"host-project-picker-nav","aria-label":"当前目录",children:[e.jsx("button",{type:"button",className:"ui-icon-button",onClick:I,disabled:D.length<=1,"aria-label":"返回上级目录",title:"返回上级目录",children:e.jsx(xe,{size:16,"aria-hidden":"true"})}),e.jsxs("div",{className:"host-project-picker-breadcrumbs",children:[!d&&e.jsx("span",{children:i?"正在定位工作目录…":"未能加载工作目录"}),D.map((n,b)=>e.jsxs("span",{children:[b>0&&e.jsx("i",{children:"/"}),e.jsx("button",{type:"button",onClick:()=>void S(n.path),children:n.label})]},n.path))]}),e.jsx("button",{type:"button",className:"ui-icon-button",onClick:()=>d&&void S(d),disabled:!d||i,"aria-label":"刷新目录",title:"刷新目录",children:e.jsx(V,{size:15,"aria-hidden":"true"})})]}),u==="/"&&e.jsx("div",{className:"host-project-picker-warning",children:"当前允许访问宿主机根目录,请谨慎选择项目。"}),e.jsx("div",{className:"host-project-picker-list","aria-busy":i,children:i?e.jsx("div",{className:"host-project-picker-state",children:"正在读取目录…"}):k?e.jsx("div",{className:"host-project-picker-state is-error",children:k}):w.length===0?e.jsx("div",{className:"host-project-picker-state",children:"此目录为空"}):w.map(n=>{const b=ve(n.name,n.kind),{icon:E,label:T}=be[b],R=e.jsxs(e.Fragment,{children:[e.jsx("span",{className:`host-project-picker-entry-icon is-${b}`,"aria-hidden":"true",children:e.jsx(E,{size:18,strokeWidth:1.8})}),e.jsx("span",{className:"host-project-picker-name",children:n.name})]});return n.kind==="file"?e.jsx("div",{className:"host-project-picker-row is-file",title:T,children:R},`${n.name}:${n.path}`):e.jsxs("button",{type:"button",className:"host-project-picker-row is-directory",onClick:()=>void S(n.path),title:T,children:[R,n.hasChildren&&e.jsx("span",{className:"host-project-picker-chevron","aria-hidden":"true",children:e.jsx(fe,{size:16})})]},`${n.name}:${n.path}`)})}),e.jsxs("footer",{className:"host-project-picker-footer",children:[e.jsx("code",{title:d,children:d}),e.jsxs("div",{children:[e.jsx("button",{type:"button",className:"host-project-picker-cancel",onClick:o,children:"取消"}),e.jsx("button",{type:"button",className:"host-project-picker-confirm",disabled:!d||!C||i||a,onClick:()=>void z(),children:a?"正在导入…":"选择此文件夹"})]})]})]})}),document.body)}function we(t,s){return[...new Map([...t,...s].map(o=>[o.id,o])).values()]}function Ce({value:t,onChange:s}){const[o,f]=c.useState(""),[g,m]=c.useState({data:[],nextCursor:null,total:0}),[u,p]=c.useState(!0),[d,j]=c.useState(""),[w,l]=c.useState(0),i=c.useRef(0),x=c.useRef(!1);c.useEffect(()=>{const a=++i.current;let h=!0;x.current=!0,p(!0),j(""),m({data:[],nextCursor:null,total:0});const C=setTimeout(()=>{U({action:"sessionCatalog",query:o,limit:20}).then(y=>{h&&a===i.current&&m(y)}).catch(y=>{h&&a===i.current&&j(y instanceof Error?y.message:"无法加载会话")}).finally(()=>{h&&a===i.current&&(x.current=!1,p(!1))})},o?200:0);return()=>{h=!1,clearTimeout(C)}},[o,w]);const k=async()=>{if(x.current||!g.nextCursor)return;const a=i.current;x.current=!0,p(!0),j("");try{const h=await U({action:"sessionCatalog",query:o,limit:20,cursor:g.nextCursor});a===i.current&&m(C=>({...h,data:we(C.data,h.data)}))}catch(h){a===i.current&&j(h instanceof Error?h.message:"加载更多失败")}finally{a===i.current&&(x.current=!1,p(!1))}},v=new Set(t.map(a=>a.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:["选填 · 已选 ",t.length]})]})}),e.jsx("p",{className:"collab-muted",children:"运行中的在前。关联后作为监控对象,恢复或交接时才介入。"}),t.length>0&&e.jsx("div",{className:"collab-monitor-selected","aria-label":"已选会话",children:t.map(a=>e.jsxs("span",{title:`${O[a.agentType]} · ${a.cwd}`,children:[e.jsx(K,{agentType:a.agentType,size:14}),e.jsx("span",{children:a.title}),e.jsx("button",{type:"button","aria-label":`取消关联${a.title}`,onClick:()=>s(t.filter(h=>h.id!==a.id)),children:e.jsx(B,{size:13})})]},a.id))}),e.jsxs("label",{className:"collab-monitor-search",children:[e.jsx(je,{size:15}),e.jsx("input",{"aria-label":"搜索所有原始会话",placeholder:"搜索所有会话的标题、目录或 Agent",value:o,onChange:a=>f(a.target.value)})]}),e.jsxs("div",{className:"collab-monitor-results","aria-label":"原始会话候选","aria-busy":u,onScroll:a=>{const h=a.currentTarget;h.scrollHeight-h.scrollTop-h.clientHeight<64&&k()},children:[g.data.map(a=>e.jsxs("label",{className:"collab-monitor-row",children:[e.jsx("input",{type:"checkbox","aria-label":`关联${a.title}`,checked:v.has(a.id),disabled:!v.has(a.id)&&t.length>=200,onChange:h=>s(h.target.checked?[...t,{id:a.id,agentType:a.agentType,title:a.title,cwd:a.cwd,projectId:a.projectId}]:t.filter(C=>C.id!==a.id))}),e.jsx(K,{agentType:a.agentType,size:18}),e.jsxs("span",{children:[e.jsx("strong",{children:a.title}),e.jsxs("small",{children:[O[a.agentType]," · ",a.cwd]})]}),e.jsx("em",{className:a.status==="running"?"is-running":"",children:a.status==="running"?"运行中":a.status==="failed"?"异常":a.status==="completed"?"已完成":"空闲"})]},a.id)),!u&&!d&&!g.data.length&&e.jsx("p",{className:"collab-muted",children:o?"没有匹配的会话":"暂无可接入会话"}),u&&e.jsx("p",{className:"collab-muted",role:"status",children:"正在加载会话…"}),g.nextCursor&&!d&&e.jsxs("button",{type:"button",className:"collab-monitor-more",disabled:u,onClick:()=>void k(),children:["加载更多(已显示 ",g.data.length," / ",g.total,")"]})]}),d&&e.jsxs("p",{className:"collab-error",role:"alert",children:[d," ",e.jsx("button",{type:"button",onClick:()=>l(a=>a+1),children:"重新加载"})]})]})}function P({children:t,...s}){return e.jsxs("span",{className:"collab-select",children:[e.jsx("select",{...s,children:t}),e.jsx(_,{size:16,"aria-hidden":"true"})]})}function H(t){return{id:crypto.randomUUID(),name:t===0?"群主":`成员 ${t}`,agentType:"codex",role:""}}function Se({member:t,index:s,owner:o,supervisor:f,health:g,onChange:m,onRemove:u}){const[p,d]=c.useState([]),[j,w]=c.useState([]);return c.useEffect(()=>{let l=!0;return d([]),w([]),t.agentType==="customer-agent"?(window.agentApi.getSettings().then(i=>{l&&w(i.profiles.map(({id:x,name:k,modelId:v})=>({id:x,name:k,modelId:v})))}).catch(()=>{}),()=>{l=!1}):(window.agentApi.listAgentModels(t.agentType).then(i=>{l&&d(i.models)}).catch(()=>{}),()=>{l=!1})},[t.agentType]),e.jsxs("fieldset",{className:"collab-member-editor",children:[e.jsxs("legend",{children:[o?e.jsx(Z,{size:14}):e.jsx(me,{size:14}),o?"群主":`成员 ${s}`,f?" · 监工":""]}),u&&e.jsx("button",{type:"button",className:"collab-remove","aria-label":`移除${t.name}`,onClick:u,children:e.jsx(B,{size:16})}),e.jsxs("div",{className:"collab-editor-fields",children:[e.jsxs("label",{children:["名称",e.jsx("input",{value:t.name,maxLength:100,onChange:l=>m({...t,name:l.target.value}),required:!0})]}),e.jsxs("label",{children:["Agent",e.jsx(P,{value:t.agentType,onChange:l=>m({...t,agentType:l.target.value,model:void 0,profileId:void 0}),children:G.map(l=>{var i,x;return e.jsxs("option",{value:l,disabled:((i=g.find(k=>k.agentType===l))==null?void 0:i.available)===!1,children:[O[l],((x=g.find(k=>k.agentType===l))==null?void 0:x.available)===!1?" · 不可用":""]},l)})})]}),e.jsxs("label",{className:"collab-model-field",children:["模型",t.agentType==="customer-agent"?e.jsxs(P,{value:t.profileId||"",onChange:l=>{const i=j.find(x=>x.id===l.target.value);m({...t,profileId:i==null?void 0:i.id,model:i?{id:i.modelId}:void 0})},children:[e.jsx("option",{value:"",children:"沿用默认模型"}),j.map(l=>e.jsxs("option",{value:l.id,children:[l.name," · ",l.modelId]},l.id))]}):e.jsxs(P,{value:t.model?`${t.model.providerID||""}|${t.model.id}`:"",onChange:l=>{const i=p.find(x=>`${x.providerID||""}|${x.id}`===l.target.value);m({...t,model:i?{id:i.id,...i.providerID?{providerID:i.providerID}:{}}:void 0})},children:[e.jsx("option",{value:"",children:"沿用默认模型"}),p.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:f||void 0,children:[e.jsxs("summary",{children:[e.jsx("span",{children:"定位与职责"}),e.jsx("span",{className:"collab-muted",children:t.role.trim()?"已设置":o?"默认安排与汇总":"留空由群主分配"}),e.jsx(_,{size:14})]}),e.jsx("textarea",{"aria-label":`${o?"群主":`成员 ${s}`}的定位与职责(选填)`,rows:2,maxLength:8e3,value:t.role,placeholder:f?"重点看什么:异常暂停、任务交接和交付。允许怎么处理:原任务内自动恢复、继续、协调交接;业务取舍或无法恢复时提醒我决策。":o?"负责拆解目标、分配任务、验收和汇总成果":"例如:负责实现接口;留空由群主自动分配",onChange:l=>m({...t,role:l.target.value})}),f&&e.jsx("p",{className:"collab-muted",children:"在职责中写明关注内容、判断标准、允许的恢复与交接,以及何时提醒你或等待决策。"})]})]})}function ze({cwd:t,initialGroup:s,health:o,onClose:f,onCreated:g}){var q;const[m,u]=c.useState((s==null?void 0:s.name)||""),[p,d]=c.useState((s==null?void 0:s.cwd)||t||""),[j,w]=c.useState(()=>s?structuredClone(s.members):[H(0),H(1)]),[l,i]=c.useState((s==null?void 0:s.ownerId)||j[0].id),[x,k]=c.useState((s==null?void 0:s.maxParallel)||3),[v,a]=c.useState(()=>{var r;return structuredClone(((r=s==null?void 0:s.monitoring)==null?void 0:r.targets)??[])}),[h,C]=c.useState(s?((q=s.monitoring)==null?void 0:q.supervisorId)??"":j[0].id),[y,D]=c.useState(!1),[S,$]=c.useState(""),[I,z]=c.useState(!1),[n,b]=c.useState(!!(s!=null&&s.cwd)),[E,T]=c.useState(!1),R=async()=>{if($(""),Y()){z(!0);return}T(!0);try{const r=await window.agentApi.openFileDialog();r&&(d(r),b(!0))}catch(r){$(r instanceof Error?r.message:"无法选择工作目录")}finally{T(!1)}};return c.useEffect(()=>{const r=N=>{N.key==="Escape"&&!y&&!I&&!E&&f()};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[f,y,I,E]),e.jsxs("div",{className:"collab-modal-backdrop",onMouseDown:r=>{r.target===r.currentTarget&&!y&&f()},children:[e.jsxs("form",{className:"collab-create",role:"dialog","aria-modal":"true","aria-labelledby":"collab-create-title",onSubmit:async r=>{r.preventDefault(),D(!0),$("");try{if(!p.trim())throw new Error("请先选择工作目录");const N=j.find(L=>{var F;return((F=o.find(J=>J.agentType===L.agentType))==null?void 0:F.available)===!1});if(N&&!s)throw new Error(`${N.name} 选择的 Agent 当前不可用`);const A=await U({...s?{action:"updateGroup",groupId:s.id}:{action:"createGroup"},group:{name:m.trim()||"协作群",cwd:p.trim(),ownerId:l,members:j,maxParallel:Math.min(x,j.length),...v.length?{monitoring:{targets:v,...h?{supervisorId:h}:{}}}:{}}});g(A)}catch(N){$(N instanceof Error?N.message:String(N))}finally{D(!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:f,disabled:y,children:e.jsx(B,{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:m,maxLength:100,placeholder:"例如:产品开发小组",onChange:r=>u(r.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":I,title:p||"选择工作目录",disabled:y||E,onClick:()=>void R(),children:[e.jsx(ge,{size:16,"aria-hidden":"true"}),e.jsx("span",{className:p?void 0:"collab-muted",children:E?"正在选择…":p||"选择工作目录"}),e.jsx(W,{size:16,"aria-hidden":"true"})]})]})]}),e.jsx("p",{className:"collab-create-hint collab-muted",children:s?"配置保存后用于新讨论,已有讨论和聊天记录保留。":"Agent 可重复加入,职责留空由群主分配。"}),j.map((r,N)=>e.jsx(Se,{member:r,index:N,owner:r.id===l,supervisor:v.length>0&&r.id===h,health:o,onChange:A=>w(L=>L.map(F=>F.id===A.id?A:F)),onRemove:r.id!==l&&j.length>2?()=>{r.id===h&&C(""),w(A=>A.filter(L=>L.id!==r.id))}:void 0},r.id)),e.jsxs("div",{className:"collab-create-actions",children:[e.jsxs("label",{children:["群主",e.jsx(P,{value:l,onChange:r=>i(r.target.value),children:j.map(r=>e.jsx("option",{value:r.id,children:r.name},r.id))})]}),e.jsxs("button",{type:"button",disabled:j.length>=20,onClick:()=>w(r=>[...r,H(r.length)]),children:[e.jsx(W,{size:16}),"添加成员"]}),e.jsxs("label",{children:["最多同时工作",e.jsx(P,{value:Math.min(x,j.length),onChange:r=>k(Number(r.target.value)),children:j.map((r,N)=>e.jsxs("option",{value:N+1,children:[N+1," 人"]},N+1))})]})]}),e.jsx(Ce,{value:v,onChange:a}),v.length>0&&e.jsxs("label",{className:"collab-supervisor-select",children:["监工",e.jsxs(P,{"aria-label":"选择监工成员",value:h,onChange:r=>C(r.target.value),children:[e.jsx("option",{value:"",children:"仅关联,不启用监工"}),j.map(r=>e.jsxs("option",{value:r.id,children:[r.name," · ",O[r.agentType]]},r.id))]}),e.jsx("small",{className:"collab-muted",children:"复用该成员的 Agent、模型和职责,关闭看板后继续监管。"})]})]}),S&&e.jsx("p",{className:"collab-error",role:"alert",children:S}),e.jsxs("footer",{children:[e.jsx("span",{className:"collab-muted",children:"职责可以留空,发送任务后由群主分配。"}),e.jsx("button",{className:"collab-primary",disabled:y||E||!p.trim(),type:"submit",children:y?"正在保存…":s?"保存修改":"创建并打开群"})]})]}),e.jsx(ke,{open:I,initialPath:n?p:void 0,onCancel:()=>z(!1),onConfirm:r=>{d(r),b(!0),z(!1),$("")}})]})}export{ze as C,ke as H};
1
+ import{r as c,d as Q,j as e,R as V,e as X,A as K,P as W,f as Y}from"./index-DKm9ESDq.js";import{C as Z,a as G}from"./types-VnQ_cKrp.js";import{a as ee,D as te,P as ae,b as se,c as re,d as le,e as ne,N as oe,f as ce,g as ie,h as de,i as he,F as ue,j as pe,S as je}from"./file-types-DKkhMnUV.js";import{X as B}from"./x-DP1nC4qG.js";import{A as xe,C as fe,F as ge}from"./trash-2-BrfgMjfL.js";import{c as U,A as O,U as me}from"./collaboration-CQhzjwS_.js";import{C as _}from"./chevron-down-DhZV290h.js";const be={folder:{icon:ue,label:"文件夹"},code:{icon:he,label:"代码文件"},style:{icon:X,label:"样式文件"},image:{icon:de,label:"图片文件"},video:{icon:ie,label:"视频文件"},audio:{icon:ce,label:"音频文件"},markdown:{icon:oe,label:"Markdown 文件"},text:{icon:ne,label:"文本文件"},json:{icon:le,label:"JSON 文件"},archive:{icon:re,label:"压缩文件"},spreadsheet:{icon:se,label:"表格文件"},presentation:{icon:ae,label:"演示文件"},database:{icon:te,label:"数据库文件"},file:{icon:ee,label:"文件"}};function ve(t,s){return s==="directory"?"folder":pe(t)}const M=t=>t.replace(/\\/g,"/").replace(/\/+$/,"")||"/";function ye(t,s){for(const f of s){if(!(f!=null&&f.trim()))continue;const g=M(f);if(g.split("/").some(u=>u==="."||u===".."))continue;const m=t.map(M).filter(u=>g===u||g.startsWith(u==="/"?"/":`${u}/`)).sort((u,p)=>p.length-u.length)[0];if(m)return{root:m,current:g}}const o=t[0]?M(t[0]):"";return{root:o,current:o}}function Ne(t,s){const o=M(t),f=M(s),m=[{label:o==="/"?"/":o.split("/").filter(Boolean).pop()||o,path:o}];if(f===o)return m;const u=f.slice(o==="/"?1:o.length+1);let p=o;for(const d of u.split("/").filter(Boolean))p=p==="/"?`/${d}`:`${p}/${d}`,m.push({label:d,path:p});return m}function ke({open:t,initialPath:s,onCancel:o,onConfirm:f}){const[g,m]=c.useState([]),[u,p]=c.useState(""),[d,j]=c.useState(""),[w,l]=c.useState([]),[i,x]=c.useState(!1),[k,v]=c.useState(""),[a,h]=c.useState(!1),[C,y]=c.useState(!1),D=c.useMemo(()=>u&&d?Ne(u,d):[],[u,d]),S=async n=>{if(window.agentApi){x(!0),y(!1),v(""),j(n),l([]);try{const b=await window.agentApi.listProjectDirectories(n);l(b),y(!0)}catch(b){v(b instanceof Error?b.message:"无法读取目录")}finally{x(!1)}}};if(c.useEffect(()=>{if(!t||!window.agentApi)return;let n=!1;return x(!0),v(""),p(""),j(""),y(!1),l([]),window.agentApi.getProjectPickerLocation().then(async({roots:b,initialPath:E})=>{if(n)return;m(b);const T=ye(b,[s,E]);p(T.root),T.current?await S(T.current):v("未配置可用的宿主机目录")}).catch(b=>{n||v(b instanceof Error?b.message:"无法读取宿主机目录")}).finally(()=>{n||x(!1)}),()=>{n=!0}},[t,s]),c.useEffect(()=>{if(!t)return;const n=b=>{b.key==="Escape"&&o()};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[t,o]),!t)return null;const $=n=>{p(n),S(n)},I=()=>{D.length<=1||S(D[D.length-2].path)},z=async()=>{if(!(!d||!C||a)){h(!0),v("");try{await f(d)}catch(n){v(n instanceof Error?n.message:"项目导入失败")}finally{h(!1)}}};return Q.createPortal(e.jsx("div",{className:"host-project-picker-backdrop",role:"presentation",onMouseDown:n=>{n.target===n.currentTarget&&o()},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:o,"aria-label":"关闭目录选择器",title:"关闭",children:e.jsx(B,{size:16,"aria-hidden":"true"})})]}),g.length>1&&e.jsxs("label",{className:"host-project-picker-root",children:[e.jsx("span",{children:"根目录"}),e.jsx("select",{value:u,onChange:n=>$(n.target.value),children:g.map(n=>e.jsx("option",{value:n,children:n},n))})]}),e.jsxs("nav",{className:"host-project-picker-nav","aria-label":"当前目录",children:[e.jsx("button",{type:"button",className:"ui-icon-button",onClick:I,disabled:D.length<=1,"aria-label":"返回上级目录",title:"返回上级目录",children:e.jsx(xe,{size:16,"aria-hidden":"true"})}),e.jsxs("div",{className:"host-project-picker-breadcrumbs",children:[!d&&e.jsx("span",{children:i?"正在定位工作目录…":"未能加载工作目录"}),D.map((n,b)=>e.jsxs("span",{children:[b>0&&e.jsx("i",{children:"/"}),e.jsx("button",{type:"button",onClick:()=>void S(n.path),children:n.label})]},n.path))]}),e.jsx("button",{type:"button",className:"ui-icon-button",onClick:()=>d&&void S(d),disabled:!d||i,"aria-label":"刷新目录",title:"刷新目录",children:e.jsx(V,{size:15,"aria-hidden":"true"})})]}),u==="/"&&e.jsx("div",{className:"host-project-picker-warning",children:"当前允许访问宿主机根目录,请谨慎选择项目。"}),e.jsx("div",{className:"host-project-picker-list","aria-busy":i,children:i?e.jsx("div",{className:"host-project-picker-state",children:"正在读取目录…"}):k?e.jsx("div",{className:"host-project-picker-state is-error",children:k}):w.length===0?e.jsx("div",{className:"host-project-picker-state",children:"此目录为空"}):w.map(n=>{const b=ve(n.name,n.kind),{icon:E,label:T}=be[b],R=e.jsxs(e.Fragment,{children:[e.jsx("span",{className:`host-project-picker-entry-icon is-${b}`,"aria-hidden":"true",children:e.jsx(E,{size:18,strokeWidth:1.8})}),e.jsx("span",{className:"host-project-picker-name",children:n.name})]});return n.kind==="file"?e.jsx("div",{className:"host-project-picker-row is-file",title:T,children:R},`${n.name}:${n.path}`):e.jsxs("button",{type:"button",className:"host-project-picker-row is-directory",onClick:()=>void S(n.path),title:T,children:[R,n.hasChildren&&e.jsx("span",{className:"host-project-picker-chevron","aria-hidden":"true",children:e.jsx(fe,{size:16})})]},`${n.name}:${n.path}`)})}),e.jsxs("footer",{className:"host-project-picker-footer",children:[e.jsx("code",{title:d,children:d}),e.jsxs("div",{children:[e.jsx("button",{type:"button",className:"host-project-picker-cancel",onClick:o,children:"取消"}),e.jsx("button",{type:"button",className:"host-project-picker-confirm",disabled:!d||!C||i||a,onClick:()=>void z(),children:a?"正在导入…":"选择此文件夹"})]})]})]})}),document.body)}function we(t,s){return[...new Map([...t,...s].map(o=>[o.id,o])).values()]}function Ce({value:t,onChange:s}){const[o,f]=c.useState(""),[g,m]=c.useState({data:[],nextCursor:null,total:0}),[u,p]=c.useState(!0),[d,j]=c.useState(""),[w,l]=c.useState(0),i=c.useRef(0),x=c.useRef(!1);c.useEffect(()=>{const a=++i.current;let h=!0;x.current=!0,p(!0),j(""),m({data:[],nextCursor:null,total:0});const C=setTimeout(()=>{U({action:"sessionCatalog",query:o,limit:20}).then(y=>{h&&a===i.current&&m(y)}).catch(y=>{h&&a===i.current&&j(y instanceof Error?y.message:"无法加载会话")}).finally(()=>{h&&a===i.current&&(x.current=!1,p(!1))})},o?200:0);return()=>{h=!1,clearTimeout(C)}},[o,w]);const k=async()=>{if(x.current||!g.nextCursor)return;const a=i.current;x.current=!0,p(!0),j("");try{const h=await U({action:"sessionCatalog",query:o,limit:20,cursor:g.nextCursor});a===i.current&&m(C=>({...h,data:we(C.data,h.data)}))}catch(h){a===i.current&&j(h instanceof Error?h.message:"加载更多失败")}finally{a===i.current&&(x.current=!1,p(!1))}},v=new Set(t.map(a=>a.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:["选填 · 已选 ",t.length]})]})}),e.jsx("p",{className:"collab-muted",children:"运行中的在前。关联后作为监控对象,恢复或交接时才介入。"}),t.length>0&&e.jsx("div",{className:"collab-monitor-selected","aria-label":"已选会话",children:t.map(a=>e.jsxs("span",{title:`${O[a.agentType]} · ${a.cwd}`,children:[e.jsx(K,{agentType:a.agentType,size:14}),e.jsx("span",{children:a.title}),e.jsx("button",{type:"button","aria-label":`取消关联${a.title}`,onClick:()=>s(t.filter(h=>h.id!==a.id)),children:e.jsx(B,{size:13})})]},a.id))}),e.jsxs("label",{className:"collab-monitor-search",children:[e.jsx(je,{size:15}),e.jsx("input",{"aria-label":"搜索所有原始会话",placeholder:"搜索所有会话的标题、目录或 Agent",value:o,onChange:a=>f(a.target.value)})]}),e.jsxs("div",{className:"collab-monitor-results","aria-label":"原始会话候选","aria-busy":u,onScroll:a=>{const h=a.currentTarget;h.scrollHeight-h.scrollTop-h.clientHeight<64&&k()},children:[g.data.map(a=>e.jsxs("label",{className:"collab-monitor-row",children:[e.jsx("input",{type:"checkbox","aria-label":`关联${a.title}`,checked:v.has(a.id),disabled:!v.has(a.id)&&t.length>=200,onChange:h=>s(h.target.checked?[...t,{id:a.id,agentType:a.agentType,title:a.title,cwd:a.cwd,projectId:a.projectId}]:t.filter(C=>C.id!==a.id))}),e.jsx(K,{agentType:a.agentType,size:18}),e.jsxs("span",{children:[e.jsx("strong",{children:a.title}),e.jsxs("small",{children:[O[a.agentType]," · ",a.cwd]})]}),e.jsx("em",{className:a.status==="running"?"is-running":"",children:a.status==="running"?"运行中":a.status==="failed"?"异常":a.status==="completed"?"已完成":"空闲"})]},a.id)),!u&&!d&&!g.data.length&&e.jsx("p",{className:"collab-muted",children:o?"没有匹配的会话":"暂无可接入会话"}),u&&e.jsx("p",{className:"collab-muted",role:"status",children:"正在加载会话…"}),g.nextCursor&&!d&&e.jsxs("button",{type:"button",className:"collab-monitor-more",disabled:u,onClick:()=>void k(),children:["加载更多(已显示 ",g.data.length," / ",g.total,")"]})]}),d&&e.jsxs("p",{className:"collab-error",role:"alert",children:[d," ",e.jsx("button",{type:"button",onClick:()=>l(a=>a+1),children:"重新加载"})]})]})}function P({children:t,...s}){return e.jsxs("span",{className:"collab-select",children:[e.jsx("select",{...s,children:t}),e.jsx(_,{size:16,"aria-hidden":"true"})]})}function H(t){return{id:crypto.randomUUID(),name:t===0?"群主":`成员 ${t}`,agentType:"codex",role:""}}function Se({member:t,index:s,owner:o,supervisor:f,health:g,onChange:m,onRemove:u}){const[p,d]=c.useState([]),[j,w]=c.useState([]);return c.useEffect(()=>{let l=!0;return d([]),w([]),t.agentType==="customer-agent"?(window.agentApi.getSettings().then(i=>{l&&w(i.profiles.map(({id:x,name:k,modelId:v})=>({id:x,name:k,modelId:v})))}).catch(()=>{}),()=>{l=!1}):(window.agentApi.listAgentModels(t.agentType).then(i=>{l&&d(i.models)}).catch(()=>{}),()=>{l=!1})},[t.agentType]),e.jsxs("fieldset",{className:"collab-member-editor",children:[e.jsxs("legend",{children:[o?e.jsx(Z,{size:14}):e.jsx(me,{size:14}),o?"群主":`成员 ${s}`,f?" · 监工":""]}),u&&e.jsx("button",{type:"button",className:"collab-remove","aria-label":`移除${t.name}`,onClick:u,children:e.jsx(B,{size:16})}),e.jsxs("div",{className:"collab-editor-fields",children:[e.jsxs("label",{children:["名称",e.jsx("input",{value:t.name,maxLength:100,onChange:l=>m({...t,name:l.target.value}),required:!0})]}),e.jsxs("label",{children:["Agent",e.jsx(P,{value:t.agentType,onChange:l=>m({...t,agentType:l.target.value,model:void 0,profileId:void 0}),children:G.map(l=>{var i,x;return e.jsxs("option",{value:l,disabled:((i=g.find(k=>k.agentType===l))==null?void 0:i.available)===!1,children:[O[l],((x=g.find(k=>k.agentType===l))==null?void 0:x.available)===!1?" · 不可用":""]},l)})})]}),e.jsxs("label",{className:"collab-model-field",children:["模型",t.agentType==="customer-agent"?e.jsxs(P,{value:t.profileId||"",onChange:l=>{const i=j.find(x=>x.id===l.target.value);m({...t,profileId:i==null?void 0:i.id,model:i?{id:i.modelId}:void 0})},children:[e.jsx("option",{value:"",children:"沿用默认模型"}),j.map(l=>e.jsxs("option",{value:l.id,children:[l.name," · ",l.modelId]},l.id))]}):e.jsxs(P,{value:t.model?`${t.model.providerID||""}|${t.model.id}`:"",onChange:l=>{const i=p.find(x=>`${x.providerID||""}|${x.id}`===l.target.value);m({...t,model:i?{id:i.id,...i.providerID?{providerID:i.providerID}:{}}:void 0})},children:[e.jsx("option",{value:"",children:"沿用默认模型"}),p.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:f||void 0,children:[e.jsxs("summary",{children:[e.jsx("span",{children:"定位与职责"}),e.jsx("span",{className:"collab-muted",children:t.role.trim()?"已设置":o?"默认安排与汇总":"留空由群主分配"}),e.jsx(_,{size:14})]}),e.jsx("textarea",{"aria-label":`${o?"群主":`成员 ${s}`}的定位与职责(选填)`,rows:2,maxLength:8e3,value:t.role,placeholder:f?"重点看什么:异常暂停、任务交接和交付。允许怎么处理:原任务内自动恢复、继续、协调交接;业务取舍或无法恢复时提醒我决策。":o?"负责拆解目标、分配任务、验收和汇总成果":"例如:负责实现接口;留空由群主自动分配",onChange:l=>m({...t,role:l.target.value})}),f&&e.jsx("p",{className:"collab-muted",children:"在职责中写明关注内容、判断标准、允许的恢复与交接,以及何时提醒你或等待决策。"})]})]})}function ze({cwd:t,initialGroup:s,health:o,onClose:f,onCreated:g}){var q;const[m,u]=c.useState((s==null?void 0:s.name)||""),[p,d]=c.useState((s==null?void 0:s.cwd)||t||""),[j,w]=c.useState(()=>s?structuredClone(s.members):[H(0),H(1)]),[l,i]=c.useState((s==null?void 0:s.ownerId)||j[0].id),[x,k]=c.useState((s==null?void 0:s.maxParallel)||3),[v,a]=c.useState(()=>{var r;return structuredClone(((r=s==null?void 0:s.monitoring)==null?void 0:r.targets)??[])}),[h,C]=c.useState(s?((q=s.monitoring)==null?void 0:q.supervisorId)??"":j[0].id),[y,D]=c.useState(!1),[S,$]=c.useState(""),[I,z]=c.useState(!1),[n,b]=c.useState(!!(s!=null&&s.cwd)),[E,T]=c.useState(!1),R=async()=>{if($(""),Y()){z(!0);return}T(!0);try{const r=await window.agentApi.openFileDialog();r&&(d(r),b(!0))}catch(r){$(r instanceof Error?r.message:"无法选择工作目录")}finally{T(!1)}};return c.useEffect(()=>{const r=N=>{N.key==="Escape"&&!y&&!I&&!E&&f()};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[f,y,I,E]),e.jsxs("div",{className:"collab-modal-backdrop",onMouseDown:r=>{r.target===r.currentTarget&&!y&&f()},children:[e.jsxs("form",{className:"collab-create",role:"dialog","aria-modal":"true","aria-labelledby":"collab-create-title",onSubmit:async r=>{r.preventDefault(),D(!0),$("");try{if(!p.trim())throw new Error("请先选择工作目录");const N=j.find(L=>{var F;return((F=o.find(J=>J.agentType===L.agentType))==null?void 0:F.available)===!1});if(N&&!s)throw new Error(`${N.name} 选择的 Agent 当前不可用`);const A=await U({...s?{action:"updateGroup",groupId:s.id}:{action:"createGroup"},group:{name:m.trim()||"协作群",cwd:p.trim(),ownerId:l,members:j,maxParallel:Math.min(x,j.length),...v.length?{monitoring:{targets:v,...h?{supervisorId:h}:{}}}:{}}});g(A)}catch(N){$(N instanceof Error?N.message:String(N))}finally{D(!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:f,disabled:y,children:e.jsx(B,{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:m,maxLength:100,placeholder:"例如:产品开发小组",onChange:r=>u(r.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":I,title:p||"选择工作目录",disabled:y||E,onClick:()=>void R(),children:[e.jsx(ge,{size:16,"aria-hidden":"true"}),e.jsx("span",{className:p?void 0:"collab-muted",children:E?"正在选择…":p||"选择工作目录"}),e.jsx(W,{size:16,"aria-hidden":"true"})]})]})]}),e.jsx("p",{className:"collab-create-hint collab-muted",children:s?"配置保存后用于新讨论,已有讨论和聊天记录保留。":"Agent 可重复加入,职责留空由群主分配。"}),j.map((r,N)=>e.jsx(Se,{member:r,index:N,owner:r.id===l,supervisor:v.length>0&&r.id===h,health:o,onChange:A=>w(L=>L.map(F=>F.id===A.id?A:F)),onRemove:r.id!==l&&j.length>2?()=>{r.id===h&&C(""),w(A=>A.filter(L=>L.id!==r.id))}:void 0},r.id)),e.jsxs("div",{className:"collab-create-actions",children:[e.jsxs("label",{children:["群主",e.jsx(P,{value:l,onChange:r=>i(r.target.value),children:j.map(r=>e.jsx("option",{value:r.id,children:r.name},r.id))})]}),e.jsxs("button",{type:"button",disabled:j.length>=20,onClick:()=>w(r=>[...r,H(r.length)]),children:[e.jsx(W,{size:16}),"添加成员"]}),e.jsxs("label",{children:["最多同时工作",e.jsx(P,{value:Math.min(x,j.length),onChange:r=>k(Number(r.target.value)),children:j.map((r,N)=>e.jsxs("option",{value:N+1,children:[N+1," 人"]},N+1))})]})]}),e.jsx(Ce,{value:v,onChange:a}),v.length>0&&e.jsxs("label",{className:"collab-supervisor-select",children:["监工",e.jsxs(P,{"aria-label":"选择监工成员",value:h,onChange:r=>C(r.target.value),children:[e.jsx("option",{value:"",children:"仅关联,不启用监工"}),j.map(r=>e.jsxs("option",{value:r.id,children:[r.name," · ",O[r.agentType]]},r.id))]}),e.jsx("small",{className:"collab-muted",children:"复用该成员的 Agent、模型和职责,关闭看板后继续监管。"})]})]}),S&&e.jsx("p",{className:"collab-error",role:"alert",children:S}),e.jsxs("footer",{children:[e.jsx("span",{className:"collab-muted",children:"职责可以留空,发送任务后由群主分配。"}),e.jsx("button",{className:"collab-primary",disabled:y||E||!p.trim(),type:"submit",children:y?"正在保存…":s?"保存修改":"创建并打开群"})]})]}),e.jsx(ke,{open:I,initialPath:n?p:void 0,onCancel:()=>z(!1),onConfirm:r=>{d(r),b(!0),z(!1),$("")}})]})}export{ze as C,ke as H};
@@ -1 +1 @@
1
- import{r as t,u as P,j as e,R as I,P as S,A as O,d as g}from"./index-B_qrzBSm.js";import{C as $,a as _,b as B}from"./CollaborationTabBridge-Dxq4G1Uk.js";import{C as G}from"./CollaborationCreateDialog-0xwWJVAB.js";import{c as R,U as z,A as T}from"./collaboration-B0sTZDns.js";import{p as M}from"./SessionDashboardBridge--lNIU1u6.js";import{X as H}from"./x-8eDWe1V2.js";import{S as U,F as Y}from"./file-types-Bv8xIlsm.js";import{P as q,T as F}from"./trash-2-Drt7yRIe.js";import{C as Q}from"./types-BOD4WqhS.js";import{A as X}from"./arrow-right-CED95s1t.js";import"./chevron-down-DuxUTH_N.js";function J(){const[u,m]=t.useState([]),[x,j]=t.useState(!0),[h,n]=t.useState(""),i=t.useRef(0),r=t.useCallback(async()=>{const l=++i.current;j(!0);try{const o=await R({action:"groups"});i.current===l&&(m(o),n(""))}catch(o){i.current===l&&n(o instanceof Error?o.message:String(o))}finally{i.current===l&&j(!1)}},[]);return t.useEffect(()=>{r();const l=()=>{r()};return window.addEventListener("focus",l),()=>{i.current++,window.removeEventListener("focus",l)}},[r]),{groups:u,loading:x,error:h,refresh:r}}function re({onOpen:u,onChanged:m,onClose:x,cwd:j}){const{groups:h,loading:n,error:i,refresh:r}=J(),[l,o]=t.useState(""),[c,b]=t.useState(null),[f,w]=t.useState(null),[p,y]=t.useState(!1),[v,N]=t.useState(""),[D,L]=t.useState([]),E=P(s=>s.skin);t.useEffect(()=>{!n&&window.parent!==window&&window.parent.postMessage({type:$},window.location.origin)},[n]),t.useEffect(()=>{document.documentElement.setAttribute("data-skin",E)},[E]),t.useEffect(()=>{let s=!0;return window.agentApi.getRuntimeHealth().then(a=>{s&&L(a)}).catch(()=>{}),()=>{s=!1}},[]);const C=s=>{u?u(s):window.parent!==window?window.parent.postMessage({type:_,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:B,groupId:s,...a?{title:a.name}:{deleted:!0}},window.location.origin),r()},k=h.filter(s=>`${s.name} ${s.cwd} ${s.members.map(a=>a.name).join(" ")}`.toLowerCase().includes(l.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:h.length})]}),e.jsx("p",{className:"collab-muted",children:"找到你的群,继续上次的协作。"})]}),e.jsxs("div",{className:"collab-dashboard-tools",children:[e.jsx("button",{onClick:()=>M({kind:"dashboard"}),children:"Dashboard"}),e.jsx("button",{"aria-label":"刷新群列表",title:"刷新群列表",disabled:n,onClick:()=>void r(),children:e.jsx(I,{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(H,{size:18})})]})]}),e.jsxs("label",{className:"collab-dashboard-search",children:[e.jsx(U,{size:17}),e.jsx("input",{"aria-label":"搜索群聊",placeholder:"搜索群名、成员或工作目录",value:l,onChange:s=>o(s.target.value)})]}),i&&e.jsxs("div",{className:"collab-error",role:"alert",children:[i,e.jsx("button",{onClick:()=>void r(),children:"重试"})]}),n&&h.length===0?e.jsx("div",{className:"collab-dashboard-empty",role:"status",children:"正在加载已保存的群…"}):!i&&k.length===0?e.jsxs("div",{className:"collab-dashboard-empty",children:[e.jsx(z,{size:32}),e.jsx("h2",{children:l?"没有找到匹配的群":"还没有协作群"}),e.jsx("p",{children:l?"换个关键词试试。":"选一位群主和成员,一起完成任务。"}),!l&&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":n,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(z,{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(q,{size:16})}),e.jsx("button",{"aria-label":`删除${s.name}`,title:"删除群聊",onClick:()=>{N(""),w(s)},children:e.jsx(F,{size:16})})]})]}),e.jsxs("p",{className:"collab-card-owner",children:[e.jsx(Q,{size:14}),e.jsxs("span",{children:["群主 · ",a==null?void 0:a.name]}),e.jsx("span",{className:"collab-muted",children:a&&T[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} · ${T[d.agentType]}`,children:e.jsx(O,{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(Y,{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(X,{size:16})]})]})]},s.id)})}),c&&g.createPortal(e.jsx(G,{cwd:j,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),f&&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:["删除“",f.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:f.id}),A(f.id),w(null)}catch(s){N(s instanceof Error?s.message:String(s))}finally{y(!1)}},children:p?"正在删除…":"确认删除"})]})]})}),document.body)]})}export{re as default};
1
+ import{r as t,u as P,j as e,R as I,P as S,A as O,d as g}from"./index-DKm9ESDq.js";import{C as $,a as _,b as B}from"./CollaborationTabBridge-Dxq4G1Uk.js";import{C as G}from"./CollaborationCreateDialog-BmgYdwe7.js";import{c as R,U as z,A as T}from"./collaboration-CQhzjwS_.js";import{p as M}from"./SessionDashboardBridge-Bx4EXtos.js";import{X as H}from"./x-DP1nC4qG.js";import{S as U,F as Y}from"./file-types-DKkhMnUV.js";import{P as q,T as F}from"./trash-2-BrfgMjfL.js";import{C as Q}from"./types-VnQ_cKrp.js";import{A as X}from"./arrow-right-Cqqb1zqH.js";import"./chevron-down-DhZV290h.js";function J(){const[u,m]=t.useState([]),[x,j]=t.useState(!0),[h,n]=t.useState(""),i=t.useRef(0),r=t.useCallback(async()=>{const l=++i.current;j(!0);try{const o=await R({action:"groups"});i.current===l&&(m(o),n(""))}catch(o){i.current===l&&n(o instanceof Error?o.message:String(o))}finally{i.current===l&&j(!1)}},[]);return t.useEffect(()=>{r();const l=()=>{r()};return window.addEventListener("focus",l),()=>{i.current++,window.removeEventListener("focus",l)}},[r]),{groups:u,loading:x,error:h,refresh:r}}function re({onOpen:u,onChanged:m,onClose:x,cwd:j}){const{groups:h,loading:n,error:i,refresh:r}=J(),[l,o]=t.useState(""),[c,b]=t.useState(null),[f,w]=t.useState(null),[p,y]=t.useState(!1),[v,N]=t.useState(""),[D,L]=t.useState([]),E=P(s=>s.skin);t.useEffect(()=>{!n&&window.parent!==window&&window.parent.postMessage({type:$},window.location.origin)},[n]),t.useEffect(()=>{document.documentElement.setAttribute("data-skin",E)},[E]),t.useEffect(()=>{let s=!0;return window.agentApi.getRuntimeHealth().then(a=>{s&&L(a)}).catch(()=>{}),()=>{s=!1}},[]);const C=s=>{u?u(s):window.parent!==window?window.parent.postMessage({type:_,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:B,groupId:s,...a?{title:a.name}:{deleted:!0}},window.location.origin),r()},k=h.filter(s=>`${s.name} ${s.cwd} ${s.members.map(a=>a.name).join(" ")}`.toLowerCase().includes(l.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:h.length})]}),e.jsx("p",{className:"collab-muted",children:"找到你的群,继续上次的协作。"})]}),e.jsxs("div",{className:"collab-dashboard-tools",children:[e.jsx("button",{onClick:()=>M({kind:"dashboard"}),children:"Dashboard"}),e.jsx("button",{"aria-label":"刷新群列表",title:"刷新群列表",disabled:n,onClick:()=>void r(),children:e.jsx(I,{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(H,{size:18})})]})]}),e.jsxs("label",{className:"collab-dashboard-search",children:[e.jsx(U,{size:17}),e.jsx("input",{"aria-label":"搜索群聊",placeholder:"搜索群名、成员或工作目录",value:l,onChange:s=>o(s.target.value)})]}),i&&e.jsxs("div",{className:"collab-error",role:"alert",children:[i,e.jsx("button",{onClick:()=>void r(),children:"重试"})]}),n&&h.length===0?e.jsx("div",{className:"collab-dashboard-empty",role:"status",children:"正在加载已保存的群…"}):!i&&k.length===0?e.jsxs("div",{className:"collab-dashboard-empty",children:[e.jsx(z,{size:32}),e.jsx("h2",{children:l?"没有找到匹配的群":"还没有协作群"}),e.jsx("p",{children:l?"换个关键词试试。":"选一位群主和成员,一起完成任务。"}),!l&&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":n,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(z,{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(q,{size:16})}),e.jsx("button",{"aria-label":`删除${s.name}`,title:"删除群聊",onClick:()=>{N(""),w(s)},children:e.jsx(F,{size:16})})]})]}),e.jsxs("p",{className:"collab-card-owner",children:[e.jsx(Q,{size:14}),e.jsxs("span",{children:["群主 · ",a==null?void 0:a.name]}),e.jsx("span",{className:"collab-muted",children:a&&T[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} · ${T[d.agentType]}`,children:e.jsx(O,{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(Y,{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(X,{size:16})]})]})]},s.id)})}),c&&g.createPortal(e.jsx(G,{cwd:j,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),f&&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:["删除“",f.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:f.id}),A(f.id),w(null)}catch(s){N(s instanceof Error?s.message:String(s))}finally{y(!1)}},children:p?"正在删除…":"确认删除"})]})]})}),document.body)]})}export{re as default};
@@ -1,4 +1,4 @@
1
- import{c as Re,r as c,j as e,A as W,k as Ce,l as Ae,u as Le,P as xe,M as Pe,m as Oe}from"./index-B_qrzBSm.js";import{r as Ie,p as Fe,C as Be}from"./artifact-links-BWD7xpfV.js";import{p as _e,a as Ue,n as Ge,M as He,H as We,S as Ye}from"./composer-file-routing-BrWLenKF.js";import{p as Ke}from"./SessionDashboardBridge--lNIU1u6.js";import{S as Ve}from"./shield-check-C_XCddHW.js";import{A as Z,U as X,c as R,D as je}from"./collaboration-B0sTZDns.js";import{X as $e}from"./x-8eDWe1V2.js";import{b as ie,C as Ze}from"./types-BOD4WqhS.js";import{c as Je}from"./CollaborationTabBridge-Dxq4G1Uk.js";import{L as ve}from"./loader-circle-CkN6rr8Q.js";import{I as Qe}from"./image-plus-CMQPwQ1a.js";/**
1
+ import{c as Re,r as c,j as e,A as W,k as Ce,l as Ae,u as Le,P as xe,M as Pe,m as Oe}from"./index-DKm9ESDq.js";import{r as Ie,p as Fe,C as Be}from"./artifact-links-73OZyi5W.js";import{p as _e,a as Ue,n as Ge,M as He,H as We,S as Ye}from"./composer-file-routing-D9orqwzY.js";import{p as Ke}from"./SessionDashboardBridge-Bx4EXtos.js";import{S as Ve}from"./shield-check-CrjI2wPR.js";import{A as Z,U as X,c as R,D as je}from"./collaboration-CQhzjwS_.js";import{X as $e}from"./x-DP1nC4qG.js";import{b as ie,C as Ze}from"./types-VnQ_cKrp.js";import{c as Je}from"./CollaborationTabBridge-Dxq4G1Uk.js";import{L as ve}from"./loader-circle-DIW9tlEz.js";import{I as Qe}from"./image-plus-nplydLA5.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-BnmCqa8x.js","./index-B_qrzBSm.js","./index-DFMBt4EW.css","./artifact-links-BWD7xpfV.js","./rotate-ccw-CFOlggPt.js","./loader-circle-CkN6rr8Q.js","./trash-2-Drt7yRIe.js","./download-DNa5KRtu.js","./x-8eDWe1V2.js"])))=>i.map(i=>d[i]);
2
- import{c as De,r,a7 as _t,j as t,R as Te}from"./index-B_qrzBSm.js";import{i as de,C as rt}from"./artifact-links-BWD7xpfV.js";import{R as Dt}from"./rotate-ccw-CFOlggPt.js";import{L as Z}from"./loader-circle-CkN6rr8Q.js";import{P as It}from"./trash-2-Drt7yRIe.js";import{D as Ht}from"./download-DNa5KRtu.js";import{X as Wt}from"./x-8eDWe1V2.js";/**
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./codeSyntax-DfQ5rLir.js","./index-DKm9ESDq.js","./index-B-d1Vs9E.css","./artifact-links-73OZyi5W.js","./rotate-ccw-O4wnfQP7.js","./loader-circle-DIW9tlEz.js","./trash-2-BrfgMjfL.js","./download-D3xZPWnZ.js","./x-DP1nC4qG.js"])))=>i.map(i=>d[i]);
2
+ import{c as De,r,a7 as _t,j as t,R as Te}from"./index-DKm9ESDq.js";import{i as de,C as rt}from"./artifact-links-73OZyi5W.js";import{R as Dt}from"./rotate-ccw-O4wnfQP7.js";import{L as Z}from"./loader-circle-DIW9tlEz.js";import{P as It}from"./trash-2-BrfgMjfL.js";import{D as Ht}from"./download-D3xZPWnZ.js";import{X as Wt}from"./x-DP1nC4qG.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,a7 as _t,j as t,R as Te}from"./index-B_qrzBSm.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,xn=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-BnmCqa8x.js");return{highlightCodeLines:u}},__vite__mapDeps([0,1,2,3,4,5,6,7,8]),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-DfQ5rLir.js");return{highlightCodeLines:u}},__vite__mapDeps([0,1,2,3,4,5,6,7,8]),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"},hn=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,xn as a,hn as b,Ut as c};
@@ -1,4 +1,4 @@
1
- import{c as se,r as a,j as s,e as oe}from"./index-B_qrzBSm.js";import{S as de,F as Z,a as ue,D as fe,P as pe,b as xe,c as he,d as me,e as je,N as be,f as ye,g as ve,h as ze,i as ke,j as Ne}from"./file-types-Bv8xIlsm.js";import{X as Fe}from"./x-8eDWe1V2.js";import{L as _}from"./loader-circle-CkN6rr8Q.js";import{C as P}from"./chevron-down-DuxUTH_N.js";import{C as S,F as T}from"./trash-2-Drt7yRIe.js";/**
1
+ import{c as se,r as a,j as s,e as oe}from"./index-DKm9ESDq.js";import{S as de,F as Z,a as ue,D as fe,P as pe,b as xe,c as he,d as me,e as je,N as be,f as ye,g as ve,h as ze,i as ke,j as Ne}from"./file-types-DKkhMnUV.js";import{X as Fe}from"./x-DP1nC4qG.js";import{L as _}from"./loader-circle-DIW9tlEz.js";import{C as P}from"./chevron-down-DhZV290h.js";import{C as S,F as T}from"./trash-2-BrfgMjfL.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-B_qrzBSm.js";import{F as d}from"./FilePreview-DIsjFx4f.js";import m from"./FileTree-BJe67ELr.js";import{X as f}from"./x-8eDWe1V2.js";import"./artifact-links-BWD7xpfV.js";import"./rotate-ccw-CFOlggPt.js";import"./loader-circle-CkN6rr8Q.js";import"./trash-2-Drt7yRIe.js";import"./download-DNa5KRtu.js";import"./file-types-Bv8xIlsm.js";import"./chevron-down-DuxUTH_N.js";function C({open:a,tab:s,gateway:r,cwd:l,selectedPath:i,revealRequest:n,onTabChange:o,onSelectPath:t,onClose:p}){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:p,"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:n}):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{C as default};
1
+ import{j as e}from"./index-DKm9ESDq.js";import{F as d}from"./FilePreview-CevPpP6E.js";import m from"./FileTree-CagcHV1N.js";import{X as f}from"./x-DP1nC4qG.js";import"./artifact-links-73OZyi5W.js";import"./rotate-ccw-O4wnfQP7.js";import"./loader-circle-DIW9tlEz.js";import"./trash-2-BrfgMjfL.js";import"./download-D3xZPWnZ.js";import"./file-types-DKkhMnUV.js";import"./chevron-down-DhZV290h.js";function C({open:a,tab:s,gateway:r,cwd:l,selectedPath:i,revealRequest:n,onTabChange:o,onSelectPath:t,onClose:p}){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:p,"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:n}):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{C as default};
@@ -1,4 +1,4 @@
1
- import{r as a,b as p,j as e}from"./index-B_qrzBSm.js";import{F as w}from"./page-BJynASYd.js";import{R as y}from"./rotate-cw-CV6TU7ho.js";import"./RunningSessionsIcon-DRhO-CVq.js";import"./x-8eDWe1V2.js";import"./chevron-down-DuxUTH_N.js";import"./artifact-links-BWD7xpfV.js";import"./trash-2-Drt7yRIe.js";import"./external-link-D0ZU8y72.js";import"./clipboard-BvwmdR4z.js";import"./CollaborationTabBridge-Dxq4G1Uk.js";import"./SessionDashboardBridge--lNIU1u6.js";import"./RemoteDesktopTabBridge-Cp9mLtcY.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 P({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,b as p,j as e}from"./index-DKm9ESDq.js";import{F as w}from"./page-BG97oPXr.js";import{R as y}from"./rotate-cw-CCJtlAtB.js";import"./RunningSessionsIcon-B8Cr2-hp.js";import"./x-DP1nC4qG.js";import"./chevron-down-DhZV290h.js";import"./artifact-links-73OZyi5W.js";import"./trash-2-BrfgMjfL.js";import"./external-link-Cwu5rEgp.js";import"./clipboard-BvwmdR4z.js";import"./CollaborationTabBridge-Dxq4G1Uk.js";import"./SessionDashboardBridge-Bx4EXtos.js";import"./RemoteDesktopTabBridge-Cp9mLtcY.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 P({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,4 +1,4 @@
1
- import{r as l,j as e}from"./index-B_qrzBSm.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-DKm9ESDq.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-B_qrzBSm.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-DKm9ESDq.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-B_qrzBSm.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-DKm9ESDq.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 as t,u as a,j as u}from"./index-B_qrzBSm.js";import l from"./BrowserLivePanel-BvXuMltx.js";import{R as f,a as d,b as w,r as g}from"./RemoteDesktopTabBridge-Cp9mLtcY.js";import"./loader-circle-CkN6rr8Q.js";import"./chevron-down-DuxUTH_N.js";import"./clipboard-BvwmdR4z.js";import"./rotate-ccw-CFOlggPt.js";import"./x-8eDWe1V2.js";import"./zoom-out-CKWUyj9b.js";import"./external-link-D0ZU8y72.js";function x(){const[s,n]=t.useState(!1),[m,i]=t.useState(!1),[r,p]=t.useState(a.getState().skin);t.useEffect(()=>a.subscribe(e=>p(e.skin)),[]),t.useEffect(()=>{document.documentElement.dataset.skin=r,document.body.dataset.remoteDesktop="1"},[r]),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 c=t.useCallback(e=>{window.parent.postMessage({type:d,fullscreen:e},location.origin)},[]);return u.jsx(l,{onFullscreenChange:c,open:m,active:s,onClose:()=>{i(!1),n(!1),window.parent.postMessage({type:w},location.origin)}})}export{x as default};
1
+ import{r as t,u as a,j as u}from"./index-DKm9ESDq.js";import l from"./BrowserLivePanel-CU_X6OU2.js";import{R as f,a as d,b as w,r as g}from"./RemoteDesktopTabBridge-Cp9mLtcY.js";import"./loader-circle-DIW9tlEz.js";import"./chevron-down-DhZV290h.js";import"./clipboard-BvwmdR4z.js";import"./rotate-ccw-O4wnfQP7.js";import"./x-DP1nC4qG.js";import"./zoom-out-Dg7YyzcP.js";import"./external-link-Cwu5rEgp.js";function x(){const[s,n]=t.useState(!1),[m,i]=t.useState(!1),[r,p]=t.useState(a.getState().skin);t.useEffect(()=>a.subscribe(e=>p(e.skin)),[]),t.useEffect(()=>{document.documentElement.dataset.skin=r,document.body.dataset.remoteDesktop="1"},[r]),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 c=t.useCallback(e=>{window.parent.postMessage({type:d,fullscreen:e},location.origin)},[]);return u.jsx(l,{onFullscreenChange:c,open:m,active:s,onClose:()=>{i(!1),n(!1),window.parent.postMessage({type:w},location.origin)}})}export{x as default};
@@ -1,4 +1,4 @@
1
- import{c as e}from"./index-B_qrzBSm.js";/**
1
+ import{c as e}from"./index-DKm9ESDq.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 I,r as u,d as L,j as s,k as O,l as v,u as z,R as P,P as U,A}from"./index-B_qrzBSm.js";import{b as G}from"./SessionDashboardBridge--lNIU1u6.js";import{p as y,D as R,P as q}from"./session-dashboard-B_G9IZRa.js";import{c as S,U as C,A as N,D as B}from"./collaboration-B0sTZDns.js";import{X as _}from"./x-8eDWe1V2.js";import{A as k}from"./arrow-right-CED95s1t.js";import{C as E}from"./chevron-down-DuxUTH_N.js";import{S as V}from"./shield-check-C_XCddHW.js";/**
1
+ import{c as I,r as u,d as L,j as s,k as O,l as v,u as z,R as P,P as U,A}from"./index-DKm9ESDq.js";import{b as G}from"./SessionDashboardBridge-Bx4EXtos.js";import{p as y,D as R,P as q}from"./session-dashboard-BigU92sz.js";import{c as S,U as C,A as N,D as B}from"./collaboration-CQhzjwS_.js";import{X as _}from"./x-DP1nC4qG.js";import{A as k}from"./arrow-right-Cqqb1zqH.js";import{C as E}from"./chevron-down-DhZV290h.js";import{S as V}from"./shield-check-CrjI2wPR.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-B_qrzBSm.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-DKm9ESDq.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,4 +1,4 @@
1
- import{r as c,j as e}from"./index-B_qrzBSm.js";import{u as ee,A as te}from"./App-Cm4c_ukZ.js";import"./loader-circle-CkN6rr8Q.js";import"./chevron-down-DuxUTH_N.js";import"./file-types-Bv8xIlsm.js";import"./trash-2-Drt7yRIe.js";import"./artifact-links-BWD7xpfV.js";import"./composer-file-routing-BrWLenKF.js";import"./x-8eDWe1V2.js";import"./clipboard-BvwmdR4z.js";import"./RunningSessionsIcon-DRhO-CVq.js";import"./zoom-out-CKWUyj9b.js";import"./rotate-ccw-CFOlggPt.js";import"./download-DNa5KRtu.js";import"./session-dashboard-B_G9IZRa.js";import"./SessionDashboardBridge--lNIU1u6.js";import"./collaboration-B0sTZDns.js";import"./CollaborationCreateDialog-0xwWJVAB.js";import"./types-BOD4WqhS.js";import"./CollaborationTabBridge-Dxq4G1Uk.js";import"./rotate-cw-CV6TU7ho.js";function se(s){if(!s.trim())return null;const i=Number(s);return Number.isSafeInteger(i)&&i>=0?i:null}const oe=()=>({id:"",name:"",enabled:!0,allowedTools:[],filesystem:{readRoots:[],writeRoots:[],followSymlinks:!1},commands:{mode:"deny",programs:[],inheritedEnvironment:[]},network:"deny",limits:{timeoutMs:12e4,maxOutputBytes:1048576}});function ne({onNotice:s}){const[i,p]=c.useState([]),[l,S]=c.useState([]),[t,n]=c.useState(null),[x,h]=c.useState(!1),w=c.useMemo(()=>[...l].sort(),[l]),N=async()=>{var a;if(!((a=window.agentApi)!=null&&a.listToolPolicies))return;const o=await window.agentApi.listToolPolicies();p(o.policies),S(o.tools)};c.useEffect(()=>{N().catch(o=>s(String(o),"error"))},[]);const D=async()=>{var o;if(!(!t||!((o=window.agentApi)!=null&&o.saveToolPolicy)))try{await window.agentApi.saveToolPolicy(t,x),await N(),n(null),s("工具策略已保存","success")}catch(a){s(a instanceof Error?a.message:"工具策略保存失败","error")}},_=async o=>{var a;if((a=window.agentApi)!=null&&a.deleteToolPolicy)try{await window.agentApi.deleteToolPolicy(o),await N(),(t==null?void 0:t.id)===o&&n(null),s("工具策略已删除","success")}catch(v){s(v instanceof Error?v.message:"工具策略删除失败","error")}};return e.jsxs("section",{className:"tool-policy-manager",children:[e.jsxs("div",{className:"settings-head-row",children:[e.jsx("h3",{children:"工具执行策略"}),e.jsx("button",{type:"button",className:"tool-policy-button",onClick:()=>{n(oe()),h(!1)},children:"+ 添加"})]}),e.jsxs("div",{className:"tool-policy-list",children:[i.map(o=>e.jsxs("div",{className:"tool-policy-row",children:[e.jsxs("div",{children:[e.jsx("strong",{children:o.name}),e.jsxs("small",{children:[o.id," · ",o.enabled?"已启用":"已停用"]})]}),e.jsxs("div",{className:"tool-policy-actions",children:[e.jsx("button",{type:"button",onClick:()=>{n(structuredClone(o)),h(!0)},children:"编辑"}),e.jsx("button",{type:"button",className:"is-danger",onClick:()=>void _(o.id),children:"删除"})]})]},o.id)),i.length===0&&e.jsx("div",{className:"tool-policy-empty",children:"暂无工具执行策略"})]}),t&&e.jsxs("div",{className:"tool-policy-form",children:[e.jsxs("div",{className:"tool-policy-grid two",children:[e.jsx(m,{label:"策略 ID",children:e.jsx("input",{value:t.id,disabled:x,onChange:o=>n({...t,id:o.target.value})})}),e.jsx(m,{label:"名称",children:e.jsx("input",{value:t.name,onChange:o=>n({...t,name:o.target.value})})})]}),e.jsxs("label",{className:"tool-policy-check",children:[e.jsx("input",{type:"checkbox",checked:t.enabled,onChange:o=>n({...t,enabled:o.target.checked})}),"启用"]}),e.jsx(m,{label:"允许的工具",children:e.jsx("div",{className:"tool-policy-tools",children:w.map(o=>e.jsxs("label",{children:[e.jsx("input",{type:"checkbox",checked:t.allowedTools.includes(o),onChange:()=>n({...t,allowedTools:ie(t.allowedTools,o)})}),o]},o))})}),e.jsxs("div",{className:"tool-policy-grid two",children:[e.jsx(m,{label:"只读根目录(每行一个)",children:e.jsx("textarea",{value:t.filesystem.readRoots.join(`
1
+ import{r as c,j as e}from"./index-DKm9ESDq.js";import{u as ee,A as te}from"./App-zihaYk1L.js";import"./loader-circle-DIW9tlEz.js";import"./chevron-down-DhZV290h.js";import"./file-types-DKkhMnUV.js";import"./trash-2-BrfgMjfL.js";import"./composer-file-routing-D9orqwzY.js";import"./artifact-links-73OZyi5W.js";import"./x-DP1nC4qG.js";import"./clipboard-BvwmdR4z.js";import"./RunningSessionsIcon-B8Cr2-hp.js";import"./zoom-out-Dg7YyzcP.js";import"./rotate-ccw-O4wnfQP7.js";import"./download-D3xZPWnZ.js";import"./session-dashboard-BigU92sz.js";import"./SessionDashboardBridge-Bx4EXtos.js";import"./collaboration-CQhzjwS_.js";import"./CollaborationCreateDialog-BmgYdwe7.js";import"./types-VnQ_cKrp.js";import"./CollaborationTabBridge-Dxq4G1Uk.js";import"./rotate-cw-CCJtlAtB.js";function se(s){if(!s.trim())return null;const i=Number(s);return Number.isSafeInteger(i)&&i>=0?i:null}const oe=()=>({id:"",name:"",enabled:!0,allowedTools:[],filesystem:{readRoots:[],writeRoots:[],followSymlinks:!1},commands:{mode:"deny",programs:[],inheritedEnvironment:[]},network:"deny",limits:{timeoutMs:12e4,maxOutputBytes:1048576}});function ne({onNotice:s}){const[i,p]=c.useState([]),[l,S]=c.useState([]),[t,n]=c.useState(null),[x,h]=c.useState(!1),w=c.useMemo(()=>[...l].sort(),[l]),N=async()=>{var a;if(!((a=window.agentApi)!=null&&a.listToolPolicies))return;const o=await window.agentApi.listToolPolicies();p(o.policies),S(o.tools)};c.useEffect(()=>{N().catch(o=>s(String(o),"error"))},[]);const D=async()=>{var o;if(!(!t||!((o=window.agentApi)!=null&&o.saveToolPolicy)))try{await window.agentApi.saveToolPolicy(t,x),await N(),n(null),s("工具策略已保存","success")}catch(a){s(a instanceof Error?a.message:"工具策略保存失败","error")}},_=async o=>{var a;if((a=window.agentApi)!=null&&a.deleteToolPolicy)try{await window.agentApi.deleteToolPolicy(o),await N(),(t==null?void 0:t.id)===o&&n(null),s("工具策略已删除","success")}catch(v){s(v instanceof Error?v.message:"工具策略删除失败","error")}};return e.jsxs("section",{className:"tool-policy-manager",children:[e.jsxs("div",{className:"settings-head-row",children:[e.jsx("h3",{children:"工具执行策略"}),e.jsx("button",{type:"button",className:"tool-policy-button",onClick:()=>{n(oe()),h(!1)},children:"+ 添加"})]}),e.jsxs("div",{className:"tool-policy-list",children:[i.map(o=>e.jsxs("div",{className:"tool-policy-row",children:[e.jsxs("div",{children:[e.jsx("strong",{children:o.name}),e.jsxs("small",{children:[o.id," · ",o.enabled?"已启用":"已停用"]})]}),e.jsxs("div",{className:"tool-policy-actions",children:[e.jsx("button",{type:"button",onClick:()=>{n(structuredClone(o)),h(!0)},children:"编辑"}),e.jsx("button",{type:"button",className:"is-danger",onClick:()=>void _(o.id),children:"删除"})]})]},o.id)),i.length===0&&e.jsx("div",{className:"tool-policy-empty",children:"暂无工具执行策略"})]}),t&&e.jsxs("div",{className:"tool-policy-form",children:[e.jsxs("div",{className:"tool-policy-grid two",children:[e.jsx(m,{label:"策略 ID",children:e.jsx("input",{value:t.id,disabled:x,onChange:o=>n({...t,id:o.target.value})})}),e.jsx(m,{label:"名称",children:e.jsx("input",{value:t.name,onChange:o=>n({...t,name:o.target.value})})})]}),e.jsxs("label",{className:"tool-policy-check",children:[e.jsx("input",{type:"checkbox",checked:t.enabled,onChange:o=>n({...t,enabled:o.target.checked})}),"启用"]}),e.jsx(m,{label:"允许的工具",children:e.jsx("div",{className:"tool-policy-tools",children:w.map(o=>e.jsxs("label",{children:[e.jsx("input",{type:"checkbox",checked:t.allowedTools.includes(o),onChange:()=>n({...t,allowedTools:ie(t.allowedTools,o)})}),o]},o))})}),e.jsxs("div",{className:"tool-policy-grid two",children:[e.jsx(m,{label:"只读根目录(每行一个)",children:e.jsx("textarea",{value:t.filesystem.readRoots.join(`
2
2
  `),onChange:o=>n({...t,filesystem:{...t.filesystem,readRoots:U(o.target.value)}})})}),e.jsx(m,{label:"可写根目录(每行一个)",children:e.jsx("textarea",{value:t.filesystem.writeRoots.join(`
3
3
  `),onChange:o=>n({...t,filesystem:{...t.filesystem,writeRoots:U(o.target.value)}})})})]}),e.jsxs("label",{className:"tool-policy-check",children:[e.jsx("input",{type:"checkbox",checked:t.filesystem.followSymlinks,onChange:o=>n({...t,filesystem:{...t.filesystem,followSymlinks:o.target.checked}})}),"允许根目录内符号链接"]}),e.jsxs("div",{className:"tool-policy-grid three",children:[e.jsx(m,{label:"命令模式",children:e.jsxs("select",{value:t.commands.mode,onChange:o=>n({...t,commands:{...t.commands,mode:o.target.value}}),children:[e.jsx("option",{value:"deny",children:"禁止"}),e.jsx("option",{value:"allowlist",children:"白名单"}),e.jsx("option",{value:"unrestricted",children:"不限制"})]})}),e.jsx(m,{label:"网络模式",children:e.jsxs("select",{value:t.network,onChange:o=>n({...t,network:o.target.value}),children:[e.jsx("option",{value:"deny",children:"禁止"}),e.jsx("option",{value:"read-only",children:"只读"}),e.jsx("option",{value:"allow",children:"允许"})]})}),e.jsx(m,{label:"继承环境变量",children:e.jsx("input",{value:t.commands.inheritedEnvironment.join(", "),onChange:o=>n({...t,commands:{...t.commands,inheritedEnvironment:C(o.target.value)}})})})]}),t.commands.mode==="allowlist"&&e.jsxs("div",{className:"tool-policy-programs",children:[e.jsxs("div",{className:"settings-head-row",children:[e.jsx("h4",{children:"允许的程序"}),e.jsx("button",{type:"button",onClick:()=>n({...t,commands:{...t.commands,programs:[...t.commands.programs,{executable:""}]}}),children:"+ 程序"})]}),t.commands.programs.map((o,a)=>e.jsx(re,{program:o,onChange:v=>n({...t,commands:{...t.commands,programs:ae(t.commands.programs,a,v)}}),onDelete:()=>n({...t,commands:{...t.commands,programs:t.commands.programs.filter((v,j)=>j!==a)}})},a))]}),e.jsxs("div",{className:"tool-policy-grid two",children:[e.jsx(m,{label:"超时(毫秒)",children:e.jsx("input",{type:"number",min:100,max:6e5,value:t.limits.timeoutMs,onChange:o=>n({...t,limits:{...t.limits,timeoutMs:Number(o.target.value)}})})}),e.jsx(m,{label:"最大输出(字节)",children:e.jsx("input",{type:"number",min:1024,max:10485760,value:t.limits.maxOutputBytes,onChange:o=>n({...t,limits:{...t.limits,maxOutputBytes:Number(o.target.value)}})})})]}),e.jsxs("div",{className:"tool-policy-actions",children:[e.jsx("button",{type:"button",className:"is-primary",onClick:()=>void D(),children:"保存策略"}),e.jsx("button",{type:"button",onClick:()=>n(null),children:"取消"})]})]})]})}function re({program:s,onChange:i,onDelete:p}){return e.jsxs("div",{className:"tool-policy-program",children:[e.jsxs("div",{className:"tool-policy-grid two",children:[e.jsx(m,{label:"可执行文件",children:e.jsx("input",{value:s.executable,onChange:l=>i({...s,executable:l.target.value})})}),e.jsx(m,{label:"子命令",children:e.jsx("input",{value:(s.subcommands??[]).join(", "),onChange:l=>i({...s,subcommands:C(l.target.value)})})})]}),e.jsxs("div",{className:"tool-policy-grid three",children:[e.jsx(m,{label:"允许参数",children:e.jsx("input",{value:(s.allowedFlags??[]).join(", "),onChange:l=>i({...s,allowedFlags:C(l.target.value)})})}),e.jsx(m,{label:"禁止参数",children:e.jsx("input",{value:(s.deniedFlags??[]).join(", "),onChange:l=>i({...s,deniedFlags:C(l.target.value)})})}),e.jsx(m,{label:"路径参数",children:e.jsx("input",{value:(s.pathFlags??[]).join(", "),onChange:l=>i({...s,pathFlags:C(l.target.value)})})})]}),e.jsxs("div",{className:"tool-policy-program-footer",children:[e.jsx(m,{label:"位置路径索引",children:e.jsx("input",{value:(s.positionalPathIndexes??[]).join(", "),onChange:l=>i({...s,positionalPathIndexes:C(l.target.value).map(Number)})})}),e.jsx("button",{type:"button",className:"is-danger",onClick:p,children:"删除程序"})]})]})}function m({label:s,children:i}){return e.jsxs("label",{className:"tool-policy-field",children:[e.jsx("span",{children:s}),i]})}function U(s){return s.split(`
4
4
  `).map(i=>i.trim()).filter(Boolean)}function C(s){return s.split(",").map(i=>i.trim()).filter(Boolean)}function ie(s,i){return s.includes(i)?s.filter(p=>p!==i):[...s,i]}function ae(s,i,p){return s.map((l,S)=>S===i?p:l)}const le=[{value:"anthropic",label:"Anthropic"},{value:"openai",label:"OpenAI"},{value:"deepseek",label:"DeepSeek"},{value:"aihub",label:"AI Hub(网页版)"}],H={anthropic:"claude-sonnet-4-6",openai:"gpt-4o",deepseek:"deepseek-chat",aihub:"deepseek"},R={anthropic:120,openai:300,deepseek:300,aihub:240};function L(){return{name:"",provider:"anthropic",modelId:"claude-sonnet-4-6",apiKey:"",baseUrl:"",maxOutputTokens:16384,requestTimeoutSeconds:R.anthropic}}function Re(){const{maxIterations:s,contextWindow:i,isConfigured:p,profiles:l,activeProfileId:S,taskNotifications:t,setField:n,loadFromSystem:x,saveToSystem:h,addProfile:w,updateProfile:N,deleteProfile:D,switchActiveProfile:_}=ee(),[o,a]=c.useState(null),[v,j]=c.useState("success"),[y,k]=c.useState(null),[W,K]=c.useState(String(s)),[B,M]=c.useState(String(Math.round((i??100)*1e3)));c.useEffect(()=>{K(String(s))},[s]),c.useEffect(()=>{M(String(Math.round((i??100)*1e3)))},[i]);const[T,A]=c.useState(null),[z,E]=c.useState(!1),[u,P]=c.useState(L());c.useEffect(()=>{x()},[]),c.useEffect(()=>{if(!y)return;const r=window.setTimeout(()=>k(null),y.type==="error"?4e3:2500);return()=>window.clearTimeout(r)},[y]);const G=()=>{E(!0),A(null),P(L())},J=r=>{E(!1),A(r.id),P({name:r.name,provider:r.provider,modelId:r.modelId,apiKey:["managed","__agentroam_stored_secret__"].includes(r.apiKey)?"":r.apiKey,baseUrl:r.baseUrl,maxOutputTokens:r.maxOutputTokens??16384,requestTimeoutSeconds:r.requestTimeoutSeconds??R[r.provider]??300})},F=()=>{A(null),E(!1)},q=async()=>{const r=u.provider!=="aihub",d=T?l.find(I=>I.id===T):void 0,g=d?["managed","__agentroam_stored_secret__"].includes(d.apiKey):!1;if(!u.name.trim()||r&&!u.apiKey.trim()&&!g||!u.modelId.trim()){a(r?"名称、API Key 和模型 ID 为必填项":"名称和模型 ID(AI Hub 站点 ID)为必填项"),j("error");return}if(u.maxOutputTokens!==void 0&&(!Number.isInteger(u.maxOutputTokens)||u.maxOutputTokens<256||u.maxOutputTokens>131072)){a("单轮最大输出请输入 256 到 131072 之间的整数 tokens"),j("error");return}if(u.requestTimeoutSeconds!==void 0&&(!Number.isInteger(u.requestTimeoutSeconds)||u.requestTimeoutSeconds<30||u.requestTimeoutSeconds>1800)){a("单次请求超时请输入 30 到 1800 之间的整数秒"),j("error");return}try{z?w(u):T&&N(T,u),await h(),A(null),E(!1),a(null),k({message:"模型配置保存成功",type:"success"})}catch(I){k({message:I instanceof Error?I.message:"模型配置保存失败",type:"error"})}},Q=async r=>{D(r),setTimeout(()=>h(),0)},X=async r=>{await _(r),a("已切换模型"),j("success"),setTimeout(()=>a(null),1500)},Y=async()=>{a(null);const r=se(W);if(r===null){a("最大迭代次数不能为空,请输入非负整数;0 表示无限制。"),j("error");return}const d=Number(B);if(!Number.isInteger(d)||d<1024||d>2e6){a("上下文窗口请输入 1024 到 2000000 之间的整数 tokens,例如 8192。"),j("error");return}n("maxIterations",r),n("contextWindow",d/1e3);try{await h(),a(null),k({message:"设置保存成功",type:"success"})}catch(g){k({message:g instanceof Error?g.message:"设置保存失败",type:"error"})}},Z=z||T!==null;return e.jsxs("div",{style:{padding:"40px 48px",maxWidth:640,animation:"fadeInUp 0.4s var(--ease-out)"},children:[e.jsx("h2",{style:{fontFamily:"var(--font-display)",fontSize:28,color:"var(--text-primary)",fontWeight:400,marginBottom:8,letterSpacing:"-0.02em"},children:"设置"}),e.jsx("p",{style:{color:"var(--text-muted)",fontSize:14,marginBottom:36},children:"管理模型提供商和运行参数。工作目录在项目设置中配置。"}),e.jsxs("section",{style:{marginBottom:40},children:[e.jsxs("div",{className:"settings-head-row",style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:14},children:[e.jsx("h3",{style:{fontSize:13,fontWeight:600,color:"var(--text-secondary)",textTransform:"uppercase",letterSpacing:"0.06em",margin:0},children:"模型提供商"}),e.jsx("button",{onClick:G,style:ce,children:"+ 添加"})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[l.length===0&&!Z&&e.jsx("div",{style:{padding:"20px 16px",borderRadius:"var(--radius-sm)",border:"1px dashed var(--border-subtle)",textAlign:"center",color:"var(--text-muted)",fontSize:13},children:"暂无配置,点击「+ 添加」创建第一个模型提供商"}),l.map(r=>{const d=r.id===S,g=r.id===T,I=["managed","__agentroam_stored_secret__"].includes(r.apiKey);return e.jsxs("div",{style:{borderRadius:"var(--radius-sm)",border:`1px solid ${d?"var(--accent)":"var(--border-default)"}`,background:d?"var(--accent-dim)":"var(--bg-surface)",overflow:"hidden",transition:"border-color 0.2s"},children:[e.jsxs("div",{className:"profile-row",style:{display:"flex",alignItems:"center",gap:10,padding:"10px 14px"},children:[e.jsx("span",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.08em",textTransform:"uppercase",padding:"2px 7px",borderRadius:4,background:d?"var(--accent)":"var(--bg-deep)",color:d?"#fff":"var(--text-muted)",flexShrink:0},children:r.provider}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontSize:14,fontWeight:600,color:"var(--text-primary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r.name||r.modelId}),e.jsx("div",{style:{fontSize:12,color:"var(--text-muted)",marginTop:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r.modelId})]}),d&&e.jsx("span",{style:{fontSize:11,color:"var(--accent)",fontWeight:600,flexShrink:0},children:"● 使用中"}),e.jsxs("div",{className:"profile-row-actions",style:{display:"flex",gap:6,flexShrink:0},children:[!d&&e.jsx("button",{onClick:()=>X(r.id),style:O,children:"切换"}),e.jsx("button",{onClick:()=>g?F():J(r),style:O,children:g?"收起":"编辑"}),e.jsx("button",{onClick:()=>Q(r.id),style:{...O,color:"var(--danger)",borderColor:"rgba(244,63,94,0.25)"},children:"删除"})]})]}),g&&e.jsx(V,{draft:u,setDraft:P,hasStoredApiKey:I,onSave:q,onCancel:F})]},r.id)}),z&&e.jsxs("div",{style:{borderRadius:"var(--radius-sm)",border:"1px solid var(--accent)",background:"var(--bg-surface)"},children:[e.jsx("div",{style:{padding:"10px 14px 0",fontSize:13,fontWeight:600,color:"var(--accent)"},children:"新建提供商"}),e.jsx(V,{draft:u,setDraft:P,hasStoredApiKey:!1,onSave:q,onCancel:F})]})]})]}),e.jsxs("section",{children:[e.jsx("h3",{style:{fontSize:13,fontWeight:600,color:"var(--text-secondary)",textTransform:"uppercase",letterSpacing:"0.06em",marginBottom:14},children:"常规"}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[e.jsxs(b,{label:"最大迭代次数",children:[e.jsx("input",{type:"number",value:W,onChange:r=>K(r.target.value),min:0,step:1,style:f}),e.jsx("div",{style:{fontSize:12,opacity:.65},children:"输入 0 表示不限制迭代次数。"})]}),e.jsxs(b,{label:"上下文窗口(tokens,输入与输出合计)",children:[e.jsx("input",{type:"number",value:B,onChange:r=>M(r.target.value),min:1024,max:2e6,step:1,style:f}),e.jsx("div",{style:{fontSize:12,opacity:.65},children:"8K 模型填 8192;不能超过模型服务实际启动的上下文大小。"})]})]})]}),e.jsxs("section",{style:{marginTop:40},children:[e.jsx("h3",{style:{fontSize:13,fontWeight:600,color:"var(--text-secondary)",textTransform:"uppercase",letterSpacing:"0.06em",marginBottom:14},children:"任务完成提醒"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[["completionEnabled","任务完成通知"],["soundEnabled","播放提示音"],["notifyWhileForeground","前台运行时也通知"]].map(([r,d])=>e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:10,color:"var(--text-primary)",fontSize:14},children:[e.jsx("input",{type:"checkbox",checked:t[r],onChange:g=>n("taskNotifications",{...t,[r]:g.target.checked})}),d]},r))})]}),e.jsx(ne,{onNotice:(r,d)=>k({message:r,type:d})}),e.jsxs("div",{style:{marginTop:28,display:"flex",gap:14,alignItems:"center"},children:[e.jsx("button",{onClick:Y,style:$,children:"保存"}),e.jsx("span",{style:{padding:"7px 14px",borderRadius:"var(--radius-sm)",fontSize:12,fontWeight:500,background:p?"rgba(52,211,153,0.1)":"rgba(255,255,255,0.04)",color:p?"var(--success)":"var(--text-muted)",border:`1px solid ${p?"rgba(52,211,153,0.2)":"var(--border-subtle)"}`},children:p?"● 已连接":"○ 未配置"})]}),o&&e.jsx("div",{style:{marginTop:12,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},children:o}),e.jsx(te,{message:(y==null?void 0:y.message)??null,type:(y==null?void 0:y.type)??"success"})]})}function V({draft:s,setDraft:i,hasStoredApiKey:p,onSave:l,onCancel:S}){const t=(n,x)=>i(h=>{const w={...h,[n]:x};return n==="provider"&&!h.modelId&&(w.modelId=H[x]??""),w});return e.jsxs("div",{style:{padding:"12px 14px 14px",display:"flex",flexDirection:"column",gap:12},children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:10},children:[e.jsx(b,{label:"名称",children:e.jsx("input",{value:s.name,onChange:n=>t("name",n.target.value),placeholder:"我的 Claude",style:f})}),e.jsx(b,{label:"提供商",children:e.jsx("select",{value:s.provider,onChange:n=>{const x=n.target.value;i(h=>({...h,provider:x,modelId:H[x]??"",requestTimeoutSeconds:R[x]??300}))},style:f,children:le.map(n=>e.jsx("option",{value:n.value,children:n.label},n.value))})})]}),e.jsx(b,{label:"模型 ID",children:e.jsx("input",{value:s.modelId,onChange:n=>t("modelId",n.target.value),placeholder:s.provider==="aihub"?"deepseek":"claude-sonnet-4-6",style:f})}),e.jsx(b,{label:"单轮最大输出(tokens)",children:e.jsx("input",{type:"number",value:s.maxOutputTokens??16384,onChange:n=>i(x=>({...x,maxOutputTokens:Number(n.target.value)})),min:256,max:131072,step:1024,style:f})}),e.jsx(b,{label:"单次请求超时(秒)",children:e.jsx("input",{type:"number",value:s.requestTimeoutSeconds??R[s.provider]??300,onChange:n=>i(x=>({...x,requestTimeoutSeconds:Number(n.target.value)})),min:30,max:1800,step:30,style:f})}),s.provider==="aihub"?e.jsx("div",{style:{padding:"8px 10px",background:"rgba(96,165,250,0.08)",border:"1px solid rgba(96,165,250,0.2)",borderRadius:8,fontSize:12,lineHeight:1.6},children:"AI Hub 网页模型来源:模型 ID 填 AI Hub 站点 ID(deepseek / chatgpt / gemini / grok 或自定义站点),无需 API Key。 运行时由桌面端 AI Hub 把上下文模拟人为发送给该站点并抓取回复;支持通过受控 JSON 协议调用 Agent 工具。需要桌面 App 在线且站点已登录。"}):e.jsxs(e.Fragment,{children:[e.jsx(b,{label:"API 密钥",children:e.jsx("input",{type:"password",value:s.apiKey,onChange:n=>t("apiKey",n.target.value),placeholder:p?"••••••••••••":"sk-...","aria-label":p?"API 密钥(已保存)":"API 密钥",style:f})}),e.jsx(b,{label:"接口地址(可选)",children:e.jsx("input",{value:s.baseUrl,onChange:n=>t("baseUrl",n.target.value),placeholder:"https://api.anthropic.com",style:f})})]}),e.jsxs("div",{style:{display:"flex",gap:8,marginTop:2},children:[e.jsx("button",{onClick:l,style:$,children:"保存"}),e.jsx("button",{onClick:S,style:de,children:"取消"})]})]})}function b({label:s,children:i}){return e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",fontSize:12,color:"var(--text-secondary)",marginBottom:6,fontWeight:500,textTransform:"uppercase",letterSpacing:"0.06em"},children:s}),i]})}const f={width:"100%",padding:"9px 12px",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)",boxSizing:"border-box"},$={padding:"11px 28px",borderRadius:"var(--radius-sm)",border:"1px solid transparent",background:"var(--accent)",color:"var(--text-inverse)",fontSize:14,fontWeight:600,cursor:"pointer",fontFamily:"var(--font-body)",boxShadow:"0 2px 16px var(--accent-glow)",transition:"transform 0.15s var(--ease-out), box-shadow 0.15s var(--ease-out)"},de={padding:"11px 16px",borderRadius:"var(--radius-sm)",border:"1px solid var(--border-default)",background:"var(--bg-glass)",color:"var(--text-secondary)",fontSize:14,fontWeight:500,cursor:"pointer",fontFamily:"var(--font-body)",whiteSpace:"nowrap",transition:"all 0.15s var(--ease-out)"},ce={padding:"6px 14px",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)"},O={padding:"4px 10px",borderRadius:6,border:"1px solid var(--border-subtle)",background:"transparent",color:"var(--text-muted)",fontSize:12,cursor:"pointer",fontFamily:"var(--font-body)"};export{Re as default};