@sapienx/agentos 0.5.6 → 0.5.8

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 (277) hide show
  1. package/bin/agentos.js +113 -2
  2. package/bin/terminal-boot.js +380 -76
  3. package/bundle/.next/BUILD_ID +1 -1
  4. package/bundle/.next/app-path-routes-manifest.json +16 -9
  5. package/bundle/.next/build-manifest.json +6 -6
  6. package/bundle/.next/prerender-manifest.json +3 -3
  7. package/bundle/.next/react-loadable-manifest.json +4 -4
  8. package/bundle/.next/required-server-files.json +1 -1
  9. package/bundle/.next/routes-manifest.json +44 -0
  10. package/bundle/.next/server/app/_global-error/page.js +2 -2
  11. package/bundle/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  12. package/bundle/.next/server/app/_global-error.html +1 -1
  13. package/bundle/.next/server/app/_global-error.rsc +4 -4
  14. package/bundle/.next/server/app/_global-error.segments/_full.segment.rsc +4 -4
  15. package/bundle/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  16. package/bundle/.next/server/app/_global-error.segments/_global-error.segment.rsc +3 -3
  17. package/bundle/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  18. package/bundle/.next/server/app/_global-error.segments/_index.segment.rsc +3 -3
  19. package/bundle/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  20. package/bundle/.next/server/app/_not-found/page.js +2 -2
  21. package/bundle/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  22. package/bundle/.next/server/app/_not-found.html +1 -1
  23. package/bundle/.next/server/app/_not-found.rsc +7 -7
  24. package/bundle/.next/server/app/_not-found.segments/_full.segment.rsc +7 -7
  25. package/bundle/.next/server/app/_not-found.segments/_head.segment.rsc +2 -2
  26. package/bundle/.next/server/app/_not-found.segments/_index.segment.rsc +5 -5
  27. package/bundle/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  28. package/bundle/.next/server/app/_not-found.segments/_not-found.segment.rsc +3 -3
  29. package/bundle/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  30. package/bundle/.next/server/app/agents/page.js +2 -0
  31. package/bundle/.next/server/app/agents/page.js.nft.json +1 -0
  32. package/bundle/.next/server/app/agents/page_client-reference-manifest.js +1 -0
  33. package/bundle/.next/server/app/api/agents/[agentId]/chat/route.js +4 -4
  34. package/bundle/.next/server/app/api/agents/[agentId]/chat/route.js.nft.json +1 -1
  35. package/bundle/.next/server/app/api/agents/route.js +1 -1
  36. package/bundle/.next/server/app/api/agents/route.js.nft.json +1 -1
  37. package/bundle/.next/server/app/api/diagnostics/route.js +1 -1
  38. package/bundle/.next/server/app/api/diagnostics/route.js.nft.json +1 -1
  39. package/bundle/.next/server/app/api/files/reveal/route.js +1 -1
  40. package/bundle/.next/server/app/api/gateway/control/route.js +1 -1
  41. package/bundle/.next/server/app/api/gateway/control/route.js.nft.json +1 -1
  42. package/bundle/.next/server/app/api/integrations/[integrationId]/status/route.js +1 -0
  43. package/bundle/.next/server/app/api/integrations/[integrationId]/status/route.js.nft.json +1 -0
  44. package/bundle/.next/server/app/api/integrations/[integrationId]/status/route_client-reference-manifest.js +1 -0
  45. package/bundle/.next/server/app/api/mission/route.js +1 -1
  46. package/bundle/.next/server/app/api/mission/route.js.nft.json +1 -1
  47. package/bundle/.next/server/app/api/models/catalog/route.js +2 -2
  48. package/bundle/.next/server/app/api/models/catalog/route.js.nft.json +1 -1
  49. package/bundle/.next/server/app/api/models/providers/route.js +2 -2
  50. package/bundle/.next/server/app/api/models/providers/route.js.nft.json +1 -1
  51. package/bundle/.next/server/app/api/onboarding/models/route.js +3 -3
  52. package/bundle/.next/server/app/api/onboarding/models/route.js.nft.json +1 -1
  53. package/bundle/.next/server/app/api/onboarding/route.js +2 -2
  54. package/bundle/.next/server/app/api/onboarding/route.js.nft.json +1 -1
  55. package/bundle/.next/server/app/api/openclaw/capabilities/route.js +1 -1
  56. package/bundle/.next/server/app/api/openclaw/capabilities/route.js.nft.json +1 -1
  57. package/bundle/.next/server/app/api/openclaw/compatibility-smoke/route.js +1 -0
  58. package/bundle/.next/server/app/api/openclaw/compatibility-smoke/route.js.nft.json +1 -0
  59. package/bundle/.next/server/app/api/openclaw/compatibility-smoke/route_client-reference-manifest.js +1 -0
  60. package/bundle/.next/server/app/api/planner/[planId]/deploy/route.js +2 -2
  61. package/bundle/.next/server/app/api/planner/[planId]/deploy/route.js.nft.json +1 -1
  62. package/bundle/.next/server/app/api/planner/[planId]/document-rewrite/route.js +1 -1
  63. package/bundle/.next/server/app/api/planner/[planId]/document-rewrite/route.js.nft.json +1 -1
  64. package/bundle/.next/server/app/api/planner/[planId]/route.js +1 -1
  65. package/bundle/.next/server/app/api/planner/[planId]/route.js.nft.json +1 -1
  66. package/bundle/.next/server/app/api/planner/[planId]/simulate/route.js +1 -1
  67. package/bundle/.next/server/app/api/planner/[planId]/simulate/route.js.nft.json +1 -1
  68. package/bundle/.next/server/app/api/planner/[planId]/turn/route.js +1 -1
  69. package/bundle/.next/server/app/api/planner/[planId]/turn/route.js.nft.json +1 -1
  70. package/bundle/.next/server/app/api/planner/route.js +1 -1
  71. package/bundle/.next/server/app/api/planner/route.js.nft.json +1 -1
  72. package/bundle/.next/server/app/api/reset/route.js +2 -2
  73. package/bundle/.next/server/app/api/reset/route.js.nft.json +1 -1
  74. package/bundle/.next/server/app/api/runtimes/[runtimeId]/route.js +1 -1
  75. package/bundle/.next/server/app/api/runtimes/[runtimeId]/route.js.nft.json +1 -1
  76. package/bundle/.next/server/app/api/settings/gateway/route.js +1 -1
  77. package/bundle/.next/server/app/api/settings/gateway/route.js.nft.json +1 -1
  78. package/bundle/.next/server/app/api/settings/openclaw-binary/route.js +1 -1
  79. package/bundle/.next/server/app/api/settings/openclaw-binary/route.js.nft.json +1 -1
  80. package/bundle/.next/server/app/api/settings/workspace-root/route.js +1 -1
  81. package/bundle/.next/server/app/api/settings/workspace-root/route.js.nft.json +1 -1
  82. package/bundle/.next/server/app/api/snapshot/route.js +1 -1
  83. package/bundle/.next/server/app/api/snapshot/route.js.nft.json +1 -1
  84. package/bundle/.next/server/app/api/stream/route.js +2 -2
  85. package/bundle/.next/server/app/api/stream/route.js.nft.json +1 -1
  86. package/bundle/.next/server/app/api/system/open-terminal/route.js +1 -1
  87. package/bundle/.next/server/app/api/tasks/[taskId]/abort/route.js +1 -1
  88. package/bundle/.next/server/app/api/tasks/[taskId]/abort/route.js.nft.json +1 -1
  89. package/bundle/.next/server/app/api/tasks/[taskId]/control/route.js +1 -1
  90. package/bundle/.next/server/app/api/tasks/[taskId]/control/route.js.nft.json +1 -1
  91. package/bundle/.next/server/app/api/tasks/[taskId]/stream/route.js +2 -2
  92. package/bundle/.next/server/app/api/tasks/[taskId]/stream/route.js.nft.json +1 -1
  93. package/bundle/.next/server/app/api/update/route.js +2 -2
  94. package/bundle/.next/server/app/api/update/route.js.nft.json +1 -1
  95. package/bundle/.next/server/app/api/workspaces/[workspaceId]/channels/discovered-groups/route.js +1 -1
  96. package/bundle/.next/server/app/api/workspaces/[workspaceId]/channels/discovered-groups/route.js.nft.json +1 -1
  97. package/bundle/.next/server/app/api/workspaces/[workspaceId]/channels/route.js +1 -1
  98. package/bundle/.next/server/app/api/workspaces/[workspaceId]/channels/route.js.nft.json +1 -1
  99. package/bundle/.next/server/app/api/workspaces/[workspaceId]/edit-draft/route.js +1 -1
  100. package/bundle/.next/server/app/api/workspaces/[workspaceId]/edit-draft/route.js.nft.json +1 -1
  101. package/bundle/.next/server/app/api/workspaces/[workspaceId]/files/route.js +1 -1
  102. package/bundle/.next/server/app/api/workspaces/[workspaceId]/files/route.js.nft.json +1 -1
  103. package/bundle/.next/server/app/api/workspaces/[workspaceId]/surfaces/discovery/route.js +1 -1
  104. package/bundle/.next/server/app/api/workspaces/[workspaceId]/surfaces/discovery/route.js.nft.json +1 -1
  105. package/bundle/.next/server/app/api/workspaces/route.js +2 -2
  106. package/bundle/.next/server/app/api/workspaces/route.js.nft.json +1 -1
  107. package/bundle/.next/server/app/files/page.js +2 -0
  108. package/bundle/.next/server/app/files/page.js.nft.json +1 -0
  109. package/bundle/.next/server/app/files/page_client-reference-manifest.js +1 -0
  110. package/bundle/.next/server/app/integrations/page.js +2 -0
  111. package/bundle/.next/server/app/integrations/page.js.nft.json +1 -0
  112. package/bundle/.next/server/app/integrations/page_client-reference-manifest.js +1 -0
  113. package/bundle/.next/server/app/models/page.js +2 -0
  114. package/bundle/.next/server/app/models/page.js.nft.json +1 -0
  115. package/bundle/.next/server/app/models/page_client-reference-manifest.js +1 -0
  116. package/bundle/.next/server/app/page.js +2 -2
  117. package/bundle/.next/server/app/page.js.nft.json +1 -1
  118. package/bundle/.next/server/app/page_client-reference-manifest.js +1 -1
  119. package/bundle/.next/server/app/settings/page.js +2 -2
  120. package/bundle/.next/server/app/settings/page.js.nft.json +1 -1
  121. package/bundle/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  122. package/bundle/.next/server/app/tasks/page.js +2 -0
  123. package/bundle/.next/server/app/tasks/page.js.nft.json +1 -0
  124. package/bundle/.next/server/app/tasks/page_client-reference-manifest.js +1 -0
  125. package/bundle/.next/server/app-paths-manifest.json +16 -9
  126. package/bundle/.next/server/chunks/1718.js +4 -0
  127. package/bundle/.next/server/chunks/4391.js +198 -0
  128. package/bundle/.next/server/chunks/4466.js +9 -0
  129. package/bundle/.next/server/chunks/4767.js +1 -4
  130. package/bundle/.next/server/chunks/4983.js +1 -0
  131. package/bundle/.next/server/chunks/5151.js +15 -5
  132. package/bundle/.next/server/chunks/6476.js +13 -0
  133. package/bundle/.next/server/chunks/7396.js +7 -0
  134. package/bundle/.next/server/chunks/8621.js +1 -0
  135. package/bundle/.next/server/chunks/8849.js +1 -0
  136. package/bundle/.next/server/functions-config-manifest.json +2 -0
  137. package/bundle/.next/server/middleware-build-manifest.js +1 -1
  138. package/bundle/.next/server/middleware-react-loadable-manifest.js +1 -1
  139. package/bundle/.next/server/pages/404.html +1 -1
  140. package/bundle/.next/server/pages/500.html +1 -1
  141. package/bundle/.next/server/server-reference-manifest.json +1 -1
  142. package/bundle/.next/static/JwIu-FqrfB4Nerk5vBqR2/_buildManifest.js +1 -0
  143. package/bundle/.next/static/chunks/1994.2c1ce6369c0b31aa.js +1 -0
  144. package/bundle/.next/static/chunks/2083-7a341dd360f54c8b.js +1 -0
  145. package/bundle/.next/static/chunks/2396-395f5ed99e66819d.js +1 -0
  146. package/bundle/.next/static/chunks/2842.b8d0551fd4d397d4.js +1 -0
  147. package/bundle/.next/static/chunks/331-518938b9d1e94c9c.js +1 -0
  148. package/bundle/.next/static/chunks/3315-597211dffe007157.js +7 -0
  149. package/bundle/.next/static/chunks/4424-805347abcfa4dab9.js +32 -0
  150. package/bundle/.next/static/chunks/4a846800.ef93163f41628d6f.js +1 -0
  151. package/bundle/.next/static/chunks/6276-fdd5e81abda749e8.js +9 -0
  152. package/bundle/.next/static/chunks/7442-5ed5b8f501838da4.js +198 -0
  153. package/bundle/.next/static/chunks/8583-7994af81ac8b7330.js +1 -0
  154. package/bundle/.next/static/chunks/app/_global-error/page-8443c62570b9a078.js +1 -0
  155. package/bundle/.next/static/chunks/app/_not-found/page-8443c62570b9a078.js +1 -0
  156. package/bundle/.next/static/chunks/app/agents/page-a48b3909fe8cc49b.js +1 -0
  157. package/bundle/.next/static/chunks/app/api/agents/[agentId]/chat/route-8443c62570b9a078.js +1 -0
  158. package/bundle/.next/static/chunks/app/api/agents/route-8443c62570b9a078.js +1 -0
  159. package/bundle/.next/static/chunks/app/api/diagnostics/route-8443c62570b9a078.js +1 -0
  160. package/bundle/.next/static/chunks/app/api/files/reveal/route-8443c62570b9a078.js +1 -0
  161. package/bundle/.next/static/chunks/app/api/gateway/control/route-8443c62570b9a078.js +1 -0
  162. package/bundle/.next/static/chunks/app/api/integrations/[integrationId]/status/route-8443c62570b9a078.js +1 -0
  163. package/bundle/.next/static/chunks/app/api/mission/route-8443c62570b9a078.js +1 -0
  164. package/bundle/.next/static/chunks/app/api/models/catalog/route-8443c62570b9a078.js +1 -0
  165. package/bundle/.next/static/chunks/app/api/models/providers/route-8443c62570b9a078.js +1 -0
  166. package/bundle/.next/static/chunks/app/api/onboarding/models/route-8443c62570b9a078.js +1 -0
  167. package/bundle/.next/static/chunks/app/api/onboarding/route-8443c62570b9a078.js +1 -0
  168. package/bundle/.next/static/chunks/app/api/openclaw/capabilities/route-8443c62570b9a078.js +1 -0
  169. package/bundle/.next/static/chunks/app/api/openclaw/compatibility-smoke/route-8443c62570b9a078.js +1 -0
  170. package/bundle/.next/static/chunks/app/api/planner/[planId]/deploy/route-8443c62570b9a078.js +1 -0
  171. package/bundle/.next/static/chunks/app/api/planner/[planId]/document-rewrite/route-8443c62570b9a078.js +1 -0
  172. package/bundle/.next/static/chunks/app/api/planner/[planId]/route-8443c62570b9a078.js +1 -0
  173. package/bundle/.next/static/chunks/app/api/planner/[planId]/simulate/route-8443c62570b9a078.js +1 -0
  174. package/bundle/.next/static/chunks/app/api/planner/[planId]/turn/route-8443c62570b9a078.js +1 -0
  175. package/bundle/.next/static/chunks/app/api/planner/route-8443c62570b9a078.js +1 -0
  176. package/bundle/.next/static/chunks/app/api/reset/route-8443c62570b9a078.js +1 -0
  177. package/bundle/.next/static/chunks/app/api/runtimes/[runtimeId]/route-8443c62570b9a078.js +1 -0
  178. package/bundle/.next/static/chunks/app/api/settings/gateway/route-8443c62570b9a078.js +1 -0
  179. package/bundle/.next/static/chunks/app/api/settings/openclaw-binary/route-8443c62570b9a078.js +1 -0
  180. package/bundle/.next/static/chunks/app/api/settings/workspace-root/route-8443c62570b9a078.js +1 -0
  181. package/bundle/.next/static/chunks/app/api/snapshot/route-8443c62570b9a078.js +1 -0
  182. package/bundle/.next/static/chunks/app/api/stream/route-8443c62570b9a078.js +1 -0
  183. package/bundle/.next/static/chunks/app/api/system/open-terminal/route-8443c62570b9a078.js +1 -0
  184. package/bundle/.next/static/chunks/app/api/tasks/[taskId]/abort/route-8443c62570b9a078.js +1 -0
  185. package/bundle/.next/static/chunks/app/api/tasks/[taskId]/control/route-8443c62570b9a078.js +1 -0
  186. package/bundle/.next/static/chunks/app/api/tasks/[taskId]/stream/route-8443c62570b9a078.js +1 -0
  187. package/bundle/.next/static/chunks/app/api/update/route-8443c62570b9a078.js +1 -0
  188. package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/channels/discovered-groups/route-8443c62570b9a078.js +1 -0
  189. package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/channels/route-8443c62570b9a078.js +1 -0
  190. package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/edit-draft/route-8443c62570b9a078.js +1 -0
  191. package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/files/route-8443c62570b9a078.js +1 -0
  192. package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/surfaces/discovery/route-8443c62570b9a078.js +1 -0
  193. package/bundle/.next/static/chunks/app/api/workspaces/route-8443c62570b9a078.js +1 -0
  194. package/bundle/.next/static/chunks/app/files/page-a0e2fdb9c72008d3.js +1 -0
  195. package/bundle/.next/static/chunks/app/integrations/page-fbeb03fb416b56e4.js +1 -0
  196. package/bundle/.next/static/chunks/app/layout-a58705d0aa0318d2.js +1 -0
  197. package/bundle/.next/static/chunks/app/models/page-a22fedc08112e7a0.js +1 -0
  198. package/bundle/.next/static/chunks/app/not-found-8443c62570b9a078.js +1 -0
  199. package/bundle/.next/static/chunks/app/page-4f990fddc5f18dcf.js +1 -0
  200. package/bundle/.next/static/chunks/app/settings/page-28f1484e79b1be1f.js +1 -0
  201. package/bundle/.next/static/chunks/app/tasks/page-89536b0bec007ced.js +1 -0
  202. package/bundle/.next/static/chunks/d08e407b-86b21ef93cdf4fa3.js +1 -0
  203. package/bundle/.next/static/chunks/f6503f1c-1272160a304f8b44.js +1 -0
  204. package/bundle/.next/static/chunks/framework-840804a6e17cee72.js +1 -0
  205. package/bundle/.next/static/chunks/main-529ff68c072bfd3e.js +5 -0
  206. package/bundle/.next/static/chunks/main-app-70892a7dc1723083.js +1 -0
  207. package/bundle/.next/static/chunks/next/dist/client/components/builtin/app-error-8443c62570b9a078.js +1 -0
  208. package/bundle/.next/static/chunks/next/dist/client/components/builtin/forbidden-8443c62570b9a078.js +1 -0
  209. package/bundle/.next/static/chunks/next/dist/client/components/builtin/global-error-307c6fd9c934218d.js +1 -0
  210. package/bundle/.next/static/chunks/next/dist/client/components/builtin/unauthorized-8443c62570b9a078.js +1 -0
  211. package/bundle/.next/static/chunks/{webpack-49728cc9bb386219.js → webpack-1e021d6850c9ac01.js} +1 -1
  212. package/bundle/.next/static/css/288b13e5308447b9.css +3 -0
  213. package/bundle/server.js +1 -1
  214. package/package.json +1 -1
  215. package/bundle/.next/server/chunks/6639.js +0 -13
  216. package/bundle/.next/server/chunks/7125.js +0 -188
  217. package/bundle/.next/server/chunks/8155.js +0 -15
  218. package/bundle/.next/static/chunks/1994.af8e615920391b12.js +0 -1
  219. package/bundle/.next/static/chunks/2798.05bb8e435bca457c.js +0 -1
  220. package/bundle/.next/static/chunks/3254-31132332d1368b3c.js +0 -15
  221. package/bundle/.next/static/chunks/4424-08671f25c8f9ae84.js +0 -32
  222. package/bundle/.next/static/chunks/4a846800.17bbc9efb621dbb7.js +0 -1
  223. package/bundle/.next/static/chunks/7442-e148a49efcfa2d32.js +0 -188
  224. package/bundle/.next/static/chunks/8583-0efb0aa0937b762c.js +0 -1
  225. package/bundle/.next/static/chunks/app/_global-error/page-a39fe5a18111b91d.js +0 -1
  226. package/bundle/.next/static/chunks/app/_not-found/page-a39fe5a18111b91d.js +0 -1
  227. package/bundle/.next/static/chunks/app/api/agents/[agentId]/chat/route-a39fe5a18111b91d.js +0 -1
  228. package/bundle/.next/static/chunks/app/api/agents/route-a39fe5a18111b91d.js +0 -1
  229. package/bundle/.next/static/chunks/app/api/diagnostics/route-a39fe5a18111b91d.js +0 -1
  230. package/bundle/.next/static/chunks/app/api/files/reveal/route-a39fe5a18111b91d.js +0 -1
  231. package/bundle/.next/static/chunks/app/api/gateway/control/route-a39fe5a18111b91d.js +0 -1
  232. package/bundle/.next/static/chunks/app/api/mission/route-a39fe5a18111b91d.js +0 -1
  233. package/bundle/.next/static/chunks/app/api/models/catalog/route-a39fe5a18111b91d.js +0 -1
  234. package/bundle/.next/static/chunks/app/api/models/providers/route-a39fe5a18111b91d.js +0 -1
  235. package/bundle/.next/static/chunks/app/api/onboarding/models/route-a39fe5a18111b91d.js +0 -1
  236. package/bundle/.next/static/chunks/app/api/onboarding/route-a39fe5a18111b91d.js +0 -1
  237. package/bundle/.next/static/chunks/app/api/openclaw/capabilities/route-a39fe5a18111b91d.js +0 -1
  238. package/bundle/.next/static/chunks/app/api/planner/[planId]/deploy/route-a39fe5a18111b91d.js +0 -1
  239. package/bundle/.next/static/chunks/app/api/planner/[planId]/document-rewrite/route-a39fe5a18111b91d.js +0 -1
  240. package/bundle/.next/static/chunks/app/api/planner/[planId]/route-a39fe5a18111b91d.js +0 -1
  241. package/bundle/.next/static/chunks/app/api/planner/[planId]/simulate/route-a39fe5a18111b91d.js +0 -1
  242. package/bundle/.next/static/chunks/app/api/planner/[planId]/turn/route-a39fe5a18111b91d.js +0 -1
  243. package/bundle/.next/static/chunks/app/api/planner/route-a39fe5a18111b91d.js +0 -1
  244. package/bundle/.next/static/chunks/app/api/reset/route-a39fe5a18111b91d.js +0 -1
  245. package/bundle/.next/static/chunks/app/api/runtimes/[runtimeId]/route-a39fe5a18111b91d.js +0 -1
  246. package/bundle/.next/static/chunks/app/api/settings/gateway/route-a39fe5a18111b91d.js +0 -1
  247. package/bundle/.next/static/chunks/app/api/settings/openclaw-binary/route-a39fe5a18111b91d.js +0 -1
  248. package/bundle/.next/static/chunks/app/api/settings/workspace-root/route-a39fe5a18111b91d.js +0 -1
  249. package/bundle/.next/static/chunks/app/api/snapshot/route-a39fe5a18111b91d.js +0 -1
  250. package/bundle/.next/static/chunks/app/api/stream/route-a39fe5a18111b91d.js +0 -1
  251. package/bundle/.next/static/chunks/app/api/system/open-terminal/route-a39fe5a18111b91d.js +0 -1
  252. package/bundle/.next/static/chunks/app/api/tasks/[taskId]/abort/route-a39fe5a18111b91d.js +0 -1
  253. package/bundle/.next/static/chunks/app/api/tasks/[taskId]/control/route-a39fe5a18111b91d.js +0 -1
  254. package/bundle/.next/static/chunks/app/api/tasks/[taskId]/stream/route-a39fe5a18111b91d.js +0 -1
  255. package/bundle/.next/static/chunks/app/api/update/route-a39fe5a18111b91d.js +0 -1
  256. package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/channels/discovered-groups/route-a39fe5a18111b91d.js +0 -1
  257. package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/channels/route-a39fe5a18111b91d.js +0 -1
  258. package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/edit-draft/route-a39fe5a18111b91d.js +0 -1
  259. package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/files/route-a39fe5a18111b91d.js +0 -1
  260. package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/surfaces/discovery/route-a39fe5a18111b91d.js +0 -1
  261. package/bundle/.next/static/chunks/app/api/workspaces/route-a39fe5a18111b91d.js +0 -1
  262. package/bundle/.next/static/chunks/app/layout-7c2d7e515f68248b.js +0 -1
  263. package/bundle/.next/static/chunks/app/not-found-a39fe5a18111b91d.js +0 -1
  264. package/bundle/.next/static/chunks/app/page-9bd535a80e3968e2.js +0 -1
  265. package/bundle/.next/static/chunks/app/settings/page-3794e22c77091d4b.js +0 -1
  266. package/bundle/.next/static/chunks/d08e407b-a7a2691dd8d9de6b.js +0 -1
  267. package/bundle/.next/static/chunks/f6503f1c-7df4e7c4564148dc.js +0 -1
  268. package/bundle/.next/static/chunks/framework-c8a5f18418cd0e86.js +0 -1
  269. package/bundle/.next/static/chunks/main-2c126219b824eed3.js +0 -5
  270. package/bundle/.next/static/chunks/main-app-9a4481b0ab7b57f6.js +0 -1
  271. package/bundle/.next/static/chunks/next/dist/client/components/builtin/app-error-a39fe5a18111b91d.js +0 -1
  272. package/bundle/.next/static/chunks/next/dist/client/components/builtin/forbidden-a39fe5a18111b91d.js +0 -1
  273. package/bundle/.next/static/chunks/next/dist/client/components/builtin/global-error-38aa72b47d0b8f99.js +0 -1
  274. package/bundle/.next/static/chunks/next/dist/client/components/builtin/unauthorized-a39fe5a18111b91d.js +0 -1
  275. package/bundle/.next/static/css/7b10ac9fa66d7c17.css +0 -3
  276. package/bundle/.next/static/ujFbMZ9arxb7I3_g4GzfY/_buildManifest.js +0 -1
  277. /package/bundle/.next/static/{ujFbMZ9arxb7I3_g4GzfY → JwIu-FqrfB4Nerk5vBqR2}/_ssgManifest.js +0 -0
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2083],{68956:(e,t,s)=>{"use strict";s.d(t,{OperationsPage:()=>tc});var a=s(36366),n=s(70430),l=s(85134),i=s(73875),r=s(3324),o=s(48758),c=s(33295),d=s(96551),p=s(87408),u=s(75167),m=s(87618),x=s(33494),h=s(8894),g=s(52493),b=s(47183),f=s(92172),v=s(4606),j=s(22937),w=s(20307),y=s(95433),N=s(78318),k=s(93479),C=s(72279),A=s(87515),S=s(1674),L=s(45927),M=s(47180),T=s(41363),O=s(82625),P=s(38402),I=s(8087),R=s(6734),$=s(8482),U=s(2946),z=s(15411),D=s(75903),F=s(50592),W=s(47697),E=s(91980),q=s(74213),_=s(75544),B=s(47322),H=s(85247),G=s(73294),K=s(3342),J=s(38413),V=s(63956),X=s(25336),Q=s(76077),Y=s(19443),Z=s(24687),ee=s(1033),et=s(42394),es=s(10910),ea=s(63406),en=s(81210),el=s(95236),ei=s(66159),er=s(99350),eo=s(1214),ec=s(6246),ed=s(23083),ep=s(82711),eu=s(72427);let em="https://docs.openclaw.ai/cli/models";function ex(e){let t=(0,eu.rY)(e.provider),s=t.provisionFields.filter(e=>e.required).map(e=>e.label);return{id:e.id,name:e.name??t.label,category:e.category,description:e.description??t.description,managedBy:"openclaw",providerType:t.kind,surfaceProvider:e.provider,surfaceKind:t.kind,permissions:e.permissions,setupRequirements:s.length>0?s:t.provisionFields.map(e=>e.label).slice(0,4),configure:{supported:t.supportsProvisioning,reason:t.supportsProvisioning?"Managed by the existing AgentOS workspace surface setup flow.":"OpenClaw does not expose provisioning fields for this surface yet."},reconnect:{supported:!0,reason:"Uses OpenClaw Gateway channels.status when available, with the existing adapter fallback."},disable:{supported:!0,reason:"Can disconnect the workspace surface binding through the existing workspace channels API."},docsUrl:null}}let eh=[ex({id:"telegram",provider:"telegram",category:"Communication",permissions:["Chat routing","Group routing","Bot token required","Route discovery"]}),ex({id:"discord",provider:"discord",category:"Communication",permissions:["Server routing","Channel routing","Bot token required","Route discovery"]}),ex({id:"gmail",provider:"gmail",category:"Communication",permissions:["Inbox access","Webhook triggers","Draft/send workflow","OAuth or Pub/Sub configuration"]}),ex({id:"slack",provider:"slack",category:"Productivity",permissions:["Workspace chat","Channel alerts","Bot token required"]}),ex({id:"google-chat",provider:"googlechat",name:"Google Chat",category:"Communication",permissions:["Space alerts","Webhook delivery","Webhook URL required"]}),ex({id:"email",provider:"email",name:"Email",category:"Communication",permissions:["Inbox access","Outbound mail when configured","OAuth or IMAP/SMTP configuration"]}),{id:"notion",name:"Notion",category:"Productivity",description:"Sync knowledge bases, briefs, and planning pages.",managedBy:"unsupported",providerType:"external-app",permissions:["Unavailable until an AgentOS/OpenClaw Notion connector exists."],setupRequirements:["OpenClaw connector support"],configure:{supported:!1,reason:"No Notion setup route or OpenClaw connector is exposed in this codebase."},reconnect:{supported:!1,reason:"No Notion health check method is exposed in this codebase."},disable:{supported:!1,reason:"No Notion connection record exists to disable."},docsUrl:null},{id:"google-drive",name:"Google Drive",category:"Productivity",description:"Use shared documents and generated outputs as workspace context.",managedBy:"unsupported",providerType:"external-app",permissions:["Unavailable until a Drive connector is exposed."],setupRequirements:["OpenClaw connector support"],configure:{supported:!1,reason:"Workspace files are local AgentOS/OpenClaw files; no Google Drive connector is exposed yet."},reconnect:{supported:!1,reason:"No Google Drive health check method is exposed in this codebase."},disable:{supported:!1,reason:"No Google Drive connection record exists to disable."},docsUrl:null},{id:"github",name:"GitHub",category:"Developer Tools",description:"Connect repositories, issues, pull requests, and release automation.",managedBy:"unsupported",providerType:"external-app",permissions:["Unavailable until a GitHub connector is exposed."],setupRequirements:["OpenClaw connector support"],configure:{supported:!1,reason:"No GitHub setup route or OpenClaw connector is exposed in this codebase."},reconnect:{supported:!1,reason:"No GitHub health check method is exposed in this codebase."},disable:{supported:!1,reason:"No GitHub connection record exists to disable."},docsUrl:null},{id:"linear",name:"Linear",category:"Developer Tools",description:"Sync tasks, roadmaps, and delivery queues.",managedBy:"unsupported",providerType:"external-app",permissions:["Unavailable until a Linear connector is exposed."],setupRequirements:["OpenClaw connector support"],configure:{supported:!1,reason:"No Linear setup route or OpenClaw connector is exposed in this codebase."},reconnect:{supported:!1,reason:"No Linear health check method is exposed in this codebase."},disable:{supported:!1,reason:"No Linear connection record exists to disable."},docsUrl:null},{id:"chrome",name:"Chrome / Browser Automation",category:"Browser / Automation",description:"Give browser agents controlled web automation access.",managedBy:"agentos",providerType:"tool",toolHints:["browser","chrome","web_search","web_fetch"],permissions:["Agent tool declarations","Runtime tool usage metadata"],setupRequirements:["Agent with browser-capable tools"],configure:{supported:!1,reason:"Browser automation is inferred from agent tool configuration; no dedicated connector setup flow exists."},reconnect:{supported:!1,reason:"OpenClaw exposes tool catalogs, but no browser connector retest action is wired here."},disable:{supported:!1,reason:"Disable browser tools from the agent capability editor instead of this integration card."},docsUrl:null},ex({id:"webhooks",provider:"webhook",name:"Webhooks",category:"Browser / Automation",permissions:["Inbound triggers","Shared hook token","Path configuration"]}),ex({id:"cron",provider:"cron",name:"Cron",category:"Browser / Automation",permissions:["Scheduled triggers","Run log metadata","Webhook token required"]}),{id:"x-twitter",name:"X / Twitter",category:"Browser / Automation",description:"Monitor social trends and route campaign signals.",managedBy:"unsupported",providerType:"external-app",permissions:["Unavailable until an X/Twitter connector is exposed."],setupRequirements:["OpenClaw connector support"],configure:{supported:!1,reason:"No X/Twitter setup route or OpenClaw connector is exposed in this codebase."},reconnect:{supported:!1,reason:"No X/Twitter health check method is exposed in this codebase."},disable:{supported:!1,reason:"No X/Twitter connection record exists to disable."},docsUrl:null},{id:"openrouter",name:"OpenRouter",category:"AI / Model Providers",description:"Route agents across broad hosted model catalogs.",managedBy:"openclaw",providerType:"model-provider",modelProvider:"openrouter",permissions:["Model catalog discovery","Configured model routes","API key stored by OpenClaw"],setupRequirements:["OpenRouter API key","At least one configured model route"],configure:{supported:!0,reason:"Uses the existing Add Models provider setup flow."},reconnect:{supported:!0,reason:"Uses the existing /api/models/providers status action."},disable:{supported:!1,reason:"Model provider removal/disable is not exposed by AgentOS or OpenClaw here yet."},docsUrl:em},{id:"ollama",name:"Ollama",category:"AI / Model Providers",description:"Use local models for private and low-cost background tasks.",managedBy:"openclaw",providerType:"model-provider",modelProvider:"ollama",permissions:["Local model discovery","Configured model routes"],setupRequirements:["Ollama installed locally","At least one pulled local model"],configure:{supported:!0,reason:"Uses the existing Add Models provider setup flow."},reconnect:{supported:!0,reason:"Uses the existing /api/models/providers status action."},disable:{supported:!1,reason:"Ollama is a local runtime dependency; disabling is not exposed by AgentOS here."},docsUrl:em}];function eg(e){let t=e.trim().toLowerCase().replace(/_/g,"-");return"webhook"===t?"webhooks":"googlechat"===t?"google-chat":"browser"===t?"chrome":"x"===t||"twitter"===t?"x-twitter":t}eh.map(e=>[e.id,e]);let eb={connected:"Connected",disabled:"Disabled","pending-setup":"Pending Setup",failed:"Failed","needs-authentication":"Needs Authentication","missing-credentials":"Missing Credentials",unsupported:"Unsupported",unknown:"Unknown"};function ef(e,t,s){return{id:e.id,name:(0,ep.CK)(e),workspaceName:t.get(e.workspaceId)??e.workspaceId,reason:s}}function ev(e){return e.trim().toLowerCase().split("/")[0].replace(/^openai-codex$/,"openai")}function ej(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}let ew={connected:"success",disabled:"muted","pending-setup":"warning",failed:"danger","needs-authentication":"warning","missing-credentials":"warning",unsupported:"muted",unknown:"muted"},ey={telegram:{icon:J.A,iconTone:"info"},discord:{icon:J.A,iconTone:"purple"},gmail:{icon:V.A,iconTone:"danger"},slack:{icon:J.A,iconTone:"success"},"google-chat":{icon:J.A,iconTone:"success"},email:{icon:V.A,iconTone:"info"},notion:{icon:k.A,iconTone:"muted"},"google-drive":{icon:L.A,iconTone:"warning"},github:{icon:X.A,iconTone:"muted"},linear:{icon:v.A,iconTone:"purple"},chrome:{icon:Q.A,iconTone:"warning"},webhooks:{icon:$.A,iconTone:"danger"},cron:{icon:o.A,iconTone:"warning"},"x-twitter":{icon:D.A,iconTone:"muted"},openrouter:{icon:Y.A,iconTone:"muted"},ollama:{icon:Z.A,iconTone:"muted"}};function eN(e){return e.runtimes.reduce((e,t)=>e+(t.tokenUsage?.total??0),0)}function ek(e){return e>=1e9?`${(e/1e9).toFixed(2)}B`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(e>=1e4?0:1)}K`:String(e)}function eC(e){return"number"!=typeof e||Number.isNaN(e)?"-":e>=0x40000000?`${(e/0x40000000).toFixed(2)} GB`:e>=1048576?`${(e/1048576).toFixed(1)} MB`:e>=1024?`${Math.round(e/1024)} KB`:`${e} B`}function eA(e){return"ready"===e?"success":"running"===e?"info":"needs-approval"===e?"danger":"idle"===e?"warning":"muted"}function eS(e,t){for(let s of t){let t=e[s];if("string"==typeof t&&t.trim())return t.trim()}return null}function eL(e){let t=e.toLowerCase().replace(/_/g,"-");return"webhook"===t?"webhooks":"googlechat"===t?"google-chat":"browser"===t?"chrome":"x"===t||"twitter"===t?"x-twitter":t}function eM(e){return e.split(/[\s-]+/).filter(Boolean).map(e=>e.slice(0,1).toUpperCase()+e.slice(1)).join(" ")}r.A,x.A,o.A,el.A,d.A;let eT={queued:ei.A,running:er.A,approval:eo.A,completed:x.A,cancelled:ec.A,stalled:el.A},eO={connected:x.A,disabled:ed.A,"pending-setup":ei.A,failed:ec.A,"needs-authentication":d.A,"missing-credentials":d.A,unsupported:ed.A,unknown:ei.A},eP={"All Files":T.A,"Core Knowledge":k.A,Memory:A.A,"Generated Outputs":p.A,Reports:v.A,Screenshots:L.A,Datasets:S.A,Campaigns:D.A,Archived:ed.A,Trash:ec.A};var eI=s(53002),eR=s(30394),e$=s(86247),eU=s(21600),ez=s(79613),eD=s(35604),eF=s(14247),eW=s(28072),eE=s(66761),eq=s(8120),e_=s(85844),eB=s(23351);let eH="border border-white/[0.08] bg-[linear-gradient(180deg,rgba(13,24,42,0.86),rgba(6,12,23,0.82))] shadow-[inset_0_1px_0_rgba(255,255,255,0.045),0_20px_64px_rgba(0,0,0,0.30)] backdrop-blur-xl",eG={success:"border-emerald-400/25 bg-emerald-400/10 text-emerald-200",info:"border-sky-400/25 bg-sky-400/10 text-sky-200",warning:"border-amber-400/25 bg-amber-400/10 text-amber-100",danger:"border-rose-400/30 bg-rose-400/10 text-rose-100",muted:"border-white/10 bg-white/[0.06] text-slate-300",purple:"border-violet-400/25 bg-violet-400/10 text-violet-200"},eK={success:"bg-emerald-400",info:"bg-sky-400",warning:"bg-amber-300",danger:"bg-rose-400",muted:"bg-slate-400",purple:"bg-violet-400"},eJ={success:"border-emerald-300/20 bg-emerald-400/10 text-emerald-200 shadow-emerald-500/10",info:"border-sky-300/20 bg-sky-400/10 text-sky-200 shadow-sky-500/10",warning:"border-amber-300/20 bg-amber-400/10 text-amber-100 shadow-amber-500/10",danger:"border-rose-300/20 bg-rose-400/10 text-rose-100 shadow-rose-500/10",muted:"border-white/10 bg-white/[0.065] text-slate-200 shadow-black/20",purple:"border-violet-300/20 bg-violet-400/10 text-violet-200 shadow-violet-500/10"};function eV({snapshot:e,connectionState:t}){let s=e.diagnostics.version??e.diagnostics.latestVersion??"unknown",n="live"===t&&"healthy"===e.diagnostics.health;return(0,a.jsxs)("div",{className:"flex items-center justify-end gap-2 text-[0.58rem] font-semibold uppercase tracking-[0.22em] text-slate-400",children:[(0,a.jsx)("span",{className:"hidden sm:inline",children:"OpenClaw"}),(0,a.jsxs)("span",{className:"hidden font-mono text-slate-500 sm:inline",children:["v",s]}),(0,a.jsxs)("span",{className:(0,eB.cn)("inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 tracking-[0.16em]",n?"border-emerald-300/18 bg-emerald-400/10 text-emerald-200":"border-amber-300/18 bg-amber-400/10 text-amber-100"),children:[(0,a.jsx)("span",{className:(0,eB.cn)("h-1.5 w-1.5 rounded-full",n?"bg-emerald-400":"bg-amber-300")}),n?"Online":"retrying"===t?"Retrying":"Connecting"]}),(0,a.jsx)(e9,{ariaLabel:"Refresh status",icon:c.A}),(0,a.jsx)(e9,{ariaLabel:"Theme",icon:eI.A}),(0,a.jsx)(e9,{ariaLabel:"Notifications",icon:eR.A,dot:!0})]})}function eX({title:e,subtitle:t,primaryAction:s,secondaryAction:n,actions:l,children:i}){let r=s?.icon,o=n?.icon;return(0,a.jsxs)("header",{className:"border-b border-white/[0.07] pb-4",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-3 xl:flex-row xl:items-end xl:justify-between",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("h1",{className:"font-display text-[1.48rem] font-semibold leading-tight tracking-normal text-white",children:e}),(0,a.jsx)("p",{className:"mt-1.5 max-w-3xl text-[0.78rem] leading-5 text-slate-300",children:t})]}),(0,a.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:l??(0,a.jsxs)(a.Fragment,{children:[n?(0,a.jsxs)(eq.$,{variant:"secondary",size:"sm",className:"h-8 rounded-[10px] px-3 text-xs",onClick:n.onClick,children:[o?(0,a.jsx)(o,{className:"mr-1.5 h-3.5 w-3.5"}):null,n.label]}):null,s?(0,a.jsxs)(eq.$,{size:"sm",className:"h-8 rounded-[10px] bg-blue-500 px-3 text-xs text-white shadow-blue-500/20 hover:bg-blue-400",onClick:s.onClick,disabled:s.disabled,title:s.title,children:[r?(0,a.jsx)(r,{className:"mr-1.5 h-3.5 w-3.5"}):null,s.label]}):null]})})]}),i?(0,a.jsx)("div",{className:"mt-4",children:i}):null]})}function eQ({label:e,value:t,detail:s,icon:n,tone:l="info"}){return(0,a.jsxs)("div",{className:(0,eB.cn)("flex min-h-[72px] items-center gap-3 rounded-[12px] p-3",eH),children:[(0,a.jsx)("span",{className:(0,eB.cn)("flex h-9 w-9 shrink-0 items-center justify-center rounded-[11px] border shadow-lg",eJ[l]),children:(0,a.jsx)(n,{className:"h-4 w-4"})}),(0,a.jsxs)("span",{className:"min-w-0",children:[(0,a.jsx)("span",{className:"block text-[0.55rem] font-semibold uppercase tracking-[0.16em] text-slate-500",children:e}),(0,a.jsx)("span",{className:"mt-1 block truncate text-[1.05rem] font-semibold leading-none text-white",children:t}),(0,a.jsx)("span",{className:"mt-1 block truncate text-[0.63rem] text-slate-400",children:s})]})]})}function eY({children:e,columns:t=5}){return(0,a.jsx)("div",{className:(0,eB.cn)("grid gap-2.5 sm:grid-cols-2 lg:grid-cols-3",6===t?"xl:grid-cols-6":4===t?"xl:grid-cols-4":"xl:grid-cols-5"),children:e})}function eZ({search:e,onSearchChange:t,searchPlaceholder:s,children:n,right:l}){return(0,a.jsxs)("div",{className:"flex flex-col gap-2 lg:flex-row lg:items-center lg:justify-between",children:[(0,a.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-2 sm:flex-row sm:items-center",children:[(0,a.jsxs)("div",{className:"relative min-w-[220px] flex-1",children:[(0,a.jsx)(e$.A,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-slate-500"}),(0,a.jsx)(e_.p,{value:e,onChange:e=>t(e.target.value),placeholder:s,className:"h-8 rounded-[10px] border-white/[0.09] bg-slate-950/42 pl-8 pr-11 text-[0.74rem]"}),(0,a.jsxs)("span",{className:"pointer-events-none absolute right-2.5 top-1/2 hidden -translate-y-1/2 items-center gap-1 rounded-md border border-white/[0.08] bg-white/[0.04] px-1.5 py-0.5 font-mono text-[0.56rem] text-slate-500 sm:flex",children:[(0,a.jsx)(eU.A,{className:"h-2.5 w-2.5"})," K"]})]}),n]}),l?(0,a.jsx)("div",{className:"flex items-center gap-2",children:l}):null]})}function e0({icon:e=m.A,label:t,chevron:s,active:n,onClick:l,disabled:i,title:r}){return(0,a.jsxs)("button",{type:"button",onClick:l,disabled:i,title:r,className:(0,eB.cn)("inline-flex h-8 shrink-0 items-center gap-1.5 rounded-[10px] border px-2.5 text-[0.74rem] font-medium transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cyan-300/40",i?"cursor-not-allowed border-white/[0.06] bg-white/[0.025] text-slate-600":n?"border-sky-300/30 bg-sky-400/14 text-sky-100":"border-white/[0.09] bg-white/[0.045] text-slate-300 hover:border-white/[0.14] hover:bg-white/[0.075] hover:text-white"),children:[(0,a.jsx)(e,{className:"h-3.5 w-3.5"}),t,s?(0,a.jsx)(ez.A,{className:"h-3 w-3 text-slate-500"}):null]})}function e1({value:e,onChange:t,labels:s=["Grid","List"]}){return(0,a.jsxs)("div",{className:"inline-flex h-8 items-center rounded-[10px] border border-white/[0.09] bg-white/[0.045] p-0.5",children:[(0,a.jsx)("button",{type:"button","aria-label":s[0],onClick:()=>t("grid"),className:(0,eB.cn)("inline-flex h-6 w-6 items-center justify-center rounded-[8px] text-slate-400 transition-colors hover:text-white",("grid"===e||"board"===e)&&"bg-sky-400/14 text-sky-200"),children:(0,a.jsx)(eD.A,{className:"h-3.5 w-3.5"})}),(0,a.jsx)("button",{type:"button","aria-label":s[1],onClick:()=>t("list"),className:(0,eB.cn)("inline-flex h-6 w-6 items-center justify-center rounded-[8px] text-slate-400 transition-colors hover:text-white","list"===e&&"bg-sky-400/14 text-sky-200"),children:(0,a.jsx)(eF.A,{className:"h-3.5 w-3.5"})})]})}function e5({label:e,count:t,active:s,tone:n="info",onClick:l}){return(0,a.jsxs)("button",{type:"button",onClick:l,className:(0,eB.cn)("inline-flex h-7 items-center gap-1.5 rounded-[9px] border px-2.5 text-[0.72rem] font-semibold transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cyan-300/40",s?eG[n]:"border-white/[0.08] bg-white/[0.035] text-slate-300 hover:bg-white/[0.07] hover:text-white"),children:[e,"number"==typeof t?(0,a.jsx)("span",{className:"rounded-full bg-white/[0.08] px-1.5 py-0.5 text-[0.58rem] text-slate-300",children:t}):null]})}function e2({title:e,action:t,children:s,className:n}){return(0,a.jsxs)("section",{className:(0,eB.cn)("rounded-[12px]",eH,n),children:[e||t?(0,a.jsxs)("div",{className:"flex min-h-10 items-center justify-between gap-2 border-b border-white/[0.07] px-3 py-2",children:[e?(0,a.jsx)("h2",{className:"text-[0.82rem] font-semibold text-white",children:e}):(0,a.jsx)("span",{}),t]}):null,s]})}function e3({title:e,onClose:t,children:s,className:n}){return(0,a.jsxs)("aside",{className:(0,eB.cn)("sticky top-4 hidden max-h-[calc(100dvh-32px)] min-h-[calc(100dvh-32px)] overflow-hidden rounded-[12px] xl:block",eH,n),children:[e?(0,a.jsxs)("div",{className:"flex h-10 items-center justify-between border-b border-white/[0.08] px-3",children:[(0,a.jsx)("h2",{className:"text-xs font-semibold text-white",children:e}),t?(0,a.jsx)(e9,{ariaLabel:"Close details",icon:eW.A,onClick:t}):null]}):null,(0,a.jsx)("div",{className:"h-full overflow-y-auto p-3",children:s})]})}function e4({label:e,tone:t="muted",dot:s=!0,className:n}){return(0,a.jsxs)("span",{className:(0,eB.cn)("inline-flex items-center gap-1.5 rounded-full border px-1.5 py-0.5 text-[0.56rem] font-semibold uppercase tracking-[0.11em]",eG[t],n),children:[s?(0,a.jsx)("span",{className:(0,eB.cn)("h-1.5 w-1.5 rounded-full",eK[t])}):null,e]})}function e8({icon:e,label:t,tone:s="info",size:n="md"}){return(0,a.jsx)("span",{className:(0,eB.cn)("flex shrink-0 items-center justify-center border shadow-lg","lg"===n?"h-12 w-12 rounded-[14px]":"sm"===n?"h-7 w-7 rounded-[9px]":"h-10 w-10 rounded-[12px]",eJ[s]),children:e?(0,a.jsx)(e,{className:(0,eB.cn)("lg"===n?"h-6 w-6":"sm"===n?"h-3.5 w-3.5":"h-5 w-5")}):(0,a.jsx)("span",{className:(0,eB.cn)("font-semibold uppercase","lg"===n?"text-lg":"sm"===n?"text-xs":"text-base"),children:t.slice(0,1)})})}function e6({label:e,value:t,action:s}){return(0,a.jsxs)("div",{className:"flex items-start justify-between gap-2 border-b border-white/[0.07] py-2 last:border-b-0",children:[(0,a.jsx)("span",{className:"text-[0.58rem] font-semibold uppercase tracking-[0.16em] text-slate-500",children:e}),(0,a.jsxs)("span",{className:"min-w-0 text-right text-[0.74rem] font-medium text-slate-100",children:[t,s?(0,a.jsx)("span",{className:"ml-2",children:s}):null]})]})}function e7({value:e,tone:t="info",className:s}){return(0,a.jsx)("div",{className:(0,eB.cn)("h-1.5 overflow-hidden rounded-full bg-white/[0.08]",s),children:(0,a.jsx)("div",{className:(0,eB.cn)("h-full rounded-full",{success:"bg-emerald-400",info:"bg-blue-400",warning:"bg-amber-300",danger:"bg-rose-400",muted:"bg-slate-400",purple:"bg-violet-400"}[t]),style:{width:`${Math.max(0,Math.min(100,e))}%`}})})}function e9({ariaLabel:e,icon:t,active:s,dot:n,onClick:l,disabled:i,title:r}){return(0,a.jsxs)("button",{type:"button","aria-label":e,onClick:l,disabled:i,title:r,className:(0,eB.cn)("relative inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-[9px] border transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cyan-300/40",i?"cursor-not-allowed border-white/[0.06] bg-white/[0.025] text-slate-600":s?"border-sky-300/30 bg-sky-400/14 text-sky-200":"border-white/[0.08] bg-white/[0.035] text-slate-400 hover:border-white/[0.14] hover:bg-white/[0.07] hover:text-white"),children:[(0,a.jsx)(t,{className:"h-3.5 w-3.5"}),n?(0,a.jsx)("span",{className:"absolute right-1.5 top-1.5 h-1.5 w-1.5 rounded-full bg-emerald-400"}):null]})}function te({onClick:e,title:t="More actions require backend support."}){return(0,a.jsx)(e9,{ariaLabel:"More actions",icon:eW.A,onClick:e,disabled:!e,title:t})}function tt({title:e,description:t}){return(0,a.jsxs)("div",{className:"flex min-h-[170px] flex-col items-center justify-center rounded-[12px] border border-dashed border-white/[0.10] bg-white/[0.025] p-6 text-center",children:[(0,a.jsx)("p",{className:"text-xs font-semibold text-white",children:e}),(0,a.jsx)("p",{className:"mt-2 max-w-md text-xs leading-5 text-slate-400",children:t})]})}function ts({children:e}){return(0,a.jsx)(eE.E,{variant:"muted",className:"border-white/[0.08] bg-white/[0.055] px-1.5 py-0 text-[0.56rem] tracking-normal text-slate-300",children:e})}var ta=s(50243),tn=s(47936);function tl({initialSnapshot:e,children:t}){let{snapshot:s,connectionState:l,refresh:i,setSnapshot:r}=(0,tn.v)(e),[o,c]=(0,n.useState)(e.workspaces[0]?.id??null),[d,p]=(0,n.useState)(!1),[u,m]=(0,n.useState)(!1),[x,h]=(0,n.useState)(null),g=(0,n.useMemo)(()=>o?s.workspaces.find(e=>e.id===o)??null:null,[o,s.workspaces]),b=(0,n.useMemo)(()=>(function(e,t){if(!t)return e;let s=e.workspaces.find(e=>e.id===t);if(!s)return{...e,workspaces:[],agents:[],tasks:[],runtimes:[],models:[],channelAccounts:[],channelRegistry:{...e.channelRegistry,channels:[]}};let a=e.agents.filter(e=>e.workspaceId===s.id),n=new Set(a.map(e=>e.id)),l=e.tasks.filter(e=>e.workspaceId===s.id||!!e.primaryAgentId&&n.has(e.primaryAgentId)||e.agentIds.some(e=>n.has(e))),i=new Set(l.map(e=>e.id)),r=new Set(l.flatMap(e=>e.runtimeIds)),o=e.runtimes.filter(e=>e.workspaceId===s.id||!!e.agentId&&n.has(e.agentId)||!!e.taskId&&i.has(e.taskId)||r.has(e.id)),c=new Set([...s.modelIds,...a.map(e=>e.modelId),...o.map(e=>e.modelId),e.diagnostics.modelReadiness.resolvedDefaultModel,e.diagnostics.modelReadiness.defaultModel].filter(e=>!!e)),d=e.models.filter(e=>c.has(e.id)),p=e.channelRegistry.channels.map(e=>({...e,workspaces:e.workspaces.filter(e=>e.workspaceId===s.id)})).filter(e=>e.workspaces.length>0),u=new Set(p.map(e=>eL(e.type))),m=e.channelAccounts.filter(e=>{var t;let s=eL(e.type);return u.has(s)||u.has("google-drive"===(t=s)?"drive":"x-twitter"===t?"twitter":t)});return{...e,workspaces:[s],agents:a,tasks:l,runtimes:o,models:d,channelAccounts:m,channelRegistry:{...e.channelRegistry,channels:p}}})(s,o),[o,s]);return(0,n.useEffect)(()=>{let e=s.diagnostics.workspaceRoot;if(x===e||(0,K.DK)(s))return;let t=(0,K.cY)(e),a=globalThis.localStorage?.getItem(t)??null,n=(0,K.mr)(s.workspaces.map(e=>e.id),a,o);queueMicrotask(()=>{n!==o&&c(n),h(e)})},[o,x,s]),(0,n.useEffect)(()=>{let e=s.diagnostics.workspaceRoot;if(x!==e)return;let t=globalThis.localStorage;void 0!==t&&t.setItem((0,K.cY)(e),(0,K.SW)(o))},[o,x,s.diagnostics.workspaceRoot]),(0,a.jsxs)("div",{className:"mission-shell relative min-h-screen overflow-hidden bg-[#030814] text-slate-100",children:[(0,a.jsxs)("div",{className:"mission-canvas-backdrop fixed inset-0 z-0",children:[(0,a.jsx)("div",{"aria-hidden":"true",className:"mission-canvas-pattern absolute inset-0 z-0 opacity-60"}),(0,a.jsx)("div",{"aria-hidden":"true",className:"absolute inset-0 z-10 bg-[radial-gradient(circle_at_54%_0%,rgba(37,99,235,0.16),transparent_32%),linear-gradient(180deg,rgba(2,6,17,0.12),rgba(2,6,17,0.58))]"})]}),(0,a.jsx)("div",{className:(0,eB.cn)("fixed left-0 top-0 z-30 hidden h-[100dvh] overflow-hidden bg-[#050a12] shadow-[18px_0_60px_rgba(0,0,0,0.36)] transition-[width] duration-200 ease-out lg:block",d?"w-[256px]":"w-[72px]"),onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!1),onFocusCapture:()=>p(!0),onBlurCapture:e=>{e.currentTarget.contains(e.relatedTarget)||p(!1)},children:(0,a.jsx)(G.z,{snapshot:s,surfaceTheme:"dark",activeWorkspaceId:o,requestedAgentAction:null,connectionState:l,collapsed:!d,modelManager:{runState:"idle",statusMessage:null,resultMessage:null,log:"",manualCommand:null,docsUrl:null,discoveredModels:[],systemReady:"healthy"===s.diagnostics.health},onExpandCollapsed:()=>p(!0),onToggleCollapsed:()=>p(e=>!e),onSelectWorkspace:c,onRefresh:i,onRunModelRefresh:()=>ta.o.message("Model refresh is available from Mission Control setup."),onRunModelDiscover:()=>ta.o.message("Model discovery is available from Mission Control setup."),onRunModelSetDefault:()=>ta.o.message("Default model changes are not exposed on this page yet."),onConnectModelProvider:e=>ta.o.message(`Open ${e} setup from Mission Control to connect it.`),onOpenModelSetup:()=>ta.o.message("Model setup opens from Mission Control."),onOpenAddModels:()=>ta.o.message("Add Models opens from Mission Control."),onOpenWorkspaceCreate:()=>ta.o.message("Workspace creation opens from Mission Control."),onEditWorkspace:()=>ta.o.message("Workspace editing opens from Mission Control."),onSnapshotChange:r,onAgentCreatedVisible:()=>{}})}),u?(0,a.jsx)("button",{type:"button","aria-label":"Close navigation",className:"fixed inset-0 z-40 bg-black/62 backdrop-blur-[2px] lg:hidden",onClick:()=>m(!1)}):null,(0,a.jsx)("div",{className:(0,eB.cn)("fixed left-0 top-0 z-50 h-[100dvh] overflow-hidden bg-[#050a12] shadow-[18px_0_60px_rgba(0,0,0,0.42)] transition-[width] duration-200 ease-out lg:hidden",u?"w-[min(86vw,292px)]":"w-[56px]"),onClickCapture:e=>{u&&e.target instanceof Element&&e.target.closest("a")&&m(!1)},children:(0,a.jsx)(G.z,{snapshot:s,surfaceTheme:"dark",activeWorkspaceId:o,requestedAgentAction:null,connectionState:l,collapsed:!u,modelManager:{runState:"idle",statusMessage:null,resultMessage:null,log:"",manualCommand:null,docsUrl:null,discoveredModels:[],systemReady:"healthy"===s.diagnostics.health},onExpandCollapsed:()=>m(!0),onToggleCollapsed:()=>m(e=>!e),onSelectWorkspace:c,onRefresh:i,onRunModelRefresh:()=>ta.o.message("Model refresh is available from Mission Control setup."),onRunModelDiscover:()=>ta.o.message("Model discovery is available from Mission Control setup."),onRunModelSetDefault:()=>ta.o.message("Default model changes are not exposed on this page yet."),onConnectModelProvider:e=>ta.o.message(`Open ${e} setup from Mission Control to connect it.`),onOpenModelSetup:()=>ta.o.message("Model setup opens from Mission Control."),onOpenAddModels:()=>ta.o.message("Add Models opens from Mission Control."),onOpenWorkspaceCreate:()=>ta.o.message("Workspace creation opens from Mission Control."),onEditWorkspace:()=>ta.o.message("Workspace editing opens from Mission Control."),onSnapshotChange:r,onAgentCreatedVisible:()=>{}})}),(0,a.jsx)("main",{className:(0,eB.cn)("relative z-20 min-h-screen pb-4 pl-[68px] pr-3 pt-4 sm:pl-[76px] sm:pr-5 lg:pl-[92px] lg:pr-4"),children:(0,a.jsxs)("div",{className:"mx-auto flex w-full max-w-[1880px] flex-col gap-3",children:[(0,a.jsx)(eV,{snapshot:s,connectionState:l}),t({snapshot:b,rootSnapshot:s,activeWorkspace:g,activeWorkspaceId:o,connectionState:l,refresh:i,setSnapshot:r})]})})]})}var ti=s(64248),tr=s(19306),to=s(23169);function tc({initialSnapshot:e,page:t}){return(0,a.jsx)(tl,{initialSnapshot:e,children:e=>"agents"===t?(0,a.jsx)(td,{snapshot:e.snapshot,rootSnapshot:e.rootSnapshot,activeWorkspaceId:e.activeWorkspaceId,refresh:e.refresh,setSnapshot:e.setSnapshot}):"tasks"===t?(0,a.jsx)(tx,{snapshot:e.snapshot,activeWorkspaceId:e.activeWorkspaceId,refresh:e.refresh}):"files"===t?(0,a.jsx)(tj,{snapshot:e.snapshot,activeWorkspaceId:e.activeWorkspaceId}):"models"===t?(0,a.jsx)(tk,{snapshot:e.snapshot,rootSnapshot:e.rootSnapshot,refresh:e.refresh,setSnapshot:e.setSnapshot}):(0,a.jsx)(tL,{snapshot:e.snapshot,rootSnapshot:e.rootSnapshot,activeWorkspaceId:e.activeWorkspaceId,refresh:e.refresh,setSnapshot:e.setSnapshot})})}function td({snapshot:e,rootSnapshot:t,activeWorkspaceId:s,refresh:x,setSnapshot:h}){var g,b;let f=(0,n.useMemo)(()=>(function(e){if(0===e.agents.length)return[];let t=(0,ep.hv)(e.generatedAt),s=new Map(e.workspaces.map(e=>[e.id,e])),a=new Map(e.models.map(e=>[e.id,e]));return e.agents.map(e=>{var n,l;let i=(n=e).currentAction.toLowerCase().includes("approval")||"standby"===n.status&&0===n.activeRuntimeIds.length&&n.heartbeat.enabled?"needs-approval":n.activeRuntimeIds.length>0||"engaged"===n.status||"monitoring"===n.status?"running":"ready"===n.status?"ready":"idle",c=s.get(e.workspaceId)?.name??e.workspaceId??"Unassigned";return{id:e.id,name:(0,ep.CK)(e),purpose:e.profile.purpose||e.currentAction||"Not reported",status:i,statusLabel:"needs-approval"===i?"Needs Approval":"running"===i?"Running":eM(i),statusTone:eA(i),modelLabel:a.get(e.modelId)?.name||e.modelId||"Unassigned",policyLabel:eM(e.policy.preset),workspaceName:c,toolsCount:new Set([...e.tools||[],...e.observedTools||[]].filter(Boolean)).size,sessionsCount:e.sessionCount,lastActiveLabel:(0,ep.fw)(e.lastActiveAt,t),online:"offline"!==e.status,icon:"browser"===(l=e).policy.preset||/browser|web/i.test(l.name)?ee.A:"monitoring"===l.policy.preset?o.A:"setup"===l.policy.preset?et.A:r.A,iconTone:"needs-approval"===i?"danger":"running"===i?"info":"idle"===i?"warning":"success",source:e}})})(e),[e]),[v,j]=(0,n.useState)(""),[w,y]=(0,n.useState)("all"),[N,k]=(0,n.useState)("last-active"),[C,A]=(0,n.useState)("grid"),[S,L]=(0,n.useState)(f[0]?.id??""),[M,T]=(0,n.useState)(null),[O,P]=(0,n.useState)(null),[I,R]=(0,n.useState)(null),[$,U]=(0,n.useState)("skills"),[z,D]=(0,n.useState)(null),[B,H]=(0,n.useState)(null),[G,K]=(0,n.useState)(!1),J=f.filter(e=>{let t=v.trim().toLowerCase(),s=!t||[e.name,e.purpose,e.modelLabel,e.policyLabel,e.workspaceName].join(" ").toLowerCase().includes(t),a="all"===w||e.status===w;return s&&a}).sort((e,t)=>{var s,a,n;return s=e,a=t,"name"===(n=N)?s.name.localeCompare(a.name):"status"===n?s.statusLabel.localeCompare(a.statusLabel)||s.name.localeCompare(a.name):"workspace"===n?s.workspaceName.localeCompare(a.workspaceName)||s.name.localeCompare(a.name):(a.source?.lastActiveAt??0)-(s.source?.lastActiveAt??0)||s.name.localeCompare(a.name)}),V=J.find(e=>e.id===S)??J[0]??null,X=M?t.agents.find(e=>e.id===M)??null:null,Q=f.filter(e=>"running"===e.status).length,Y=f.filter(e=>"ready"===e.status).length,Z=f.filter(e=>"idle"===e.status).length,es=f.filter(e=>"needs-approval"===e.status).length,ea=eN(e),en={all:f.length,ready:Y,running:Q,idle:Z,"needs-approval":es},el=["last-active","name","status","workspace"],ei=(e,t)=>{R(e),U(t)},er=async e=>{if(!e.source)return void ta.o.message("Delete is unavailable.",{description:"This row is not backed by an AgentOS agent record."});if(window.confirm(`Delete ${e.name}? This removes the OpenClaw agent from AgentOS.`)){H(e.id);try{let t=await fetch("/api/agents",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({agentId:e.source.id})}),s=await t.json().catch(()=>null);if(!t.ok||s?.error)throw Error(s?.error||"Agent deletion failed.");ta.o.success("Agent deleted."),L(""),await x()}catch(e){ta.o.error("Agent deletion failed.",{description:t$(e)})}finally{H(null)}}};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(tU,{main:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(eX,{title:"Agents",subtitle:"Manage your AI workforce. Monitor health, configure capabilities, and run agents at scale.",actions:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(eq.$,{variant:"secondary",size:"sm",className:"h-8 rounded-[10px] px-3 text-xs",disabled:!0,title:"Agent import requires a backend import contract.",children:[(0,a.jsx)(l.A,{className:"mr-1.5 h-3.5 w-3.5"}),"Import Agent"]}),(0,a.jsx)(_.O,{snapshot:t,defaultWorkspaceId:s,onRefresh:x,onSnapshotChange:e=>h(t=>e(t)),onAgentCreated:L,onAgentCreatedVisible:L,surfaceTheme:"dark",trigger:(0,a.jsxs)(eq.$,{size:"sm",className:"h-8 rounded-[10px] bg-blue-500 px-3 text-xs text-white shadow-blue-500/20 hover:bg-blue-400",children:[(0,a.jsx)(i.A,{className:"mr-1.5 h-3.5 w-3.5"}),"Create Agent"]})})]})}),(0,a.jsxs)(eY,{columns:5,children:[(0,a.jsx)(eQ,{label:"Total Agents",value:String(f.length),detail:`${e.workspaces.length} workspaces`,icon:r.A,tone:"info"}),(0,a.jsx)(eQ,{label:"Active",value:String(Q),detail:`${Math.round(Q/Math.max(1,f.length)*100)}% of total`,icon:o.A,tone:"success"}),(0,a.jsx)(eQ,{label:"Idle",value:String(Z),detail:`${Math.round(Z/Math.max(1,f.length)*100)}% of total`,icon:c.A,tone:"warning"}),(0,a.jsx)(eQ,{label:"Needs Approval",value:String(es),detail:`${Math.round(es/Math.max(1,f.length)*100)}% of total`,icon:d.A,tone:"danger"}),(0,a.jsx)(eQ,{label:"Runtime Tokens",value:ek(ea),detail:ea?"From live runtimes":"No runtime token usage reported",icon:p.A,tone:"purple"})]}),(0,a.jsxs)(eZ,{search:v,onSearchChange:j,searchPlaceholder:"Search agents...",right:(0,a.jsx)(e1,{value:C,onChange:A}),children:[(0,a.jsx)(e0,{icon:u.A,label:`Filter: ${t_(w)}`,active:"all"!==w,onClick:()=>y("all")}),(0,a.jsx)(e0,{icon:m.A,label:`Sort: ${"last-active"===(g=N)?"Last active":tB(g)}`,chevron:!0,onClick:()=>k(e=>el[(el.indexOf(e)+1)%el.length])})]}),(0,a.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:["all","ready","running","idle","needs-approval"].map(e=>(0,a.jsx)(e5,{label:t_(e),count:en[e],active:w===e,tone:eA(e),onClick:()=>y(e)},e))}),J.length>0?(0,a.jsx)("div",{className:(0,eB.cn)("grid"===C?"grid gap-2.5 lg:grid-cols-2 min-[1400px]:grid-cols-3":"flex flex-col gap-2.5"),children:J.map(e=>(0,a.jsx)(tp,{agent:e,selected:V?.id===e.id,list:"list"===C,onSelect:()=>L(e.id),onMessage:()=>T(e.id),onRunTask:()=>D(e)},e.id))}):(0,a.jsx)(tt,{title:"No agents match your filters",description:"Clear search or switch back to All to see every OpenClaw agent in this workspace."}),(0,a.jsx)(tm,{snapshot:e,agents:f})]}),inspector:V?(0,a.jsx)(tu,{agent:V,deleting:B===V.id,onMessage:()=>T(V.id),onRunTask:()=>D(V),onChangeModel:()=>P(V.id),onManagePolicy:()=>ei(V.id,"skills"),onManageTools:()=>ei(V.id,"tools"),onDelete:()=>void er(V)}):null}),(0,a.jsx)(ti.lG,{open:!!X,onOpenChange:e=>T(e?M:null),children:(0,a.jsxs)(ti.Cf,{className:"flex h-[min(82dvh,760px)] max-w-3xl flex-col rounded-[18px] border-white/[0.10] bg-[#08111f]/95 p-4",children:[(0,a.jsxs)(ti.c7,{children:[(0,a.jsx)(ti.L3,{children:X?`Message ${b=X,b.identityName?.trim()||b.name||b.id}`:"Agent Chat"}),(0,a.jsx)(ti.rr,{children:"Messages are sent through the existing AgentOS/OpenClaw agent chat runner."})]}),(0,a.jsx)("div",{className:"min-h-0 flex-1",children:X?(0,a.jsx)(E.d,{agent:X,snapshot:t,surfaceTheme:"dark",isVisible:!!X,onRefresh:x,onSnapshotChange:e=>h(t=>e(t))}):null})]})}),(0,a.jsx)(q.r,{open:!!O,agentId:O,snapshot:t,onOpenChange:e=>P(e?O:null),onSnapshotChange:e=>h(t=>e(t)),onRefresh:x,onOpenAddModels:()=>K(!0)}),(0,a.jsx)(F.o,{open:G,onOpenChange:K,snapshot:t,onSnapshotChange:h}),(0,a.jsx)(W.z,{open:!!I,agentId:I,initialFocus:$,snapshot:t,onOpenChange:e=>R(e?I:null),onSnapshotChange:e=>h(t=>e(t)),onRefresh:x}),(0,a.jsx)(tW,{open:!!z,agent:z,onOpenChange:e=>D(e?z:null),onSubmitted:x})]})}function tp({agent:e,selected:t,list:s,onSelect:n,onMessage:l,onRunTask:i}){return(0,a.jsx)("div",{role:"button",tabIndex:0,onClick:n,onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),n())},className:(0,eB.cn)("group rounded-[12px] border p-3 text-left transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cyan-300/40",eH,t&&"border-blue-400/70 bg-blue-500/[0.08] shadow-[0_0_0_1px_rgba(59,130,246,0.22),0_22px_64px_rgba(37,99,235,0.16)]"),children:(0,a.jsxs)("div",{className:(0,eB.cn)("flex gap-3",s?"items-center":"items-start"),children:[(0,a.jsx)(e8,{icon:e.icon,label:e.name,tone:e.iconTone,size:"lg"}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)(e4,{label:e.statusLabel,tone:e.statusTone}),(0,a.jsx)("h3",{className:"mt-1.5 truncate text-[0.88rem] font-semibold text-white",children:e.name}),(0,a.jsx)("p",{className:"mt-1 line-clamp-2 text-[0.72rem] leading-4 text-slate-300",children:e.purpose})]}),t?(0,a.jsx)(x.A,{className:"h-4 w-4 shrink-0 text-blue-300"}):null]}),(0,a.jsxs)("div",{className:"mt-2.5 flex flex-wrap gap-1.5",children:[(0,a.jsx)(ts,{children:e.modelLabel}),(0,a.jsxs)(ts,{children:["Policy: ",e.policyLabel]})]}),(0,a.jsxs)("div",{className:"mt-3 grid grid-cols-3 gap-2 border-t border-white/[0.07] pt-2.5 text-[0.58rem] uppercase tracking-[0.11em] text-slate-500",children:[(0,a.jsxs)("span",{children:["Tools ",(0,a.jsx)("b",{className:"ml-1 text-slate-200",children:e.toolsCount})]}),(0,a.jsxs)("span",{children:["Sessions ",(0,a.jsx)("b",{className:"ml-1 text-slate-200",children:e.sessionsCount})]}),(0,a.jsxs)("span",{children:["Last active ",(0,a.jsx)("b",{className:"ml-1 normal-case tracking-normal text-slate-200",children:e.lastActiveLabel})]})]}),(0,a.jsxs)("div",{className:"mt-2.5 grid grid-cols-[1fr_1fr_auto] gap-2",children:[(0,a.jsxs)(eq.$,{variant:"secondary",size:"sm",className:"h-8 rounded-[9px] px-2 text-xs",onClick:e=>{e.stopPropagation(),l()},children:[(0,a.jsx)(h.A,{className:"mr-1.5 h-3.5 w-3.5"})," Message"]}),(0,a.jsxs)(eq.$,{variant:"secondary",size:"sm",className:"h-8 rounded-[9px] px-2 text-xs",onClick:e=>{e.stopPropagation(),i()},children:[(0,a.jsx)(g.A,{className:"mr-1.5 h-3.5 w-3.5"})," Run Task"]}),(0,a.jsx)(eq.$,{variant:"secondary",size:"sm",className:"h-8 rounded-[9px] px-2.5",disabled:!0,title:"Following agents requires backend support.",onClick:e=>e.stopPropagation(),children:(0,a.jsx)(b.A,{className:"h-3.5 w-3.5"})})]})]})]})})}function tu({agent:e,deleting:t,onMessage:s,onRunTask:n,onChangeModel:l,onManagePolicy:i,onManageTools:r,onDelete:o}){return(0,a.jsxs)(e3,{children:[(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[(0,a.jsx)(e8,{icon:e.icon,label:e.name,tone:e.iconTone,size:"lg"}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,a.jsx)("h2",{className:"text-base font-semibold leading-tight text-white",children:e.name}),(0,a.jsx)(te,{})]}),(0,a.jsxs)("div",{className:"mt-1.5 flex flex-wrap items-center gap-2",children:[(0,a.jsx)(e4,{label:e.statusLabel,tone:e.statusTone}),(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-xs text-slate-400",children:[(0,a.jsx)("span",{className:(0,eB.cn)("h-1.5 w-1.5 rounded-full",e.online?"bg-emerald-400":"bg-slate-500")}),e.online?"Online":"Offline"]})]}),(0,a.jsx)("p",{className:"mt-2.5 text-xs leading-5 text-slate-300",children:e.purpose})]})]}),(0,a.jsxs)("div",{className:"mt-3 grid grid-cols-3 gap-2",children:[(0,a.jsx)(eq.$,{variant:"secondary",size:"sm",className:"h-8 rounded-[9px] px-2 text-xs",onClick:s,children:"Message"}),(0,a.jsx)(eq.$,{variant:"secondary",size:"sm",className:"h-8 rounded-[9px] px-2 text-xs",onClick:n,children:"Run Task"}),(0,a.jsx)(eq.$,{size:"sm",className:"h-8 rounded-[9px] bg-amber-400 px-2 text-xs text-slate-950 hover:bg-amber-300",disabled:!0,title:"Following agents requires backend support.",children:"Follow"})]}),(0,a.jsxs)("div",{className:"mt-4 rounded-[10px] border border-white/[0.08] bg-white/[0.03] px-3",children:[(0,a.jsx)(e6,{label:"Role",value:e.source?.policy.preset?tB(e.source.policy.preset):e.policyLabel}),(0,a.jsx)(e6,{label:"Policy Mode",value:e.policyLabel,action:(0,a.jsx)("button",{className:"text-blue-300",onClick:i,children:"Manage"})}),(0,a.jsx)(e6,{label:"Workspace Scope",value:`${e.workspaceName} (Full Access)`}),(0,a.jsx)(e6,{label:"Default Model",value:e.modelLabel,action:(0,a.jsx)("button",{className:"text-blue-300",onClick:l,children:"Change"})}),(0,a.jsx)(e6,{label:"Tools Enabled",value:`${e.toolsCount} tools`,action:(0,a.jsx)("button",{className:"text-blue-300",onClick:r,children:"Manage"})})]}),(0,a.jsx)(e2,{title:"Runtime Summary",className:"mt-3",children:(0,a.jsxs)("div",{className:"px-3 py-2 text-xs",children:[(0,a.jsx)(e6,{label:"Sessions",value:String(e.sessionsCount)}),(0,a.jsx)(e6,{label:"Active runtimes",value:String(e.source?.activeRuntimeIds.length??0)}),(0,a.jsx)(e6,{label:"Status",value:e.source?.status??e.statusLabel}),(0,a.jsx)(e6,{label:"Heartbeat",value:e.source?.heartbeat.enabled?e.source.heartbeat.every??"Enabled":"Disabled"}),(0,a.jsx)(e6,{label:"Last active",value:e.lastActiveLabel})]})}),(0,a.jsx)(e2,{title:"Backend Support",className:"mt-3",children:(0,a.jsxs)("div",{className:"space-y-2 p-3 text-xs leading-5 text-slate-300",children:[(0,a.jsx)("p",{children:"Message, model changes, capability management, mission dispatch, and delete are connected to existing AgentOS/OpenClaw APIs."}),(0,a.jsx)("p",{className:"text-slate-500",children:"Follow/import actions are disabled because this codebase does not expose persistence or import contracts for them."})]})}),(0,a.jsx)(eq.$,{variant:"destructive",size:"sm",className:"mt-3 h-8 w-full rounded-[9px] text-xs",disabled:t||!e.source,title:e.source?"Delete this AgentOS/OpenClaw agent.":"Delete requires a real agent record.",onClick:o,children:t?"Deleting...":"Delete Agent"})]})}function tm({snapshot:e,agents:t}){let s=e.runtimes.slice(0,4).map(e=>{let s=t.find(t=>t.id===e.agentId);return{agent:s?.name||e.agentId||"OpenClaw",event:"completed"===e.status?"Completed task":"running"===e.status?"Running task":"Updated session",status:e.status,task:e.title||e.subtitle||e.id,time:e.updatedAt?"recently":"no activity"}});return(0,a.jsx)(e2,{title:"Recent Activity",children:0===s.length?(0,a.jsx)(tt,{title:"No runtime activity",description:"No agent runtime events were reported in the current AgentOS snapshot."}):(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)("table",{className:"w-full min-w-[680px] text-left text-xs",children:[(0,a.jsx)("thead",{className:"border-b border-white/[0.07] text-[0.58rem] uppercase tracking-[0.14em] text-slate-500",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"px-3 py-2.5 font-semibold",children:"Agent"}),(0,a.jsx)("th",{className:"px-3 py-2.5 font-semibold",children:"Event"}),(0,a.jsx)("th",{className:"px-3 py-2.5 font-semibold",children:"Status"}),(0,a.jsx)("th",{className:"px-3 py-2.5 font-semibold",children:"Task"}),(0,a.jsx)("th",{className:"px-3 py-2.5 font-semibold",children:"Time"})]})}),(0,a.jsx)("tbody",{className:"divide-y divide-white/[0.06] text-slate-300",children:s.map((e,t)=>(0,a.jsxs)("tr",{className:"hover:bg-white/[0.025]",children:[(0,a.jsx)("td",{className:"px-3 py-2.5 text-white",children:e.agent}),(0,a.jsx)("td",{className:"px-3 py-2.5",children:e.event}),(0,a.jsx)("td",{className:"px-3 py-2.5",children:(0,a.jsx)(e4,{label:e.status,tone:"completed"===e.status?"success":"running"===e.status?"info":"warning"})}),(0,a.jsx)("td",{className:"px-3 py-2.5",children:e.task}),(0,a.jsx)("td",{className:"px-3 py-2.5",children:e.time})]},`${e.agent}-${e.task}-${t}`))})]})})})}function tx({snapshot:e,activeWorkspaceId:t,refresh:s}){var l;let r=(0,n.useMemo)(()=>(function(e){if(0===e.tasks.length)return[];let t=(0,ep.hv)(e.generatedAt);return e.tasks.map(e=>{var s,a,n,l,i,r;let o,c,d=(s=e).warningCount>0&&"completed"!==s.status&&"cancelled"!==s.status?"approval":"running"===s.status?"running":"queued"===s.status||"idle"===s.status?"queued":"completed"===s.status?"completed":"cancelled"===s.status?"cancelled":"stalled"===s.status?"stalled":"queued",p=(a=e,n=d,null!=(o=function(e,t){for(let s of t){let t=e[s];if("number"==typeof t&&Number.isFinite(t))return t;if("string"==typeof t&&t.trim()){let e=Number(t);if(Number.isFinite(e))return e}}return null}(a.metadata,["progress","progressPercent","percentComplete"]))?Math.max(0,Math.min(100,Math.round(o))):100*("completed"===n)),u=e.subtitle||e.mission||e.title||e.id;return{id:e.id,title:e.title||e.mission||e.id,status:d,statusLabel:"approval"===(l=d)?"Awaiting Approval":"queued"===l?"Queued":eM(l),statusTone:"completed"===(i=d)?"success":"running"===i?"info":"approval"===i||"stalled"===i?"warning":"cancelled"===i?"danger":"muted",agentName:e.primaryAgentName||"Unassigned",category:eS(e.metadata,["category","type","source"])||"Uncategorized",priority:(c=eS((r=e).metadata,["priority"]))&&/high/i.test(c)?"High":c&&/low/i.test(c)?"Low":r.warningCount>0||r.liveRunCount>1?"High":r.runtimeCount>1?"Medium":"Low",progress:p,dueLabel:eS(e.metadata,["dueLabel","dueAt","scheduledAt"])||(0,ep.fw)(e.updatedAt,t),tokenLabel:(0,ep._y)(e.tokenUsage?.total),objective:e.mission||u,description:u,artifactCount:e.artifactCount,warningCount:e.warningCount,source:e}})})(e),[e]),[h,g]=(0,n.useState)(""),[b,w]=(0,n.useState)("all"),[y,N]=(0,n.useState)("updated"),[k,C]=(0,n.useState)("board"),[A,S]=(0,n.useState)(r[0]?.id??""),[L,M]=(0,n.useState)(!1),T=r.filter(e=>{let t=h.trim().toLowerCase(),s=!t||[e.title,e.agentName,e.category,e.objective,e.description].join(" ").toLowerCase().includes(t),a="all"===b||e.status===b;return s&&a}).sort((e,t)=>{var s,a,n;return s=e,a=t,"title"===(n=y)?s.title.localeCompare(a.title):"status"===n?s.statusLabel.localeCompare(a.statusLabel)||s.title.localeCompare(a.title):"agent"===n?s.agentName.localeCompare(a.agentName)||s.title.localeCompare(a.title):(a.source?.updatedAt??0)-(s.source?.updatedAt??0)||s.title.localeCompare(a.title)}),O=T.find(e=>e.id===A)??T[0]??null,P={queued:r.filter(e=>"queued"===e.status).length,running:r.filter(e=>"running"===e.status).length,approval:r.filter(e=>"approval"===e.status).length,completed:r.filter(e=>"completed"===e.status).length,cancelled:r.filter(e=>"cancelled"===e.status).length,stalled:r.filter(e=>"stalled"===e.status).length},I=e.tasks.reduce((e,t)=>e+(t.tokenUsage?.total??0),0)||eN(e),R=["updated","title","status","agent"],$=async e=>{if(!tq(e))return void ta.o.message("Cancel is unavailable.",{description:"Only live, queued, stalled, or approval tasks can be cancelled through the current task API."});if(!e.source)return void ta.o.message("Cancel is unavailable.",{description:"This row is not backed by an AgentOS task record."});try{let t=await fetch(`/api/tasks/${encodeURIComponent(e.source.id)}/abort`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:"Cancelled from Tasks page.",dispatchId:e.source.dispatchId??null})}),a=await t.json();if(!t.ok||a.error)throw Error(a.error||"Unable to cancel task.");ta.o.success("Task cancellation requested."),await s()}catch(e){ta.o.error("Task cancellation failed.",{description:e instanceof Error?e.message:"Unknown task error."})}};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(tU,{main:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(eX,{title:"Tasks",subtitle:"Plan, monitor, and execute work across your agents. Track progress and manage approvals.",actions:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(eq.$,{variant:"secondary",size:"sm",className:"h-8 rounded-[10px] px-3 text-xs",disabled:!0,title:"Task import requires a backend import contract.",children:[(0,a.jsx)(f.A,{className:"mr-1.5 h-3.5 w-3.5"}),"Import Tasks"]}),(0,a.jsxs)(eq.$,{size:"sm",className:"h-8 rounded-[10px] bg-blue-500 px-3 text-xs text-white shadow-blue-500/20 hover:bg-blue-400",onClick:()=>M(!0),children:[(0,a.jsx)(i.A,{className:"mr-1.5 h-3.5 w-3.5"}),"Create Task"]})]})}),(0,a.jsxs)(eY,{columns:4,children:[(0,a.jsx)(eQ,{label:"Total Tasks",value:String(r.length),detail:`${e.tasks.length} tracked from snapshot`,icon:v.A,tone:"info"}),(0,a.jsx)(eQ,{label:"Running",value:String(P.running),detail:"Live task records",icon:o.A,tone:"success"}),(0,a.jsx)(eQ,{label:"Queued",value:String(P.queued),detail:"Waiting to run",icon:c.A,tone:"warning"}),(0,a.jsx)(eQ,{label:"Needs Approval",value:String(P.approval),detail:"Warnings or review gates",icon:d.A,tone:"danger"}),(0,a.jsx)(eQ,{label:"Completed",value:String(P.completed),detail:"Completed task records",icon:x.A,tone:"purple"}),(0,a.jsx)(eQ,{label:"Runtime Tokens",value:ek(I),detail:I?"From live task/runtime usage":"No token usage reported",icon:p.A,tone:"purple"})]}),(0,a.jsxs)(eZ,{search:h,onSearchChange:g,searchPlaceholder:"Search tasks...",right:(0,a.jsx)(e1,{value:"board"===k?"board":"list",labels:["Board","List"],onChange:e=>C("grid"===e?"board":"list")}),children:[(0,a.jsx)(e0,{icon:u.A,label:`Filter: ${tE(b)}`,active:"all"!==b,onClick:()=>w("all")}),(0,a.jsx)(e0,{icon:m.A,label:`Sort: ${"updated"===(l=y)?"Last updated":tB(l)}`,chevron:!0,onClick:()=>N(e=>R[(R.indexOf(e)+1)%R.length])}),(0,a.jsx)(e0,{icon:j.A,label:"Group: Status",active:!0,disabled:!0,title:"The board is grouped by status."})]}),(0,a.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:["all","queued","running","approval","stalled","completed","cancelled"].map(e=>{var t;return(0,a.jsx)(e5,{label:tE(e),count:"all"===e?r.length:P[e],active:b===e,tone:"running"===(t=e)?"info":"completed"===t?"success":"approval"===t||"stalled"===t?"warning":"cancelled"===t?"danger":"muted",onClick:()=>w(e)},e)})}),0===T.length?(0,a.jsx)(tt,{title:"No tasks match your filters",description:"Clear search or switch filters to inspect the current AgentOS task snapshot."}):"board"===k?(0,a.jsx)("div",{className:"grid gap-2.5 xl:grid-cols-3 min-[1600px]:grid-cols-6",children:["queued","running","approval","stalled","completed","cancelled"].map(e=>(0,a.jsx)(th,{status:e,tasks:T.filter(t=>t.status===e),selectedId:O?.id,onSelect:S,onAbort:$},e))}):(0,a.jsx)(e2,{children:(0,a.jsx)("div",{className:"divide-y divide-white/[0.07]",children:T.map(e=>(0,a.jsx)(tb,{task:e,selected:e.id===O?.id,onSelect:()=>S(e.id),onAbort:()=>$(e)},e.id))})}),(0,a.jsxs)("div",{className:"grid gap-2.5 xl:grid-cols-2",children:[(0,a.jsx)(tv,{tasks:r.slice(0,5)}),(0,a.jsx)(tF,{title:"Automation Controls",description:"Task scheduling toggles, approval decisions, pause, and retry controls are not exposed by the current Operations backend. Existing live cancellation and mission dispatch remain enabled."})]})]}),inspector:O?(0,a.jsx)(tf,{task:O,onAbort:()=>$(O)}):null}),(0,a.jsx)(tW,{open:L,agent:null,defaultWorkspaceId:t,onOpenChange:M,onSubmitted:s})]})}function th({status:e,tasks:t,selectedId:s,onSelect:n,onAbort:l}){let r=eT[e];return(0,a.jsxs)("section",{className:(0,eB.cn)("rounded-[12px] p-2.5",eH),children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 px-1 pb-2.5",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(r,{className:"h-3.5 w-3.5 text-blue-300"}),(0,a.jsx)("h2",{className:"text-[0.66rem] font-bold uppercase tracking-[0.13em] text-blue-200",children:tE(e)}),(0,a.jsx)("span",{className:"rounded-full bg-white/[0.08] px-1.5 py-0.5 text-[0.62rem] text-slate-400",children:t.length})]}),(0,a.jsx)("button",{className:"text-slate-500",type:"button",disabled:!0,title:"Use Create Task to submit a mission through the supported dispatch flow.",children:(0,a.jsx)(i.A,{className:"h-3.5 w-3.5"})})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2.5",children:[t.map(e=>(0,a.jsx)(tg,{task:e,selected:e.id===s,onSelect:()=>n(e.id),onAbort:()=>l(e)},e.id)),(0,a.jsxs)("button",{type:"button",disabled:!0,title:"Inline column creation is disabled; use Create Task to submit a mission through the supported dispatch flow.",className:"rounded-[10px] border border-white/[0.08] bg-white/[0.03] px-3 py-2.5 text-xs text-slate-500",children:[(0,a.jsx)(i.A,{className:"mr-1.5 inline h-3.5 w-3.5"})," Add Task"]})]})]})}function tg({task:e,selected:t,onSelect:s,onAbort:n}){let l=tq(e);return(0,a.jsxs)("div",{role:"button",tabIndex:0,onClick:s,onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),s())},className:(0,eB.cn)("rounded-[10px] border bg-white/[0.035] p-2.5 text-left transition-all hover:bg-white/[0.055] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cyan-300/40",t?"border-blue-400/70 shadow-[0_0_0_1px_rgba(59,130,246,0.18)]":"border-white/[0.08]"),children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("h3",{className:"line-clamp-2 text-xs font-semibold text-white",children:e.title}),(0,a.jsx)("p",{className:"mt-1 truncate text-[0.68rem] text-slate-400",children:e.agentName})]}),(0,a.jsx)(te,{})]}),(0,a.jsxs)("div",{className:"mt-2.5 flex flex-wrap gap-1.5",children:[(0,a.jsx)(ts,{children:e.category}),(0,a.jsx)(e4,{label:e.priority,tone:"High"===e.priority?"danger":"Medium"===e.priority?"warning":"success",dot:!1})]}),"running"===e.status?(0,a.jsxs)("div",{className:"mt-2.5",children:[(0,a.jsxs)("div",{className:"mb-1 flex justify-between text-[0.68rem] text-slate-400",children:[(0,a.jsxs)("span",{children:[e.progress,"%"]}),(0,a.jsx)("span",{children:e.tokenLabel})]}),(0,a.jsx)(e7,{value:e.progress})]}):null,(0,a.jsxs)("div",{className:"mt-2.5 flex items-center justify-between gap-2 text-[0.68rem] text-slate-400",children:[(0,a.jsx)("span",{children:e.dueLabel}),(0,a.jsx)("span",{children:"approval"===e.status?`Est. cost ${e.tokenLabel}`:e.tokenLabel})]}),(0,a.jsxs)("div",{className:"mt-2.5 flex gap-2",children:["approval"===e.status?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(eq.$,{variant:"secondary",size:"sm",className:"h-7 flex-1 rounded-[8px] px-2 text-[0.7rem]",disabled:!0,title:"Approval review decisions are not exposed by the current task API.",onClick:e=>e.stopPropagation(),children:"Review"}),(0,a.jsx)(eq.$,{variant:"secondary",size:"sm",className:"h-7 flex-1 rounded-[8px] border-rose-400/20 px-2 text-[0.7rem] text-rose-200",disabled:!0,title:"Reject is not exposed by the current task API.",onClick:e=>e.stopPropagation(),children:"Reject"})]}):"running"===e.status?(0,a.jsxs)(eq.$,{variant:"secondary",size:"sm",className:"h-7 flex-1 rounded-[8px] px-2 text-[0.7rem]",disabled:!0,title:"Pause is not exposed by the current task API.",onClick:e=>e.stopPropagation(),children:[(0,a.jsx)(w.A,{className:"mr-1.5 h-3 w-3"})," Pause"]}):(0,a.jsxs)(eq.$,{variant:"secondary",size:"sm",className:"h-7 flex-1 rounded-[8px] px-2 text-[0.7rem]",onClick:e=>{e.stopPropagation(),s()},children:[(0,a.jsx)(g.A,{className:"mr-1.5 h-3 w-3"})," Open"]}),(0,a.jsx)(eq.$,{variant:"secondary",size:"sm",className:"h-7 rounded-[8px] px-2",disabled:!l,title:l?"Cancel this task through the supported abort action.":"This task status cannot be cancelled.",onClick:e=>{e.stopPropagation(),n()},children:(0,a.jsx)(y.A,{className:"h-3 w-3"})})]})]})}function tb({task:e,selected:t,onSelect:s,onAbort:n}){let l=tq(e);return(0,a.jsxs)("div",{role:"button",tabIndex:0,onClick:s,onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),s())},className:(0,eB.cn)("grid w-full grid-cols-[1fr_auto_auto_auto] items-center gap-3 px-3 py-2.5 text-left text-xs hover:bg-white/[0.035] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cyan-300/40",t&&"bg-blue-500/[0.08]"),children:[(0,a.jsxs)("span",{className:"min-w-0",children:[(0,a.jsx)("span",{className:"block truncate font-semibold text-white",children:e.title}),(0,a.jsxs)("span",{className:"mt-1 block truncate text-[0.68rem] text-slate-400",children:[e.agentName," \xb7 ",e.category]})]}),(0,a.jsx)(e4,{label:e.statusLabel,tone:e.statusTone}),(0,a.jsx)("span",{className:"w-24 text-right text-slate-400",children:e.tokenLabel}),(0,a.jsx)(eq.$,{variant:"secondary",size:"sm",className:"h-7 rounded-[8px] px-2 text-[0.7rem]",disabled:!l,title:l?"Cancel this task through the supported abort action.":"This task status cannot be cancelled.",onClick:e=>{e.stopPropagation(),n()},children:"Cancel"})]})}function tf({task:e,onAbort:t}){let s=tq(e);return(0,a.jsxs)(e3,{title:"Task Details",children:[(0,a.jsx)("h2",{className:"text-base font-semibold text-white",children:e.title}),(0,a.jsxs)("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[(0,a.jsx)(e4,{label:e.statusLabel,tone:e.statusTone}),(0,a.jsxs)("span",{className:"font-mono text-[0.68rem] text-slate-500",children:["ID: ",e.id.slice(0,18)]})]}),(0,a.jsx)(e2,{title:"Assigned Agent",className:"mt-3",children:(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 p-2.5",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("p",{className:"truncate text-xs font-semibold text-white",children:e.agentName}),(0,a.jsxs)("p",{className:"mt-1 text-[0.68rem] text-slate-400",children:[e.category," work item"]})]}),(0,a.jsx)(eq.$,{variant:"secondary",size:"sm",className:"h-7 rounded-[8px] px-2 text-[0.7rem]",disabled:!0,title:"Task-to-agent messaging is not exposed from this inspector. Use the Agents page chat for direct messages.",children:"Message"})]})}),(0,a.jsxs)("div",{className:"mt-3 space-y-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-[0.58rem] font-semibold uppercase tracking-[0.16em] text-slate-500",children:"Objective"}),(0,a.jsx)("p",{className:"mt-1.5 text-xs leading-5 text-slate-300",children:e.objective})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-[0.58rem] font-semibold uppercase tracking-[0.16em] text-slate-500",children:"Description"}),(0,a.jsx)("p",{className:"mt-1.5 text-xs leading-5 text-slate-300",children:e.description})]})]}),(0,a.jsxs)("div",{className:"mt-3 grid grid-cols-3 gap-2 rounded-[10px] border border-white/[0.08] bg-white/[0.03] p-2.5",children:[(0,a.jsx)(tz,{label:"Status",value:e.statusLabel}),(0,a.jsx)(tz,{label:"Priority",value:e.priority}),(0,a.jsx)(tz,{label:"Due",value:e.dueLabel})]}),(0,a.jsxs)("div",{className:"mt-3",children:[(0,a.jsxs)("div",{className:"mb-1.5 flex justify-between text-xs",children:[(0,a.jsx)("span",{className:"text-slate-400",children:"Progress"}),(0,a.jsxs)("span",{className:"text-blue-300",children:[e.progress,"%"]})]}),(0,a.jsx)(e7,{value:e.progress})]}),(0,a.jsxs)("div",{className:"mt-4 rounded-[10px] border border-white/[0.08] bg-white/[0.03] px-3",children:[(0,a.jsx)(e6,{label:"Task Key",value:e.source?.key??"Not reported"}),(0,a.jsx)(e6,{label:"Approvals",value:"approval"===e.status?"Review required by task warnings":"Not reported"}),(0,a.jsx)(e6,{label:"Outputs / Files",value:`${e.artifactCount} files`}),(0,a.jsx)(e6,{label:"Warnings",value:`${e.warningCount} warnings`})]}),(0,a.jsxs)("div",{className:"mt-4 grid grid-cols-2 gap-2",children:[(0,a.jsx)(eq.$,{size:"sm",className:"h-8 rounded-[9px] bg-blue-500 text-xs text-white hover:bg-blue-400",disabled:!0,title:"Task details are already shown in this inspector.",children:"Open"}),(0,a.jsx)(eq.$,{variant:"secondary",size:"sm",className:"h-8 rounded-[9px] text-xs",disabled:!0,title:"Pause is not exposed by the current task API.",children:"Pause"}),(0,a.jsx)(eq.$,{variant:"secondary",size:"sm",className:"h-8 rounded-[9px] text-xs",disabled:!0,title:"Retry/run-again requires a supported replay contract for the original mission.",children:"Run Again"}),(0,a.jsx)(eq.$,{variant:"destructive",size:"sm",className:"h-8 rounded-[9px] text-xs",disabled:!s,title:s?"Cancel this task through the supported abort action.":"This task status cannot be cancelled.",onClick:t,children:"Cancel"})]})]})}function tv({tasks:e}){return(0,a.jsx)(e2,{title:"Recent Activity",children:0===e.length?(0,a.jsx)(tt,{title:"No task activity",description:"No task records were reported in the current AgentOS snapshot."}):(0,a.jsx)("div",{className:"divide-y divide-white/[0.06] px-3",children:e.map(e=>(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 py-2.5 text-[0.68rem]",children:[(0,a.jsx)("span",{className:"min-w-0 truncate text-slate-300",children:e.title}),(0,a.jsx)("span",{className:"shrink-0 text-slate-500",children:e.statusLabel})]},e.id))})})}function tj({snapshot:e,activeWorkspaceId:t}){var s;let r=t?e.workspaces.find(e=>e.id===t)??null:null,o=(0,n.useMemo)(()=>t?r?[r]:[]:e.workspaces,[r,t,e.workspaces]),[c,d]=(0,n.useState)({}),[p,x]=(0,n.useState)(!1),[h,g]=(0,n.useState)(null),[b,f]=(0,n.useState)(""),[v,j]=(0,n.useState)("All Files"),[w,y]=(0,n.useState)("path"),[O,P]=(0,n.useState)("list"),[I,R]=(0,n.useState)(""),[$,U]=(0,n.useState)(null),[z,D]=(0,n.useState)(!1),[F,W]=(0,n.useState)(0);(0,n.useEffect)(()=>{if(0===o.length){d({}),g(null);return}let e=!1;return x(!0),g(null),(async()=>{let t=await Promise.all(o.map(async e=>{try{let t=await fetch(`/api/workspaces/${encodeURIComponent(e.id)}/files`,{cache:"no-store"}),s=await t.json();if(!t.ok||s.error)throw Error(s.error||"Workspace files could not be loaded.");return{workspaceId:e.id,files:s.files,error:null}}catch(t){return{workspaceId:e.id,files:[],error:`${e.name}: ${t instanceof Error?t.message:"Workspace files could not be loaded."}`}}}));if(!e){d(Object.fromEntries(t.map(e=>[e.workspaceId,e.files])));let e=t.map(e=>e.error).filter(e=>!!e);e.length>0&&g(e.join(" ")),x(!1)}})(),()=>{e=!0}},[F,o]);let E=(0,n.useMemo)(()=>o.flatMap(t=>{var s,a;return s=c[t.id]??[],a=e.agents.filter(e=>e.workspaceId===t.id),0===s.length?[]:s.map(e=>{var s,n,l,i,r;let o,c="memory"===(s=e).category?"Memory":"context"===s.category||"identity"===s.category||"tools"===s.category||"boot"===s.category||"project-config"===s.category||"agent-policy-config"===s.category?"Core Knowledge":"skills"===s.category?"Generated Outputs":"All Files",d=function(e,t){let s=/^agents\/([^/]+)\/PROFILE\.md$/.exec(e.path),a=s?.[1]?t.find(e=>e.id===s[1]):null;if(a)return a;let n=/^\.openclaw\/agents\/([^/]+)\/agent\//.exec(e.path),l=n?.[1]?t.find(e=>e.id===n[1]):null;return l||(t.find(t=>{var s;return e.path===`skills/${s=t.id,`agent-policy-${s.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,64)||"agent"}`}/SKILL.md`})??null)}(e,a);return{id:`${t?.id??"global"}:${e.path}`,name:e.label,path:`/${e.path}`,relativePath:e.path,type:"json"===e.language?"JSON":"Markdown",category:e.category,collection:c,updatedLabel:e.exists?"Not reported":"Not created",owner:d?(0,ep.CK)(d):"Workspace",workspaceId:t?.id??null,workspaceName:t?.name??"All workspaces",workspacePath:t?.path??null,sizeLabel:null==e.size?"-":eC(e.size),sizeBytes:e.size,tags:(o=[(n=e).category.replace("-config",""),n.source],n.editable||o.push("read-only"),o.slice(0,3)),tasks:0,icon:(l=e.path,i=e.language,l.endsWith(".json")?es.A:l.endsWith(".csv")?ea.A:l.endsWith(".zip")?en.A:l.endsWith("/")?T.A:"json"===i?es.A:k.A),iconTone:(r=e).exists?"memory"===r.category?"purple":"project-config"===r.category||"agent-policy-config"===r.category?"warning":"info":"muted",source:e}})}),[c,e.agents,o]),q=E.filter(e=>{let t=b.trim().toLowerCase(),s=!t||[e.name,e.path,e.type,e.owner,e.workspaceName,...e.tags].join(" ").toLowerCase().includes(t),a="All Files"===v||e.collection===v;return s&&a}).sort((e,t)=>{var s,a,n;return s=e,a=t,"name"===(n=w)?s.name.localeCompare(a.name):"collection"===n?s.collection.localeCompare(a.collection)||s.name.localeCompare(a.name):"size"===n?(a.sizeBytes??-1)-(s.sizeBytes??-1)||s.name.localeCompare(a.name):s.relativePath.localeCompare(a.relativePath)}),_=q.find(e=>e.id===I)??q[0]??null,H=E.reduce((e,t)=>e+(t.sizeBytes??0),0),G=E.filter(e=>"Generated Outputs"===e.collection).length,K=E.filter(e=>"Memory"===e.collection).length,J=E.filter(e=>"Core Knowledge"===e.collection).length,V=["All Files",...Array.from(new Set(E.map(e=>e.collection))).sort()],X=["path","name","collection","size"],Q=async e=>{if(!e.workspacePath)return void ta.o.message("This file is not attached to a workspace.");try{let t=await fetch("/api/files/reveal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e.source?.path??e.relativePath,basePath:e.workspacePath})}),s=await t.json();if(!t.ok||s.error)throw Error(s.error||"Unable to reveal file.");ta.o.success("File revealed in Finder.")}catch(e){ta.o.error("File open failed.",{description:e instanceof Error?e.message:"Unknown file error."})}};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(tU,{main:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(eX,{title:"Files",subtitle:"Manage workspace documents, knowledge files, memory, and generated outputs.",actions:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(eq.$,{variant:"secondary",size:"sm",className:"h-8 rounded-[10px] px-3 text-xs",disabled:!0,title:"Runtime artifact import is not exposed by the current workspace file API.",children:[(0,a.jsx)(l.A,{className:"mr-1.5 h-3.5 w-3.5"}),"Import from Agent"]}),(0,a.jsxs)(eq.$,{variant:"secondary",size:"sm",className:"h-8 rounded-[10px] px-3 text-xs",disabled:!0,title:"Uploads are not exposed by the current workspace file API.",children:[(0,a.jsx)(N.A,{className:"mr-1.5 h-3.5 w-3.5"}),"Upload Files"]}),(0,a.jsxs)(eq.$,{size:"sm",className:"h-8 rounded-[10px] bg-blue-500 px-3 text-xs text-white shadow-blue-500/20 hover:bg-blue-400",disabled:!t,title:t?"Open the existing workspace file reader/editor.":"Select a workspace to open workspace files.",onClick:()=>D(!0),children:[(0,a.jsx)(k.A,{className:"mr-1.5 h-3.5 w-3.5"}),"Workspace Files"]})]})}),(0,a.jsxs)(eY,{columns:5,children:[(0,a.jsx)(eQ,{label:"Total Files",value:String(E.length),detail:p?"Loading workspace files":`${q.length} visible`,icon:k.A,tone:"info"}),(0,a.jsx)(eQ,{label:"Core Files",value:String(J),detail:`${Math.round(J/Math.max(1,E.length)*100)}% of total`,icon:C.A,tone:"success"}),(0,a.jsx)(eQ,{label:"Generated Outputs",value:String(G),detail:"Managed workspace files",icon:A.A,tone:"purple"}),(0,a.jsx)(eQ,{label:"Memory Docs",value:String(K),detail:"Durable context",icon:S.A,tone:"warning"}),(0,a.jsx)(eQ,{label:"Storage Used",value:eC(H),detail:E.some(e=>null!=e.sizeBytes)?"From file metadata":"No file sizes reported",icon:L.A,tone:"info"})]}),(0,a.jsxs)(eZ,{search:b,onSearchChange:f,searchPlaceholder:"Search files...",right:(0,a.jsx)(e1,{value:O,onChange:P}),children:[(0,a.jsx)(e0,{icon:u.A,label:`Collection: ${v}`,active:"All Files"!==v,onClick:()=>j("All Files")}),(0,a.jsx)(e0,{icon:M.A,label:"Workspace managed files",disabled:!0,title:"Only managed workspace files are exposed by the current file API."}),(0,a.jsx)(e0,{icon:m.A,label:`Sort: ${"path"===(s=w)?"Path":tB(s)}`,chevron:!0,onClick:()=>y(e=>X[(X.indexOf(e)+1)%X.length])})]}),h?(0,a.jsx)("div",{className:"rounded-[10px] border border-amber-300/20 bg-amber-400/10 px-3 py-2.5 text-xs text-amber-100",children:h}):null,(0,a.jsxs)("div",{className:"grid gap-2.5 xl:grid-cols-[180px_minmax(0,1fr)]",children:[(0,a.jsxs)(e2,{title:"Collections",action:(0,a.jsx)("button",{className:"text-slate-500",disabled:!0,title:"Custom collections are not exposed by the workspace file API.",children:(0,a.jsx)(i.A,{className:"h-3.5 w-3.5"})}),children:[(0,a.jsx)("div",{className:"flex flex-col gap-1 p-2.5",children:V.map(e=>{let t=eP[e]??T.A,s="All Files"===e?E.length:E.filter(t=>t.collection===e).length;return(0,a.jsxs)("button",{type:"button",onClick:()=>j(e),className:(0,eB.cn)("flex items-center justify-between gap-2 rounded-[9px] px-2.5 py-2 text-left text-xs transition-colors",v===e?"bg-blue-500/[0.14] text-blue-200":"text-slate-300 hover:bg-white/[0.05] hover:text-white"),children:[(0,a.jsxs)("span",{className:"flex min-w-0 items-center gap-2",children:[(0,a.jsx)(t,{className:"h-3.5 w-3.5 shrink-0"}),(0,a.jsx)("span",{className:"truncate",children:e})]}),(0,a.jsx)("span",{className:"text-[0.68rem] text-slate-500",children:s})]},e)})}),(0,a.jsxs)("div",{className:"mt-auto border-t border-white/[0.07] p-3",children:[(0,a.jsxs)("div",{className:"mb-2 flex items-center justify-between text-[0.68rem] text-slate-400",children:[(0,a.jsx)("span",{children:"Storage"}),(0,a.jsx)("span",{children:E.some(e=>null!=e.sizeBytes)?"Reported":"Unknown"})]}),(0,a.jsx)(e7,{value:E.some(e=>null!=e.sizeBytes)?Math.min(100,H/1e10*100):0}),(0,a.jsx)(eq.$,{variant:"secondary",size:"sm",className:"mt-3 h-7 w-full rounded-[8px] px-2 text-[0.7rem]",disabled:!0,title:"Storage quota management is not exposed by the current workspace file API.",children:"Manage Storage"})]})]}),(0,a.jsxs)(e2,{title:`Files (${E.length})`,children:[p?(0,a.jsx)("div",{className:"p-6 text-center text-xs text-slate-400",children:"Loading workspace files..."}):0===q.length?(0,a.jsx)(tt,{title:"No files found",description:0===E.length?"No managed workspace files were returned by the current workspace file API.":"Clear search or collection filters to inspect another file set."}):"list"===O?(0,a.jsx)(tw,{files:q,selectedId:_?.id,onSelect:R,onPreview:U,onReveal:Q}):(0,a.jsx)("div",{className:"grid gap-2.5 p-3 lg:grid-cols-2 2xl:grid-cols-3",children:q.map(e=>(0,a.jsxs)("button",{type:"button",onClick:()=>R(e.id),className:(0,eB.cn)("rounded-[10px] border p-3 text-left hover:bg-white/[0.05]",e.id===_?.id?"border-blue-400/60 bg-blue-500/[0.08]":"border-white/[0.08] bg-white/[0.03]"),children:[(0,a.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,a.jsx)(e8,{icon:e.icon,label:e.name,tone:e.iconTone}),(0,a.jsxs)("span",{className:"min-w-0",children:[(0,a.jsx)("span",{className:"block truncate text-xs font-semibold text-white",children:e.name}),(0,a.jsx)("span",{className:"mt-1 block truncate text-[0.68rem] text-slate-500",children:e.path})]})]}),(0,a.jsx)("div",{className:"mt-2.5 flex flex-wrap gap-1.5",children:e.tags.map(e=>(0,a.jsx)(ts,{children:e},e))})]},e.id))}),(0,a.jsxs)("div",{className:"flex items-center justify-between border-t border-white/[0.07] px-3 py-2.5 text-[0.68rem] text-slate-400",children:[(0,a.jsxs)("span",{children:["Showing ",q.length," of ",E.length," files"]}),(0,a.jsx)("span",{children:"Workspace managed files only"})]})]})]})]}),inspector:_?(0,a.jsx)(ty,{file:_,onReveal:()=>Q(_),onPreview:()=>U(_)}):null}),(0,a.jsx)(B.W,{snapshot:e,workspaceId:t,open:z,onOpenChange:D}),(0,a.jsx)(tN,{file:$,open:!!$,onOpenChange:e=>U(e?$:null),onSaved:()=>{U(null),W(e=>e+1)}})]})}function tw({files:e,selectedId:t,onSelect:s,onPreview:n,onReveal:l}){return(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)("table",{className:"w-full min-w-[700px] text-left text-[0.72rem]",children:[(0,a.jsx)("thead",{className:"border-b border-white/[0.07] text-[0.56rem] uppercase tracking-[0.14em] text-slate-500",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"w-8 px-3 py-2.5",children:(0,a.jsx)("span",{className:"block h-3.5 w-3.5 rounded border border-white/[0.14]"})}),(0,a.jsx)("th",{className:"px-2 py-2.5 font-semibold",children:"Name"}),(0,a.jsx)("th",{className:"px-2 py-2.5 font-semibold",children:"Type"}),(0,a.jsx)("th",{className:"px-2 py-2.5 font-semibold",children:"Last Updated"}),(0,a.jsx)("th",{className:"px-2 py-2.5 font-semibold",children:"Owner / Agent"}),(0,a.jsx)("th",{className:"px-2 py-2.5 font-semibold",children:"Size"}),(0,a.jsx)("th",{className:"px-2 py-2.5 font-semibold",children:"Tags"}),(0,a.jsx)("th",{className:"px-3 py-2.5 font-semibold",children:"Actions"})]})}),(0,a.jsx)("tbody",{className:"divide-y divide-white/[0.06] text-slate-300",children:e.map(e=>(0,a.jsxs)("tr",{onClick:()=>s(e.id),className:(0,eB.cn)("cursor-pointer hover:bg-white/[0.035]",e.id===t&&"bg-blue-500/[0.10] outline outline-1 outline-blue-400/50"),children:[(0,a.jsx)("td",{className:"px-3 py-2.5",children:(0,a.jsx)("span",{className:(0,eB.cn)("flex h-3.5 w-3.5 items-center justify-center rounded border",e.id===t?"border-blue-400 bg-blue-500 text-white":"border-white/[0.14]"),children:(0,a.jsx)(O.A,{className:"h-2.5 w-2.5"})})}),(0,a.jsx)("td",{className:"px-2 py-2.5",children:(0,a.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,a.jsx)(e8,{icon:e.icon,label:e.name,tone:e.iconTone,size:"sm"}),(0,a.jsxs)("span",{className:"min-w-0",children:[(0,a.jsx)("span",{className:"block truncate font-semibold text-white",children:e.name}),(0,a.jsxs)("span",{className:"mt-0.5 block truncate text-[0.66rem] text-slate-500",children:[e.workspaceName," \xb7 ",e.path]})]})]})}),(0,a.jsx)("td",{className:"px-2 py-2.5",children:(0,a.jsx)(ts,{children:e.type})}),(0,a.jsx)("td",{className:"px-2 py-2.5",children:e.updatedLabel}),(0,a.jsx)("td",{className:"px-2 py-2.5",children:(0,a.jsx)("span",{className:"line-clamp-2 max-w-24",children:e.owner})}),(0,a.jsx)("td",{className:"px-2 py-2.5",children:e.sizeLabel}),(0,a.jsx)("td",{className:"px-2 py-2.5",children:(0,a.jsx)("div",{className:"flex max-w-28 flex-wrap gap-1",children:e.tags.slice(0,2).map(e=>(0,a.jsx)(ts,{children:e},e))})}),(0,a.jsx)("td",{className:"px-3 py-2.5",children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)(eq.$,{variant:"secondary",size:"sm",className:"h-7 rounded-[8px] px-2 text-[0.7rem]",disabled:!e.source?.exists,title:e.source?.exists?"Read this managed workspace file.":"File is not created yet.",onClick:t=>{t.stopPropagation(),n(e)},children:"Preview"}),(0,a.jsx)(eq.$,{variant:"secondary",size:"sm",className:"h-7 rounded-[8px] px-2 text-[0.7rem]",disabled:!e.workspacePath,title:e.workspacePath?"Reveal this file in Finder.":"Reveal requires a workspace path.",onClick:t=>{t.stopPropagation(),l(e)},children:"Reveal"})]})})]},e.id))})]})})}function ty({file:e,onReveal:t,onPreview:s}){return(0,a.jsxs)(e3,{children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,a.jsxs)("div",{className:"flex min-w-0 items-center gap-2.5",children:[(0,a.jsx)(e8,{icon:e.icon,label:e.name,tone:e.iconTone,size:"lg"}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("h2",{className:"truncate text-base font-semibold text-white",children:e.name}),(0,a.jsxs)("div",{className:"mt-1.5 flex gap-1.5",children:[(0,a.jsx)(ts,{children:e.type}),(0,a.jsx)(ts,{children:e.sizeLabel})]})]})]}),(0,a.jsx)(te,{})]}),(0,a.jsxs)("div",{className:"mt-3 grid grid-cols-3 gap-2",children:[(0,a.jsxs)(eq.$,{size:"sm",className:"h-8 rounded-[9px] bg-blue-500 px-2 text-xs text-white hover:bg-blue-400",onClick:t,children:[(0,a.jsx)(P.A,{className:"mr-1.5 h-3.5 w-3.5"}),"Open"]}),(0,a.jsx)(eq.$,{variant:"secondary",size:"sm",className:"h-8 rounded-[9px] px-2 text-xs",disabled:!e.source?.exists,title:e.source?.exists?"Read this managed workspace file.":"File is not created yet.",onClick:s,children:"Preview"}),(0,a.jsx)(eq.$,{variant:"secondary",size:"sm",className:"h-8 rounded-[9px] px-2 text-xs",disabled:!0,title:"Additional file actions require backend support.",children:"More"})]}),(0,a.jsx)("div",{className:"mt-3 border-b border-white/[0.08] px-3 py-2.5 text-xs text-blue-200",children:"Details"}),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"mt-3 rounded-[10px] border border-white/[0.08] bg-white/[0.03] px-3",children:[(0,a.jsx)(e6,{label:"File Path",value:e.path}),(0,a.jsx)(e6,{label:"Type",value:e.type}),(0,a.jsx)(e6,{label:"Size",value:e.sizeLabel}),(0,a.jsx)(e6,{label:"Last Updated",value:e.updatedLabel}),(0,a.jsx)(e6,{label:"Workspace",value:e.workspaceName}),(0,a.jsx)(e6,{label:"Owner / Agent",value:e.owner}),(0,a.jsx)(e6,{label:"Workspace API",value:e.source?"Managed file":"Not reported"})]}),(0,a.jsxs)("div",{className:"mt-3",children:[(0,a.jsx)("p",{className:"text-[0.58rem] font-semibold uppercase tracking-[0.16em] text-slate-500",children:"Tags"}),(0,a.jsx)("div",{className:"mt-1.5 flex flex-wrap gap-1.5",children:e.tags.map(e=>(0,a.jsx)(ts,{children:e},e))})]}),(0,a.jsxs)("div",{className:"mt-3",children:[(0,a.jsx)("p",{className:"text-[0.58rem] font-semibold uppercase tracking-[0.16em] text-slate-500",children:"Description"}),(0,a.jsx)("p",{className:"mt-1.5 text-xs leading-5 text-slate-300",children:e.source?.description??"Workspace context file managed by AgentOS and OpenClaw."})]})]}),(0,a.jsx)(e2,{title:"Quick Actions",className:"mt-4",children:(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-2 p-2.5",children:[(0,a.jsx)(eq.$,{variant:"secondary",size:"sm",className:"h-8 rounded-[9px] px-2 text-xs",disabled:!0,title:"Share requires backend support.",children:"Share"}),(0,a.jsx)(eq.$,{variant:"secondary",size:"sm",className:"h-8 rounded-[9px] px-2 text-xs",disabled:!0,title:"Context selection persistence is not exposed by the workspace file API.",children:"Add to Context"}),(0,a.jsx)(eq.$,{variant:"destructive",size:"sm",className:"col-span-2 h-8 rounded-[9px] px-2 text-xs",disabled:!0,title:"Trash/delete is not exposed by the workspace file API.",children:"Move to Trash"})]})})]})}function tN({file:e,open:t,onOpenChange:s,onSaved:l}){let[i,r]=(0,n.useState)(""),[o,c]=(0,n.useState)(""),[d,p]=(0,n.useState)(!1),[u,m]=(0,n.useState)(!1),[x,h]=(0,n.useState)(null),g=!!(e?.workspaceId&&e?.source?.exists),b=!!(e?.workspaceId&&e?.source?.editable&&i!==o&&!d&&!u);(0,n.useEffect)(()=>{if(!t||!e){r(""),c(""),h(null);return}if(!g)return void h("This file cannot be read because it is not created yet or is not attached to a workspace.");let s=!1;return p(!0),h(null),(async()=>{try{let t=await fetch(`/api/workspaces/${encodeURIComponent(e.workspaceId??"")}/files?path=${encodeURIComponent(e.relativePath)}`,{cache:"no-store"}),a=await t.json();if(!t.ok||a.error)throw Error(a.error||"Workspace file could not be read.");s||(r(a.content),c(a.content))}catch(e){s||h(t$(e))}finally{s||p(!1)}})(),()=>{s=!0}},[g,e,t]);let f=async()=>{if(!e?.workspaceId)return void h("This file is not attached to a workspace.");m(!0),h(null);try{let t=await fetch(`/api/workspaces/${encodeURIComponent(e.workspaceId)}/files`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e.relativePath,content:i})}),s=await t.json();if(!t.ok||s.error)throw Error(s.error||"Workspace file could not be saved.");c(s.content),r(s.content),ta.o.success("Workspace file saved."),l()}catch(e){h(t$(e))}finally{m(!1)}};return(0,a.jsx)(ti.lG,{open:t,onOpenChange:s,children:(0,a.jsxs)(ti.Cf,{className:"flex h-[min(82dvh,780px)] max-w-4xl flex-col rounded-[18px] border-white/[0.10] bg-[#08111f]/95 p-4",children:[(0,a.jsxs)(ti.c7,{children:[(0,a.jsx)(ti.L3,{children:e?.name??"Workspace File"}),(0,a.jsx)(ti.rr,{children:"Reads and saves through the existing workspace file API with workspace path safety checks."})]}),x?(0,a.jsx)("div",{className:"rounded-[10px] border border-rose-300/20 bg-rose-400/10 px-3 py-2 text-xs text-rose-100",children:x}):null,(0,a.jsx)(tr.T,{value:i,onChange:e=>r(e.target.value),readOnly:d||u||!e?.source?.editable,placeholder:d?"Loading workspace file...":"File content",className:"min-h-0 flex-1 resize-none rounded-[12px] border-white/[0.10] bg-slate-950/50 font-mono text-xs leading-5 text-slate-100"}),(0,a.jsxs)(ti.Es,{children:[(0,a.jsx)(eq.$,{variant:"secondary",size:"sm",className:"h-8 rounded-[9px] text-xs",onClick:()=>s(!1),children:"Close"}),(0,a.jsx)(eq.$,{size:"sm",className:"h-8 rounded-[9px] bg-blue-500 text-xs text-white hover:bg-blue-400",disabled:!b,title:e?.source?.editable?"Save this managed workspace file.":"This managed file is read-only.",onClick:()=>void f(),children:u?"Saving...":"Save"})]})]})})}function tk({snapshot:e,rootSnapshot:t,refresh:s,setSnapshot:r}){let o=(0,n.useMemo)(()=>(function(e){if(0===e.models.length)return[];let t=e.diagnostics.modelReadiness.resolvedDefaultModel??e.diagnostics.modelReadiness.defaultModel;return e.models.map(e=>{var s,a,n,l;let i,r;return{id:e.id,name:e.name||e.id,provider:(s=e.provider)?"openai"===s?"OpenAI":"openrouter"===s?"OpenRouter":eM(s.replace(/[-_]/g," ")):"Unknown",statusLabel:e.local?"Local":e.missing||!1===e.available?"Unavailable":"Healthy",statusTone:e.missing||!1===e.available?"danger":e.local?"info":"success",latencyLabel:"Not reported",contextLabel:(0,ep.FO)(e.contextWindow),costLabel:"Not reported",rateLimitLabel:"Not reported",role:(a=e,n=t,i=new Set(a.tags.map(e=>e.toLowerCase())),a.id===n||i.has("default")||i.has("primary")?"Primary":i.has("fallback")?"Fallback":i.has("experimental")||i.has("preview")||i.has("beta")?"Experimental":"Secondary"),lastActiveLabel:e.usageCount>0?`${e.usageCount} use${1===e.usageCount?"":"s"}`:"Not reported",capabilities:((r=(l=e).input.split(/[+,/|]+/).map(e=>e.trim()).filter(Boolean).map(e=>"image"===e?"Vision":eM(e))).push(...l.tags.map(eM)),Array.from(new Set(r))),source:e}})})(e),[e]),[c,d]=(0,n.useState)(""),[h,g]=(0,n.useState)("All Providers"),[b,f]=(0,n.useState)("provider"),[v,j]=(0,n.useState)(o[0]?.id??""),[w,y]=(0,n.useState)("Details"),[N,k]=(0,n.useState)(!1),[C,L]=(0,n.useState)(null),M=["All Providers",...Array.from(new Set(o.map(e=>e.provider)))],T=["provider","name","status","role"],O=o.filter(e=>{let t=c.trim().toLowerCase(),s=!t||[e.name,e.provider,e.id,e.role].join(" ").toLowerCase().includes(t),a="All Providers"===h||e.provider===h;return s&&a}).sort((e,t)=>{var s,a,n;return s=e,a=t,"name"===(n=b)?s.name.localeCompare(a.name):"status"===n?s.statusLabel.localeCompare(a.statusLabel)||s.name.localeCompare(a.name):"role"===n?s.role.localeCompare(a.role)||s.name.localeCompare(a.name):s.provider.localeCompare(a.provider)||s.name.localeCompare(a.name)}),P=O.find(e=>e.id===v)??O[0]??null,R=new Set(o.filter(e=>"danger"!==e.statusTone).map(e=>e.provider)).size,$=eN(e),U=e.diagnostics.modelReadiness.resolvedDefaultModel??e.diagnostics.modelReadiness.defaultModel,z=async e=>{let t=e.source?.provider;if(!t||!(0,to.a3)(t))return void ta.o.message("Default model change is unavailable.",{description:"This model provider is not supported by the model provider API."});L(e.id);try{let a=await fetch("/api/models/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"set-default",provider:t,modelId:e.id})}),n=await a.json().catch(()=>null);if(!a.ok||!n?.ok)throw Error(n?.error||n?.message||"Default model update failed.");n.snapshot?r(n.snapshot):await s(),ta.o.success("Default model updated.",{description:n.message})}catch(e){ta.o.error("Default model update failed.",{description:t$(e)})}finally{L(null)}};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(tU,{main:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(eX,{title:"Models",subtitle:"Configure default models, providers, routing, and runtime preferences for your AI agents.",actions:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(eq.$,{variant:"secondary",size:"sm",className:"h-8 rounded-[10px] px-3 text-xs",disabled:!0,title:"Model import is handled by the Add Models flow; there is no separate import backend.",children:[(0,a.jsx)(l.A,{className:"mr-1.5 h-3.5 w-3.5"}),"Import Model"]}),(0,a.jsxs)(eq.$,{size:"sm",className:"h-8 rounded-[10px] bg-blue-500 px-3 text-xs text-white shadow-blue-500/20 hover:bg-blue-400",onClick:()=>k(!0),children:[(0,a.jsx)(i.A,{className:"mr-1.5 h-3.5 w-3.5"}),"Add Model"]})]})}),(0,a.jsxs)(eZ,{search:c,onSearchChange:d,searchPlaceholder:"Search models...",children:[(0,a.jsx)(e0,{icon:S.A,label:h,chevron:!0,onClick:()=>g(e=>M[(M.indexOf(e)+1)%M.length])}),(0,a.jsx)(e0,{icon:u.A,label:"Configured models",disabled:!0,title:"Only configured models are exposed by the current model snapshot."}),(0,a.jsx)(e0,{icon:m.A,label:`Sort: ${tB(b)}`,chevron:!0,onClick:()=>f(e=>T[(T.indexOf(e)+1)%T.length])})]}),(0,a.jsxs)(eY,{columns:4,children:[(0,a.jsx)(eQ,{label:"Providers",value:String(R),detail:`${M.length-1} configured providers`,icon:I.A,tone:"info"}),(0,a.jsx)(eQ,{label:"Configured Models",value:String(o.length),detail:`${o.filter(e=>"danger"!==e.statusTone).length} available`,icon:A.A,tone:"success"}),(0,a.jsx)(eQ,{label:"Default Model",value:U?"1":"0",detail:U??"No default configured",icon:x.A,tone:"warning"}),(0,a.jsx)(eQ,{label:"Runtime Tokens",value:ek($),detail:$?"From live runtimes":"No token usage reported",icon:p.A,tone:"purple"})]}),(0,a.jsx)(e2,{title:"Providers & Models",children:0===O.length?(0,a.jsx)(tt,{title:"No models found",description:"Add models through the existing model setup flow or clear the current search/provider filter."}):(0,a.jsx)(tC,{models:O,selectedId:P?.id,settingDefaultId:C,onSelect:j,onSetDefault:e=>void z(e)})}),(0,a.jsxs)("div",{className:"grid gap-2.5 xl:grid-cols-[0.9fr_1.6fr]",children:[(0,a.jsx)(e2,{title:"Default Route",children:(0,a.jsxs)("div",{className:"divide-y divide-white/[0.07] px-3",children:[(0,a.jsx)(e6,{label:"Configured default",value:U??"Not configured"}),(0,a.jsx)(e6,{label:"Readiness",value:e.diagnostics.modelReadiness.ready?"Ready":"Needs setup"}),(0,a.jsx)(e6,{label:"Available models",value:String(e.diagnostics.modelReadiness.availableModelCount)}),(0,a.jsx)(e6,{label:"Missing models",value:String(e.diagnostics.modelReadiness.missingModelCount)})]})}),(0,a.jsx)(e2,{title:"Model Usage",children:(0,a.jsxs)("div",{className:"p-3",children:[(0,a.jsxs)("div",{className:"grid grid-cols-3 gap-3 text-xs",children:[(0,a.jsx)(tz,{label:"Requests",value:"Not reported"}),(0,a.jsx)(tz,{label:"Total Tokens",value:ek($)}),(0,a.jsx)(tz,{label:"Avg Latency",value:"Not reported"})]}),(0,a.jsx)(tF,{className:"mt-4",title:"Live routing metrics unavailable",description:"The current snapshot does not expose model request, cost, latency, or route split analytics. AgentOS shows configured models and runtime token usage only."})]})})]})]}),inspector:P?(0,a.jsx)(tA,{model:P,tab:w,onTabChange:y,settingDefault:C===P.id,onSetDefault:()=>void z(P),onOpenAddModels:()=>k(!0)}):null}),(0,a.jsx)(F.o,{open:N,onOpenChange:k,snapshot:t,onSnapshotChange:r})]})}function tC({models:e,selectedId:t,settingDefaultId:s,onSelect:n,onSetDefault:l}){return(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)("table",{className:"w-full min-w-[900px] text-left text-xs",children:[(0,a.jsx)("thead",{className:"border-b border-white/[0.07] text-[0.56rem] uppercase tracking-[0.14em] text-slate-500",children:(0,a.jsx)("tr",{children:["Model / Provider","Status","Context Window","Role","Usage","Actions"].map(e=>(0,a.jsx)("th",{className:"px-3 py-2.5 font-semibold",children:e},e))})}),(0,a.jsx)("tbody",{className:"divide-y divide-white/[0.06] text-slate-300",children:e.map(e=>(0,a.jsxs)("tr",{onClick:()=>n(e.id),className:(0,eB.cn)("cursor-pointer hover:bg-white/[0.035]",e.id===t&&"bg-blue-500/[0.10] outline outline-1 outline-blue-400/50"),children:[(0,a.jsx)("td",{className:"px-3 py-2.5",children:(0,a.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,a.jsx)(e8,{icon:A.A,label:e.name,tone:e.statusTone,size:"sm"}),(0,a.jsxs)("span",{children:[(0,a.jsx)("span",{className:"block font-semibold text-white",children:e.name}),(0,a.jsx)("span",{className:"text-[0.66rem] text-slate-500",children:e.provider})]})]})}),(0,a.jsx)("td",{className:"px-3 py-2.5",children:(0,a.jsx)(e4,{label:e.statusLabel,tone:e.statusTone})}),(0,a.jsx)("td",{className:"px-3 py-2.5",children:e.contextLabel}),(0,a.jsx)("td",{className:"px-3 py-2.5",children:(0,a.jsx)(e4,{label:e.role,tone:"Primary"===e.role?"info":"Fallback"===e.role?"purple":"Secondary"===e.role?"success":"warning",dot:!1})}),(0,a.jsx)("td",{className:"px-3 py-2.5",children:e.lastActiveLabel}),(0,a.jsx)("td",{className:"px-3 py-2.5",children:(0,a.jsx)(eq.$,{variant:"secondary",size:"sm",className:"h-7 rounded-[8px] px-2 text-[0.7rem]",disabled:s===e.id||"Primary"===e.role||"danger"===e.statusTone,title:"Primary"===e.role?"This model is already the default.":"danger"===e.statusTone?"Unavailable models cannot be selected as default.":"Set this configured model as the AgentOS default.",onClick:t=>{t.stopPropagation(),l(e)},children:s===e.id?"Saving...":"Set Default"})})]},e.id))})]})})}function tA({model:e,tab:t,onTabChange:s,settingDefault:n,onSetDefault:l,onOpenAddModels:i}){return(0,a.jsxs)(e3,{children:[(0,a.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,a.jsx)(e8,{icon:A.A,label:e.name,tone:e.statusTone,size:"lg"}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-base font-semibold text-white",children:e.name}),(0,a.jsx)("p",{className:"mt-1 text-xs text-slate-300",children:e.provider})]}),(0,a.jsx)(e4,{label:e.statusLabel,tone:e.statusTone})]}),(0,a.jsx)("p",{className:"mt-2.5 text-xs leading-5 text-slate-300",children:"Configured model route reported by AgentOS/OpenClaw."})]})]}),(0,a.jsxs)("div",{className:"mt-3 grid grid-cols-2 gap-2",children:[(0,a.jsx)(eq.$,{size:"sm",className:"col-span-2 h-8 rounded-[9px] bg-blue-500 text-xs text-white hover:bg-blue-400",disabled:n||"Primary"===e.role||"danger"===e.statusTone,title:"Primary"===e.role?"This model is already the default.":"danger"===e.statusTone?"Unavailable models cannot be selected as default.":"Set this configured model as the AgentOS default.",onClick:l,children:n?"Saving...":"Set as Default"}),(0,a.jsx)(eq.$,{variant:"secondary",size:"sm",className:"h-8 rounded-[9px] text-xs text-violet-200",disabled:!0,title:"Fallback routing is not exposed by the current model provider API.",children:"Set as Fallback"}),(0,a.jsx)(eq.$,{variant:"secondary",size:"sm",className:"h-8 rounded-[9px] text-xs",onClick:i,children:"Add Models"}),(0,a.jsx)(eq.$,{variant:"secondary",size:"sm",className:"h-8 rounded-[9px] text-xs",disabled:!0,title:"Model removal/disable is not exposed by the current model provider API.",children:"Disable"})]}),(0,a.jsx)("div",{className:"mt-3 flex border-b border-white/[0.08]",children:["Details","Capabilities","Performance"].map(e=>(0,a.jsx)("button",{type:"button",onClick:()=>s(e),className:(0,eB.cn)("border-b-2 px-3 py-2.5 text-xs",t===e?"border-blue-400 text-blue-200":"border-transparent text-slate-400 hover:text-white"),children:e},e))}),"Details"===t?(0,a.jsxs)("div",{className:"mt-3 rounded-[10px] border border-white/[0.08] bg-white/[0.03] px-3",children:[(0,a.jsx)(e6,{label:"Provider",value:e.provider}),(0,a.jsx)(e6,{label:"API Status",value:e.statusLabel}),(0,a.jsx)(e6,{label:"Model ID",value:e.id}),(0,a.jsx)(e6,{label:"Context Window",value:e.contextLabel}),(0,a.jsx)(e6,{label:"Latency",value:e.latencyLabel}),(0,a.jsx)(e6,{label:"Rate Limit",value:e.rateLimitLabel}),(0,a.jsx)(e6,{label:"Cost / 1M",value:e.costLabel})]}):"Capabilities"===t?(0,a.jsx)("div",{className:"mt-3 flex flex-wrap gap-1.5",children:e.capabilities.map(e=>(0,a.jsx)(ts,{children:e},e))}):(0,a.jsxs)("div",{className:"mt-4",children:[(0,a.jsx)(tF,{title:"Performance metrics unavailable",description:"The current snapshot does not expose per-model latency, cost, request volume, or route split analytics."}),(0,a.jsxs)("div",{className:"mt-3 grid grid-cols-2 gap-2.5",children:[(0,a.jsx)(tz,{label:"Latency",value:e.latencyLabel}),(0,a.jsx)(tz,{label:"Rate Limit",value:e.rateLimitLabel})]})]})]})}let tS={connected:"success",disabled:"muted","pending-setup":"warning",failed:"danger","needs-authentication":"warning","missing-credentials":"warning",unsupported:"muted",unknown:"muted"};function tL({snapshot:e,rootSnapshot:t,activeWorkspaceId:s,refresh:r,setSnapshot:o}){var d;let p=(0,n.useMemo)(()=>{let t,s,a,n,l,i,r;return(t=(0,ep.hv)(e.generatedAt),s=Date.parse(e.generatedAt),a=new Map(e.workspaces.map(e=>[e.id,e.name])),n=new Map(e.agents.map(e=>[e.id,e])),l=function(e){let t=new Map;for(let s of e){let e=eg(s.type);t.set(e,[...t.get(e)??[],s])}return t}(e.channelRegistry.channels),i=function(e){let t=new Map;for(let s of e){let e=eg(s.type);t.set(e,[...t.get(e)??[],s])}return t}(e.channelAccounts),r=function(e){let t=new Map;for(let s of e){let e=ev(s.provider||s.id);t.set(e,[...t.get(e)??[],s])}return t}(e.models),eh.map(o=>{let c=["integrationRegistry"];o.surfaceProvider&&c.push("OPENCLAW_SURFACE_CATALOG");let d=o.surfaceProvider?l.get(eg(o.surfaceProvider))??[]:[],p=o.surfaceProvider?i.get(eg(o.surfaceProvider))??[]:[],u=o.modelProvider?r.get(o.modelProvider)??[]:[];p.length>0&&c.push("snapshot.channelAccounts"),d.length>0&&c.push("snapshot.channelRegistry.channels"),u.length>0&&c.push("snapshot.models");let m=function(e){let t=new Map;for(let s of e.channels){let a=new Set;for(let e of(s.primaryAgentId&&a.add(s.primaryAgentId),s.workspaces)){for(let t of e.agentIds)a.add(t);for(let t of e.groupAssignments)t.agentId&&a.add(t.agentId)}for(let n of a){let a=e.agentsById.get(n);a&&t.set(a.id,ef(a,e.workspaceNameById,`Workspace surface: ${s.name}`))}}if(e.descriptor.modelProvider)for(let s of e.agents)ev(s.modelId)===e.descriptor.modelProvider&&t.set(s.id,ef(s,e.workspaceNameById,`Model route: ${s.modelId}`));if(e.descriptor.toolHints?.length){let s=RegExp(e.descriptor.toolHints.map(ej).join("|"),"i");for(let a of e.agents){let n=[...a.tools,...a.observedTools??[]].join(" ");(s.test(n)||s.test(a.policy.preset)||s.test(a.name))&&t.set(a.id,ef(a,e.workspaceNameById,"Agent tool configuration"))}}return Array.from(t.values()).sort((e,t)=>e.name.localeCompare(t.name))}({descriptor:o,channels:d,models:u,agents:e.agents,agentsById:n,workspaceNameById:a});m.length>0&&c.push("snapshot.agents");let x=function(e){let{descriptor:t,accounts:s,channels:a,models:n,linkedAgents:l,snapshot:i}=e,r=function(e){for(let t of e){let e=t.metadata??{},s=function(e,t){for(let s of t){let t=e[s];if("string"==typeof t&&t.trim())return t.trim()}return null}(e,["lastError","error","healthError","reason"])??("string"==typeof e.healthState&&/fail|error/i.test(e.healthState)?e.healthState:null);if(s)return s}return null}(s);if("unsupported"===t.managedBy)return{status:"unsupported",connectionHealth:{label:"Unsupported",detail:t.configure.reason},missingConfiguration:t.setupRequirements,errorMessage:null,uptimeLabel:"Unavailable",rateLimitLabel:"Unavailable",hasOperationalData:!1};if(!i.diagnostics.installed)return{status:"unknown",connectionHealth:{label:"OpenClaw not installed",detail:"AgentOS cannot resolve live integration state until OpenClaw is installed."},missingConfiguration:["OpenClaw installation"],errorMessage:null,uptimeLabel:"Unavailable",rateLimitLabel:"Unavailable",hasOperationalData:!1};if(r)return{status:"failed",connectionHealth:{label:"OpenClaw reported an error",detail:r},missingConfiguration:[],errorMessage:r,uptimeLabel:"Unavailable",rateLimitLabel:"Unavailable",hasOperationalData:!0};if(t.modelProvider){var o=t,c=n,d=i;if(0===c.length)return{status:"ollama"===o.modelProvider?"pending-setup":"missing-credentials",connectionHealth:{label:"ollama"===o.modelProvider?"No local models detected":"No configured model routes",detail:"ollama"===o.modelProvider?"Ollama may be installed, but this snapshot does not include any local Ollama model routes.":"Connect the provider and add at least one model route in the existing Add Models flow."},missingConfiguration:o.setupRequirements,errorMessage:null,uptimeLabel:"Unavailable",rateLimitLabel:"Unavailable",hasOperationalData:!1};if(c.every(e=>e.missing||!1===e.available))return{status:"failed",connectionHealth:{label:"Configured routes unavailable",detail:"OpenClaw returned model routes for this provider, but none are currently available."},missingConfiguration:[],errorMessage:"Configured model routes are missing or unavailable.",uptimeLabel:"Unavailable",rateLimitLabel:"Unavailable",hasOperationalData:!0};let e=d.diagnostics.modelReadiness.resolvedDefaultModel??d.diagnostics.modelReadiness.defaultModel;return{status:"connected",connectionHealth:{label:e&&ev(e)===o.modelProvider?"Connected and default-capable":"Connected",detail:`${c.length} configured model route${1===c.length?"":"s"} found in the OpenClaw model snapshot.`},missingConfiguration:[],errorMessage:null,uptimeLabel:"Unavailable",rateLimitLabel:"Provider-specific limits are not exposed in the snapshot",hasOperationalData:!0}}return"tool"===t.providerType?l.length>0?{status:"connected",connectionHealth:{label:"Configured on agents",detail:"This state is inferred from real agent tool declarations and runtime tool metadata."},missingConfiguration:[],errorMessage:null,uptimeLabel:"Unavailable",rateLimitLabel:"Unavailable",hasOperationalData:!0}:{status:"unknown",connectionHealth:{label:"No linked agent tools",detail:"No agent currently declares or recently used a matching tool."},missingConfiguration:t.setupRequirements,errorMessage:null,uptimeLabel:"Unavailable",rateLimitLabel:"Unavailable",hasOperationalData:!1}:s.length>0&&s.every(e=>!1===e.enabled)?{status:"disabled",connectionHealth:{label:"Disabled in OpenClaw config",detail:"The integration account exists but is disabled."},missingConfiguration:[],errorMessage:null,uptimeLabel:"Unavailable",rateLimitLabel:"Unavailable",hasOperationalData:!0}:s.some(e=>!1!==e.enabled)?{status:"unknown",connectionHealth:{label:"Configured, not verified",detail:"OpenClaw configuration exists, but this snapshot does not include a live connector health probe. Use Reconnect to run channels.status."},missingConfiguration:[],errorMessage:null,uptimeLabel:"Unavailable",rateLimitLabel:"Unavailable",hasOperationalData:!0}:a.length>0?{status:"unknown",connectionHealth:{label:"Workspace binding found",detail:"A workspace binding exists, but OpenClaw account configuration was not returned in the snapshot."},missingConfiguration:t.setupRequirements,errorMessage:null,uptimeLabel:"Unavailable",rateLimitLabel:"Unavailable",hasOperationalData:!0}:{status:t.surfaceProvider?"missing-credentials":"pending-setup",connectionHealth:{label:"Not configured",detail:"No OpenClaw account, workspace binding, or runtime state was found for this integration."},missingConfiguration:t.setupRequirements,errorMessage:null,uptimeLabel:"Unavailable",rateLimitLabel:"Unavailable",hasOperationalData:!1}}({descriptor:o,accounts:p,channels:d,models:u,linkedAgents:m,snapshot:e}),h=x.hasOperationalData&&Number.isFinite(s)?s:null;return{id:o.id,name:o.name,category:o.category,description:o.description,managedBy:o.managedBy,providerType:o.providerType,surfaceProvider:o.surfaceProvider??null,modelProvider:o.modelProvider??null,status:x.status,statusLabel:eb[x.status],connectionHealth:x.connectionHealth,lastSyncLabel:h?`Snapshot ${(0,ep.fw)(h,t)}`:"Unavailable",lastActiveMs:h,uptimeLabel:x.uptimeLabel,rateLimitLabel:x.rateLimitLabel,linkedAgents:m,linkedAgentCount:m.length,permissions:o.permissions,setupRequirements:o.setupRequirements,missingConfiguration:x.missingConfiguration,sourceMethods:Array.from(new Set(c.filter(Boolean))),accountIds:p.map(e=>e.id),channelIds:d.map(e=>e.id),modelIds:u.map(e=>e.id),errorMessage:x.errorMessage,docsUrl:o.docsUrl??null,actionSupport:{configure:o.configure,reconnect:o.reconnect,disable:o.disable},source:p[0]}})).map(e=>{let t=ey[e.id]??{icon:Y.A,iconTone:"muted"};return{...e,...t,statusTone:ew[e.status]}})},[e]),[u,h]=(0,n.useState)({}),[g,b]=(0,n.useState)(""),[f,v]=(0,n.useState)("All Categories"),[w,N]=(0,n.useState)("All Statuses"),[k,C]=(0,n.useState)("last-active"),[A,S]=(0,n.useState)("grid"),[L,M]=(0,n.useState)(p[0]?.id??""),[T,O]=(0,n.useState)(null),[P,U]=(0,n.useState)(!1),[z,D]=(0,n.useState)(!1),[W,E]=(0,n.useState)(!1),[q,_]=(0,n.useState)(!1),[B,G]=(0,n.useState)(null),[K,J]=(0,n.useState)(null),V=(0,n.useMemo)(()=>p.map(e=>{let t=u[e.id];if(!t)return e;let s=t.status?{status:t.status,statusLabel:t.statusLabel??e.statusLabel,statusTone:t.statusTone??tS[t.status]}:{};return{...e,...t,...s,sourceMethods:Array.from(new Set([...e.sourceMethods,...t.sourceMethods??[]]))}}),[p,u]),X=["All Categories",...Array.from(new Set(V.map(e=>e.category)))],Q=["All Statuses","connected","unknown","pending-setup","missing-credentials","needs-authentication","failed","disabled","unsupported"],Z=["last-active","name","status","category"],ee=V.filter(e=>{let t=g.trim().toLowerCase(),s=!t||[e.name,e.category,e.description,e.statusLabel,e.managedBy,e.providerType,e.permissions.join(" "),e.setupRequirements.join(" ")].join(" ").toLowerCase().includes(t),a="All Categories"===f||e.category===f,n="All Statuses"===w||e.status===w;return s&&a&&n}).sort((e,t)=>(function(e,t,s){if("name"===s)return e.name.localeCompare(t.name);if("status"===s)return e.statusLabel.localeCompare(t.statusLabel)||e.name.localeCompare(t.name);if("category"===s)return e.category.localeCompare(t.category)||e.name.localeCompare(t.name);let a=e.lastActiveMs??0;return(t.lastActiveMs??0)-a||e.name.localeCompare(t.name)})(e,t,k)),et=ee.find(e=>e.id===L)??ee[0]??null,es=ee.filter(e=>"connected"===e.status).length,ea=ee.filter(e=>"pending-setup"===e.status||"missing-credentials"===e.status||"needs-authentication"===e.status).length,en=ee.filter(e=>"failed"===e.status).length,el=(e=null)=>{s?(J(e),E(!0)):ta.o.error("Select a workspace before configuring workspace surfaces.",{description:"All Workspaces is read-only for surface setup. Pick a workspace from the sidebar first."})},ei=(e=null)=>{G(e),_(!0)},er=e=>{e.actionSupport.configure.supported?e.modelProvider?ei(e.modelProvider):e.surfaceProvider?el(e.surfaceProvider):ta.o.message("No setup flow is wired for this integration.",{description:e.actionSupport.configure.reason}):ta.o.message("Configure is not available.",{description:e.actionSupport.configure.reason})},eo=async e=>{if(!e.actionSupport.reconnect.supported)return void ta.o.message("Reconnect is not available.",{description:e.actionSupport.reconnect.reason});O(`${e.id}:reconnect`);try{if(e.modelProvider){let t=await fetch("/api/models/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"status",provider:e.modelProvider,includeSnapshot:!0})}),s=await t.json().catch(()=>null);if(!t.ok||!s)throw Error(s?.error||"Model provider status check failed.");s.snapshot&&o(s.snapshot);let a=s.connection?.connected?"connected":"ollama"===e.modelProvider?"pending-setup":"missing-credentials";h(t=>({...t,[e.id]:{status:a,statusLabel:tR(a),statusTone:tS[a],connectionHealth:{label:s.connection?.connected?"Provider status verified":"Provider not connected",detail:s.connection?.detail??s.message??"Provider status was refreshed through /api/models/providers."},lastSyncLabel:"Checked just now",sourceMethods:["/api/models/providers"]}})),ta.o.message(s.connection?.connected?"Provider is ready.":"Provider needs setup.",{description:s.connection?.detail??s.message});return}if(e.surfaceProvider){let t=await fetch(`/api/integrations/${encodeURIComponent(e.id)}/status`,{method:"POST",headers:{"Content-Type":"application/json"}}),s=await t.json().catch(()=>null),a=s?.status;if(!t.ok||!a)throw Error(s?.error||"Integration status check failed.");h(t=>({...t,[e.id]:{status:a,statusLabel:s.statusLabel??tR(a),statusTone:tS[a],connectionHealth:s.connectionHealth??{label:tR(a),detail:"OpenClaw channel status was refreshed."},lastSyncLabel:s.lastSyncLabel??"Checked just now",uptimeLabel:s.uptimeLabel,rateLimitLabel:s.rateLimitLabel,errorMessage:s.errorMessage,sourceMethods:s.sourceMethods}})),ta.o.message("connected"===s.status?"Integration status verified.":"Status check completed.",{description:s.connectionHealth?.detail});return}ta.o.message("Reconnect is not wired for this integration.",{description:e.actionSupport.reconnect.reason})}catch(s){let t=t$(s);h(s=>({...s,[e.id]:{status:"unknown",statusLabel:"Unknown",statusTone:"muted",connectionHealth:{label:"Status check failed",detail:t},lastSyncLabel:"Check failed",errorMessage:t}})),ta.o.error("Reconnect failed.",{description:t})}finally{O(null)}},ec=async e=>{if(!e.actionSupport.disable.supported)return void ta.o.message("Disable is not available.",{description:e.actionSupport.disable.reason});if(!s)return void ta.o.error("Select a workspace before disabling a surface.",{description:"All Workspaces cannot safely remove a workspace-specific binding."});if(0===e.channelIds.length)return void ta.o.message("No workspace binding found.",{description:"There is no AgentOS workspace surface binding to disconnect."});O(`${e.id}:disable`);try{for(let t of e.channelIds){let e=await fetch(`/api/workspaces/${encodeURIComponent(s)}/channels`,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({channelId:t,scope:"workspace"})}),a=await e.json().catch(()=>null);if(!e.ok)throw Error(a?.error||`Unable to disconnect ${t}.`)}await r(),h(t=>({...t,[e.id]:{status:"disabled",statusLabel:"Disabled",statusTone:"muted",connectionHealth:{label:"Disconnected from workspace",detail:"The workspace surface binding was removed through the channels API."},lastSyncLabel:"Updated just now",sourceMethods:["/api/workspaces/[workspaceId]/channels DELETE"]}})),ta.o.success(`${e.name} disconnected from this workspace.`)}catch(e){ta.o.error("Disable failed.",{description:t$(e)})}finally{O(null)}};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(tU,{main:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(eX,{title:"Integrations",subtitle:"Connect channels, tools, and external systems to extend AgentOS capabilities and power automations.",secondaryAction:{label:"Import Integration",icon:l.A,onClick:()=>D(!0)},primaryAction:{label:"Add Integration",icon:i.A,onClick:()=>U(!0)}}),(0,a.jsxs)(eZ,{search:g,onSearchChange:b,searchPlaceholder:"Search integrations...",right:(0,a.jsx)(e1,{value:A,onChange:S}),children:[(0,a.jsx)(e0,{icon:j.A,label:f,chevron:!0,onClick:()=>v(e=>X[(X.indexOf(e)+1)%X.length])}),(0,a.jsx)(e0,{icon:R.A,label:"All Statuses"===(d=w)?d:tR(d),chevron:!0,onClick:()=>N(e=>Q[(Q.indexOf(e)+1)%Q.length])}),(0,a.jsx)(e0,{icon:m.A,label:`Sort: ${function(e){switch(e){case"last-active":return"Last active";case"name":return"Name";case"status":return"Status";case"category":return"Category"}}(k)}`,chevron:!0,onClick:()=>C(e=>Z[(Z.indexOf(e)+1)%Z.length])})]}),(0,a.jsxs)(eY,{columns:5,children:[(0,a.jsx)(eQ,{label:"Total Integrations",value:String(ee.length),detail:`${V.length} registered`,icon:I.A,tone:"info"}),(0,a.jsx)(eQ,{label:"Connected",value:String(es),detail:`${Math.round(es/Math.max(1,ee.length)*100)}% of filtered`,icon:x.A,tone:"success"}),(0,a.jsx)(eQ,{label:"Pending Setup",value:String(ea),detail:"Needs setup or credentials",icon:c.A,tone:"warning"}),(0,a.jsx)(eQ,{label:"Failed",value:String(en),detail:"Real errors only",icon:y.A,tone:"danger"}),(0,a.jsx)(eQ,{label:"Automations Using",value:"-",detail:"Metrics unavailable from snapshot",icon:$.A,tone:"purple"})]}),0===ee.length?(0,a.jsx)(tt,{title:"No integrations match",description:"Adjust search, category, or status filters to inspect another integration set."}):(0,a.jsx)("div",{className:"space-y-3",children:Array.from(new Set(ee.map(e=>e.category))).map(e=>(0,a.jsxs)("section",{children:[(0,a.jsxs)("h2",{className:"mb-2 text-[0.62rem] font-bold uppercase tracking-[0.16em] text-slate-500",children:[e," (",ee.filter(t=>t.category===e).length,")"]}),(0,a.jsx)("div",{className:(0,eB.cn)("grid"===A?"grid gap-2.5 lg:grid-cols-2 min-[1400px]:grid-cols-3":"flex flex-col gap-2.5"),children:ee.filter(t=>t.category===e).map(e=>(0,a.jsx)(tM,{integration:e,selected:e.id===et?.id,list:"list"===A,actionBusy:T?.startsWith(`${e.id}:`)??!1,onSelect:()=>M(e.id),onConfigure:()=>er(e),onReconnect:()=>void eo(e)},e.id))})]},e))}),(0,a.jsx)(tO,{integrations:V})]}),inspector:et?(0,a.jsx)(tT,{integration:et,actionBusy:T?.startsWith(`${et.id}:`)??!1,activeWorkspaceId:s,onConfigure:()=>er(et),onReconnect:()=>void eo(et),onDisable:()=>void ec(et)}):null}),(0,a.jsx)(tP,{open:P,integrations:V,onOpenChange:U,onSelect:e=>{U(!1),er(e)}}),(0,a.jsx)(tI,{open:z,onOpenChange:D,onOpenSurfaceSetup:()=>{D(!1),el(null)},onOpenModelSetup:()=>{D(!1),ei(null)}}),(0,a.jsx)(H._,{snapshot:t,workspaceId:s,open:W,initialProvider:K,onOpenChange:E,onRefresh:r,onSnapshotChange:e=>o(t=>e(t))}),(0,a.jsx)(F.o,{open:q,onOpenChange:_,snapshot:t,initialProvider:B,onSnapshotChange:o})]})}function tM({integration:e,selected:t,list:s,actionBusy:n,onSelect:l,onConfigure:i,onReconnect:r}){return(0,a.jsx)("div",{role:"button",tabIndex:0,onClick:l,onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),l())},className:(0,eB.cn)("rounded-[12px] border p-3 text-left transition-all hover:bg-white/[0.055] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cyan-300/40",eH,t&&"border-blue-400/70 bg-blue-500/[0.08]"),children:(0,a.jsxs)("div",{className:(0,eB.cn)("flex gap-3",s?"items-center":"items-start"),children:[(0,a.jsx)(e8,{icon:e.icon,label:e.name,tone:e.iconTone,size:"lg"}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("h3",{className:"truncate text-[0.88rem] font-semibold text-white",children:e.name}),(0,a.jsx)("p",{className:"mt-1 truncate text-[0.68rem] text-slate-400",children:e.connectionHealth.label}),(0,a.jsxs)("p",{className:"mt-1 text-[0.68rem] text-slate-400",children:["Linked: ",e.linkedAgentCount," agents"]})]}),(0,a.jsx)(e4,{label:e.statusLabel,tone:e.statusTone})]}),(0,a.jsxs)("div",{className:"mt-2.5 flex items-center justify-between gap-2",children:[(0,a.jsxs)("div",{className:"flex min-w-0 flex-wrap gap-1.5",children:[(0,a.jsx)(ts,{children:e.category.split(" ")[0]}),(0,a.jsx)(ts,{children:e.managedBy})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(eq.$,{variant:"secondary",size:"sm",className:"h-7 rounded-[8px] px-2",disabled:n||!e.actionSupport.configure.supported,title:e.actionSupport.configure.reason,onClick:e=>{e.stopPropagation(),i()},children:(0,a.jsx)(U.A,{className:"h-3 w-3"})}),(0,a.jsx)(eq.$,{variant:"secondary",size:"sm",className:"h-7 rounded-[8px] px-2",disabled:n||!e.actionSupport.reconnect.supported,title:e.actionSupport.reconnect.reason,onClick:e=>{e.stopPropagation(),r()},children:(0,a.jsx)(z.A,{className:(0,eB.cn)("h-3 w-3",n&&"animate-spin")})}),(0,a.jsx)(te,{})]})]})]})]})})}function tT({integration:e,actionBusy:t,activeWorkspaceId:s,onConfigure:n,onReconnect:l,onDisable:i}){var r;let o=eO[e.status],c=s?e.actionSupport.disable.reason:"Select a workspace before disabling workspace-specific surface bindings.";return(0,a.jsxs)(e3,{children:[(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[(0,a.jsx)(e8,{icon:e.icon,label:e.name,tone:e.iconTone,size:"lg"}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-base font-semibold text-white",children:e.name}),(0,a.jsx)(e4,{label:e.statusLabel,tone:e.statusTone,className:"mt-1.5"})]}),(0,a.jsx)(te,{})]}),(0,a.jsx)(ts,{children:e.category}),(0,a.jsx)("p",{className:"mt-2.5 text-xs leading-5 text-slate-300",children:e.description})]})]}),(0,a.jsxs)("div",{className:"mt-3 grid grid-cols-3 gap-2",children:[(0,a.jsxs)(eq.$,{variant:"secondary",size:"sm",className:"h-8 rounded-[9px] px-2 text-xs",disabled:t||!e.actionSupport.reconnect.supported,title:e.actionSupport.reconnect.reason,onClick:l,children:[(0,a.jsx)(z.A,{className:(0,eB.cn)("mr-1.5 h-3.5 w-3.5",t&&"animate-spin")}),"Reconnect"]}),(0,a.jsx)(eq.$,{variant:"secondary",size:"sm",className:"h-8 rounded-[9px] px-2 text-xs",disabled:t||!e.actionSupport.configure.supported,title:e.actionSupport.configure.reason,onClick:n,children:"Configure"}),(0,a.jsx)(eq.$,{variant:"destructive",size:"sm",className:"h-8 rounded-[9px] px-2 text-xs",disabled:t||!e.actionSupport.disable.supported||!s,title:c,onClick:i,children:"Disable"})]}),(0,a.jsx)(e2,{title:"Connection Health",className:"mt-3",children:(0,a.jsxs)("div",{className:"px-3 py-2.5",children:[(0,a.jsx)(e6,{label:"Health",value:(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,a.jsx)(o,{className:(0,eB.cn)("h-3.5 w-3.5","connected"===(r=e.status)?"text-emerald-300":"failed"===r?"text-red-300":"pending-setup"===r||"missing-credentials"===r||"needs-authentication"===r?"text-amber-300":"text-slate-400")}),e.connectionHealth.label]})}),(0,a.jsx)(e6,{label:"Last sync",value:e.lastSyncLabel}),(0,a.jsx)(e6,{label:"Uptime",value:e.uptimeLabel}),(0,a.jsx)(e6,{label:"Rate limit",value:e.rateLimitLabel}),(0,a.jsx)(e6,{label:"Source",value:e.sourceMethods.join(", ")}),(0,a.jsx)("p",{className:"border-t border-white/[0.07] py-2 text-xs leading-5 text-slate-400",children:e.connectionHealth.detail}),(0,a.jsx)(e7,{value:"connected"===e.status?84:"failed"===e.status?8:28,tone:e.statusTone})]})}),(0,a.jsx)(e2,{title:"Scopes / Permissions",className:"mt-3",children:(0,a.jsx)("div",{className:"space-y-1.5 p-3 text-xs text-slate-300",children:e.permissions.map(e=>(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)(x.A,{className:"h-3.5 w-3.5 text-emerald-300"}),e]},e))})}),(0,a.jsx)(e2,{title:`Linked Agents (${e.linkedAgentCount})`,className:"mt-3",children:(0,a.jsx)("div",{className:"divide-y divide-white/[0.07] px-3",children:e.linkedAgents.length>0?e.linkedAgents.map(e=>(0,a.jsxs)("div",{className:"py-2.5 text-xs",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsx)("span",{className:"truncate text-slate-200",children:e.name}),(0,a.jsx)("span",{className:"shrink-0 text-slate-500",children:e.workspaceName})]}),(0,a.jsx)("p",{className:"mt-1 truncate text-[0.66rem] text-slate-500",children:e.reason})]},e.id)):(0,a.jsx)("div",{className:"py-3 text-xs text-slate-500",children:"unsupported"===e.managedBy?"Linkage unavailable until this connector exists.":"No linked agents found in the current workspace snapshot."})})}),(0,a.jsx)(e2,{title:"Setup Notes",className:"mt-3",children:(0,a.jsxs)("div",{className:"space-y-2 p-3 text-xs leading-5 text-slate-300",children:[(0,a.jsx)(e6,{label:"Managed by",value:function(e){switch(e){case"openclaw":return"OpenClaw";case"agentos":return"AgentOS";case"external-config":return"External config";case"unsupported":return"Unsupported"}}(e.managedBy)}),(0,a.jsx)(e6,{label:"Provider type",value:e.providerType}),(0,a.jsx)(e6,{label:"Accounts",value:e.accountIds.length?e.accountIds.join(", "):"None"}),(0,a.jsx)(e6,{label:"Channels",value:e.channelIds.length?e.channelIds.join(", "):"None"}),(0,a.jsx)(e6,{label:"Models",value:e.modelIds.length?e.modelIds.join(", "):"None"}),e.errorMessage?(0,a.jsx)("p",{className:"rounded-[9px] border border-red-400/20 bg-red-500/10 p-2 text-red-200",children:e.errorMessage}):null,e.missingConfiguration.length>0?(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-[0.62rem] font-semibold uppercase tracking-[0.14em] text-slate-500",children:"Required setup"}),(0,a.jsx)("div",{className:"mt-1 flex flex-wrap gap-1.5",children:e.missingConfiguration.map(e=>(0,a.jsx)(ts,{children:e},e))})]}):null,(0,a.jsxs)("div",{className:"rounded-[9px] border border-white/[0.07] bg-white/[0.03] p-2 text-slate-400",children:[(0,a.jsxs)("p",{children:["Configure: ",e.actionSupport.configure.reason]}),(0,a.jsxs)("p",{children:["Reconnect: ",e.actionSupport.reconnect.reason]}),(0,a.jsxs)("p",{children:["Disable: ",e.actionSupport.disable.reason]})]})]})})]})}function tO({integrations:e}){let t=e.filter(e=>"connected"===e.status),s=e.filter(e=>e.linkedAgentCount>0).sort((e,t)=>t.linkedAgentCount-e.linkedAgentCount);return(0,a.jsx)(e2,{title:"Automation Impact Summary",children:(0,a.jsxs)("div",{className:"grid gap-2.5 p-3 lg:grid-cols-[repeat(4,minmax(0,1fr))_1.4fr_0.8fr]",children:[(0,a.jsx)(tD,{icon:$.A,label:"Automations",value:"-",detail:"OpenClaw metric unavailable",tone:"info"}),(0,a.jsx)(tD,{icon:p.A,label:"Triggers fired",value:"-",detail:"OpenClaw metric unavailable",tone:"success"}),(0,a.jsx)(tD,{icon:D.A,label:"Actions executed",value:"-",detail:"OpenClaw metric unavailable",tone:"purple"}),(0,a.jsx)(tD,{icon:d.A,label:"Success rate",value:"-",detail:"OpenClaw metric unavailable",tone:"success"}),(0,a.jsxs)("div",{className:"rounded-[10px] border border-white/[0.08] bg-white/[0.03] p-2.5",children:[(0,a.jsx)("p",{className:"mb-2.5 text-[0.58rem] font-semibold uppercase tracking-[0.14em] text-slate-500",children:"Top linked integrations"}),s.slice(0,3).map(e=>(0,a.jsxs)("div",{className:"mb-2 grid grid-cols-[80px_1fr_auto] items-center gap-2 text-[0.68rem]",children:[(0,a.jsx)("span",{className:"truncate text-slate-300",children:e.name}),(0,a.jsx)(e7,{value:Math.min(100,20+18*e.linkedAgentCount)}),(0,a.jsxs)("span",{className:"text-slate-500",children:[e.linkedAgentCount," agents"]})]},e.id)),0===s.length?(0,a.jsx)("p",{className:"text-[0.68rem] text-slate-500",children:"No linked integrations found in the current snapshot."}):null]}),(0,a.jsxs)("div",{className:"rounded-[10px] border border-white/[0.08] bg-white/[0.03] p-2.5",children:[(0,a.jsx)("p",{className:"mb-2.5 text-[0.58rem] font-semibold uppercase tracking-[0.14em] text-slate-500",children:"Recently observed"}),t.slice(0,3).map(e=>(0,a.jsxs)("div",{className:"flex justify-between gap-2 py-1 text-[0.68rem]",children:[(0,a.jsx)("span",{className:"text-slate-300",children:e.name}),(0,a.jsx)("span",{className:"text-slate-500",children:e.lastSyncLabel})]},e.id)),0===t.length?(0,a.jsx)("p",{className:"text-[0.68rem] text-slate-500",children:"No verified connected integrations yet."}):null]})]})})}function tP({open:e,integrations:t,onOpenChange:s,onSelect:n}){return(0,a.jsx)(ti.lG,{open:e,onOpenChange:s,children:(0,a.jsxs)(ti.Cf,{className:"max-w-3xl rounded-[18px] border-white/[0.10] bg-[#08111f]/95 p-4",children:[(0,a.jsxs)(ti.c7,{children:[(0,a.jsx)(ti.L3,{children:"Add Integration"}),(0,a.jsx)(ti.rr,{children:"Choose a real AgentOS/OpenClaw setup path. Unsupported connectors are shown with their blocking reason."})]}),(0,a.jsx)("div",{className:"grid max-h-[62vh] gap-2 overflow-y-auto pr-1 sm:grid-cols-2",children:t.map(e=>(0,a.jsx)("button",{type:"button",onClick:()=>n(e),className:(0,eB.cn)("rounded-[12px] border p-3 text-left transition hover:bg-white/[0.06]",eH,!e.actionSupport.configure.supported&&"opacity-70"),children:(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[(0,a.jsx)(e8,{icon:e.icon,label:e.name,tone:e.iconTone}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsx)("h3",{className:"truncate text-sm font-semibold text-white",children:e.name}),(0,a.jsx)(e4,{label:e.statusLabel,tone:e.statusTone})]}),(0,a.jsx)("p",{className:"mt-1 line-clamp-2 text-xs leading-5 text-slate-400",children:e.description}),(0,a.jsx)("p",{className:"mt-2 text-[0.68rem] text-slate-500",children:e.actionSupport.configure.reason})]})]})},e.id))})]})})}function tI({open:e,onOpenChange:t,onOpenSurfaceSetup:s,onOpenModelSetup:n}){return(0,a.jsx)(ti.lG,{open:e,onOpenChange:t,children:(0,a.jsxs)(ti.Cf,{className:"max-w-xl rounded-[18px] border-white/[0.10] bg-[#08111f]/95 p-4",children:[(0,a.jsxs)(ti.c7,{children:[(0,a.jsx)(ti.L3,{children:"Import Integration"}),(0,a.jsx)(ti.rr,{children:"Secure bulk import is not available because this codebase does not expose a credential import contract or secret store handoff."})]}),(0,a.jsx)("div",{className:"rounded-[12px] border border-amber-300/20 bg-amber-400/10 p-3 text-xs leading-5 text-amber-100",children:"Importing tokens, OAuth secrets, bot credentials, or webhook secrets from the browser would expose sensitive values. Use the existing setup flows so OpenClaw handles credentials through its supported config paths."}),(0,a.jsxs)("div",{className:"grid gap-2 sm:grid-cols-2",children:[(0,a.jsx)(eq.$,{className:"h-9 rounded-[9px] bg-blue-500 text-white hover:bg-blue-400",onClick:s,children:"Open Surface Setup"}),(0,a.jsx)(eq.$,{variant:"secondary",className:"h-9 rounded-[9px]",onClick:n,children:"Open Model Setup"})]})]})})}function tR(e){switch(e){case"connected":return"Connected";case"disabled":return"Disabled";case"pending-setup":return"Pending Setup";case"failed":return"Failed";case"needs-authentication":return"Needs Authentication";case"missing-credentials":return"Missing Credentials";case"unsupported":return"Unsupported";case"unknown":return"Unknown"}}function t$(e){return e instanceof Error?e.message:"Unknown integration error."}function tU({main:e,inspector:t}){return(0,a.jsxs)("div",{className:(0,eB.cn)("grid gap-3",t?"xl:grid-cols-[minmax(0,1fr)_320px]":"xl:grid-cols-1"),children:[(0,a.jsx)("div",{className:"flex min-w-0 flex-col gap-3",children:e}),t]})}function tz({label:e,value:t}){return(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("p",{className:"truncate text-[0.56rem] font-semibold uppercase tracking-[0.14em] text-slate-500",children:e}),(0,a.jsx)("p",{className:"mt-1 truncate text-xs font-semibold text-white",children:t})]})}function tD({icon:e,label:t,value:s,detail:n,tone:l}){return(0,a.jsxs)("div",{className:"rounded-[10px] border border-white/[0.08] bg-white/[0.03] p-2.5",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,a.jsx)(e8,{icon:e,label:t,tone:l}),(0,a.jsxs)("span",{className:"min-w-0",children:[(0,a.jsx)("span",{className:"block text-base font-semibold text-white",children:s}),(0,a.jsx)("span",{className:"block truncate text-[0.68rem] text-slate-400",children:t})]})]}),(0,a.jsx)("p",{className:"mt-1.5 text-[0.68rem] text-slate-500",children:n})]})}function tF({title:e,description:t,className:s}){return(0,a.jsxs)("div",{className:(0,eB.cn)("rounded-[12px] border border-white/[0.08] bg-white/[0.03] p-3",s),children:[(0,a.jsx)("p",{className:"text-xs font-semibold text-white",children:e}),(0,a.jsx)("p",{className:"mt-2 text-xs leading-5 text-slate-400",children:t})]})}function tW({open:e,agent:t,defaultWorkspaceId:s=null,onOpenChange:l,onSubmitted:i}){let[r,o]=(0,n.useState)(""),[c,d]=(0,n.useState)(!1),[p,u]=(0,n.useState)(null),m=t?.source?.workspaceId??s??void 0;(0,n.useEffect)(()=>{e&&(o(""),u(null))},[e]);let x=async()=>{let e=r.trim();if(!e)return void u("Enter a task brief before submitting.");d(!0),u(null);try{let s=await fetch("/api/mission",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mission:e,agentId:t?.source?.id,workspaceId:m})}),a=await s.json().catch(()=>null);if(!s.ok||a?.error)throw Error(a?.error||"Mission dispatch failed.");ta.o.success("Task submitted.",{description:a?.summary}),l(!1),await i()}catch(e){u(t$(e))}finally{d(!1)}};return(0,a.jsx)(ti.lG,{open:e,onOpenChange:l,children:(0,a.jsxs)(ti.Cf,{className:"max-w-xl rounded-[18px] border-white/[0.10] bg-[#08111f]/95 p-4",children:[(0,a.jsxs)(ti.c7,{children:[(0,a.jsx)(ti.L3,{children:t?`Run task with ${t.name}`:"Create Task"}),(0,a.jsx)(ti.rr,{children:"Submits through the existing AgentOS mission dispatch flow."})]}),p?(0,a.jsx)("div",{className:"rounded-[10px] border border-rose-300/20 bg-rose-400/10 px-3 py-2 text-xs text-rose-100",children:p}):null,(0,a.jsx)(tr.T,{value:r,onChange:e=>o(e.target.value),placeholder:"Describe the task to run...",className:"min-h-36 rounded-[12px] border-white/[0.10] bg-slate-950/50 text-sm text-slate-100"}),(0,a.jsxs)(ti.Es,{children:[(0,a.jsx)(eq.$,{variant:"secondary",size:"sm",className:"h-8 rounded-[9px] text-xs",onClick:()=>l(!1),children:"Cancel"}),(0,a.jsx)(eq.$,{size:"sm",className:"h-8 rounded-[9px] bg-blue-500 text-xs text-white hover:bg-blue-400",disabled:c||!r.trim(),onClick:()=>void x(),children:c?"Submitting...":"Submit Task"})]})]})})}function tE(e){return"all"===e?"All":"approval"===e?"Awaiting Approval":tB(e)}function tq(e){return!!(e.source&&["queued","running","approval","stalled"].includes(e.status))}function t_(e){return"all"===e?"All":"needs-approval"===e?"Needs Approval":tB(e)}function tB(e){return e.split(/[\s-]+/).filter(Boolean).map(e=>e.slice(0,1).toUpperCase()+e.slice(1)).join(" ")}},92083:(e,t,s)=>{Promise.resolve().then(s.bind(s,68956))}}]);