botmux 3.16.0 → 3.17.0

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 (619) hide show
  1. package/dist/.runtime-build-id +1 -1
  2. package/dist/adapters/backend/riff-backend.d.ts +84 -1
  3. package/dist/adapters/backend/riff-backend.d.ts.map +1 -1
  4. package/dist/adapters/backend/riff-backend.js +202 -19
  5. package/dist/adapters/backend/riff-backend.js.map +1 -1
  6. package/dist/adapters/backend/sandbox.d.ts +8 -0
  7. package/dist/adapters/backend/sandbox.d.ts.map +1 -1
  8. package/dist/adapters/backend/sandbox.js +15 -0
  9. package/dist/adapters/backend/sandbox.js.map +1 -1
  10. package/dist/adapters/backend/tmux-backend.d.ts +61 -7
  11. package/dist/adapters/backend/tmux-backend.d.ts.map +1 -1
  12. package/dist/adapters/backend/tmux-backend.js +80 -9
  13. package/dist/adapters/backend/tmux-backend.js.map +1 -1
  14. package/dist/adapters/backend/tmux-pipe-backend.d.ts +62 -4
  15. package/dist/adapters/backend/tmux-pipe-backend.d.ts.map +1 -1
  16. package/dist/adapters/backend/tmux-pipe-backend.js +240 -27
  17. package/dist/adapters/backend/tmux-pipe-backend.js.map +1 -1
  18. package/dist/adapters/cli/claude-code.d.ts.map +1 -1
  19. package/dist/adapters/cli/claude-code.js +4 -2
  20. package/dist/adapters/cli/claude-code.js.map +1 -1
  21. package/dist/adapters/cli/coco.d.ts.map +1 -1
  22. package/dist/adapters/cli/coco.js +27 -0
  23. package/dist/adapters/cli/coco.js.map +1 -1
  24. package/dist/adapters/cli/codex-app.d.ts.map +1 -1
  25. package/dist/adapters/cli/codex-app.js +28 -0
  26. package/dist/adapters/cli/codex-app.js.map +1 -1
  27. package/dist/adapters/cli/codex.d.ts.map +1 -1
  28. package/dist/adapters/cli/codex.js +51 -23
  29. package/dist/adapters/cli/codex.js.map +1 -1
  30. package/dist/adapters/cli/dsh-tui.d.ts +24 -0
  31. package/dist/adapters/cli/dsh-tui.d.ts.map +1 -0
  32. package/dist/adapters/cli/dsh-tui.js +99 -0
  33. package/dist/adapters/cli/dsh-tui.js.map +1 -0
  34. package/dist/adapters/cli/dsh.d.ts.map +1 -1
  35. package/dist/adapters/cli/dsh.js +15 -9
  36. package/dist/adapters/cli/dsh.js.map +1 -1
  37. package/dist/adapters/cli/fs-policy.d.ts +98 -1
  38. package/dist/adapters/cli/fs-policy.d.ts.map +1 -1
  39. package/dist/adapters/cli/fs-policy.js +182 -7
  40. package/dist/adapters/cli/fs-policy.js.map +1 -1
  41. package/dist/adapters/cli/grok.js +16 -18
  42. package/dist/adapters/cli/grok.js.map +1 -1
  43. package/dist/adapters/cli/model-catalog-json.d.ts +17 -0
  44. package/dist/adapters/cli/model-catalog-json.d.ts.map +1 -0
  45. package/dist/adapters/cli/model-catalog-json.js +43 -0
  46. package/dist/adapters/cli/model-catalog-json.js.map +1 -0
  47. package/dist/adapters/cli/oh-my-pi.d.ts +2 -0
  48. package/dist/adapters/cli/oh-my-pi.d.ts.map +1 -1
  49. package/dist/adapters/cli/oh-my-pi.js +45 -13
  50. package/dist/adapters/cli/oh-my-pi.js.map +1 -1
  51. package/dist/adapters/cli/opencode.js +1 -1
  52. package/dist/adapters/cli/opencode.js.map +1 -1
  53. package/dist/adapters/cli/registry.d.ts +2 -1
  54. package/dist/adapters/cli/registry.d.ts.map +1 -1
  55. package/dist/adapters/cli/registry.js +6 -1
  56. package/dist/adapters/cli/registry.js.map +1 -1
  57. package/dist/adapters/cli/relay.d.ts.map +1 -1
  58. package/dist/adapters/cli/relay.js +7 -0
  59. package/dist/adapters/cli/relay.js.map +1 -1
  60. package/dist/adapters/cli/seed.d.ts.map +1 -1
  61. package/dist/adapters/cli/seed.js +6 -0
  62. package/dist/adapters/cli/seed.js.map +1 -1
  63. package/dist/adapters/cli/shared-hints.d.ts.map +1 -1
  64. package/dist/adapters/cli/shared-hints.js +20 -14
  65. package/dist/adapters/cli/shared-hints.js.map +1 -1
  66. package/dist/adapters/cli/traex.d.ts +4 -0
  67. package/dist/adapters/cli/traex.d.ts.map +1 -1
  68. package/dist/adapters/cli/traex.js +153 -0
  69. package/dist/adapters/cli/traex.js.map +1 -1
  70. package/dist/adapters/cli/types.d.ts +42 -1
  71. package/dist/adapters/cli/types.d.ts.map +1 -1
  72. package/dist/autostart.d.ts +6 -0
  73. package/dist/autostart.d.ts.map +1 -1
  74. package/dist/autostart.js +21 -1
  75. package/dist/autostart.js.map +1 -1
  76. package/dist/bot-registry.d.ts +27 -0
  77. package/dist/bot-registry.d.ts.map +1 -1
  78. package/dist/bot-registry.js +62 -2
  79. package/dist/bot-registry.js.map +1 -1
  80. package/dist/cli/vc-agent.d.ts.map +1 -1
  81. package/dist/cli/vc-agent.js +21 -3
  82. package/dist/cli/vc-agent.js.map +1 -1
  83. package/dist/cli.d.ts.map +1 -1
  84. package/dist/cli.js +92 -1
  85. package/dist/cli.js.map +1 -1
  86. package/dist/codex-app-runner.js +28 -0
  87. package/dist/codex-app-runner.js.map +1 -1
  88. package/dist/core/bot-steer-directive.d.ts +25 -0
  89. package/dist/core/bot-steer-directive.d.ts.map +1 -0
  90. package/dist/core/bot-steer-directive.js +47 -0
  91. package/dist/core/bot-steer-directive.js.map +1 -0
  92. package/dist/core/command-handler.d.ts.map +1 -1
  93. package/dist/core/command-handler.js +102 -18
  94. package/dist/core/command-handler.js.map +1 -1
  95. package/dist/core/dashboard-ipc-server.d.ts.map +1 -1
  96. package/dist/core/dashboard-ipc-server.js +53 -13
  97. package/dist/core/dashboard-ipc-server.js.map +1 -1
  98. package/dist/core/dashboard-rows.d.ts +3 -0
  99. package/dist/core/dashboard-rows.d.ts.map +1 -1
  100. package/dist/core/dashboard-rows.js +26 -5
  101. package/dist/core/dashboard-rows.js.map +1 -1
  102. package/dist/core/dashboard-url.d.ts +10 -1
  103. package/dist/core/dashboard-url.d.ts.map +1 -1
  104. package/dist/core/dashboard-url.js +12 -2
  105. package/dist/core/dashboard-url.js.map +1 -1
  106. package/dist/core/dispatch.d.ts.map +1 -1
  107. package/dist/core/dispatch.js +5 -4
  108. package/dist/core/dispatch.js.map +1 -1
  109. package/dist/core/existing-app-server.d.ts +22 -0
  110. package/dist/core/existing-app-server.d.ts.map +1 -0
  111. package/dist/core/existing-app-server.js +85 -0
  112. package/dist/core/existing-app-server.js.map +1 -0
  113. package/dist/core/native-topic-id.d.ts +9 -0
  114. package/dist/core/native-topic-id.d.ts.map +1 -0
  115. package/dist/core/native-topic-id.js +14 -0
  116. package/dist/core/native-topic-id.js.map +1 -0
  117. package/dist/core/per-bot-env.d.ts.map +1 -1
  118. package/dist/core/per-bot-env.js +10 -0
  119. package/dist/core/per-bot-env.js.map +1 -1
  120. package/dist/core/plugins/mcp/gateway.d.ts +27 -3
  121. package/dist/core/plugins/mcp/gateway.d.ts.map +1 -1
  122. package/dist/core/plugins/mcp/gateway.js +272 -26
  123. package/dist/core/plugins/mcp/gateway.js.map +1 -1
  124. package/dist/core/plugins/mcp/host.d.ts +18 -0
  125. package/dist/core/plugins/mcp/host.d.ts.map +1 -1
  126. package/dist/core/plugins/mcp/host.js +80 -16
  127. package/dist/core/plugins/mcp/host.js.map +1 -1
  128. package/dist/core/plugins/mcp/launch-record.d.ts +14 -0
  129. package/dist/core/plugins/mcp/launch-record.d.ts.map +1 -0
  130. package/dist/core/plugins/mcp/launch-record.js +63 -0
  131. package/dist/core/plugins/mcp/launch-record.js.map +1 -0
  132. package/dist/core/session-activity.d.ts +11 -0
  133. package/dist/core/session-activity.d.ts.map +1 -1
  134. package/dist/core/session-activity.js +23 -0
  135. package/dist/core/session-activity.js.map +1 -1
  136. package/dist/core/session-group-birth.d.ts.map +1 -1
  137. package/dist/core/session-group-birth.js +23 -8
  138. package/dist/core/session-group-birth.js.map +1 -1
  139. package/dist/core/session-manager.d.ts +1 -4
  140. package/dist/core/session-manager.d.ts.map +1 -1
  141. package/dist/core/session-manager.js +16 -20
  142. package/dist/core/session-manager.js.map +1 -1
  143. package/dist/core/shared-adopt.d.ts +20 -0
  144. package/dist/core/shared-adopt.d.ts.map +1 -0
  145. package/dist/core/shared-adopt.js +26 -0
  146. package/dist/core/shared-adopt.js.map +1 -0
  147. package/dist/core/skills/customize-command.d.ts +7 -0
  148. package/dist/core/skills/customize-command.d.ts.map +1 -0
  149. package/dist/core/skills/customize-command.js +303 -0
  150. package/dist/core/skills/customize-command.js.map +1 -0
  151. package/dist/core/terminal-write-auth.d.ts +15 -0
  152. package/dist/core/terminal-write-auth.d.ts.map +1 -1
  153. package/dist/core/terminal-write-auth.js +15 -0
  154. package/dist/core/terminal-write-auth.js.map +1 -1
  155. package/dist/core/terminal-write-frame.d.ts +30 -0
  156. package/dist/core/terminal-write-frame.d.ts.map +1 -0
  157. package/dist/core/terminal-write-frame.js +44 -0
  158. package/dist/core/terminal-write-frame.js.map +1 -0
  159. package/dist/core/types.d.ts +14 -4
  160. package/dist/core/types.d.ts.map +1 -1
  161. package/dist/core/types.js +6 -8
  162. package/dist/core/types.js.map +1 -1
  163. package/dist/core/worker-pool.d.ts +31 -6
  164. package/dist/core/worker-pool.d.ts.map +1 -1
  165. package/dist/core/worker-pool.js +444 -102
  166. package/dist/core/worker-pool.js.map +1 -1
  167. package/dist/core/worker-startup-retry.d.ts +52 -0
  168. package/dist/core/worker-startup-retry.d.ts.map +1 -0
  169. package/dist/core/worker-startup-retry.js +68 -0
  170. package/dist/core/worker-startup-retry.js.map +1 -0
  171. package/dist/daemon.d.ts +9 -8
  172. package/dist/daemon.d.ts.map +1 -1
  173. package/dist/daemon.js +467 -171
  174. package/dist/daemon.js.map +1 -1
  175. package/dist/dashboard/autostart-api.d.ts +26 -0
  176. package/dist/dashboard/autostart-api.d.ts.map +1 -0
  177. package/dist/dashboard/autostart-api.js +88 -0
  178. package/dist/dashboard/autostart-api.js.map +1 -0
  179. package/dist/dashboard/bot-payload.d.ts +5 -0
  180. package/dist/dashboard/bot-payload.d.ts.map +1 -1
  181. package/dist/dashboard/bot-payload.js +2 -0
  182. package/dist/dashboard/bot-payload.js.map +1 -1
  183. package/dist/dashboard/control-csrf.d.ts +29 -1
  184. package/dist/dashboard/control-csrf.d.ts.map +1 -1
  185. package/dist/dashboard/control-csrf.js +49 -10
  186. package/dist/dashboard/control-csrf.js.map +1 -1
  187. package/dist/dashboard/customization-api.d.ts +23 -0
  188. package/dist/dashboard/customization-api.d.ts.map +1 -0
  189. package/dist/dashboard/customization-api.js +198 -0
  190. package/dist/dashboard/customization-api.js.map +1 -0
  191. package/dist/dashboard/debug-terminal.d.ts +13 -1
  192. package/dist/dashboard/debug-terminal.d.ts.map +1 -1
  193. package/dist/dashboard/debug-terminal.js +18 -4
  194. package/dist/dashboard/debug-terminal.js.map +1 -1
  195. package/dist/dashboard/settings-write-applier.d.ts +0 -23
  196. package/dist/dashboard/settings-write-applier.d.ts.map +1 -1
  197. package/dist/dashboard/settings-write-applier.js +7 -28
  198. package/dist/dashboard/settings-write-applier.js.map +1 -1
  199. package/dist/dashboard/terminal-control-route.d.ts +32 -0
  200. package/dist/dashboard/terminal-control-route.d.ts.map +1 -0
  201. package/dist/dashboard/terminal-control-route.js +70 -0
  202. package/dist/dashboard/terminal-control-route.js.map +1 -0
  203. package/dist/dashboard/terminal-control.d.ts +64 -13
  204. package/dist/dashboard/terminal-control.d.ts.map +1 -1
  205. package/dist/dashboard/terminal-control.js +77 -14
  206. package/dist/dashboard/terminal-control.js.map +1 -1
  207. package/dist/dashboard/terminal-front-proxy.d.ts.map +1 -1
  208. package/dist/dashboard/terminal-front-proxy.js +41 -9
  209. package/dist/dashboard/terminal-front-proxy.js.map +1 -1
  210. package/dist/dashboard/vc-consumer-profiles-api.d.ts +69 -18
  211. package/dist/dashboard/vc-consumer-profiles-api.d.ts.map +1 -1
  212. package/dist/dashboard/vc-consumer-profiles-api.js +149 -29
  213. package/dist/dashboard/vc-consumer-profiles-api.js.map +1 -1
  214. package/dist/dashboard/web/agent-workbench-api.d.ts +34 -2
  215. package/dist/dashboard/web/agent-workbench-api.d.ts.map +1 -1
  216. package/dist/dashboard/web/agent-workbench-api.js +39 -4
  217. package/dist/dashboard/web/agent-workbench-api.js.map +1 -1
  218. package/dist/dashboard/web/agent-workbench-appearance.d.ts +6 -3
  219. package/dist/dashboard/web/agent-workbench-appearance.d.ts.map +1 -1
  220. package/dist/dashboard/web/agent-workbench-appearance.js +7 -4
  221. package/dist/dashboard/web/agent-workbench-appearance.js.map +1 -1
  222. package/dist/dashboard/web/agent-workbench-model.d.ts +2 -0
  223. package/dist/dashboard/web/agent-workbench-model.d.ts.map +1 -1
  224. package/dist/dashboard/web/agent-workbench-model.js.map +1 -1
  225. package/dist/dashboard/web/agent-workbench-page.js +2 -2
  226. package/dist/dashboard/web/agent-workbench-page.js.map +1 -1
  227. package/dist/dashboard/web/agent-workbench-panes.d.ts +59 -4
  228. package/dist/dashboard/web/agent-workbench-panes.d.ts.map +1 -1
  229. package/dist/dashboard/web/agent-workbench-panes.js +493 -85
  230. package/dist/dashboard/web/agent-workbench-panes.js.map +1 -1
  231. package/dist/dashboard/web/agent-workbench-session-list.d.ts +11 -7
  232. package/dist/dashboard/web/agent-workbench-session-list.d.ts.map +1 -1
  233. package/dist/dashboard/web/agent-workbench-session-list.js +24 -31
  234. package/dist/dashboard/web/agent-workbench-session-list.js.map +1 -1
  235. package/dist/dashboard/web/agent-workbench-terminal-control.d.ts +198 -0
  236. package/dist/dashboard/web/agent-workbench-terminal-control.d.ts.map +1 -0
  237. package/dist/dashboard/web/agent-workbench-terminal-control.js +292 -0
  238. package/dist/dashboard/web/agent-workbench-terminal-control.js.map +1 -0
  239. package/dist/dashboard/web/agent-workbench-view.d.ts +3 -2
  240. package/dist/dashboard/web/agent-workbench-view.d.ts.map +1 -1
  241. package/dist/dashboard/web/agent-workbench-view.js +69 -50
  242. package/dist/dashboard/web/agent-workbench-view.js.map +1 -1
  243. package/dist/dashboard/web/app.d.ts.map +1 -1
  244. package/dist/dashboard/web/app.js +58 -7
  245. package/dist/dashboard/web/app.js.map +1 -1
  246. package/dist/dashboard/web/bot-defaults-page.d.ts +24 -0
  247. package/dist/dashboard/web/bot-defaults-page.d.ts.map +1 -1
  248. package/dist/dashboard/web/bot-defaults-page.js +191 -16
  249. package/dist/dashboard/web/bot-defaults-page.js.map +1 -1
  250. package/dist/dashboard/web/bot-defaults.d.ts +17 -0
  251. package/dist/dashboard/web/bot-defaults.d.ts.map +1 -1
  252. package/dist/dashboard/web/bot-defaults.js +51 -2
  253. package/dist/dashboard/web/bot-defaults.js.map +1 -1
  254. package/dist/dashboard/web/bot-onboarding.d.ts.map +1 -1
  255. package/dist/dashboard/web/bot-onboarding.js +32 -8
  256. package/dist/dashboard/web/bot-onboarding.js.map +1 -1
  257. package/dist/dashboard/web/confirm-modal.d.ts +35 -0
  258. package/dist/dashboard/web/confirm-modal.d.ts.map +1 -0
  259. package/dist/dashboard/web/confirm-modal.js +111 -0
  260. package/dist/dashboard/web/confirm-modal.js.map +1 -0
  261. package/dist/dashboard/web/connectors-page.d.ts.map +1 -1
  262. package/dist/dashboard/web/connectors-page.js +2 -1
  263. package/dist/dashboard/web/connectors-page.js.map +1 -1
  264. package/dist/dashboard/web/customization-page.d.ts +3 -0
  265. package/dist/dashboard/web/customization-page.d.ts.map +1 -0
  266. package/dist/dashboard/web/customization-page.js +315 -0
  267. package/dist/dashboard/web/customization-page.js.map +1 -0
  268. package/dist/dashboard/web/dashboard-routes.d.ts.map +1 -1
  269. package/dist/dashboard/web/dashboard-routes.js +1 -0
  270. package/dist/dashboard/web/dashboard-routes.js.map +1 -1
  271. package/dist/dashboard/web/groups-page.d.ts.map +1 -1
  272. package/dist/dashboard/web/groups-page.js +11 -9
  273. package/dist/dashboard/web/groups-page.js.map +1 -1
  274. package/dist/dashboard/web/i18n.d.ts.map +1 -1
  275. package/dist/dashboard/web/i18n.js +226 -42
  276. package/dist/dashboard/web/i18n.js.map +1 -1
  277. package/dist/dashboard/web/monitor-room.d.ts.map +1 -1
  278. package/dist/dashboard/web/monitor-room.js +3 -2
  279. package/dist/dashboard/web/monitor-room.js.map +1 -1
  280. package/dist/dashboard/web/overview-page.d.ts.map +1 -1
  281. package/dist/dashboard/web/overview-page.js +98 -63
  282. package/dist/dashboard/web/overview-page.js.map +1 -1
  283. package/dist/dashboard/web/roles-page.d.ts.map +1 -1
  284. package/dist/dashboard/web/roles-page.js +4 -3
  285. package/dist/dashboard/web/roles-page.js.map +1 -1
  286. package/dist/dashboard/web/schedules-page.d.ts.map +1 -1
  287. package/dist/dashboard/web/schedules-page.js +165 -18
  288. package/dist/dashboard/web/schedules-page.js.map +1 -1
  289. package/dist/dashboard/web/sessions-kanban.d.ts +2 -0
  290. package/dist/dashboard/web/sessions-kanban.d.ts.map +1 -1
  291. package/dist/dashboard/web/sessions-kanban.js +142 -24
  292. package/dist/dashboard/web/sessions-kanban.js.map +1 -1
  293. package/dist/dashboard/web/sessions-page.d.ts.map +1 -1
  294. package/dist/dashboard/web/sessions-page.js +177 -94
  295. package/dist/dashboard/web/sessions-page.js.map +1 -1
  296. package/dist/dashboard/web/sessions.d.ts.map +1 -1
  297. package/dist/dashboard/web/sessions.js +5 -4
  298. package/dist/dashboard/web/sessions.js.map +1 -1
  299. package/dist/dashboard/web/settings-page.d.ts +0 -8
  300. package/dist/dashboard/web/settings-page.d.ts.map +1 -1
  301. package/dist/dashboard/web/settings-page.js +185 -65
  302. package/dist/dashboard/web/settings-page.js.map +1 -1
  303. package/dist/dashboard/web/skills/skill-library-tab.d.ts +2 -0
  304. package/dist/dashboard/web/skills/skill-library-tab.d.ts.map +1 -1
  305. package/dist/dashboard/web/skills/skill-library-tab.js +15 -1
  306. package/dist/dashboard/web/skills/skill-library-tab.js.map +1 -1
  307. package/dist/dashboard/web/skills-page.d.ts.map +1 -1
  308. package/dist/dashboard/web/skills-page.js +5 -4
  309. package/dist/dashboard/web/skills-page.js.map +1 -1
  310. package/dist/dashboard/web/store.d.ts +5 -0
  311. package/dist/dashboard/web/store.d.ts.map +1 -1
  312. package/dist/dashboard/web/store.js +4 -0
  313. package/dist/dashboard/web/store.js.map +1 -1
  314. package/dist/dashboard/web/team-federation-page.d.ts.map +1 -1
  315. package/dist/dashboard/web/team-federation-page.js +3 -2
  316. package/dist/dashboard/web/team-federation-page.js.map +1 -1
  317. package/dist/dashboard/web/toast.d.ts +15 -0
  318. package/dist/dashboard/web/toast.d.ts.map +1 -0
  319. package/dist/dashboard/web/toast.js +70 -0
  320. package/dist/dashboard/web/toast.js.map +1 -0
  321. package/dist/dashboard/web/v3-components.d.ts.map +1 -1
  322. package/dist/dashboard/web/v3-components.js +2 -1
  323. package/dist/dashboard/web/v3-components.js.map +1 -1
  324. package/dist/dashboard/web/vc-consumer-profiles-section.d.ts +10 -12
  325. package/dist/dashboard/web/vc-consumer-profiles-section.d.ts.map +1 -1
  326. package/dist/dashboard/web/vc-consumer-profiles-section.js +219 -200
  327. package/dist/dashboard/web/vc-consumer-profiles-section.js.map +1 -1
  328. package/dist/dashboard/web/whiteboards-page.d.ts.map +1 -1
  329. package/dist/dashboard/web/whiteboards-page.js +2 -1
  330. package/dist/dashboard/web/whiteboards-page.js.map +1 -1
  331. package/dist/dashboard-web/app.js +1 -1
  332. package/dist/dashboard-web/chunks/agent-workbench-dock-page-LZSUOCEQ.js +1 -0
  333. package/dist/dashboard-web/chunks/agent-workbench-page-YONDRJU7.js +1 -0
  334. package/dist/dashboard-web/chunks/bot-defaults-page-X7LV6373.js +1 -0
  335. package/dist/dashboard-web/chunks/chunk-2PVRDXEL.js +1 -0
  336. package/dist/dashboard-web/chunks/chunk-53JUKBU2.js +10 -0
  337. package/dist/dashboard-web/chunks/{chunk-5CJMHTT4.js → chunk-5QX4OYOR.js} +1 -1
  338. package/dist/dashboard-web/chunks/{chunk-NACP7BMR.js → chunk-5VRVJFQR.js} +1 -1
  339. package/dist/dashboard-web/chunks/{chunk-FDZ7WOBW.js → chunk-6ROOZWYV.js} +1 -1
  340. package/dist/dashboard-web/chunks/{chunk-F6KNPF4R.js → chunk-CK22743G.js} +15 -19
  341. package/dist/dashboard-web/chunks/chunk-CVNIMUPY.js +25 -0
  342. package/dist/dashboard-web/chunks/chunk-GJC2TMWS.js +2 -0
  343. package/dist/dashboard-web/chunks/chunk-OT6L6G7R.js +1 -0
  344. package/dist/dashboard-web/chunks/chunk-QITAMHW6.js +1 -0
  345. package/dist/dashboard-web/chunks/chunk-RHVFZC5Z.js +1 -0
  346. package/dist/dashboard-web/chunks/chunk-SOBMN2VY.js +1 -0
  347. package/dist/dashboard-web/chunks/chunk-SZOB6VK2.js +1 -0
  348. package/dist/dashboard-web/chunks/chunk-XVIXNQGC.js +44 -0
  349. package/dist/dashboard-web/chunks/chunk-YUJF34ME.js +1 -0
  350. package/dist/dashboard-web/chunks/connectors-page-LB2HEJ7F.js +1 -0
  351. package/dist/dashboard-web/chunks/customization-page-4GXBYLG6.js +105 -0
  352. package/dist/dashboard-web/chunks/feedback-page-IZQ7VLDG.js +1 -0
  353. package/dist/dashboard-web/chunks/groups-page-4WCP5OEV.js +8 -0
  354. package/dist/dashboard-web/chunks/{insights-page-HJFDYR5N.js → insights-page-TXQHIPQL.js} +1 -1
  355. package/dist/dashboard-web/chunks/{monitor-room-V7PCP47V.js → monitor-room-VBRVWXCM.js} +8 -8
  356. package/dist/dashboard-web/chunks/monitoring-page-QDDZWERE.js +2 -0
  357. package/dist/dashboard-web/chunks/office-page-PENFNYPG.js +1 -0
  358. package/dist/dashboard-web/chunks/overview-page-BZQDP6MP.js +1 -0
  359. package/dist/dashboard-web/chunks/plugin-page-JX4GSWZS.js +1 -0
  360. package/dist/dashboard-web/chunks/roles-page-VPNINZNK.js +1 -0
  361. package/dist/dashboard-web/chunks/schedules-page-BITO6HEA.js +1 -0
  362. package/dist/dashboard-web/chunks/sessions-page-ZKCOVTD2.js +8 -0
  363. package/dist/dashboard-web/chunks/settings-page-UT6JDTS6.js +2 -0
  364. package/dist/dashboard-web/chunks/skills-page-GULXVAJY.js +4 -0
  365. package/dist/dashboard-web/chunks/team-federation-page-CUUJWGEG.js +1 -0
  366. package/dist/dashboard-web/chunks/v3-page-5WVJ5AUR.js +94 -0
  367. package/dist/dashboard-web/chunks/whiteboards-page-FZ2CME4H.js +1 -0
  368. package/dist/dashboard-web/design-tokens.css +236 -0
  369. package/dist/dashboard-web/index.html +1 -0
  370. package/dist/dashboard-web/style.css +1930 -114
  371. package/dist/dashboard.js +360 -279
  372. package/dist/dashboard.js.map +1 -1
  373. package/dist/desktop/renderer/app.js +6 -0
  374. package/dist/desktop/renderer/app.js.map +1 -1
  375. package/dist/dsh-runner.js +139 -17
  376. package/dist/dsh-runner.js.map +1 -1
  377. package/dist/global-config.d.ts +33 -2
  378. package/dist/global-config.d.ts.map +1 -1
  379. package/dist/global-config.js +62 -0
  380. package/dist/global-config.js.map +1 -1
  381. package/dist/i18n/en.d.ts.map +1 -1
  382. package/dist/i18n/en.js +13 -4
  383. package/dist/i18n/en.js.map +1 -1
  384. package/dist/i18n/index.d.ts +27 -3
  385. package/dist/i18n/index.d.ts.map +1 -1
  386. package/dist/i18n/index.js +33 -4
  387. package/dist/i18n/index.js.map +1 -1
  388. package/dist/i18n/zh.d.ts.map +1 -1
  389. package/dist/i18n/zh.js +13 -4
  390. package/dist/i18n/zh.js.map +1 -1
  391. package/dist/im/lark/card-builder.d.ts +2 -0
  392. package/dist/im/lark/card-builder.d.ts.map +1 -1
  393. package/dist/im/lark/card-builder.js +7 -4
  394. package/dist/im/lark/card-builder.js.map +1 -1
  395. package/dist/im/lark/card-handler.d.ts.map +1 -1
  396. package/dist/im/lark/card-handler.js +135 -20
  397. package/dist/im/lark/card-handler.js.map +1 -1
  398. package/dist/im/lark/event-dispatcher.d.ts +38 -3
  399. package/dist/im/lark/event-dispatcher.d.ts.map +1 -1
  400. package/dist/im/lark/event-dispatcher.js +163 -13
  401. package/dist/im/lark/event-dispatcher.js.map +1 -1
  402. package/dist/im/lark/v3-blocked-card-handler.d.ts.map +1 -1
  403. package/dist/im/lark/v3-blocked-card-handler.js +2 -1
  404. package/dist/im/lark/v3-blocked-card-handler.js.map +1 -1
  405. package/dist/im/lark/v3-blocked-card.d.ts +1 -1
  406. package/dist/im/lark/v3-blocked-card.d.ts.map +1 -1
  407. package/dist/im/lark/v3-blocked-card.js +14 -0
  408. package/dist/im/lark/v3-blocked-card.js.map +1 -1
  409. package/dist/index-core-only.js +2 -0
  410. package/dist/index-core-only.js.map +1 -1
  411. package/dist/index-daemon.js +3 -0
  412. package/dist/index-daemon.js.map +1 -1
  413. package/dist/platform/binding.d.ts +37 -0
  414. package/dist/platform/binding.d.ts.map +1 -1
  415. package/dist/platform/binding.js +15 -0
  416. package/dist/platform/binding.js.map +1 -1
  417. package/dist/services/bridge-turn-journal.d.ts +63 -0
  418. package/dist/services/bridge-turn-journal.d.ts.map +1 -0
  419. package/dist/services/bridge-turn-journal.js +149 -0
  420. package/dist/services/bridge-turn-journal.js.map +1 -0
  421. package/dist/services/bridge-turn-queue.d.ts +8 -1
  422. package/dist/services/bridge-turn-queue.d.ts.map +1 -1
  423. package/dist/services/bridge-turn-queue.js +2 -1
  424. package/dist/services/bridge-turn-queue.js.map +1 -1
  425. package/dist/services/codex-app-runner-protocol.d.ts +5 -0
  426. package/dist/services/codex-app-runner-protocol.d.ts.map +1 -1
  427. package/dist/services/codex-app-runner-protocol.js +5 -0
  428. package/dist/services/codex-app-runner-protocol.js.map +1 -1
  429. package/dist/services/customization-store.d.ts +93 -0
  430. package/dist/services/customization-store.d.ts.map +1 -0
  431. package/dist/services/customization-store.js +542 -0
  432. package/dist/services/customization-store.js.map +1 -0
  433. package/dist/services/file-bridge-path.d.ts.map +1 -1
  434. package/dist/services/file-bridge-path.js +3 -0
  435. package/dist/services/file-bridge-path.js.map +1 -1
  436. package/dist/services/grok-transcript.d.ts.map +1 -1
  437. package/dist/services/grok-transcript.js +44 -9
  438. package/dist/services/grok-transcript.js.map +1 -1
  439. package/dist/services/local-cli-opener.d.ts.map +1 -1
  440. package/dist/services/local-cli-opener.js +12 -3
  441. package/dist/services/local-cli-opener.js.map +1 -1
  442. package/dist/services/model-catalog.d.ts +54 -0
  443. package/dist/services/model-catalog.d.ts.map +1 -0
  444. package/dist/services/model-catalog.js +147 -0
  445. package/dist/services/model-catalog.js.map +1 -0
  446. package/dist/services/omp-transcript.d.ts +27 -0
  447. package/dist/services/omp-transcript.d.ts.map +1 -0
  448. package/dist/services/omp-transcript.js +214 -0
  449. package/dist/services/omp-transcript.js.map +1 -0
  450. package/dist/services/platform-team-store.d.ts +16 -8
  451. package/dist/services/platform-team-store.d.ts.map +1 -1
  452. package/dist/services/platform-team-store.js +17 -10
  453. package/dist/services/platform-team-store.js.map +1 -1
  454. package/dist/services/project-scanner.d.ts.map +1 -1
  455. package/dist/services/project-scanner.js +13 -8
  456. package/dist/services/project-scanner.js.map +1 -1
  457. package/dist/services/resumable-session-discovery.d.ts.map +1 -1
  458. package/dist/services/resumable-session-discovery.js +117 -35
  459. package/dist/services/resumable-session-discovery.js.map +1 -1
  460. package/dist/services/structured-bridge-clis.d.ts +5 -3
  461. package/dist/services/structured-bridge-clis.d.ts.map +1 -1
  462. package/dist/services/structured-bridge-clis.js +5 -1
  463. package/dist/services/structured-bridge-clis.js.map +1 -1
  464. package/dist/services/vc-meeting-action-gate.d.ts.map +1 -1
  465. package/dist/services/vc-meeting-action-gate.js +15 -4
  466. package/dist/services/vc-meeting-action-gate.js.map +1 -1
  467. package/dist/services/vc-meeting-consumer-profile-bootstrap.d.ts +46 -66
  468. package/dist/services/vc-meeting-consumer-profile-bootstrap.d.ts.map +1 -1
  469. package/dist/services/vc-meeting-consumer-profile-bootstrap.js +33 -292
  470. package/dist/services/vc-meeting-consumer-profile-bootstrap.js.map +1 -1
  471. package/dist/services/vc-meeting-consumer-profile-templates.js +3 -3
  472. package/dist/services/vc-meeting-consumer-profile-templates.js.map +1 -1
  473. package/dist/services/vc-meeting-delivery-store.d.ts +18 -0
  474. package/dist/services/vc-meeting-delivery-store.d.ts.map +1 -1
  475. package/dist/services/vc-meeting-delivery-store.js +55 -0
  476. package/dist/services/vc-meeting-delivery-store.js.map +1 -1
  477. package/dist/services/vc-meeting-send-policy.d.ts +21 -1
  478. package/dist/services/vc-meeting-send-policy.d.ts.map +1 -1
  479. package/dist/services/vc-meeting-send-policy.js +30 -2
  480. package/dist/services/vc-meeting-send-policy.js.map +1 -1
  481. package/dist/services/vc-meeting-shared-consumer-catalog-store.d.ts +78 -0
  482. package/dist/services/vc-meeting-shared-consumer-catalog-store.d.ts.map +1 -0
  483. package/dist/services/vc-meeting-shared-consumer-catalog-store.js +227 -0
  484. package/dist/services/vc-meeting-shared-consumer-catalog-store.js.map +1 -0
  485. package/dist/services/vc-meeting-shared-consumer-catalog.d.ts +53 -0
  486. package/dist/services/vc-meeting-shared-consumer-catalog.d.ts.map +1 -0
  487. package/dist/services/vc-meeting-shared-consumer-catalog.js +161 -0
  488. package/dist/services/vc-meeting-shared-consumer-catalog.js.map +1 -0
  489. package/dist/setup/bot-config-editor.d.ts.map +1 -1
  490. package/dist/setup/bot-config-editor.js +1 -0
  491. package/dist/setup/bot-config-editor.js.map +1 -1
  492. package/dist/setup/open-platform-automation.d.ts +20 -0
  493. package/dist/setup/open-platform-automation.d.ts.map +1 -1
  494. package/dist/setup/open-platform-automation.js +27 -0
  495. package/dist/setup/open-platform-automation.js.map +1 -1
  496. package/dist/skills/customization-bundle.d.ts +83 -0
  497. package/dist/skills/customization-bundle.d.ts.map +1 -0
  498. package/dist/skills/customization-bundle.js +214 -0
  499. package/dist/skills/customization-bundle.js.map +1 -0
  500. package/dist/skills/definitions.d.ts.map +1 -1
  501. package/dist/skills/definitions.js +10 -3
  502. package/dist/skills/definitions.js.map +1 -1
  503. package/dist/skills/effective-builtins.d.ts +38 -0
  504. package/dist/skills/effective-builtins.d.ts.map +1 -0
  505. package/dist/skills/effective-builtins.js +96 -0
  506. package/dist/skills/effective-builtins.js.map +1 -0
  507. package/dist/skills/injection-mode.d.ts +4 -1
  508. package/dist/skills/injection-mode.d.ts.map +1 -1
  509. package/dist/skills/injection-mode.js +11 -3
  510. package/dist/skills/injection-mode.js.map +1 -1
  511. package/dist/skills/installer.d.ts.map +1 -1
  512. package/dist/skills/installer.js +24 -1
  513. package/dist/skills/installer.js.map +1 -1
  514. package/dist/skills/prompt-fragments.d.ts +58 -0
  515. package/dist/skills/prompt-fragments.d.ts.map +1 -0
  516. package/dist/skills/prompt-fragments.js +88 -0
  517. package/dist/skills/prompt-fragments.js.map +1 -0
  518. package/dist/types.d.ts +51 -0
  519. package/dist/types.d.ts.map +1 -1
  520. package/dist/utils/cli-usage-limit.d.ts +50 -0
  521. package/dist/utils/cli-usage-limit.d.ts.map +1 -1
  522. package/dist/utils/cli-usage-limit.js +43 -0
  523. package/dist/utils/cli-usage-limit.js.map +1 -1
  524. package/dist/utils/idle-detector.d.ts +12 -0
  525. package/dist/utils/idle-detector.d.ts.map +1 -1
  526. package/dist/utils/idle-detector.js +88 -2
  527. package/dist/utils/idle-detector.js.map +1 -1
  528. package/dist/utils/stuck-detector.d.ts +5 -0
  529. package/dist/utils/stuck-detector.d.ts.map +1 -1
  530. package/dist/utils/stuck-detector.js +41 -0
  531. package/dist/utils/stuck-detector.js.map +1 -1
  532. package/dist/utils/usage-limit-tracker.d.ts +46 -0
  533. package/dist/utils/usage-limit-tracker.d.ts.map +1 -0
  534. package/dist/utils/usage-limit-tracker.js +91 -0
  535. package/dist/utils/usage-limit-tracker.js.map +1 -0
  536. package/dist/utils/user-token.js +1 -1
  537. package/dist/utils/user-token.js.map +1 -1
  538. package/dist/worker.js +812 -125
  539. package/dist/worker.js.map +1 -1
  540. package/dist/workflows/definition.d.ts +14 -14
  541. package/dist/workflows/events/payloads.d.ts +12 -12
  542. package/dist/workflows/events/schema.d.ts +164 -164
  543. package/dist/workflows/migration/v2-to-v3.js +1 -1
  544. package/dist/workflows/migration/v2-to-v3.js.map +1 -1
  545. package/dist/workflows/v3/architect.d.ts.map +1 -1
  546. package/dist/workflows/v3/architect.js +11 -5
  547. package/dist/workflows/v3/architect.js.map +1 -1
  548. package/dist/workflows/v3/artifact-contract-declarations.d.ts +22 -0
  549. package/dist/workflows/v3/artifact-contract-declarations.d.ts.map +1 -0
  550. package/dist/workflows/v3/artifact-contract-declarations.js +95 -0
  551. package/dist/workflows/v3/artifact-contract-declarations.js.map +1 -0
  552. package/dist/workflows/v3/contract.d.ts +1 -0
  553. package/dist/workflows/v3/contract.d.ts.map +1 -1
  554. package/dist/workflows/v3/contract.js.map +1 -1
  555. package/dist/workflows/v3/daemon-run.d.ts +2 -2
  556. package/dist/workflows/v3/daemon-run.d.ts.map +1 -1
  557. package/dist/workflows/v3/daemon-run.js +4 -0
  558. package/dist/workflows/v3/daemon-run.js.map +1 -1
  559. package/dist/workflows/v3/dag.d.ts +7 -0
  560. package/dist/workflows/v3/dag.d.ts.map +1 -1
  561. package/dist/workflows/v3/dag.js +69 -8
  562. package/dist/workflows/v3/dag.js.map +1 -1
  563. package/dist/workflows/v3/ephemeral-pool.js +1 -1
  564. package/dist/workflows/v3/ephemeral-pool.js.map +1 -1
  565. package/dist/workflows/v3/event-contract.d.ts +3 -1
  566. package/dist/workflows/v3/event-contract.d.ts.map +1 -1
  567. package/dist/workflows/v3/host.d.ts.map +1 -1
  568. package/dist/workflows/v3/host.js +5 -1
  569. package/dist/workflows/v3/host.js.map +1 -1
  570. package/dist/workflows/v3/journal.d.ts +1 -1
  571. package/dist/workflows/v3/journal.d.ts.map +1 -1
  572. package/dist/workflows/v3/journal.js.map +1 -1
  573. package/dist/workflows/v3/library-materialize.d.ts.map +1 -1
  574. package/dist/workflows/v3/library-materialize.js +9 -1
  575. package/dist/workflows/v3/library-materialize.js.map +1 -1
  576. package/dist/workflows/v3/library-schema.d.ts +3 -1
  577. package/dist/workflows/v3/library-schema.d.ts.map +1 -1
  578. package/dist/workflows/v3/library-schema.js +20 -4
  579. package/dist/workflows/v3/library-schema.js.map +1 -1
  580. package/dist/workflows/v3/library-store.d.ts.map +1 -1
  581. package/dist/workflows/v3/library-store.js +15 -3
  582. package/dist/workflows/v3/library-store.js.map +1 -1
  583. package/dist/workflows/v3/run-envelope.d.ts +16 -16
  584. package/dist/workflows/v3/shared-node-runtime.d.ts +2 -1
  585. package/dist/workflows/v3/shared-node-runtime.d.ts.map +1 -1
  586. package/dist/workflows/v3/shared-node-runtime.js +48 -7
  587. package/dist/workflows/v3/shared-node-runtime.js.map +1 -1
  588. package/package.json +2 -1
  589. package/dist/dashboard-web/chunks/agent-workbench-dock-page-IKAC5CFL.js +0 -1
  590. package/dist/dashboard-web/chunks/agent-workbench-page-M53UN5EB.js +0 -1
  591. package/dist/dashboard-web/chunks/bot-defaults-page-YKE5SDZF.js +0 -10
  592. package/dist/dashboard-web/chunks/chunk-22WIADUT.js +0 -2
  593. package/dist/dashboard-web/chunks/chunk-24ONYQMR.js +0 -1
  594. package/dist/dashboard-web/chunks/chunk-2W6SCN3M.js +0 -1
  595. package/dist/dashboard-web/chunks/chunk-4XNJX6B3.js +0 -1
  596. package/dist/dashboard-web/chunks/chunk-5THX4DI2.js +0 -66
  597. package/dist/dashboard-web/chunks/chunk-7SZRL6FY.js +0 -1
  598. package/dist/dashboard-web/chunks/chunk-AGCPF6MT.js +0 -1
  599. package/dist/dashboard-web/chunks/chunk-FXW3V4JR.js +0 -1
  600. package/dist/dashboard-web/chunks/chunk-SYC6D5XU.js +0 -1
  601. package/dist/dashboard-web/chunks/connectors-page-VOISXXII.js +0 -1
  602. package/dist/dashboard-web/chunks/feedback-page-RN6HRZMS.js +0 -1
  603. package/dist/dashboard-web/chunks/groups-page-UQT6DCB7.js +0 -8
  604. package/dist/dashboard-web/chunks/monitoring-page-NKEKVQAP.js +0 -2
  605. package/dist/dashboard-web/chunks/office-page-GVJF73XW.js +0 -1
  606. package/dist/dashboard-web/chunks/overview-page-KHLV6VTI.js +0 -1
  607. package/dist/dashboard-web/chunks/plugin-page-J3OF5IY4.js +0 -1
  608. package/dist/dashboard-web/chunks/roles-page-WQIRSOLZ.js +0 -1
  609. package/dist/dashboard-web/chunks/schedules-page-J2DEY2X6.js +0 -1
  610. package/dist/dashboard-web/chunks/sessions-page-7BQFEA5P.js +0 -8
  611. package/dist/dashboard-web/chunks/settings-page-BJEIOFJH.js +0 -2
  612. package/dist/dashboard-web/chunks/skills-page-HGIFR3IU.js +0 -4
  613. package/dist/dashboard-web/chunks/team-federation-page-MR5ZPL4B.js +0 -1
  614. package/dist/dashboard-web/chunks/v3-page-GBR5JWPE.js +0 -94
  615. package/dist/dashboard-web/chunks/whiteboards-page-QAZM4BN3.js +0 -1
  616. package/dist/services/vc-meeting-consumer-profile-store.d.ts +0 -39
  617. package/dist/services/vc-meeting-consumer-profile-store.d.ts.map +0 -1
  618. package/dist/services/vc-meeting-consumer-profile-store.js +0 -191
  619. package/dist/services/vc-meeting-consumer-profile-store.js.map +0 -1
@@ -0,0 +1,4 @@
1
+ import{a as Ie}from"./chunk-SOBMN2VY.js";import{b as el,c as bl,d as ue,h as hl,l as yl}from"./chunk-5QX4OYOR.js";import{d as X}from"./chunk-RHVFZC5Z.js";import"./chunk-QITAMHW6.js";import{C as Ye}from"./chunk-CK22743G.js";import{a as us,c as vl}from"./chunk-XVIXNQGC.js";import{c as ee,d as Be,e as de}from"./chunk-CVNIMUPY.js";var c=ee(Be(),1),xl=ee(us(),1);var J=ee(Be(),1);var k=ee(de(),1);function ks(e){return(e.missingSkills?.length??0)>0?"missing":(e.references?.length??0)===0?"unassigned":"complete"}function Sl(e){let l=X(),n=e.packs??[],m=e.skills??[],[v,p]=(0,J.useState)(!1),[g,w]=(0,J.useState)(null),[a,C]=(0,J.useState)(null),[B,b]=(0,J.useState)(null),[P,N]=(0,J.useState)(!1),h=()=>{w(null),p(!0)},x=y=>{w(y),p(!0)},[E,T]=(0,J.useState)(()=>new Set),{focusPackId:L,focusPackIds:A,onFocusConsumed:$}=e;(0,J.useEffect)(()=>{if(!(!L&&(A?.length??0)===0)){if(L){let y=n.find(f=>f.id===L);y&&(w(y),p(!0)),T(new Set([L]))}else A&&T(new Set(A));$?.()}},[L,A]);let H=()=>{p(!1),w(null),C({text:l("skills.saved"),ok:!0}),e.onRefresh()},K=async y=>{try{let f=await fetch(`/api/skill-packs/${encodeURIComponent(y.id)}`,{method:"DELETE"}),I=await f.json().catch(()=>({}));if(f.ok){C({text:l("skills.packDeleted",{name:y.name}),ok:!0}),e.onRefresh();return}if(f.status===409&&I?.error==="SKILL_PACK_IN_USE"){let d=Array.isArray(I?.references)?I.references:y.references??[];b({pack:y,references:d});return}throw new Error(I?.error??`HTTP ${f.status}`)}catch(f){C({text:`${l("skills.failed")}: ${f?.message??f}`,ok:!1})}},F=async()=>{if(B){N(!0);try{let y=await fetch(`/api/skill-packs/${encodeURIComponent(B.pack.id)}?force=1`,{method:"DELETE"}),f=await y.json().catch(()=>({}));if(!y.ok)throw new Error(f?.error??`HTTP ${y.status}`);C({text:l("skills.packDeleted",{name:B.pack.name}),ok:!0}),b(null),e.onRefresh()}catch(y){C({text:`${l("skills.failed")}: ${y?.message??y}`,ok:!1})}finally{N(!1)}}};return(0,k.jsxs)("section",{className:"skills-config-block",children:[(0,k.jsx)(ue,{title:l("skills.packs"),count:e.packsKnown===!1?"\u2014":l("skills.packCount",{count:n.length}),hint:l("skills.packsHelp")}),a&&(0,k.jsx)("p",{className:`hint-${a.ok?"ok":"warn"}`,children:a.text}),(0,k.jsx)("div",{className:"bd-card skills-config-card",children:e.packsKnown===!1&&n.length===0?(0,k.jsxs)("div",{className:"skills-empty-state","data-packs-unknown":!0,children:[(0,k.jsx)("p",{className:"hint-warn",children:l("skills.packsUnknown")}),(0,k.jsx)("button",{className:"bd-button",onClick:()=>e.onRefresh(),children:l("skills.refresh")})]}):n.length===0?(0,k.jsxs)("div",{className:"skills-empty-state",children:[(0,k.jsx)("p",{children:l("skills.packsEmpty")}),(0,k.jsx)("button",{className:"bd-button primary",onClick:h,children:l("skills.packCreate")})]}):(0,k.jsxs)("div",{className:"skills-pack-grid",children:[(0,k.jsxs)("button",{className:"skills-pack-create-tile",onClick:h,children:[(0,k.jsx)("span",{className:"skills-pack-create-plus",children:"+"}),(0,k.jsx)("span",{children:l("skills.packCreate")})]}),n.map(y=>{let f=ks(y);return(0,k.jsxs)("div",{className:`skills-pack-card${E.has(y.id)?" skills-pack-card-focus":""}`,children:[(0,k.jsxs)("div",{className:"skills-pack-card-head",children:[(0,k.jsxs)("div",{className:"skills-pack-title",children:[(0,k.jsx)("strong",{children:y.name}),(0,k.jsx)("code",{className:"skills-pack-id",children:y.id})]}),(0,k.jsx)("span",{className:`skills-pack-health skills-pack-health-${f}`,children:f==="complete"?"\u2713":f==="missing"?"!":"\u25CB"})]}),y.description&&(0,k.jsx)("p",{className:"skills-pack-desc",children:y.description}),(0,k.jsxs)("div",{className:"skills-pack-meta",children:[(0,k.jsx)("span",{className:"skills-pack-meta-item",children:l("skills.skillCount",{count:y.include.length})}),(0,k.jsx)("span",{className:"skills-pack-meta-item",children:l("skills.packRefCount",{count:y.references?.length??0})})]}),y.tags&&y.tags.length>0&&(0,k.jsx)("div",{className:"skills-pack-tags",children:y.tags.map(I=>(0,k.jsx)("span",{className:"skills-pack-tag",children:I},I))}),(y.references?.length??0)>0&&(0,k.jsx)("div",{className:"skills-pack-refs",children:y.references.map(I=>(0,k.jsx)("button",{type:"button",className:"skills-pack-ref-chip","data-action":"open-pack-bot",disabled:!e.onOpenBot,onClick:()=>e.onOpenBot?.(I.larkAppId),children:I.botName},I.larkAppId))}),(y.missingSkills?.length??0)>0&&(0,k.jsxs)("div",{className:"skills-pack-missing",children:[l("skills.packMissing"),":"," ",y.missingSkills.map(I=>(0,k.jsx)("button",{type:"button",className:"skills-missing-skill-chip","data-action":"install-missing-skill",title:l("skills.installMissingHint",{skill:I}),disabled:!e.onInstallMissingSkill,onClick:()=>e.onInstallMissingSkill?.(I),children:I},I))]}),(0,k.jsxs)("div",{className:"skills-pack-actions",children:[(0,k.jsx)("button",{className:"bd-button small",onClick:()=>x(y),children:l("skills.packEdit")}),(0,k.jsx)("button",{className:"bd-button small danger",onClick:()=>{K(y)},children:l("skills.remove")})]})]},y.id)})]})}),v&&(0,k.jsx)(ms,{pack:g,skills:m,onClose:()=>{p(!1),w(null)},onSaved:H}),B&&(0,k.jsx)("dialog",{className:"bd-dialog skills-pack-delete-confirm",open:!0,onClose:()=>!P&&b(null),children:(0,k.jsxs)("form",{method:"dialog",onSubmit:y=>{y.preventDefault(),F()},children:[(0,k.jsx)("h3",{children:l("skills.packDeleteConfirmTitle")}),(0,k.jsx)("p",{children:l("skills.packDeleteConfirmBody",{name:B.pack.name})}),B.references.length>0&&(0,k.jsxs)("div",{className:"skills-pack-delete-refs",children:[(0,k.jsx)("p",{children:(0,k.jsxs)("strong",{children:[l("skills.packDeleteAffectedBots"),":"]})}),(0,k.jsx)("ul",{children:B.references.map(y=>(0,k.jsx)("li",{children:y.botName},y.larkAppId))})]}),(0,k.jsx)("p",{className:"hint-warn",children:l("skills.packDeleteForceWarning")}),(0,k.jsxs)("div",{className:"skills-dialog-actions",children:[(0,k.jsx)("button",{type:"button",className:"bd-button",onClick:()=>b(null),disabled:P,children:l("skills.cancel")}),(0,k.jsx)("button",{type:"submit",className:"bd-button danger",disabled:P,children:l(P?"skills.removing":"skills.removeAnyway")})]})]})})]})}function ms(e){let l=X(),n=e.skills??[],[m,v]=(0,J.useState)(e.pack?.id??""),[p,g]=(0,J.useState)(e.pack?.name??""),[w,a]=(0,J.useState)(e.pack?.description??""),[C,B]=(0,J.useState)((e.pack?.tags??[]).join(", ")),[b,P]=(0,J.useState)(()=>new Set(e.pack?.include.map(d=>d.replace("skill:",""))??[])),[N,h]=(0,J.useState)(!1),[x,E]=(0,J.useState)(null),[T,L]=(0,J.useState)(""),A=(0,J.useRef)(null),$=(0,J.useMemo)(()=>new Set(n.map(d=>d.name)),[n]),H=(0,J.useMemo)(()=>[...b].filter(d=>!$.has(d)).sort(),[$,b]);(0,J.useEffect)(()=>{let d=A.current;d&&!d.open&&d.showModal()},[]);let K=(0,J.useMemo)(()=>{let d=T.trim().toLowerCase();return d?n.filter(U=>`${U.name} ${U.description??""}`.toLowerCase().includes(d)):n},[n,T]),F=K.length>0&&K.every(d=>b.has(d.name)),y=d=>{P(U=>{let G=new Set(U);return G.has(d)?G.delete(d):G.add(d),G})},f=()=>{P(d=>{let U=new Set(d);if(F)for(let G of K)U.delete(G.name);else for(let G of K)U.add(G.name);return U})},I=async()=>{h(!0),E(null);try{let d={id:m,name:p,description:w||void 0,tags:C.split(",").map(r=>r.trim()).filter(Boolean),include:[...b].map(r=>`skill:${r}`),...e.pack?{expectedRevision:e.pack.revision}:{}},U=e.pack?`/api/skill-packs/${encodeURIComponent(e.pack.id)}`:"/api/skill-packs",G=await fetch(U,{method:e.pack?"PUT":"POST",headers:{"content-type":"application/json"},body:JSON.stringify(d)}),te=await G.json().catch(()=>({}));if(!G.ok)throw new Error(te?.error??te?.reason??`HTTP ${G.status}`);e.onSaved()}catch(d){E(d?.message??String(d))}finally{h(!1)}};return(0,k.jsx)("dialog",{className:"bd-dialog skills-pack-editor",ref:A,onClose:e.onClose,children:(0,k.jsxs)("form",{method:"dialog",onSubmit:d=>{d.preventDefault(),I()},children:[(0,k.jsx)("h3",{children:e.pack?l("skills.packEdit"):l("skills.packCreate")}),x&&(0,k.jsx)("p",{className:"hint-warn",children:x}),(0,k.jsxs)("div",{className:"skills-control-block",children:[(0,k.jsx)("label",{children:l("skills.packId")}),(0,k.jsx)("input",{value:m,onChange:d=>v(d.target.value),disabled:!!e.pack,placeholder:l("skills.packIdPlaceholder")})]}),(0,k.jsxs)("div",{className:"skills-control-block",children:[(0,k.jsx)("label",{children:l("skills.packName")}),(0,k.jsx)("input",{value:p,onChange:d=>g(d.target.value)})]}),(0,k.jsxs)("div",{className:"skills-control-block",children:[(0,k.jsx)("label",{children:l("skills.packDescription")}),(0,k.jsx)("textarea",{value:w,onChange:d=>a(d.target.value),rows:2})]}),(0,k.jsxs)("div",{className:"skills-control-block",children:[(0,k.jsx)("label",{children:l("skills.packTags")}),(0,k.jsx)("input",{value:C,onChange:d=>B(d.target.value),placeholder:l("skills.packTagsPlaceholder")})]}),(0,k.jsxs)("div",{className:"skills-control-block",children:[(0,k.jsxs)("div",{className:"skills-pack-include-head",children:[(0,k.jsxs)("label",{children:[l("skills.packInclude")," (",b.size,"/",n.length+H.length,")"]}),(0,k.jsx)("input",{className:"skills-pack-skill-search",type:"text",placeholder:l("skills.searchPlaceholder"),value:T,onChange:d=>L(d.target.value)})]}),K.length>0&&(0,k.jsxs)("label",{className:"skills-pack-select-all",children:[(0,k.jsx)("input",{type:"checkbox",checked:F,onChange:f}),l(F?"skills.deselectAll":"skills.selectAll")]}),H.length>0&&(0,k.jsxs)("div",{className:"skills-pack-missing-editor",children:[(0,k.jsx)("small",{className:"muted",children:l("skills.packMissing")}),H.map(d=>(0,k.jsxs)("label",{className:"skills-pack-skill-item skills-pack-skill-missing","data-missing-skill":d,children:[(0,k.jsx)("input",{type:"checkbox",checked:!0,onChange:()=>y(d)}),(0,k.jsx)("span",{className:"skills-pack-skill-name",children:d}),(0,k.jsx)("small",{className:"skills-pack-skill-desc",children:l("skills.packMissing")})]},d))]}),(0,k.jsxs)("div",{className:"skills-pack-skill-list",children:[K.map(d=>(0,k.jsxs)("label",{className:"skills-pack-skill-item",children:[(0,k.jsx)("input",{type:"checkbox",checked:b.has(d.name),onChange:()=>y(d.name)}),(0,k.jsx)("span",{className:"skills-pack-skill-name",children:d.name}),d.description&&(0,k.jsx)("small",{className:"skills-pack-skill-desc",children:d.description})]},d.name)),K.length===0&&(0,k.jsx)("p",{className:"muted",children:l("skills.noResults")})]})]}),(0,k.jsxs)("div",{className:"skills-dialog-actions",children:[(0,k.jsx)("button",{type:"button",className:"bd-button",onClick:e.onClose,children:l("skills.cancel")}),(0,k.jsx)("button",{type:"submit",className:"bd-button primary",disabled:N||b.size===0||!p.trim(),children:l(N?"skills.saving":"skills.saveSelection")})]})]})})}var oe=ee(Be(),1);var Il=new Set(["-y","--yes","-g","--global"]);function gs(e){let l=[],n="",m,v=!1;for(let p=0;p<e.length;p++){let g=e[p];if(m){if(g===m){m=void 0;continue}if(g==="\\"&&m==='"'){if(p+1>=e.length)return null;n+=e[++p];continue}n+=g;continue}if(/\s/.test(g)){v&&(l.push(n),n="",v=!1);continue}if(g==="'"||g==='"'){m=g,v=!0;continue}if(g==="\\"){if(p+1>=e.length)return null;n+=e[++p],v=!0;continue}n+=g,v=!0}return m?null:(v&&l.push(n),l)}function Nl(e){for(let l of e)if(!Il.has(l))return l.startsWith("-")?null:l||null;return null}function wl(e){let l=gs(e);if(!l)return null;let n=l.findIndex(g=>g==="skills"||g==="add-skill"||g.startsWith("skills@"));if(n<0)return null;let m=l[n],v=l.slice(n+1);if(m==="add-skill")return Nl(v);let p=0;for(;Il.has(v[p]);)p++;return v[p]!=="add"?null:Nl(v.slice(p+1))}var q=ee(de(),1);function Cl(e){let l=X(),[n,m]=(0,oe.useState)(null),v=(0,oe.useRef)(null),{navIntent:p,onNavIntentConsumed:g}=e;(0,oe.useEffect)(()=>{if(p){if(p.openInstallWizard){let a=v.current;a?.scrollIntoView?.({behavior:"smooth",block:"start"}),a?.querySelector('input[data-install="source"]')?.focus()}g?.()}},[p,g]);let w=a=>{if(!(!a||a.length===0)){if(a.length>1)m(a);else if(e.onAssignInstalledSkill){let C=a[0];Ie(l("skills.installSuccess",{skill:C}),{kind:"success",duration:5e3,action:{label:l("skills.assignToBot"),onClick:()=>e.onAssignInstalledSkill(C)}})}}};return(0,q.jsxs)("div",{className:"skills-page-stack",children:[(0,q.jsx)("div",{className:"skills-install-anchor",ref:v,children:(0,q.jsx)(e.InstallPanel,{installSource:e.installSource,installPath:e.installPath,installRef:e.installRef,installFullDepth:e.installFullDepth,installTargetSkill:e.installTargetSkill??null,installStatus:e.installStatus,installBusy:e.installBusy,installDiscovering:e.installDiscovering,installSelectionOpen:e.installSelectionOpen,installCandidates:e.installCandidates,selectedInstallSkills:e.selectedInstallSkills,onInstallSourceChange:e.onInstallSourceChange,onInstallPathChange:e.onInstallPathChange,onInstallRefChange:e.onInstallRefChange,onInstallFullDepthChange:e.onInstallFullDepthChange,onClearInstallTarget:e.onClearInstallTarget,onToggleInstallSkill:e.onToggleInstallSkill,onSelectAllInstallSkills:e.onSelectAllInstallSkills,onConfirmInstallSelection:()=>{e.onConfirmInstallSelection().then(w)},onCloseInstallSelection:e.onCloseInstallSelection,onInstall:()=>{e.onInstall().then(w)},onOpenNativeDiscovery:e.onOpenNativeDiscovery})}),n&&(0,q.jsx)(ps,{skillNames:n,onClose:()=>m(null),onCreate:async a=>{await e.onCreatePack(a),m(null)}}),(0,q.jsx)(e.InstalledLibrary,{skills:e.skills,busySkill:e.skillBusy,removingNames:e.removingNames,status:e.installedStatus,onUpdate:e.onUpdateSkill,onRequestRemove:e.onRequestRemove,externalQuery:e.navIntent?.librarySearch??null,externalFilterNames:e.navIntent?.libraryFilterSkills??null,packsKnown:e.packsKnown,onInstallMissing:e.onInstallMissing,graph:e.graph,packNames:e.packNames,onShowSkillPacks:e.onShowSkillPacks,onShowSkillBots:e.onShowSkillBots}),(0,q.jsx)(e.RemoveDialog,{names:e.removalDialogOpen?e.pendingRemoval:null,references:e.removalReferences,busy:e.removingNames.size>0,error:e.removalError,onCancel:e.onCancelRemoval,onConfirm:e.onConfirmRemoval})]})}function ps(e){let l=X(),[n,m]=(0,oe.useState)(""),[v,p]=(0,oe.useState)(""),[g,w]=(0,oe.useState)(!1),[a,C]=(0,oe.useState)(null),B=(0,oe.useRef)(null);(0,oe.useEffect)(()=>{let P=B.current;if(P&&!P.open)try{P.showModal()}catch{}},[]);let b=async()=>{if(!(!n.trim()||!v.trim())){w(!0),C(null);try{await e.onCreate({id:n.trim(),name:v.trim(),skillNames:e.skillNames})}catch(P){C(P?.message??String(P))}finally{w(!1)}}};return(0,q.jsx)("dialog",{className:"bd-dialog skills-post-install-pack",ref:B,onClose:()=>!g&&e.onClose(),children:(0,q.jsxs)("form",{method:"dialog",onSubmit:P=>{P.preventDefault(),b()},children:[(0,q.jsx)("h3",{children:l("skills.postInstallPackTitle")}),(0,q.jsx)("p",{children:l("skills.postInstallPackHelp",{count:e.skillNames.length})}),(0,q.jsxs)("div",{className:"skills-control-block",children:[(0,q.jsx)("label",{children:l("skills.packId")}),(0,q.jsx)("input",{autoFocus:!0,required:!0,value:n,onChange:P=>m(P.target.value)})]}),(0,q.jsxs)("div",{className:"skills-control-block",children:[(0,q.jsx)("label",{children:l("skills.packName")}),(0,q.jsx)("input",{required:!0,value:v,onChange:P=>p(P.target.value)})]}),(0,q.jsxs)("div",{className:"skills-resolved-preview",children:[(0,q.jsx)("strong",{children:l("skills.postInstallPackSkills")}),(0,q.jsx)("ul",{children:e.skillNames.map(P=>(0,q.jsx)("li",{children:(0,q.jsx)("code",{children:P})},P))})]}),a&&(0,q.jsx)("p",{className:"hint-warn",children:a}),(0,q.jsxs)("div",{className:"skills-dialog-actions",children:[(0,q.jsx)("button",{type:"button",className:"bd-button",disabled:g,onClick:e.onClose,children:l("skills.postInstallPackSkip")}),(0,q.jsx)("button",{type:"submit",className:"bd-button primary",disabled:g||!n.trim()||!v.trim(),children:l(g?"skills.saving":"skills.postInstallPackCreate")})]})]})})}function ll(e){let l=e.trim(),n=l.toLowerCase();if(!l)return"unknown";if(/^agentbuddy:/i.test(l)||/(?:^|\s)(?:npx\s+)?agentbuddy(?:@[\w.-]+)?\s+(?:skill|plugin)\s/i.test(l))return"agentbuddy";let m=wl(l);return m?ll(m):n.startsWith("github:")?"github":n.startsWith("git+")||n.startsWith("git@")||n.startsWith("git://")?"git":n.includes("github.com")?"github":n.startsWith("http://")||n.startsWith("https://")||n.endsWith(".git")?"git":/^[/~.]/.test(l)?"local":/^[A-Za-z0-9][A-Za-z0-9-]*\/[A-Za-z0-9._-]+(?:\/[\w./-]+)?$/.test(l)?"github":l.includes("://")?"unknown":"local"}var Q=ee(Be(),1);function fs(e,l){let n=String(e??"").replace(/\\/g,"/");return n.includes("/.codex/skills/")?l("skills.sourceCodex"):n.includes("/.claude/skills/")?l("skills.sourceClaude"):n.includes("/.trae/skills/")?l("skills.sourceTrae"):n.includes("/.cursor/skills/")?l("skills.sourceCursor"):n.includes("/.gemini/skills/")?l("skills.sourceGemini"):n.includes("/.config/opencode/skills/")?l("skills.sourceOpenCode"):null}function sl(e,l){let n=e.source??{};return n.type==="github"?`github:${n.owner}/${n.repo}/${n.path??""}`:n.type==="git"?`${n.url??"git"}#${n.path??""}`:n.type==="local-link"?fs(n.path,l)??l("skills.sourceLocalLink"):n.type==="local-copy"?l("skills.sourceBotmuxCopy"):String(n.type??"unknown")}function ke(e){return(e?.include??[]).filter(l=>l.startsWith("skill:")).map(l=>l.slice(6))}function be(e){return(e?.include??[]).filter(l=>l.startsWith("pack:")).map(l=>l.slice(5))}function Pl(e,l,n){let m=(e?.include??[]).filter(g=>!g.startsWith("skill:")&&!g.startsWith("pack:")),v=[...new Set(l.map(g=>g.trim()).filter(Boolean))].map(g=>`skill:${g}`),p=[...new Set(n.map(g=>g.trim()).filter(Boolean))].map(g=>`pack:${g}`);return[...v,...p,...m]}function Rl(e){return(e?.include?.length??0)>0}function xe(e){return`${e.cliId}
2
+ ${e.rootDir}`}function ze(e,l,n,m){let v=m?.packsKnown!==!1,p=new Set(e.map(b=>b.name)),g=new Map,w=b=>{let P=g.get(b);return P||(P={name:b,installed:p.has(b),packIds:[],directBotIds:[],viaPackBotIds:[]},g.set(b,P)),P};for(let b of p)w(b);let a=new Map,C=new Map;for(let b of l){C.set(b.id,b);let P=[],N=[];for(let h of b.include){if(!h.startsWith("skill:"))continue;let x=h.slice(6),E=w(x);E.packIds.includes(b.id)||E.packIds.push(b.id),(p.has(x)?P:N).push(x)}a.set(b.id,{id:b.id,resolved:P,missing:N,botIds:[]})}let B=new Map;for(let b of n){let P=b.skills?.include??[],N=new Map,h=new Set,x=[],E=!1;for(let L of P)if(L.startsWith("skill:")){let A=L.slice(6),$=w(A);$.directBotIds.includes(b.larkAppId)||$.directBotIds.push(b.larkAppId),p.has(A)?N.set(A,"direct"):h.add(A)}else if(L.startsWith("pack:")){let A=L.slice(5),$=C.get(A);if(!$){v?x.push(A):E=!0;continue}let H=a.get(A);H.botIds.includes(b.larkAppId)||H.botIds.push(b.larkAppId);for(let K of $.include){if(!K.startsWith("skill:"))continue;let F=K.slice(6),y=w(F);y.viaPackBotIds.includes(b.larkAppId)||y.viaPackBotIds.push(b.larkAppId),p.has(F)?N.has(F)||N.set(F,`pack:${A}`):h.add(F)}}let T=x.length>0?"pack_missing":h.size>0?"missing":E?"unknown":P.length===0?"default":"ok";B.set(b.larkAppId,{larkAppId:b.larkAppId,resolved:[...N.entries()].map(([L,A])=>({name:L,source:A})),missingSkills:[...h],missingPacks:x,finalCount:N.size,health:T})}return{skills:g,packs:a,bots:B}}function Dl(e){return[...e.skills.values()].filter(l=>!l.installed).map(l=>l.name).sort()}function tl(e,l){if(l){let n=e.some(m=>m.name===l);return{selected:n?new Set([l]):new Set,targetMissing:!n}}return{selected:new Set(e.map(n=>n.name)),targetMissing:!1}}var u=ee(de(),1);function Tl(e){let l=X(),[n,m]=(0,Q.useState)(null),[v,p]=(0,Q.useState)(null),[g,w]=(0,Q.useState)(!1),[a,C]=(0,Q.useState)(null),[B,b]=(0,Q.useState)(null),[P,N]=(0,Q.useState)(""),[h,x]=(0,Q.useState)(null),[E,T]=(0,Q.useState)(()=>new Set),[L,A]=(0,Q.useState)(null),{focusBotIds:$,focusSkill:H,onFocusConsumed:K}=e;(0,Q.useEffect)(()=>{($?.length??0)===0&&!H||($&&$.length>0&&T(new Set($)),H&&(A(H),N(H)),K?.())},[$,H]),(0,Q.useEffect)(()=>{if(!B)return;let r=setTimeout(()=>b(null),1600);return()=>clearTimeout(r)},[B]);let F=(0,Q.useMemo)(()=>ze(e.skills,e.packs,e.bots,{packsKnown:e.packsKnown!==!1}),[e.skills,e.packs,e.bots,e.packsKnown]),y=(0,Q.useMemo)(()=>{let r=new Set;for(let i of e.skills)for(let M of i.tags??[])r.add(M);return[...r].sort()},[e.skills]),f=(0,Q.useMemo)(()=>{let r=P.trim().toLowerCase();return e.skills.filter(i=>h&&!(i.tags??[]).includes(h)?!1:r?`${i.name} ${i.description??""}`.toLowerCase().includes(r):!0)},[e.skills,P,h]),I=async r=>{if(!a||a.sourceBotId)return;p(null),C(null);let i=ke(r.skills),M=be(r.skills);if(a.type==="skill"){if(i.includes(a.id)){b({botId:r.larkAppId,itemLabel:a.id});return}e.onMutate?await e.onMutate(r.larkAppId,`skill:${a.id}`,!0):await e.onSave(r.larkAppId,[...i,a.id],M)}else{if(M.includes(a.id)){b({botId:r.larkAppId,itemLabel:e.packs.find(R=>R.id===a.id)?.name??a.id});return}e.onMutate?await e.onMutate(r.larkAppId,`pack:${a.id}`,!0):await e.onSave(r.larkAppId,i,[...M,a.id])}},d=async()=>{let r=a;if(!r?.sourceBotId)return;w(!1),p(null),C(null);let i=e.bots.find(_=>_.larkAppId===r.sourceBotId);if(!i)return;let M=ke(i.skills),R=be(i.skills);if(r.type==="skill"){if(!M.includes(r.id))return;e.onMutate?await e.onMutate(i.larkAppId,`skill:${r.id}`,!1):await e.onSave(i.larkAppId,M.filter(_=>_!==r.id),R)}else{if(!R.includes(r.id))return;e.onMutate?await e.onMutate(i.larkAppId,`pack:${r.id}`,!1):await e.onSave(i.larkAppId,M,R.filter(_=>_!==r.id))}},U=()=>{C(null),p(null),w(!1)},G=(r,i,M)=>{r.dataTransfer.effectAllowed=M,r.dataTransfer.setData("text/plain",i.id),b(null),C(i)},te=a?.sourceBotId?e.bots.find(r=>r.larkAppId===a.sourceBotId):null;return(0,u.jsxs)("section",{className:"skills-config-block",children:[(0,u.jsx)(ue,{title:l("skills.bots"),count:l("skills.botCount",{count:e.bots.length}),hint:l("skills.botsHelp")}),(0,u.jsxs)("div",{className:"skills-bot-assign-layout",children:[(0,u.jsxs)("div",{className:"skills-bot-palette",children:[(0,u.jsxs)("div",{className:"skills-bot-palette-hint",children:[(0,u.jsx)("span",{className:"skills-drag-icon",children:"\u2927"}),(0,u.jsx)("span",{children:l("skills.dragHint")})]}),a?.sourceBotId?(0,u.jsxs)("div",{className:`skills-unassign-dropzone${g?" is-active":""}`,"data-action":"unassign-dropzone","data-drag-over":g||void 0,role:"status","aria-live":"polite",onDragOver:r=>{r.preventDefault(),r.dataTransfer.dropEffect="move",w(!0)},onDragLeave:r=>{r.currentTarget.contains(r.relatedTarget)||w(!1)},onDrop:r=>{r.preventDefault(),d().catch(()=>{})},children:[(0,u.jsx)("span",{className:"skills-unassign-icon","aria-hidden":"true",children:"\u21A9"}),(0,u.jsxs)("span",{children:[(0,u.jsx)("strong",{children:l("skills.unassignDropTitle")}),(0,u.jsx)("small",{children:l("skills.unassignDropHint",{bot:te?.botName??a.sourceBotId})})]})]}):null,e.packs.length>0&&(0,u.jsxs)("div",{className:"skills-bot-palette-group",children:[(0,u.jsx)("span",{className:"skills-bot-palette-label",children:l("skills.packChips")}),(0,u.jsx)("div",{className:"skills-bot-palette-items",children:e.packs.map(r=>(0,u.jsx)("span",{className:"skills-draggable-chip skills-pack-chip",draggable:!0,"data-palette-drag-type":"pack","data-palette-drag-id":r.id,onDragStart:i=>G(i,{type:"pack",id:r.id},"copy"),onDragEnd:U,title:`${r.name} (${l("skills.skillCount",{count:r.include.length})})`,children:r.name},r.id))})]}),(0,u.jsxs)("div",{className:"skills-bot-palette-group",children:[(0,u.jsx)("span",{className:"skills-bot-palette-label",children:l("skills.individualSkills")}),(0,u.jsx)("input",{className:"skills-bot-palette-search",type:"text",placeholder:l("skills.searchPlaceholder"),value:P,onChange:r=>N(r.target.value)}),y.length>0&&(0,u.jsxs)("div",{className:"skills-bot-palette-tags",children:[(0,u.jsx)("button",{className:`skills-tag-filter${h===null?" active":""}`,onClick:()=>x(null),children:l("skills.all")}),y.map(r=>(0,u.jsx)("button",{className:`skills-tag-filter${h===r?" active":""}`,onClick:()=>x(h===r?null:r),children:r},r))]}),(0,u.jsxs)("div",{className:"skills-bot-palette-items",children:[f.map(r=>(0,u.jsx)("span",{className:"skills-draggable-chip skills-skill-chip",draggable:!0,"data-palette-drag-type":"skill","data-palette-drag-id":r.name,onDragStart:i=>G(i,{type:"skill",id:r.name},"copy"),onDragEnd:U,title:r.description??r.name,children:r.name},r.name)),f.length===0&&(0,u.jsx)("span",{className:"muted",children:l("skills.noResults")})]})]})]}),(0,u.jsx)("article",{className:"bd-card skills-config-card skills-bot-table-wrap",children:(0,u.jsx)("div",{className:"skills-bot-table",children:(0,u.jsxs)("table",{children:[(0,u.jsx)("thead",{children:(0,u.jsxs)("tr",{children:[(0,u.jsx)("th",{children:l("skills.bot")}),(0,u.jsx)("th",{children:l("skills.packChips")}),(0,u.jsx)("th",{children:l("skills.individualSkills")}),(0,u.jsx)("th",{children:l("skills.finalCount")}),(0,u.jsx)("th",{children:l("skills.health")}),(0,u.jsx)("th",{})]})}),(0,u.jsx)("tbody",{children:e.bots.map(r=>{let i=ke(r.skills),M=be(r.skills),R=F.bots.get(r.larkAppId),_=R?.finalCount??0,V=vs(R,l),he=v===r.larkAppId,fe=E.has(r.larkAppId)||L!=null&&(R?.resolved.some(W=>W.name===L)??!1),ye=B?.botId===r.larkAppId?B:null,le=e.statuses[r.larkAppId]??null,se=e.busyBotIds?.has(r.larkAppId)===!0;return(0,u.jsxs)("tr",{className:`skills-bot-row${he?" drag-over":""}${fe?" skills-bot-row-focus":""}${se?" is-busy":""}`,"aria-busy":se,onDragOver:W=>{se||!a||a.sourceBotId||(W.preventDefault(),W.dataTransfer.dropEffect="copy",p(r.larkAppId))},onDragLeave:W=>{W.currentTarget.contains(W.relatedTarget)||p(Y=>Y===r.larkAppId?null:Y)},onDrop:W=>{se||!a||a.sourceBotId||(W.preventDefault(),I(r).catch(()=>{}))},children:[(0,u.jsx)("td",{children:r.botName??r.larkAppId}),(0,u.jsx)("td",{children:(0,u.jsx)("div",{className:"skills-pack-chips",children:M.length===0?(0,u.jsx)("span",{className:"muted",children:"\u2014"}):M.map(W=>{let Y=e.packs.find(Se=>Se.id===W),we=!Y&&e.packsKnown===!1,Me=!Y&&!we;return(0,u.jsx)("span",{className:`skills-assigned-draggable${a?.sourceBotId===r.larkAppId&&a.type==="pack"&&a.id===W?" is-dragging":""}`,draggable:!se,"data-assigned-drag-type":"pack","data-assigned-drag-id":W,"data-assigned-bot":r.larkAppId,title:l("skills.dragToRemove"),onDragStart:Se=>{se||G(Se,{type:"pack",id:W,sourceBotId:r.larkAppId},"move")},onDragEnd:U,children:(0,u.jsx)("button",{type:"button",className:`skills-pack-chip${Me?" skills-chip-missing":""}${we?" skills-chip-unknown":""}`,"data-action":"open-bot-pack",title:we?l("skills.healthUnknown"):void 0,disabled:!Y||!e.onOpenPack,onClick:()=>e.onOpenPack?.(W),children:Y?.name??W})},W)})})}),(0,u.jsx)("td",{children:i.length===0?(0,u.jsx)("span",{className:"muted",children:"\u2014"}):(0,u.jsxs)("span",{className:"skills-skill-chips",children:[i.slice(0,3).map(W=>(0,u.jsx)("span",{className:`skills-assigned-draggable${a?.sourceBotId===r.larkAppId&&a.type==="skill"&&a.id===W?" is-dragging":""}`,draggable:!se,"data-assigned-drag-type":"skill","data-assigned-drag-id":W,"data-assigned-bot":r.larkAppId,title:l("skills.dragToRemove"),onDragStart:Y=>{se||G(Y,{type:"skill",id:W,sourceBotId:r.larkAppId},"move")},onDragEnd:U,children:(0,u.jsx)("button",{type:"button",className:"skills-skill-chip","data-action":"open-bot-skill",disabled:!e.onOpenSkill,onClick:()=>e.onOpenSkill?.(W),children:W})},W)),i.length>3&&(0,u.jsxs)("span",{className:"muted",children:["+",i.length-3]})]})}),(0,u.jsx)("td",{children:R?.health==="unknown"?(0,u.jsx)("span",{className:"muted",title:l("skills.healthUnknown"),children:"\u2014"}):_}),(0,u.jsx)("td",{children:(0,u.jsx)("span",{className:`skills-health skills-health-${V.level}`,children:V.label})}),(0,u.jsx)("td",{children:(0,u.jsxs)("div",{className:"skills-bot-row-actions",children:[ye?(0,u.jsx)("span",{className:"skills-duplicate-feedback",role:"status","aria-live":"polite",children:l("skills.alreadyAssigned",{item:ye.itemLabel})}):null,le?(0,u.jsx)("span",{className:`oncall-status ${le.ok?"hint-ok":"hint-warn-inline"}`,role:"status","aria-live":"polite",children:le.text}):se?(0,u.jsx)("span",{className:"oncall-status",role:"status","aria-live":"polite",children:l("skills.saving")}):null,(0,u.jsx)("button",{className:"bd-button",disabled:se,onClick:()=>m(r),children:l("skills.select")})]})})]},r.larkAppId)})})]})})})]}),n&&(0,u.jsx)(bs,{bot:n,skills:e.skills,packs:e.packs,status:e.statuses[n.larkAppId]??null,onClose:()=>m(null),onSave:(r,i)=>e.onSave(n.larkAppId,r,i)})]})}function vs(e,l){switch(e?.health){case"pack_missing":return{level:"error",label:l("skills.healthPackMissing")};case"missing":return{level:"warn",label:l("skills.healthMissing",{count:e.missingSkills.length})};case"unknown":return{level:"unknown",label:l("skills.healthUnknown")};case"default":case void 0:return{level:"ok",label:l("skills.healthDefault")};default:return{level:"ok",label:l("skills.healthOk")}}}function bs(e){let l=X(),n=(0,Q.useMemo)(()=>ke(e.bot.skills),[e.bot.skills]),m=(0,Q.useMemo)(()=>be(e.bot.skills),[e.bot.skills]),[v,p]=(0,Q.useState)(()=>new Set(n)),[g,w]=(0,Q.useState)(()=>new Set(m)),[a,C]=(0,Q.useState)(!1),B=h=>{p(x=>{let E=new Set(x);return E.has(h)?E.delete(h):E.add(h),E})},b=h=>{w(x=>{let E=new Set(x);return E.has(h)?E.delete(h):E.add(h),E})},P=(0,Q.useMemo)(()=>{let h=new Map;for(let x of v)h.set(x,"direct");for(let x of g){let E=e.packs.find(T=>T.id===x);if(E)for(let T of E.include){let L=T.replace("skill:","");h.has(L)||h.set(L,`pack:${E.name}`)}}return[...h.entries()].map(([x,E])=>({name:x,source:E}))},[v,g,e.packs]),N=async()=>{C(!0);try{await e.onSave([...v],[...g]),e.onClose()}finally{C(!1)}};return(0,u.jsx)("dialog",{className:"bd-dialog skills-bot-editor",open:!0,onClose:e.onClose,children:(0,u.jsxs)("form",{method:"dialog","data-action":"save-bot-assignment",onSubmit:h=>{h.preventDefault(),N().catch(()=>{})},children:[(0,u.jsxs)("h3",{children:[l("skills.botEdit"),": ",e.bot.botName??e.bot.larkAppId]}),e.status&&(0,u.jsx)("p",{className:`hint-${e.status.ok?"ok":"warn"}`,children:e.status.text}),(0,u.jsxs)("div",{className:"skills-control-block",children:[(0,u.jsx)("label",{children:l("skills.packChips")}),(0,u.jsxs)("div",{className:"skills-pack-skill-list",children:[e.packs.map(h=>(0,u.jsxs)("label",{className:"skills-pack-skill-item",children:[(0,u.jsx)("input",{type:"checkbox",checked:g.has(h.id),onChange:()=>b(h.id)}),(0,u.jsx)("span",{children:h.name}),(0,u.jsx)("small",{children:l("skills.skillCount",{count:h.include.length})})]},h.id)),e.packs.length===0&&(0,u.jsx)("small",{className:"muted",children:l("skills.packsEmpty")})]})]}),(0,u.jsxs)("div",{className:"skills-control-block",children:[(0,u.jsxs)("label",{children:[l("skills.individualSkills")," (",l("skills.advanced"),")"]}),(0,u.jsx)("div",{className:"skills-pack-skill-list",children:e.skills.map(h=>(0,u.jsxs)("label",{className:"skills-pack-skill-item",children:[(0,u.jsx)("input",{type:"checkbox",checked:v.has(h.name),onChange:()=>B(h.name)}),(0,u.jsx)("span",{children:h.name})]},h.name))})]}),(0,u.jsxs)("div",{className:"skills-control-block",children:[(0,u.jsxs)("label",{children:[l("skills.resolvedPreview")," (",P.length,")"]}),(0,u.jsx)("div",{className:"skills-resolved-preview",children:P.map(({name:h,source:x})=>(0,u.jsxs)("div",{className:"skills-resolved-item",children:[(0,u.jsx)("span",{children:h}),(0,u.jsx)("small",{className:"muted",children:x})]},h))})]}),(0,u.jsxs)("div",{className:"skills-dialog-actions",children:[(0,u.jsx)("button",{type:"button",className:"bd-button",onClick:e.onClose,children:l("skills.cancel")}),(0,u.jsx)("button",{type:"submit",className:"bd-button primary",disabled:a,children:l(a?"skills.saving":"skills.saveSelection")})]})]})})}var O=ee(de(),1);function Al(e){let l=X(),{SkillSegmented:n}=e;return(0,O.jsxs)("div",{className:"skills-page-stack",children:[(0,O.jsxs)("section",{className:"skills-config-block",children:[(0,O.jsx)(ue,{title:l("skills.globalDefaults")}),(0,O.jsxs)("article",{className:"bd-card skills-defaults-panel skills-config-card",children:[(0,O.jsxs)("div",{className:"skills-control-block",children:[(0,O.jsx)("span",{className:"skills-control-label",children:l("skills.globalProject")}),(0,O.jsx)(n,{value:e.trustProjectSkills,disabled:e.globalBusy==="project",options:[{value:"off",label:l("skills.globalProjectOff"),help:l("skills.globalProjectOffHelp")},{value:"all",label:l("skills.globalProjectAll"),help:l("skills.globalProjectAllHelp")}],onChange:m=>e.onUpdateProject(m)})]}),(0,O.jsxs)("div",{className:"skills-control-block",children:[(0,O.jsxs)("span",{className:"skills-control-label",children:[l("skills.globalDelivery"),(0,O.jsx)("small",{className:"skills-scope-note",children:l("skills.scopeGlobal")})]}),(0,O.jsx)(n,{value:e.delivery,disabled:e.globalBusy==="delivery",options:[{value:"auto",label:l("skills.deliveryAuto"),help:l("skills.deliveryAutoHelp")},{value:"prompt",label:l("skills.deliveryPrompt"),help:l("skills.deliveryPromptHelp")},{value:"native",label:l("skills.deliveryNative"),help:l("skills.deliveryNativeHelp")}],onChange:m=>e.onUpdateDelivery(m)})]})]})]}),(0,O.jsxs)("section",{className:"skills-config-block",children:[(0,O.jsx)(ue,{title:l("skills.botInjection"),hint:l("skills.botInjectionHelp")}),(0,O.jsxs)("article",{className:"bd-card skills-config-card",children:[(0,O.jsx)("p",{className:"skills-injection-note",children:l("skills.botInjectionNote")}),(0,O.jsx)("div",{className:"skills-bot-injection-table",children:(0,O.jsxs)("table",{children:[(0,O.jsx)("thead",{children:(0,O.jsxs)("tr",{children:[(0,O.jsx)("th",{children:l("skills.bot")}),(0,O.jsx)("th",{children:l("skills.cli")}),(0,O.jsx)("th",{children:l("skills.injection")}),(0,O.jsx)("th",{children:l("skills.status")})]})}),(0,O.jsx)("tbody",{children:e.bots.map(m=>(0,O.jsxs)("tr",{children:[(0,O.jsx)("td",{children:m.botName??m.larkAppId}),(0,O.jsx)("td",{children:(0,O.jsx)("code",{children:m.cliId??""})}),(0,O.jsx)("td",{children:(0,O.jsx)(n,{value:m.skillInjection??m.skillInjectionDefault??"prompt",options:[{value:"global",label:l("skills.injectionGlobal"),help:l("skills.injectionGlobalHelp")},{value:"prompt",label:l("skills.injectionPrompt"),help:l("skills.injectionPromptHelp")},{value:"off",label:l("skills.injectionOff"),help:l("skills.injectionOffHelp")}],onChange:v=>e.onUpdateBotInjection(m.larkAppId,v)})}),(0,O.jsx)("td",{children:e.botStatuses[m.larkAppId]?(0,O.jsx)("span",{className:`hint-${e.botStatuses[m.larkAppId].ok?"ok":"warn"}`,children:e.botStatuses[m.larkAppId].text}):null})]},m.larkAppId))})]})})]})]})]})}var Z=ee(Be(),1);function Bl(e){let l=(0,Z.useRef)(!0),[n,m]=(0,Z.useState)([]),[v,p]=(0,Z.useState)([]),[g,w]=(0,Z.useState)([]),[a,C]=(0,Z.useState)([]),[B,b]=(0,Z.useState)("off"),[P,N]=(0,Z.useState)("auto"),[h,x]=(0,Z.useState)(!0),[E,T]=(0,Z.useState)(null),[L,A]=(0,Z.useState)(null),[$,H]=(0,Z.useState)(!1),K=(0,Z.useRef)(e.apiUnavailableText);K.current=e.apiUnavailableText;let F=(0,Z.useCallback)(async()=>{x(!0);try{let[y,f,I]=await Promise.all([fetch("/api/skills"),fetch("/api/bots"),fetch("/api/skill-packs").catch(()=>null)]),d=await y.json().catch(()=>({})),U=await f.json().catch(()=>({})),G=I?await I.json().catch(()=>({})):{};if(!y.ok){let te=d?.error??`skills HTTP ${y.status}`;throw new Error(te==="not_found_yet"||te==="not_found"?K.current:te)}if(!f.ok)throw new Error(U?.error??`bots HTTP ${f.status}`);if(!l.current)return;m(Array.isArray(d.skills)?d.skills:[]),p(Array.isArray(d.nativeSkillGroups)?d.nativeSkillGroups:[]),w(Array.isArray(U.bots)?U.bots:[]),I?.ok&&Array.isArray(G.packs)?(C(G.packs),A(null),H(!0)):I?.status===404?(C([]),A(null),H(!0)):A(I?G?.error??`HTTP ${I.status}`:"network_error"),b(d.trustProjectSkills==="all"?"all":"off"),N(d.delivery==="prompt"||d.delivery==="native"?d.delivery:"auto"),T(null)}catch(y){l.current&&T(y?.message??String(y))}finally{l.current&&x(!1)}},[]);return(0,Z.useEffect)(()=>(l.current=!0,F(),()=>{l.current=!1}),[F]),{skills:n,nativeSkillGroups:v,bots:g,packs:a,trustProjectSkills:B,delivery:P,loading:h,loadError:E,packsError:L,packsKnown:$,refresh:F,setSkills:m,setBots:w,setTrustProjectSkills:b,setDelivery:N}}var s=ee(de(),1),hs=2;function ys(e){return e>=1600?4:e<=620?1:e<=980?2:3}async function re(e,l){let n=await fetch(e,{...l,headers:{"content-type":"application/json",...l.headers??{}}}),m=await n.json().catch(()=>({}));if(!n.ok||m.ok===!1){let v=new Error(m?.error??`HTTP ${n.status}`);throw v.status=n.status,v.body=m,v}return m}function nl(e){return`oncall-status${e?` ${e.ok?"hint-ok":"hint-warn-inline"}`:""}`}function Ss(e){let l=e.options.find(n=>n.value===e.value);return(0,s.jsxs)("div",{className:"skills-segmented-control",children:[(0,s.jsx)("div",{className:"segmented skills-segmented",role:"group",children:e.options.map(n=>(0,s.jsx)("button",{type:"button",className:e.value===n.value?"active":"","aria-pressed":e.value===n.value?"true":"false",title:typeof n.help=="string"?n.help:void 0,disabled:e.disabled,onClick:()=>e.onChange(n.value),children:n.label},n.value))}),l?.help?(0,s.jsx)("span",{className:"skills-setting-hint",children:l.help}):null]})}function Ns(e){let l=X(),n=(0,c.useRef)(null),m=(0,c.useRef)(null),v=(0,c.useId)(),p=`${v}-input`,g=`${v}-title`,[w,a]=(0,c.useState)(!1),C=e.installCandidates??[],B=e.selectedInstallSkills??new Set,b=C.length>0&&C.every(T=>B.has(T.name)),P=e.installBusy||e.installDiscovering,N=ll(e.installSource),h=l(N==="github"?"skills.sourceDetectedGithub":N==="git"?"skills.sourceDetectedGit":N==="agentbuddy"?"skills.sourceDetectedAgentbuddy":N==="local"?"skills.sourceDetectedLocal":"skills.sourceDetectedUnknown"),x=l(N==="agentbuddy"?"skills.sourcePreflightAgentbuddy":N==="github"||N==="git"?"skills.sourcePreflightGit":N==="local"?"skills.sourcePreflightLocal":"skills.sourcePreflightUnknown"),E=l(N==="agentbuddy"?"skills.installDiagnosticAgentbuddy":N==="github"||N==="git"?"skills.installDiagnosticGit":N==="local"?"skills.installDiagnosticLocal":"skills.installDiagnosticUnknown");return(0,c.useEffect)(()=>{let T=n.current;if(T)if(e.installSelectionOpen&&!T.open)try{T.showModal()}catch{}else!e.installSelectionOpen&&T.open&&T.close()},[e.installSelectionOpen,C.length]),(0,c.useEffect)(()=>{if(!w||typeof document>"u")return;let T=A=>{m.current?.contains(A.target)||a(!1)},L=A=>{A.key==="Escape"&&a(!1)};return document.addEventListener("pointerdown",T),document.addEventListener("keydown",L),()=>{document.removeEventListener("pointerdown",T),document.removeEventListener("keydown",L)}},[w]),(0,s.jsxs)("article",{className:"bd-card skills-install-panel",children:[e.showTitle===!1?null:(0,s.jsx)("div",{className:"skills-install-title",children:(0,s.jsx)("h3",{className:"bd-section-title",children:(0,s.jsx)(yl,{help:l("skills.installInfo"),helpLabel:l("skills.installInfoLabel"),children:l("skills.install")})})}),e.installTargetSkill?(0,s.jsxs)("div",{className:"skills-inline-target","data-install-target":e.installTargetSkill,children:[(0,s.jsx)("span",{children:l("skills.installTargetHint",{skill:e.installTargetSkill})}),(0,s.jsx)("button",{type:"button","data-action":"clear-install-target",onClick:()=>e.onClearInstallTarget?.(),children:l("skills.clearInstallTarget")})]}):null,(0,s.jsxs)("div",{className:"skills-install-grid",children:[(0,s.jsxs)("div",{className:"skills-source-label",children:[(0,s.jsxs)("div",{className:"skills-source-heading",ref:m,onKeyDown:T=>{T.key==="Escape"&&a(!1)},children:[(0,s.jsx)("label",{htmlFor:p,children:l("skills.source")}),(0,s.jsx)("button",{type:"button",className:"skills-source-help-trigger","data-action":"toggle-source-help","aria-label":l("skills.sourceHelpOpen"),"aria-expanded":w,"aria-controls":v,"aria-haspopup":"dialog",onClick:()=>a(T=>!T),children:"?"}),w?(0,s.jsxs)("aside",{className:"skills-source-help-popover",id:v,role:"dialog","aria-labelledby":g,"data-source-help-popover":!0,children:[(0,s.jsxs)("div",{className:"skills-source-help-head",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("strong",{id:g,children:l("skills.sourceHelpTitle")}),(0,s.jsx)("span",{children:l("skills.sourceHelpIntro")})]}),(0,s.jsx)("button",{type:"button",className:"skills-source-help-close","data-action":"close-source-help","aria-label":l("skills.sourceHelpClose"),onClick:()=>a(!1),children:"\xD7"})]}),(0,s.jsxs)("div",{className:"skills-source-help-list",children:[(0,s.jsxs)("section",{children:[(0,s.jsx)("strong",{children:l("skills.sourceHelpRemoteLabel")}),(0,s.jsx)("span",{children:l("skills.sourceHelpRemote")}),(0,s.jsx)("code",{children:l("skills.sourceHelpRemoteExample")})]}),(0,s.jsxs)("section",{children:[(0,s.jsx)("strong",{children:l("skills.sourceHelpLocalLabel")}),(0,s.jsx)("span",{children:l("skills.sourceHelpLocal")}),(0,s.jsx)("code",{children:l("skills.sourceHelpLocalExample")})]}),(0,s.jsxs)("section",{children:[(0,s.jsx)("strong",{children:l("skills.sourceHelpAgentbuddyLabel")}),(0,s.jsx)("span",{children:l("skills.sourceHelpAgentbuddy")}),(0,s.jsx)("code",{children:l("skills.sourceHelpAgentbuddyExample")})]})]})]}):null]}),(0,s.jsx)("div",{className:"skills-source-control",children:(0,s.jsx)("input",{id:p,type:"text","data-install":"source","aria-label":l("skills.source"),placeholder:l("skills.sourcePlaceholder"),value:e.installSource,onChange:T=>e.onInstallSourceChange(T.currentTarget.value)})}),e.installSource.trim()?(0,s.jsxs)("div",{className:`skills-source-feedback is-${N}`,"data-source-hint":N,children:[(0,s.jsx)("strong",{children:h}),(0,s.jsx)("span",{children:x})]}):null]}),(0,s.jsxs)("details",{className:"skills-install-advanced","data-install-advanced":!0,children:[(0,s.jsx)("summary",{children:l("skills.advancedOptions")}),(0,s.jsxs)("div",{className:"skills-install-advanced-body",children:[(0,s.jsxs)("label",{className:"skills-install-field",children:[(0,s.jsx)("span",{children:l("skills.path")}),(0,s.jsx)("input",{type:"text","data-install":"path",placeholder:l("skills.pathPlaceholder"),value:e.installPath,onChange:T=>e.onInstallPathChange(T.currentTarget.value)}),(0,s.jsx)("small",{children:l("skills.pathHelpInline")})]}),(0,s.jsxs)("label",{className:"skills-install-field",children:[(0,s.jsx)("span",{children:l("skills.ref")}),(0,s.jsx)("input",{type:"text","data-install":"ref",placeholder:l("skills.refPlaceholder"),value:e.installRef,onChange:T=>e.onInstallRefChange(T.currentTarget.value)}),(0,s.jsx)("small",{children:l("skills.refHelpInline")})]}),(0,s.jsxs)("label",{className:"skills-scan-toggle",children:[(0,s.jsx)("input",{type:"checkbox","data-install":"full-depth",checked:e.installFullDepth,disabled:P,onChange:T=>e.onInstallFullDepthChange(T.currentTarget.checked)}),(0,s.jsxs)("span",{children:[(0,s.jsx)("strong",{children:l("skills.deepScan")}),(0,s.jsx)("small",{children:l("skills.deepScanHelp")}),(0,s.jsx)("small",{className:"muted",children:l("skills.autoDeepScanHint")})]})]})]})]}),(0,s.jsxs)("div",{className:"skills-install-actions",children:[(0,s.jsx)("button",{type:"button",className:"skills-local-discovery-link","data-action":"open-native-skill-discovery",title:l("skills.localDiscoverHelp"),onClick:()=>e.onOpenNativeDiscovery(),children:l("skills.localDiscover")}),(0,s.jsx)("button",{type:"button",className:"primary","data-action":"install",disabled:P||!e.installSource.trim(),onClick:()=>e.onInstall(),children:e.installDiscovering?l("skills.scanning"):e.installBusy?l("skills.jobRunning"):l("skills.installSubmit")})]})]}),e.installStatus?(0,s.jsx)("div",{className:"actions skills-install-status-row",children:(0,s.jsx)("span",{className:nl(e.installStatus),"data-skills-status":!0,children:e.installStatus.text})}):null,e.installStatus&&!e.installStatus.ok?(0,s.jsxs)("div",{className:"skills-install-diagnostic","data-install-diagnostic":N,role:"alert",children:[(0,s.jsx)("strong",{children:l("skills.installDiagnosticTitle")}),(0,s.jsx)("span",{children:E})]}):null,(0,s.jsx)("dialog",{className:"skills-discovery-dialog skills-install-selection-dialog","data-install-selection-dialog":!0,ref:n,onClose:()=>e.onCloseInstallSelection?.(),children:(0,s.jsxs)("article",{children:[(0,s.jsxs)("header",{children:[(0,s.jsx)("h3",{children:l("skills.installSelectionTitle")}),(0,s.jsx)("p",{children:l("skills.installSelectionHelp",{count:C.length})})]}),(0,s.jsx)("div",{className:"skills-discovery-body skills-install-selection-body",children:(0,s.jsxs)("div",{className:"skills-candidate-list","data-install-candidates":!0,children:[(0,s.jsxs)("div",{className:"skills-candidate-list-head",children:[(0,s.jsx)("span",{children:l("skills.scanFound",{count:C.length})}),e.onSelectAllInstallSkills?(0,s.jsx)("button",{type:"button","data-action":"toggle-all-source-skills",disabled:e.installBusy,onClick:()=>e.onSelectAllInstallSkills?.(!b),children:l(b?"skills.discoverClearSelection":"skills.discoverSelectAll")}):null]}),C.map(T=>(0,s.jsxs)("label",{className:"skills-candidate-row",children:[(0,s.jsx)("input",{type:"checkbox",checked:B.has(T.name),disabled:e.installBusy,onChange:()=>e.onToggleInstallSkill?.(T.name)}),(0,s.jsxs)("span",{children:[(0,s.jsx)("strong",{children:T.name}),(0,s.jsxs)("small",{children:[T.path,T.description?` \xB7 ${T.description}`:""]})]})]},`${T.name}:${T.path}`))]})}),(0,s.jsxs)("footer",{className:"actions",children:[(0,s.jsx)("button",{type:"button","data-action":"close-install-selection",disabled:e.installBusy,onClick:()=>e.onCloseInstallSelection?.(),children:l("skills.installSelectionCancel")}),(0,s.jsx)("button",{type:"button",className:"primary","data-action":"confirm-install-selection",disabled:e.installBusy||B.size===0,onClick:()=>e.onConfirmInstallSelection?.(),children:e.installBusy?l("skills.jobRunning"):l("skills.installSelected")})]})]})})]})}function Is(e){let l=X(),n=(0,c.useRef)(null),m=(0,c.useRef)(new Set(e.skills.map(i=>i.name))),v=(0,c.useRef)(""),p=(0,c.useRef)(!1),g=(0,c.useRef)(null),[w,a]=(0,c.useState)(""),[C,B]=(0,c.useState)(!1),[b,P]=(0,c.useState)(()=>new Set),[N,h]=(0,c.useState)(null),[x,E]=(0,c.useState)(0),[T,L]=(0,c.useState)(()=>typeof window>"u"?1200:window.innerWidth),A=w.trim().toLocaleLowerCase();v.current=w,p.current=C;let $=(0,c.useMemo)(()=>{let i=N?e.skills.filter(M=>N.has(M.name)):e.skills;return A?i.filter(M=>[M.name,M.displayName,M.description,...M.tags??[],sl(M,l)].filter(Boolean).join(`
3
+ `).toLocaleLowerCase().includes(A)):i},[N,A,e.skills,l]),H=(0,c.useMemo)(()=>{if(!N)return[];let i=new Set(e.skills.map(M=>M.name));return[...N].filter(M=>!i.has(M)).sort()},[N,e.skills]),K=ys(T)*hs,F=Math.max(1,Math.ceil($.length/K)),y=$.slice(x*K,x*K+K),f=(0,c.useMemo)(()=>new Set($.map(i=>i.name)),[$]),I=$.filter(i=>b.has(i.name)).length,d=Math.max(0,b.size-I),U=$.length>0&&I===$.length;(0,c.useEffect)(()=>{if(typeof window>"u")return;let i=()=>L(window.innerWidth);return window.addEventListener("resize",i),()=>window.removeEventListener("resize",i)},[]),(0,c.useEffect)(()=>{e.externalQuery!=null&&e.externalQuery!==""&&a(e.externalQuery)},[e.externalQuery]),(0,c.useEffect)(()=>{e.externalFilterNames&&e.externalFilterNames.length>0&&h(new Set(e.externalFilterNames))},[e.externalFilterNames]),(0,c.useEffect)(()=>E(0),[A,K,N]),(0,c.useEffect)(()=>{E(i=>Math.min(Math.max(0,i),F-1))},[F]),(0,c.useEffect)(()=>{let i=new Set(e.skills.map(R=>R.name)),M=[...m.current].some(R=>!i.has(R));P(R=>{let _=new Set([...R].filter(V=>i.has(V)));return _.size===R.size?R:_}),M&&(B(!1),P(new Set)),m.current=i},[e.skills]),(0,c.useEffect)(()=>{n.current&&(n.current.indeterminate=I>0&&!U)},[U,I]),(0,c.useEffect)(()=>{if(typeof document>"u")return;let i=R=>{if(R.key!=="Escape"||!p.current)return;let _=v.current;g.current=_,R.preventDefault(),R.stopPropagation(),B(!1),P(new Set),window.setTimeout(()=>{a(V=>V||_),g.current=null},50)},M=R=>{if(R.key!=="Escape"||g.current===null)return;let _=g.current;g.current=null,R.preventDefault(),R.stopPropagation(),a(_)};return document.addEventListener("keydown",i,!0),document.addEventListener("keyup",M,!0),()=>{document.removeEventListener("keydown",i,!0),document.removeEventListener("keyup",M,!0)}},[]);function G(i){P(M=>{let R=new Set(M);return R.has(i)?R.delete(i):R.add(i),R})}function te(){P(i=>{let M=new Set(i);if(U)for(let R of f)M.delete(R);else for(let R of f)M.add(R);return M})}function r(i=!1){let M=w;B(!1),P(new Set),i&&typeof window<"u"&&window.setTimeout(()=>a(M),0)}return(0,s.jsxs)("section",{className:"skills-installed-block",children:[(0,s.jsx)(ue,{title:l("skills.installed"),count:l("skills.installedCount",{count:e.skills.length}),hint:l("skills.installedHelp"),children:(0,s.jsx)("div",{className:"skills-installed-header-actions",children:C?(0,s.jsx)("button",{type:"button","data-action":"cancel-installed-selection",onClick:()=>r(),children:l("skills.cancel")}):(0,s.jsx)("button",{type:"button","data-action":"select-installed-skills",disabled:e.skills.length===0,onClick:()=>B(!0),children:l("skills.select")})})}),(0,s.jsxs)("section",{className:"bd-card skills-installed-panel",children:[(0,s.jsxs)("div",{className:"skills-library-toolbar",children:[(0,s.jsxs)("label",{className:"skills-installed-search",children:[(0,s.jsx)("span",{className:"sr-only",children:l("skills.searchLabel")}),(0,s.jsx)("input",{type:"text",role:"searchbox",inputMode:"search","data-action":"search-installed-skills",placeholder:l("skills.searchPlaceholder"),value:w,onChange:i=>a(i.currentTarget.value),onKeyDown:i=>{i.key!=="Escape"||!C||(i.preventDefault(),i.stopPropagation(),r(!0))}}),w?(0,s.jsx)("button",{type:"button","data-action":"clear-installed-search","aria-label":l("skills.clearSearch"),onClick:()=>a(""),children:"\xD7"}):null]}),C?(0,s.jsxs)("label",{className:"skills-select-all-results",children:[(0,s.jsx)("input",{ref:n,type:"checkbox",checked:U,disabled:$.length===0||e.removingNames.size>0,onChange:te}),(0,s.jsx)("span",{children:A?l("skills.selectSearchResults",{count:$.length}):l("skills.selectAllSkills",{count:$.length})})]}):null,N?(0,s.jsxs)("button",{type:"button",className:"skills-library-filter-chip","data-action":"clear-library-filter",title:[...N].join(", "),"aria-label":l("skills.clearFilter"),onClick:()=>h(null),children:[l("skills.libraryFilterActive",{count:N.size})," \xD7"]}):null,A?(0,s.jsx)("span",{className:"skills-filter-count",children:l("skills.resultCount",{count:$.length})}):null,F>1?(0,s.jsxs)("div",{className:"skills-pager",children:[(0,s.jsx)("button",{type:"button",className:"skills-pager-button","data-action":"page-installed-skills","data-dir":"-1","aria-label":l("skills.prevPage"),title:l("skills.prevPage"),disabled:x===0,onClick:()=>E(i=>Math.max(0,i-1)),children:"\u2039"}),(0,s.jsx)("span",{children:l("skills.pageStatus",{page:x+1,pages:F})}),(0,s.jsx)("button",{type:"button",className:"skills-pager-button","data-action":"page-installed-skills","data-dir":"1","aria-label":l("skills.nextPage"),title:l("skills.nextPage"),disabled:x>=F-1,onClick:()=>E(i=>Math.min(F-1,i+1)),children:"\u203A"})]}):null]}),(0,s.jsx)("div",{className:"skills-installed-live",role:"status","aria-live":"polite",children:e.status?(0,s.jsx)("span",{className:nl(e.status),children:e.status.text}):null}),H.length>0&&(0,s.jsxs)("div",{className:"skills-missing-list","data-missing-skills":!0,children:[(0,s.jsx)("strong",{children:l("skills.missingFilteredTitle")}),H.map(i=>(0,s.jsxs)("div",{className:"skills-missing-row","data-missing-skill":i,children:[(0,s.jsx)("span",{className:"skills-missing-row-name",children:i}),(0,s.jsx)("small",{className:"muted",children:l("skills.dangling")}),(0,s.jsx)("button",{type:"button","data-action":"install-dangling-skill",disabled:!e.onInstallMissing,onClick:()=>e.onInstallMissing?.(i),children:l("skills.installNow")})]},i))]}),e.skills.length===0?(0,s.jsxs)("div",{className:"skills-library-empty",children:[(0,s.jsx)("strong",{children:l("skills.emptyTitle")}),(0,s.jsx)("p",{children:l("skills.emptyHelp")})]}):$.length===0&&H.length>0?null:$.length===0?(0,s.jsxs)("div",{className:"skills-library-empty","data-empty":"search",children:[(0,s.jsx)("strong",{children:l("skills.noResultsTitle",{query:w.trim()})}),(0,s.jsx)("p",{children:l("skills.noResultsHelp")}),(0,s.jsx)("button",{type:"button","data-action":"clear-installed-search-empty",onClick:()=>a(""),children:l("skills.clearSearch")})]}):(0,s.jsx)("div",{className:"skills-list",children:y.map(i=>{let M=b.has(i.name),R=e.removingNames.has(i.name);return(0,s.jsxs)("article",{className:`skills-row skills-installed-card${C?" is-selectable":""}${M?" is-selected":""}${R?" is-removing":""}`,"data-skill":i.name,"data-selection-mode":C?"true":void 0,"aria-busy":R||void 0,onClick:C?()=>G(i.name):void 0,children:[(0,s.jsxs)("div",{className:"skills-row-body",children:[(0,s.jsxs)("div",{className:"skills-row-title",children:[C?(0,s.jsx)("input",{type:"checkbox","aria-label":l("skills.selectNamed",{skill:i.displayName??i.name}),checked:M,disabled:R,onClick:_=>_.stopPropagation(),onChange:()=>G(i.name)}):null,(0,s.jsxs)("span",{children:[(0,s.jsx)("strong",{children:i.displayName??i.name}),i.displayName&&i.displayName!==i.name?(0,s.jsx)("small",{className:"skills-canonical-name",children:i.name}):null]})]}),i.description?(0,s.jsx)("p",{children:i.description}):null,(0,s.jsx)("small",{className:"skills-source-badge",children:sl(i,l)}),e.graph?(()=>{let _=e.graph.skills.get(i.name),V=e.packsKnown===!1,he=_?.packIds.length??0,fe=_?new Set([..._.directBotIds,..._.viaPackBotIds]).size:0,ye=V?l("skills.healthUnknown"):(_?.packIds??[]).map(le=>e.packNames?.find(se=>se.id===le)?.name??le).join(", ");return(0,s.jsxs)("span",{className:"skills-usage-chips",children:[(0,s.jsx)("button",{type:"button",className:"skills-usage-chip","data-action":"show-skill-packs",disabled:V||he===0||!e.onShowSkillPacks,title:ye||void 0,onClick:le=>{le.stopPropagation(),e.onShowSkillPacks?.(i.name)},children:V?l("skills.usedInPacksUnknown"):l("skills.usedInPacks",{count:he})}),(0,s.jsx)("button",{type:"button",className:"skills-usage-chip","data-action":"show-skill-bots",disabled:fe===0||!e.onShowSkillBots,onClick:le=>{le.stopPropagation(),e.onShowSkillBots?.(i.name)},children:l("skills.usedByBots",{count:fe})})]})})():null,R?(0,s.jsx)("span",{className:"skills-removing-label",children:l("skills.removing")}):null]}),C?null:(0,s.jsxs)("div",{className:"skills-card-actions",children:[(0,s.jsx)("button",{type:"button","data-action":"update-skill",disabled:e.busySkill===`${i.name}:update`||R,onClick:()=>e.onUpdate(i.name),children:l("skills.update")}),(0,s.jsx)("button",{type:"button","data-action":"remove-skill",disabled:R,onClick:()=>e.onRequestRemove([i.name]),children:l("skills.remove")})]})]},i.name)})})]}),C?(0,s.jsxs)("div",{className:"skills-bulk-action-bar",role:"toolbar","aria-label":l("skills.bulkActions"),children:[(0,s.jsxs)("span",{children:[(0,s.jsx)("strong",{children:l("skills.selectedCount",{count:b.size})}),d>0?(0,s.jsx)("small",{children:l("skills.selectedHidden",{count:d})}):null]}),(0,s.jsx)("button",{type:"button",className:"danger","data-action":"remove-selected-skills",disabled:b.size===0||e.removingNames.size>0,onClick:()=>e.onRequestRemove([...b]),children:l("skills.removeSelected",{count:b.size})})]}):null]})}function ws(e){let l=X(),n=(0,c.useRef)(null),m=e.names??[],v=e.references.length>0,p=m.slice(0,3),g=new Set(e.references.flatMap(a=>a.bots)).size,w=new Set(e.references.flatMap(a=>a.packs)).size;return(0,c.useEffect)(()=>{let a=n.current;if(a)if(e.names&&!a.open)try{a.showModal()}catch{}else!e.names&&a.open&&a.close()},[e.names]),(0,s.jsx)("dialog",{className:"skills-remove-dialog","data-remove-skills-dialog":!0,ref:n,onCancel:a=>{a.preventDefault(),e.busy||e.onCancel()},onClick:a=>{a.target===a.currentTarget&&!e.busy&&e.onCancel()},children:(0,s.jsxs)("article",{children:[(0,s.jsxs)("header",{children:[(0,s.jsx)("h3",{children:v?m.length===1?l("skills.removeInUseOneTitle",{skill:m[0]}):l("skills.removeInUseManyTitle",{count:m.length}):m.length===1?l("skills.removeOneTitle",{skill:m[0]}):l("skills.removeManyTitle",{count:m.length})}),(0,s.jsx)("p",{children:v?m.length===1?w>0?l("skills.removeInUseOneHelpWithPacks",{botCount:g,packCount:w}):l("skills.removeInUseOneHelp",{count:g}):w>0?l("skills.removeInUseManyHelpWithPacks",{botCount:g,packCount:w}):l("skills.removeInUseManyHelp",{count:g}):m.length===1?l("skills.removeOnePermanentHelp"):l("skills.removePermanentHelp")})]}),(0,s.jsxs)("div",{className:"skills-remove-dialog-body",children:[m.length>1?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("ul",{children:p.map(a=>(0,s.jsx)("li",{children:a},a))}),m.length>p.length?(0,s.jsx)("p",{children:l("skills.removeMore",{count:m.length-p.length})}):null]}):null,e.references.length>0?(0,s.jsxs)("div",{className:"skills-remove-reference-warning",role:"alert",children:[(0,s.jsx)("strong",{children:l("skills.removeReferencesDetail")}),(0,s.jsx)("ul",{children:e.references.map(a=>(0,s.jsxs)("li",{children:[(0,s.jsx)("strong",{children:a.name}),(0,s.jsxs)("span",{children:[a.bots.join(", "),a.bots.length>0&&a.packs.length>0?" \xB7 ":"",a.packs.length>0?`${l("skills.packChips")}: ${a.packs.join(", ")}`:""]})]},a.name))})]}):null,e.error?(0,s.jsx)("p",{className:"hint-warn",role:"alert",children:e.error}):null]}),(0,s.jsxs)("footer",{className:"actions",children:[(0,s.jsx)("button",{type:"button",autoFocus:!0,disabled:e.busy,onClick:e.onCancel,children:l("skills.cancel")}),(0,s.jsx)("button",{type:"button",className:"danger",disabled:e.busy,onClick:()=>e.onConfirm(v),children:e.busy?l("skills.removing"):v?l("skills.removeAnyway"):m.length===1?l("skills.removeOneConfirm"):l("skills.removeSelected",{count:m.length})})]})]})})}function Cs(){let e=X(),l=(0,c.useRef)(!0),n=(0,c.useRef)(new Set),m=(0,c.useRef)(null),{skills:v,nativeSkillGroups:p,bots:g,packs:w,trustProjectSkills:a,delivery:C,loading:B,loadError:b,packsError:P,packsKnown:N,refresh:h,setSkills:x,setBots:E,setTrustProjectSkills:T,setDelivery:L}=Bl({apiUnavailableText:e("skills.apiUnavailable")}),[A,$]=(0,c.useState)("library"),[H,K]=(0,c.useState)(null),[F,y]=(0,c.useState)(null),f=(0,c.useCallback)(t=>{K(t),y(t.installTargetSkill??null),$(t.tab)},[]),I=(0,c.useCallback)(()=>K(null),[]),[d,U]=(0,c.useState)(""),[G,te]=(0,c.useState)(""),[r,i]=(0,c.useState)(""),[M,R]=(0,c.useState)(null),[_,V]=(0,c.useState)(!1),[he,fe]=(0,c.useState)(!1),[ye,le]=(0,c.useState)(!1),[se,W]=(0,c.useState)([]),[Y,we]=(0,c.useState)(!1),[Me,Se]=(0,c.useState)(!1),[Ke,Ee]=(0,c.useState)(()=>new Set),[_e,Ce]=(0,c.useState)(!1),[Ml,al]=(0,c.useState)(!1),[We,El]=(0,c.useState)(null),[qe,Je]=(0,c.useState)(()=>new Set),[$l,$e]=(0,c.useState)(null),[Ll,il]=(0,c.useState)(null),[Hl,ol]=(0,c.useState)(()=>new Set),[rl,Ne]=(0,c.useState)({}),[Qe,Pe]=(0,c.useState)(null),[cl,Xe]=(0,c.useState)(null),[Ol,Re]=(0,c.useState)(!1),[jl,Le]=(0,c.useState)([]),[Fl,He]=(0,c.useState)(null),[Oe,dl]=(0,c.useState)(()=>new Set),De=(0,c.useRef)(g),je=(0,c.useRef)(new Map);(0,c.useEffect)(()=>{De.current=g},[g]);let Fe=(0,c.useMemo)(()=>new Set(v.map(t=>t.name)),[v]),ve=(0,c.useMemo)(()=>p.length===0?void 0:(We?p.find(o=>xe(o)===We):void 0)??p.find(o=>o.skills.length>0)??p[0],[We,p]),Ze=ve?xe(ve):"",Te=(0,c.useMemo)(()=>ve?ve.skills.filter(t=>!Fe.has(t.name)).map(t=>t.rootDir??t.source?.root??"").filter(Boolean):[],[ve,Fe]),ul=Te.length>0&&Te.every(t=>qe.has(t)),kl=(0,c.useCallback)(()=>{for(let t of n.current)window.clearTimeout(t);n.current.clear()},[]),Ul=(0,c.useCallback)(t=>new Promise(o=>{let S=window.setTimeout(()=>{n.current.delete(S),o()},t);n.current.add(S)}),[]);(0,c.useEffect)(()=>(l.current=!0,()=>{l.current=!1,kl()}),[kl]),(0,c.useEffect)(()=>{Je(t=>{let o=new Set,S=new Set(v.map(D=>D.name));for(let D of p)for(let z of D.skills){let j=z.rootDir??z.source?.root??"";j&&!S.has(z.name)&&t.has(j)&&o.add(j)}return o.size===t.size?t:o})},[v,p]),(0,c.useEffect)(()=>{if(!Qe||Oe.size>0)return;let t=window.setTimeout(()=>{l.current&&Pe(null)},6e3);return()=>window.clearTimeout(t)},[Qe,Oe]),(0,c.useEffect)(()=>{let t=m.current;if(t)if(_e&&!t.open)try{t.showModal()}catch{}else!_e&&t.open&&t.close()},[_e,Ze]);async function ml(t,o,S=!0){let D=t;for(o({text:e("skills.jobRunning"),ok:!0});;){if(!l.current)return null;if(D.status==="succeeded")return o({text:e("skills.saved"),ok:!0}),S&&await h(),D;if(D.status==="failed")throw new Error(D.error??"job_failed");if(await Ul(800),!l.current)return null;let z=await re(`/api/skills/jobs/${encodeURIComponent(D.id)}`,{method:"GET"});if(!l.current)return null;D=z.job}}function Gl(t){return g.filter(o=>ke(o.skills).includes(t)).map(o=>o.botName??o.larkAppId)}function Ae(){W([]),Ee(new Set),le(!1),Se(!1)}function gl(){return{source:d.trim(),path:G.trim()||void 0,ref:r.trim()||void 0,...Y?{fullDepth:!0}:{}}}function zl(t,o=Y||Me){let S=t??[...Ke];return{...gl(),skillNames:S.length>0?S:void 0,...o?{fullDepth:!0}:{}}}async function Kl(){fe(!0),R({text:e("skills.scanning"),ok:!0});try{let t=await re("/api/skills/discover",{method:"POST",body:JSON.stringify(gl())});if(!l.current)return{skills:[],directInstall:!1,fullDepth:Y};let o=t.discovery?.directInstall===!0,S=Array.isArray(t.discovery?.skills)?t.discovery.skills:[],D=t.discovery?.deepScanned===!0;return Se(D),W(S),Ee(tl(S,F).selected),{skills:S,directInstall:o,fullDepth:Y||D}}finally{l.current&&fe(!1)}}function me(t){let o=t||"";return o.startsWith("skill_git_command_failed")&&/authentication failed|could not read username|repository not found|unauthor|\b401\b|\b403\b/i.test(o)?e("skills.gitNeedsAuth"):o.startsWith("agentbuddy_not_found")?e("skills.agentbuddyNotFound"):o.startsWith("agentbuddy_login_required")?e("skills.agentbuddyNeedsLogin"):o.startsWith("agentbuddy_command_failed")?/login|credential|unauthor|not logged|401|403/i.test(o)?e("skills.agentbuddyNeedsLogin"):e("skills.agentbuddyCommandFailed"):o.startsWith("agentbuddy_clear_telemetry_failed")||o.startsWith("agentbuddy_telemetry_not_stripped")?e("skills.agentbuddyTelemetryFailed"):o.startsWith("agentbuddy_no_skill_produced")?e("skills.agentbuddyNoSkill"):o.startsWith("invalid_agentbuddy")?e("skills.agentbuddyInvalid"):o}async function Ve(t,o=Y||Me){V(!0);try{let S=await re("/api/skills/install",{method:"POST",body:JSON.stringify(zl(t,o))});if(!l.current)return null;let D=await ml(S.job,R);if(!l.current||!D)return null;let z=(D.skills??(D.skill?[D.skill]:[])).map(j=>j.name).filter(Boolean);return Ae(),y(null),[...new Set(z.length>0?z:t??[])]}catch(S){return l.current&&R({text:`${e("skills.failed")}: ${me(S?.message??String(S))}`,ok:!1}),null}finally{l.current&&V(!1)}}function _l(t){Ee(o=>{let S=new Set(o);return S.has(t)?S.delete(t):S.add(t),S})}function Wl(t){Ee(t?new Set(se.map(o=>o.name)):new Set)}async function ql(){if(!d.trim())return R({text:e("skills.sourceRequired"),ok:!1}),null;try{le(!1);let{skills:t,directInstall:o,fullDepth:S}=await Kl();if(!l.current)return null;if(o)return await Ve(void 0,S);if(t.length===0)return R({text:e("skills.scanEmpty"),ok:!1}),null;let{targetMissing:D}=tl(t,F);return t.length===1&&!D?await Ve([t[0].name],S):(R(D?{text:e("skills.installTargetNotFound",{skill:F}),ok:!1}:{text:e("skills.scanFound",{count:t.length}),ok:!0}),le(!0),null)}catch(t){return l.current&&R({text:`${e("skills.failed")}: ${me(t?.message??String(t))}`,ok:!1}),null}}async function Jl(){let t=[...Ke];return t.length===0?(R({text:e("skills.discoverNothingSelected"),ok:!1}),null):await Ve(t)}async function Ql(t){await re("/api/skill-packs",{method:"POST",body:JSON.stringify({id:t.id,name:t.name,include:t.skillNames.map(o=>`skill:${o}`)})}),l.current&&(await h(),l.current&&$("packs"))}async function Xl(){let t=[...qe].filter(Boolean);if(t.length===0){R({text:e("skills.discoverNothingSelected"),ok:!1});return}al(!0);try{if(R({text:e("skills.discoverRegisteringBatch",{total:t.length}),ok:!0}),await re("/api/skills/install-local-links",{method:"POST",body:JSON.stringify({sources:t})}),!l.current)return;Ce(!1),await h(),l.current&&R({text:e("skills.saved"),ok:!0})}catch(o){l.current&&R({text:`${e("skills.failed")}: ${me(o?.message??String(o))}`,ok:!1})}finally{l.current&&al(!1)}}async function Zl(t){if(a!==t){$e("project");try{let o=await re("/api/skills/global",{method:"PUT",body:JSON.stringify({trustProjectSkills:t})});if(!l.current)return;T(o.trustProjectSkills==="all"?"all":t)}catch(o){l.current&&Ie(`${e("skills.failed")}: ${me(o?.message??String(o))}`,{kind:"error"})}finally{l.current&&$e(null)}}}async function Vl(t){if(C!==t){$e("delivery");try{let o=await re("/api/skills/global",{method:"PUT",body:JSON.stringify({delivery:t})});if(!l.current)return;L(o.delivery==="prompt"||o.delivery==="native"?o.delivery:t)}catch(o){l.current&&Ie(`${e("skills.failed")}: ${me(o?.message??String(o))}`,{kind:"error"})}finally{l.current&&$e(null)}}}async function Yl(t){il(`${t}:update`);try{let o=await re(`/api/skills/${encodeURIComponent(t)}/update`,{method:"POST",body:"{}"});if(!l.current)return;await ml(o.job,R)}catch(o){l.current&&Ie(`${e("skills.failed")}: ${me(o?.message??String(o))}`,{kind:"error"})}finally{l.current&&il(null)}}function es(t){let o=[...new Set(t.filter(S=>Fe.has(S)))];o.length!==0&&(Xe(o),Re(!0),Le([]),He(null))}function ls(){Oe.size>0||(Re(!1),Xe(null),Le([]),He(null))}async function ss(t){let o=cl??[];if(o.length!==0){dl(new Set(o)),Re(!1),He(null),Pe({text:e("skills.removingCount",{count:o.length}),ok:!0});try{let S=await re("/api/skills/remove",{method:"POST",body:JSON.stringify({names:o,force:t})});if(!l.current)return;let D=Array.isArray(S.removed)?S.removed.filter(j=>typeof j=="string"):o,z=new Set(D);x(j=>j.filter(ne=>!z.has(ne.name))),Pe({text:D.length===1?e("skills.removedOne",{skill:D[0]}):e("skills.removedMany",{count:D.length}),ok:!0}),Xe(null),Le([])}catch(S){if(!l.current)return;if(S?.status===409&&S?.body?.error==="skills_in_use"){let z=Array.isArray(S.body.affectedSkills)?S.body.affectedSkills.map(j=>{let ne=typeof j?.name=="string"?j.name:"",ie=Array.isArray(j?.affectedBots)?j.affectedBots.map(ae=>ae?.botName||ae?.larkAppId||"").filter(Boolean):Gl(ne),ce=Array.isArray(j?.affectedPacks)?j.affectedPacks.filter(ae=>typeof ae=="string"):[];return ne?{name:ne,bots:ie,packs:ce}:null}).filter(j=>j!==null):[];Le(z),Re(!0),Pe(null);return}let D=e("skills.removeFailed",{detail:me(S?.message??String(S))});He(D),Re(!0),Pe({text:D,ok:!1})}finally{l.current&&dl(new Set)}}}function pl(t,o){let S=je.current.get(t)??Promise.resolve();ol(z=>new Set(z).add(t));let D=S.catch(()=>{}).then(o);return je.current.set(t,D),D.finally(()=>{je.current.get(t)===D&&(je.current.delete(t),l.current&&ol(z=>{let j=new Set(z);return j.delete(t),j}))})}async function fl(t,o,S){Ne(D=>({...D,[t]:null}));try{let D=De.current.find(ie=>ie.larkAppId===t),z=Pl(D?.skills,o,S),j=await re(`/api/bots/${encodeURIComponent(t)}/skills`,{method:"PUT",body:JSON.stringify({action:"set",policy:z.length>0?{include:z}:null})});if(!l.current)return;let ne=ie=>ie.map(ce=>ce.larkAppId===t?{...ce,skills:j.skills??null}:ce);De.current=ne(De.current),E(ne),Ne(ie=>({...ie,[t]:{text:e("skills.policySaved"),ok:!0}}))}catch(D){throw l.current&&Ne(z=>({...z,[t]:{text:`${e("skills.failed")}: ${me(D?.message??String(D))}`,ok:!1}})),D}}function ts(t,o,S){return pl(t,()=>fl(t,o,S))}function ns(t,o,S){return pl(t,async()=>{let D=De.current.find(ae=>ae.larkAppId===t),z=ke(D?.skills),j=be(D?.skills),[ne,ie]=o.split(":",2),ce=ae=>S?[...new Set([...ae,ie])]:ae.filter(ds=>ds!==ie);await fl(t,ne==="skill"?ce(z):z,ne==="pack"?ce(j):j)})}async function as(t,o){Ne(S=>({...S,[t]:null}));try{if(await re(`/api/bots/${encodeURIComponent(t)}/skill-injection`,{method:"PUT",body:JSON.stringify({skillInjection:o})}),!l.current)return;E(S=>S.map(D=>D.larkAppId===t?{...D,skillInjection:o}:D)),Ne(S=>({...S,[t]:{text:e("skills.saved"),ok:!0}}))}catch(S){l.current&&Ne(D=>({...D,[t]:{text:`${e("skills.failed")}: ${S?.message??S}`,ok:!1}}))}}let is=g.filter(t=>Rl(t.skills)).length,os=g.reduce((t,o)=>t+(o.skills?.include?.length??0),0),ge=(0,c.useMemo)(()=>ze(v,w,g,{packsKnown:N}),[v,w,g,N]),pe=(0,c.useMemo)(()=>Dl(ge),[ge]),Ue=(0,c.useMemo)(()=>[...ge.packs.values()].filter(t=>t.botIds.length===0).map(t=>t.id),[ge]),Ge=(0,c.useMemo)(()=>[...ge.bots.values()].filter(t=>t.health==="missing"||t.health==="pack_missing").map(t=>t.larkAppId),[ge]),rs=(0,s.jsxs)("div",{className:"page-heading-actions skills-heading-actions",children:[(0,s.jsxs)("div",{className:"skills-metric-strip",children:[(0,s.jsxs)("span",{children:[(0,s.jsx)("small",{children:e("skills.metricInstalled")}),(0,s.jsx)("strong",{children:v.length})]}),(0,s.jsxs)("span",{children:[(0,s.jsx)("small",{children:e("skills.metricPacks")}),(0,s.jsx)("strong",{children:N?w.length:"\u2014"})]}),(0,s.jsxs)("span",{children:[(0,s.jsx)("small",{children:e("skills.metricBots")}),(0,s.jsxs)("strong",{children:[is,"/",g.length]})]}),(0,s.jsxs)("span",{children:[(0,s.jsx)("small",{children:e("skills.metricAttached")}),(0,s.jsx)("strong",{children:os})]})]}),(0,s.jsxs)("div",{className:"skills-issue-strip",role:"group","aria-label":e("skills.issuesLabel"),children:[pe.length>0&&(0,s.jsx)("button",{type:"button",className:"skills-issue-badge skills-issue-warn","data-action":"issue-dangling-skills",title:pe.join(", "),onClick:()=>f(pe.length===1?{tab:"library",librarySearch:pe[0],openInstallWizard:!0,installTargetSkill:pe[0]}:{tab:"library",libraryFilterSkills:pe}),children:e("skills.issueDangling",{count:pe.length})}),Ue.length>0&&(0,s.jsx)("button",{type:"button",className:"skills-issue-badge skills-issue-info","data-action":"issue-unassigned-packs",onClick:()=>f({tab:"packs",focusPackIds:Ue}),children:e("skills.issueUnassignedPacks",{count:Ue.length})}),Ge.length>0&&(0,s.jsx)("button",{type:"button",className:"skills-issue-badge skills-issue-warn","data-action":"issue-bots-missing",onClick:()=>f({tab:"bots",focusBotIds:Ge}),children:e("skills.issueBotsMissing",{count:Ge.length})}),!B&&N&&pe.length===0&&Ue.length===0&&Ge.length===0&&(0,s.jsx)("span",{className:"skills-issue-badge skills-issue-ok","data-skills-healthy":!0,children:e("skills.issueNone")})]}),(0,s.jsx)(hl,{id:"skills-refresh",label:e("skills.refresh"),busy:B,disabled:B,onClick:()=>{h()}})]}),cs=(0,s.jsx)("div",{className:"skills-page-stack",children:B?(0,s.jsx)(bl,{label:e("common.loading")}):b?(0,s.jsx)("p",{className:"hint-warn",children:b}):(0,s.jsxs)(s.Fragment,{children:[P&&(0,s.jsx)("p",{className:"hint-warn","data-packs-error":!0,role:"alert",children:e(N?"skills.packsLoadError":"skills.packsLoadErrorFirst",{error:P})}),(0,s.jsxs)("div",{className:"skills-tabs",role:"tablist",children:[(0,s.jsx)("button",{role:"tab","aria-selected":A==="library",className:A==="library"?"active":"",onClick:()=>$("library"),children:e("skills.tabLibrary")}),(0,s.jsx)("button",{role:"tab","aria-selected":A==="packs",className:A==="packs"?"active":"",onClick:()=>$("packs"),children:e("skills.tabPacks")}),(0,s.jsx)("button",{role:"tab","aria-selected":A==="bots",className:A==="bots"?"active":"",onClick:()=>$("bots"),children:e("skills.tabBots")}),(0,s.jsx)("button",{role:"tab","aria-selected":A==="delivery",className:A==="delivery"?"active":"",onClick:()=>$("delivery"),children:e("skills.tabDelivery")})]}),A==="packs"&&(0,s.jsx)(Sl,{skills:v,packs:w,packsKnown:N,onRefresh:()=>{h()},focusPackId:H?.tab==="packs"?H.focusPackId??null:null,focusPackIds:H?.tab==="packs"?H.focusPackIds??null:null,onFocusConsumed:I,onOpenBot:t=>f({tab:"bots",focusBotIds:[t]}),onInstallMissingSkill:t=>f({tab:"library",librarySearch:t,openInstallWizard:!0,installTargetSkill:t})}),A==="library"&&(0,s.jsx)(Cl,{skills:v,nativeSkillGroups:p,installSource:d,installPath:G,installRef:r,installFullDepth:Y,installStatus:M,installBusy:_,installDiscovering:he,installSelectionOpen:ye,installCandidates:se,selectedInstallSkills:Ke,onInstallSourceChange:t=>{U(t),Ae()},onInstallPathChange:t=>{te(t),Ae()},onInstallRefChange:t=>{i(t),Ae()},onInstallFullDepthChange:t=>{we(t),Ae()},onToggleInstallSkill:_l,onSelectAllInstallSkills:Wl,onConfirmInstallSelection:Jl,onCloseInstallSelection:()=>le(!1),onInstall:ql,onOpenNativeDiscovery:()=>Ce(!0),onCreatePack:Ql,InstallPanel:Ns,InstalledLibrary:Is,RemoveDialog:ws,removingNames:Oe,removalDialogOpen:Ol,pendingRemoval:cl,removalReferences:jl,removalError:Fl,skillBusy:Ll,installedStatus:Qe,onUpdateSkill:t=>{Yl(t)},onRequestRemove:es,onCancelRemoval:ls,onConfirmRemoval:t=>{ss(t)},navIntent:H?.tab==="library"?H:null,onNavIntentConsumed:I,installTargetSkill:F,onClearInstallTarget:()=>y(null),packsKnown:N,onInstallMissing:t=>f({tab:"library",openInstallWizard:!0,installTargetSkill:t}),graph:ge,packNames:w.map(t=>({id:t.id,name:t.name})),onShowSkillPacks:t=>{let o=ge.skills.get(t)?.packIds??[];f(o.length===1?{tab:"packs",focusPackId:o[0]}:{tab:"packs",focusPackIds:o})},onShowSkillBots:t=>f({tab:"bots",focusSkill:t}),onAssignInstalledSkill:t=>f({tab:"bots",focusSkill:t})}),A==="bots"&&(0,s.jsx)(Tl,{bots:g,skills:v,statuses:rl,onSave:ts,onMutate:ns,busyBotIds:Hl,packs:w,packsKnown:N,focusBotIds:H?.tab==="bots"?H.focusBotIds??null:null,focusSkill:H?.tab==="bots"?H.focusSkill??null:null,onFocusConsumed:I,onOpenPack:t=>f({tab:"packs",focusPackId:t}),onOpenSkill:t=>f({tab:"library",librarySearch:t})}),A==="delivery"&&(0,s.jsx)(Al,{trustProjectSkills:a,delivery:C,globalBusy:$l,onUpdateProject:t=>{Zl(t)},onUpdateDelivery:t=>{Vl(t)},bots:g,onUpdateBotInjection:as,botStatuses:rl,SkillSegmented:Ss}),(0,s.jsx)("dialog",{className:"skills-discovery-dialog",id:"skills-discovery-dialog",ref:m,onClose:()=>Ce(!1),onClick:t=>{t.target===t.currentTarget&&Ce(!1)},children:(0,s.jsxs)("article",{children:[(0,s.jsxs)("header",{children:[(0,s.jsx)("h3",{children:e("skills.discoverTitle")}),(0,s.jsx)("p",{children:e("skills.discoverHelp")}),(0,s.jsx)("button",{type:"button",className:"skills-discovery-close","data-action":"close-discovery","aria-label":e("skills.discoverClose"),title:e("skills.discoverClose"),onClick:()=>Ce(!1)})]}),(0,s.jsx)("div",{className:"skills-discovery-body",children:ve?(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("div",{className:"skills-discovery-layout",children:[(0,s.jsx)("div",{className:"skills-discovery-tabs",role:"tablist","aria-label":e("skills.discoverTitle"),children:p.map(t=>{let o=xe(t),S=o===Ze;return(0,s.jsxs)("button",{type:"button",role:"tab","data-discovery-tab":o,className:S?"selected":"","aria-selected":S?"true":"false",onClick:()=>El(o),children:[(0,s.jsx)("strong",{children:t.label??t.cliId}),(0,s.jsx)("small",{children:e("skills.skillCount",{count:t.skills.length})})]},o)})}),(0,s.jsxs)("div",{className:"skills-discovery-main",children:[(0,s.jsx)("div",{className:"skills-discovery-path",children:(0,s.jsx)("code",{children:ve.rootDir})}),p.map(t=>{let o=xe(t);return(0,s.jsx)("section",{className:"skills-discovery-group","data-discovery-panel":o,hidden:!(o===Ze),children:t.skills.length===0?(0,s.jsx)("p",{className:"empty",children:e("skills.discoverGroupEmpty")}):(0,s.jsx)("div",{className:"skills-discovery-list",children:t.skills.map(D=>{let z=Fe.has(D.name),j=D.rootDir??D.source?.root??"";return(0,s.jsxs)("label",{className:`skills-discovery-row${z?" installed":""}`,children:[(0,s.jsx)("input",{type:"checkbox","data-discovered-skill":!0,value:j,disabled:z,checked:!z&&qe.has(j),onChange:ne=>{let ie=ne.currentTarget.checked;Je(ce=>{let ae=new Set(ce);return ie?ae.add(j):ae.delete(j),ae})}}),(0,s.jsxs)("span",{children:[(0,s.jsx)("strong",{children:D.name}),D.description?(0,s.jsx)("small",{children:D.description}):null]}),z?(0,s.jsx)("em",{children:e("skills.discoverRegistered")}):null]},`${D.name}:${j}`)})})},o)})]})]})}):(0,s.jsx)("p",{className:"empty",children:e("skills.discoverEmpty")})}),(0,s.jsxs)("footer",{className:"actions",children:[(0,s.jsx)("button",{type:"button","data-action":"toggle-discovered-skills",disabled:Te.length===0,onClick:()=>{Je(t=>{let o=new Set(t);return ul?Te.forEach(S=>o.delete(S)):Te.forEach(S=>o.add(S)),o})},children:e(ul?"skills.discoverClearSelection":"skills.discoverSelectAll")}),(0,s.jsx)("button",{type:"button",className:"primary","data-action":"register-discovered-skills",disabled:Ml,onClick:()=>{Xl()},children:e("skills.discoverRegister")})]})]})})]})});return(0,s.jsxs)("section",{className:"page skills-page",children:[(0,s.jsxs)("div",{className:"page-heading",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"eyebrow",children:e("nav.skills")}),(0,s.jsx)("h1",{children:e("skills.title")})]}),rs]}),(0,s.jsx)("div",{id:"skills-body",children:cs})]})}function Ps(e,l){return e.size===l.length&&l.every(n=>e.has(n))}function Rs(e){let l=X(),n=(0,c.useRef)(null),m=(0,c.useRef)(null),v=(0,c.useRef)(null),[p,g]=(0,c.useState)(!1),[w,a]=(0,c.useState)(""),[C,B]=(0,c.useState)(()=>new Set(e.names)),[b,P]=(0,c.useState)(null),N=e.names.join(`
4
+ `),h=w.trim().toLocaleLowerCase(),x=(0,c.useMemo)(()=>{let f=new Map(e.skills.map(I=>[I.name,I]));for(let I of e.names)f.has(I)||f.set(I,{name:I});return[...f.values()].sort((I,d)=>I.name.localeCompare(d.name))},[e.names,e.skills]),E=(0,c.useMemo)(()=>h?x.filter(f=>`${f.name} ${f.description||""}`.toLocaleLowerCase().includes(h)):x,[h,x]),T=!Ps(C,e.names),L=(0,c.useCallback)(()=>{let f=m.current;if(!f||typeof window>"u")return;let I=f.getBoundingClientRect(),d=12,U=7,G=Math.min(370,Math.max(260,window.innerWidth-d*2)),te=Math.min(Math.max(d,I.left),Math.max(d,window.innerWidth-G-d)),r=Math.max(0,I.top-U-d),i=Math.max(0,window.innerHeight-I.bottom-U-d),M=r>i,R=M?r:i,_=118+Math.min(x.length,5)*42,V=Math.max(180,Math.min(_,R));P({left:te,top:M?Math.max(d,I.top-U-V):I.bottom+U,width:G,height:V})},[x.length]);(0,c.useEffect)(()=>{p||B(new Set(e.names))},[N,p]),(0,c.useEffect)(()=>{if(!p||typeof document>"u")return;let f=I=>{n.current?.contains(I.target)||v.current?.contains(I.target)||(g(!1),a(""),B(new Set(e.names)))};return document.addEventListener("pointerdown",f),window.addEventListener("resize",L),window.addEventListener("scroll",L,!0),L(),()=>{document.removeEventListener("pointerdown",f),window.removeEventListener("resize",L),window.removeEventListener("scroll",L,!0)}},[N,p,L]);function A(){B(new Set(e.names)),a(""),L(),g(!0)}function $(){B(new Set(e.names)),a(""),g(!1)}function H(f){B(I=>{let d=new Set(I);return d.has(f)?d.delete(f):d.add(f),d})}async function K(){let f=[...C].sort((I,d)=>I.localeCompare(d));try{await e.onSave(f),a(""),g(!1)}catch{}}let F=e.names.length===0?l("skills.pickerPlaceholder"):e.names.length===1?e.names[0]:l("skills.pickerSelectedCount",{count:e.names.length}),y=p?(0,s.jsxs)("div",{ref:v,className:"skills-multi-picker-popover",style:b?{left:b.left,top:b.top,width:b.width,height:b.height}:void 0,children:[(0,s.jsxs)("div",{className:"skills-multi-picker-head",children:[(0,s.jsxs)("label",{className:"skills-multi-picker-search",children:[(0,s.jsx)("span",{className:"skills-multi-picker-search-icon","aria-hidden":"true"}),(0,s.jsx)("input",{type:"search","data-action":"search-skills",autoFocus:!0,autoComplete:"off",value:w,placeholder:l("skills.pickerSearchPlaceholder"),onChange:f=>a(f.currentTarget.value),onKeyDown:f=>{f.key==="Escape"&&(f.preventDefault(),$())}})]}),(0,s.jsxs)("div",{className:"skills-multi-picker-meta",children:[(0,s.jsx)("span",{children:l("skills.pickerSelectionMeta",{selected:C.size,total:x.length})}),C.size>0?(0,s.jsx)("button",{type:"button",className:"skills-multi-picker-clear","data-action":"clear-skill-selection",onClick:()=>B(new Set),children:l("skills.pickerClear")}):null]})]}),(0,s.jsxs)("div",{className:"skills-multi-picker-options",role:"listbox","aria-label":l("skills.priority"),"aria-multiselectable":"true",children:[E.map(f=>{let I=C.has(f.name),d=!e.installedNames.has(f.name);return(0,s.jsxs)("button",{type:"button",className:`skills-multi-picker-option${I?" selected":""}${d?" dangling":""}`,role:"option","aria-selected":I,"data-skill-name":f.name,onClick:()=>H(f.name),children:[(0,s.jsx)("span",{className:"skills-multi-picker-check","aria-hidden":"true"}),(0,s.jsxs)("span",{className:"skills-multi-picker-option-copy",children:[(0,s.jsxs)("span",{children:[(0,s.jsx)("b",{children:f.name}),d?(0,s.jsx)("em",{children:l("skills.dangling")}):null]}),f.description?(0,s.jsx)("small",{children:f.description}):null]})]},f.name)}),E.length===0?(0,s.jsx)("p",{className:"skills-multi-picker-empty",children:l("skills.pickerNoResults")}):null]}),(0,s.jsxs)("footer",{className:"skills-multi-picker-actions",children:[(0,s.jsx)("button",{type:"button",className:"ghost","data-action":"cancel-skill-selection",disabled:e.busy,onClick:$,children:l("skills.cancel")}),(0,s.jsx)("button",{type:"button",className:"primary","data-action":"save-skill-selection",disabled:!T||e.busy,onClick:()=>{K()},children:e.busy?l("skills.saving"):l("skills.saveSelection")})]})]}):null;return(0,s.jsxs)("div",{ref:n,className:`skills-multi-picker${p?" open":""}`,"data-skill-picker":e.botId,children:[(0,s.jsxs)("button",{ref:m,type:"button",className:"skills-multi-picker-trigger","data-action":"open-skill-picker","aria-haspopup":"listbox","aria-expanded":p,disabled:e.busy,onClick:()=>p?$():A(),children:[(0,s.jsxs)("span",{className:"skills-multi-picker-trigger-copy",children:[(0,s.jsx)("b",{children:F}),(0,s.jsx)("small",{children:l("skills.pickerTriggerHint")})]}),(0,s.jsx)("span",{className:"skills-multi-picker-chevron","aria-hidden":"true"})]}),y&&typeof document<"u"?(0,xl.createPortal)(y,document.body):y]})}function st(e){let l=X(),{bot:n,installedNames:m,skills:v,status:p,busyKey:g,onSave:w}=e,a=n.botName??n.larkAppId,C=ke(n.skills);return n.error?(0,s.jsxs)("article",{className:"bd-card skills-bot-card","data-appid":n.larkAppId,children:[(0,s.jsxs)("header",{children:[(0,s.jsx)(el,{html:Ye({name:a,larkAppId:n.larkAppId,size:"sm"})}),(0,s.jsx)("strong",{children:a})]}),(0,s.jsx)("p",{className:"hint-warn-inline",children:n.error})]}):(0,s.jsxs)("article",{className:"bd-card skills-bot-card","data-appid":n.larkAppId,children:[(0,s.jsxs)("header",{className:"skills-bot-head",children:[(0,s.jsx)(el,{html:Ye({name:a,larkAppId:n.larkAppId,size:"sm",dot:"ok"})}),(0,s.jsxs)("div",{className:"skills-bot-title-line",children:[(0,s.jsx)("strong",{children:a}),(0,s.jsx)("span",{className:"skills-count-pill",children:l("skills.skillCount",{count:C.length})})]})]}),(0,s.jsxs)("section",{className:"skills-policy-panel",children:[(0,s.jsx)("div",{className:"skills-priority-head",children:(0,s.jsx)("h3",{className:"skills-priority-title",children:l("skills.priority")})}),(0,s.jsx)(Rs,{botId:n.larkAppId,names:C,installedNames:m,skills:v,busy:g===`${n.larkAppId}:set`,onSave:B=>w(n.larkAppId,B)})]}),(0,s.jsx)("span",{className:nl(p),"data-bot-status":!0,children:p?.text??""})]})}function tt(e){return vl(e,(0,s.jsx)(Cs,{}))}export{st as BotPolicyCard,Is as InstalledSkillsLibrary,ws as RemoveSkillsDialog,Rs as SkillMultiPicker,Ss as SkillSegmented,Ns as SkillsInstallPanel,Cs as SkillsPage,tt as renderSkillsPage};
@@ -0,0 +1 @@
1
+ import{a as E,b as V,c as S,d as W}from"./chunk-EVK77ASG.js";import{a as J}from"./chunk-OT6L6G7R.js";import{a as ie,d as q,g as re,q as le}from"./chunk-5QX4OYOR.js";import{d as F}from"./chunk-RHVFZC5Z.js";import"./chunk-QITAMHW6.js";import"./chunk-CK22743G.js";import{c as K}from"./chunk-XVIXNQGC.js";import{c as L,d as z,e as se}from"./chunk-CVNIMUPY.js";var l=L(z(),1);async function Q(){return E("/api/team/hosted")}async function de(){return E("/api/team/remote-roster")}async function me(t,a){return W("/api/team/local-bots/"+encodeURIComponent(t)+"/capability",{capability:a})}async function ce(t){return E("/api/team/local-bots/"+encodeURIComponent(t)+"/role")}async function ue(t){return S("/api/team/identity/auto-bind",t?{unionId:t}:void 0)}async function pe(t,a){return V("DELETE",`/api/team/hosted/${encodeURIComponent(t)}/members/${encodeURIComponent(a)}`)}async function ge(t,a,n){return S("/api/team/federated-group",{name:a,larkAppIds:n,teamId:t})}async function ye(t,a,n,o){return S("/api/team/remote-group",{hubUrl:t,teamId:a,name:n,larkAppIds:o})}async function be(t){return S("/api/team/hosted",{name:t})}async function fe(t){return V("DELETE","/api/team/hosted/"+encodeURIComponent(t))}async function ke(t,a){return W(`/api/team/hosted/${encodeURIComponent(t)}/feedback`,{feedback:a})}async function he(t){return S("/api/team/local-invite",{teamId:t})}async function ve(t,a){return S("/api/team/join-remote",{hubUrl:t,inviteCode:a})}function G(t,a){let n=a.query.trim().toLowerCase();return!(n&&!((t.name||"")+" "+(t.cliId||"")+" "+(t.capability||"")).toLowerCase().includes(n)||a.cliId&&t.cliId!==a.cliId||a.hasCapability&&!t.capability||a.hasRole&&!t.hasTeamRole)}function Te(t){return Array.from(new Set(t.flatMap(a=>a.bots.map(n=>n.cliId)).filter(Boolean))).sort()}function Ne(t,a){return(t.teams||[]).map(n=>({kind:"local",key:`local:${n.teamId}`,teamId:n.teamId,label:n.isDefault?a("team.myHostedTeam"):n.name,sub:"",ok:!0,deployments:n.deployments||[],bots:n.bots||[]}))}function Re(t,a){return(t.memberships||[]).map(o=>{let d=o.roster?.deployments||[],r=d.find(T=>T.local),p=r?.name?a("team.remoteTeamLabel",{name:r.name}):o.teamName||o.teamId;return{kind:"remote",key:`${o.hubUrl}::${o.teamId}`,teamId:o.teamId,label:p,sub:o.hubUrl,ok:!!o.ok,error:o.error,hubUrl:o.hubUrl,deployments:d,bots:o.roster?.bots||[]}})}function X(t,a,n){return t.map(o=>({...o,bots:o.bots.map(d=>d.larkAppId===a?{...d,capability:n.trim()||null}:d)}))}var e=L(se(),1),xe=L(z(),1);function Ce(){let t=(0,l.useRef)(!0);return(0,l.useEffect)(()=>(t.current=!0,()=>{t.current=!1}),[]),t}function Se(t){let a=F(),n=t.active==="home",o=t.active==="manage";return(0,e.jsxs)("nav",{className:"team-subnav insight-tabs",role:"tablist","aria-label":a("team.eyebrow"),children:[(0,e.jsx)("a",{href:"#/team",className:`itab${n?" on":""}`,role:"tab","aria-selected":n,children:a("team.navHome")}),(0,e.jsx)("a",{href:"#/team/manage",className:`itab${o?" on":""}`,role:"tab","aria-selected":o,children:a("team.navManage")})]})}function Y(t,a){return t.get(a)??new Set}function Oe(){let t=F(),a=Ce(),[n,o]=(0,l.useState)([]),[d,r]=(0,l.useState)([]),[p,T]=(0,l.useState)(""),[k,y]=(0,l.useState)(t("team.unbound")),[u,R]=(0,l.useState)({query:"",cliId:"",hasCapability:!1,hasRole:!1}),[B,x]=(0,l.useState)(()=>new Map),[D,M]=(0,l.useState)(()=>new Map),[O,I]=(0,l.useState)(()=>new Set),[P,H]=(0,l.useState)(()=>new Set),[U,w]=(0,l.useState)({kind:"hidden"}),[j,c]=(0,l.useState)(()=>new Map),[g,N]=(0,l.useState)(null),b=(0,l.useMemo)(()=>[...n,...d],[n,d]),ee=(0,l.useMemo)(()=>Te(b),[b]),te=(0,l.useMemo)(()=>[{value:"",label:t("team.allCli")},...ee.map(s=>({value:s,label:s}))],[ee,t]),A=(0,l.useCallback)(async()=>{let s=await Q();if(!a.current)return;let i=s.body;if(!i?.ok){o([]);return}T(i.deployment?.deploymentId??""),y(i.deployment?.ownerName||(i.deployment?.ownerUnionId?t("team.bound"):t("team.unbound"))),o(Ne(i,t))},[a,t]),ae=(0,l.useCallback)(async()=>{let s=await de();a.current&&r(Re(s.body,t))},[a,t]);(0,l.useEffect)(()=>{x(new Map),M(new Map),I(new Set),H(new Set),A(),ae()},[A,ae]),(0,l.useEffect)(()=>{y(s=>s==="\u672A\u7ED1\u5B9A"||s==="Unbound"?t("team.unbound"):s)},[t]),(0,l.useEffect)(()=>{let s=new Map;for(let i of b)s.set(i.key,new Set(i.bots.filter(m=>G(m,u)).map(m=>m.larkAppId)));x(i=>{let m=!1,f=new Map;for(let[h,v]of i){let C=s.get(h),_=new Set([...v].filter(Le=>C?.has(Le)));_.size!==v.size&&(m=!0),_.size&&f.set(h,_)}return m?f:i})},[u,b]);let ne=(0,l.useMemo)(()=>{if(!b.length)return"";let s=new Set,i=new Set;for(let h of b)h.bots.filter(C=>G(C,u)).forEach(C=>s.add(C.larkAppId)),h.bots.forEach(C=>i.add(C.larkAppId));let m=b.length>1?t("team.acrossTeams",{n:b.length}):"";return`\xB7 ${s.size===i.size?`${i.size}`:`${s.size} / ${i.size}`} ${t("team.botsWord")}${m}`},[u,b,t]);function $(s,i){c(m=>{let f=new Map(m);return f.set(s,i),f})}function Me(s,i,m){x(f=>{let h=new Map(f),v=new Set(h.get(s)??[]);return m?v.add(i):v.delete(i),v.size?h.set(s,v):h.delete(s),h})}function Pe(s,i){M(m=>{let f=new Map(m);return i?f.set(s,i):f.delete(s),f})}async function Be(s,i){await me(s,i),a.current&&(o(m=>X(m,s,i)),r(m=>X(m,s,i)))}async function De(s,i){let m=await ce(s);a.current&&N({app:s,name:i,content:m.body?.role||""})}async function He(s,i,m){await J({title:"\u79FB\u9664\u6210\u5458",message:t("team.removeMemberConfirm",{name:m}),danger:!0})&&(await pe(s,i),a.current&&A())}async function Ae(s){let i=[...Y(B,s.key)];if(!i.length){$(s.key,{kind:"err",key:"team.errPickBot"});return}let m=(D.get(s.key)||"").trim()||t("team.defaultGroupName");$(s.key,{kind:"muted",key:"team.creatingGroup"});let f=s.kind==="local"?await ge(s.teamId,m,i):await ye(s.hubUrl,s.teamId,m,i);a.current&&($(s.key,{kind:"group-result",body:f.body,status:f.status}),f.body?.ok&&(x(h=>{let v=new Map(h);return v.delete(s.key),v}),M(h=>{let v=new Map(h);return v.delete(s.key),v}),s.kind==="local"&&A()))}async function oe(s){w({kind:"loading",key:s?"team.binding":"team.identifying"});let i=await ue(s);if(!a.current)return;let m=i.body;if(m?.ok&&m.owner){w({kind:"ok",name:m.owner.name||m.owner.unionId||""}),A();return}if(m?.ok&&m.needChoice&&Array.isArray(m.candidates)){w({kind:"choice",candidates:m.candidates});return}if(m?.error==="no_candidates"){w({kind:"err",key:"team.noCandidates"});return}w({kind:"bind-fail",error:String(m?.error||"unknown")})}return(0,e.jsxs)("section",{className:"page team-page team-home-page",children:[(0,e.jsxs)("div",{className:"page-heading",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:"eyebrow",children:t("team.eyebrow")}),(0,e.jsx)("h1",{children:t("team.homeTitle")})]}),(0,e.jsx)("div",{className:"page-heading-actions",children:(0,e.jsx)(Se,{active:"home"})})]}),(0,e.jsxs)("section",{className:"overview-block team-identity-section",children:[(0,e.jsx)(q,{title:t("team.localDeployTitle"),hint:t("team.bindHint")}),(0,e.jsx)("div",{className:"card team-card team-identity-card",children:(0,e.jsxs)("p",{className:"team-identity-row",children:[(0,e.jsx)("span",{className:"team-identity-label",children:t("team.myIdentity")}),(0,e.jsx)("b",{id:"tf-owner",children:k}),(0,e.jsx)("button",{type:"button",id:"tf-autobind",className:"page-primary-action",onClick:()=>{oe()},children:t("team.bindBtn")}),(0,e.jsx)("span",{id:"tf-bind-out",className:"team-bind-status",hidden:U.kind==="hidden",children:(0,e.jsx)(Ue,{state:U,tr:t,onPick:s=>{oe(s)}})})]})})]}),(0,e.jsxs)("section",{className:"overview-block team-roster-section",children:[(0,e.jsx)(q,{title:t("team.myTeams"),count:ne?ne.replace(/^·\s*/,""):void 0,hint:t("team.teamsHint")}),(0,e.jsxs)("div",{className:"card team-card team-roster-card",children:[(0,e.jsxs)("form",{className:"team-filters dashboard-toolbar",onSubmit:s=>s.preventDefault(),children:[(0,e.jsx)("input",{id:"tf-search",type:"search",placeholder:t("team.searchPh"),value:u.query,onChange:s=>R(i=>({...i,query:s.target.value}))}),(0,e.jsx)(le,{id:"tf-cli",className:"team-cli-menu",ariaLabel:t("team.allCli"),value:u.cliId,label:ie(te,u.cliId),options:te,onChange:s=>R(i=>({...i,cliId:s}))}),(0,e.jsxs)("label",{className:"filter-toggle",children:[(0,e.jsx)("input",{type:"checkbox",id:"tf-fcap",checked:u.hasCapability,onChange:s=>R(i=>({...i,hasCapability:s.target.checked}))}),(0,e.jsx)("span",{className:"filter-toggle-switch","aria-hidden":"true"}),(0,e.jsx)("span",{className:"filter-toggle-label",children:t("team.hasCap")})]}),(0,e.jsxs)("label",{className:"filter-toggle",children:[(0,e.jsx)("input",{type:"checkbox",id:"tf-frole",checked:u.hasRole,onChange:s=>R(i=>({...i,hasRole:s.target.checked}))}),(0,e.jsx)("span",{className:"filter-toggle-switch","aria-hidden":"true"}),(0,e.jsx)("span",{className:"filter-toggle-label",children:t("team.hasRole")})]})]}),(0,e.jsx)("div",{id:"tf-teams",children:(0,e.jsx)(je,{teams:b,filters:u,pickedByTeam:B,gnameByTeam:D,expandedTeams:O,expandedDeps:P,groupOutputs:j,myDeploymentId:p,tr:t,onToggleTeam:s=>I(i=>Ie(i,s)),onToggleDep:s=>H(i=>Ie(i,s)),onPick:Me,onGroupNameChange:Pe,onCapabilityChange:(s,i)=>{Be(s,i)},onOpenRole:(s,i)=>{De(s,i)},onRemoveMember:(s,i,m)=>{He(s,i,m)},onPullGroup:s=>{Ae(s)}})})]})]}),(0,e.jsx)(ze,{state:g,tr:t,onClose:()=>N(null)})]})}function Ie(t,a){let n=new Set(t);return n.has(a)?n.delete(a):n.add(a),n}function Ue(t){let{state:a,tr:n}=t;return a.kind==="hidden"?null:a.kind==="loading"?(0,e.jsx)("span",{className:"team-bind-loading",children:n(a.key)}):a.kind==="ok"?(0,e.jsx)("span",{className:"ok",children:n("team.bound2",{name:a.name})}):a.kind==="choice"?(0,e.jsxs)(e.Fragment,{children:[n("team.multiCandidate"),(0,e.jsx)("br",{}),a.candidates.map(o=>(0,e.jsx)("button",{type:"button",className:"tf-pickowner ghost","data-union":o.unionId,style:{margin:"2px"},onClick:()=>t.onPick(o.unionId),children:o.name||o.unionId},o.unionId))]}):a.kind==="err"?(0,e.jsx)("span",{className:"err",children:n(a.key)}):(0,e.jsx)("span",{className:"err",children:n("team.bindFail",{error:a.error})})}function je(t){let{tr:a}=t;return t.teams.length?(0,e.jsx)(e.Fragment,{children:t.teams.map(n=>{let o=n.bots.filter(p=>G(p,t.filters)),d=!t.expandedTeams.has(n.key),r=n.kind==="remote"?n.ok?(0,e.jsx)("span",{className:"team-status-pill ok",children:a("team.connected")}):(0,e.jsx)("span",{className:"team-status-pill err",children:a("team.connectFail",{error:n.error||""})}):(0,e.jsx)("span",{className:"team-status-pill muted",children:a("team.iHost")});return(0,e.jsxs)("article",{className:"card team-list-card",children:[(0,e.jsxs)("button",{type:"button",className:"tf-team-h","data-tk":n.key,"aria-expanded":!d,onClick:()=>t.onToggleTeam(n.key),children:[(0,e.jsx)("span",{className:"team-chevron","aria-hidden":"true",children:d?"\u203A":"\u2304"}),(0,e.jsx)("b",{children:n.label}),n.sub?(0,e.jsx)("span",{className:"muted",children:n.sub}):null,r,(0,e.jsx)("span",{className:"team-meta-pill",children:a("team.teamMeta",{deps:n.deployments.length,bots:n.bots.length})})]}),d?null:n.kind==="remote"&&!n.ok?(0,e.jsx)("p",{className:"muted",style:{margin:"8px 0 0"},children:a("team.rosterFail")}):(0,e.jsx)(Fe,{...t,team:n,filtered:o})]},n.key)})}):(0,e.jsx)("p",{className:"muted",children:a("team.noTeams")})}function Fe(t){let{team:a,tr:n}=t,o=[...a.deployments].sort((r,p)=>r.local===p.local?0:r.local?-1:1),d=o.some(r=>t.filtered.some(p=>p.deployment.id===r.id));return(0,e.jsxs)(e.Fragment,{children:[o.map(r=>(0,xe.createElement)(Ee,{...t,deployment:r,key:r.id})),d?null:(0,e.jsx)("p",{className:"muted",style:{margin:"8px 0 0"},children:n("team.noMatch")}),(0,e.jsxs)("div",{className:"team-pull-row",children:[(0,e.jsxs)("label",{className:"team-pill-field team-group-name-field",children:[(0,e.jsx)("span",{children:n("team.gnameLabel")}),(0,e.jsx)("input",{className:"tf-gname","data-tk":a.key,value:t.gnameByTeam.get(a.key)||"",placeholder:n("team.gnamePlaceholder"),onChange:r=>t.onGroupNameChange(a.key,r.target.value)})]}),(0,e.jsx)("button",{className:"tf-grp page-primary-action","data-tk":a.key,onClick:()=>t.onPullGroup(a),children:n("team.pullGroupBtn")}),(0,e.jsx)("span",{className:"muted team-pull-hint",children:n("team.pullGroupHint")}),(0,e.jsx)("span",{className:"tf-gout","data-tk":a.key,children:(0,e.jsx)($e,{output:t.groupOutputs.get(a.key),tr:n})})]})]})}function Ee(t){let{team:a,deployment:n,tr:o}=t,d=t.filtered.filter(u=>u.deployment.id===n.id);if(!d.length)return null;let r=n.id===t.myDeploymentId,p=r?o("team.tagLocal"):n.stale?o("team.tagRemoteStale"):o("team.tagRemote"),T=`${a.key}::${n.id}`,k=t.expandedDeps.has(T),y=d.filter(u=>Y(t.pickedByTeam,a.key).has(u.larkAppId)).length;return(0,e.jsxs)("section",{className:"team-deployment-block",children:[(0,e.jsxs)("div",{className:"tf-dep-h","data-dk":T,"aria-expanded":k,role:"button",tabIndex:0,onClick:()=>t.onToggleDep(T),onKeyDown:u=>{u.key!=="Enter"&&u.key!==" "||(u.preventDefault(),t.onToggleDep(T))},children:[(0,e.jsx)("span",{className:"team-chevron","aria-hidden":"true",children:k?"\u2304":"\u203A"}),(0,e.jsx)("b",{children:n.name}),(0,e.jsxs)("span",{className:"muted",children:[o("team.depTag",{tag:p})," \xB7 ",o("team.depCount",{count:d.length}),y?o("team.depSelected",{n:y}):""]}),a.kind==="local"&&!r?(0,e.jsx)("button",{type:"button",className:"tf-rmmember ghost","data-team":a.teamId,"data-dep":n.id,"data-name":n.name,onClick:u=>{u.stopPropagation(),t.onRemoveMember(a.teamId,n.id,n.name)},children:o("team.removeMember")}):null]}),k?(0,e.jsx)("div",{className:"team-roster-list",children:d.map(u=>(0,e.jsx)(Ge,{bot:u,mine:r,picked:Y(t.pickedByTeam,a.key).has(u.larkAppId),teamKey:a.key,tr:o,onPick:t.onPick,onCapabilityChange:t.onCapabilityChange,onOpenRole:t.onOpenRole},u.larkAppId))}):null]})}function Ge(t){let{bot:a,tr:n}=t,o=a.deployment.stale?{opacity:.55}:void 0,d=()=>t.onPick(t.teamKey,a.larkAppId,!t.picked);return(0,e.jsxs)("article",{className:`team-bot-row${t.picked?" selected":""}`,style:o,role:"checkbox","aria-checked":t.picked,tabIndex:0,onClick:r=>{we(r.target)||d()},onKeyDown:r=>{r.key!=="Enter"&&r.key!==" "||we(r.target)||(r.preventDefault(),d())},children:[(0,e.jsxs)("label",{className:`team-check-pill${t.picked?" selected":""}`,onClick:r=>r.stopPropagation(),children:[(0,e.jsx)("input",{type:"checkbox",className:"tf-pick","data-tk":t.teamKey,"data-app":a.larkAppId,checked:t.picked,onChange:r=>t.onPick(t.teamKey,a.larkAppId,r.target.checked)}),(0,e.jsx)("span",{className:"team-check-dot","aria-hidden":"true"})]}),(0,e.jsxs)("div",{className:"team-bot-main",children:[(0,e.jsx)("strong",{children:a.name}),(0,e.jsx)("span",{children:a.larkAppId})]}),(0,e.jsx)("span",{className:"team-meta-pill",children:a.cliId}),(0,e.jsx)("div",{className:"team-capability-cell",children:t.mine?(0,e.jsxs)("label",{className:"team-pill-field team-cap-field",children:[(0,e.jsx)("span",{children:n("team.capLabel")}),(0,e.jsx)("input",{className:"tf-cap","data-app":a.larkAppId,defaultValue:a.capability||"",placeholder:n("team.capPh"),onBlur:r=>{let p=r.target.value;p!==(a.capability||"")&&t.onCapabilityChange(a.larkAppId,p)},onKeyDown:r=>{r.key==="Enter"&&(r.preventDefault(),r.currentTarget.blur())}})]}):a.capability||null}),(0,e.jsx)("div",{className:"team-role-cell",children:a.hasTeamRole?t.mine?(0,e.jsx)("button",{className:"tf-role","data-app":a.larkAppId,"data-name":a.name,onClick:()=>t.onOpenRole(a.larkAppId,a.name),children:n("team.viewRole")}):n("team.hasRoleShort"):(0,e.jsx)("span",{className:"muted",children:"\u2014"})})]})}function we(t){return t instanceof HTMLElement?!!t.closest('button, input, textarea, select, a, label, [contenteditable="true"]'):!1}function $e(t){let{output:a,tr:n}=t;return a?a.kind==="muted"?(0,e.jsx)("span",{className:"muted",children:n(a.key)}):a.kind==="err"?(0,e.jsx)("span",{className:"err",children:n(a.key)}):(0,e.jsx)(_e,{body:a.body,status:a.status,tr:n}):null}function _e(t){let{body:a,status:n,tr:o}=t;if(a?.ok&&a.chatId){let p=a.shareLink||"https://applink.feishu.cn/client/chat/open?openChatId="+encodeURIComponent(a.chatId);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"ok",children:o("team.groupCreated")}),a.delegatedTo?o("team.delegatedBy",{name:String(a.delegatedTo)}):""," \xB7 ",(0,e.jsx)("a",{href:p,target:"_blank",rel:"noreferrer",children:o("team.openInLark")}),(a.invalidBotIds||[]).length?(0,e.jsxs)("span",{className:"err",children:[" \xB7 ",o("team.invalidBots",{ids:(a.invalidBotIds||[]).join(", ")})]}):null,(a.invalidOwnerUnionIds||[]).length?(0,e.jsxs)("span",{className:"err",children:[" \xB7 ",o("team.invalidOwners",{n:(a.invalidOwnerUnionIds||[]).length})]}):null,a.missingOperatorIdentity?(0,e.jsxs)("span",{className:"err",children:[" \xB7 ",o("team.missingIdentity")]}):null,(a.skippedNoOwner||[]).length?(0,e.jsxs)("span",{className:"err",children:[" \xB7 ",o("team.skippedNoOwner",{n:(a.skippedNoOwner||[]).length})]}):null]})}let d=a?.error||n,r=d==="no_local_online_bot"?o("team.errNoLocalBot"):d==="all_bots_skipped_no_owner"?o("team.errAllSkipped"):d==="no_creator_available"?o("team.errNoCreator"):d==="delegation_timeout"?o("team.errDelegationTimeout"):o("team.errGroupCreate",{error:String(d)});return(0,e.jsx)("span",{className:"err",children:r})}function ze(t){let{state:a,tr:n}=t;return(0,e.jsx)("div",{id:"tf-modal",className:"team-role-modal","data-app":a?.app,hidden:!a,children:(0,e.jsxs)("div",{className:"team-role-dialog",children:[(0,e.jsx)("h2",{id:"tf-modal-title",children:a?n("team.roleModalTitleName",{name:a.name}):n("team.roleModalTitle")}),(0,e.jsx)("p",{className:"muted",style:{fontSize:"13px"},children:n("team.roleModalHint")}),(0,e.jsx)("textarea",{id:"tf-modal-text",readOnly:!0,value:a?.content??""}),(0,e.jsx)("div",{className:"team-role-actions",children:(0,e.jsx)("button",{type:"button",id:"tf-modal-cancel",onClick:t.onClose,children:n("team.close")})})]})})}function Ke(){let t=F(),a=Ce(),[n,o]=(0,l.useState)([]),[d,r]=(0,l.useState)(""),[p,T]=(0,l.useState)(""),[k,y]=(0,l.useState)({kind:"none"}),[u,R]=(0,l.useState)(()=>new Map),[B,x]=(0,l.useState)(""),[D,M]=(0,l.useState)(""),[O,I]=(0,l.useState)({kind:"none"}),P=(0,l.useCallback)(async()=>{let c=await Q();if(!a.current)return;let g=c.body;r(N=>g?.suggestedHubUrl||N),o(g?.teams||[])},[a]);(0,l.useEffect)(()=>{P()},[P]);async function H(){let c=p.trim();if(!c){y({kind:"err",key:"team.errName"});return}y({kind:"muted",key:"team.creating"});let g=await be(c);a.current&&(g.body?.ok?(y({kind:"ok",key:"team.created"}),T(""),P()):y({kind:"create-fail",error:String(g.body?.error||g.status)}))}async function U(c){R(N=>{let b=new Map(N);return b.set(c,{kind:"muted",key:"team.generating"}),b});let g=await he(c);a.current&&R(N=>{let b=new Map(N);return b.set(c,g.body?.code?{kind:"invite",code:g.body.code}:{kind:"err",key:"team.genFail"}),b})}async function w(c,g){await J({title:"\u5220\u9664\u56E2\u961F",message:t("team.delConfirm",{name:g}),danger:!0})&&(await fe(c),a.current&&P())}async function j(){let c=B.trim(),g=D.trim();if(I({kind:"muted",key:"team.joining"}),!c||!g){I({kind:"err",key:"team.errHubCode"});return}let N=await ve(c,g);a.current&&(N.body?.ok?(I({kind:"joined",name:String(N.body.teamName||"")}),M("")):I({kind:"join-fail",error:N.body?.error||N.status}))}return(0,e.jsxs)("section",{className:"page team-page team-manage-page",children:[(0,e.jsxs)("div",{className:"page-heading",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:"eyebrow",children:t("team.eyebrow")}),(0,e.jsx)("h1",{children:t("team.manageTitle")})]}),(0,e.jsx)("div",{className:"page-heading-actions",children:(0,e.jsx)(Se,{active:"manage"})})]}),(0,e.jsxs)("div",{className:"card team-card",children:[(0,e.jsx)("div",{className:"team-card-head",children:(0,e.jsx)("h2",{children:t("team.hostedTitle")})}),(0,e.jsxs)("form",{className:"team-inline-form dashboard-toolbar",onSubmit:c=>{c.preventDefault(),H()},children:[(0,e.jsx)("input",{id:"tm-newname",type:"text",placeholder:t("team.newTeamPh"),value:p,onChange:c=>T(c.target.value)}),(0,e.jsx)(re,{id:"tm-create",className:"page-primary-action",onClick:()=>{H()},children:t("team.createTeamBtn")}),(0,e.jsx)("span",{className:"toolbar-status tm-cout",children:(0,e.jsx)(Z,{status:k,tr:t})})]}),(0,e.jsx)("div",{id:"tm-list",children:(0,e.jsx)(qe,{teams:n,suggestedHubUrl:d,inviteStatuses:u,tr:t,onInvite:c=>{U(c)},onDelete:(c,g)=>{w(c,g)}})})]}),(0,e.jsxs)("div",{className:"card team-card",children:[(0,e.jsx)("div",{className:"team-card-head",children:(0,e.jsx)("h2",{children:t("team.joinTitle")})}),(0,e.jsxs)("form",{className:"team-inline-form dashboard-toolbar team-join-form",onSubmit:c=>{c.preventDefault(),j()},children:[(0,e.jsx)("input",{id:"tm-hub",type:"text",placeholder:t("team.hubPh"),value:B,onChange:c=>x(c.target.value)}),(0,e.jsx)("input",{id:"tm-code",type:"text",placeholder:t("team.codePh"),value:D,onChange:c=>M(c.target.value)}),(0,e.jsx)("button",{type:"button",id:"tm-join",className:"page-primary-action",onClick:()=>{j()},children:t("team.joinBtn")})]}),(0,e.jsx)("div",{id:"tm-join-out",className:"team-inline-output",hidden:O.kind==="none",children:(0,e.jsx)(Z,{status:O,tr:t})})]})]})}function qe(t){let{teams:a,tr:n}=t;return a.length?(0,e.jsx)(e.Fragment,{children:a.map(o=>{let d=(o.deployments||[]).filter(p=>!p.local).length,r=t.inviteStatuses.get(o.teamId)??{kind:"none"};return(0,e.jsxs)("div",{className:"card team-list-card team-manage-card",children:[(0,e.jsxs)("div",{className:"team-manage-head",children:[(0,e.jsx)("b",{children:o.name}),o.isDefault?(0,e.jsx)("span",{className:"team-status-pill muted",children:n("team.default")}):null,(0,e.jsxs)("span",{className:"team-meta-pill",children:[n("team.manageMetaDeps",{count:(o.deployments||[]).length}),d?n("team.manageMetaRemote",{r:d}):""," \xB7 ",n("team.manageMetaBots",{count:(o.bots||[]).length})]}),(0,e.jsxs)("span",{className:"team-manage-actions",children:[(0,e.jsx)("button",{className:"tm-invite ghost","data-team":o.teamId,onClick:()=>t.onInvite(o.teamId),children:n("team.genInvite")}),o.isDefault?null:(0,e.jsx)("button",{className:"tm-del ghost","data-team":o.teamId,"data-name":o.name,onClick:()=>t.onDelete(o.teamId,o.name),children:n("team.delBtn")})]})]}),(0,e.jsx)("div",{className:"tm-inv-out team-inline-output","data-team":o.teamId,hidden:r.kind==="none",children:(0,e.jsx)(Z,{status:r,tr:n,suggestedHubUrl:t.suggestedHubUrl})}),(0,e.jsx)(Je,{teamId:o.teamId,initial:o.feedback??null})]},o.teamId)})}):(0,e.jsx)("p",{className:"muted",children:n("team.noTeamsShort")})}function Je(t){let[a,n]=(0,l.useState)(JSON.stringify(t.initial??{enabled:!1},null,2)),[o,d]=(0,l.useState)(""),[r,p]=(0,l.useState)(!1);async function T(){p(!0),d("");try{let k=JSON.parse(a),y=await ke(t.teamId,k);if(y.status<200||y.status>=300||y.body.ok===!1)throw new Error(String(y.body?.error??y.status));n(JSON.stringify(y.body.feedback??null,null,2)),d("\u2713 \u5DF2\u4FDD\u5B58")}catch(k){d(`\u2717 ${k instanceof Error?k.message:String(k)}`)}finally{p(!1)}}return(0,e.jsxs)("div",{className:"team-feedback-editor",children:[(0,e.jsxs)("label",{children:[(0,e.jsx)("span",{children:"\u56E2\u961F\u53CD\u9988\u7B56\u7565"}),(0,e.jsx)("textarea",{rows:6,value:a,disabled:r,onChange:k=>n(k.target.value)})]}),(0,e.jsxs)("div",{className:"actions",children:[(0,e.jsx)("button",{type:"button",disabled:r,onClick:()=>{T()},children:"\u4FDD\u5B58\u53CD\u9988\u7B56\u7565"}),(0,e.jsx)("span",{children:o})]})]})}function Z(t){let{status:a,tr:n}=t;if(a.kind==="none")return null;if(a.kind==="muted")return(0,e.jsx)("span",{className:"muted",children:n(a.key)});if(a.kind==="ok")return(0,e.jsx)("span",{className:"ok",children:n(a.key)});if(a.kind==="err")return(0,e.jsx)("span",{className:"err",children:n(a.key)});if(a.kind==="create-fail")return(0,e.jsx)("span",{className:"err",children:n("team.createFail",{error:a.error})});if(a.kind==="invite")return(0,e.jsxs)(e.Fragment,{children:[n("team.inviteResultLede"),(0,e.jsx)("br",{}),n("team.inviteHub"),(0,e.jsx)("code",{children:t.suggestedHubUrl||""}),(0,e.jsx)("br",{}),n("team.inviteCode"),(0,e.jsx)("code",{className:"team-invite-code",children:a.code})]});if(a.kind==="joined")return(0,e.jsx)("span",{className:"ok",children:n("team.joined",{name:a.name})});let o=a.error,d=o==="cannot_join_self"?n("team.joinErrSelf"):o==="deployment_already_joined"?n("team.joinErrAlready"):o==="hub_unreachable"?n("team.joinErrUnreachable"):o==="hub_timeout"?n("team.joinErrTimeout"):n("team.joinErrGeneric",{error:String(o)});return(0,e.jsx)("span",{className:"err",children:d})}function tt(t){return K(t,(0,e.jsx)(Oe,{}))}function at(t){return K(t,(0,e.jsx)(Ke,{}))}export{tt as renderTeamFederationPage,at as renderTeamManagePage};
@@ -0,0 +1,94 @@
1
+ import{a as _}from"./chunk-OT6L6G7R.js";import{d as E}from"./chunk-5QX4OYOR.js";import{d as V}from"./chunk-RHVFZC5Z.js";import"./chunk-QITAMHW6.js";import{w as F}from"./chunk-CK22743G.js";import{c as O}from"./chunk-XVIXNQGC.js";import{c as S,d as re,e as $}from"./chunk-CVNIMUPY.js";var l=S(re(),1);async function j(t=fetch){let e=await t("/api/v3/runs");if(!e.ok)return[];let o=await e.json();return Array.isArray(o.runs)?o.runs:[]}async function J(t,e=fetch){let o=await e(`/api/v3/runs/${encodeURIComponent(t)}`);return o.ok?{ok:!0,view:await o.json()}:{ok:!1,status:o.status}}async function X(t,e=fetch){let o=await e(`/api/v3/runs/${encodeURIComponent(t)}/cancel`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({})}),s={};try{let r=await o.json();r&&typeof r=="object"&&!Array.isArray(r)&&(s=r)}catch{}if(!o.ok||s.ok===!1)return{ok:!1,status:o.status,error:typeof s.error=="string"?s.error:`http_${o.status}`};let a=s.status;return{ok:!0,...typeof s.runId=="string"?{runId:s.runId}:{},...ie(a)?{runStatus:a}:{},...s.alreadyTerminal===!0?{alreadyTerminal:!0}:{}}}function ie(t){return t==="running"||t==="cancelling"||t==="cancelled"||t==="succeeded"||t==="failed"||t==="blocked"}var I={pending:"\u5F85\u673A",gateWaiting:"\u7B49\u5BA1\u6279",running:"\u8FD0\u884C\u4E2D",done:"\u5B8C\u6210",skipped:"\u5DF2\u8DF3\u8FC7",cancelled:"\u5DF2\u53D6\u6D88",blocked:"\u53D7\u963B",superseded:"\u5DF2\u5237\u65B0",failed:"\u5931\u8D25"},W={exit:"\u2713 \u901A\u8FC7",continue:"\u21BB \u7EE7\u7EED\u8FD4\u5DE5",exhausted:"\u26D4 \u8F6E\u6570\u8017\u5C3D"},p={nodeWidth:168,plainHeight:48,loopHeight:70,columnGap:226,verticalGap:30,padding:26,maxDots:8},x={width:104,height:30,columnGap:138,rowGap:42,padding:6};function k(t){return t==="succeeded"||t==="failed"||t==="cancelled"}function z(t=typeof location<"u"?location.hash:""){let e=t.match(/^#\/workflows\/([^?#]+)/);if(!e)return null;try{return decodeURIComponent(e[1])}catch{return e[1]}}function L(t,e){return t.length>e?`${t.slice(0,e-1)}\u2026`:t}function D(t){return t.isLoop?p.loopHeight:p.plainHeight}function C(t){return t.nodes.filter(e=>!e.loop)}function U(t){let e=C(t),o=le(e),s=new Map;for(let i of e){let m=o.get(i.id)??0,c=s.get(m);c?c.push(i):s.set(m,[i])}let a=[...s.keys()].sort((i,m)=>i-m),r=[],d=new Map,u=0;for(let i of a){let m=s.get(i)??[],c=p.padding;for(let g of m){let v={node:g,x:p.padding+i*p.columnGap,y:c,width:p.nodeWidth,height:D(g)};r.push(v),d.set(g.id,v),c+=v.height+p.verticalGap}u=Math.max(u,c-p.verticalGap+p.padding)}let f=p.padding*2+(a.length===0?0:Math.max(...a)*p.columnGap+p.nodeWidth),w=new Map(e.map(i=>[i.id,i])),y=[];for(let i of e){let m=d.get(i.id);if(m)for(let c of i.depends){let g=d.get(c),v=w.get(c);if(!g||!v)continue;let N=g.x+p.nodeWidth,R=g.y+D(v)/2,b=m.x,M=m.y+D(i)/2;y.push({fromId:c,toId:i.id,x1:N,y1:R,x2:b,y2:M,mx:(N+b)/2,live:i.status==="running"})}}return{width:f,height:u,nodes:r,edges:y}}function le(t){let e=new Map(t.map(r=>[r.id,r])),o=new Map,s=new Set;function a(r){if(o.has(r))return o.get(r);if(s.has(r))return 0;s.add(r);let u=(e.get(r)?.depends??[]).filter(w=>e.has(w)),f=u.length?1+Math.max(...u.map(a)):0;return s.delete(r),o.set(r,f),f}for(let r of t)a(r.id);return o}function q(t,e){return(t?.nodes??[]).filter(o=>o.loop?.loopId===e)}function Y(t,e,o){if(o&&e){let a=t.find(r=>r.id===e);if(a)return a}let s=t.filter(a=>a.status==="running");return s[s.length-1]??t[t.length-1]??null}function K(t){let e=new Map;for(let o of t){let s=o.loop?.iteration;if(s===void 0)continue;let a=e.get(s);a?a.push(o):e.set(s,[o])}return[...e.entries()].sort((o,s)=>o[0]-s[0]).map(([o,s])=>({iteration:o,instances:s}))}function P(t){let e=t.loopState?.maxIterations;return t.loopState&&e!==void 0?e+t.loopState.granted:void 0}function Q(t,e){let o=new Map(t.map(i=>[i.id,i])),s=new Map;function a(i){if(s.has(i))return s.get(i);s.set(i,0);let m=(o.get(i)?.depends??[]).filter(g=>o.has(g)),c=m.length?1+Math.max(...m.map(a)):0;return s.set(i,c),c}let r=new Map,d=0,u=[],f=new Map;for(let i of t){let m=a(i.id),c=r.get(m)??0;r.set(m,c+1),d=Math.max(d,c);let g={templateId:i.id,node:e.get(i.id),x:x.padding+m*x.columnGap,y:x.padding+c*x.rowGap,width:x.width,height:x.height};u.push(g),f.set(i.id,g)}let w=s.size?Math.max(...s.values()):0,y=[];for(let i of t){let m=f.get(i.id);if(m)for(let c of i.depends){let g=f.get(c);if(!g)continue;let v=g.x+x.width,N=g.y+x.height/2,R=m.x,b=m.y+x.height/2;y.push({fromId:c,toId:i.id,x1:v,y1:N,x2:R,y2:b,mx:(v+R)/2,live:e.get(i.id)?.status==="running"})}}return{width:x.padding*2+(t.length?w*x.columnGap+x.width:0),height:x.padding*2+d*x.rowGap+x.height,nodes:u,edges:y}}function H(t){let e=t.webTerminal;return`${e?.status??"-"}|${e?.sessionId??"-"}|${e?.webPort??"-"}|${t.hasPtyLog?"1":"0"}`}function Z(t,e,o){t.setAttribute("data-run-id",e),t.setAttribute("data-node-id",o.id),t.innerHTML=de(e,o).html}function de(t,e,o={}){let s=H(e),a=e.webTerminal;if(a?.status==="live"&&a.webPort&&a.webPort>0)return{kind:"live",signature:s,html:ce(a.webPort,a.sessionId,o.host)};if(e.hasPtyLog)return{kind:"replay",signature:s,html:ue(t,e.id,a?.status==="closed")};let r=a?.status==="live"?"\u7EC8\u7AEF\u6B63\u5728\u542F\u52A8\uFF0C\u7A0D\u540E\u5237\u65B0":"\u6682\u65E0\u7EC8\u7AEF\u8BB0\u5F55";return{kind:"empty",signature:s,html:me(r)}}function ce(t,e,o){let s=pe(t,o,e);return`<div class="v3-terminal-panel">
2
+ <div class="v3-terminal-head">
3
+ <span class="v3-terminal-dot live"></span>
4
+ <span>\u5B9E\u65F6\u7EC8\u7AEF\uFF08\u53EA\u8BFB\uFF09</span>
5
+ <span class="muted">:${t}</span>
6
+ <a class="btn-link" href="${T(s)}" target="_blank" rel="noopener">\u65B0\u7A97\u53E3\u6253\u5F00</a>
7
+ </div>
8
+ <iframe class="v3-terminal-frame" src="${T(s)}" title="v3 live terminal" loading="lazy"></iframe>
9
+ </div>`}function ue(t,e,o){let s=`/api/v3/runs/${encodeURIComponent(t)}/nodes/${encodeURIComponent(e)}/pty-log`,a=ge(s,`${t} / ${e}`);return`<div class="v3-terminal-panel">
10
+ <div class="v3-terminal-head">
11
+ <span class="v3-terminal-dot ${o?"closed":"replay"}"></span>
12
+ <span>${o?"\u7EC8\u7AEF\u56DE\u653E":"\u7EC8\u7AEF\u8BB0\u5F55"}</span>
13
+ <span class="muted">PTY log</span>
14
+ <a class="btn-link" href="${T(s)}" target="_blank" rel="noopener">\u4E0B\u8F7D/\u6253\u5F00\u539F\u59CB\u65E5\u5FD7</a>
15
+ </div>
16
+ <iframe class="v3-terminal-frame" srcdoc="${T(a)}" title="v3 terminal replay" loading="lazy"></iframe>
17
+ </div>`}function me(t){return`<div class="v3-terminal-empty muted">${G(t)}</div>`}function pe(t,e,o){return o&&typeof window<"u"&&window.location.protocol==="https:"?`${window.location.origin}/s/${encodeURIComponent(o)}`:`http://${e??fe()}:${t}/`}function fe(){return typeof window>"u"?"127.0.0.1":window.location.hostname||"127.0.0.1"}function ge(t,e){let o=JSON.stringify(t);return`<!doctype html>
18
+ <html>
19
+ <head>
20
+ <meta charset="utf-8">
21
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@xterm/xterm@5.5.0/css/xterm.css">
22
+ <style>
23
+ html,body{margin:0;height:100%;background:#0d1117;color:#c9d1d9;font:12px ui-monospace,SFMono-Regular,Menlo,monospace}
24
+ #bar{height:31px;display:flex;align-items:center;gap:10px;padding:0 10px;background:#161b22;border-bottom:1px solid #30363d;box-sizing:border-box}
25
+ #status{margin-left:auto;color:#8b949e;white-space:nowrap}
26
+ #term{height:calc(100% - 31px);padding:4px;box-sizing:border-box;overflow:auto}
27
+ a{color:#58a6ff;text-decoration:none}
28
+ </style>
29
+ </head>
30
+ <body>
31
+ <div id="bar"><span>${G(e)}</span><span id="status">loading...</span></div>
32
+ <div id="term"></div>
33
+ <script src="https://cdn.jsdelivr.net/npm/@xterm/xterm@5.5.0/lib/xterm.js"><\/script>
34
+ <script src="https://cdn.jsdelivr.net/npm/@xterm/addon-fit@0.10.0/lib/addon-fit.js"><\/script>
35
+ <script>
36
+ (function(){
37
+ var endpoint=${o};
38
+ // v3 ephemeral workers spawn their PTY at DEFAULT_RENDER_COLS (=160, see
39
+ // worker.ts) and never adopt, so the captured stream's TUI / box-drawing
40
+ // is exactly 160 cols wide. Fitting it into a narrower (or oddly-measured)
41
+ // grid re-wraps those fixed-width lines into a stair-stepped mess and
42
+ // wastes the panel. So we render at the capture width and let FitAddon
43
+ // only size the ROW count to the iframe height (cols pinned back to 160).
44
+ var COLS=160;
45
+ var status=document.getElementById('status');
46
+ var termEl=document.getElementById('term');
47
+ if(!window.Terminal){status.textContent='xterm.js failed to load';return;}
48
+ var term=new Terminal({
49
+ cols:COLS,
50
+ convertEol:false,
51
+ scrollback:100000,
52
+ fontSize:13,
53
+ disableStdin:true,
54
+ theme:{background:'#0d1117',foreground:'#c9d1d9',cursor:'#c9d1d9'}
55
+ });
56
+ var fit=null;
57
+ if(window.FitAddon){fit=new window.FitAddon.FitAddon();term.loadAddon(fit);}
58
+ term.open(termEl);
59
+ function doFit(){
60
+ try{if(fit)fit.fit()}catch(_){}
61
+ if(term.cols!==COLS)term.resize(COLS,term.rows||24);
62
+ }
63
+ doFit(); window.addEventListener('resize',doFit);
64
+ fetch(endpoint,{credentials:'include'}).then(function(res){
65
+ if(!res.ok){
66
+ if(res.status===401){status.textContent='\u9700\u8981\u767B\u5F55 dashboard \u540E\u67E5\u770B\u56DE\u653E';}
67
+ else if(res.status===404){status.textContent='\u6CA1\u6709 PTY \u65E5\u5FD7';}
68
+ else{status.textContent='\u52A0\u8F7D\u5931\u8D25 HTTP '+res.status;}
69
+ return null;
70
+ }
71
+ var total=Number(res.headers.get('x-botmux-log-bytes')||0);
72
+ var served=Number(res.headers.get('x-botmux-served-bytes')||0);
73
+ var truncated=res.headers.get('x-botmux-truncated')==='1';
74
+ status.textContent=truncated
75
+ ? 'showing tail '+formatBytes(served)+' / '+formatBytes(total)
76
+ : 'loaded '+formatBytes(total);
77
+ return res.arrayBuffer();
78
+ }).then(function(buf){
79
+ if(!buf)return;
80
+ term.write(new TextDecoder().decode(buf));
81
+ setTimeout(doFit,0);
82
+ }).catch(function(err){
83
+ status.textContent='\u52A0\u8F7D\u5931\u8D25: '+(err&&err.message?err.message:String(err));
84
+ });
85
+ function formatBytes(n){
86
+ if(!Number.isFinite(n)||n<=0)return '0 B';
87
+ var u=['B','KiB','MiB','GiB'];var i=0;
88
+ while(n>=1024&&i<u.length-1){n/=1024;i++;}
89
+ return (i===0?String(n):n.toFixed(1))+' '+u[i];
90
+ }
91
+ })();
92
+ <\/script>
93
+ </body>
94
+ </html>`}function G(t){return t.replace(/[&<>"']/g,e=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[e])}function T(t){return G(t).replace(/`/g,"&#96;")}var n=S($(),1);function te(){return typeof document<"u"&&document.hidden}function ve(){let[t,e]=(0,l.useState)([]);return(0,l.useEffect)(()=>{let o=!1,s=null,a=()=>{s=window.setTimeout(()=>{r()},2e3)};async function r(){if(!o){if(!te())try{let d=await j();o||e(d)}catch{}o||a()}}return r(),()=>{o=!0,s!==null&&window.clearTimeout(s)}},[]),t}function he(t){let[e,o]=(0,l.useState)(null),[s,a]=(0,l.useState)("");return(0,l.useEffect)(()=>{let r=!1,d=null,u=()=>{d=window.setTimeout(()=>{f()},2e3)};async function f(){if(r)return;let w=!1;if(!te())try{let y=await J(t);if(r)return;y.ok?(o(y.view),a(y.view.runStatus),w=k(y.view.runStatus)):a(y.status===404?"not found":`HTTP ${y.status}`)}catch{}!r&&!w&&u()}return f(),()=>{r=!0,d!==null&&window.clearTimeout(d)}},[t]),{view:e,statusText:s}}function we(){let t=V(),e=ve(),o=(0,n.jsx)("div",{className:"page-heading-actions v3r-run-toolbar",children:(0,n.jsx)("span",{className:"v3r-run-count",children:e.length})});return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"page-heading",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"eyebrow",children:t("nav.workflows")}),(0,n.jsx)("h1",{children:t("nav.workflows")})]}),o]}),(0,n.jsx)("section",{className:"overview-block v3r-runs-section",children:(0,n.jsx)("div",{className:"v3r-run-list",children:e.length?e.map(s=>(0,n.jsxs)("a",{className:"v3r-run-card",href:`#/workflows/${encodeURIComponent(s.runId)}`,children:[(0,n.jsxs)("span",{className:"v3r-run-main",children:[(0,n.jsx)("code",{className:"v3r-runid",children:s.runId}),(0,n.jsxs)("small",{children:["\u8282\u70B9 ",s.nodeCount]})]}),(0,n.jsx)("span",{className:`v3r-pill rs-${s.runStatus}`,children:s.runStatus})]},s.runId)):(0,n.jsxs)("div",{className:"empty v3r-empty",children:["\u6682\u65E0\u5DE5\u4F5C\u6D41\u8FD0\u884C\uFF08\u7528 ",(0,n.jsx)("code",{children:"/workflow new"})," \u53D1\u8D77\u4E00\u4E2A\uFF09"]})})})]})}function ye(t){let e=V(),{view:o,statusText:s}=he(t.runId),[a,r]=(0,l.useState)(null),[d,u]=(0,l.useState)(null),[f,w]=(0,l.useState)(!1),[y,i]=(0,l.useState)(!1),[m,c]=(0,l.useState)(!1),[g,v]=(0,l.useState)(null);(0,l.useEffect)(()=>{r(null),u(null),w(!1),i(!1),c(!1),v(null)},[t.runId]),(0,l.useEffect)(()=>{o?.runStatus==="cancelling"?(c(!0),v(e("workflow.v3.cancelPending"))):o?.runStatus==="cancelled"?(c(!1),v(e("workflow.v3.cancelled"))):k(o?.runStatus)&&c(!1)},[e,o?.runStatus]),(0,l.useEffect)(()=>{o&&r(h=>h&&o.nodes.some(ae=>ae.id===h)?h:C(o)[0]?.id??o.nodes[0]?.id??null)},[o]);let N=(0,l.useCallback)(h=>{r(h),u(null),w(!1)},[]),R=(0,l.useCallback)(h=>{u(h),w(!0)},[]),b=o?.nodes.find(h=>h.id===a)??null,M=o?`v3r-pill rs-${o.runStatus}`:"v3r-pill",A=k(o?.runStatus),B=y||m||o?.runStatus==="cancelling",oe=(0,l.useCallback)(async()=>{if(!(!o||A||B)&&await _({title:"\u53D6\u6D88\u8FD0\u884C",message:e("workflow.v3.cancelConfirm",{runId:t.runId}),danger:!0})){i(!0),v(null);try{let h=await X(t.runId);if(!h.ok){v(h.status===401?e("workflow.v3.cancelAuthRequired"):e("workflow.v3.cancelFailed",{error:h.error}));return}v(h.runStatus==="cancelled"?e("workflow.v3.cancelled"):h.alreadyTerminal?e("workflow.v3.cancelAlreadyTerminal"):e("workflow.v3.cancelPending")),c(h.runStatus!=="cancelled"&&h.alreadyTerminal!==!0)}catch{v(e("workflow.v3.cancelFailed",{error:"network_error"}))}finally{i(!1)}}},[B,t.runId,A,e,o]);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"page-heading v3r-detail-heading",children:[(0,n.jsxs)("div",{className:"v3r-title-row",children:[(0,n.jsx)("p",{className:"eyebrow",children:e("nav.workflows")}),(0,n.jsxs)("a",{href:"#/workflows",className:"btn-link v3r-back-link",children:["\u2190 ",e("nav.workflows")]}),(0,n.jsx)("h1",{children:t.runId}),(0,n.jsx)("span",{className:`${M} v3r-run-status-pill`,children:s})]}),(0,n.jsx)("div",{className:"page-heading-actions",children:(0,n.jsx)(xe,{runStatus:o?.runStatus,busy:y||m,onCancel:()=>{oe()}})})]}),g?(0,n.jsx)("div",{className:`v3r-cancel-notice${o?.runStatus==="cancelled"?" done":""}`,role:"status",children:g}):null,(0,n.jsxs)("div",{className:"v3r-wrap",children:[(0,n.jsxs)("section",{className:"overview-block v3r-graph-section",children:[(0,n.jsx)(E,{title:"\u8FD0\u884C\u62D3\u6251",hint:o?`${o.nodes.length} \u4E2A\u8282\u70B9`:s}),(0,n.jsxs)("div",{className:"v3r-graph-card",children:[(0,n.jsx)(Ne,{view:o,selectedId:a,onSelect:N}),(0,n.jsx)(be,{})]})]}),(0,n.jsxs)("section",{className:"overview-block v3r-node-section",children:[(0,n.jsx)(E,{title:"\u8282\u70B9\u8BE6\u60C5",hint:b?(0,n.jsxs)("span",{className:`v3r-pill v3r-node-status-pill st-${b.status}`,children:[(0,n.jsx)("i",{className:"dot"}),I[b.status]]}):"\u9009\u62E9\u4E00\u4E2A\u8282\u70B9"}),(0,n.jsx)(ke,{runId:t.runId,view:o,node:b,instanceId:d,instancePinned:f,onInstanceSelect:R})]})]})]})}function xe(t){let e=V();if(!F.authed)return null;let o=k(t.runStatus),s=t.busy||t.runStatus==="cancelling";return(0,n.jsx)("button",{type:"button",className:"danger v3r-cancel-button",disabled:!t.runStatus||o||s,title:e(o?"workflow.v3.cancelTerminal":"workflow.v3.cancelTitle"),onClick:t.onCancel,children:e(s?"workflow.v3.cancelling":o?"workflow.v3.cancelTerminal":"workflow.v3.cancel")})}function be(){return(0,n.jsxs)("div",{className:"v3r-legend",children:[(0,n.jsx)("span",{className:"lg st-pending",children:"\u5F85\u673A"}),(0,n.jsx)("span",{className:"lg st-running",children:"\u8FD0\u884C\u4E2D"}),(0,n.jsx)("span",{className:"lg st-gateWaiting",children:"\u7B49\u5BA1\u6279"}),(0,n.jsx)("span",{className:"lg st-done",children:"\u5B8C\u6210"}),(0,n.jsx)("span",{className:"lg st-skipped",children:"\u5DF2\u8DF3\u8FC7"}),(0,n.jsx)("span",{className:"lg st-cancelled",children:"\u5DF2\u53D6\u6D88"}),(0,n.jsx)("span",{className:"lg st-blocked",children:"\u53D7\u963B"}),(0,n.jsx)("span",{className:"lg st-failed",children:"\u5931\u8D25"}),(0,n.jsx)("span",{className:"lg lg-loop",children:"\u27F3 \u5FAA\u73AF\u5BB9\u5668"})]})}function Ne(t){let e=(0,l.useMemo)(()=>t.view?U(t.view):null,[t.view]),o=e?`${e.width}:${e.height}:${e.nodes.map(a=>a.node.id).join("\0")}`:"",s=(0,l.useRef)(null);return(0,l.useLayoutEffect)(()=>{let a=s.current;if(!a||!o)return;let r=0,d=()=>{r=0,a.scrollLeft=Math.max(0,(a.scrollWidth-a.clientWidth)/2),a.scrollTop=Math.max(0,(a.scrollHeight-a.clientHeight)/2)},u=()=>{r&&window.cancelAnimationFrame(r),r=window.requestAnimationFrame(d)};u();let f=typeof ResizeObserver>"u"?null:new ResizeObserver(u);f?.observe(a);let w=a.querySelector(".v3r-graph-stage");return w&&f?.observe(w),()=>{r&&window.cancelAnimationFrame(r),f?.disconnect()}},[o]),(0,n.jsx)("div",{id:"v3-graph",className:"v3r-graph",ref:s,children:e?(0,n.jsx)("div",{className:"v3r-graph-stage",children:(0,n.jsxs)("svg",{width:e.width,height:e.height,viewBox:`0 0 ${e.width} ${e.height}`,children:[(0,n.jsx)("defs",{children:(0,n.jsx)("marker",{id:"v3arrow",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"7",markerHeight:"7",orient:"auto-start-reverse",children:(0,n.jsx)("path",{d:"M0,0 L10,5 L0,10 z",fill:"var(--faint, #8b98aa)"})})}),e.edges.map(a=>(0,n.jsx)("path",{className:`v3r-edge${a.live?" live":""}`,d:`M${a.x1},${a.y1} C${a.mx},${a.y1} ${a.mx},${a.y2} ${a.x2},${a.y2}`,markerEnd:"url(#v3arrow)"},`${a.fromId}->${a.toId}`)),e.nodes.map(a=>(0,n.jsx)(Re,{box:a,selected:a.node.id===t.selectedId,onSelect:t.onSelect},a.node.id))]})}):null})}function Re(t){let{box:e,selected:o}=t,s=e.node;return s.isLoop?(0,n.jsx)(Ie,{box:e,selected:o,onSelect:t.onSelect}):(0,n.jsxs)("g",{className:`v3r-node st-${s.status}${o?" sel":""}`,"data-node":s.id,onClick:()=>t.onSelect(s.id),children:[(0,n.jsx)("rect",{className:"v3r-box",x:e.x,y:e.y,width:p.nodeWidth,height:p.plainHeight,rx:"10"}),(0,n.jsx)("text",{className:"v3r-nid",x:e.x+14,y:e.y+20,children:L(s.id,18)}),(0,n.jsx)("text",{className:"v3r-nstatus",x:e.x+14,y:e.y+37,children:I[s.status]})]})}function Ie(t){let{box:e,selected:o}=t,s=e.node,a=s.loopState,r=P(s),d=a?`${I[s.status]} \xB7 \u7B2C${a.iteration}${r!==void 0?`/${r}`:""}\u8F6E`:`${I[s.status]} \xB7 loop`,u=a?.maxIterations;return(0,n.jsxs)("g",{className:`v3r-node v3r-loopnode st-${s.status}${o?" sel":""}`,"data-node":s.id,onClick:()=>t.onSelect(s.id),children:[(0,n.jsx)("rect",{className:"v3r-cap",x:e.x-4,y:e.y-4,width:p.nodeWidth+8,height:p.loopHeight+8,rx:"14"}),(0,n.jsx)("rect",{className:"v3r-box",x:e.x,y:e.y,width:p.nodeWidth,height:p.loopHeight,rx:"10"}),(0,n.jsx)("text",{className:"v3r-spin",x:e.x+14,y:e.y+21,children:"\u27F3"}),(0,n.jsx)("text",{className:"v3r-nid",x:e.x+30,y:e.y+21,children:L(s.id,16)}),(0,n.jsx)("text",{className:"v3r-nstatus",x:e.x+14,y:e.y+39,children:d}),a&&r!==void 0&&r<=p.maxDots?(0,n.jsx)(Se,{node:s,x:e.x,y:e.y,budget:r,maxIterations:u}):null]})}function Se(t){let e=t.node.loopState,o=t.y+p.loopHeight-13,s=Array.from({length:t.budget},(a,r)=>r+1);return(0,n.jsxs)(n.Fragment,{children:[s.map(a=>{let r=a<e.iteration?"v3r-dot done":a===e.iteration?`v3r-dot cur${t.node.status==="running"?" live":""}`:"v3r-dot todo",d=t.maxIterations!==void 0&&a>t.maxIterations?" grant":"";return(0,n.jsx)("circle",{className:`${r}${d}`,cx:t.x+14+(a-1)*15,cy:o,r:"3.6"},a)}),e.lastDecision==="exit"?(0,n.jsx)("text",{className:"v3r-dots-verdict ok",x:t.x+14+t.budget*15+4,y:o+4,children:"\u2713"}):null,e.lastDecision==="exhausted"&&t.node.status==="blocked"?(0,n.jsx)("text",{className:"v3r-dots-verdict warn",x:t.x+14+t.budget*15+4,y:o+4,children:"\u26A0"}):null]})}function ke(t){let e=t.node,o=(0,l.useMemo)(()=>e?.isLoop?q(t.view,e.id):[],[e,t.view]),s=e?.isLoop?Y(o,t.instanceId,t.instancePinned):e,a=e?.isLoop?s?.id??null:null;return e?(0,n.jsxs)("div",{id:"v3-node-panel",className:"v3r-panel",children:[(0,n.jsxs)("div",{id:"v3-node-meta",children:[e.goal?(0,n.jsx)("p",{className:"v3r-goal",children:e.goal}):null,e.depends.length?(0,n.jsxs)("p",{className:"v3r-deps",children:[(0,n.jsx)("span",{children:"\u4F9D\u8D56"}),e.depends.map(r=>(0,n.jsx)("span",{className:"v3r-dep",children:r},r))]}):null,e.errorClass?(0,n.jsx)(Ve,{node:e}):null,e.isLoop?(0,n.jsx)(Le,{runId:t.runId,node:e,instances:o,activeInstanceId:a,onInstanceSelect:t.onInstanceSelect}):null]}),(0,n.jsx)("div",{id:"v3-inst-strip",children:e.isLoop&&s?(0,n.jsx)($e,{node:s,auto:!t.instancePinned}):null}),(0,n.jsx)(Me,{runId:t.runId,node:s})]}):(0,n.jsx)("div",{id:"v3-node-panel",className:"v3r-panel",children:(0,n.jsx)("p",{className:"muted",children:"\u70B9\u4E00\u4E2A\u8282\u70B9\u770B\u8BE6\u60C5\u4E0E\u7EC8\u7AEF"})})}function Ve(t){let e=t.node;return(0,n.jsxs)("p",{className:"v3r-err",children:["\u539F\u56E0\uFF1A",e.errorClass,e.errorCode?` (${e.errorCode})`:"",e.status==="blocked"&&!e.isLoop?(0,n.jsxs)(n.Fragment,{children:[" \u2014 \u98DE\u4E66\u5361\u7247\u6216 ",(0,n.jsx)("code",{children:"botmux workflow retry"})," \u53EF\u91CD\u8BD5"]}):null]})}function $e(t){let e=t.node.loop;return(0,n.jsxs)("div",{className:"v3r-inst-strip",children:[(0,n.jsx)("span",{className:"lbl",children:"\u5B9E\u4F8B\u7EC8\u7AEF"}),(0,n.jsx)("span",{className:"v3r-nodeid sm",children:t.node.id}),(0,n.jsxs)("span",{className:`v3r-pill st-${t.node.status}`,children:[(0,n.jsx)("i",{className:"dot"}),I[t.node.status]]}),(0,n.jsxs)("span",{className:"muted",children:["\u7B2C ",e.iteration," \u8F6E \xB7 ",e.bodyNodeId,t.auto?" \xB7 \u81EA\u52A8\u8DDF\u968F":""]})]})}function Le(t){let e=t.node.loopState;if(!e)return(0,n.jsx)("p",{className:"muted",children:"loop \u672A\u5F00\u59CB"});let o=P(t.node),s=new Map(e.decisions.map(r=>[r.iteration,r.decision])),a=K(t.instances);return(0,n.jsxs)("div",{className:"v3r-loop-sec",children:[(0,n.jsxs)("div",{className:"v3r-loop-meter",children:[(0,n.jsxs)("span",{className:"num",children:["\u7B2C ",(0,n.jsx)("b",{children:e.iteration}),o!==void 0?(0,n.jsxs)(n.Fragment,{children:[" / ",(0,n.jsx)("b",{children:o})]}):null," \u8F6E"]}),e.granted>0?(0,n.jsxs)("span",{className:"v3r-granted-tag",children:["\u542B\u4EBA\u5DE5\u8FFD\u52A0 +",e.granted]}):null,e.lastDecision==="exit"?(0,n.jsx)("span",{className:"v3r-verdict vd-exit",children:"\u2713 \u5DF2\u6536\u655B"}):null]}),(0,n.jsx)("div",{className:"v3r-rounds",children:a.map(r=>{let d=s.get(r.iteration),u=r.iteration===e.iteration,f=e.maxIterations!==void 0&&r.iteration>e.maxIterations;return(0,n.jsxs)("div",{className:`v3r-round${u?" cur":""}${d?` vd-${d}`:""}`,children:[(0,n.jsxs)("div",{className:"v3r-round-head",children:[(0,n.jsxs)("span",{className:"rn",children:["R",r.iteration]}),f?(0,n.jsx)("span",{className:"v3r-granted-tag",children:"\u2795 \u8FFD\u52A0\u8F6E"}):null,d?(0,n.jsx)("span",{className:`v3r-verdict vd-${d}`,children:W[d]}):u&&t.node.status==="running"?(0,n.jsx)("span",{className:"v3r-verdict vd-live",children:"\u25B6 \u8FDB\u884C\u4E2D"}):null]}),(0,n.jsx)(Te,{template:e.bodyTemplate,instances:r.instances,activeInstanceId:t.activeInstanceId,onInstanceSelect:t.onInstanceSelect})]},r.iteration)})}),t.node.status==="blocked"?(0,n.jsxs)("div",{className:"v3r-cta",children:["\u26A0 \u8F6E\u6570\u8017\u5C3D\uFF0C\u7B49\u4EBA\u8FFD\u52A0 \u2014 \u98DE\u4E66\u5361\u7247\u70B9\u300C\u2795 \u8FFD\u52A0 1 \u8F6E\u300D\uFF0C\u6216 ",(0,n.jsxs)("code",{children:["botmux workflow grant ",t.runId]})]}):null]})}function Te(t){let e=(0,l.useMemo)(()=>new Map(t.instances.map(s=>[s.loop.bodyNodeId,s])),[t.instances]),o=(0,l.useMemo)(()=>Q(t.template,e),[t.template,e]);return(0,n.jsxs)("svg",{className:"v3r-mini-svg",width:o.width,height:o.height,viewBox:`0 0 ${o.width} ${o.height}`,children:[(0,n.jsx)("defs",{children:(0,n.jsx)("marker",{id:"v3arrow-mini",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"6",markerHeight:"6",orient:"auto-start-reverse",children:(0,n.jsx)("path",{d:"M0,0 L10,5 L0,10 z",fill:"var(--faint, #8b98aa)"})})}),o.edges.map(s=>(0,n.jsx)("path",{className:`v3r-edge${s.live?" live":""}`,d:`M${s.x1},${s.y1} C${s.mx},${s.y1} ${s.mx},${s.y2} ${s.x2},${s.y2}`,markerEnd:"url(#v3arrow-mini)"},`${s.fromId}->${s.toId}`)),o.nodes.map(s=>{let a=s.node,r=a?.status??"pending",d=a?.id===t.activeInstanceId;return(0,n.jsxs)("g",{className:`v3r-node v3r-mini st-${r}${d?" sel":""}${a?"":" ghost"}`,"data-sel":a?.id,style:a?{cursor:"pointer"}:void 0,onClick:u=>{a&&(u.stopPropagation(),t.onInstanceSelect(a.id))},children:[(0,n.jsx)("rect",{className:"v3r-box",x:s.x,y:s.y,width:s.width,height:s.height,rx:"8"}),(0,n.jsx)("circle",{className:"v3r-mini-dot",cx:s.x+13,cy:s.y+s.height/2,r:"3.4"}),(0,n.jsx)("text",{className:"v3r-nid",x:s.x+24,y:s.y+s.height/2+4,children:L(s.templateId,12)})]},s.templateId)})]})}function Me(t){let e=(0,l.useRef)(null),o=(0,l.useRef)(null),s=t.node?`${t.runId}|${t.node.id}|${H(t.node)}`:null;return(0,l.useEffect)(()=>{let a=e.current;if(a){if(!t.node||!s){a.innerHTML="",o.current=null;return}o.current!==s&&(Z(a,t.runId,t.node),o.current=s)}},[t.runId,t.node,s]),(0,n.jsx)("div",{id:"v3-term-slot",className:"v3r-term-slot",ref:e})}function ne(){let t=z();return(0,n.jsx)("section",{className:"page workflows-page v3-page",children:t?(0,n.jsx)(ye,{runId:t}):(0,n.jsx)(we,{})})}var se=S($(),1);function Xe(t){return O(t,(0,se.jsx)(ne,{}))}export{Xe as renderV3RunsPage};
@@ -0,0 +1 @@
1
+ import{a as E}from"./chunk-SOBMN2VY.js";import{c as B,k as C}from"./chunk-5QX4OYOR.js";import{d as T}from"./chunk-RHVFZC5Z.js";import"./chunk-QITAMHW6.js";import"./chunk-CK22743G.js";import{c as P}from"./chunk-XVIXNQGC.js";import{c as R,d as F,e as W}from"./chunk-CVNIMUPY.js";var s=R(F(),1);var e=R(W(),1);function G(t){let a=Date.parse(t);if(!a)return t||"-";let o=Math.max(0,Math.floor((Date.now()-a)/1e3));if(o<60)return`${o}s ago`;let i=Math.floor(o/60);if(i<60)return`${i}m ago`;let n=Math.floor(i/60);return n<24?`${n}h ago`:`${Math.floor(n/24)}d ago`}function K(t){return t.chatId?.trim()||"__local__"}function _(t,a){if(t==="__local__")return"\u672A\u7ED1\u5B9A\u7FA4 / \u672C\u5730\u767D\u677F";let o=a.get(t);return o&&o!==t?`${o} (${t})`:t}function z(t,a){let o=new Map;for(let i of t){let n=K(i),c=o.get(n)??[];c.push(i),o.set(n,c)}return[...o.entries()].map(([i,n])=>({chatId:i,label:_(i,a),rows:[...n].sort((c,b)=>b.updatedAt.localeCompare(c.updatedAt))})).sort((i,n)=>i.label.localeCompare(n.label))}function J(){return decodeURIComponent((location.hash.match(/^#\/whiteboards\/([^/]+)/)?.[1]??"").trim())}async function x(t,a){let o=await fetch(`/api/whiteboards/${encodeURIComponent(t)}`),i=await o.json().catch(()=>({}));if(o.ok)return{id:t,content:String(i.content??""),row:a.find(n=>n.id===t)}}async function Q(t){let a=new Map;if(!t?.ok)return a;let o=await t.json().catch(()=>({})),i=Array.isArray(o.chats)?o.chats:[];for(let n of i)n.chatId&&a.set(String(n.chatId),String(n.name||n.chatId));return a}function V(t){let a=t.row,o=a.title||a.id;return(0,e.jsxs)("a",{className:`wb-item${t.active?" active":""}`,"data-whiteboard-id":a.id,href:`#/whiteboards/${encodeURIComponent(a.id)}`,onClick:i=>{i.preventDefault(),t.onSelect(a.id)},children:[(0,e.jsx)("div",{className:"wb-item-head",children:(0,e.jsxs)("div",{className:"wb-item-main",children:[(0,e.jsx)("strong",{children:(0,e.jsx)(C,{text:o,textClassName:"wb-title-scroll"})}),(0,e.jsx)("span",{className:"wb-id-text",title:a.id,children:a.id})]})}),(0,e.jsxs)("div",{className:"wb-item-foot",children:[(0,e.jsxs)("div",{className:"wb-item-meta",children:[(0,e.jsx)("span",{children:G(a.updatedAt)}),(0,e.jsx)("span",{children:"\xB7"}),(0,e.jsxs)("span",{children:["log ",a.logCount]})]}),(0,e.jsx)("span",{className:"wb-scope",title:a.scope,children:a.scope})]})]})}function w(t){let a=t.value||"-";return(0,e.jsxs)("div",{className:"wb-meta-card",title:a,children:[(0,e.jsx)("span",{children:t.label}),(0,e.jsx)("strong",{children:a})]})}function X(t){let a=t.selected;if(!a)return(0,e.jsx)("p",{className:"empty",children:"\u9009\u62E9\u5DE6\u4FA7\u767D\u677F\u67E5\u770B meta \u548C board.md\u3002"});let o=a.row,i=o?.chatId?_(o.chatId,t.groupNames):"\u672A\u7ED1\u5B9A\u7FA4 / \u672C\u5730\u767D\u677F",n=o?.title||a.id;return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"wb-detail-head",children:[(0,e.jsxs)("div",{className:"wb-detail-title",children:[(0,e.jsx)("p",{className:"eyebrow",children:"WHITEBOARD"}),(0,e.jsx)("h2",{title:n,children:n}),(0,e.jsx)("code",{title:a.id,children:a.id})]}),(0,e.jsx)("button",{type:"button",className:"danger","data-delete-whiteboard":!0,onClick:t.onDelete,children:"\u5220\u9664\u767D\u677F"})]}),(0,e.jsxs)("div",{className:"wb-meta-grid",children:[(0,e.jsx)(w,{label:"\u6240\u5C5E\u7FA4",value:i}),(0,e.jsx)(w,{label:"\u8303\u56F4",value:o?.scope??"-"}),(0,e.jsx)(w,{label:"\u6700\u8FD1\u66F4\u65B0",value:o?.updatedAt?G(o.updatedAt):"-"}),(0,e.jsx)(w,{label:"\u6765\u6E90\u76EE\u5F55",value:o?.workingDir??"-"})]}),(0,e.jsxs)("details",{className:"wb-admin-info",children:[(0,e.jsx)("summary",{children:"\u7BA1\u7406\u4FE1\u606F / \u6587\u4EF6\u8DEF\u5F84"}),(0,e.jsx)("code",{children:o?.path??""})]}),(0,e.jsxs)("section",{className:"wb-board-panel",children:[(0,e.jsxs)("div",{className:"wb-board-panel-head",children:[(0,e.jsx)("strong",{children:"board.md"}),(0,e.jsx)("span",{children:"\u53EA\u8BFB\u9884\u89C8"})]}),(0,e.jsx)("pre",{children:a.content||"\uFF08\u6682\u65E0\u5185\u5BB9\uFF09"})]})]})}function Y(t){let a=t.selected.row?.title||t.selected.id;return(0,e.jsx)("div",{className:"wb-delete-backdrop","data-delete-modal":!0,onClick:o=>{o.target===o.currentTarget&&t.onCancel()},children:(0,e.jsxs)("div",{className:"wb-delete-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"wb-delete-title",children:[(0,e.jsxs)("div",{className:"wb-delete-body",children:[(0,e.jsx)("div",{className:"wb-delete-mark","aria-hidden":"true",children:"!"}),(0,e.jsxs)("div",{children:[(0,e.jsx)("h3",{id:"wb-delete-title",children:"\u5220\u9664\u767D\u677F\uFF1F"}),(0,e.jsxs)("p",{children:["\u5C06\u5220\u9664 ",(0,e.jsx)("strong",{children:a}),"\uFF08",(0,e.jsx)("code",{children:t.selected.id}),"\uFF09\u7684 board\u3001log\u3001meta\uFF0C\u5E76\u6E05\u7406\u9ED8\u8BA4\u7ED1\u5B9A\u548C\u4F1A\u8BDD\u5F15\u7528\u3002\u6B64\u64CD\u4F5C\u4E0D\u53EF\u6062\u590D\u3002"]})]})]}),(0,e.jsxs)("div",{className:"actions wb-delete-actions",children:[(0,e.jsx)("button",{type:"button","data-delete-cancel":!0,onClick:t.onCancel,disabled:t.deleting,children:"\u53D6\u6D88"}),(0,e.jsx)("button",{type:"button",className:"danger","data-delete-confirm":!0,onClick:t.onConfirm,disabled:t.deleting,children:t.deleting?"\u5220\u9664\u4E2D...":"\u786E\u8BA4\u5220\u9664"})]})]})})}function Z(){let t=T(),a=(0,s.useRef)(!1),o=(0,s.useRef)(0),[i,n]=(0,s.useState)(!1),[c,b]=(0,s.useState)([]),[g,H]=(0,s.useState)(()=>new Map),[m,f]=(0,s.useState)(),[L,S]=(0,s.useState)(!0),[k,M]=(0,s.useState)(null),[u,h]=(0,s.useState)(null),[U,D]=(0,s.useState)(!1),I=(0,s.useMemo)(()=>z(c,g),[c,g]);(0,s.useEffect)(()=>{a.current=!0;let r=J();async function d(){S(!0);try{let[l,y]=await Promise.all([fetch("/api/whiteboards"),fetch("/api/groups").catch(()=>null)]),p=await l.json().catch(()=>({}));if(!l.ok)throw new Error(p?.error??`HTTP ${l.status}`);let O=await Q(y),$=Array.isArray(p.whiteboards)?p.whiteboards:[],A;if(r&&(A=await x(r,$)),!a.current)return;n(p.enabled===!0),b($),H(O),f(A),M(null)}catch(l){a.current&&M(l instanceof Error?l.message:String(l))}finally{a.current&&S(!1)}}return d(),()=>{a.current=!1,o.current+=1}},[]);async function j(r){let d=o.current+1;o.current=d;let l=await x(r,c);!a.current||o.current!==d||!l||(f(l),window.history.replaceState(null,"",`#/whiteboards/${encodeURIComponent(r)}`))}async function q(){if(u){D(!0);try{let r=await fetch(`/api/whiteboards/${encodeURIComponent(u.id)}`,{method:"DELETE"}),d=await r.json().catch(()=>({}));if(!r.ok||d.ok===!1)throw new Error(d?.error??`HTTP ${r.status}`);if(!a.current)return;b(l=>l.filter(y=>y.id!==u.id)),m?.id===u.id&&(f(void 0),window.history.replaceState(null,"","#/whiteboards")),h(null)}catch(r){a.current&&E(`\u5220\u9664\u5931\u8D25\uFF1A${r instanceof Error?r.message:String(r)}`,{kind:"error"})}finally{a.current&&D(!1)}}}let v="\u767D\u677F\u80FD\u529B\u5F53\u524D\u5173\u95ED\uFF1A\u4E0D\u4F1A\u81EA\u52A8\u521B\u5EFA/\u7ED1\u5B9A\u767D\u677F\uFF0C\u4E5F\u4E0D\u4F1A\u6CE8\u5165\u5230 agent prompt\u3002\u5386\u53F2\u767D\u677F\u4EC5\u5728 dashboard \u4E2D\u53EA\u8BFB\u53EF\u89C1\uFF0C\u53EF\u5728\u6B64\u6E05\u7406\u3002",N=(r=!1)=>(0,e.jsx)("div",{className:"page-heading",children:(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:"eyebrow",children:t("nav.whiteboards")}),(0,e.jsx)("h1",{children:t("nav.whiteboards")}),r?(0,e.jsx)("span",{className:"wb-disabled-pill",title:v,"aria-label":v,children:v}):null]})});return k?(0,e.jsxs)("section",{className:"page whiteboards-page",children:[N(),(0,e.jsxs)("p",{className:"hint-warn",children:["\u52A0\u8F7D\u767D\u677F\u5931\u8D25\uFF1A",k]})]}):L?(0,e.jsxs)("section",{className:"page whiteboards-page","data-whiteboards-host":!0,children:[N(),(0,e.jsx)(B,{label:t("common.loading")})]}):(0,e.jsxs)("section",{className:"page whiteboards-page",children:[N(!i),(0,e.jsxs)("div",{className:"wb-split",children:[(0,e.jsx)("section",{className:"overview-block wb-list-block",children:(0,e.jsx)("div",{className:"wb-list-panel",children:I.length===0?(0,e.jsx)("p",{className:"empty wb-empty",children:"\u6682\u65E0\u767D\u677F\u3002\u6253\u5F00\u80FD\u529B\u540E\uFF0C\u6BCF\u4E2A\u7FA4\u9996\u6B21\u9700\u8981\u767D\u677F\u65F6\u624D\u4F1A\u521B\u5EFA\u9ED8\u8BA4\u767D\u677F\u3002"}):I.map(r=>(0,e.jsxs)("details",{className:"wb-group",open:!0,children:[(0,e.jsxs)("summary",{children:[(0,e.jsx)("span",{className:"wb-group-title",children:(0,e.jsx)(C,{text:r.label,textClassName:"wb-group-title-scroll"})}),(0,e.jsx)("small",{children:r.rows.length})]}),(0,e.jsx)("div",{className:"wb-group-items",children:r.rows.map(d=>(0,e.jsx)(V,{row:d,active:m?.id===d.id,onSelect:l=>{j(l)}},d.id))})]},r.chatId))})}),(0,e.jsx)("section",{className:"overview-block wb-detail-block",children:(0,e.jsx)("div",{className:"wb-detail-panel",id:"whiteboard-detail",children:(0,e.jsx)(X,{selected:m,groupNames:g,onDelete:()=>{m&&h(m)}})})})]}),u?(0,e.jsx)(Y,{selected:u,deleting:U,onCancel:()=>h(null),onConfirm:()=>{q()}}):null]})}function ne(t){return P(t,(0,e.jsx)(Z,{}))}export{ne as renderWhiteboardsPage};