agentroam-runtime-darwin-arm64 0.2.0-preview.76 → 0.2.0-preview.77

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 (319) hide show
  1. package/manifest.json +2 -2
  2. package/package.json +1 -1
  3. package/runtime/.next/BUILD_ID +1 -1
  4. package/runtime/.next/app-path-routes-manifest.json +1 -1
  5. package/runtime/.next/build-manifest.json +2 -2
  6. package/runtime/.next/prerender-manifest.json +1 -1
  7. package/runtime/.next/server/app/_not-found.html +1 -1
  8. package/runtime/.next/server/app/_not-found.rsc +1 -1
  9. package/runtime/.next/server/app/api/agent/abort/route.js +1 -1
  10. package/runtime/.next/server/app/api/agent/abort/route.js.nft.json +1 -1
  11. package/runtime/.next/server/app/api/agent/answer/route.js +1 -1
  12. package/runtime/.next/server/app/api/agent/answer/route.js.nft.json +1 -1
  13. package/runtime/.next/server/app/api/agent/codex-sharing/route.js +1 -1
  14. package/runtime/.next/server/app/api/agent/harness/status/route.js +1 -1
  15. package/runtime/.next/server/app/api/agent/harness/status/route.js.nft.json +1 -1
  16. package/runtime/.next/server/app/api/agent/model/route.js +1 -1
  17. package/runtime/.next/server/app/api/agent/model/route.js.nft.json +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/run/route.js.nft.json +1 -1
  21. package/runtime/.next/server/app/api/agent/runtime-health/route.js +1 -1
  22. package/runtime/.next/server/app/api/agent/steer/route.js +1 -1
  23. package/runtime/.next/server/app/api/agent/steer/route.js.nft.json +1 -1
  24. package/runtime/.next/server/app/api/agent/stream/route.js +3 -3
  25. package/runtime/.next/server/app/api/agent/stream/route.js.nft.json +1 -1
  26. package/runtime/.next/server/app/api/agent-workspaces/[workspaceId]/sessions/route.js +1 -1
  27. package/runtime/.next/server/app/api/agent-workspaces/[workspaceId]/sessions/route.js.nft.json +1 -1
  28. package/runtime/.next/server/app/api/agent-workspaces/route.js +1 -1
  29. package/runtime/.next/server/app/api/agent-workspaces/route.js.nft.json +1 -1
  30. package/runtime/.next/server/app/api/business/route.js +1 -1
  31. package/runtime/.next/server/app/api/business/route.js.nft.json +1 -1
  32. package/runtime/.next/server/app/api/calendar/route.js +2 -2
  33. package/runtime/.next/server/app/api/client-logs/route.js +1 -1
  34. package/runtime/.next/server/app/api/collaboration/route.js +4 -4
  35. package/runtime/.next/server/app/api/collaboration/route.js.nft.json +1 -1
  36. package/runtime/.next/server/app/api/engine-threads/route.js +1 -1
  37. package/runtime/.next/server/app/api/engine-threads.body +1 -1
  38. package/runtime/.next/server/app/api/flow/v1/catalog/route.js +1 -1
  39. package/runtime/.next/server/app/api/flow/v1/catalog/route.js.nft.json +1 -1
  40. package/runtime/.next/server/app/api/flow/v1/runs/[runId]/cancel/route.js +1 -1
  41. package/runtime/.next/server/app/api/flow/v1/runs/[runId]/cancel/route.js.nft.json +1 -1
  42. package/runtime/.next/server/app/api/flow/v1/runs/[runId]/events/route.js +1 -1
  43. package/runtime/.next/server/app/api/flow/v1/runs/[runId]/events/route.js.nft.json +1 -1
  44. package/runtime/.next/server/app/api/flow/v1/runs/route.js +1 -1
  45. package/runtime/.next/server/app/api/flow/v1/runs/route.js.nft.json +1 -1
  46. package/runtime/.next/server/app/api/internal/todo-bootstrap/route.js +1 -4
  47. package/runtime/.next/server/app/api/internal/todo-bootstrap/route.js.nft.json +1 -1
  48. package/runtime/.next/server/app/api/internal/todo-mcp/route.js +1 -1
  49. package/runtime/.next/server/app/api/internal/todo-mcp/route.js.nft.json +1 -1
  50. package/runtime/.next/server/app/api/notifications/[id]/ack/route.js +1 -1
  51. package/runtime/.next/server/app/api/notifications/[id]/ack/route.js.nft.json +1 -1
  52. package/runtime/.next/server/app/api/notifications/[id]/route.js +1 -1
  53. package/runtime/.next/server/app/api/notifications/[id]/route.js.nft.json +1 -1
  54. package/runtime/.next/server/app/api/notifications/route.js +1 -1
  55. package/runtime/.next/server/app/api/notifications/route.js.nft.json +1 -1
  56. package/runtime/.next/server/app/api/notifications/stream/route.js +1 -1
  57. package/runtime/.next/server/app/api/notifications/stream/route.js.nft.json +1 -1
  58. package/runtime/.next/server/app/api/plugins/load/route.js +1 -1
  59. package/runtime/.next/server/app/api/plugins/load/route.js.nft.json +1 -1
  60. package/runtime/.next/server/app/api/push/subscribe/route.js +2 -2
  61. package/runtime/.next/server/app/api/push/subscribe/route.js.nft.json +1 -1
  62. package/runtime/.next/server/app/api/push/vapid/route.js +3 -3
  63. package/runtime/.next/server/app/api/push/vapid/route.js.nft.json +1 -1
  64. package/runtime/.next/server/app/api/remote-tools/register/route.js +1 -1
  65. package/runtime/.next/server/app/api/remote-tools/register/route.js.nft.json +1 -1
  66. package/runtime/.next/server/app/api/sessions/[id]/background-jobs/[jobId]/route.js +1 -1
  67. package/runtime/.next/server/app/api/sessions/[id]/background-jobs/[jobId]/stop/route.js +1 -1
  68. package/runtime/.next/server/app/api/sessions/[id]/background-jobs/route.js +1 -1
  69. package/runtime/.next/server/app/api/sessions/[id]/changes/route.js +3 -3
  70. package/runtime/.next/server/app/api/sessions/[id]/engine-switches/route.js +1 -1
  71. package/runtime/.next/server/app/api/sessions/[id]/fork/route.js +1 -1
  72. package/runtime/.next/server/app/api/sessions/[id]/fork/route.js.nft.json +1 -1
  73. package/runtime/.next/server/app/api/sessions/[id]/fork-at/route.js +1 -1
  74. package/runtime/.next/server/app/api/sessions/[id]/fork-at/route.js.nft.json +1 -1
  75. package/runtime/.next/server/app/api/sessions/[id]/goals/route.js +1 -1
  76. package/runtime/.next/server/app/api/sessions/[id]/goals/route.js.nft.json +1 -1
  77. package/runtime/.next/server/app/api/sessions/[id]/handoff/route.js +1 -1
  78. package/runtime/.next/server/app/api/sessions/[id]/native-goal/route.js +1 -1
  79. package/runtime/.next/server/app/api/sessions/[id]/query-index/route.js +1 -1
  80. package/runtime/.next/server/app/api/sessions/[id]/query-index/route.js.nft.json +1 -1
  81. package/runtime/.next/server/app/api/sessions/[id]/release/route.js +1 -1
  82. package/runtime/.next/server/app/api/sessions/[id]/route.js +1 -1
  83. package/runtime/.next/server/app/api/sessions/[id]/route.js.nft.json +1 -1
  84. package/runtime/.next/server/app/api/sessions/[id]/switch-engine/route.js +1 -1
  85. package/runtime/.next/server/app/api/sessions/[id]/thread-goal/route.js +1 -1
  86. package/runtime/.next/server/app/api/sessions/[id]/thread-goal/route.js.nft.json +1 -1
  87. package/runtime/.next/server/app/api/sessions/[id]/thread-history/route.js +1 -1
  88. package/runtime/.next/server/app/api/sessions/[id]/tool-result/route.js +1 -1
  89. package/runtime/.next/server/app/api/sessions/parallel/route.js +1 -1
  90. package/runtime/.next/server/app/api/sessions/parallel/route.js.nft.json +1 -1
  91. package/runtime/.next/server/app/api/sessions/route.js +1 -1
  92. package/runtime/.next/server/app/api/sessions/route.js.nft.json +1 -1
  93. package/runtime/.next/server/app/api/todos/[id]/commands/route.js +1 -1
  94. package/runtime/.next/server/app/api/todos/[id]/commands/route.js.nft.json +1 -1
  95. package/runtime/.next/server/app/api/todos/[id]/executions/route.js +1 -1
  96. package/runtime/.next/server/app/api/todos/[id]/executions/route.js.nft.json +1 -1
  97. package/runtime/.next/server/app/api/todos/[id]/route.js +1 -1
  98. package/runtime/.next/server/app/api/todos/[id]/route.js.nft.json +1 -1
  99. package/runtime/.next/server/app/api/todos/route.js +1 -1
  100. package/runtime/.next/server/app/api/todos/route.js.nft.json +1 -1
  101. package/runtime/.next/server/app/api/tool-policies/[policyId]/route.js +1 -1
  102. package/runtime/.next/server/app/api/tool-policies/[policyId]/route.js.nft.json +1 -1
  103. package/runtime/.next/server/app/api/tool-policies/route.js +1 -1
  104. package/runtime/.next/server/app/api/tool-policies/route.js.nft.json +1 -1
  105. package/runtime/.next/server/app/api/tools/route.js +1 -1
  106. package/runtime/.next/server/app/api/tools/route.js.nft.json +1 -1
  107. package/runtime/.next/server/app-paths-manifest.json +36 -36
  108. package/runtime/.next/server/chunks/535.js +1 -0
  109. package/runtime/.next/server/chunks/5762.js +3 -3
  110. package/runtime/.next/server/chunks/5801.js +1 -1
  111. package/runtime/.next/server/chunks/5812.js +1 -0
  112. package/runtime/.next/server/chunks/685.js +1 -0
  113. package/runtime/.next/server/chunks/9119.js +4 -4
  114. package/runtime/.next/server/chunks/9457.js +1 -4
  115. package/runtime/.next/server/pages/404.html +1 -1
  116. package/runtime/.next/server/pages/500.html +1 -1
  117. package/runtime/.next/server/server-reference-manifest.json +1 -1
  118. package/runtime/native/Support.noindex/AgentRoam Remote Desktop.app/Contents/MacOS/agentroam-remote-desktop +0 -0
  119. package/runtime/native/Support.noindex/AgentRoam Remote Desktop.app/Contents/Resources/agentroam-component.json +1 -1
  120. package/runtime/native/Support.noindex/AgentRoam Remote Desktop.app/Contents/_CodeSignature/CodeResources +2 -2
  121. package/runtime/node_modules/.package-lock.json +17 -17
  122. package/runtime/node_modules/@agent/core/dist/index.js +9 -4
  123. package/runtime/node_modules/@agent/native-runtime/dist/index.js +439 -90
  124. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/bridge.mjs +81 -85
  125. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/browser-sdk.js +65 -65
  126. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-0vfvgmex.mjs +39 -0
  127. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-k19jejpn.mjs → core-3h0s3zzg.mjs} +2 -2
  128. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-a8ty0dnc.mjs → core-6w7w19rc.mjs} +2 -2
  129. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-8fprsbvz.mjs +42 -0
  130. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-avz7wgsg.mjs +23 -0
  131. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-b9ebje8h.mjs +20 -0
  132. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-kag24kjr.mjs → core-e1h3fbg3.mjs} +3 -3
  133. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-ae73vzp2.mjs → core-ge6en8c9.mjs} +4 -4
  134. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-e93r8awg.mjs → core-htcq9qj1.mjs} +2 -2
  135. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-v6sp3qjw.mjs → core-nv0a4kre.mjs} +4 -4
  136. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-y4qk5bdp.mjs +17 -0
  137. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-nfa6p2rw.mjs → core-yrdmz7je.mjs} +3 -3
  138. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-z276fcqp.mjs +28 -0
  139. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core.mjs +12 -12
  140. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/manifest.json +21 -21
  141. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/manifest.zst.json +25 -25
  142. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/package.json +23 -25
  143. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs +85 -85
  144. package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.cjs +72 -45
  145. package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.min.cjs +13 -13
  146. package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.min.mjs +13 -13
  147. package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.mjs +72 -45
  148. package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.node.cjs +72 -45
  149. package/runtime/node_modules/mediabunny/dist/modules/src/input.js +6 -0
  150. package/runtime/node_modules/mediabunny/dist/modules/src/media-sink.js +52 -35
  151. package/runtime/node_modules/mediabunny/dist/modules/src/media-source.js +2 -0
  152. package/runtime/node_modules/mediabunny/dist/modules/src/mpeg-ts/mpeg-ts-demuxer.js +7 -1
  153. package/runtime/node_modules/mediabunny/dist/modules/src/source.js +7 -4
  154. package/runtime/node_modules/mediabunny/dist/modules/src/tsconfig.tsbuildinfo +1 -1
  155. package/runtime/node_modules/mediabunny/dist/modules/src/version.js +1 -1
  156. package/runtime/node_modules/mediabunny/dist/modules/src/wave/wave-demuxer.js +6 -6
  157. package/runtime/node_modules/mediabunny/package.json +1 -1
  158. package/runtime/node_modules/mediabunny/src/input.ts +7 -0
  159. package/runtime/node_modules/mediabunny/src/media-sink.ts +56 -37
  160. package/runtime/node_modules/mediabunny/src/media-source.ts +3 -0
  161. package/runtime/node_modules/mediabunny/src/mpeg-ts/mpeg-ts-demuxer.ts +6 -1
  162. package/runtime/node_modules/mediabunny/src/source.ts +7 -4
  163. package/runtime/node_modules/mediabunny/src/version.ts +1 -1
  164. package/runtime/node_modules/mediabunny/src/wave/wave-demuxer.ts +6 -6
  165. package/runtime/node_modules/source-map-js/lib/quick-sort.js +92 -22
  166. package/runtime/node_modules/source-map-js/package.json +1 -1
  167. package/runtime/package-lock.json +41 -65
  168. package/runtime/webapp/dist/assets/{AIHubView-DF0D5qd2.js → AIHubView-CrtJMKfW.js} +1 -1
  169. package/runtime/webapp/dist/assets/{AgentManager-Ccj6ZefC.js → AgentManager-C2O-Dacy.js} +1 -1
  170. package/runtime/webapp/dist/assets/{AiHubPane-3PRSxzO0.js → AiHubPane-D2XWxc9R.js} +1 -1
  171. package/runtime/webapp/dist/assets/App-Bum2L4_E.js +63 -0
  172. package/runtime/webapp/dist/assets/{BrowserLivePanel-BZDtF0ne.js → BrowserLivePanel-DkBugqrH.js} +13 -18
  173. package/runtime/webapp/dist/assets/{CalendarPage-B8Jo-3Da.js → CalendarPage-DzYWlqoZ.js} +1 -1
  174. package/runtime/webapp/dist/assets/CalendarView-BjjC_t12.css +1 -0
  175. package/runtime/webapp/dist/assets/CalendarView-HQls5G-1.js +31 -0
  176. package/runtime/webapp/dist/assets/{CollaborationCreateDialog-CU1t0iYL.js → CollaborationCreateDialog-BwiSJbjb.js} +1 -1
  177. package/runtime/webapp/dist/assets/{CollaborationDashboard-BZhWQXzn.js → CollaborationDashboard-CNHt31kl.js} +1 -1
  178. package/runtime/webapp/dist/assets/{CollaborationPage-BwRJN55v.js → CollaborationPage-C4l-tTvn.js} +2 -2
  179. package/runtime/webapp/dist/assets/{FilePreview-Oo8sZH0t.js → FilePreview-EGUAbGpH.js} +3 -3
  180. package/runtime/webapp/dist/assets/{FileTree-qJTRdDPQ.js → FileTree-aJGl1V0W.js} +1 -1
  181. package/runtime/webapp/dist/assets/{FileWorkspaceDrawer-D40WNAqC.js → FileWorkspaceDrawer-zpD91eB6.js} +1 -1
  182. package/runtime/webapp/dist/assets/{FlowStudioPane-C1tgSbGo.js → FlowStudioPane-K1o4pSkZ.js} +1 -1
  183. package/runtime/webapp/dist/assets/{HostProjectPicker-BEfXuqxT.js → HostProjectPicker-BvboCQ0a.js} +1 -1
  184. package/runtime/webapp/dist/assets/{LSPServerList-DQRv04aP.js → LSPServerList-BSLzGLtW.js} +1 -1
  185. package/runtime/webapp/dist/assets/{MCPServerList-BmsejJC9.js → MCPServerList-CeWTI1-m.js} +1 -1
  186. package/runtime/webapp/dist/assets/{MemoryViewer-qZMdVrli.js → MemoryViewer-YcceFawC.js} +1 -1
  187. package/runtime/webapp/dist/assets/NewSessionWindow-C_HCQQnW.js +1 -0
  188. package/runtime/webapp/dist/assets/NewSessionWindow-DOLG1XEp.css +1 -0
  189. package/runtime/webapp/dist/assets/{RemoteDesktopPage-Dz_6-rOL.js → RemoteDesktopPage-Cpzv8zH0.js} +1 -1
  190. package/runtime/webapp/dist/assets/{RunningSessionsIcon-DJxTmxZn.js → RunningSessionsIcon-DmCYwIYD.js} +1 -1
  191. package/runtime/webapp/dist/assets/{SessionDashboard-DuR9r_ZP.js → SessionDashboard-C58Mke8a.js} +1 -1
  192. package/runtime/webapp/dist/assets/{SessionDashboardBridge-BHVjvDHa.js → SessionDashboardBridge-BPsNDY5Y.js} +1 -1
  193. package/runtime/webapp/dist/assets/{SettingsPanel-B-g919uV.js → SettingsPanel-CPBIPT-Z.js} +1 -1
  194. package/runtime/webapp/dist/assets/{SkillManager-nrWIOtEO.js → SkillManager-_qaGEuOE.js} +1 -1
  195. package/runtime/webapp/dist/assets/{TerminalPane-C4HiD2IC.js → TerminalPane-mYe76Pgb.js} +1 -1
  196. package/runtime/webapp/dist/assets/TodoPage-DdF5_SkL.js +1 -0
  197. package/runtime/webapp/dist/assets/{abnfDiagram-VCTEODGH-BXRYzdBT.js → abnfDiagram-VCTEODGH-DLd8EeCY.js} +1 -1
  198. package/runtime/webapp/dist/assets/{arc-BeG7yjCw.js → arc-D4smlqs5.js} +1 -1
  199. package/runtime/webapp/dist/assets/{architectureDiagram-5GKGNRK7-DIQbpqn7.js → architectureDiagram-5GKGNRK7-ByE3DRU4.js} +1 -1
  200. package/runtime/webapp/dist/assets/{arrow-right-B03zMFiC.js → arrow-right-BtIv2jiq.js} +1 -1
  201. package/runtime/webapp/dist/assets/{blockDiagram-I7D4REHJ-DvgKV01C.js → blockDiagram-I7D4REHJ-BvTUm5vA.js} +1 -1
  202. package/runtime/webapp/dist/assets/{c4Diagram-7LVT6UL2-DIr7nDIg.js → c4Diagram-7LVT6UL2-XKwj5RmQ.js} +1 -1
  203. package/runtime/webapp/dist/assets/{calendar-days-D1OJEOKr.js → calendar-days-BeI09qof.js} +1 -1
  204. package/runtime/webapp/dist/assets/channel-wxCRUEc2.js +1 -0
  205. package/runtime/webapp/dist/assets/{check-BDiCDSY5.js → check-BdadwkYj.js} +1 -1
  206. package/runtime/webapp/dist/assets/{chevron-down-DIt_NscV.js → chevron-down-DwzPFeq8.js} +1 -1
  207. package/runtime/webapp/dist/assets/{chevron-right-DVhYkZeF.js → chevron-right-kcIXzCMb.js} +1 -1
  208. package/runtime/webapp/dist/assets/{chunk-2Q5K7J3B-Cykdc4to.js → chunk-2Q5K7J3B-7A6CDWIw.js} +1 -1
  209. package/runtime/webapp/dist/assets/{chunk-5VM5RSS4-DL-gBU30.js → chunk-5VM5RSS4-mkNEWbY6.js} +1 -1
  210. package/runtime/webapp/dist/assets/{chunk-F27PBJKO-z0F9O96j.js → chunk-F27PBJKO-DKG-1HL0.js} +1 -1
  211. package/runtime/webapp/dist/assets/{chunk-IMKFNOWR-DcSgatN1.js → chunk-IMKFNOWR-kiJDyKM7.js} +1 -1
  212. package/runtime/webapp/dist/assets/{chunk-JWPE2WC7-BmG1ozp9.js → chunk-JWPE2WC7-DS7C5_M7.js} +1 -1
  213. package/runtime/webapp/dist/assets/{chunk-POPQ4Y6H-BK2jifSN.js → chunk-POPQ4Y6H-DvgeK_lX.js} +1 -1
  214. package/runtime/webapp/dist/assets/{chunk-SVP7TREG-DtInGjiG.js → chunk-SVP7TREG-BLo_2ua-.js} +1 -1
  215. package/runtime/webapp/dist/assets/{chunk-TICWLB2K-DWdiL4Y6.js → chunk-TICWLB2K-CJT6Qkz4.js} +1 -1
  216. package/runtime/webapp/dist/assets/{chunk-XXDRQBXY-w8UYxZUB.js → chunk-XXDRQBXY-D1OLqjNu.js} +1 -1
  217. package/runtime/webapp/dist/assets/classDiagram-ZZMXUADV-Ct3Cgqrl.js +1 -0
  218. package/runtime/webapp/dist/assets/classDiagram-v2-VYDZK3BY-Ct3Cgqrl.js +1 -0
  219. package/runtime/webapp/dist/assets/{codeSyntax-Cprr1Nm9.js → codeSyntax-Dd0hAazb.js} +1 -1
  220. package/runtime/webapp/dist/assets/collaboration-CAgt9AiV.js +6 -0
  221. package/runtime/webapp/dist/assets/composer-file-routing-DSC2Eojr.js +6 -0
  222. package/runtime/webapp/dist/assets/{cose-bilkent-JH36ORCC-BJgwy7Y5.js → cose-bilkent-JH36ORCC-CI6EKHP8.js} +1 -1
  223. package/runtime/webapp/dist/assets/{cynefin-OW5HDTMX-BssWa1kU.js → cynefin-OW5HDTMX-CJTXYieX.js} +1 -1
  224. package/runtime/webapp/dist/assets/{cynefinDiagram-5FMLGOSQ-Bv_-fuG_.js → cynefinDiagram-5FMLGOSQ-CPl1UVhy.js} +1 -1
  225. package/runtime/webapp/dist/assets/{dagre-GXQ25YYZ-BjA5n2Zi.js → dagre-GXQ25YYZ-Dq3ZQGTN.js} +1 -1
  226. package/runtime/webapp/dist/assets/{diagram-S7CK7UJ4-CCT38L0E.js → diagram-S7CK7UJ4-DJyU-2Di.js} +1 -1
  227. package/runtime/webapp/dist/assets/{diagram-UQ7AKVKN-4fLw8kje.js → diagram-UQ7AKVKN-Csg8hC8m.js} +1 -1
  228. package/runtime/webapp/dist/assets/{diagram-VSXAHHWV-43_Qj0Se.js → diagram-VSXAHHWV-B14uLH_N.js} +1 -1
  229. package/runtime/webapp/dist/assets/{diagram-VX7I27RA-BHEXgMDZ.js → diagram-VX7I27RA-D2Ww2nHe.js} +1 -1
  230. package/runtime/webapp/dist/assets/{diagram-Z3DM3KII-BRTSiXVr.js → diagram-Z3DM3KII-D_YC6AVP.js} +1 -1
  231. package/runtime/webapp/dist/assets/{download-CuYS63Ny.js → download-COWHIKec.js} +1 -1
  232. package/runtime/webapp/dist/assets/{ebnfDiagram-PWID7BFC-B4GImY-o.js → ebnfDiagram-PWID7BFC-s66xVEGY.js} +1 -1
  233. package/runtime/webapp/dist/assets/{erDiagram-RLTQ6QDP-EmEsAxWS.js → erDiagram-RLTQ6QDP-CgZh5cEn.js} +1 -1
  234. package/runtime/webapp/dist/assets/{external-link-Baeyco26.js → external-link-T3kil1jt.js} +1 -1
  235. package/runtime/webapp/dist/assets/{file-types-CykGmGsd.js → file-types-0e-tNIVd.js} +1 -1
  236. package/runtime/webapp/dist/assets/{flowDiagram-HODETNUW-sky_wmbX.js → flowDiagram-HODETNUW-BISMKynN.js} +1 -1
  237. package/runtime/webapp/dist/assets/{ganttDiagram-EL5Y4UJY-Cc71xV1j.js → ganttDiagram-EL5Y4UJY-Cbyu0NcF.js} +1 -1
  238. package/runtime/webapp/dist/assets/{gitGraphDiagram-WWUBYQGX-z7uQ8-8z.js → gitGraphDiagram-WWUBYQGX-Cs6IQGBz.js} +1 -1
  239. package/runtime/webapp/dist/assets/{history-C7WUwl_W.js → history-Df4LXw6L.js} +1 -1
  240. package/runtime/webapp/dist/assets/{image-plus-B2RK1ogI.js → image-plus-COHCHOpI.js} +1 -1
  241. package/runtime/webapp/dist/assets/index-CQTDnt74.css +1 -0
  242. package/runtime/webapp/dist/assets/{index-d8fS3JdV.js → index-CTJNAMck.js} +52 -52
  243. package/runtime/webapp/dist/assets/{infoDiagram-27XIBGKW-DXLEePz0.js → infoDiagram-27XIBGKW-4f3bFqNV.js} +1 -1
  244. package/runtime/webapp/dist/assets/{ishikawaDiagram-5VMMS53U-DCFXm_zQ.js → ishikawaDiagram-5VMMS53U-D-cJ9vio.js} +1 -1
  245. package/runtime/webapp/dist/assets/{journeyDiagram-3NMN7TZE-DHWCpvY6.js → journeyDiagram-3NMN7TZE-CeToS0Qx.js} +1 -1
  246. package/runtime/webapp/dist/assets/{kanban-definition-UXKFOSKX-D_uP81aw.js → kanban-definition-UXKFOSKX-DStbIUk1.js} +1 -1
  247. package/runtime/webapp/dist/assets/{layout-Bcu83-1p.js → layout-i2D4wlYd.js} +1 -1
  248. package/runtime/webapp/dist/assets/{linear-CPim5SQa.js → linear-BcJhiCv3.js} +1 -1
  249. package/runtime/webapp/dist/assets/{list-todo-F1W4yBLx.js → list-todo-7yETOqQe.js} +1 -1
  250. package/runtime/webapp/dist/assets/{loader-circle-DesEGpVH.js → loader-circle-CZdAfU-D.js} +1 -1
  251. package/runtime/webapp/dist/assets/{locate-fixed-UXM91vCS.js → locate-fixed-ByJuEKxC.js} +1 -1
  252. package/runtime/webapp/dist/assets/{mermaid.core-CyzKk3O2.js → mermaid.core-BjNFAB9I.js} +5 -5
  253. package/runtime/webapp/dist/assets/{mindmap-definition-YA3MSWOX-0MHQpQro.js → mindmap-definition-YA3MSWOX-BUIHHUVG.js} +1 -1
  254. package/runtime/webapp/dist/assets/new-session-window-C7R76XMp.css +1 -0
  255. package/runtime/webapp/dist/assets/new-session-window-DwtkwFBQ.js +190 -0
  256. package/runtime/webapp/dist/assets/{page-C2e368Dx.js → page-9-9EC7QM.js} +3 -3
  257. package/runtime/webapp/dist/assets/{pause-_h6c8qPD.js → pause-DXyBDZlg.js} +1 -1
  258. package/runtime/webapp/dist/assets/{pegDiagram-XKGWAZYB-BNinoE-7.js → pegDiagram-XKGWAZYB-BY5Bio5e.js} +1 -1
  259. package/runtime/webapp/dist/assets/{pieDiagram-E7YTZNPT-CfPzV9yb.js → pieDiagram-E7YTZNPT-CF8DVW3F.js} +1 -1
  260. package/runtime/webapp/dist/assets/{pin-BcXr5230.js → pin-2YlrlSJv.js} +1 -1
  261. package/runtime/webapp/dist/assets/{play-BdB0D0rZ.js → play-BxEpdvoI.js} +1 -1
  262. package/runtime/webapp/dist/assets/{quadrantDiagram-AXDQQJYC-0qLb33lM.js → quadrantDiagram-AXDQQJYC-CXWHO3a-.js} +1 -1
  263. package/runtime/webapp/dist/assets/{railroadDiagram-O6MQD6OU-DNU4eRJt.js → railroadDiagram-O6MQD6OU-C20JeJZ-.js} +1 -1
  264. package/runtime/webapp/dist/assets/{requirementDiagram-BXWQKSXE-BWJRwKX8.js → requirementDiagram-BXWQKSXE-IYd9UrO9.js} +1 -1
  265. package/runtime/webapp/dist/assets/{rotate-ccw-BdZpOTYP.js → rotate-ccw-CFIRtbUD.js} +1 -1
  266. package/runtime/webapp/dist/assets/{rotate-cw-D-zPMe4i.js → rotate-cw-B_vFqNsz.js} +1 -1
  267. package/runtime/webapp/dist/assets/{sankeyDiagram-P5KCCOFB-CGW9pvun.js → sankeyDiagram-P5KCCOFB-ysBhpblA.js} +1 -1
  268. package/runtime/webapp/dist/assets/{send-DCVOqOap.js → send-DUE2vBoK.js} +1 -1
  269. package/runtime/webapp/dist/assets/{sequenceDiagram-WJ2MYXX4-CeVAD519.js → sequenceDiagram-WJ2MYXX4-CQMmk6cu.js} +1 -1
  270. package/runtime/webapp/dist/assets/session-dashboard-DnFhQhBN.js +1 -0
  271. package/runtime/webapp/dist/assets/{shield-check-DrxVJwVC.js → shield-check-Btyos6Iv.js} +1 -1
  272. package/runtime/webapp/dist/assets/{sizeCapture-INFHLROL-Dj5SukiO.js → sizeCapture-INFHLROL-DekvKUn1.js} +1 -1
  273. package/runtime/webapp/dist/assets/{stateDiagram-D77RDMKH-UtRSslyd.js → stateDiagram-D77RDMKH-Ds_FEmbr.js} +1 -1
  274. package/runtime/webapp/dist/assets/stateDiagram-v2-MP3YSRHH-DxJ1ks_8.js +1 -0
  275. package/runtime/webapp/dist/assets/{swimlanes-42K2YHIH-DKbrz8SF.js → swimlanes-42K2YHIH-cjPcEO_T.js} +1 -1
  276. package/runtime/webapp/dist/assets/swimlanesDiagram-VR7AAH4N-JGHIAQXy.js +8 -0
  277. package/runtime/webapp/dist/assets/{timeline-definition-24CTP7MA-mtVdMOBL.js → timeline-definition-24CTP7MA-CEOprVt5.js} +1 -1
  278. package/runtime/webapp/dist/assets/{trash-2-Bbhd8-xd.js → trash-2-DLDxY6J7.js} +1 -1
  279. package/runtime/webapp/dist/assets/{types-CMhUwzwJ.js → types-CFAnlTif.js} +1 -1
  280. package/runtime/webapp/dist/assets/{vennDiagram-4TSXK5OY-ZcuGEhJx.js → vennDiagram-4TSXK5OY-D82uxYY9.js} +1 -1
  281. package/runtime/webapp/dist/assets/{wardleyDiagram-VM6X3IG4-CnAYI2ZE.js → wardleyDiagram-VM6X3IG4-JFt7Izt0.js} +1 -1
  282. package/runtime/webapp/dist/assets/{web-BH9JgWsL.js → web-BMqaP0jw.js} +1 -1
  283. package/runtime/webapp/dist/assets/{web-CBiaPgEe.js → web-Q9VPRftY.js} +1 -1
  284. package/runtime/webapp/dist/assets/{x-1GQMVfza.js → x-CeSbythI.js} +1 -1
  285. package/runtime/webapp/dist/assets/{xychartDiagram-S5SC5T6Z-B_uJt0Bg.js → xychartDiagram-S5SC5T6Z-1WCa4SfL.js} +1 -1
  286. package/runtime/webapp/dist/assets/{zoom-out-BNKdrTFD.js → zoom-out-CRr_o1NV.js} +8 -3
  287. package/runtime/webapp/dist/index.html +2 -2
  288. package/runtime/ws-server.mjs +11 -0
  289. package/runtime/.next/server/chunks/2480.js +0 -4
  290. package/runtime/.next/server/chunks/3604.js +0 -4
  291. package/runtime/.next/server/chunks/732.js +0 -1
  292. package/runtime/.next/server/chunks/7788.js +0 -1
  293. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-25bstexa.mjs +0 -17
  294. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-4ps8vwh1.mjs +0 -42
  295. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-9a7zb9bm.mjs +0 -53
  296. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-dsa3p77h.mjs +0 -18
  297. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-eqz9ara6.mjs +0 -18
  298. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-esw7xtkz.mjs +0 -17
  299. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-ey906mbk.mjs +0 -20
  300. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-mhczx7zp.mjs +0 -18
  301. package/runtime/webapp/dist/assets/App-HomcUet2.js +0 -63
  302. package/runtime/webapp/dist/assets/CalendarView-BD7GhA0i.js +0 -36
  303. package/runtime/webapp/dist/assets/CalendarView-DHi-mzjY.css +0 -1
  304. package/runtime/webapp/dist/assets/NewSessionWindow-BOCZ0mXT.css +0 -1
  305. package/runtime/webapp/dist/assets/NewSessionWindow-uzVK5LVS.js +0 -1
  306. package/runtime/webapp/dist/assets/TodoPage-Bn6j6kR6.js +0 -1
  307. package/runtime/webapp/dist/assets/channel-Cchxg6Fx.js +0 -1
  308. package/runtime/webapp/dist/assets/classDiagram-ZZMXUADV-BGv4sK1I.js +0 -1
  309. package/runtime/webapp/dist/assets/classDiagram-v2-VYDZK3BY-BGv4sK1I.js +0 -1
  310. package/runtime/webapp/dist/assets/collaboration-acdqOxaY.js +0 -6
  311. package/runtime/webapp/dist/assets/composer-file-routing-BsSxfxUa.js +0 -6
  312. package/runtime/webapp/dist/assets/index-B_fTpc5K.css +0 -1
  313. package/runtime/webapp/dist/assets/new-session-window-B4BJYrds.css +0 -1
  314. package/runtime/webapp/dist/assets/new-session-window-fsYu53Ht.js +0 -188
  315. package/runtime/webapp/dist/assets/session-dashboard-BAYi5acZ.js +0 -1
  316. package/runtime/webapp/dist/assets/stateDiagram-v2-MP3YSRHH-Se3lznH6.js +0 -1
  317. package/runtime/webapp/dist/assets/swimlanesDiagram-VR7AAH4N-C-Zsmae7.js +0 -8
  318. /package/runtime/.next/static/{q4ez_w8bVMUW1e57Cd7GC → alt-ud1W2PlWW6FLlkBcB}/_buildManifest.js +0 -0
  319. /package/runtime/.next/static/{q4ez_w8bVMUW1e57Cd7GC → alt-ud1W2PlWW6FLlkBcB}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- import{r,u as i,j as n}from"./index-d8fS3JdV.js";import m from"./CalendarView-BD7GhA0i.js";import"./calendar-days-D1OJEOKr.js";import"./x-1GQMVfza.js";import"./chevron-right-DVhYkZeF.js";import"./locate-fixed-UXM91vCS.js";import"./check-BDiCDSY5.js";import"./pause-_h6c8qPD.js";import"./list-todo-F1W4yBLx.js";import"./chevron-down-DIt_NscV.js";function x(){const[a,o]=r.useState(i.getState().skin);return r.useEffect(()=>i.subscribe(t=>o(t.skin)),[]),r.useEffect(()=>{document.documentElement.dataset.skin=a},[a]),n.jsx(m,{initialTaskId:new URLSearchParams(location.search).get("task")??void 0,loadOverview:async(t,s)=>{const e=window.agentApi;if(!(e!=null&&e.calendarOverview))throw new Error("当前环境不支持日历视图");return e.calendarOverview({from:t,to:s})}})}export{x as default};
1
+ import{r,u as i,j as n}from"./index-CTJNAMck.js";import m from"./CalendarView-HQls5G-1.js";import"./calendar-days-BeI09qof.js";import"./x-CeSbythI.js";import"./chevron-right-kcIXzCMb.js";import"./locate-fixed-ByJuEKxC.js";import"./list-todo-7yETOqQe.js";import"./chevron-down-DwzPFeq8.js";import"./check-BdadwkYj.js";import"./pause-DXyBDZlg.js";function x(){const[a,o]=r.useState(i.getState().skin);return r.useEffect(()=>i.subscribe(t=>o(t.skin)),[]),r.useEffect(()=>{document.documentElement.dataset.skin=a},[a]),n.jsx(m,{initialTaskId:new URLSearchParams(location.search).get("task")??void 0,loadOverview:async(t,s)=>{const e=window.agentApi;if(!(e!=null&&e.calendarOverview))throw new Error("当前环境不支持日历视图");return e.calendarOverview({from:t,to:s})}})}export{x as default};
@@ -0,0 +1 @@
1
+ .cal-root{--src-customer-agent: #4f6ef7;--src-codex: #059669;--src-claude: #d97706;--src-workbuddy: #db2777;--src-zcode: #7c3aed;--src-opencode: #0891b2;--src-deepseek: #dc2626;position:relative;display:flex;flex-direction:column;gap:14px;height:100%;min-height:100dvh;box-sizing:border-box;padding:20px clamp(14px,3vw,30px) 30px;overflow-y:auto;overflow-x:hidden;background:var(--bg-deepest, #f5f6fa);color:var(--text-primary, #111827);font-family:var(--font-body, "Inter", system-ui, sans-serif);scrollbar-width:thin;scrollbar-color:color-mix(in srgb,var(--accent, #4f6ef7) 38%,transparent) transparent}.cal-root::-webkit-scrollbar{width:11px;height:11px}.cal-root::-webkit-scrollbar-track{background:color-mix(in srgb,var(--bg-deep, #eef0f6) 70%,transparent)}.cal-root::-webkit-scrollbar-thumb{background:color-mix(in srgb,var(--accent, #4f6ef7) 34%,var(--bg-deep, #eef0f6));border-radius:99px;border:3px solid var(--bg-deepest, #f5f6fa)}.cal-root::-webkit-scrollbar-thumb:hover{background:color-mix(in srgb,var(--accent, #4f6ef7) 60%,var(--bg-deep, #eef0f6))}.cal-aurora{position:fixed;top:0;right:0;bottom:0;left:0;z-index:0;pointer-events:none;opacity:.55;background:radial-gradient(46% 38% at 12% 8%,color-mix(in srgb,var(--src-customer-agent) 16%,transparent),transparent 70%),radial-gradient(40% 34% at 88% 12%,color-mix(in srgb,var(--src-zcode) 13%,transparent),transparent 72%),radial-gradient(48% 40% at 78% 92%,color-mix(in srgb,var(--src-opencode) 12%,transparent),transparent 74%),radial-gradient(40% 36% at 18% 90%,color-mix(in srgb,var(--src-workbuddy) 10%,transparent),transparent 72%);animation:cal-drift 26s var(--ease-out, ease) infinite alternate}@keyframes cal-drift{0%{transform:translateZ(0) scale(1)}to{transform:translate3d(0,-1.5%,0) scale(1.05)}}.cal-root>*:not(.cal-aurora){position:relative;z-index:1;min-width:0;flex-shrink:0}[data-source=customer-agent]{--src: var(--src-customer-agent)}[data-source=codex]{--src: var(--src-codex)}[data-source=claude]{--src: var(--src-claude)}[data-source=workbuddy]{--src: var(--src-workbuddy)}[data-source=zcode]{--src: var(--src-zcode)}[data-source=opencode]{--src: var(--src-opencode)}[data-source=deepseek]{--src: var(--src-deepseek)}.cal-root [data-source=qoder]{--src: #4338ca}.cal-root [data-source=copilot]{--src: #2563eb}.cal-header{display:flex;align-items:center;justify-content:space-between;gap:16px;flex-wrap:wrap}.cal-title{display:flex;align-items:center;gap:13px}.cal-title-icon{display:grid;place-items:center;width:44px;height:44px;border-radius:var(--radius-md, 12px);color:#fff;background:linear-gradient(135deg,var(--src-customer-agent),var(--src-zcode));box-shadow:0 6px 18px color-mix(in srgb,var(--src-customer-agent) 34%,transparent)}.cal-title h1{margin:0;font-size:20px;font-weight:700;letter-spacing:-.02em;font-family:var(--font-display, inherit)}.cal-title p{margin:2px 0 0;font-size:12px;color:var(--text-muted, #9ca3af)}.cal-nav{display:flex;align-items:center;gap:7px}.cal-nav-btn,.cal-refresh{display:grid;place-items:center;width:34px;height:34px;border-radius:var(--radius-sm, 7px);border:1px solid var(--border-default, rgba(17,24,39,.13));background:var(--bg-surface, #fff);color:var(--text-secondary, #4b5563);cursor:pointer;transition:all var(--duration-fast, .15s) var(--ease-out, ease)}.cal-nav-btn:hover,.cal-refresh:hover,.cal-nav-btn.is-active{border-color:var(--accent, #4f6ef7);color:var(--accent, #4f6ef7);background:var(--control-hover, #eef1fe)}.cal-month{min-width:128px;height:34px;padding:0 14px;border-radius:var(--radius-sm, 7px);border:1px solid var(--border-default, rgba(17,24,39,.13));background:var(--bg-surface, #fff);font-size:14px;font-weight:650;color:var(--text-primary, #111827);cursor:pointer;font-family:inherit}.cal-month:hover{border-color:var(--accent, #4f6ef7)}.cal-refresh.is-spinning svg{animation:cal-spin .9s linear infinite}@keyframes cal-spin{to{transform:rotate(360deg)}}.cal-filters{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}.cal-sources{display:flex;flex-wrap:wrap;gap:6px}.cal-source-chip{display:inline-flex;align-items:center;gap:6px;padding:4px 11px;border-radius:99px;cursor:pointer;font-size:12px;font-weight:600;font-family:inherit;border:1px solid var(--border-default, rgba(17,24,39,.13));background:var(--bg-surface, #fff);color:var(--text-secondary, #4b5563);transition:all var(--duration-fast, .15s) var(--ease-out, ease)}.cal-source-dot{width:8px;height:8px;border-radius:99px;background:var(--src);flex-shrink:0}.cal-source-chip.is-on{border-color:color-mix(in srgb,var(--src) 46%,transparent);background:color-mix(in srgb,var(--src) 10%,#fff);color:color-mix(in srgb,var(--src) 78%,#111827)}.cal-source-chip.is-off{opacity:.5}.cal-source-chip.is-off .cal-source-dot{background:var(--text-muted, #9ca3af)}.cal-source-chip:hover{transform:translateY(-1px)}.cal-source-n{font-size:10.5px;font-weight:700;padding:0 5px;border-radius:99px;background:color-mix(in srgb,var(--src) 16%,transparent);color:color-mix(in srgb,var(--src) 80%,#111827)}.cal-source-errors{display:flex;flex-wrap:wrap;gap:6px}.cal-source-error{display:inline-flex;align-items:center;gap:5px;padding:3px 10px;border-radius:99px;font-size:11.5px;color:var(--warning, #d97706);background:color-mix(in srgb,var(--warning, #d97706) 10%,#fff);border:1px solid color-mix(in srgb,var(--warning, #d97706) 28%,transparent);cursor:help}.cal-error{display:flex;align-items:center;gap:9px;padding:11px 15px;border-radius:var(--radius-md, 12px);background:color-mix(in srgb,var(--danger, #dc2626) 8%,#fff);border:1px solid color-mix(in srgb,var(--danger, #dc2626) 26%,transparent);color:var(--danger, #dc2626);font-size:13px}.cal-error button{margin-left:auto;padding:4px 12px;border-radius:7px;border:1px solid currentColor;background:transparent;color:inherit;cursor:pointer;font-family:inherit;font-weight:600}.cal-body{display:grid;grid-template-columns:minmax(0,1fr) 336px;gap:16px;align-items:start}.cal-grid-wrap{border-radius:var(--radius-lg, 18px);border:1px solid var(--border-subtle, rgba(17,24,39,.07));background:var(--bg-surface, #fff);box-shadow:var(--shadow-sm, 0 1px 4px rgba(17,24,39,.07));overflow:hidden}.cal-weekdays{display:grid;grid-template-columns:repeat(7,1fr);border-bottom:1px solid var(--border-subtle, rgba(17,24,39,.07));background:var(--bg-workspace, #fafbfe)}.cal-weekdays span{padding:9px 0;text-align:center;font-size:12px;font-weight:650;color:var(--text-secondary, #4b5563)}.cal-weekdays span.is-weekend{color:var(--src-workbuddy)}.cal-grid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));grid-auto-rows:minmax(104px,auto)}.cal-cell{position:relative;display:flex;flex-direction:column;gap:5px;padding:7px 7px 9px;cursor:pointer;border-right:1px solid var(--border-subtle, rgba(17,24,39,.07));border-bottom:1px solid var(--border-subtle, rgba(17,24,39,.07));background:var(--bg-surface, #fff);transition:background var(--duration-fast, .15s);min-width:0}.cal-cell:nth-child(7n){border-right:none}.cal-cell:hover{background:var(--control-hover, #f3f5fe)}.cal-cell.is-other{background:color-mix(in srgb,var(--bg-deepest, #f5f6fa) 60%,#fff)}.cal-cell.is-other .cal-cell-date{color:var(--text-muted, #9ca3af)}.cal-cell.is-selected{background:color-mix(in srgb,var(--accent, #4f6ef7) 7%,#fff);box-shadow:inset 0 0 0 2px var(--accent, #4f6ef7)}.cal-cell.is-today .cal-cell-date{display:grid;place-items:center;width:24px;height:24px;border-radius:99px;background:var(--accent, #4f6ef7);color:#fff;font-weight:700}.cal-cell.has-overdue:after{content:"";position:absolute;top:0;left:0;width:3px;height:100%;background:var(--text-muted, #9ca3af);opacity:.5}.cal-cell-head{display:flex;align-items:center;gap:5px}.cal-cell-date{font-size:12.5px;font-weight:650;color:var(--text-secondary, #4b5563)}.cal-today-pill{font-size:9.5px;font-weight:700;color:var(--accent, #4f6ef7)}.cal-cell-n{margin-left:auto;font-size:10px;font-weight:700;color:var(--text-muted, #9ca3af)}.cal-chips{display:flex;flex-direction:column;gap:3px;min-width:0}.cal-chip{box-sizing:border-box;display:flex;align-items:center;gap:4px;width:100%;min-width:0;padding:3px 6px;border-radius:6px;border:1px solid color-mix(in srgb,var(--src) 26%,transparent);border-left:3px solid var(--src);background:color-mix(in srgb,var(--src) 8%,#fff);cursor:pointer;text-align:left;font-family:inherit;transition:transform var(--duration-fast, .15s) var(--ease-out, ease),box-shadow var(--duration-fast, .15s)}.cal-chip:hover{transform:translate(1px);box-shadow:0 2px 7px color-mix(in srgb,var(--src) 22%,transparent)}.cal-chip-dot{display:none}.cal-chip-time{font-size:9.5px;font-weight:700;color:color-mix(in srgb,var(--src) 82%,#111827);font-variant-numeric:tabular-nums;flex-shrink:0}.cal-chip-title{font-size:11px;font-weight:550;color:var(--text-primary, #111827);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0;flex:1}.cal-mark{flex-shrink:0}.cal-mark.is-done{color:var(--success, #059669)}.cal-mark.is-fail{color:var(--danger, #dc2626)}.cal-mark.is-pause{color:var(--warning, #d97706)}.cal-chip.is-completed{opacity:.72}.cal-chip.is-completed .cal-chip-title{text-decoration:line-through;color:var(--text-muted, #9ca3af)}.cal-chip.is-overdue{border-color:var(--border-default, rgba(17,24,39,.13));border-left-color:var(--text-muted, #9ca3af);background:var(--bg-deep, #eef0f6)}.cal-chip.is-overdue .cal-chip-title,.cal-chip.is-overdue .cal-chip-time{color:var(--text-muted, #9ca3af)}.cal-chip.is-paused{opacity:.6;border-style:dashed}.cal-chip.is-failed{border-color:color-mix(in srgb,var(--danger, #dc2626) 34%,transparent);border-left-color:var(--danger, #dc2626);background:color-mix(in srgb,var(--danger, #dc2626) 7%,#fff)}.cal-tag{flex-shrink:0;font-size:8.5px;font-weight:700;padding:1px 4px;border-radius:4px}.cal-tag.is-overdue{background:var(--border-default, rgba(17,24,39,.13));color:var(--text-secondary, #4b5563)}.cal-tag.is-paused{background:color-mix(in srgb,var(--warning, #d97706) 16%,transparent);color:var(--warning, #d97706)}.cal-tag.is-progress{background:color-mix(in srgb,var(--src-opencode) 16%,transparent);color:var(--src-opencode)}.cal-more{align-self:flex-start;padding:1px 6px;border-radius:5px;border:none;background:transparent;color:var(--accent, #4f6ef7);font-size:10.5px;font-weight:650;cursor:pointer;font-family:inherit}.cal-more:hover{background:var(--accent-dim, rgba(79,110,247,.09))}.cal-pulse{width:8px;height:8px;border-radius:99px;background:var(--src-opencode);flex-shrink:0;animation:cal-pulse 1.5s var(--ease-out, ease) infinite}@keyframes cal-pulse{0%,to{box-shadow:0 0 color-mix(in srgb,var(--src-opencode) 50%,transparent)}50%{box-shadow:0 0 0 4px transparent}}.cal-detail{position:sticky;top:14px;display:flex;flex-direction:column;max-height:calc(100dvh - 40px);border-radius:var(--radius-lg, 18px);border:1px solid var(--border-subtle, rgba(17,24,39,.07));background:var(--bg-surface, #fff);box-shadow:var(--shadow-sm, 0 1px 4px rgba(17,24,39,.07));overflow:hidden}.cal-detail-head{display:flex;align-items:center;justify-content:space-between;padding:15px 17px;border-bottom:1px solid var(--border-subtle, rgba(17,24,39,.07));background:var(--bg-workspace, #fafbfe)}.cal-detail-head h2{margin:0;font-size:15px;font-weight:700}.cal-detail-n{font-size:11.5px;font-weight:650;color:var(--accent, #4f6ef7);padding:2px 9px;border-radius:99px;background:var(--accent-dim, rgba(79,110,247,.09))}.cal-detail-list{padding:12px;overflow-y:auto;display:flex;flex-direction:column;gap:10px;scrollbar-width:thin;scrollbar-color:color-mix(in srgb,var(--accent, #4f6ef7) 34%,transparent) transparent}.cal-detail-list::-webkit-scrollbar{width:9px}.cal-detail-list::-webkit-scrollbar-thumb{background:color-mix(in srgb,var(--accent, #4f6ef7) 30%,var(--bg-deep, #eef0f6));border-radius:99px;border:2px solid #fff}.cal-entry{padding:11px 13px;border-radius:var(--radius-md, 12px);border:1px solid var(--border-subtle, rgba(17,24,39,.07));border-left:3px solid var(--src);background:color-mix(in srgb,var(--src) 4%,#fff);animation:cal-rise .32s var(--ease-out, ease) both}@keyframes cal-rise{0%{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}.cal-entry.is-overdue{border-left-color:var(--text-muted, #9ca3af);background:var(--bg-deep, #eef0f6)}.cal-entry.is-paused{opacity:.7;border-left-style:dashed}.cal-entry.is-highlight,.cal-chip.is-highlight{box-shadow:0 0 0 2px color-mix(in srgb,var(--accent, #4f6ef7) 55%,transparent)}.cal-entry-top{display:flex;align-items:center;gap:7px;margin-bottom:6px}.cal-entry-src{font-size:10px;font-weight:700;padding:1px 7px;border-radius:99px;color:#fff;background:var(--src)}.cal-entry-state{font-size:10.5px;font-weight:650;padding:1px 7px;border-radius:99px;background:var(--bg-deep, #eef0f6);color:var(--text-secondary, #4b5563)}.cal-entry-state.is-completed{background:color-mix(in srgb,var(--success, #059669) 13%,#fff);color:var(--success, #059669)}.cal-entry-state.is-failed{background:color-mix(in srgb,var(--danger, #dc2626) 12%,#fff);color:var(--danger, #dc2626)}.cal-entry-state.is-overdue{background:var(--border-default, rgba(17,24,39,.13));color:var(--text-secondary, #4b5563)}.cal-entry-state.is-in-progress{background:color-mix(in srgb,var(--src-opencode) 14%,#fff);color:var(--src-opencode)}.cal-entry-state.is-paused{background:color-mix(in srgb,var(--warning, #d97706) 14%,#fff);color:var(--warning, #d97706)}.cal-entry-time{margin-left:auto;display:inline-flex;align-items:center;gap:4px;font-size:11px;font-weight:650;color:var(--text-secondary, #4b5563);font-variant-numeric:tabular-nums}.cal-entry-title{margin:0 0 7px;font-size:13.5px;font-weight:650;line-height:1.4}.cal-entry-title.is-struck,.cal-todo-text.is-struck,.cal-unsched-title.is-struck,.cal-chip.is-completed .cal-chip-title{text-decoration:line-through;color:var(--text-muted, #9ca3af)}.cal-entry-meta{display:flex;flex-wrap:wrap;gap:5px}.cal-meta-pill{display:inline-flex;align-items:center;gap:4px;font-size:10.5px;padding:2px 8px;border-radius:99px;background:var(--bg-deep, #eef0f6);color:var(--text-secondary, #4b5563);max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.cal-entry-detail{margin:8px 0 0;font-size:11.5px;line-height:1.55;color:var(--text-secondary, #4b5563);display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}.cal-entry-cwd{margin:6px 0 0;font-size:10px;color:var(--text-muted, #9ca3af);font-family:var(--font-mono, monospace);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.cal-empty{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:7px;padding:40px 20px;text-align:center;color:var(--text-muted, #9ca3af)}.cal-empty p{margin:0;font-size:13px;font-weight:600;color:var(--text-secondary, #4b5563)}.cal-empty small{font-size:11px}.cal-empty.is-inline{padding:26px}.cal-unscheduled{border-radius:var(--radius-lg, 18px);border:1px solid var(--border-subtle, rgba(17,24,39,.07));background:var(--bg-surface, #fff);box-shadow:var(--shadow-sm, 0 1px 4px rgba(17,24,39,.07));overflow:hidden}.cal-unscheduled-head{display:flex;align-items:center;gap:9px;width:100%;padding:14px 18px;border:none;background:var(--bg-workspace, #fafbfe);cursor:pointer;font-family:inherit;font-size:14px;font-weight:700;color:var(--text-primary, #111827)}.cal-unscheduled-head svg:first-child{color:var(--src-zcode)}.cal-unscheduled-n{margin-left:auto;font-size:11.5px;font-weight:600;color:var(--text-muted, #9ca3af)}.cal-unscheduled-chev{transition:transform var(--duration-normal, .3s) var(--ease-out, ease);color:var(--text-muted, #9ca3af)}.cal-unscheduled.is-open .cal-unscheduled-chev{transform:rotate(180deg)}.cal-unscheduled-body{padding:16px 18px;display:flex;flex-direction:column;gap:16px;border-top:1px solid var(--border-subtle, rgba(17,24,39,.07))}.cal-unsched-schedule-list{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:10px}.cal-unsched-schedule{padding:11px 13px;border-radius:var(--radius-md, 12px);border:1px dashed color-mix(in srgb,var(--src) 40%,transparent);background:color-mix(in srgb,var(--src) 5%,#fff)}.cal-unsched-schedule.is-highlight{border-style:solid;border-color:color-mix(in srgb,var(--accent, #4f6ef7) 55%,transparent);box-shadow:0 0 0 2px color-mix(in srgb,var(--accent, #4f6ef7) 28%,transparent)}.cal-unsched-row{display:flex;gap:10px;align-items:center}.cal-unsched-row>.cal-mark{flex:0 0 32px}.cal-unsched-title{flex:1;min-width:0;padding:0;border:none;background:none;text-align:left;font-family:inherit;font-size:13px;font-weight:650;color:var(--text-primary, #111827);cursor:pointer;overflow-wrap:anywhere}.cal-unsched-title:hover{color:var(--accent, #4f6ef7)}.cal-unsched-expand{margin-top:8px;display:flex;flex-direction:column;gap:6px}.cal-edit-schedule{margin-top:8px}.cal-root>.cal-schedule-overlay{position:fixed;top:0;right:0;bottom:0;left:0;z-index:100;display:grid;place-items:center;padding:16px;background:#0000004d}.cal-schedule-dialog{box-sizing:border-box;width:min(100%,400px);max-height:100%;overflow:auto;padding:20px;border-radius:12px;background:var(--bg-surface, #fff);color:var(--text-primary, #111827)}.cal-schedule-dialog h2{margin:0 0 16px;font-size:16px}.cal-schedule-editor{display:grid;gap:12px}.cal-schedule-editor label{display:grid;gap:4px;font-size:13px}.cal-schedule-editor select,.cal-schedule-editor input:not([type=checkbox]){box-sizing:border-box;width:100%;min-height:36px;padding:5px 8px;border:1px solid var(--border-default, #d1d5db);border-radius:6px;background:var(--bg-deep, #f5f6f8);color:inherit;font:inherit}.cal-schedule-editor .cal-schedule-enabled{display:flex;align-items:center;gap:6px}.cal-schedule-editor [role=alert]{margin:0;font-size:13px;color:var(--danger, #b91c1c)}.cal-schedule-actions{display:flex;justify-content:flex-end;gap:8px}.cal-schedule-actions .cal-nav-btn,.cal-edit-schedule{width:auto;padding-inline:9px}.cal-unsched-schedule p{margin:5px 0 0;font-size:11px;line-height:1.5;color:var(--text-secondary, #4b5563);display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.cal-groups{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:10px;align-items:start}.cal-group{border-radius:var(--radius-md, 12px);border:1px solid var(--border-subtle, rgba(17,24,39,.07));background:var(--bg-workspace, #fafbfe);overflow:hidden}.cal-group-head{display:flex;align-items:center;gap:8px;width:100%;padding:11px 13px;border:none;background:transparent;cursor:pointer;font-family:inherit;text-align:left}.cal-group-head:hover{background:var(--control-hover, #f3f5fe)}.cal-group-dot{width:9px;height:9px;border-radius:99px;background:var(--src);flex-shrink:0}.cal-group-title{font-size:12.5px;font-weight:650;color:var(--text-primary, #111827);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0;flex:1}.cal-group-count{font-size:10.5px;font-weight:600;color:var(--text-muted, #9ca3af);flex-shrink:0}.cal-group-chev{color:var(--text-muted, #9ca3af);transition:transform var(--duration-normal, .3s) var(--ease-out, ease);flex-shrink:0}.cal-group.is-open .cal-group-chev{transform:rotate(180deg)}.cal-group-body{padding:0 13px 12px}.cal-group-cwd{margin:0 0 8px;font-size:10px;color:var(--text-muted, #9ca3af);font-family:var(--font-mono, monospace);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.cal-group-todos{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:5px}.cal-todo{display:flex;align-items:center;gap:8px;padding:5px 8px;border-radius:7px;background:var(--bg-surface, #fff);border:1px solid var(--border-subtle, rgba(17,24,39,.07))}.cal-todo-box{display:grid;place-items:center;width:17px;height:17px;border-radius:5px;border:1.5px solid color-mix(in srgb,var(--src) 50%,transparent);color:var(--success, #059669);flex-shrink:0}.cal-todo.is-completed .cal-todo-box{background:color-mix(in srgb,var(--success, #059669) 14%,#fff);border-color:var(--success, #059669)}.cal-todo.is-overdue{opacity:.66}.cal-todo.is-overdue .cal-todo-box{border-color:var(--text-muted, #9ca3af)}.cal-todo-text{font-size:12px;color:var(--text-primary, #111827);min-width:0;flex:1;line-height:1.4}.cal-todo .cal-tag{margin-left:auto}.cal-grid.is-skeleton .cal-cell{cursor:default}.cal-skeleton-cell{gap:8px}.cal-skel-bar{height:11px;border-radius:5px;background:linear-gradient(90deg,var(--bg-deep, #eef0f6) 25%,var(--bg-workspace, #fafbfe) 50%,var(--bg-deep, #eef0f6) 75%);background-size:200% 100%;animation:cal-shimmer 1.4s linear infinite}.cal-skel-bar.is-short{width:55%}@keyframes cal-shimmer{to{background-position:-200% 0}}@media (max-width: 1080px){.cal-body{grid-template-columns:1fr}.cal-detail{position:static;max-height:none}.cal-detail-list{max-height:420px}}@media (max-width: 720px){.cal-root{padding:14px 12px 24px;gap:11px}.cal-title p{display:none}.cal-grid{grid-auto-rows:minmax(78px,auto)}.cal-cell{padding:5px 3px 7px}.cal-nav-btn,.cal-refresh,.cal-month{min-height:44px}.cal-nav-btn,.cal-refresh{min-width:44px}.cal-nav{flex-wrap:nowrap;gap:6px}.cal-month{flex:1 1 auto;min-width:0;padding:0 8px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.cal-today-pill{display:none}.cal-unscheduled-head{flex-wrap:wrap}.cal-unscheduled-n{margin-left:0;font-size:10px}.cal-entry-top{flex-wrap:wrap}.cal-group-count{font-size:9px}.cal-chip-time{display:none}.cal-chip{padding:2px 4px;border-left-width:2px}.cal-chip-title{font-size:10px}.cal-tag{display:none}.cal-filters{flex-direction:column;align-items:stretch}.cal-groups,.cal-unsched-schedule-list{grid-template-columns:1fr}}@media (prefers-reduced-motion: reduce){.cal-aurora,.cal-pulse,.cal-skel-bar,.cal-refresh.is-spinning svg{animation:none}.cal-entry{animation:none}}
@@ -0,0 +1,31 @@
1
+ import{c as $,r as l,j as e,n as me,N as Ae,o as pe,p as De,R as Ee}from"./index-CTJNAMck.js";import{C as $e}from"./calendar-days-BeI09qof.js";import{X as xe}from"./x-CeSbythI.js";import{C as Te}from"./chevron-right-kcIXzCMb.js";import{L as Me}from"./locate-fixed-ByJuEKxC.js";import{L as ge}from"./list-todo-7yETOqQe.js";import{C as Le}from"./chevron-down-DwzPFeq8.js";import{C as fe}from"./check-BdadwkYj.js";import{P as ze}from"./pause-DXyBDZlg.js";/**
2
+ * @license lucide-react v0.468.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const Re=$("CalendarClock",[["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M17.5 17.5 16 16.3V14",key:"akvzfd"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]]);/**
7
+ * @license lucide-react v0.468.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const Ie=$("CircleDot",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);/**
12
+ * @license lucide-react v0.468.0 - ISC
13
+ *
14
+ * This source code is licensed under the ISC license.
15
+ * See the LICENSE file in the root directory of this source tree.
16
+ */const oe=$("Inbox",[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]);/**
17
+ * @license lucide-react v0.468.0 - ISC
18
+ *
19
+ * This source code is licensed under the ISC license.
20
+ * See the LICENSE file in the root directory of this source tree.
21
+ */const je=$("Repeat",[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]]);/**
22
+ * @license lucide-react v0.468.0 - ISC
23
+ *
24
+ * This source code is licensed under the ISC license.
25
+ * See the LICENSE file in the root directory of this source tree.
26
+ */const de=$("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
27
+ * @license lucide-react v0.468.0 - ISC
28
+ *
29
+ * This source code is licensed under the ISC license.
30
+ * See the LICENSE file in the root directory of this source tree.
31
+ */const Fe=$("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),B=["customer-agent","codex","claude","workbuddy","zcode","opencode","deepseek"],Z={"customer-agent":"AgentRoam",codex:"Codex",claude:"Claude Code",workbuddy:"WorkBuddy",zcode:"ZCode",opencode:"OpenCode",deepseek:"DeepSeek"};function I(s){const a=new Date(s),m=`${a.getMonth()+1}`.padStart(2,"0"),x=`${a.getDate()}`.padStart(2,"0");return`${a.getFullYear()}-${m}-${x}`}function _e({detail:s,onSave:a,onClose:m}){const{task:x,schedule:i}=s,g=i.trigger.kind==="cron",[f,p]=l.useState(i.target.agentType),[v,F]=l.useState(()=>{if(i.trigger.kind==="cron")return i.trigger.expression;const u=new Date(i.trigger.at);return new Date(u.getTime()-u.getTimezoneOffset()*6e4).toISOString().slice(0,19)}),[T,Y]=l.useState(i.enabled),[A,M]=l.useState([]),[j,r]=l.useState(!1),[D,w]=l.useState("");l.useEffect(()=>{var h,b;let u=!0;return(b=(h=window.agentApi)==null?void 0:h.getRuntimeHealth)==null||b.call(h).then(E=>{u&&M(E.filter(N=>!N.available).map(N=>N.agentType))}).catch(()=>{}),()=>{u=!1}},[]);async function C(u){if(u.preventDefault(),j)return;const h=g?{kind:"cron",expression:v.trim()}:{kind:"once",at:new Date(v).getTime()};if(h.kind==="once"&&(!Number.isFinite(h.at)||T&&h.at<=Date.now())){w("请选择有效的未来执行时间");return}r(!0),w("");const b=i.target,E=f===b.agentType?void 0:{agentType:f,cwd:b.cwd,permissionMode:b.permissionMode},N=h.kind==="once"&&i.trigger.kind==="once"?h.at!==i.trigger.at:h.kind==="cron"&&i.trigger.kind==="cron"&&h.expression!==i.trigger.expression;try{await a({type:"schedule",taskId:x.id,expectedVersion:x.version,enabled:T,...E?{target:E}:{},...N?{trigger:h}:{}})}catch(L){w(L instanceof Error?L.message:"执行计划保存失败")}finally{r(!1)}}return e.jsxs("form",{className:"cal-schedule-editor",onSubmit:C,"aria-label":"编辑执行计划",children:[e.jsxs("label",{children:["执行 Agent",e.jsxs("select",{value:f,onChange:u=>p(u.target.value),disabled:j,children:[!me(i.target.agentType)&&e.jsx("option",{value:i.target.agentType,children:i.target.agentType}),Ae.map(u=>e.jsx("option",{value:u,disabled:A.includes(u)&&u!==i.target.agentType,children:pe[u]},u))]})]}),e.jsxs("label",{children:[g?`执行规则(${i.timeZone})`:"执行时间(本地时间)",e.jsx("input",{type:g?"text":"datetime-local",step:g?void 0:1,value:v,required:!0,disabled:j,onChange:u=>F(u.target.value)})]}),e.jsxs("label",{className:"cal-schedule-enabled",children:[e.jsx("input",{type:"checkbox",checked:T,disabled:j,onChange:u=>Y(u.target.checked)}),"启用执行计划"]}),D&&e.jsx("p",{role:"alert",children:D}),e.jsxs("div",{className:"cal-schedule-actions",children:[e.jsx("button",{type:"button",className:"cal-nav-btn",onClick:m,disabled:j,children:"取消"}),e.jsx("button",{type:"submit",className:"cal-nav-btn",disabled:j,children:j?"保存中":"保存"})]})]})}const ue=["一","二","三","四","五","六","日"],Ue={upcoming:"待执行",paused:"已暂停",completed:"已完成",failed:"失败",overdue:"已过期",pending:"待处理","in-progress":"进行中",unscheduled:"未排期"},Oe=3e4;function Ve(s){const a=new Date(s);return a.setHours(0,0,0,0),a.getTime()}function V(s){const a=new Date(s);return`${`${a.getHours()}`.padStart(2,"0")}:${`${a.getMinutes()}`.padStart(2,"0")}`}function Ye(s,a){return`${s}年${a+1}月`}function he({task:s,schedule:a,reminders:m,executions:x}){var g,f;return s.dueAt!==void 0?s.dueAt:a!=null&&a.enabled&&a.nextFireAt!==null?a.nextFireAt:s.status==="completed"&&(a==null?void 0:a.trigger.kind)==="once"?a.trigger.at:(a&&((g=x.find(p=>p.scheduleId===a.id&&(s.status==="completed"||p.generation===a.generation)))==null?void 0:g.scheduledAt))??((f=m.find(p=>p.enabled&&p.nextFireAt!==null))==null?void 0:f.nextFireAt)??void 0}function qe(s,a){const m=new Date(s,a,1),x=(m.getDay()+6)%7,i=Ve(m.getTime())-x*864e5;return Array.from({length:42},(g,f)=>{const p=i+f*864e5,v=new Date(p);return{key:I(p),day:v.getDate(),inMonth:v.getMonth()===a,ms:p}})}function Ge({kind:s,size:a=12}){return s==="cron"?e.jsx(je,{size:a,"aria-hidden":"true"}):s==="run"?e.jsx(Fe,{size:a,"aria-hidden":"true"}):e.jsx(Ie,{size:a,"aria-hidden":"true"})}function ke({state:s}){return s==="completed"?e.jsx(fe,{size:12,className:"cal-mark is-done",role:"img","aria-label":"已完成"}):s==="failed"?e.jsx(xe,{size:12,className:"cal-mark is-fail","aria-label":"失败"}):s==="in-progress"?e.jsx("span",{className:"cal-pulse","aria-label":"进行中"}):s==="paused"?e.jsx(ze,{size:11,className:"cal-mark is-pause","aria-label":"已暂停"}):null}function ve({source:s,executionAgentType:a}){return!a||a==="customer-agent"?{tone:s,label:Z[s]}:me(a)?{tone:a==="claude-code"?"claude":a==="deepseek-harness"?"deepseek":a,label:pe[a]}:{tone:s,label:a}}function He({entry:s,onClick:a,highlighted:m}){const x=`cal-chip kind-${s.kind} is-${s.state}${m?" is-highlight":""}`,{tone:i,label:g}=ve(s),f=`${g} · ${s.title}`,p=e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"cal-chip-dot","aria-hidden":"true"}),e.jsx("span",{className:"cal-chip-time",children:s.kind==="todo"?s.dueAt?V(s.dueAt):"待办":V(s.at)}),e.jsx("span",{className:"cal-chip-title",children:s.title}),e.jsx(ke,{state:s.state}),s.state==="overdue"&&e.jsx("span",{className:"cal-tag is-overdue",children:"过期"}),s.state==="paused"&&e.jsx("span",{className:"cal-tag is-paused",children:"暂停"})]});return a?e.jsx("button",{type:"button",className:x,"data-source":i,onClick:a,title:f,children:p}):e.jsx("div",{className:x,"data-source":i,title:f,children:p})}function Ke({entry:s,highlighted:a,onEditSchedule:m}){const{tone:x,label:i}=ve(s);return e.jsxs("article",{className:`cal-entry is-${s.state}${a?" is-highlight":""}`,"data-source":x,"data-task-id":s.taskId,children:[e.jsxs("div",{className:"cal-entry-top",children:[e.jsx("span",{className:"cal-entry-src",children:i}),e.jsx("span",{className:`cal-entry-state is-${s.state}`,children:Ue[s.state]??s.state}),e.jsxs("span",{className:"cal-entry-time",children:[e.jsx(Ge,{kind:s.kind}),s.kind==="todo"?s.dueAt?V(s.dueAt):"无截止":V(s.at)]})]}),e.jsx("h4",{className:`cal-entry-title ${s.state==="completed"?"is-struck":""}`,children:s.title}),e.jsxs("div",{className:"cal-entry-meta",children:[s.scheduleLabel&&e.jsxs("span",{className:"cal-meta-pill",children:[e.jsx(Re,{size:11}),s.scheduleLabel]}),s.recurring&&e.jsxs("span",{className:"cal-meta-pill",children:[e.jsx(je,{size:11}),"循环"]}),s.sessionTitle&&e.jsxs("span",{className:"cal-meta-pill",title:s.sessionTitle,children:[e.jsx(ge,{size:11}),s.sessionTitle]})]}),s.executedAt!==void 0&&e.jsxs("p",{className:"cal-entry-detail",children:["执行记录:",new Date(s.executedAt).toLocaleString("zh-CN",{hour12:!1})]}),s.kind==="cron"&&s.state==="overdue"&&e.jsx("p",{className:"cal-entry-detail",children:"计划时间已过,未找到执行结果;不代表执行成功或失败。"}),s.detail&&e.jsx("p",{className:"cal-entry-detail",children:s.detail}),s.cwd&&e.jsx("p",{className:"cal-entry-cwd",title:s.cwd,children:s.cwd}),m&&e.jsx("button",{type:"button",className:"cal-nav-btn cal-edit-schedule",onClick:m,children:"编辑执行计划"})]})}function st({loadOverview:s,onClose:a,initialTaskId:m,focusKey:x=0}){const[i,g]=l.useState([]),[f,p]=l.useState(""),[v,F]=l.useState(""),[T,Y]=l.useState(""),[A,M]=l.useState(null),j=l.useRef(0),r=typeof window>"u"?void 0:window.agentApi,D=new Date,w=I(D.getTime()),[C,u]=l.useState({year:D.getFullYear(),month:D.getMonth()}),[h,b]=l.useState(null),[E,N]=l.useState(!0),[L,_]=l.useState(""),[be,X]=l.useState(!1),[q,S]=l.useState(w),[U,J]=l.useState(()=>new Set(B)),[G,H]=l.useState(!0),Q=l.useRef({from:"",to:""}),z=l.useRef(!0),O=l.useRef(0),ee=l.useCallback(async t=>{const n=++O.current;J(c=>new Set([...c,"customer-agent"])),F(t);try{const c=r!=null&&r.todoGet?await r.todoGet(t):void 0;if(n!==O.current)return;const o=c&&he(c);if(o!==void 0){const d=new Date(o);u({year:d.getFullYear(),month:d.getMonth()}),S(I(o))}else H(!0)}catch{n===O.current&&H(!0)}},[r]);l.useEffect(()=>(m&&ee(m),()=>{O.current++}),[m,x,ee]);const K=l.useMemo(()=>qe(C.year,C.month),[C]),te=K[0].key,se=K[41].key;Q.current={from:te,to:se};const y=l.useCallback(async t=>{var o;const{from:n,to:c}=Q.current;t==="initial"?N(!0):X(!0);try{const d=typeof window>"u"?void 0:window.agentApi,[R,k]=await Promise.all([s(n,c),(o=d==null?void 0:d.todoList)==null?void 0:o.call(d,{limit:200}).catch(()=>{})]);if(!z.current)return;k&&g(k.items.filter(re=>re.task.status!=="cancelled"&&he(re)===void 0)),b(R),_("")}catch(d){if(!z.current)return;_(d instanceof Error?d.message:"日历加载失败")}finally{z.current&&(N(!1),X(!1))}},[s]);l.useEffect(()=>{z.current=!0,y("initial");const t=setInterval(()=>{document.visibilityState==="visible"&&y("refresh")},Oe),n=()=>{document.visibilityState==="visible"&&y("refresh")};return document.addEventListener("visibilitychange",n),()=>{z.current=!1,clearInterval(t),document.removeEventListener("visibilitychange",n)}},[y,te,se]);const ae=t=>{u(n=>{const c=new Date(n.year,n.month+t,1);return{year:c.getFullYear(),month:c.getMonth()}})},ne=()=>{const t=new Date;u({year:t.getFullYear(),month:t.getMonth()}),S(I(t.getTime()))},ce=l.useMemo(()=>{const t=new Map;if(!h)return t;for(const[n,c]of Object.entries(h.days)){const o=c.filter(d=>d.kind!=="todo"&&U.has(d.source));o.length&&t.set(n,o)}return t},[h,U]),P=ce.get(q)??[],le=l.useMemo(()=>h?B.filter(t=>{var n;return!((n=h.sources[t])!=null&&n.ok)}).map(t=>{var n;return{source:t,error:((n=h.sources[t])==null?void 0:n.error)??""}}):[],[h]),Ne=t=>{J(n=>{const c=new Set(n);return c.has(t)?c.delete(t):c.add(t),c})},W=new Date(`${q}T00:00:00`),ye=`${W.getMonth()+1} 月 ${W.getDate()} 日 · 周${ue[(W.getDay()+6)%7]}`,we=async t=>{var n;p(t.task.id);try{const c=await((n=r==null?void 0:r.todoCommand)==null?void 0:n.call(r,{type:"complete",taskId:t.task.id,expectedVersion:t.task.version},crypto.randomUUID()));c&&g(o=>o.map(d=>d.task.id===c.task.id?c:d)),await y("refresh")}catch(c){_(c instanceof Error?c.message:"待办更新失败")}finally{p("")}},Ce=async t=>{var c;const n=++j.current;try{const o=await((c=r==null?void 0:r.todoGet)==null?void 0:c.call(r,t));n===j.current&&(o!=null&&o.schedule)&&M({...o,schedule:o.schedule})}catch(o){n===j.current&&_(o instanceof Error?o.message:"读取执行计划失败")}},ie=()=>{j.current++,M(null)},Se=async t=>{var o;if(!(r!=null&&r.todoCommand))throw new Error("当前服务不支持编辑待办");const n=await r.todoCommand(t,crypto.randomUUID());ie();const c=(o=n.schedule)==null?void 0:o.nextFireAt;if(c!=null){const d=new Date(c);u({year:d.getFullYear(),month:d.getMonth()}),S(I(c)),F(n.task.id)}await y("refresh")};return e.jsxs("div",{className:"cal-root",children:[e.jsx("div",{className:"cal-aurora","aria-hidden":"true"}),e.jsxs("header",{className:"cal-header",children:[e.jsxs("div",{className:"cal-title",children:[e.jsx("span",{className:"cal-title-icon",children:e.jsx($e,{size:20,"aria-hidden":"true"})}),e.jsxs("div",{children:[e.jsx("h1",{children:"智能体日历"}),e.jsx("p",{children:"定时任务与待办"})]})]}),e.jsxs("div",{className:"cal-nav",children:[a&&e.jsx("button",{type:"button",className:"cal-nav-btn","aria-label":"返回聊天",title:"返回聊天",onClick:a,children:e.jsx(xe,{size:17})}),e.jsx("button",{type:"button",className:"cal-nav-btn","aria-label":"上个月",onClick:()=>ae(-1),children:e.jsx(De,{size:17})}),e.jsx("button",{type:"button",className:"cal-month",onClick:ne,title:"回到今天",children:Ye(C.year,C.month)}),e.jsx("button",{type:"button",className:"cal-nav-btn","aria-label":"下个月",onClick:()=>ae(1),children:e.jsx(Te,{size:17})}),e.jsx("button",{type:"button",className:"cal-nav-btn","aria-label":"回到今天",title:"回到今天",onClick:ne,children:e.jsx(Me,{size:17})}),e.jsx("button",{type:"button",className:`cal-refresh ${be?"is-spinning":""}`,"aria-label":"刷新",title:"刷新",onClick:()=>void y("refresh"),children:e.jsx(Ee,{size:17})})]})]}),e.jsx("div",{className:"cal-filters",children:e.jsx("div",{className:"cal-sources",role:"group","aria-label":"按来源筛选",children:B.map(t=>{var n;return e.jsxs("button",{type:"button","data-source":t,className:`cal-source-chip ${U.has(t)?"is-on":"is-off"}`,onClick:()=>Ne(t),"aria-pressed":U.has(t),children:[e.jsx("span",{className:"cal-source-dot","aria-hidden":"true"}),Z[t],h&&e.jsx("span",{className:"cal-source-n",children:((n=h.sources[t])==null?void 0:n.entries)||0})]},t)})})}),le.length>0&&e.jsx("div",{className:"cal-source-errors",role:"status",children:le.map(({source:t,error:n})=>e.jsxs("span",{className:"cal-source-error","data-source":t,title:n,children:[e.jsx(de,{size:12}),Z[t]," 读取异常"]},t))}),L&&e.jsxs("div",{className:"cal-error",role:"alert",children:[e.jsx(de,{size:16}),L,e.jsx("button",{type:"button",onClick:()=>void y("initial"),children:"重试"})]}),e.jsxs("div",{className:"cal-body",children:[e.jsxs("div",{className:"cal-grid-wrap",children:[e.jsx("div",{className:"cal-weekdays",children:ue.map(t=>e.jsxs("span",{className:t==="六"||t==="日"?"is-weekend":"",children:["周",t]},t))}),E&&!h?e.jsx("div",{className:"cal-grid is-skeleton",children:Array.from({length:42},(t,n)=>e.jsxs("div",{className:"cal-cell cal-skeleton-cell",children:[e.jsx("span",{className:"cal-skel-bar"}),e.jsx("span",{className:"cal-skel-bar is-short"})]},n))}):e.jsx("div",{className:"cal-grid",children:K.map(t=>{const n=ce.get(t.key)??[],c=n.slice(0,3),o=n.length-c.length,d=n.some(k=>k.state==="overdue"),R=`cal-cell ${t.inMonth?"":"is-other"} ${t.key===w?"is-today":""} ${t.key===q?"is-selected":""} ${d?"has-overdue":""}`;return e.jsxs("div",{className:R,role:"button",tabIndex:0,onClick:()=>S(t.key),onKeyDown:k=>{(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),S(t.key))},children:[e.jsxs("div",{className:"cal-cell-head",children:[e.jsx("span",{className:"cal-cell-date",children:t.day}),t.key===w&&e.jsx("span",{className:"cal-today-pill",children:"今天"}),n.length>0&&e.jsx("span",{className:"cal-cell-n",children:n.length})]}),e.jsxs("div",{className:"cal-chips",children:[c.map(k=>e.jsx(He,{entry:k,highlighted:k.taskId===v,onClick:()=>S(t.key)},k.id)),o>0&&e.jsxs("button",{type:"button",className:"cal-more",onClick:()=>S(t.key),children:["+",o," 更多"]})]})]},t.key)})})]}),e.jsxs("aside",{className:"cal-detail",children:[e.jsxs("div",{className:"cal-detail-head",children:[e.jsx("h2",{children:ye}),e.jsxs("span",{className:"cal-detail-n",children:[P.length," 项"]})]}),e.jsx("div",{className:"cal-detail-list",children:P.length===0?e.jsxs("div",{className:"cal-empty",children:[e.jsx(oe,{size:28,strokeWidth:1.4}),e.jsx("p",{children:"这一天没有安排"}),e.jsx("small",{children:"点击其他日期查看安排与提醒"})]}):P.map(t=>{var n;return e.jsx(Ke,{entry:t,highlighted:t.taskId===v,onEditSchedule:r!=null&&r.todoGet&&r.todoCommand&&t.taskId&&((n=t.scheduleRef)!=null&&n.startsWith("agentroam:todo_execution_schedules:"))?()=>void Ce(t.taskId):void 0},t.id)})})]})]}),e.jsxs("section",{className:`cal-unscheduled ${G?"is-open":""}`,children:[e.jsxs("button",{type:"button",className:"cal-unscheduled-head",onClick:()=>H(t=>!t),"aria-expanded":G,children:[e.jsx(ge,{size:16}),e.jsx("span",{children:"无日期待办"}),e.jsxs("span",{className:"cal-unscheduled-n",children:[i.length," 项"]}),e.jsx(Le,{size:16,className:"cal-unscheduled-chev"})]}),G&&e.jsxs("div",{className:"cal-unscheduled-body",children:[i.length>0&&e.jsx("div",{className:"cal-unsched-schedule-list",children:i.map(t=>{var d;const n=T===t.task.id,c=t.task.status==="completed",o=t.task.status==="in_progress"?"进行中":t.task.status==="failed"?"执行失败":"";return e.jsxs("div",{className:`cal-unsched-schedule ${t.task.id===v?"is-highlight":""}`,"data-source":"customer-agent",children:[e.jsxs("div",{className:"cal-unsched-row",children:[c?e.jsx(ke,{state:"completed"}):e.jsx("button",{type:"button",className:"cal-nav-btn","aria-label":`完成 ${t.task.title}`,disabled:!!f,onClick:()=>void we(t),children:e.jsx(fe,{size:13})}),e.jsx("button",{type:"button",className:`cal-unsched-title${c?" is-struck":""}`,"aria-expanded":n,title:n?"收起详情":"查看详情",onClick:()=>Y(n?"":t.task.id),children:t.task.title})]}),o&&e.jsx("p",{children:o}),n&&e.jsxs("div",{className:"cal-unsched-expand",children:[t.task.description&&e.jsx("p",{children:t.task.description}),((d=t.schedule)==null?void 0:d.enabled)&&e.jsxs("p",{children:["下次执行:",t.schedule.nextFireAt?new Date(t.schedule.nextFireAt).toLocaleString("zh-CN",{hour12:!1}):"—"," · ",t.schedule.target.agentType]}),t.reminders.some(R=>R.enabled)&&e.jsx("p",{children:"已设置提醒"}),(r==null?void 0:r.todoCommand)&&t.schedule&&!c&&e.jsx("button",{type:"button",className:"cal-nav-btn cal-edit-schedule",onClick:()=>M({...t,schedule:t.schedule}),children:"编辑执行计划"})]})]},t.task.id)})}),i.length===0&&e.jsxs("div",{className:"cal-empty is-inline",children:[e.jsx(oe,{size:24,strokeWidth:1.4}),e.jsx("p",{children:"没有无日期待办"})]})]})]}),A&&e.jsx("div",{className:"cal-schedule-overlay",children:e.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"cal-schedule-title",className:"cal-schedule-dialog",children:[e.jsx("h2",{id:"cal-schedule-title",children:A.task.title}),e.jsx(_e,{detail:A,onSave:Se,onClose:ie},A.task.id)]})})]})}export{Ke as EntryRow,st as default,he as personalTodoCalendarTime};
@@ -1 +1 @@
1
- import{r as o,j as e,A as U,e as q,f as X}from"./index-d8fS3JdV.js";import{C as J,a as K}from"./types-CMhUwzwJ.js";import{H as V}from"./HostProjectPicker-BEfXuqxT.js";import{c as P,A as $,U as Y}from"./collaboration-acdqOxaY.js";import{X as M}from"./x-1GQMVfza.js";import{S as Z}from"./file-types-CykGmGsd.js";import{F as G}from"./trash-2-Bbhd8-xd.js";import{C as B}from"./chevron-down-DIt_NscV.js";function ee(r,s){return[...new Map([...r,...s].map(i=>[i.id,i])).values()]}function ae({value:r,onChange:s}){const[i,p]=o.useState(""),[x,j]=o.useState({data:[],nextCursor:null,total:0}),[y,h]=o.useState(!0),[f,d]=o.useState(""),[N,l]=o.useState(0),n=o.useRef(0),u=o.useRef(!1);o.useEffect(()=>{const t=++n.current;let c=!0;u.current=!0,h(!0),d(""),j({data:[],nextCursor:null,total:0});const C=setTimeout(()=>{P({action:"sessionCatalog",query:i,limit:20}).then(m=>{c&&t===n.current&&j(m)}).catch(m=>{c&&t===n.current&&d(m instanceof Error?m.message:"无法加载会话")}).finally(()=>{c&&t===n.current&&(u.current=!1,h(!1))})},i?200:0);return()=>{c=!1,clearTimeout(C)}},[i,N]);const b=async()=>{if(u.current||!x.nextCursor)return;const t=n.current;u.current=!0,h(!0),d("");try{const c=await P({action:"sessionCatalog",query:i,limit:20,cursor:x.nextCursor});t===n.current&&j(C=>({...c,data:ee(C.data,c.data)}))}catch(c){t===n.current&&d(c instanceof Error?c.message:"加载更多失败")}finally{t===n.current&&(u.current=!1,h(!1))}},v=new Set(r.map(t=>t.id));return e.jsxs("section",{className:"collab-monitor-picker","aria-label":"关联原始会话",children:[e.jsx("div",{className:"collab-monitor-heading",children:e.jsxs("strong",{children:["关联原始会话 ",e.jsxs("small",{children:["选填 · 已选 ",r.length]})]})}),e.jsx("p",{className:"collab-muted",children:"运行中的在前。关联后作为监控对象,恢复或交接时才介入。"}),r.length>0&&e.jsx("div",{className:"collab-monitor-selected","aria-label":"已选会话",children:r.map(t=>e.jsxs("span",{title:`${$[t.agentType]} · ${t.cwd}`,children:[e.jsx(U,{agentType:t.agentType,size:14}),e.jsx("span",{children:t.title}),e.jsx("button",{type:"button","aria-label":`取消关联${t.title}`,onClick:()=>s(r.filter(c=>c.id!==t.id)),children:e.jsx(M,{size:13})})]},t.id))}),e.jsxs("label",{className:"collab-monitor-search",children:[e.jsx(Z,{size:15}),e.jsx("input",{"aria-label":"搜索所有原始会话",placeholder:"搜索所有会话的标题、目录或 Agent",value:i,onChange:t=>p(t.target.value)})]}),e.jsxs("div",{className:"collab-monitor-results","aria-label":"原始会话候选","aria-busy":y,onScroll:t=>{const c=t.currentTarget;c.scrollHeight-c.scrollTop-c.clientHeight<64&&b()},children:[x.data.map(t=>e.jsxs("label",{className:"collab-monitor-row",children:[e.jsx("input",{type:"checkbox","aria-label":`关联${t.title}`,checked:v.has(t.id),disabled:!v.has(t.id)&&r.length>=200,onChange:c=>s(c.target.checked?[...r,{id:t.id,agentType:t.agentType,title:t.title,cwd:t.cwd,projectId:t.projectId}]:r.filter(C=>C.id!==t.id))}),e.jsx(U,{agentType:t.agentType,size:18}),e.jsxs("span",{children:[e.jsx("strong",{children:t.title}),e.jsxs("small",{children:[$[t.agentType]," · ",t.cwd]})]}),e.jsx("em",{className:t.status==="running"?"is-running":"",children:t.status==="running"?"运行中":t.status==="failed"?"异常":t.status==="completed"?"已完成":"空闲"})]},t.id)),!y&&!f&&!x.data.length&&e.jsx("p",{className:"collab-muted",children:i?"没有匹配的会话":"暂无可接入会话"}),y&&e.jsx("p",{className:"collab-muted",role:"status",children:"正在加载会话…"}),x.nextCursor&&!f&&e.jsxs("button",{type:"button",className:"collab-monitor-more",disabled:y,onClick:()=>void b(),children:["加载更多(已显示 ",x.data.length," / ",x.total,")"]})]}),f&&e.jsxs("p",{className:"collab-error",role:"alert",children:[f," ",e.jsx("button",{type:"button",onClick:()=>l(t=>t+1),children:"重新加载"})]})]})}function S({children:r,...s}){return e.jsxs("span",{className:"collab-select",children:[e.jsx("select",{...s,children:r}),e.jsx(B,{size:16,"aria-hidden":"true"})]})}function z(r){return{id:crypto.randomUUID(),name:r===0?"群主":`成员 ${r}`,agentType:"codex",role:""}}function te({member:r,index:s,owner:i,supervisor:p,health:x,onChange:j,onRemove:y}){const[h,f]=o.useState([]),[d,N]=o.useState([]);return o.useEffect(()=>{let l=!0;return f([]),N([]),r.agentType==="customer-agent"?(window.agentApi.getSettings().then(n=>{l&&N(n.profiles.map(({id:u,name:b,modelId:v})=>({id:u,name:b,modelId:v})))}).catch(()=>{}),()=>{l=!1}):(window.agentApi.listAgentModels(r.agentType).then(n=>{l&&f(n.models)}).catch(()=>{}),()=>{l=!1})},[r.agentType]),e.jsxs("fieldset",{className:"collab-member-editor",children:[e.jsxs("legend",{children:[i?e.jsx(J,{size:14}):e.jsx(Y,{size:14}),i?"群主":`成员 ${s}`,p?" · 监工":""]}),y&&e.jsx("button",{type:"button",className:"collab-remove","aria-label":`移除${r.name}`,onClick:y,children:e.jsx(M,{size:16})}),e.jsxs("div",{className:"collab-editor-fields",children:[e.jsxs("label",{children:["名称",e.jsx("input",{value:r.name,maxLength:100,onChange:l=>j({...r,name:l.target.value}),required:!0})]}),e.jsxs("label",{children:["Agent",e.jsx(S,{value:r.agentType,onChange:l=>j({...r,agentType:l.target.value,model:void 0,profileId:void 0}),children:K.map(l=>{var n,u;return e.jsxs("option",{value:l,disabled:((n=x.find(b=>b.agentType===l))==null?void 0:n.available)===!1,children:[$[l],((u=x.find(b=>b.agentType===l))==null?void 0:u.available)===!1?" · 不可用":""]},l)})})]}),e.jsxs("label",{className:"collab-model-field",children:["模型",r.agentType==="customer-agent"?e.jsxs(S,{value:r.profileId||"",onChange:l=>{const n=d.find(u=>u.id===l.target.value);j({...r,profileId:n==null?void 0:n.id,model:n?{id:n.modelId}:void 0})},children:[e.jsx("option",{value:"",children:"沿用默认模型"}),d.map(l=>e.jsxs("option",{value:l.id,children:[l.name," · ",l.modelId]},l.id))]}):e.jsxs(S,{value:r.model?`${r.model.providerID||""}|${r.model.id}`:"",onChange:l=>{const n=h.find(u=>`${u.providerID||""}|${u.id}`===l.target.value);j({...r,model:n?{id:n.id,...n.providerID?{providerID:n.providerID}:{}}:void 0})},children:[e.jsx("option",{value:"",children:"沿用默认模型"}),h.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:p||void 0,children:[e.jsxs("summary",{children:[e.jsx("span",{children:"定位与职责"}),e.jsx("span",{className:"collab-muted",children:r.role.trim()?"已设置":i?"默认安排与汇总":"留空由群主分配"}),e.jsx(B,{size:14})]}),e.jsx("textarea",{"aria-label":`${i?"群主":`成员 ${s}`}的定位与职责(选填)`,rows:2,maxLength:8e3,value:r.role,placeholder:p?"重点看什么:异常暂停、任务交接和交付。允许怎么处理:原任务内自动恢复、继续、协调交接;业务取舍或无法恢复时提醒我决策。":i?"负责拆解目标、分配任务、验收和汇总成果":"例如:负责实现接口;留空由群主自动分配",onChange:l=>j({...r,role:l.target.value})}),p&&e.jsx("p",{className:"collab-muted",children:"在职责中写明关注内容、判断标准、允许的恢复与交接,以及何时提醒你或等待决策。"})]})]})}function ue({cwd:r,initialGroup:s,health:i,onClose:p,onCreated:x}){var H;const[j,y]=o.useState((s==null?void 0:s.name)||""),[h,f]=o.useState((s==null?void 0:s.cwd)||r||""),[d,N]=o.useState(()=>s?structuredClone(s.members):[z(0),z(1)]),[l,n]=o.useState((s==null?void 0:s.ownerId)||d[0].id),[u,b]=o.useState((s==null?void 0:s.maxParallel)||3),[v,t]=o.useState(()=>{var a;return structuredClone(((a=s==null?void 0:s.monitoring)==null?void 0:a.targets)??[])}),[c,C]=o.useState(s?((H=s.monitoring)==null?void 0:H.supervisorId)??"":d[0].id),[m,L]=o.useState(!1),[O,T]=o.useState(""),[E,A]=o.useState(!1),[_,R]=o.useState(!!(s!=null&&s.cwd)),[I,F]=o.useState(!1),Q=async()=>{if(T(""),X()){A(!0);return}F(!0);try{const a=await window.agentApi.openFileDialog();a&&(f(a),R(!0))}catch(a){T(a instanceof Error?a.message:"无法选择工作目录")}finally{F(!1)}};return o.useEffect(()=>{const a=g=>{g.key==="Escape"&&!m&&!E&&!I&&p()};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[p,m,E,I]),e.jsxs("div",{className:"collab-modal-backdrop",onMouseDown:a=>{a.target===a.currentTarget&&!m&&p()},children:[e.jsxs("form",{className:"collab-create",role:"dialog","aria-modal":"true","aria-labelledby":"collab-create-title",onSubmit:async a=>{a.preventDefault(),L(!0),T("");try{if(!h.trim())throw new Error("请先选择工作目录");const g=d.find(k=>{var D;return((D=i.find(W=>W.agentType===k.agentType))==null?void 0:D.available)===!1});if(g&&!s)throw new Error(`${g.name} 选择的 Agent 当前不可用`);const w=await P({...s?{action:"updateGroup",groupId:s.id}:{action:"createGroup"},group:{name:j.trim()||"协作群",cwd:h.trim(),ownerId:l,members:d,maxParallel:Math.min(u,d.length),...v.length?{monitoring:{targets:v,...c?{supervisorId:c}:{}}}:{}}});x(w)}catch(g){T(g instanceof Error?g.message:String(g))}finally{L(!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:p,disabled:m,children:e.jsx(M,{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:j,maxLength:100,placeholder:"例如:产品开发小组",onChange:a=>y(a.target.value)})]}),e.jsxs("label",{children:[e.jsx("span",{children:"工作目录"}),e.jsxs("button",{type:"button",className:"collab-directory-picker","aria-label":"选择工作目录","aria-haspopup":"dialog","aria-expanded":E,title:h||"选择工作目录",disabled:m||I,onClick:()=>void Q(),children:[e.jsx(G,{size:16,"aria-hidden":"true"}),e.jsx("span",{className:h?void 0:"collab-muted",children:I?"正在选择…":h||"选择工作目录"}),e.jsx(q,{size:16,"aria-hidden":"true"})]})]})]}),e.jsx("p",{className:"collab-create-hint collab-muted",children:s?"配置保存后用于新讨论,已有讨论和聊天记录保留。":"Agent 可重复加入,职责留空由群主分配。"}),d.map((a,g)=>e.jsx(te,{member:a,index:g,owner:a.id===l,supervisor:v.length>0&&a.id===c,health:i,onChange:w=>N(k=>k.map(D=>D.id===w.id?w:D)),onRemove:a.id!==l&&d.length>2?()=>{a.id===c&&C(""),N(w=>w.filter(k=>k.id!==a.id))}:void 0},a.id)),e.jsxs("div",{className:"collab-create-actions",children:[e.jsxs("label",{children:["群主",e.jsx(S,{value:l,onChange:a=>n(a.target.value),children:d.map(a=>e.jsx("option",{value:a.id,children:a.name},a.id))})]}),e.jsxs("button",{type:"button",disabled:d.length>=20,onClick:()=>N(a=>[...a,z(a.length)]),children:[e.jsx(q,{size:16}),"添加成员"]}),e.jsxs("label",{children:["最多同时工作",e.jsx(S,{value:Math.min(u,d.length),onChange:a=>b(Number(a.target.value)),children:d.map((a,g)=>e.jsxs("option",{value:g+1,children:[g+1," 人"]},g+1))})]})]}),e.jsx(ae,{value:v,onChange:t}),v.length>0&&e.jsxs("label",{className:"collab-supervisor-select",children:["监工",e.jsxs(S,{"aria-label":"选择监工成员",value:c,onChange:a=>C(a.target.value),children:[e.jsx("option",{value:"",children:"仅关联,不启用监工"}),d.map(a=>e.jsxs("option",{value:a.id,children:[a.name," · ",$[a.agentType]]},a.id))]}),e.jsx("small",{className:"collab-muted",children:"复用该成员的 Agent、模型和职责,关闭看板后继续监管。"})]})]}),O&&e.jsx("p",{className:"collab-error",role:"alert",children:O}),e.jsxs("footer",{children:[e.jsx("span",{className:"collab-muted",children:"职责可以留空,发送任务后由群主分配。"}),e.jsx("button",{className:"collab-primary",disabled:m||I||!h.trim(),type:"submit",children:m?"正在保存…":s?"保存修改":"创建并打开群"})]})]}),e.jsx(V,{open:E,initialPath:_?h:void 0,onCancel:()=>A(!1),onConfirm:a=>{f(a),R(!0),A(!1),T("")}})]})}export{ue as C};
1
+ import{r as o,j as e,A as U,e as q,f as X}from"./index-CTJNAMck.js";import{C as J,a as K}from"./types-CFAnlTif.js";import{H as V}from"./HostProjectPicker-BvboCQ0a.js";import{c as P,A as $,U as Y}from"./collaboration-CAgt9AiV.js";import{X as M}from"./x-CeSbythI.js";import{S as Z}from"./file-types-0e-tNIVd.js";import{F as G}from"./trash-2-DLDxY6J7.js";import{C as B}from"./chevron-down-DwzPFeq8.js";function ee(r,s){return[...new Map([...r,...s].map(i=>[i.id,i])).values()]}function ae({value:r,onChange:s}){const[i,p]=o.useState(""),[x,j]=o.useState({data:[],nextCursor:null,total:0}),[y,h]=o.useState(!0),[f,d]=o.useState(""),[N,l]=o.useState(0),n=o.useRef(0),u=o.useRef(!1);o.useEffect(()=>{const t=++n.current;let c=!0;u.current=!0,h(!0),d(""),j({data:[],nextCursor:null,total:0});const C=setTimeout(()=>{P({action:"sessionCatalog",query:i,limit:20}).then(m=>{c&&t===n.current&&j(m)}).catch(m=>{c&&t===n.current&&d(m instanceof Error?m.message:"无法加载会话")}).finally(()=>{c&&t===n.current&&(u.current=!1,h(!1))})},i?200:0);return()=>{c=!1,clearTimeout(C)}},[i,N]);const b=async()=>{if(u.current||!x.nextCursor)return;const t=n.current;u.current=!0,h(!0),d("");try{const c=await P({action:"sessionCatalog",query:i,limit:20,cursor:x.nextCursor});t===n.current&&j(C=>({...c,data:ee(C.data,c.data)}))}catch(c){t===n.current&&d(c instanceof Error?c.message:"加载更多失败")}finally{t===n.current&&(u.current=!1,h(!1))}},v=new Set(r.map(t=>t.id));return e.jsxs("section",{className:"collab-monitor-picker","aria-label":"关联原始会话",children:[e.jsx("div",{className:"collab-monitor-heading",children:e.jsxs("strong",{children:["关联原始会话 ",e.jsxs("small",{children:["选填 · 已选 ",r.length]})]})}),e.jsx("p",{className:"collab-muted",children:"运行中的在前。关联后作为监控对象,恢复或交接时才介入。"}),r.length>0&&e.jsx("div",{className:"collab-monitor-selected","aria-label":"已选会话",children:r.map(t=>e.jsxs("span",{title:`${$[t.agentType]} · ${t.cwd}`,children:[e.jsx(U,{agentType:t.agentType,size:14}),e.jsx("span",{children:t.title}),e.jsx("button",{type:"button","aria-label":`取消关联${t.title}`,onClick:()=>s(r.filter(c=>c.id!==t.id)),children:e.jsx(M,{size:13})})]},t.id))}),e.jsxs("label",{className:"collab-monitor-search",children:[e.jsx(Z,{size:15}),e.jsx("input",{"aria-label":"搜索所有原始会话",placeholder:"搜索所有会话的标题、目录或 Agent",value:i,onChange:t=>p(t.target.value)})]}),e.jsxs("div",{className:"collab-monitor-results","aria-label":"原始会话候选","aria-busy":y,onScroll:t=>{const c=t.currentTarget;c.scrollHeight-c.scrollTop-c.clientHeight<64&&b()},children:[x.data.map(t=>e.jsxs("label",{className:"collab-monitor-row",children:[e.jsx("input",{type:"checkbox","aria-label":`关联${t.title}`,checked:v.has(t.id),disabled:!v.has(t.id)&&r.length>=200,onChange:c=>s(c.target.checked?[...r,{id:t.id,agentType:t.agentType,title:t.title,cwd:t.cwd,projectId:t.projectId}]:r.filter(C=>C.id!==t.id))}),e.jsx(U,{agentType:t.agentType,size:18}),e.jsxs("span",{children:[e.jsx("strong",{children:t.title}),e.jsxs("small",{children:[$[t.agentType]," · ",t.cwd]})]}),e.jsx("em",{className:t.status==="running"?"is-running":"",children:t.status==="running"?"运行中":t.status==="failed"?"异常":t.status==="completed"?"已完成":"空闲"})]},t.id)),!y&&!f&&!x.data.length&&e.jsx("p",{className:"collab-muted",children:i?"没有匹配的会话":"暂无可接入会话"}),y&&e.jsx("p",{className:"collab-muted",role:"status",children:"正在加载会话…"}),x.nextCursor&&!f&&e.jsxs("button",{type:"button",className:"collab-monitor-more",disabled:y,onClick:()=>void b(),children:["加载更多(已显示 ",x.data.length," / ",x.total,")"]})]}),f&&e.jsxs("p",{className:"collab-error",role:"alert",children:[f," ",e.jsx("button",{type:"button",onClick:()=>l(t=>t+1),children:"重新加载"})]})]})}function S({children:r,...s}){return e.jsxs("span",{className:"collab-select",children:[e.jsx("select",{...s,children:r}),e.jsx(B,{size:16,"aria-hidden":"true"})]})}function z(r){return{id:crypto.randomUUID(),name:r===0?"群主":`成员 ${r}`,agentType:"codex",role:""}}function te({member:r,index:s,owner:i,supervisor:p,health:x,onChange:j,onRemove:y}){const[h,f]=o.useState([]),[d,N]=o.useState([]);return o.useEffect(()=>{let l=!0;return f([]),N([]),r.agentType==="customer-agent"?(window.agentApi.getSettings().then(n=>{l&&N(n.profiles.map(({id:u,name:b,modelId:v})=>({id:u,name:b,modelId:v})))}).catch(()=>{}),()=>{l=!1}):(window.agentApi.listAgentModels(r.agentType).then(n=>{l&&f(n.models)}).catch(()=>{}),()=>{l=!1})},[r.agentType]),e.jsxs("fieldset",{className:"collab-member-editor",children:[e.jsxs("legend",{children:[i?e.jsx(J,{size:14}):e.jsx(Y,{size:14}),i?"群主":`成员 ${s}`,p?" · 监工":""]}),y&&e.jsx("button",{type:"button",className:"collab-remove","aria-label":`移除${r.name}`,onClick:y,children:e.jsx(M,{size:16})}),e.jsxs("div",{className:"collab-editor-fields",children:[e.jsxs("label",{children:["名称",e.jsx("input",{value:r.name,maxLength:100,onChange:l=>j({...r,name:l.target.value}),required:!0})]}),e.jsxs("label",{children:["Agent",e.jsx(S,{value:r.agentType,onChange:l=>j({...r,agentType:l.target.value,model:void 0,profileId:void 0}),children:K.map(l=>{var n,u;return e.jsxs("option",{value:l,disabled:((n=x.find(b=>b.agentType===l))==null?void 0:n.available)===!1,children:[$[l],((u=x.find(b=>b.agentType===l))==null?void 0:u.available)===!1?" · 不可用":""]},l)})})]}),e.jsxs("label",{className:"collab-model-field",children:["模型",r.agentType==="customer-agent"?e.jsxs(S,{value:r.profileId||"",onChange:l=>{const n=d.find(u=>u.id===l.target.value);j({...r,profileId:n==null?void 0:n.id,model:n?{id:n.modelId}:void 0})},children:[e.jsx("option",{value:"",children:"沿用默认模型"}),d.map(l=>e.jsxs("option",{value:l.id,children:[l.name," · ",l.modelId]},l.id))]}):e.jsxs(S,{value:r.model?`${r.model.providerID||""}|${r.model.id}`:"",onChange:l=>{const n=h.find(u=>`${u.providerID||""}|${u.id}`===l.target.value);j({...r,model:n?{id:n.id,...n.providerID?{providerID:n.providerID}:{}}:void 0})},children:[e.jsx("option",{value:"",children:"沿用默认模型"}),h.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:p||void 0,children:[e.jsxs("summary",{children:[e.jsx("span",{children:"定位与职责"}),e.jsx("span",{className:"collab-muted",children:r.role.trim()?"已设置":i?"默认安排与汇总":"留空由群主分配"}),e.jsx(B,{size:14})]}),e.jsx("textarea",{"aria-label":`${i?"群主":`成员 ${s}`}的定位与职责(选填)`,rows:2,maxLength:8e3,value:r.role,placeholder:p?"重点看什么:异常暂停、任务交接和交付。允许怎么处理:原任务内自动恢复、继续、协调交接;业务取舍或无法恢复时提醒我决策。":i?"负责拆解目标、分配任务、验收和汇总成果":"例如:负责实现接口;留空由群主自动分配",onChange:l=>j({...r,role:l.target.value})}),p&&e.jsx("p",{className:"collab-muted",children:"在职责中写明关注内容、判断标准、允许的恢复与交接,以及何时提醒你或等待决策。"})]})]})}function ue({cwd:r,initialGroup:s,health:i,onClose:p,onCreated:x}){var H;const[j,y]=o.useState((s==null?void 0:s.name)||""),[h,f]=o.useState((s==null?void 0:s.cwd)||r||""),[d,N]=o.useState(()=>s?structuredClone(s.members):[z(0),z(1)]),[l,n]=o.useState((s==null?void 0:s.ownerId)||d[0].id),[u,b]=o.useState((s==null?void 0:s.maxParallel)||3),[v,t]=o.useState(()=>{var a;return structuredClone(((a=s==null?void 0:s.monitoring)==null?void 0:a.targets)??[])}),[c,C]=o.useState(s?((H=s.monitoring)==null?void 0:H.supervisorId)??"":d[0].id),[m,L]=o.useState(!1),[O,T]=o.useState(""),[E,A]=o.useState(!1),[_,R]=o.useState(!!(s!=null&&s.cwd)),[I,F]=o.useState(!1),Q=async()=>{if(T(""),X()){A(!0);return}F(!0);try{const a=await window.agentApi.openFileDialog();a&&(f(a),R(!0))}catch(a){T(a instanceof Error?a.message:"无法选择工作目录")}finally{F(!1)}};return o.useEffect(()=>{const a=g=>{g.key==="Escape"&&!m&&!E&&!I&&p()};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[p,m,E,I]),e.jsxs("div",{className:"collab-modal-backdrop",onMouseDown:a=>{a.target===a.currentTarget&&!m&&p()},children:[e.jsxs("form",{className:"collab-create",role:"dialog","aria-modal":"true","aria-labelledby":"collab-create-title",onSubmit:async a=>{a.preventDefault(),L(!0),T("");try{if(!h.trim())throw new Error("请先选择工作目录");const g=d.find(k=>{var D;return((D=i.find(W=>W.agentType===k.agentType))==null?void 0:D.available)===!1});if(g&&!s)throw new Error(`${g.name} 选择的 Agent 当前不可用`);const w=await P({...s?{action:"updateGroup",groupId:s.id}:{action:"createGroup"},group:{name:j.trim()||"协作群",cwd:h.trim(),ownerId:l,members:d,maxParallel:Math.min(u,d.length),...v.length?{monitoring:{targets:v,...c?{supervisorId:c}:{}}}:{}}});x(w)}catch(g){T(g instanceof Error?g.message:String(g))}finally{L(!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:p,disabled:m,children:e.jsx(M,{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:j,maxLength:100,placeholder:"例如:产品开发小组",onChange:a=>y(a.target.value)})]}),e.jsxs("label",{children:[e.jsx("span",{children:"工作目录"}),e.jsxs("button",{type:"button",className:"collab-directory-picker","aria-label":"选择工作目录","aria-haspopup":"dialog","aria-expanded":E,title:h||"选择工作目录",disabled:m||I,onClick:()=>void Q(),children:[e.jsx(G,{size:16,"aria-hidden":"true"}),e.jsx("span",{className:h?void 0:"collab-muted",children:I?"正在选择…":h||"选择工作目录"}),e.jsx(q,{size:16,"aria-hidden":"true"})]})]})]}),e.jsx("p",{className:"collab-create-hint collab-muted",children:s?"配置保存后用于新讨论,已有讨论和聊天记录保留。":"Agent 可重复加入,职责留空由群主分配。"}),d.map((a,g)=>e.jsx(te,{member:a,index:g,owner:a.id===l,supervisor:v.length>0&&a.id===c,health:i,onChange:w=>N(k=>k.map(D=>D.id===w.id?w:D)),onRemove:a.id!==l&&d.length>2?()=>{a.id===c&&C(""),N(w=>w.filter(k=>k.id!==a.id))}:void 0},a.id)),e.jsxs("div",{className:"collab-create-actions",children:[e.jsxs("label",{children:["群主",e.jsx(S,{value:l,onChange:a=>n(a.target.value),children:d.map(a=>e.jsx("option",{value:a.id,children:a.name},a.id))})]}),e.jsxs("button",{type:"button",disabled:d.length>=20,onClick:()=>N(a=>[...a,z(a.length)]),children:[e.jsx(q,{size:16}),"添加成员"]}),e.jsxs("label",{children:["最多同时工作",e.jsx(S,{value:Math.min(u,d.length),onChange:a=>b(Number(a.target.value)),children:d.map((a,g)=>e.jsxs("option",{value:g+1,children:[g+1," 人"]},g+1))})]})]}),e.jsx(ae,{value:v,onChange:t}),v.length>0&&e.jsxs("label",{className:"collab-supervisor-select",children:["监工",e.jsxs(S,{"aria-label":"选择监工成员",value:c,onChange:a=>C(a.target.value),children:[e.jsx("option",{value:"",children:"仅关联,不启用监工"}),d.map(a=>e.jsxs("option",{value:a.id,children:[a.name," · ",$[a.agentType]]},a.id))]}),e.jsx("small",{className:"collab-muted",children:"复用该成员的 Agent、模型和职责,关闭看板后继续监管。"})]})]}),O&&e.jsx("p",{className:"collab-error",role:"alert",children:O}),e.jsxs("footer",{children:[e.jsx("span",{className:"collab-muted",children:"职责可以留空,发送任务后由群主分配。"}),e.jsx("button",{className:"collab-primary",disabled:m||I||!h.trim(),type:"submit",children:m?"正在保存…":s?"保存修改":"创建并打开群"})]})]}),e.jsx(V,{open:E,initialPath:_?h:void 0,onCancel:()=>A(!1),onConfirm:a=>{f(a),R(!0),A(!1),T("")}})]})}export{ue as C};
@@ -1 +1 @@
1
- import{r as t,u as O,j as e,R as P,e as S,A as $,a as g}from"./index-d8fS3JdV.js";import{C as _,a as B,b as G}from"./CollaborationTabBridge-Dxq4G1Uk.js";import{C as M}from"./CollaborationCreateDialog-CU1t0iYL.js";import{c as R,U as z,A as T}from"./collaboration-acdqOxaY.js";import{p as H}from"./SessionDashboardBridge-BHVjvDHa.js";import{X as U}from"./x-1GQMVfza.js";import{S as Y,i as q}from"./file-types-CykGmGsd.js";import{P as F,T as Q}from"./trash-2-Bbhd8-xd.js";import{C as X}from"./types-CMhUwzwJ.js";import{A as J}from"./arrow-right-B03zMFiC.js";import"./HostProjectPicker-BEfXuqxT.js";import"./chevron-right-DVhYkZeF.js";import"./chevron-down-DIt_NscV.js";function K(){const[u,m]=t.useState([]),[x,h]=t.useState(!0),[f,o]=t.useState(""),l=t.useRef(0),r=t.useCallback(async()=>{const n=++l.current;h(!0);try{const i=await R({action:"groups"});l.current===n&&(m(i),o(""))}catch(i){l.current===n&&o(i instanceof Error?i.message:String(i))}finally{l.current===n&&h(!1)}},[]);return t.useEffect(()=>{r();const n=()=>{r()};return window.addEventListener("focus",n),()=>{l.current++,window.removeEventListener("focus",n)}},[r]),{groups:u,loading:x,error:f,refresh:r}}function de({onOpen:u,onChanged:m,onClose:x,onViewDashboard:h,cwd:f}){const{groups:o,loading:l,error:r,refresh:n}=K(),[i,L]=t.useState(""),[c,b]=t.useState(null),[j,w]=t.useState(null),[p,y]=t.useState(!1),[v,N]=t.useState(""),[D,I]=t.useState([]),E=O(s=>s.skin);t.useEffect(()=>{!l&&window.parent!==window&&window.parent.postMessage({type:_},window.location.origin)},[l]),t.useEffect(()=>{document.documentElement.setAttribute("data-skin",E)},[E]),t.useEffect(()=>{let s=!0;return window.agentApi.getRuntimeHealth().then(a=>{s&&I(a)}).catch(()=>{}),()=>{s=!1}},[]);const C=s=>{u?u(s):window.parent!==window?window.parent.postMessage({type:B,groupId:s.id,title:s.name},window.location.origin):location.assign(`?view=collaboration&groupId=${encodeURIComponent(s.id)}`)},A=(s,a)=>{m==null||m(s,a),window.parent!==window&&window.parent.postMessage({type:G,groupId:s,...a?{title:a.name}:{deleted:!0}},window.location.origin),n()},k=o.filter(s=>`${s.name} ${s.cwd} ${s.members.map(a=>a.name).join(" ")}`.toLowerCase().includes(i.trim().toLowerCase()));return e.jsxs("main",{className:"collab-dashboard",children:[e.jsxs("header",{className:"collab-dashboard-heading",children:[e.jsxs("div",{children:[e.jsx("span",{className:"collab-eyebrow",children:"协作空间"}),e.jsxs("h1",{children:["群聊列表 ",e.jsx("small",{children:o.length})]}),e.jsx("p",{className:"collab-muted",children:"找到你的群,继续上次的协作。"})]}),e.jsxs("div",{className:"collab-dashboard-tools",children:[e.jsx("button",{onClick:()=>h?h():H({kind:"dashboard"}),children:"Dashboard"}),e.jsx("button",{"aria-label":"刷新群列表",title:"刷新群列表",disabled:l,onClick:()=>void n(),children:e.jsx(P,{size:17})}),e.jsxs("button",{className:"collab-primary",onClick:()=>b("new"),children:[e.jsx(S,{size:17}),"新增群聊"]}),x&&e.jsx("button",{"aria-label":"关闭群看板",onClick:x,children:e.jsx(U,{size:18})})]})]}),e.jsxs("label",{className:"collab-dashboard-search",children:[e.jsx(Y,{size:17}),e.jsx("input",{"aria-label":"搜索群聊",placeholder:"搜索群名、成员或工作目录",value:i,onChange:s=>L(s.target.value)})]}),r&&e.jsxs("div",{className:"collab-error",role:"alert",children:[r,e.jsx("button",{onClick:()=>void n(),children:"重试"})]}),l&&o.length===0?e.jsx("div",{className:"collab-dashboard-empty",role:"status",children:"正在加载已保存的群…"}):!r&&k.length===0?e.jsxs("div",{className:"collab-dashboard-empty",children:[e.jsx(z,{size:32}),e.jsx("h2",{children:i?"没有找到匹配的群":"还没有协作群"}),e.jsx("p",{children:i?"换个关键词试试。":"选一位群主和成员,一起完成任务。"}),!i&&e.jsxs("button",{className:"collab-primary",onClick:()=>b("new"),children:[e.jsx(S,{size:16}),"新建第一个群"]})]}):e.jsx("section",{className:"collab-dashboard-grid","aria-label":"已保存的群聊","aria-busy":l,children:k.map(s=>{const a=s.members.find(d=>d.id===s.ownerId);return e.jsxs("article",{className:"collab-group-card",children:[e.jsxs("div",{className:"collab-card-heading",children:[e.jsxs("button",{className:"collab-card-title",onClick:()=>C(s),title:s.name,children:[e.jsx(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(F,{size:16})}),e.jsx("button",{"aria-label":`删除${s.name}`,title:"删除群聊",onClick:()=>{N(""),w(s)},children:e.jsx(Q,{size:16})})]})]}),e.jsxs("p",{className:"collab-card-owner",children:[e.jsx(X,{size:14}),e.jsxs("span",{children:["群主 · ",a==null?void 0:a.name]}),e.jsx("span",{className:"collab-muted",children:a&&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($,{agentType:d.agentType,size:18})},d.id)),e.jsxs("small",{children:[s.members.length," 人 · 最多 ",s.maxParallel," 人并行"]})]}),e.jsxs("p",{className:"collab-card-path",title:s.cwd,children:[e.jsx(q,{size:14}),e.jsx("span",{children:s.cwd})]}),e.jsxs("footer",{children:[e.jsxs("time",{dateTime:s.createdAt,children:[new Date(s.createdAt).toLocaleDateString("zh-CN")," 创建"]}),e.jsxs("button",{onClick:()=>C(s),children:["进入群聊",e.jsx(J,{size:16})]})]})]},s.id)})}),c&&g.createPortal(e.jsx(M,{cwd:f,initialGroup:c==="new"?void 0:c,health:D,onClose:()=>b(null),onCreated:s=>{const a=c==="new";b(null),A(s.id,s),a&&C(s)}},c==="new"?"new":c.id),document.body),j&&g.createPortal(e.jsx("div",{className:"collab-modal-backdrop",children:e.jsxs("section",{className:"collab-delete-dialog",role:"alertdialog","aria-modal":"true","aria-labelledby":"collab-delete-title","aria-describedby":"collab-delete-description",children:[e.jsxs("h2",{id:"collab-delete-title",children:["删除“",j.name,"”?"]}),e.jsx("p",{id:"collab-delete-description",children:"删除后将停止监工并取消关联定时任务,原始业务会话和工作目录文件会保留。进行中的协作需要先停止。"}),v&&e.jsx("p",{className:"collab-error",role:"alert",children:v}),e.jsxs("footer",{children:[e.jsx("button",{autoFocus:!0,disabled:p,onClick:()=>w(null),children:"取消"}),e.jsx("button",{className:"collab-delete-confirm",disabled:p,onClick:async()=>{y(!0),N("");try{await R({action:"deleteGroup",groupId:j.id}),A(j.id),w(null)}catch(s){N(s instanceof Error?s.message:String(s))}finally{y(!1)}},children:p?"正在删除…":"确认删除"})]})]})}),document.body)]})}export{de as default};
1
+ import{r as t,u as O,j as e,R as P,e as S,A as $,a as g}from"./index-CTJNAMck.js";import{C as _,a as B,b as G}from"./CollaborationTabBridge-Dxq4G1Uk.js";import{C as M}from"./CollaborationCreateDialog-BwiSJbjb.js";import{c as R,U as z,A as T}from"./collaboration-CAgt9AiV.js";import{p as H}from"./SessionDashboardBridge-BPsNDY5Y.js";import{X as U}from"./x-CeSbythI.js";import{S as Y,i as q}from"./file-types-0e-tNIVd.js";import{P as F,T as Q}from"./trash-2-DLDxY6J7.js";import{C as X}from"./types-CFAnlTif.js";import{A as J}from"./arrow-right-BtIv2jiq.js";import"./HostProjectPicker-BvboCQ0a.js";import"./chevron-right-kcIXzCMb.js";import"./chevron-down-DwzPFeq8.js";function K(){const[u,m]=t.useState([]),[x,h]=t.useState(!0),[f,o]=t.useState(""),l=t.useRef(0),r=t.useCallback(async()=>{const n=++l.current;h(!0);try{const i=await R({action:"groups"});l.current===n&&(m(i),o(""))}catch(i){l.current===n&&o(i instanceof Error?i.message:String(i))}finally{l.current===n&&h(!1)}},[]);return t.useEffect(()=>{r();const n=()=>{r()};return window.addEventListener("focus",n),()=>{l.current++,window.removeEventListener("focus",n)}},[r]),{groups:u,loading:x,error:f,refresh:r}}function de({onOpen:u,onChanged:m,onClose:x,onViewDashboard:h,cwd:f}){const{groups:o,loading:l,error:r,refresh:n}=K(),[i,L]=t.useState(""),[c,b]=t.useState(null),[j,w]=t.useState(null),[p,y]=t.useState(!1),[v,N]=t.useState(""),[D,I]=t.useState([]),E=O(s=>s.skin);t.useEffect(()=>{!l&&window.parent!==window&&window.parent.postMessage({type:_},window.location.origin)},[l]),t.useEffect(()=>{document.documentElement.setAttribute("data-skin",E)},[E]),t.useEffect(()=>{let s=!0;return window.agentApi.getRuntimeHealth().then(a=>{s&&I(a)}).catch(()=>{}),()=>{s=!1}},[]);const C=s=>{u?u(s):window.parent!==window?window.parent.postMessage({type:B,groupId:s.id,title:s.name},window.location.origin):location.assign(`?view=collaboration&groupId=${encodeURIComponent(s.id)}`)},A=(s,a)=>{m==null||m(s,a),window.parent!==window&&window.parent.postMessage({type:G,groupId:s,...a?{title:a.name}:{deleted:!0}},window.location.origin),n()},k=o.filter(s=>`${s.name} ${s.cwd} ${s.members.map(a=>a.name).join(" ")}`.toLowerCase().includes(i.trim().toLowerCase()));return e.jsxs("main",{className:"collab-dashboard",children:[e.jsxs("header",{className:"collab-dashboard-heading",children:[e.jsxs("div",{children:[e.jsx("span",{className:"collab-eyebrow",children:"协作空间"}),e.jsxs("h1",{children:["群聊列表 ",e.jsx("small",{children:o.length})]}),e.jsx("p",{className:"collab-muted",children:"找到你的群,继续上次的协作。"})]}),e.jsxs("div",{className:"collab-dashboard-tools",children:[e.jsx("button",{onClick:()=>h?h():H({kind:"dashboard"}),children:"Dashboard"}),e.jsx("button",{"aria-label":"刷新群列表",title:"刷新群列表",disabled:l,onClick:()=>void n(),children:e.jsx(P,{size:17})}),e.jsxs("button",{className:"collab-primary",onClick:()=>b("new"),children:[e.jsx(S,{size:17}),"新增群聊"]}),x&&e.jsx("button",{"aria-label":"关闭群看板",onClick:x,children:e.jsx(U,{size:18})})]})]}),e.jsxs("label",{className:"collab-dashboard-search",children:[e.jsx(Y,{size:17}),e.jsx("input",{"aria-label":"搜索群聊",placeholder:"搜索群名、成员或工作目录",value:i,onChange:s=>L(s.target.value)})]}),r&&e.jsxs("div",{className:"collab-error",role:"alert",children:[r,e.jsx("button",{onClick:()=>void n(),children:"重试"})]}),l&&o.length===0?e.jsx("div",{className:"collab-dashboard-empty",role:"status",children:"正在加载已保存的群…"}):!r&&k.length===0?e.jsxs("div",{className:"collab-dashboard-empty",children:[e.jsx(z,{size:32}),e.jsx("h2",{children:i?"没有找到匹配的群":"还没有协作群"}),e.jsx("p",{children:i?"换个关键词试试。":"选一位群主和成员,一起完成任务。"}),!i&&e.jsxs("button",{className:"collab-primary",onClick:()=>b("new"),children:[e.jsx(S,{size:16}),"新建第一个群"]})]}):e.jsx("section",{className:"collab-dashboard-grid","aria-label":"已保存的群聊","aria-busy":l,children:k.map(s=>{const a=s.members.find(d=>d.id===s.ownerId);return e.jsxs("article",{className:"collab-group-card",children:[e.jsxs("div",{className:"collab-card-heading",children:[e.jsxs("button",{className:"collab-card-title",onClick:()=>C(s),title:s.name,children:[e.jsx(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(F,{size:16})}),e.jsx("button",{"aria-label":`删除${s.name}`,title:"删除群聊",onClick:()=>{N(""),w(s)},children:e.jsx(Q,{size:16})})]})]}),e.jsxs("p",{className:"collab-card-owner",children:[e.jsx(X,{size:14}),e.jsxs("span",{children:["群主 · ",a==null?void 0:a.name]}),e.jsx("span",{className:"collab-muted",children:a&&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($,{agentType:d.agentType,size:18})},d.id)),e.jsxs("small",{children:[s.members.length," 人 · 最多 ",s.maxParallel," 人并行"]})]}),e.jsxs("p",{className:"collab-card-path",title:s.cwd,children:[e.jsx(q,{size:14}),e.jsx("span",{children:s.cwd})]}),e.jsxs("footer",{children:[e.jsxs("time",{dateTime:s.createdAt,children:[new Date(s.createdAt).toLocaleDateString("zh-CN")," 创建"]}),e.jsxs("button",{onClick:()=>C(s),children:["进入群聊",e.jsx(J,{size:16})]})]})]},s.id)})}),c&&g.createPortal(e.jsx(M,{cwd:f,initialGroup:c==="new"?void 0:c,health:D,onClose:()=>b(null),onCreated:s=>{const a=c==="new";b(null),A(s.id,s),a&&C(s)}},c==="new"?"new":c.id),document.body),j&&g.createPortal(e.jsx("div",{className:"collab-modal-backdrop",children:e.jsxs("section",{className:"collab-delete-dialog",role:"alertdialog","aria-modal":"true","aria-labelledby":"collab-delete-title","aria-describedby":"collab-delete-description",children:[e.jsxs("h2",{id:"collab-delete-title",children:["删除“",j.name,"”?"]}),e.jsx("p",{id:"collab-delete-description",children:"删除后将停止监工并取消关联定时任务,原始业务会话和工作目录文件会保留。进行中的协作需要先停止。"}),v&&e.jsx("p",{className:"collab-error",role:"alert",children:v}),e.jsxs("footer",{children:[e.jsx("button",{autoFocus:!0,disabled:p,onClick:()=>w(null),children:"取消"}),e.jsx("button",{className:"collab-delete-confirm",disabled:p,onClick:async()=>{y(!0),N("");try{await R({action:"deleteGroup",groupId:j.id}),A(j.id),w(null)}catch(s){N(s instanceof Error?s.message:String(s))}finally{y(!1)}},children:p?"正在删除…":"确认删除"})]})]})}),document.body)]})}export{de as default};
@@ -1,6 +1,6 @@
1
- import{c as Re,r as c,j as e,A as W,h as Ce,m as Ae,u as Le,e as xe,M as Pe,o as Oe}from"./index-d8fS3JdV.js";import{r as Ie,p as Fe}from"./artifact-links-4m1A00GO.js";import{i as Be,r as _e,p as Ue,a as Ge,n as He,M as We,S as Ye}from"./composer-file-routing-BsSxfxUa.js";import{p as Ke}from"./SessionDashboardBridge-BHVjvDHa.js";import{S as Ve}from"./shield-check-DrxVJwVC.js";import{A as Z,U as X,c as R,D as je}from"./collaboration-acdqOxaY.js";import{X as Te}from"./x-1GQMVfza.js";import{b as ie,C as Ze}from"./types-CMhUwzwJ.js";import{c as Je}from"./CollaborationTabBridge-Dxq4G1Uk.js";import{L as ve}from"./loader-circle-DesEGpVH.js";import{H as Qe}from"./history-C7WUwl_W.js";import{I as Xe}from"./image-plus-B2RK1ogI.js";import{C as et}from"./check-BDiCDSY5.js";/**
1
+ import{c as Re,r as c,j as e,A as W,h as Ce,m as Ae,q as Le,u as Pe,e as xe,M as Oe,s as Fe}from"./index-CTJNAMck.js";import{r as Ie,p as Be}from"./artifact-links-4m1A00GO.js";import{i as _e,r as Ue,p as Ge,a as He,M as We,S as Ye}from"./composer-file-routing-DSC2Eojr.js";import{p as Ke}from"./SessionDashboardBridge-BPsNDY5Y.js";import{S as Ve}from"./shield-check-Btyos6Iv.js";import{A as Z,U as X,c as R,D as je}from"./collaboration-CAgt9AiV.js";import{X as Te}from"./x-CeSbythI.js";import{b as ie,C as Ze}from"./types-CFAnlTif.js";import{c as Je}from"./CollaborationTabBridge-Dxq4G1Uk.js";import{L as ve}from"./loader-circle-CZdAfU-D.js";import{H as Qe}from"./history-Df4LXw6L.js";import{I as Xe}from"./image-plus-COHCHOpI.js";import{C as et}from"./check-BdadwkYj.js";/**
2
2
  * @license lucide-react v0.468.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
5
5
  * See the LICENSE file in the root directory of this source tree.
6
- */const tt=Re("Clock3",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16.5 12",key:"1aq6pp"}]]),st=8;function nt(s,u){return s.split(/(\[[^\]\n]+\]\([^\n)]+\))/g).flatMap(r=>{const a=Ue(r),m=/^\[([^\]]+)\]\(([^)]+)\)$/.exec(r);if(!m||a.some(f=>f.type==="artifact"||f.type==="link"))return a;const p=m[2].trim().replace(/^<|>$/g,"");if(/^[A-Za-z][\w+.-]*:/.test(p)&&!/^[A-Za-z]:[\\/]/.test(p))return a;const n=Ie(p,u);return n?[{type:"artifact",label:m[1],path:n,raw:r}]:a})}function le({text:s,cwd:u}){const r=c.useId(),a=c.useRef(null),[m,p]=c.useState(!1),[n,f]=c.useState(!1);return c.useEffect(()=>{const o=a.current;if(!o)return;const l=()=>{const A=Number.parseFloat(getComputedStyle(o).lineHeight);p(o.scrollHeight>A*st+1)};l();const h=new ResizeObserver(l);return h.observe(o),()=>h.disconnect()},[s]),e.jsxs(e.Fragment,{children:[e.jsx("div",{id:r,ref:a,className:"collab-message-text","data-collapsed":!n,children:nt(s,u).map((o,l)=>{if(o.type==="text")return o.value;if(o.type==="code")return e.jsx("code",{children:o.value},l);if(o.type==="link")return e.jsx("a",{href:o.href,target:"_blank",rel:"noopener noreferrer",onClick:A=>{Be(A)&&_e(o.href)&&A.preventDefault()},children:o.label},l);const h=Ie(o.path,u);return h?e.jsx("button",{type:"button",className:"collab-message-path",title:o.line?`${h}:${o.line}`:h,"aria-label":`查看文件:${o.label}`,onClick:()=>{Fe(h)||window.agentApi.openExternal(/^https?:\/\//i.test(h)?h:`file://${h}`)},children:o.label},l):o.raw})}),m&&e.jsx("button",{type:"button",className:"collab-message-toggle","aria-expanded":n,"aria-controls":r,onClick:()=>f(o=>!o),children:n?"收起":"展开全文"})]})}function at({group:s}){var r;if(!((r=s.monitoring)!=null&&r.targets.length))return null;const u=s.members.find(a=>{var m;return a.id===((m=s.monitoring)==null?void 0:m.supervisorId)});return e.jsxs("div",{className:"collab-supervision-summary",children:[e.jsxs("div",{children:[e.jsx(Ve,{size:14}),e.jsxs("span",{children:[u?`监工 · ${u.name}`:"已关联"," · ",s.monitoring.targets.length," 条原始会话"]})]}),e.jsx("button",{onClick:()=>Ke({kind:"dashboard"}),children:"查看监工与决策"})]})}function ye(s,u,r){var f,o;const a=r==="sender"?s.senderAgentType:s.recipientAgentType;if(a)return a;const m=s[r];if(!m||m==="你"||m===u.name)return;const p=s.direction==="received"?"sender":s.direction==="sent"?"recipient":void 0;if(r===p){const l=((f=u.monitoring)==null?void 0:f.targets.filter(h=>(s.sessionId?h.id===s.sessionId:h.title===m)&&(m===s.sessionTitle||m===h.title)))??[];if(l.length===1)return l[0].agentType}const n=u.members.filter(l=>l.name===m);if(n.length===1)return n[0].agentType;if(m==="监工")return(o=u.members.find(l=>{var h;return l.id===((h=u.monitoring)==null?void 0:h.supervisorId)}))==null?void 0:o.agentType}function rt({message:s,group:u}){const r=ye(s,u,"sender"),a=ye(s,u,"recipient"),m=r?`${s.sender} · ${Z[r]}`:s.sender,p=a?`${s.recipient} · ${Z[a]}`:s.recipient,n=s.sender==="你"&&!r,f=s.direction==="received"?"收到消息":s.direction==="sent"?"发出消息":"监工动态";return e.jsxs("article",{className:`collab-message collab-supervision-message is-${s.direction}`,"data-supervision-message":s.id,"aria-label":`${f}:${s.title}`,children:[e.jsx("span",{className:`collab-avatar collab-supervision-avatar${n?" collab-avatar--user":""}`,role:"img","aria-label":m,title:m,children:r?e.jsx(W,{agentType:r,size:20}):n?"你":e.jsx(X,{size:18,"aria-hidden":"true"})}),e.jsxs("div",{className:"collab-message-body",children:[e.jsxs("div",{className:"collab-supervision-message-heading",children:[e.jsx("strong",{children:s.title}),e.jsx("span",{children:s.historical?"历史监工记录":f})]}),e.jsxs("div",{className:"collab-supervision-message-route","aria-label":`${s.sender}${s.recipient?` → ${s.recipient}`:""}`,children:[e.jsxs("span",{className:"collab-supervision-participant",title:m,children:[r&&e.jsx(W,{agentType:r,size:13}),e.jsx("span",{children:s.sender})]}),s.recipient&&e.jsxs(e.Fragment,{children:[e.jsx("span",{"aria-hidden":"true",children:"→"}),e.jsxs("span",{className:"collab-supervision-participant",title:p,children:[a&&e.jsx(W,{agentType:a,size:13}),e.jsx("span",{children:s.recipient})]})]})]}),s.sessionTitle&&e.jsxs("div",{className:"collab-supervision-message-source",title:s.sessionTitle,children:["来源会话:",s.sessionTitle]}),e.jsx(le,{text:s.content,cwd:s.cwd||u.cwd})]}),e.jsx("time",{dateTime:s.createdAt,title:new Date(s.createdAt).toLocaleString("zh-CN"),children:new Date(s.createdAt).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"})})]})}function we(s,u){return[...new Map([...s,...u].map(r=>[r.id,r])).values()].sort((r,a)=>r.createdAt.localeCompare(a.createdAt)||(r.sequence??0)-(a.sequence??0)||r.id.localeCompare(a.id))}function it(s,u){return[...s.filter(r=>r.kind!=="progress").map(r=>({kind:"discussion",message:r})),...u.map(r=>({kind:"supervision",message:r}))].sort((r,a)=>r.message.createdAt.localeCompare(a.message.createdAt)||(r.kind==="supervision"&&a.kind==="supervision"?(r.message.sequence??0)-(a.message.sequence??0):0)||r.message.id.localeCompare(a.message.id))}function lt(s){const u=Ce(),[r,a]=c.useState([]),[m,p]=c.useState(""),[n,f]=c.useState(!0),[o,l]=c.useState(!1),[h,A]=c.useState(null),k=c.useRef({groupId:s,generation:0,latest:0,before:null,loaded:!1,older:!1});c.useEffect(()=>{const i={groupId:s,generation:k.current.generation+1,latest:0,before:null,loaded:!1,older:!1};k.current=i,a([]),p(""),A(null),f(!0),l(!1)},[s]),c.useEffect(()=>{if(!u)return;const i=k.current;let v=!0,j=!1;const w=async()=>{if(!(j||!s||!Ae())){j=!0;try{const N=await R({action:"supervisionMessages",groupId:s,limit:100,...i.loaded?{afterSequence:i.latest}:{}});if(!v)return;a(z=>we(z,N.messages)),i.loaded||(i.before=N.nextBefore,A(N.nextBefore)),i.latest=Math.max(i.latest,N.latestSequence),i.loaded=!0,p("")}catch(N){v&&p(`监工消息加载失败:${N instanceof Error?N.message:String(N)}`)}finally{j=!1,v&&f(!1)}}};w();const D=setInterval(()=>{w()},2e3);return()=>{v=!1,clearInterval(D)}},[u,s]);const $=c.useCallback(async()=>{const i=k.current;if(!(i.groupId!==s||i.before===null||i.older)){i.older=!0,l(!0);try{const v=await R({action:"supervisionMessages",groupId:s,beforeSequence:i.before,limit:100});if(k.current!==i)return;a(j=>we(j,v.messages)),i.before=v.nextBefore,A(v.nextBefore),p("")}catch(v){k.current===i&&p(`历史监工消息加载失败:${v instanceof Error?v.message:String(v)}`)}finally{i.older=!1,k.current===i&&l(!1)}}},[s]);return{messages:r,error:m,loading:n,loadingOlder:o,hasOlder:h!==null,loadOlder:$}}function Ne({images:s,onPreview:u,onRemove:r}){return s.length?e.jsx("div",{className:`collab-images${r?" is-draft":""}`,"aria-label":r?"待发送图片":"消息图片",children:s.map((a,m)=>e.jsxs("div",{className:"collab-image",children:[e.jsx("button",{type:"button",className:"collab-image-preview","aria-label":`查看图片 ${m+1}`,onClick:()=>u(a),children:e.jsx("img",{src:a,alt:`图片 ${m+1}`,loading:"lazy"})}),r&&e.jsx("button",{type:"button",className:"collab-image-remove","aria-label":`移除图片 ${m+1}`,onClick:()=>r(m),children:e.jsx(Te,{size:13})})]},m))}):null}const Se=10,ot=20*1024*1024;function ct(s){if(s===void 0)return;if(!Array.isArray(s)||s.length>Se)throw new ie(`每条消息最多添加 ${Se} 张图片`);let u=0;for(const r of s){if(typeof r!="string"||!/^data:image\/(?:png|jpeg|gif|webp);base64,[A-Za-z0-9+/]+={0,2}$/.test(r))throw new ie("图片格式无效,仅支持 JPG、PNG、GIF 和 WebP");u+=r.length}if(u>ot)throw new ie("图片总大小超过限制,请减少图片或压缩后重试")}const Q={text:"",images:[]};function dt(s,u,r){const a=`${s}:${u||"new"}`,[m,p]=c.useState({}),[n,f]=c.useState({}),o=c.useRef(),l=m[a]??Q,h=$=>{p(i=>({...i,[a]:$(i[a]??Q)}))},A=async $=>{if($.length){f(i=>({...i,[a]:(i[a]??0)+1}));try{const i=await Ge($,async v=>{const j=await He(v);return new Promise((w,D)=>{const N=new FileReader;N.onload=()=>w(String(N.result)),N.onerror=()=>D(new Error("无法读取图片")),N.readAsDataURL(j)})});(i.attachments.length||i.unsupportedImages.length||i.failedImages.length)&&r("无法添加部分图片,仅支持 JPG、PNG、GIF 和 WebP。"),i.images.length&&h(v=>({...v,images:[...v.images,...i.images]}))}catch(i){r(i instanceof Error?i.message:"无法添加图片")}finally{f(i=>({...i,[a]:Math.max(0,(i[a]??1)-1)}))}}},k=async $=>{var j;if(n[a]||!l.text.trim()&&!l.images.length)return!1;try{ct(l.images)}catch(w){return r(w instanceof Error?w.message:"图片无效"),!1}(((j=o.current)==null?void 0:j.key)!==a||o.current.draft!==l)&&(o.current={key:a,draft:l,id:crypto.randomUUID()});let i=a;return await $(l.text,o.current.id,l.images,w=>{var D;i=`${s}:${w}`,p(N=>({...N,[a]:Q,[i]:N[a]??l})),((D=o.current)==null?void 0:D.draft)===l&&(o.current.key=i)})?(p(w=>w[i]===l?{...w,[i]:Q}:w),!0):!1};return{draft:l.text,images:l.images,reading:!!n[a],addImages:A,submit:k,setDraft:$=>h(i=>({...i,text:$})),removeImage:$=>h(i=>({...i,images:i.images.filter((v,j)=>j!==$)}))}}function ut(s,u){const r=Ce(),[a,m]=c.useState(null),[p,n]=c.useState([]),[f,o]=c.useState(null),[l,h]=c.useState(null),[A,k]=c.useState(""),[$,i]=c.useState(!1),v=c.useRef(0),j=c.useRef(null),w=c.useRef(!1),D=c.useRef(null),N=()=>{v.current++,i(!0)},z=()=>{v.current--,i(v.current>0)},y=c.useRef({groupId:s,selected:f,revision:-1});y.current.groupId=s,y.current.selected=f;const O=c.useCallback(g=>{y.current.selected=g,y.current.revision=-1,o(g),h(null),k("");try{g&&localStorage.setItem(`collaboration:${s}:discussion`,g)}catch{}},[s]),P=c.useCallback(async()=>{const g=await R({action:"discussions",groupId:s});return y.current.groupId===s&&n(g),g},[s]);c.useEffect(()=>{let g=!0;return m(null),n([]),O(null),Promise.all([R({action:"group",groupId:s}),P()]).then(([x,E])=>{var C,T;if(!g)return;m(x);let I=null;try{I=localStorage.getItem(`collaboration:${s}:discussion`)}catch{}I=u||new URLSearchParams(window.location.search).get("discussionId")||I,O(((C=E.find(M=>M.id===I))==null?void 0:C.id)||((T=E[0])==null?void 0:T.id)||null)}).catch(x=>{g&&k(x.message)}),()=>{g=!1}},[s,P,O,u]),c.useEffect(()=>{if(!r||!f)return;let g=!0,x=!1;const E=async()=>{if(!(x||!Ae())){x=!0;try{const C=await R({action:"discussion",discussionId:f,afterRevision:y.current.revision<0?void 0:y.current.revision});if(!g||y.current.selected!==f)return;if(!("unchanged"in C)&&C.revision>=y.current.revision&&(y.current.revision=C.revision,h(C),await P()),D.current){const T=D.current;k(M=>M===T?"":M),D.current=null}}catch(C){g&&(D.current=C instanceof Error?C.message:String(C),k(D.current))}finally{x=!1}}};E();const I=setInterval(()=>{E()},1200);return()=>{g=!1,clearInterval(I)}},[r,f,P]);const Y=()=>(j.current||(N(),j.current=(async()=>{const g=await R({action:"createDiscussion",groupId:s});return y.current.groupId!==s?null:(O(g.id),y.current.revision=g.revision,h(g),await P(),g)})().finally(()=>{j.current=null,z()})),j.current),F=async g=>{if(!(!r||!f)){N();try{const x=await R({action:g,discussionId:f});y.current.selected===f&&x.revision>=y.current.revision&&(y.current.revision=x.revision,h(x))}catch(x){k(x instanceof Error?x.message:String(x))}finally{z()}}},K=async g=>{if(!(!f||(l==null?void 0:l.mode)===g)){N();try{const x=await R({action:"setMode",discussionId:f,mode:g});y.current.selected===f&&x.revision>=y.current.revision&&(y.current.revision=x.revision,h(x))}catch(x){k(x instanceof Error?x.message:String(x))}finally{z()}}},ee=async(g,x,E,I)=>{var C;if(w.current)return!1;w.current=!0,N(),k("");try{const T=f||((C=await Y())==null?void 0:C.id);if(!T)return!1;f||I==null||I(T);const M=await R({action:"send",discussionId:T,text:g,messageId:x,...E!=null&&E.length?{images:E}:{}});return y.current.selected===T&&M.revision>=y.current.revision&&(y.current.revision=M.revision,h(M)),await P(),!0}catch(T){return k(T instanceof Error?T.message:String(T)),!1}finally{w.current=!1,z()}},J=async(g,x)=>{const E=await R({action:"updateRole",groupId:s,memberId:g,role:x});y.current.groupId===s&&m(E)};return{group:l!=null&&l.groupSnapshot&&a?{...l.groupSnapshot,name:a.name}:a,history:p,selected:f,discussion:l,error:A,busy:$,select:O,create:Y,act:F,setMode:K,send:ee,setError:k,updateRole:J}}function ke({member:s,isUser:u=!1,isOwner:r=!1}){const a=u?"你":s?`${s.name} · ${Z[s.agentType]}${r?" · 群主":""}`:"协作动态";return e.jsxs("span",{className:`collab-avatar${u?" collab-avatar--user":""}`,role:"img","aria-label":a,title:a,children:[u?"你":s?e.jsx(W,{agentType:s.agentType,size:20}):e.jsx(X,{size:18,"aria-hidden":"true"}),r&&e.jsx(Ze,{className:"collab-avatar-crown",size:13,"aria-hidden":"true"})]})}function ft({message:s,discussionId:u,onError:r}){var o;const[a,m]=c.useState(""),[p,n]=c.useState(!1);if(!s.question||s.question.resolved)return e.jsxs("span",{className:"collab-muted",children:[e.jsx(et,{size:12})," 已处理"]});const f=async(l,h)=>{n(!0);try{await R({action:"answer",discussionId:u,questionId:s.question.id,answer:l,...h===void 0?{}:{selectedIndices:[h]}})}catch(A){r(A instanceof Error?A.message:String(A))}finally{n(!1)}};return e.jsxs("div",{className:"collab-question",children:[(o=s.question.options)==null?void 0:o.map((l,h)=>e.jsx("button",{disabled:p,onClick:()=>{f(l.label,h)},title:l.description,children:l.label},h)),e.jsxs("form",{onSubmit:l=>{l.preventDefault(),a.trim()&&f(a)},children:[e.jsx("input",{"aria-label":"回答成员问题",value:a,onChange:l=>m(l.target.value),placeholder:"输入回复"}),e.jsx("button",{disabled:p||!a.trim(),children:"回复"})]})]})}function At({groupId:s,initialDiscussionId:u}){var pe,ge;const r=s||new URLSearchParams(location.search).get("groupId")||"",{group:a,history:m,selected:p,discussion:n,error:f,busy:o,select:l,create:h,act:A,setMode:k,send:$,setError:i,updateRole:v}=ut(r,u),j=lt(r),{draft:w,setDraft:D,images:N,reading:z,addImages:y,removeImage:O,submit:P}=dt(r,p,i),[Y,F]=c.useState(!1),[K,ee]=c.useState(null),[J,g]=c.useState(null),x=c.useRef(null),E=c.useRef(null),[I,C]=c.useState(null),[T,M]=c.useState(0),oe=Le(t=>t.skin);c.useEffect(()=>{document.documentElement.setAttribute("data-skin",oe)},[oe]);const ce=!!f||!!a&&(!p||!!n);c.useEffect(()=>{ce&&window.parent!==window&&window.parent.postMessage({type:Je,groupId:r},window.location.origin)},[ce,r]);const de=c.useRef(null),te=c.useRef(null),G=c.useRef(!0);if(c.useEffect(()=>{var t;G.current&&((t=de.current)==null||t.scrollIntoView({block:"end"}))},[n==null?void 0:n.messages.length,j.messages.length,p]),c.useEffect(()=>{G.current=!0},[p]),!a)return e.jsx("div",{className:"collab-loading",children:f?e.jsx("p",{role:"alert",children:f}):e.jsxs(e.Fragment,{children:[e.jsx(ve,{className:"collab-spin"}),"正在打开协作群…"]})});const L=a.members.find(t=>t.id===a.ownerId),B=((n==null?void 0:n.mode)??"task-graph")==="chat",_=I?a.members.filter(t=>`${t.name} ${t.id}`.toLowerCase().includes(I.query.toLowerCase())):[],$e=(t,d)=>{const S=/(?:^|\s)@([^\s@]{0,30})$/.exec(t.slice(0,d));C(S?{query:S[1],start:d-S[1].length-1}:null),M(0)},ue=t=>{const d=E.current;if(!I||!d)return;const S=d.selectionStart??w.length,q=`@${t.name} `;D(w.slice(0,I.start)+q+w.slice(S)),C(null),requestAnimationFrame(()=>{d.focus();const U=I.start+q.length;d.setSelectionRange(U,U)})},V=(n==null?void 0:n.tasks.filter(t=>t.status==="running"))||[],se=(n==null?void 0:n.status)==="running"?n.tasks.filter(t=>t.status==="queued"):[],ne=se.filter(t=>t.result==="等待工作目录空闲"),ae=(n==null?void 0:n.planning)||(n==null?void 0:n.status)==="running"&&n.ownerPending&&V.length===0,H=!ae&&V.length===0&&se.length>0,Ee=ne.length>0?`${ne.length} 个任务等待工作目录空闲,空闲后会自动继续。`:"任务排队中,等待前置任务完成。",fe=H?ne.length>0?"等待工作目录空闲":"任务排队中":n?je[n.status]:"准备好了",re=it((n==null?void 0:n.messages)??[],j.messages),De=t=>{l(t),F(!1),C(null),G.current=!0},me=async()=>{var t;try{await h()&&(F(!1),C(null),(t=E.current)==null||t.focus())}catch(d){i(d instanceof Error?d.message:String(d))}},he=async()=>{o||z||await P($)&&(C(null),G.current=!0)};return e.jsxs("div",{className:"collab-page",children:[e.jsx(We,{image:J?{src:J,alt:"群聊图片"}:null,onClose:()=>g(null)}),Y&&e.jsx("button",{className:"collab-drawer-mask","aria-label":"关闭成员栏",onClick:()=>F(!1)}),e.jsxs("aside",{className:`collab-sidebar${Y?" is-open":""}`,children:[e.jsxs("header",{className:"collab-sidebar-heading",children:[e.jsx("div",{className:"collab-group-icon",children:e.jsx(X,{size:22})}),e.jsxs("div",{children:[e.jsxs("span",{className:"collab-eyebrow",children:["协作群 · ",a.members.length," 人"]}),e.jsx("h2",{children:a.name})]}),e.jsx("button",{className:"collab-mobile-close","aria-label":"收起群成员",onClick:()=>F(!1),children:e.jsx(Te,{size:18})})]}),e.jsxs("div",{className:"collab-roster","aria-label":"群成员",children:[e.jsx("span",{className:"collab-section-label",children:"群成员"}),[L,...a.members.filter(t=>t.id!==L.id)].map(t=>{var be;const d=V.find(b=>b.memberId===t.id),S=t.id===L.id&&(n==null?void 0:n.planning),q=se.find(b=>b.memberId===t.id),ze=(n==null?void 0:n.messages.some(b=>b.memberId===t.id&&b.question&&!b.question.resolved))?"等待你回复":S?"正在安排":d?"正在执行":q?q.result==="等待工作目录空闲"?"等待目录空闲":"排队中":"空闲";return e.jsxs("div",{className:`collab-roster-member${S||d?" is-working":""}`,children:[e.jsxs("button",{onClick:()=>ee(b=>b===t.id?null:t.id),"aria-expanded":K===t.id,children:[e.jsx(ke,{member:t,isOwner:t.id===L.id}),e.jsxs("span",{className:"collab-member-name",children:[e.jsx("strong",{children:t.name}),e.jsx("small",{children:Z[t.agentType]})]}),e.jsx("span",{className:"collab-member-status",children:ze})]}),e.jsx("p",{className:K===t.id?"is-expanded":void 0,children:t.role||(n==null?void 0:n.roles[t.id])||"等待群主分配定位"}),K===t.id&&e.jsxs("div",{className:"collab-member-detail",children:[e.jsx("small",{children:((be=t.model)==null?void 0:be.id)||"默认模型"}),e.jsxs("form",{className:"collab-role-form",onSubmit:b=>{b.preventDefault();const Me=new FormData(b.currentTarget).get("role");v(t.id,String(Me||"")).catch(qe=>i(qe.message))},children:[e.jsxs("label",{children:["定位与职责",e.jsx("textarea",{name:"role",defaultValue:t.role,rows:3,maxLength:8e3,placeholder:"留空由群主分配"},t.role)]}),e.jsx("button",{type:"submit",children:"保存职责"})]}),n==null?void 0:n.tasks.filter(b=>b.memberId===t.id).map(b=>e.jsxs("div",{children:[b.title,e.jsx("span",{children:b.status==="completed"?"已完成":b.status==="running"?"执行中":b.status==="queued"?"等待依赖或空闲":b.status==="failed"?"失败":b.status==="cancelled"?"已取消":"已中断"}),b.result&&e.jsxs("details",{children:[e.jsx("summary",{children:"查看结果"}),e.jsx(le,{text:b.result,cwd:b.cwd||a.cwd})]})]},b.id)),n==null?void 0:n.messages.filter(b=>b.memberId===t.id&&b.kind==="progress").slice(-20).map(b=>e.jsx("small",{children:b.content},b.id))]})]},t.id)})]}),e.jsxs("section",{className:"collab-history","aria-label":"群聊记录",children:[e.jsxs("header",{children:[e.jsxs("span",{className:"collab-section-label",children:[e.jsx(Qe,{size:13}),"群聊记录"]}),e.jsx("button",{disabled:o,"aria-label":"新建群讨论",title:"新讨论",onClick:()=>{me()},children:e.jsx(xe,{size:17})})]}),e.jsx("div",{className:"collab-history-list",children:m.length?m.map(t=>e.jsxs("button",{className:p===t.id?"is-selected":"","aria-current":p===t.id?"page":void 0,onClick:()=>{De(t.id)},children:[e.jsx("strong",{children:t.title}),e.jsxs("span",{children:[e.jsx("time",{children:new Date(t.updatedAt).toLocaleDateString("zh-CN",{month:"short",day:"numeric"})}),e.jsx("small",{children:je[t.status]})]})]},t.id)):e.jsx("p",{className:"collab-muted",children:(pe=a.monitoring)!=null&&pe.targets.length?"监工动态持续保存在群内,普通讨论会列在这里。":"发送第一条任务,记录会保存在这里。"})})]}),e.jsxs("footer",{className:"collab-sidebar-footer",title:a.cwd,children:[e.jsx(at,{group:a}),a.cwd]})]}),e.jsxs("main",{className:"collab-conversation",children:[e.jsxs("header",{className:"collab-conversation-heading",children:[e.jsx("button",{className:"collab-mobile-menu","aria-label":"展开群成员和群聊记录",onClick:()=>F(!0),children:e.jsx(Pe,{size:20})}),e.jsxs("div",{className:"collab-discussion-title",children:[e.jsx("h1",{children:(n==null?void 0:n.title)||((ge=a.monitoring)!=null&&ge.targets.length?"监工动态":"开始一起做事")}),e.jsx("span",{className:"collab-discussion-status","data-status":H?"queued":(n==null?void 0:n.status)||"idle",role:"status","aria-label":fe,title:fe})]}),e.jsxs("div",{className:"collab-heading-actions",children:[n&&e.jsxs("div",{className:"collab-mode-toggle",role:"group","aria-label":"讨论模式",children:[e.jsx("button",{"aria-pressed":!B,disabled:o||!B,title:"每条消息交给群主安排;@成员 仍直接指派",onClick:()=>{k("task-graph")},children:"编排"}),e.jsx("button",{"aria-pressed":B,disabled:o||B,title:"@成员直接指派 · @群主安排分工 · 无 @ 静默",onClick:()=>{k("chat")},children:"@直聊"})]}),n&&["running","waiting"].includes(n.status)&&e.jsx("button",{className:"collab-heading-stop",disabled:o,onClick:()=>{A("stop")},children:e.jsxs("span",{className:"collab-heading-action-content",children:[e.jsx(Ye,{size:12,fill:"currentColor",strokeWidth:0}),"停止"]})}),n&&["waiting","interrupted","stopped"].includes(n.status)&&e.jsx("button",{className:"collab-heading-resume",disabled:o,onClick:()=>{A("resume")},children:e.jsx("span",{className:"collab-heading-action-content",children:"继续协作"})}),e.jsx("button",{className:"collab-heading-new",disabled:o,onClick:()=>{me()},children:e.jsxs("span",{className:"collab-heading-action-content",children:[e.jsx(xe,{size:14}),"新讨论"]})})]})]}),e.jsxs("div",{ref:te,className:"collab-messages",onScroll:()=>{const t=te.current;t&&(G.current=t.scrollHeight-t.scrollTop-t.clientHeight<120)},children:[j.error&&e.jsx("p",{className:"collab-error",role:"alert",children:j.error}),j.hasOlder&&e.jsx("button",{className:"collab-supervision-load",disabled:j.loadingOlder,onClick:async()=>{G.current=!1;const t=te.current,d=(t==null?void 0:t.scrollHeight)??0;await j.loadOlder(),requestAnimationFrame(()=>{t&&(t.scrollTop+=t.scrollHeight-d)})},children:j.loadingOlder?"正在加载…":"查看更早的监工消息"}),j.loading&&!re.length&&e.jsx("p",{className:"collab-muted",role:"status",children:"正在加载群内消息…"}),!re.length&&!j.loading&&e.jsxs("div",{className:"collab-empty",children:[e.jsx("span",{className:"collab-empty-icon",children:e.jsx(X,{size:34})}),e.jsx("h2",{children:"把目标交给这个群。"}),e.jsx("p",{children:B?e.jsxs(e.Fragment,{children:["在群里 @ 成员直接做事,或 @群主 让它拆解安排。",e.jsx("br",{}),"没有 @ 的消息不会触发回应。"]}):e.jsxs(e.Fragment,{children:[L.name,"会安排分工,成员会在这里汇报进展。",e.jsx("br",{}),"@某位成员可直接指派;不 @ 则由",L.name,"安排。"]})}),e.jsx("div",{className:"collab-empty-members",children:a.members.map(t=>e.jsxs("span",{children:[e.jsx(W,{agentType:t.agentType,size:17}),t.name]},t.id))})]}),re.map(t=>{var q;if(t.kind==="supervision")return e.jsx(rt,{message:t.message,group:a},`supervision:${t.message.id}`);const d=t.message,S=a.members.find(U=>U.id===d.memberId);return e.jsxs("article",{className:`collab-message collab-message--${d.kind}`,children:[e.jsx(ke,{member:S,isUser:d.kind==="user",isOwner:d.kind!=="user"&&(S==null?void 0:S.id)===L.id}),e.jsxs("div",{className:"collab-message-body",children:[e.jsx(Ne,{images:d.images??[],onPreview:g}),e.jsx(le,{text:d.content,cwd:((q=n==null?void 0:n.tasks.find(U=>U.id===d.taskId))==null?void 0:q.cwd)||a.cwd}),d.kind==="question"&&p&&e.jsx(ft,{message:d,discussionId:p,onError:i})]}),e.jsx("time",{dateTime:d.createdAt,children:new Date(d.createdAt).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"})})]},`discussion:${d.id}`)}),(ae||V.length>0||H)&&e.jsxs("div",{className:`collab-live-status${H?" is-queued":""}`,role:"status",children:[H?e.jsx(tt,{size:14,"aria-hidden":"true"}):e.jsx(ve,{size:14,className:"collab-spin","aria-hidden":"true"}),e.jsx("span",{children:ae?`${L.name}正在安排下一步`:H?Ee:V.map(t=>{var d;return`${(d=a.members.find(S=>S.id===t.memberId))==null?void 0:d.name}:${t.title}`}).join(" · ")})]}),e.jsx("div",{ref:de})]}),e.jsxs("div",{className:"collab-composer-area",children:[f&&e.jsx("p",{className:"collab-error",role:"alert",children:f}),e.jsxs("div",{className:"collab-composer",children:[e.jsx(Ne,{images:N,onPreview:g,onRemove:O}),e.jsx("input",{ref:x,type:"file",accept:"image/png,image/jpeg,image/gif,image/webp",multiple:!0,hidden:!0,"aria-label":"选择群聊图片",onChange:t=>{const d=Array.from(t.target.files??[]);t.target.value="",y(d)}}),I&&_.length>0&&e.jsx("ul",{className:"collab-mention-list",role:"listbox","aria-label":"选择要提及的成员",children:_.map((t,d)=>e.jsx("li",{children:e.jsxs("button",{type:"button",role:"option","aria-selected":d===T,className:d===T?"is-active":"",title:t.id===L.id?"提及群主:触发一轮安排":`指派给 ${t.name}`,onMouseDown:S=>{S.preventDefault(),ue(t)},children:[e.jsx(W,{agentType:t.agentType,size:15}),e.jsx("span",{children:t.name}),e.jsx("small",{children:t.id===L.id?"群主 · 安排分工":Z[t.agentType]})]})},t.id))}),e.jsx("textarea",{ref:E,"aria-label":"发送群消息",value:w,placeholder:B?"@成员 或 @群主,说说要做什么…":"告诉群主,你想完成什么…",rows:3,onPaste:t=>{const d=Array.from(t.clipboardData.items).filter(S=>S.type.startsWith("image/")).flatMap(S=>{const q=S.getAsFile();return q?[q]:[]});d.length&&(t.preventDefault(),y(d))},onChange:t=>{D(t.target.value),$e(t.target.value,t.target.selectionStart??t.target.value.length)},onBlur:()=>C(null),onKeyDown:t=>{const d=_[T];if(I&&_.length>0&&d){if(t.key==="ArrowDown"||t.key==="ArrowUp"){t.preventDefault(),M(S=>t.key==="ArrowDown"?(S+1)%_.length:(S-1+_.length)%_.length);return}if(t.key==="Enter"||t.key==="Tab"){t.preventDefault(),ue(d);return}if(t.key==="Escape"){t.preventDefault(),C(null);return}}t.key==="Enter"&&!t.shiftKey&&!t.nativeEvent.isComposing&&(t.preventDefault(),he())}}),e.jsxs("footer",{children:[e.jsx("button",{type:"button",className:"collab-add-image","aria-label":"添加群聊图片",title:"添加图片",disabled:o||z,onClick:()=>{var t;return(t=x.current)==null?void 0:t.click()},children:e.jsx(Xe,{size:18})}),e.jsx("span",{children:z?"正在处理图片…":w.includes("@")?"@成员 直接指派,不打扰群主;@群主 触发一轮安排":B?"chat 模式:@成员 直接指派 · @群主 安排分工 · 无 @ 不会回应":(n==null?void 0:n.status)==="running"?"补充要求会交给群主继续安排":"由群主安排分工与并行"}),e.jsx("button",{"aria-label":"发送群消息",className:"collab-primary",disabled:o||z||!w.trim()&&!N.length||(n==null?void 0:n.status)==="stopping",onClick:()=>{he()},children:e.jsx(Oe,{size:20})})]})]}),e.jsx("small",{className:"collab-composer-hint",children:"Enter 发送 · Shift+Enter 换行 · 群聊记录自动保存"})]})]})]})}export{At as default};
6
+ */const tt=Re("Clock3",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16.5 12",key:"1aq6pp"}]]),st=8;function nt(s,u){return s.split(/(\[[^\]\n]+\]\([^\n)]+\))/g).flatMap(r=>{const a=Ge(r),m=/^\[([^\]]+)\]\(([^)]+)\)$/.exec(r);if(!m||a.some(f=>f.type==="artifact"||f.type==="link"))return a;const p=m[2].trim().replace(/^<|>$/g,"");if(/^[A-Za-z][\w+.-]*:/.test(p)&&!/^[A-Za-z]:[\\/]/.test(p))return a;const n=Ie(p,u);return n?[{type:"artifact",label:m[1],path:n,raw:r}]:a})}function le({text:s,cwd:u}){const r=c.useId(),a=c.useRef(null),[m,p]=c.useState(!1),[n,f]=c.useState(!1);return c.useEffect(()=>{const o=a.current;if(!o)return;const l=()=>{const A=Number.parseFloat(getComputedStyle(o).lineHeight);p(o.scrollHeight>A*st+1)};l();const h=new ResizeObserver(l);return h.observe(o),()=>h.disconnect()},[s]),e.jsxs(e.Fragment,{children:[e.jsx("div",{id:r,ref:a,className:"collab-message-text","data-collapsed":!n,children:nt(s,u).map((o,l)=>{if(o.type==="text")return o.value;if(o.type==="code")return e.jsx("code",{children:o.value},l);if(o.type==="link")return e.jsx("a",{href:o.href,target:"_blank",rel:"noopener noreferrer",onClick:A=>{_e(A)&&Ue(o.href)&&A.preventDefault()},children:o.label},l);const h=Ie(o.path,u);return h?e.jsx("button",{type:"button",className:"collab-message-path",title:o.line?`${h}:${o.line}`:h,"aria-label":`查看文件:${o.label}`,onClick:()=>{Be(h)||window.agentApi.openExternal(/^https?:\/\//i.test(h)?h:`file://${h}`)},children:o.label},l):o.raw})}),m&&e.jsx("button",{type:"button",className:"collab-message-toggle","aria-expanded":n,"aria-controls":r,onClick:()=>f(o=>!o),children:n?"收起":"展开全文"})]})}function at({group:s}){var r;if(!((r=s.monitoring)!=null&&r.targets.length))return null;const u=s.members.find(a=>{var m;return a.id===((m=s.monitoring)==null?void 0:m.supervisorId)});return e.jsxs("div",{className:"collab-supervision-summary",children:[e.jsxs("div",{children:[e.jsx(Ve,{size:14}),e.jsxs("span",{children:[u?`监工 · ${u.name}`:"已关联"," · ",s.monitoring.targets.length," 条原始会话"]})]}),e.jsx("button",{onClick:()=>Ke({kind:"dashboard"}),children:"查看监工与决策"})]})}function ye(s,u,r){var f,o;const a=r==="sender"?s.senderAgentType:s.recipientAgentType;if(a)return a;const m=s[r];if(!m||m==="你"||m===u.name)return;const p=s.direction==="received"?"sender":s.direction==="sent"?"recipient":void 0;if(r===p){const l=((f=u.monitoring)==null?void 0:f.targets.filter(h=>(s.sessionId?h.id===s.sessionId:h.title===m)&&(m===s.sessionTitle||m===h.title)))??[];if(l.length===1)return l[0].agentType}const n=u.members.filter(l=>l.name===m);if(n.length===1)return n[0].agentType;if(m==="监工")return(o=u.members.find(l=>{var h;return l.id===((h=u.monitoring)==null?void 0:h.supervisorId)}))==null?void 0:o.agentType}function rt({message:s,group:u}){const r=ye(s,u,"sender"),a=ye(s,u,"recipient"),m=r?`${s.sender} · ${Z[r]}`:s.sender,p=a?`${s.recipient} · ${Z[a]}`:s.recipient,n=s.sender==="你"&&!r,f=s.direction==="received"?"收到消息":s.direction==="sent"?"发出消息":"监工动态";return e.jsxs("article",{className:`collab-message collab-supervision-message is-${s.direction}`,"data-supervision-message":s.id,"aria-label":`${f}:${s.title}`,children:[e.jsx("span",{className:`collab-avatar collab-supervision-avatar${n?" collab-avatar--user":""}`,role:"img","aria-label":m,title:m,children:r?e.jsx(W,{agentType:r,size:20}):n?"你":e.jsx(X,{size:18,"aria-hidden":"true"})}),e.jsxs("div",{className:"collab-message-body",children:[e.jsxs("div",{className:"collab-supervision-message-heading",children:[e.jsx("strong",{children:s.title}),e.jsx("span",{children:s.historical?"历史监工记录":f})]}),e.jsxs("div",{className:"collab-supervision-message-route","aria-label":`${s.sender}${s.recipient?` → ${s.recipient}`:""}`,children:[e.jsxs("span",{className:"collab-supervision-participant",title:m,children:[r&&e.jsx(W,{agentType:r,size:13}),e.jsx("span",{children:s.sender})]}),s.recipient&&e.jsxs(e.Fragment,{children:[e.jsx("span",{"aria-hidden":"true",children:"→"}),e.jsxs("span",{className:"collab-supervision-participant",title:p,children:[a&&e.jsx(W,{agentType:a,size:13}),e.jsx("span",{children:s.recipient})]})]})]}),s.sessionTitle&&e.jsxs("div",{className:"collab-supervision-message-source",title:s.sessionTitle,children:["来源会话:",s.sessionTitle]}),e.jsx(le,{text:s.content,cwd:s.cwd||u.cwd})]}),e.jsx("time",{dateTime:s.createdAt,title:new Date(s.createdAt).toLocaleString("zh-CN"),children:new Date(s.createdAt).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"})})]})}function we(s,u){return[...new Map([...s,...u].map(r=>[r.id,r])).values()].sort((r,a)=>r.createdAt.localeCompare(a.createdAt)||(r.sequence??0)-(a.sequence??0)||r.id.localeCompare(a.id))}function it(s,u){return[...s.filter(r=>r.kind!=="progress").map(r=>({kind:"discussion",message:r})),...u.map(r=>({kind:"supervision",message:r}))].sort((r,a)=>r.message.createdAt.localeCompare(a.message.createdAt)||(r.kind==="supervision"&&a.kind==="supervision"?(r.message.sequence??0)-(a.message.sequence??0):0)||r.message.id.localeCompare(a.message.id))}function lt(s){const u=Ce(),[r,a]=c.useState([]),[m,p]=c.useState(""),[n,f]=c.useState(!0),[o,l]=c.useState(!1),[h,A]=c.useState(null),k=c.useRef({groupId:s,generation:0,latest:0,before:null,loaded:!1,older:!1});c.useEffect(()=>{const i={groupId:s,generation:k.current.generation+1,latest:0,before:null,loaded:!1,older:!1};k.current=i,a([]),p(""),A(null),f(!0),l(!1)},[s]),c.useEffect(()=>{if(!u)return;const i=k.current;let v=!0,j=!1;const w=async()=>{if(!(j||!s||!Ae())){j=!0;try{const N=await R({action:"supervisionMessages",groupId:s,limit:100,...i.loaded?{afterSequence:i.latest}:{}});if(!v)return;a(z=>we(z,N.messages)),i.loaded||(i.before=N.nextBefore,A(N.nextBefore)),i.latest=Math.max(i.latest,N.latestSequence),i.loaded=!0,p("")}catch(N){v&&p(`监工消息加载失败:${N instanceof Error?N.message:String(N)}`)}finally{j=!1,v&&f(!1)}}};w();const D=setInterval(()=>{w()},2e3);return()=>{v=!1,clearInterval(D)}},[u,s]);const $=c.useCallback(async()=>{const i=k.current;if(!(i.groupId!==s||i.before===null||i.older)){i.older=!0,l(!0);try{const v=await R({action:"supervisionMessages",groupId:s,beforeSequence:i.before,limit:100});if(k.current!==i)return;a(j=>we(j,v.messages)),i.before=v.nextBefore,A(v.nextBefore),p("")}catch(v){k.current===i&&p(`历史监工消息加载失败:${v instanceof Error?v.message:String(v)}`)}finally{i.older=!1,k.current===i&&l(!1)}}},[s]);return{messages:r,error:m,loading:n,loadingOlder:o,hasOlder:h!==null,loadOlder:$}}function Ne({images:s,onPreview:u,onRemove:r}){return s.length?e.jsx("div",{className:`collab-images${r?" is-draft":""}`,"aria-label":r?"待发送图片":"消息图片",children:s.map((a,m)=>e.jsxs("div",{className:"collab-image",children:[e.jsx("button",{type:"button",className:"collab-image-preview","aria-label":`查看图片 ${m+1}`,onClick:()=>u(a),children:e.jsx("img",{src:a,alt:`图片 ${m+1}`,loading:"lazy"})}),r&&e.jsx("button",{type:"button",className:"collab-image-remove","aria-label":`移除图片 ${m+1}`,onClick:()=>r(m),children:e.jsx(Te,{size:13})})]},m))}):null}const Se=10,ot=20*1024*1024;function ct(s){if(s===void 0)return;if(!Array.isArray(s)||s.length>Se)throw new ie(`每条消息最多添加 ${Se} 张图片`);let u=0;for(const r of s){if(typeof r!="string"||!/^data:image\/(?:png|jpeg|gif|webp);base64,[A-Za-z0-9+/]+={0,2}$/.test(r))throw new ie("图片格式无效,仅支持 JPG、PNG、GIF 和 WebP");u+=r.length}if(u>ot)throw new ie("图片总大小超过限制,请减少图片或压缩后重试")}const Q={text:"",images:[]};function dt(s,u,r){const a=`${s}:${u||"new"}`,[m,p]=c.useState({}),[n,f]=c.useState({}),o=c.useRef(),l=m[a]??Q,h=$=>{p(i=>({...i,[a]:$(i[a]??Q)}))},A=async $=>{if($.length){f(i=>({...i,[a]:(i[a]??0)+1}));try{const i=await He($,async v=>{const j=await Le(v);return new Promise((w,D)=>{const N=new FileReader;N.onload=()=>w(String(N.result)),N.onerror=()=>D(new Error("无法读取图片")),N.readAsDataURL(j)})});(i.attachments.length||i.unsupportedImages.length||i.failedImages.length)&&r("无法添加部分图片,仅支持 JPG、PNG、GIF 和 WebP。"),i.images.length&&h(v=>({...v,images:[...v.images,...i.images]}))}catch(i){r(i instanceof Error?i.message:"无法添加图片")}finally{f(i=>({...i,[a]:Math.max(0,(i[a]??1)-1)}))}}},k=async $=>{var j;if(n[a]||!l.text.trim()&&!l.images.length)return!1;try{ct(l.images)}catch(w){return r(w instanceof Error?w.message:"图片无效"),!1}(((j=o.current)==null?void 0:j.key)!==a||o.current.draft!==l)&&(o.current={key:a,draft:l,id:crypto.randomUUID()});let i=a;return await $(l.text,o.current.id,l.images,w=>{var D;i=`${s}:${w}`,p(N=>({...N,[a]:Q,[i]:N[a]??l})),((D=o.current)==null?void 0:D.draft)===l&&(o.current.key=i)})?(p(w=>w[i]===l?{...w,[i]:Q}:w),!0):!1};return{draft:l.text,images:l.images,reading:!!n[a],addImages:A,submit:k,setDraft:$=>h(i=>({...i,text:$})),removeImage:$=>h(i=>({...i,images:i.images.filter((v,j)=>j!==$)}))}}function ut(s,u){const r=Ce(),[a,m]=c.useState(null),[p,n]=c.useState([]),[f,o]=c.useState(null),[l,h]=c.useState(null),[A,k]=c.useState(""),[$,i]=c.useState(!1),v=c.useRef(0),j=c.useRef(null),w=c.useRef(!1),D=c.useRef(null),N=()=>{v.current++,i(!0)},z=()=>{v.current--,i(v.current>0)},y=c.useRef({groupId:s,selected:f,revision:-1});y.current.groupId=s,y.current.selected=f;const O=c.useCallback(g=>{y.current.selected=g,y.current.revision=-1,o(g),h(null),k("");try{g&&localStorage.setItem(`collaboration:${s}:discussion`,g)}catch{}},[s]),P=c.useCallback(async()=>{const g=await R({action:"discussions",groupId:s});return y.current.groupId===s&&n(g),g},[s]);c.useEffect(()=>{let g=!0;return m(null),n([]),O(null),Promise.all([R({action:"group",groupId:s}),P()]).then(([x,E])=>{var C,T;if(!g)return;m(x);let I=null;try{I=localStorage.getItem(`collaboration:${s}:discussion`)}catch{}I=u||new URLSearchParams(window.location.search).get("discussionId")||I,O(((C=E.find(q=>q.id===I))==null?void 0:C.id)||((T=E[0])==null?void 0:T.id)||null)}).catch(x=>{g&&k(x.message)}),()=>{g=!1}},[s,P,O,u]),c.useEffect(()=>{if(!r||!f)return;let g=!0,x=!1;const E=async()=>{if(!(x||!Ae())){x=!0;try{const C=await R({action:"discussion",discussionId:f,afterRevision:y.current.revision<0?void 0:y.current.revision});if(!g||y.current.selected!==f)return;if(!("unchanged"in C)&&C.revision>=y.current.revision&&(y.current.revision=C.revision,h(C),await P()),D.current){const T=D.current;k(q=>q===T?"":q),D.current=null}}catch(C){g&&(D.current=C instanceof Error?C.message:String(C),k(D.current))}finally{x=!1}}};E();const I=setInterval(()=>{E()},1200);return()=>{g=!1,clearInterval(I)}},[r,f,P]);const Y=()=>(j.current||(N(),j.current=(async()=>{const g=await R({action:"createDiscussion",groupId:s});return y.current.groupId!==s?null:(O(g.id),y.current.revision=g.revision,h(g),await P(),g)})().finally(()=>{j.current=null,z()})),j.current),F=async g=>{if(!(!r||!f)){N();try{const x=await R({action:g,discussionId:f});y.current.selected===f&&x.revision>=y.current.revision&&(y.current.revision=x.revision,h(x))}catch(x){k(x instanceof Error?x.message:String(x))}finally{z()}}},K=async g=>{if(!(!f||(l==null?void 0:l.mode)===g)){N();try{const x=await R({action:"setMode",discussionId:f,mode:g});y.current.selected===f&&x.revision>=y.current.revision&&(y.current.revision=x.revision,h(x))}catch(x){k(x instanceof Error?x.message:String(x))}finally{z()}}},ee=async(g,x,E,I)=>{var C;if(w.current)return!1;w.current=!0,N(),k("");try{const T=f||((C=await Y())==null?void 0:C.id);if(!T)return!1;f||I==null||I(T);const q=await R({action:"send",discussionId:T,text:g,messageId:x,...E!=null&&E.length?{images:E}:{}});return y.current.selected===T&&q.revision>=y.current.revision&&(y.current.revision=q.revision,h(q)),await P(),!0}catch(T){return k(T instanceof Error?T.message:String(T)),!1}finally{w.current=!1,z()}},J=async(g,x)=>{const E=await R({action:"updateRole",groupId:s,memberId:g,role:x});y.current.groupId===s&&m(E)};return{group:l!=null&&l.groupSnapshot&&a?{...l.groupSnapshot,name:a.name}:a,history:p,selected:f,discussion:l,error:A,busy:$,select:O,create:Y,act:F,setMode:K,send:ee,setError:k,updateRole:J}}function ke({member:s,isUser:u=!1,isOwner:r=!1}){const a=u?"你":s?`${s.name} · ${Z[s.agentType]}${r?" · 群主":""}`:"协作动态";return e.jsxs("span",{className:`collab-avatar${u?" collab-avatar--user":""}`,role:"img","aria-label":a,title:a,children:[u?"你":s?e.jsx(W,{agentType:s.agentType,size:20}):e.jsx(X,{size:18,"aria-hidden":"true"}),r&&e.jsx(Ze,{className:"collab-avatar-crown",size:13,"aria-hidden":"true"})]})}function ft({message:s,discussionId:u,onError:r}){var o;const[a,m]=c.useState(""),[p,n]=c.useState(!1);if(!s.question||s.question.resolved)return e.jsxs("span",{className:"collab-muted",children:[e.jsx(et,{size:12})," 已处理"]});const f=async(l,h)=>{n(!0);try{await R({action:"answer",discussionId:u,questionId:s.question.id,answer:l,...h===void 0?{}:{selectedIndices:[h]}})}catch(A){r(A instanceof Error?A.message:String(A))}finally{n(!1)}};return e.jsxs("div",{className:"collab-question",children:[(o=s.question.options)==null?void 0:o.map((l,h)=>e.jsx("button",{disabled:p,onClick:()=>{f(l.label,h)},title:l.description,children:l.label},h)),e.jsxs("form",{onSubmit:l=>{l.preventDefault(),a.trim()&&f(a)},children:[e.jsx("input",{"aria-label":"回答成员问题",value:a,onChange:l=>m(l.target.value),placeholder:"输入回复"}),e.jsx("button",{disabled:p||!a.trim(),children:"回复"})]})]})}function At({groupId:s,initialDiscussionId:u}){var pe,ge;const r=s||new URLSearchParams(location.search).get("groupId")||"",{group:a,history:m,selected:p,discussion:n,error:f,busy:o,select:l,create:h,act:A,setMode:k,send:$,setError:i,updateRole:v}=ut(r,u),j=lt(r),{draft:w,setDraft:D,images:N,reading:z,addImages:y,removeImage:O,submit:P}=dt(r,p,i),[Y,F]=c.useState(!1),[K,ee]=c.useState(null),[J,g]=c.useState(null),x=c.useRef(null),E=c.useRef(null),[I,C]=c.useState(null),[T,q]=c.useState(0),oe=Pe(t=>t.skin);c.useEffect(()=>{document.documentElement.setAttribute("data-skin",oe)},[oe]);const ce=!!f||!!a&&(!p||!!n);c.useEffect(()=>{ce&&window.parent!==window&&window.parent.postMessage({type:Je,groupId:r},window.location.origin)},[ce,r]);const de=c.useRef(null),te=c.useRef(null),G=c.useRef(!0);if(c.useEffect(()=>{var t;G.current&&((t=de.current)==null||t.scrollIntoView({block:"end"}))},[n==null?void 0:n.messages.length,j.messages.length,p]),c.useEffect(()=>{G.current=!0},[p]),!a)return e.jsx("div",{className:"collab-loading",children:f?e.jsx("p",{role:"alert",children:f}):e.jsxs(e.Fragment,{children:[e.jsx(ve,{className:"collab-spin"}),"正在打开协作群…"]})});const L=a.members.find(t=>t.id===a.ownerId),B=((n==null?void 0:n.mode)??"task-graph")==="chat",_=I?a.members.filter(t=>`${t.name} ${t.id}`.toLowerCase().includes(I.query.toLowerCase())):[],$e=(t,d)=>{const S=/(?:^|\s)@([^\s@]{0,30})$/.exec(t.slice(0,d));C(S?{query:S[1],start:d-S[1].length-1}:null),q(0)},ue=t=>{const d=E.current;if(!I||!d)return;const S=d.selectionStart??w.length,M=`@${t.name} `;D(w.slice(0,I.start)+M+w.slice(S)),C(null),requestAnimationFrame(()=>{d.focus();const U=I.start+M.length;d.setSelectionRange(U,U)})},V=(n==null?void 0:n.tasks.filter(t=>t.status==="running"))||[],se=(n==null?void 0:n.status)==="running"?n.tasks.filter(t=>t.status==="queued"):[],ne=se.filter(t=>t.result==="等待工作目录空闲"),ae=(n==null?void 0:n.planning)||(n==null?void 0:n.status)==="running"&&n.ownerPending&&V.length===0,H=!ae&&V.length===0&&se.length>0,Ee=ne.length>0?`${ne.length} 个任务等待工作目录空闲,空闲后会自动继续。`:"任务排队中,等待前置任务完成。",fe=H?ne.length>0?"等待工作目录空闲":"任务排队中":n?je[n.status]:"准备好了",re=it((n==null?void 0:n.messages)??[],j.messages),De=t=>{l(t),F(!1),C(null),G.current=!0},me=async()=>{var t;try{await h()&&(F(!1),C(null),(t=E.current)==null||t.focus())}catch(d){i(d instanceof Error?d.message:String(d))}},he=async()=>{o||z||await P($)&&(C(null),G.current=!0)};return e.jsxs("div",{className:"collab-page",children:[e.jsx(We,{image:J?{src:J,alt:"群聊图片"}:null,onClose:()=>g(null)}),Y&&e.jsx("button",{className:"collab-drawer-mask","aria-label":"关闭成员栏",onClick:()=>F(!1)}),e.jsxs("aside",{className:`collab-sidebar${Y?" is-open":""}`,children:[e.jsxs("header",{className:"collab-sidebar-heading",children:[e.jsx("div",{className:"collab-group-icon",children:e.jsx(X,{size:22})}),e.jsxs("div",{children:[e.jsxs("span",{className:"collab-eyebrow",children:["协作群 · ",a.members.length," 人"]}),e.jsx("h2",{children:a.name})]}),e.jsx("button",{className:"collab-mobile-close","aria-label":"收起群成员",onClick:()=>F(!1),children:e.jsx(Te,{size:18})})]}),e.jsxs("div",{className:"collab-roster","aria-label":"群成员",children:[e.jsx("span",{className:"collab-section-label",children:"群成员"}),[L,...a.members.filter(t=>t.id!==L.id)].map(t=>{var be;const d=V.find(b=>b.memberId===t.id),S=t.id===L.id&&(n==null?void 0:n.planning),M=se.find(b=>b.memberId===t.id),ze=(n==null?void 0:n.messages.some(b=>b.memberId===t.id&&b.question&&!b.question.resolved))?"等待你回复":S?"正在安排":d?"正在执行":M?M.result==="等待工作目录空闲"?"等待目录空闲":"排队中":"空闲";return e.jsxs("div",{className:`collab-roster-member${S||d?" is-working":""}`,children:[e.jsxs("button",{onClick:()=>ee(b=>b===t.id?null:t.id),"aria-expanded":K===t.id,children:[e.jsx(ke,{member:t,isOwner:t.id===L.id}),e.jsxs("span",{className:"collab-member-name",children:[e.jsx("strong",{children:t.name}),e.jsx("small",{children:Z[t.agentType]})]}),e.jsx("span",{className:"collab-member-status",children:ze})]}),e.jsx("p",{className:K===t.id?"is-expanded":void 0,children:t.role||(n==null?void 0:n.roles[t.id])||"等待群主分配定位"}),K===t.id&&e.jsxs("div",{className:"collab-member-detail",children:[e.jsx("small",{children:((be=t.model)==null?void 0:be.id)||"默认模型"}),e.jsxs("form",{className:"collab-role-form",onSubmit:b=>{b.preventDefault();const qe=new FormData(b.currentTarget).get("role");v(t.id,String(qe||"")).catch(Me=>i(Me.message))},children:[e.jsxs("label",{children:["定位与职责",e.jsx("textarea",{name:"role",defaultValue:t.role,rows:3,maxLength:8e3,placeholder:"留空由群主分配"},t.role)]}),e.jsx("button",{type:"submit",children:"保存职责"})]}),n==null?void 0:n.tasks.filter(b=>b.memberId===t.id).map(b=>e.jsxs("div",{children:[b.title,e.jsx("span",{children:b.status==="completed"?"已完成":b.status==="running"?"执行中":b.status==="queued"?"等待依赖或空闲":b.status==="failed"?"失败":b.status==="cancelled"?"已取消":"已中断"}),b.result&&e.jsxs("details",{children:[e.jsx("summary",{children:"查看结果"}),e.jsx(le,{text:b.result,cwd:b.cwd||a.cwd})]})]},b.id)),n==null?void 0:n.messages.filter(b=>b.memberId===t.id&&b.kind==="progress").slice(-20).map(b=>e.jsx("small",{children:b.content},b.id))]})]},t.id)})]}),e.jsxs("section",{className:"collab-history","aria-label":"群聊记录",children:[e.jsxs("header",{children:[e.jsxs("span",{className:"collab-section-label",children:[e.jsx(Qe,{size:13}),"群聊记录"]}),e.jsx("button",{disabled:o,"aria-label":"新建群讨论",title:"新讨论",onClick:()=>{me()},children:e.jsx(xe,{size:17})})]}),e.jsx("div",{className:"collab-history-list",children:m.length?m.map(t=>e.jsxs("button",{className:p===t.id?"is-selected":"","aria-current":p===t.id?"page":void 0,onClick:()=>{De(t.id)},children:[e.jsx("strong",{children:t.title}),e.jsxs("span",{children:[e.jsx("time",{children:new Date(t.updatedAt).toLocaleDateString("zh-CN",{month:"short",day:"numeric"})}),e.jsx("small",{children:je[t.status]})]})]},t.id)):e.jsx("p",{className:"collab-muted",children:(pe=a.monitoring)!=null&&pe.targets.length?"监工动态持续保存在群内,普通讨论会列在这里。":"发送第一条任务,记录会保存在这里。"})})]}),e.jsxs("footer",{className:"collab-sidebar-footer",title:a.cwd,children:[e.jsx(at,{group:a}),a.cwd]})]}),e.jsxs("main",{className:"collab-conversation",children:[e.jsxs("header",{className:"collab-conversation-heading",children:[e.jsx("button",{className:"collab-mobile-menu","aria-label":"展开群成员和群聊记录",onClick:()=>F(!0),children:e.jsx(Oe,{size:20})}),e.jsxs("div",{className:"collab-discussion-title",children:[e.jsx("h1",{children:(n==null?void 0:n.title)||((ge=a.monitoring)!=null&&ge.targets.length?"监工动态":"开始一起做事")}),e.jsx("span",{className:"collab-discussion-status","data-status":H?"queued":(n==null?void 0:n.status)||"idle",role:"status","aria-label":fe,title:fe})]}),e.jsxs("div",{className:"collab-heading-actions",children:[n&&e.jsxs("div",{className:"collab-mode-toggle",role:"group","aria-label":"讨论模式",children:[e.jsx("button",{"aria-pressed":!B,disabled:o||!B,title:"每条消息交给群主安排;@成员 仍直接指派",onClick:()=>{k("task-graph")},children:"编排"}),e.jsx("button",{"aria-pressed":B,disabled:o||B,title:"@成员直接指派 · @群主安排分工 · 无 @ 静默",onClick:()=>{k("chat")},children:"@直聊"})]}),n&&["running","waiting"].includes(n.status)&&e.jsx("button",{className:"collab-heading-stop",disabled:o,onClick:()=>{A("stop")},children:e.jsxs("span",{className:"collab-heading-action-content",children:[e.jsx(Ye,{size:12,fill:"currentColor",strokeWidth:0}),"停止"]})}),n&&["waiting","interrupted","stopped"].includes(n.status)&&e.jsx("button",{className:"collab-heading-resume",disabled:o,onClick:()=>{A("resume")},children:e.jsx("span",{className:"collab-heading-action-content",children:"继续协作"})}),e.jsx("button",{className:"collab-heading-new",disabled:o,onClick:()=>{me()},children:e.jsxs("span",{className:"collab-heading-action-content",children:[e.jsx(xe,{size:14}),"新讨论"]})})]})]}),e.jsxs("div",{ref:te,className:"collab-messages",onScroll:()=>{const t=te.current;t&&(G.current=t.scrollHeight-t.scrollTop-t.clientHeight<120)},children:[j.error&&e.jsx("p",{className:"collab-error",role:"alert",children:j.error}),j.hasOlder&&e.jsx("button",{className:"collab-supervision-load",disabled:j.loadingOlder,onClick:async()=>{G.current=!1;const t=te.current,d=(t==null?void 0:t.scrollHeight)??0;await j.loadOlder(),requestAnimationFrame(()=>{t&&(t.scrollTop+=t.scrollHeight-d)})},children:j.loadingOlder?"正在加载…":"查看更早的监工消息"}),j.loading&&!re.length&&e.jsx("p",{className:"collab-muted",role:"status",children:"正在加载群内消息…"}),!re.length&&!j.loading&&e.jsxs("div",{className:"collab-empty",children:[e.jsx("span",{className:"collab-empty-icon",children:e.jsx(X,{size:34})}),e.jsx("h2",{children:"把目标交给这个群。"}),e.jsx("p",{children:B?e.jsxs(e.Fragment,{children:["在群里 @ 成员直接做事,或 @群主 让它拆解安排。",e.jsx("br",{}),"没有 @ 的消息不会触发回应。"]}):e.jsxs(e.Fragment,{children:[L.name,"会安排分工,成员会在这里汇报进展。",e.jsx("br",{}),"@某位成员可直接指派;不 @ 则由",L.name,"安排。"]})}),e.jsx("div",{className:"collab-empty-members",children:a.members.map(t=>e.jsxs("span",{children:[e.jsx(W,{agentType:t.agentType,size:17}),t.name]},t.id))})]}),re.map(t=>{var M;if(t.kind==="supervision")return e.jsx(rt,{message:t.message,group:a},`supervision:${t.message.id}`);const d=t.message,S=a.members.find(U=>U.id===d.memberId);return e.jsxs("article",{className:`collab-message collab-message--${d.kind}`,children:[e.jsx(ke,{member:S,isUser:d.kind==="user",isOwner:d.kind!=="user"&&(S==null?void 0:S.id)===L.id}),e.jsxs("div",{className:"collab-message-body",children:[e.jsx(Ne,{images:d.images??[],onPreview:g}),e.jsx(le,{text:d.content,cwd:((M=n==null?void 0:n.tasks.find(U=>U.id===d.taskId))==null?void 0:M.cwd)||a.cwd}),d.kind==="question"&&p&&e.jsx(ft,{message:d,discussionId:p,onError:i})]}),e.jsx("time",{dateTime:d.createdAt,children:new Date(d.createdAt).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"})})]},`discussion:${d.id}`)}),(ae||V.length>0||H)&&e.jsxs("div",{className:`collab-live-status${H?" is-queued":""}`,role:"status",children:[H?e.jsx(tt,{size:14,"aria-hidden":"true"}):e.jsx(ve,{size:14,className:"collab-spin","aria-hidden":"true"}),e.jsx("span",{children:ae?`${L.name}正在安排下一步`:H?Ee:V.map(t=>{var d;return`${(d=a.members.find(S=>S.id===t.memberId))==null?void 0:d.name}:${t.title}`}).join(" · ")})]}),e.jsx("div",{ref:de})]}),e.jsxs("div",{className:"collab-composer-area",children:[f&&e.jsx("p",{className:"collab-error",role:"alert",children:f}),e.jsxs("div",{className:"collab-composer",children:[e.jsx(Ne,{images:N,onPreview:g,onRemove:O}),e.jsx("input",{ref:x,type:"file",accept:"image/png,image/jpeg,image/gif,image/webp",multiple:!0,hidden:!0,"aria-label":"选择群聊图片",onChange:t=>{const d=Array.from(t.target.files??[]);t.target.value="",y(d)}}),I&&_.length>0&&e.jsx("ul",{className:"collab-mention-list",role:"listbox","aria-label":"选择要提及的成员",children:_.map((t,d)=>e.jsx("li",{children:e.jsxs("button",{type:"button",role:"option","aria-selected":d===T,className:d===T?"is-active":"",title:t.id===L.id?"提及群主:触发一轮安排":`指派给 ${t.name}`,onMouseDown:S=>{S.preventDefault(),ue(t)},children:[e.jsx(W,{agentType:t.agentType,size:15}),e.jsx("span",{children:t.name}),e.jsx("small",{children:t.id===L.id?"群主 · 安排分工":Z[t.agentType]})]})},t.id))}),e.jsx("textarea",{ref:E,"aria-label":"发送群消息",value:w,placeholder:B?"@成员 或 @群主,说说要做什么…":"告诉群主,你想完成什么…",rows:3,onPaste:t=>{const d=Array.from(t.clipboardData.items).filter(S=>S.type.startsWith("image/")).flatMap(S=>{const M=S.getAsFile();return M?[M]:[]});d.length&&(t.preventDefault(),y(d))},onChange:t=>{D(t.target.value),$e(t.target.value,t.target.selectionStart??t.target.value.length)},onBlur:()=>C(null),onKeyDown:t=>{const d=_[T];if(I&&_.length>0&&d){if(t.key==="ArrowDown"||t.key==="ArrowUp"){t.preventDefault(),q(S=>t.key==="ArrowDown"?(S+1)%_.length:(S-1+_.length)%_.length);return}if(t.key==="Enter"||t.key==="Tab"){t.preventDefault(),ue(d);return}if(t.key==="Escape"){t.preventDefault(),C(null);return}}t.key==="Enter"&&!t.shiftKey&&!t.nativeEvent.isComposing&&(t.preventDefault(),he())}}),e.jsxs("footer",{children:[e.jsx("button",{type:"button",className:"collab-add-image","aria-label":"添加群聊图片",title:"添加图片",disabled:o||z,onClick:()=>{var t;return(t=x.current)==null?void 0:t.click()},children:e.jsx(Xe,{size:18})}),e.jsx("span",{children:z?"正在处理图片…":w.includes("@")?"@成员 直接指派,不打扰群主;@群主 触发一轮安排":B?"chat 模式:@成员 直接指派 · @群主 安排分工 · 无 @ 不会回应":(n==null?void 0:n.status)==="running"?"补充要求会交给群主继续安排":"由群主安排分工与并行"}),e.jsx("button",{"aria-label":"发送群消息",className:"collab-primary",disabled:o||z||!w.trim()&&!N.length||(n==null?void 0:n.status)==="stopping",onClick:()=>{he()},children:e.jsx(Fe,{size:20})})]})]}),e.jsx("small",{className:"collab-composer-hint",children:"Enter 发送 · Shift+Enter 换行 · 群聊记录自动保存"})]})]})]})}export{At as default};
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./codeSyntax-Cprr1Nm9.js","./index-d8fS3JdV.js","./index-B_fTpc5K.css","./artifact-links-4m1A00GO.js","./rotate-ccw-BdZpOTYP.js","./loader-circle-DesEGpVH.js","./trash-2-Bbhd8-xd.js","./check-BDiCDSY5.js","./download-CuYS63Ny.js","./x-1GQMVfza.js"])))=>i.map(i=>d[i]);
2
- import{c as De,r,a8 as _t,j as t,R as Te}from"./index-d8fS3JdV.js";import{i as de}from"./artifact-links-4m1A00GO.js";import{R as Dt}from"./rotate-ccw-BdZpOTYP.js";import{L as Z}from"./loader-circle-DesEGpVH.js";import{P as It}from"./trash-2-Bbhd8-xd.js";import{C as rt}from"./check-BDiCDSY5.js";import{D as Ht}from"./download-CuYS63Ny.js";import{X as Wt}from"./x-1GQMVfza.js";/**
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./codeSyntax-Dd0hAazb.js","./index-CTJNAMck.js","./index-CQTDnt74.css","./artifact-links-4m1A00GO.js","./rotate-ccw-CFIRtbUD.js","./loader-circle-CZdAfU-D.js","./trash-2-DLDxY6J7.js","./check-BdadwkYj.js","./download-COWHIKec.js","./x-CeSbythI.js"])))=>i.map(i=>d[i]);
2
+ import{c as De,r,ac as _t,j as t,R as Te}from"./index-CTJNAMck.js";import{i as de}from"./artifact-links-4m1A00GO.js";import{R as Dt}from"./rotate-ccw-CFIRtbUD.js";import{L as Z}from"./loader-circle-CZdAfU-D.js";import{P as It}from"./trash-2-DLDxY6J7.js";import{C as rt}from"./check-BdadwkYj.js";import{D as Ht}from"./download-COWHIKec.js";import{X as Wt}from"./x-CeSbythI.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,a8 as _t,j as t,R as Te}from"./index-d8fS3JdV.js";import{i as d
16
16
  * See the LICENSE file in the root directory of this source tree.
17
17
  */const Ft=De("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]),At=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/;function Ot(e){if(!e.trim())return{rows:[],added:0,removed:0};const n=[];let l=0,a=0,x=!1,g=0,c=0;for(const f of e.replace(/\n$/,"").split(`
18
18
  `)){const k=f.match(At);if(k){l=Number(k[1]),a=Number(k[2]),x=!0,n.push({kind:"hunk",text:f,oldLine:null,newLine:null});continue}if(!x){!f.startsWith("diff --git ")&&!f.startsWith("index ")&&!f.startsWith("--- ")&&!f.startsWith("+++ ")&&n.push({kind:"meta",text:f,oldLine:null,newLine:null});continue}f.startsWith("+")?(n.push({kind:"added",text:f.slice(1),oldLine:null,newLine:a}),a+=1,g+=1):f.startsWith("-")?(n.push({kind:"removed",text:f.slice(1),oldLine:l,newLine:null}),l+=1,c+=1):f.startsWith(" ")?(n.push({kind:"context",text:f.slice(1),oldLine:l,newLine:a}),l+=1,a+=1):n.push({kind:"note",text:f,oldLine:null,newLine:null})}return{rows:n,added:g,removed:c}}const it=256*1024,hn=16*1024,Bt={java:"java",js:"javascript",jsx:"javascript",mjs:"javascript",cjs:"javascript",ts:"typescript",tsx:"typescript",json:"json",py:"python",sh:"bash",bash:"bash",zsh:"bash",css:"css",scss:"scss",html:"xml",htm:"xml",xml:"xml",vue:"xml",svelte:"xml",astro:"xml",yml:"yaml",yaml:"yaml",toml:"ini",env:"ini",sql:"sql",c:"c",h:"c",cpp:"cpp",hpp:"cpp",go:"go",rs:"rust",kt:"kotlin",rb:"ruby",md:"markdown",markdown:"markdown",mdown:"markdown",mkdn:"markdown",mdx:"markdown",dockerfile:"dockerfile",gradle:"groovy",properties:"properties",graphql:"graphql",proto:"protobuf"};function Ut(e){var a;const n=((a=e.split(/[/\\]/).pop())==null?void 0:a.toLowerCase())??"";if(n==="dockerfile"||n.startsWith("dockerfile."))return"dockerfile";if(n===".env"||n.startsWith(".env."))return"ini";if(n===".bashrc"||n===".zshrc")return"bash";const l=n.includes(".")?n.slice(n.lastIndexOf(".")+1):"";return Bt[l]??null}function Xt(e){const n=[""];for(const l of e){const a=l.split(`
19
- `);n[n.length-1]+=a[0];for(let x=1;x<a.length;x+=1)n.push(a[x])}return n}function $t({path:e,chunks:n,fileSize:l}){const[a,x]=r.useState(null),g=Ut(e),c=n.length>0&&g!==null&&(l===void 0||l<=it)&&n.reduce((y,u)=>y+u.length,0)<=it;r.useEffect(()=>{if(!c)return;let y=!1;return _t(async()=>{const{highlightCodeLines:u}=await import("./codeSyntax-Cprr1Nm9.js");return{highlightCodeLines:u}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]),import.meta.url).then(({highlightCodeLines:u})=>{y||x(()=>u)}).catch(()=>{}),()=>{y=!0}},[c]);const f=r.useMemo(()=>Xt(n),[n]),k=r.useMemo(()=>c&&a?a(e,n.join("")):null,[n,c,a,e]);return t.jsx("code",{className:"file-code-preview","data-language":g??void 0,children:f.map((y,u)=>{const C=u<f.length-1?`
19
+ `);n[n.length-1]+=a[0];for(let x=1;x<a.length;x+=1)n.push(a[x])}return n}function $t({path:e,chunks:n,fileSize:l}){const[a,x]=r.useState(null),g=Ut(e),c=n.length>0&&g!==null&&(l===void 0||l<=it)&&n.reduce((y,u)=>y+u.length,0)<=it;r.useEffect(()=>{if(!c)return;let y=!1;return _t(async()=>{const{highlightCodeLines:u}=await import("./codeSyntax-Dd0hAazb.js");return{highlightCodeLines:u}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]),import.meta.url).then(({highlightCodeLines:u})=>{y||x(()=>u)}).catch(()=>{}),()=>{y=!0}},[c]);const f=r.useMemo(()=>Xt(n),[n]),k=r.useMemo(()=>c&&a?a(e,n.join("")):null,[n,c,a,e]);return t.jsx("code",{className:"file-code-preview","data-language":g??void 0,children:f.map((y,u)=>{const C=u<f.length-1?`
20
20
  `:"";return t.jsxs(r.Fragment,{children:[t.jsx("span",{className:"file-code-line-number","aria-hidden":"true","data-line-number":u+1}),k?t.jsx("span",{className:"file-code-line-content",dangerouslySetInnerHTML:{__html:k[u]+C}}):t.jsxs("span",{className:"file-code-line-content",children:[y,C]})]},u)})})}const at=new Set(["ts","tsx","js","jsx","mjs","cjs","json","md","markdown","mdown","mkdn","mdx","css","scss","html","htm","xml","yml","yaml","toml","sh","zsh","bash","py","rb","go","rs","java","kt","c","h","cpp","hpp","sql","env","gitignore","dockerfile","txt","log","conf","properties","gradle","lock","csv","vue","svelte","astro","graphql","prisma","proto"]),qt=new Set(["png","jpg","jpeg","gif","webp","bmp","ico","svg"]),Gt=new Set(["html","htm"]),Yt=new Set(["md","markdown","mdown","mkdn","mdx"]),Vt=new Set(at),Jt="allow-scripts allow-popups allow-forms allow-modals",Qt=new Set(["mp4","webm","mov","m4v"]),Zt=new Set(["mp3","wav","m4a","aac","ogg","flac"]),Kt=new Set(["pdf"]),en=8*1024*1024,tn=4096,nn=512*1024,lt=256*1024*1024,rn={aac:"audio/aac",csv:"text/csv",doc:"application/msword",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",gif:"image/gif",html:"text/html",jpeg:"image/jpeg",jpg:"image/jpeg",json:"application/json",m4a:"audio/mp4",m4v:"video/mp4",md:"text/markdown",mov:"video/quicktime",mp3:"audio/mpeg",mp4:"video/mp4",ogg:"audio/ogg",pdf:"application/pdf",png:"image/png",ppt:"application/vnd.ms-powerpoint",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",svg:"image/svg+xml",tar:"application/x-tar",txt:"text/plain",wav:"audio/wav",webm:"video/webm",webp:"image/webp",xls:"application/vnd.ms-excel",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",xml:"application/xml",zip:"application/zip"};function ct(e,n){return n?!e.share||!e.canShare?"unsupported-browser":"ready":"insecure-context"}function dt(e){const n=ut(e);return rn[n]??"application/octet-stream"}function ut(e){var l;return((l=(de(e)?new URL(e).pathname:e).split(".").pop())==null?void 0:l.toLowerCase())??""}async function ft(e,n){var l;if(!n.share||!((l=n.canShare)!=null&&l.call(n,{files:[e]})))return"unsupported";try{return await n.share({files:[e],title:e.name}),"shared"}catch(a){if(a&&typeof a=="object"&&"name"in a&&a.name==="AbortError")return"cancelled";throw a}}function Ie(e){return Uint8Array.from(atob(e),n=>n.charCodeAt(0))}function mt(e,n,l){return e.decode(Ie(n),{stream:!l})}async function Me(e,n,l=()=>{},a=nn){const x=await n("fs:stat",{path:e});if(x.dir)throw new Error("文件夹不能下载");if(x.size>lt)throw new Error("文件超过 256M,请通过终端传输");const g=[];let c=0;do{const f=await n("fs:read",{path:e,offset:c,length:a},6e4),k=Ie(f.data);if(k.byteLength!==f.bytes)throw new Error("文件分块长度不一致,请重试");g.push(k.slice().buffer);const y=f.offset+f.bytes;if(!f.eof&&y<=c)throw new Error("文件下载未取得进展,请重试");if(c=y,l(x.size===0?100:Math.min(100,Math.round(c/x.size*100))),f.eof)break}while(c<x.size);return new Blob(g,{type:"application/octet-stream"})}function pt(e){var l;const n=((l=e.split(".").pop())==null?void 0:l.toLowerCase())??"";return Gt.has(n)}function xt(e){var l;const n=((l=e.split(".").pop())==null?void 0:l.toLowerCase())??"";return Yt.has(n)}function Re(e){var l;const n=((l=e.split(".").pop())==null?void 0:l.toLowerCase())??"";return Vt.has(n)}function ht(e){const n=ut(e);return at.has(n)||!e.includes(".")?"text":qt.has(n)?"image":Qt.has(n)?"video":Zt.has(n)?"audio":Kt.has(n)?"pdf":"hex"}function sn({path:e,gateway:n,onClose:l}){const a=n.request,[x,g]=r.useState([]),[c,f]=r.useState(null),[k,y]=r.useState(""),[u,C]=r.useState(null),[z,b]=r.useState("initial-loading"),[gt,He]=r.useState(!1),[We,K]=r.useState(0),[ue,fe]=r.useState(null),[S,T]=r.useState(null),[Pe,ee]=r.useState(null),[v,te]=r.useState(null),[bt,ne]=r.useState(!1),[Ne,I]=r.useState(null),[j,re]=r.useState(null),[vt,ie]=r.useState(!1),[me,pe]=r.useState(!0),[se,Fe]=r.useState(null),[Ae,xe]=r.useState("unavailable"),[he,ge]=r.useState(!1),[Oe,be]=r.useState(null),[F,ve]=r.useState("file"),[M,Be]=r.useState(!1),[Ue,we]=r.useState(!1),[ye,ke]=r.useState(!1),[w,O]=r.useState(!1),[L,A]=r.useState(""),[_,Xe]=r.useState(!1),[$e,H]=r.useState(null),[wt,B]=r.useState(!1),qe=r.useRef(null),Ge=r.useRef(null),oe=r.useRef(0),W=r.useRef(!1),p=r.useRef(0),U=r.useRef(!1),Se=r.useRef(new TextDecoder("utf-8",{fatal:!1})),je=r.useRef(null),X=r.useRef(null),Ee=r.useRef(!1),m=e?ht(e):"unsupported",Ce=e?de(e):!1,Ye=e?pt(e):!1,Ve=e?xt(e):!1,yt=Ye||Ve,Je=e?Re(e):!1,D=r.useMemo(()=>x.join(""),[x]),P=r.useCallback(()=>{const i=je.current;je.current=null,i&&a("fs:preview-close",{ticketId:i}).catch(()=>{})},[a]),$=r.useCallback(async(i,o=!1,s=p.current)=>{if(!U.current){U.current=!0,b(o?"initial-loading":"loading-more"),fe(null);try{const d=o?0:oe.current,h=await a("fs:read",{path:i,offset:d,length:256*1024});if(s!==p.current)return;const J=h.offset+h.bytes;if(!h.eof&&J<=d)throw new Error("文件加载未取得进展,请重试");o&&(Se.current=new TextDecoder("utf-8",{fatal:!1}));const le=mt(Se.current,h.data,h.eof);oe.current=J,pe(h.eof),K(J),g(E=>o?[le]:[...E,le]),C(E=>({size:h.size,mtime:(E==null?void 0:E.mtime)??0})),T(null),b("ready")}catch(d){if(s!==p.current)return;const h=d.message??String(d);o?(T(h),b("error")):(fe(h),b("ready"))}finally{s===p.current&&(U.current=!1)}}},[a]),Qe=r.useCallback(async(i,o)=>{try{const s=await a("fs:inspect-text-status",{path:i});if(o!==p.current)return;C({size:s.size,mtime:s.mtime}),xe(s.diffStatus),we(!s.tooLarge),B(!1),H(null)}catch{}},[a]),q=r.useCallback(async(i,o=p.current)=>{P(),b("initial-loading"),T(null);try{const s=await a("fs:preview-open",{path:i});if(o!==p.current){a("fs:preview-close",{ticketId:s.ticketId}).catch(()=>{});return}je.current=s.ticketId,X.current=s.url,f(s.url),C({size:s.size,mtime:s.mtime})}catch(s){if(o!==p.current)return;T(s.message??String(s)),b("error")}},[P,a]),Ze=r.useCallback(async(i,o=p.current)=>{b("initial-loading"),T(null);try{const s=await a("fs:read",{path:i,offset:0,length:tn});if(o!==p.current)return;kt(s.data),K(s.bytes),C(d=>({size:s.size,mtime:(d==null?void 0:d.mtime)??0})),b("ready")}catch(s){if(o!==p.current)return;T(s.message??String(s)),b("error")}},[a]);function kt(i){const o=atob(i),s=[];for(let d=0;d+16<=o.length||d===0;d+=16){const h=o.slice(d,d+16),J=[...h].map(E=>E.charCodeAt(0).toString(16).padStart(2,"0")).join(" ").padEnd(47," "),le=[...h].map(E=>E.charCodeAt(0)>=32&&E.charCodeAt(0)<127?E:".").join("");if(s.push(`${d.toString(16).padStart(8,"0")} ${J} |${le}|`),d+16>o.length)break}y(s.join(`
21
21
  `))}const R=r.useCallback((i,o)=>{const s=++p.current,d=Re(i);if(U.current=!1,P(),X.current=null,g([]),f(null),y(""),C(null),T(null),fe(null),K(0),ee(null),te(null),ne(!1),I(null),re(null),ie(!1),pe(!0),Fe(null),xe("unavailable"),ge(!1),be(null),ve("file"),we(!1),ke(!1),O(!1),A(""),H(null),B(!1),b("initial-loading"),W.current=!1,oe.current=0,Se.current=new TextDecoder("utf-8",{fatal:!1}),de(i)){X.current=i,f(i);return}a("fs:watch",{path:on(i)}).catch(()=>{}),o==="text"?(Qe(i,s),$(i,!0,s),d&&Ee.current&&q(i,s)):o==="image"||o==="video"||o==="audio"||o==="pdf"?q(i,s):o==="hex"&&(a("fs:stat",{path:i}).then(h=>{s===p.current&&C(h)}).catch(()=>{}),Ze(i,s))},[$,Ze,q,Qe,P,a]);r.useEffect(()=>{if(e)return Ee.current=!1,Be(!1),R(e,m),()=>{p.current++,U.current=!1,P()}},[e]),r.useEffect(()=>{let i=null;const o=s=>{const d=s.detail;!d||d!==e||(i!==null&&window.clearTimeout(i),i=window.setTimeout(()=>{m==="text"&&W.current?B(!0):e&&R(e,m)},350))};return window.addEventListener("file-changed",o),()=>{window.removeEventListener("file-changed",o),i!==null&&window.clearTimeout(i)}},[e,m,R]),r.useEffect(()=>{W.current=w},[w]),r.useEffect(()=>{if(z!=="initial-loading"){He(!1);return}const i=window.setTimeout(()=>He(!0),120);return()=>window.clearTimeout(i)},[e,z]),r.useEffect(()=>{const i=Ge.current,o=qe.current;if(!i||!o||!e||m!=="text"||me||w||F!=="file"||z!=="ready"||ue)return;const s=new IntersectionObserver(d=>{d.some(h=>h.isIntersecting)&&$(e)},{root:o,rootMargin:"0px 0px 360px 0px"});return s.observe(i),()=>s.disconnect()},[w,me,m,$,ue,e,z,F]);const Ke=r.useCallback((i,o)=>{const s=URL.createObjectURL(i),d=document.createElement("a");d.href=s,d.download=Q(o),d.style.display="none",document.body.appendChild(d),d.click(),d.remove(),window.setTimeout(()=>URL.revokeObjectURL(s),1e3)},[]),St=r.useCallback(async()=>{if(!e||v!==null||j!==null)return;if(de(e)){window.open(e,"_blank","noopener,noreferrer");return}const i=e;ee(null),I(null),ne(!1),te(0);try{const o=await Me(i,a,te);Ke(o,i),ne(!0),window.setTimeout(()=>ne(!1),1500)}catch(o){ee((o==null?void 0:o.message)??String(o))}finally{te(null)}},[Ke,v,e,a,j]),jt=r.useCallback(async()=>{if(!e||j!==null||v!==null)return;const i=e;ee(null),I(null),ie(!1);const o=ct(navigator,window.isSecureContext);if(o==="insecure-context"){I("当前页面是 HTTP,手机 Chrome 仅允许 HTTPS 页面分享文件,请改用 HTTPS 地址后重试");return}if(o==="unsupported-browser"){I("当前浏览器不支持分享文件,请使用最新版手机 Chrome 或系统浏览器");return}re(0);try{const s=await Me(i,a,re),d=new File([s],Q(i),{type:dt(i),lastModified:(u==null?void 0:u.mtime)??Date.now()}),h=await ft(d,navigator);h==="unsupported"?I("当前浏览器不支持分享此文件类型,请使用下载按钮"):h==="shared"&&(ie(!0),window.setTimeout(()=>ie(!1),1500))}catch(s){I((s==null?void 0:s.message)??String(s))}finally{re(null)}},[v,u==null?void 0:u.mtime,e,a,j]),ae=r.useCallback(async(i,o)=>{const s=await a("fs:inspect-text",{path:i},6e4);return o!==p.current?null:(C({size:s.size,mtime:s.mtime}),xe(s.diffStatus),Fe(s.patch),we(!s.tooLarge&&s.validUtf8),s)},[a]),Et=r.useCallback(async()=>{if(!e||ye)return;const i=p.current;ke(!0),H(null);try{const o=await ae(e,i);if(!o)return;if(o.tooLarge||o.data===null)throw new Error("文件超过 8M,无法在线编辑");if(!o.validUtf8)throw new Error("此文件不是有效的 UTF-8 文本,无法在线编辑");const s=new TextDecoder("utf-8",{fatal:!1}).decode(Ie(o.data));g([s]),K(o.size),oe.current=o.size,pe(!0),A(s),B(!1),W.current=!0,O(!0)}catch(o){i===p.current&&H(o.message??String(o))}finally{i===p.current&&ke(!1)}},[ye,ae,e]),et=r.useCallback(async()=>{if(!e||he||(ve("diff"),se!==null))return;const i=p.current;ge(!0),be(null);try{await ae(e,i)}catch(o){i===p.current&&be(o.message??String(o))}finally{i===p.current&&ge(!1)}},[he,ae,se,e]),Ct=r.useCallback(()=>{if(!e)return;const i=!M;Ee.current=i,Be(i),i&&!c&&q(e,p.current)},[q,c,e,M]),G=r.useCallback(i=>{X.current===i&&(T(null),b("ready"))},[]),Y=r.useCallback(i=>{X.current===i&&(T("文件预览加载失败,请重试"),b("error"))},[]),Lt=r.useCallback(()=>{e&&R(e,m)},[m,e,R]),zt=r.useCallback(()=>{L!==D&&!window.confirm("放弃未保存的修改?")||(W.current=!1,O(!1),A(""),H(null),B(!1))},[L,D]),Tt=r.useCallback(()=>{w&&L!==D&&!window.confirm("放弃未保存的修改并关闭预览?")||(p.current++,P(),l())},[L,w,l,P,D]),Mt=r.useCallback(()=>{e&&(W.current=!1,O(!1),A(""),R(e,"text"))},[e,R]),Rt=r.useCallback(async()=>{if(!(!e||!u||_||L===D)){Xe(!0),H(null);try{await a("fs:write-text",{path:e,content:L,expectedSize:u.size,expectedMtime:u.mtime},6e4),W.current=!1,O(!1),A(""),R(e,"text")}catch(i){H((i==null?void 0:i.message)??String(i))}finally{Xe(!1)}}},[L,u,e,a,_,R,D]),V=r.useMemo(()=>Ot(se??""),[se]);if(!e)return null;const tt=((u==null?void 0:u.size)??0)>en,Le=!tt&&(Ae==="changed"||Ae==="untracked"),nt=m==="text"&&Ue&&z!=="initial-loading"&&!ye&&!S;return t.jsxs("div",{style:{height:"100%",display:"flex",flexDirection:"column",background:"var(--ui-term-col-bg, #101014)",color:"var(--ui-text, #e8e8ee)",colorScheme:"var(--ui-color-scheme, dark)",accentColor:"var(--ui-tab-accent, #7aa2f7)"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"9px 12px",borderBottom:"1px solid var(--ui-tree-border, #222)",background:"var(--ui-tree-bg, #121218)",flexShrink:0},children:[t.jsx("span",{className:"pv-name",style:{minWidth:0,flex:"1 1 auto",fontSize:12.5,color:"var(--ui-text, #e8e8ee)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:Q(e)}),u&&t.jsx("span",{style:{fontSize:10.5,color:"var(--ui-history-meta, #666)",flexShrink:0},children:ze(u.size)}),w?t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",onClick:zt,disabled:_,style:N,"aria-label":"取消编辑",title:"取消编辑",children:t.jsx(Dt,{size:15,strokeWidth:1.8,"aria-hidden":"true"})}),t.jsx("button",{type:"button",onClick:Rt,disabled:_||L===D,style:{...N,color:"var(--ui-tab-accent, #7aa2f7)",opacity:_||L===D?.55:1},"aria-label":_?"正在保存":"保存修改",title:_?"正在保存":"保存修改",children:_?t.jsx(Z,{className:"tree-spin",size:15,strokeWidth:1.8,"aria-hidden":"true"}):t.jsx(Nt,{size:15,strokeWidth:1.8,"aria-hidden":"true"})})]}):t.jsxs(t.Fragment,{children:[m==="text"&&t.jsx("button",{type:"button",onClick:Et,disabled:!nt,style:{...N,opacity:nt?1:.45},"aria-label":"编辑文件",title:tt?"文件超过 8M,无法在线编辑":Ue?"编辑文件":"此文件不可编辑",children:t.jsx(It,{size:15,strokeWidth:1.8,"aria-hidden":"true"})}),t.jsx("button",{type:"button",onClick:St,disabled:v!==null||j!==null,style:{...N,opacity:v!==null||j!==null?.72:1},"aria-label":Ce?"打开原始地址":v===null?"下载到当前设备":`正在下载 ${v}%`,title:Ce?"打开原始地址":v===null?"下载到当前设备":`正在下载 ${v}%`,children:v!==null?t.jsx(Z,{className:"tree-spin",size:15,strokeWidth:1.8,"aria-hidden":"true"}):bt?t.jsx(rt,{size:15,strokeWidth:1.8,"aria-hidden":"true"}):t.jsx(Ht,{size:15,strokeWidth:1.8,"aria-hidden":"true"})}),!Ce&&t.jsx("button",{type:"button",onClick:jt,disabled:j!==null||v!==null,style:{...N,opacity:j!==null||v!==null?.72:1},"aria-label":"分享文件",title:j===null?"分享文件":`正在准备 ${j}%`,children:j!==null?t.jsx(Z,{className:"tree-spin",size:15,strokeWidth:1.8,"aria-hidden":"true"}):vt?t.jsx(rt,{size:15,strokeWidth:1.8,"aria-hidden":"true"}):t.jsx(Ft,{size:15,strokeWidth:1.8,"aria-hidden":"true"})}),Je&&t.jsx("button",{type:"button",onClick:Ct,"aria-pressed":M,style:{...N,...M?{color:"var(--ui-tab-accent, #7aa2f7)",borderColor:"var(--ui-tab-accent, #7aa2f7)"}:{}},"aria-label":M?"退出浏览器预览":"浏览器预览",title:M?"退出浏览器预览":Ye?"在浏览器中预览渲染效果":Ve?"预览 Markdown 排版效果":"在浏览器中查看原始文件",children:t.jsx(Pt,{size:15,strokeWidth:1.8,"aria-hidden":"true"})})]}),t.jsx("button",{type:"button",onClick:Tt,style:N,"aria-label":"关闭预览",title:"关闭预览",children:t.jsx(Wt,{size:15,strokeWidth:1.8,"aria-hidden":"true"})})]}),m==="text"&&Le&&!w&&!M&&t.jsxs("div",{style:{display:"flex",alignItems:"center",minHeight:34,padding:"0 12px",borderBottom:"1px solid var(--ui-tree-border, #222)",background:"var(--ui-tree-bg, #121218)",flexShrink:0},children:[t.jsxs("div",{role:"tablist","aria-label":"文件预览模式",style:{display:"inline-flex",gap:2,padding:2,border:"1px solid var(--ui-panel-input-border, #333)",borderRadius:6,background:"var(--ui-muted-surface, #1b1b22)"},children:[t.jsx(st,{active:F==="diff",onClick:et,children:"变更"}),t.jsx(st,{active:F==="file",onClick:()=>ve("file"),children:"文件"})]}),t.jsxs("span",{style:{marginLeft:9,display:"inline-flex",gap:7,fontFamily:'"SF Mono", Menlo, Consolas, monospace',fontSize:10.5},children:[V.added>0&&t.jsxs("span",{style:{color:"var(--ui-success, #059669)"},children:["+",V.added]}),V.removed>0&&t.jsxs("span",{style:{color:"var(--ui-error, #dc2626)"},children:["-",V.removed]})]})]}),Ne&&t.jsxs("div",{role:"alert",style:{flexShrink:0,padding:"8px 12px",borderBottom:"1px solid var(--ui-tree-border, #222)",background:"var(--ui-tree-bg, #121218)",color:"var(--ui-error, #f7768e)",fontSize:12.5,lineHeight:1.5},children:["分享失败:",Ne]}),t.jsxs("div",{ref:qe,className:"pv-body",style:{position:"relative",flex:1,minHeight:0,overflow:"auto",background:"var(--ui-term-col-bg, #101014)",WebkitOverflowScrolling:"touch"},children:[Pe&&t.jsxs("div",{style:{padding:"10px 14px 0",color:"var(--ui-error, #f7768e)",fontSize:12.5},children:["下载失败:",Pe]}),$e&&t.jsx("div",{role:"alert",style:{padding:"10px 14px",color:"var(--ui-error, #f7768e)",fontSize:12.5},children:$e}),wt&&w&&t.jsxs("div",{role:"alert",style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px",borderBottom:"1px solid var(--ui-tree-border, #222)",color:"var(--ui-error, #f7768e)",fontSize:12},children:[t.jsx("span",{style:{flex:1},children:"文件已在其他位置更新"}),t.jsxs("button",{type:"button",onClick:Mt,style:_e,children:[t.jsx(Te,{size:13,strokeWidth:1.8,"aria-hidden":"true"}),"重新加载"]})]}),c&&!S&&m==="image"&&t.jsx("img",{src:c,alt:e,onLoad:()=>G(c),onError:()=>Y(c),style:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain",display:"block",margin:"0 auto"}}),c&&!S&&m==="video"&&t.jsx("video",{src:c,controls:!0,playsInline:!0,preload:"metadata",onLoadedMetadata:()=>G(c),onError:()=>Y(c),style:{maxWidth:"100%",maxHeight:"100%",display:"block",margin:"0 auto"}}),c&&!S&&m==="audio"&&t.jsx("div",{style:{display:"grid",placeItems:"center",height:"100%"},children:t.jsx("audio",{src:c,controls:!0,autoPlay:!0,onLoadedMetadata:()=>G(c),onError:()=>Y(c),style:{width:"min(420px, 88%)"}})}),c&&!S&&m==="pdf"&&t.jsx("iframe",{src:c,title:e,onLoad:()=>G(c),onError:()=>Y(c),style:{width:"100%",height:"100%",border:"none"}}),c&&!S&&m==="text"&&Je&&M&&!w&&t.jsx("iframe",{src:yt?`${c}/${encodeURIComponent(Q(e))}`:c,sandbox:Jt,title:e,onLoad:()=>G(c),onError:()=>Y(c),style:{width:"100%",height:"100%",border:"none",background:"#fff"}}),m==="text"&&w&&!S&&t.jsx("textarea",{value:L,onChange:i=>A(i.target.value),spellCheck:!1,autoCapitalize:"off",autoCorrect:"off","aria-label":`编辑 ${Q(e)}`,style:{width:"100%",minHeight:"100%",boxSizing:"border-box",resize:"none",margin:0,padding:"12px 14px calc(env(safe-area-inset-bottom) + 36px)",border:0,outline:0,background:"var(--ui-term-col-bg, #101014)",color:"var(--ui-history-item-text, var(--ui-text, #d6d6de))",fontFamily:'"SF Mono", Menlo, Consolas, monospace',fontSize:12,lineHeight:1.5,tabSize:2}}),m==="text"&&!w&&!S&&Le&&F==="diff"&&(Oe?t.jsx(ce,{label:Oe,actionLabel:"重试",onAction:()=>void et(),tone:"error"}):he?t.jsx(ce,{label:"正在加载变更"}):t.jsx(an,{rows:V.rows})),(m==="hex"||m==="text"&&!w&&!M&&(!Le||F==="file"))&&!S&&t.jsxs(t.Fragment,{children:[t.jsx("pre",{style:{margin:0,padding:"11px 13px calc(env(safe-area-inset-bottom) + 36px)",fontFamily:'"SF Mono", Menlo, Consolas, monospace',fontSize:m==="hex"?10.5:12,lineHeight:1.45,color:m==="hex"?"var(--ui-muted-text, #9aa)":"var(--ui-history-item-text, var(--ui-text, #d6d6de))",whiteSpace:m==="hex"?"pre":"pre-wrap",wordBreak:m==="hex"?"normal":"break-word"},children:m==="hex"?k:t.jsx($t,{path:e,chunks:x,fileSize:u==null?void 0:u.size})}),m==="text"&&!me&&t.jsxs("div",{ref:Ge,role:"status","aria-live":"polite",style:{minHeight:44,padding:"0 14px calc(env(safe-area-inset-bottom) + 8px)",display:"flex",alignItems:"center",justifyContent:"center",gap:7,color:"var(--ui-history-meta, #666)",fontSize:11.5},children:[z==="loading-more"&&t.jsx(Z,{className:"tree-spin",size:14,strokeWidth:1.8,"aria-hidden":"true",style:{color:"var(--ui-tab-accent, #7aa2f7)"}}),ue?t.jsxs(t.Fragment,{children:[t.jsx("span",{children:"加载失败"}),t.jsxs("button",{type:"button",onClick:()=>$(e),style:_e,children:[t.jsx(Te,{size:13,strokeWidth:1.8,"aria-hidden":"true"}),"重试"]})]}):t.jsx("span",{children:z==="loading-more"?"正在加载更多":`${ze(We)} / ${ze((u==null?void 0:u.size)??We)}`})]})]}),gt&&z==="initial-loading"&&t.jsx(ce,{label:"正在加载文件"}),S&&z==="error"&&t.jsx(ce,{label:S,actionLabel:"重试",onAction:Lt,tone:"error"})]})]})}function Q(e){return e.slice(e.lastIndexOf("/")+1)||e}function on(e){const n=e.lastIndexOf("/");return n>0?e.slice(0,n):"/"}function ze(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}K`:`${(e/1024/1024).toFixed(1)}M`}const N={width:28,height:28,borderRadius:7,border:"1px solid var(--ui-panel-input-border, #333)",display:"inline-flex",alignItems:"center",justifyContent:"center",background:"var(--ui-muted-surface, #1b1b22)",color:"var(--ui-muted-text, #ccc)",flexShrink:0,cursor:"pointer",WebkitAppRegion:"no-drag"},_e={minHeight:28,padding:"0 9px",borderRadius:6,border:"1px solid var(--ui-panel-input-border, #333)",display:"inline-flex",alignItems:"center",justifyContent:"center",gap:5,background:"var(--ui-muted-surface, #1b1b22)",color:"var(--ui-muted-text, #ccc)",cursor:"pointer",fontSize:11};function ce({label:e,actionLabel:n,onAction:l,tone:a="muted"}){return t.jsxs("div",{role:a==="error"?"alert":"status",style:{position:"absolute",inset:0,minHeight:120,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:10,color:a==="error"?"var(--ui-error, #f7768e)":"var(--ui-muted-text, #9aa)",fontSize:12.5},children:[a!=="error"&&t.jsx(Z,{className:"tree-spin",size:18,strokeWidth:1.8,"aria-hidden":"true",style:{color:"var(--ui-tab-accent, #7aa2f7)"}}),t.jsx("span",{children:e}),n&&l&&t.jsxs("button",{type:"button",onClick:l,style:_e,children:[t.jsx(Te,{size:13,strokeWidth:1.8,"aria-hidden":"true"}),n]})]})}function st({active:e,onClick:n,children:l}){return t.jsx("button",{type:"button",role:"tab","aria-selected":e,onClick:n,style:{minWidth:48,height:24,padding:"0 9px",border:0,borderRadius:4,background:e?"var(--ui-tab-accent, #7aa2f7)":"transparent",color:e?"var(--ui-tab-active-text, #fff)":"var(--ui-muted-text, #9aa)",fontSize:11,fontWeight:600,cursor:"pointer"},children:l})}function an({rows:e}){return t.jsx("div",{style:{minWidth:"100%",width:"max-content",paddingBottom:"calc(env(safe-area-inset-bottom) + 36px)",fontFamily:'"SF Mono", Menlo, Consolas, monospace',fontSize:11.5,lineHeight:1.55},children:e.map((n,l)=>{const a=n.kind==="added",x=n.kind==="removed",g=n.kind==="hunk"||n.kind==="meta"||n.kind==="note",c=a?"color-mix(in srgb, var(--ui-success, #059669) 12%, transparent)":x?"color-mix(in srgb, var(--ui-error, #dc2626) 11%, transparent)":n.kind==="hunk"?"color-mix(in srgb, var(--ui-tab-accent, #7aa2f7) 10%, transparent)":"transparent",f=a?"var(--ui-success, #059669)":x?"var(--ui-error, #dc2626)":g?"var(--ui-muted-text, #9aa)":"var(--ui-history-item-text, var(--ui-text, #d6d6de))";return t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"42px 42px 22px minmax(0, 1fr)",minHeight:18,background:c,color:f},children:[t.jsx("span",{style:ot,children:n.oldLine??""}),t.jsx("span",{style:ot,children:n.newLine??""}),t.jsx("span",{style:{textAlign:"center",userSelect:"none",color:f},children:a?"+":x?"-":" "}),t.jsx("span",{style:{padding:"0 12px 0 6px",whiteSpace:"pre-wrap",overflowWrap:"anywhere"},children:n.text||" "})]},`${n.kind}-${l}`)})})}const ot={padding:"0 6px",borderRight:"1px solid var(--ui-tree-border, #222)",color:"var(--ui-history-meta, #666)",textAlign:"right",userSelect:"none"},gn=Object.freeze(Object.defineProperty({__proto__:null,MAX_CLIENT_DOWNLOAD_BYTES:lt,decodeTextChunk:mt,default:sn,isBrowserPreviewPath:Re,isHtmlPreviewPath:pt,isMarkdownPreviewPath:xt,kindOf:ht,mimeTypeForPath:dt,nativeFileShareReadiness:ct,readFileForClientDownload:Me,shareFileWithNativePicker:ft},Symbol.toStringTag,{value:"Module"}));export{sn as F,it as M,hn as a,gn as b,Ut as c};
@@ -1,4 +1,4 @@
1
- import{c as ce,r as l,j as s,P as oe}from"./index-d8fS3JdV.js";import{S as de,i as Y,F as ue,D as fe,P as pe,a as me,b as he,c as xe,d as je,N as be,e as ve,f as ze,g as Ne,h as ge,j as Fe}from"./file-types-CykGmGsd.js";import{L as ke}from"./locate-fixed-UXM91vCS.js";import{X as ye}from"./x-1GQMVfza.js";import{L as Z}from"./loader-circle-DesEGpVH.js";import{C as _}from"./chevron-down-DIt_NscV.js";import{C as S}from"./chevron-right-DVhYkZeF.js";import{F as T}from"./trash-2-Bbhd8-xd.js";/**
1
+ import{c as ce,r as l,j as s,P as oe}from"./index-CTJNAMck.js";import{S as de,i as Y,F as ue,D as fe,P as pe,a as me,b as he,c as xe,d as je,N as be,e as ve,f as ze,g as Ne,h as ge,j as Fe}from"./file-types-0e-tNIVd.js";import{L as ke}from"./locate-fixed-ByJuEKxC.js";import{X as ye}from"./x-CeSbythI.js";import{L as Z}from"./loader-circle-CZdAfU-D.js";import{C as _}from"./chevron-down-DwzPFeq8.js";import{C as S}from"./chevron-right-kcIXzCMb.js";import{F as T}from"./trash-2-DLDxY6J7.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-d8fS3JdV.js";import{F as d}from"./FilePreview-Oo8sZH0t.js";import m from"./FileTree-qJTRdDPQ.js";import{X as f}from"./x-1GQMVfza.js";import"./artifact-links-4m1A00GO.js";import"./rotate-ccw-BdZpOTYP.js";import"./loader-circle-DesEGpVH.js";import"./trash-2-Bbhd8-xd.js";import"./check-BDiCDSY5.js";import"./download-CuYS63Ny.js";import"./file-types-CykGmGsd.js";import"./locate-fixed-UXM91vCS.js";import"./chevron-down-DIt_NscV.js";import"./chevron-right-DVhYkZeF.js";function z({open:a,tab:s,gateway:r,cwd:l,selectedPath:i,revealRequest:p,onTabChange:o,onSelectPath:t,onClose:n}){return a?e.jsxs("section",{className:`desktop-file-workspace${i?" has-preview":""}`,"aria-label":"我的文件",children:[e.jsxs("aside",{className:"desktop-file-drawer",children:[e.jsxs("header",{className:"desktop-file-drawer-header",children:[e.jsxs("div",{className:"desktop-file-drawer-tabs",role:"tablist","aria-label":"文件工作区视图",children:[e.jsx("button",{type:"button",role:"tab","aria-selected":s==="files",className:s==="files"?"is-active":"",onClick:()=>o("files"),children:"文件"}),e.jsx("button",{type:"button",role:"tab","aria-selected":s==="history",className:s==="history"?"is-active":"",onClick:()=>o("history"),children:"历史"})]}),e.jsx("button",{type:"button",className:"desktop-file-workspace-close ui-icon-button ui-icon-button--small",onClick:n,"aria-label":"关闭我的文件",title:"关闭",children:e.jsx(f,{size:15,"aria-hidden":"true"})})]}),s==="files"?l?e.jsx(m,{gateway:r,ready:!0,followCwd:!0,cwd:l,onOpenFile:c=>t(c),selectedPath:i,revealRequest:p}):e.jsx("div",{className:"desktop-file-workspace-empty",children:"请先选择一个项目目录"}):e.jsxs("div",{className:"desktop-file-workspace-empty",children:[e.jsx("strong",{children:"终端历史在 Web 控制台中可用"}),e.jsx("span",{children:"Electron 当前没有终端上下文,因此不会提供填入或执行操作。"})]}),e.jsxs("footer",{className:"desktop-file-drawer-footer",children:[e.jsx("span",{}),"实时同步"]})]}),i&&e.jsx("div",{className:"desktop-file-preview",children:e.jsx(d,{path:i,gateway:r,onClose:()=>t(null)})})]}):null}export{z as default};
1
+ import{j as e}from"./index-CTJNAMck.js";import{F as d}from"./FilePreview-EGUAbGpH.js";import m from"./FileTree-aJGl1V0W.js";import{X as f}from"./x-CeSbythI.js";import"./artifact-links-4m1A00GO.js";import"./rotate-ccw-CFIRtbUD.js";import"./loader-circle-CZdAfU-D.js";import"./trash-2-DLDxY6J7.js";import"./check-BdadwkYj.js";import"./download-COWHIKec.js";import"./file-types-0e-tNIVd.js";import"./locate-fixed-ByJuEKxC.js";import"./chevron-down-DwzPFeq8.js";import"./chevron-right-kcIXzCMb.js";function z({open:a,tab:s,gateway:r,cwd:l,selectedPath:i,revealRequest:p,onTabChange:o,onSelectPath:t,onClose:n}){return a?e.jsxs("section",{className:`desktop-file-workspace${i?" has-preview":""}`,"aria-label":"我的文件",children:[e.jsxs("aside",{className:"desktop-file-drawer",children:[e.jsxs("header",{className:"desktop-file-drawer-header",children:[e.jsxs("div",{className:"desktop-file-drawer-tabs",role:"tablist","aria-label":"文件工作区视图",children:[e.jsx("button",{type:"button",role:"tab","aria-selected":s==="files",className:s==="files"?"is-active":"",onClick:()=>o("files"),children:"文件"}),e.jsx("button",{type:"button",role:"tab","aria-selected":s==="history",className:s==="history"?"is-active":"",onClick:()=>o("history"),children:"历史"})]}),e.jsx("button",{type:"button",className:"desktop-file-workspace-close ui-icon-button ui-icon-button--small",onClick:n,"aria-label":"关闭我的文件",title:"关闭",children:e.jsx(f,{size:15,"aria-hidden":"true"})})]}),s==="files"?l?e.jsx(m,{gateway:r,ready:!0,followCwd:!0,cwd:l,onOpenFile:c=>t(c),selectedPath:i,revealRequest:p}):e.jsx("div",{className:"desktop-file-workspace-empty",children:"请先选择一个项目目录"}):e.jsxs("div",{className:"desktop-file-workspace-empty",children:[e.jsx("strong",{children:"终端历史在 Web 控制台中可用"}),e.jsx("span",{children:"Electron 当前没有终端上下文,因此不会提供填入或执行操作。"})]}),e.jsxs("footer",{className:"desktop-file-drawer-footer",children:[e.jsx("span",{}),"实时同步"]})]}),i&&e.jsx("div",{className:"desktop-file-preview",children:e.jsx(d,{path:i,gateway:r,onClose:()=>t(null)})})]}):null}export{z as default};
@@ -1,4 +1,4 @@
1
- import{r as a,d as f,j as e}from"./index-d8fS3JdV.js";import{F as w}from"./page-C2e368Dx.js";import{R as y}from"./rotate-cw-D-zPMe4i.js";import"./RunningSessionsIcon-DJxTmxZn.js";import"./x-1GQMVfza.js";import"./chevron-down-DIt_NscV.js";import"./check-BDiCDSY5.js";import"./trash-2-Bbhd8-xd.js";import"./external-link-Baeyco26.js";import"./chevron-right-DVhYkZeF.js";import"./calendar-days-D1OJEOKr.js";import"./artifact-links-4m1A00GO.js";import"./clipboard-BvwmdR4z.js";import"./pin-BcXr5230.js";import"./CollaborationTabBridge-Dxq4G1Uk.js";import"./SessionDashboardBridge-BHVjvDHa.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 I({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 d=>{if(!d.ok)throw new Error("Flow Studio config request failed");const c=await d.json();if(!c.entryUrl)throw new Error("Flow Studio entry is not configured");const l=new URL(c.entryUrl);if(l.protocol!=="http:"&&l.protocol!=="https:")throw new Error("Flow Studio entry URL is invalid");i||o(h(l.toString(),f()))}).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 p=()=>{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:p,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,d as f,j as e}from"./index-CTJNAMck.js";import{F as w}from"./page-9-9EC7QM.js";import{R as y}from"./rotate-cw-B_vFqNsz.js";import"./RunningSessionsIcon-DmCYwIYD.js";import"./x-CeSbythI.js";import"./chevron-down-DwzPFeq8.js";import"./check-BdadwkYj.js";import"./trash-2-DLDxY6J7.js";import"./external-link-T3kil1jt.js";import"./chevron-right-kcIXzCMb.js";import"./calendar-days-BeI09qof.js";import"./artifact-links-4m1A00GO.js";import"./clipboard-BvwmdR4z.js";import"./pin-2YlrlSJv.js";import"./CollaborationTabBridge-Dxq4G1Uk.js";import"./SessionDashboardBridge-BPsNDY5Y.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 I({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 d=>{if(!d.ok)throw new Error("Flow Studio config request failed");const c=await d.json();if(!c.entryUrl)throw new Error("Flow Studio entry is not configured");const l=new URL(c.entryUrl);if(l.protocol!=="http:"&&l.protocol!=="https:")throw new Error("Flow Studio entry URL is invalid");i||o(h(l.toString(),f()))}).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 p=()=>{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:p,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; } }