@sapienx/agentos 0.5.8 → 0.6.1

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 (254) hide show
  1. package/README.md +1 -1
  2. package/bin/agentos.js +4 -5
  3. package/bin/terminal-boot.js +6 -3
  4. package/bundle/.next/BUILD_ID +1 -1
  5. package/bundle/.next/app-path-routes-manifest.json +10 -9
  6. package/bundle/.next/build-manifest.json +3 -3
  7. package/bundle/.next/prerender-manifest.json +3 -3
  8. package/bundle/.next/react-loadable-manifest.json +2 -2
  9. package/bundle/.next/required-server-files.json +1 -1
  10. package/bundle/.next/routes-manifest.json +8 -0
  11. package/bundle/.next/server/app/_global-error/page.js +2 -2
  12. package/bundle/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  13. package/bundle/.next/server/app/_global-error.html +1 -1
  14. package/bundle/.next/server/app/_global-error.rsc +1 -1
  15. package/bundle/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  16. package/bundle/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  17. package/bundle/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  18. package/bundle/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  19. package/bundle/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  20. package/bundle/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  21. package/bundle/.next/server/app/_not-found/page.js +2 -2
  22. package/bundle/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  23. package/bundle/.next/server/app/_not-found.html +1 -1
  24. package/bundle/.next/server/app/_not-found.rsc +2 -2
  25. package/bundle/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  26. package/bundle/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  27. package/bundle/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  28. package/bundle/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  29. package/bundle/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  30. package/bundle/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  31. package/bundle/.next/server/app/agents/page.js +2 -2
  32. package/bundle/.next/server/app/agents/page.js.nft.json +1 -1
  33. package/bundle/.next/server/app/agents/page_client-reference-manifest.js +1 -1
  34. package/bundle/.next/server/app/api/agents/[agentId]/chat/route.js +2 -2
  35. package/bundle/.next/server/app/api/agents/[agentId]/chat/route.js.nft.json +1 -1
  36. package/bundle/.next/server/app/api/agents/route.js +1 -1
  37. package/bundle/.next/server/app/api/agents/route.js.nft.json +1 -1
  38. package/bundle/.next/server/app/api/diagnostics/route.js +1 -1
  39. package/bundle/.next/server/app/api/diagnostics/route.js.nft.json +1 -1
  40. package/bundle/.next/server/app/api/files/reveal/route.js +1 -1
  41. package/bundle/.next/server/app/api/gateway/control/route.js +1 -1
  42. package/bundle/.next/server/app/api/gateway/control/route.js.nft.json +1 -1
  43. package/bundle/.next/server/app/api/integrations/[integrationId]/status/route.js +1 -1
  44. package/bundle/.next/server/app/api/integrations/[integrationId]/status/route.js.nft.json +1 -1
  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/compatibility-smoke/route.js +1 -1
  57. package/bundle/.next/server/app/api/openclaw/compatibility-smoke/route.js.nft.json +1 -1
  58. package/bundle/.next/server/app/api/planner/[planId]/deploy/route.js +2 -2
  59. package/bundle/.next/server/app/api/planner/[planId]/deploy/route.js.nft.json +1 -1
  60. package/bundle/.next/server/app/api/planner/[planId]/document-rewrite/route.js +1 -1
  61. package/bundle/.next/server/app/api/planner/[planId]/document-rewrite/route.js.nft.json +1 -1
  62. package/bundle/.next/server/app/api/planner/[planId]/route.js +1 -1
  63. package/bundle/.next/server/app/api/planner/[planId]/route.js.nft.json +1 -1
  64. package/bundle/.next/server/app/api/planner/[planId]/simulate/route.js +1 -1
  65. package/bundle/.next/server/app/api/planner/[planId]/simulate/route.js.nft.json +1 -1
  66. package/bundle/.next/server/app/api/planner/[planId]/turn/route.js +1 -1
  67. package/bundle/.next/server/app/api/planner/[planId]/turn/route.js.nft.json +1 -1
  68. package/bundle/.next/server/app/api/planner/route.js +1 -1
  69. package/bundle/.next/server/app/api/planner/route.js.nft.json +1 -1
  70. package/bundle/.next/server/app/api/reset/route.js +2 -2
  71. package/bundle/.next/server/app/api/reset/route.js.nft.json +1 -1
  72. package/bundle/.next/server/app/api/runtimes/[runtimeId]/route.js +1 -1
  73. package/bundle/.next/server/app/api/runtimes/[runtimeId]/route.js.nft.json +1 -1
  74. package/bundle/.next/server/app/api/settings/gateway/route.js +1 -1
  75. package/bundle/.next/server/app/api/settings/gateway/route.js.nft.json +1 -1
  76. package/bundle/.next/server/app/api/settings/openclaw-binary/route.js +1 -1
  77. package/bundle/.next/server/app/api/settings/openclaw-binary/route.js.nft.json +1 -1
  78. package/bundle/.next/server/app/api/settings/workspace-root/route.js +1 -1
  79. package/bundle/.next/server/app/api/settings/workspace-root/route.js.nft.json +1 -1
  80. package/bundle/.next/server/app/api/snapshot/route.js +1 -1
  81. package/bundle/.next/server/app/api/snapshot/route.js.nft.json +1 -1
  82. package/bundle/.next/server/app/api/stream/route.js +2 -2
  83. package/bundle/.next/server/app/api/stream/route.js.nft.json +1 -1
  84. package/bundle/.next/server/app/api/system/open-terminal/route.js +1 -1
  85. package/bundle/.next/server/app/api/tasks/[taskId]/abort/route.js +1 -1
  86. package/bundle/.next/server/app/api/tasks/[taskId]/abort/route.js.nft.json +1 -1
  87. package/bundle/.next/server/app/api/tasks/[taskId]/control/route.js +1 -1
  88. package/bundle/.next/server/app/api/tasks/[taskId]/control/route.js.nft.json +1 -1
  89. package/bundle/.next/server/app/api/tasks/[taskId]/stream/route.js +2 -2
  90. package/bundle/.next/server/app/api/tasks/[taskId]/stream/route.js.nft.json +1 -1
  91. package/bundle/.next/server/app/api/update/route.js +2 -2
  92. package/bundle/.next/server/app/api/update/route.js.nft.json +1 -1
  93. package/bundle/.next/server/app/api/workspaces/[workspaceId]/channels/discovered-groups/route.js +1 -1
  94. package/bundle/.next/server/app/api/workspaces/[workspaceId]/channels/discovered-groups/route.js.nft.json +1 -1
  95. package/bundle/.next/server/app/api/workspaces/[workspaceId]/channels/route.js +1 -1
  96. package/bundle/.next/server/app/api/workspaces/[workspaceId]/channels/route.js.nft.json +1 -1
  97. package/bundle/.next/server/app/api/workspaces/[workspaceId]/edit-draft/route.js +1 -1
  98. package/bundle/.next/server/app/api/workspaces/[workspaceId]/edit-draft/route.js.nft.json +1 -1
  99. package/bundle/.next/server/app/api/workspaces/[workspaceId]/files/route.js +1 -1
  100. package/bundle/.next/server/app/api/workspaces/[workspaceId]/files/route.js.nft.json +1 -1
  101. package/bundle/.next/server/app/api/workspaces/[workspaceId]/surfaces/discovery/route.js +1 -1
  102. package/bundle/.next/server/app/api/workspaces/[workspaceId]/surfaces/discovery/route.js.nft.json +1 -1
  103. package/bundle/.next/server/app/api/workspaces/[workspaceId]/surfaces/reconcile/route.js +1 -0
  104. package/bundle/.next/server/app/api/workspaces/[workspaceId]/surfaces/reconcile/route.js.nft.json +1 -0
  105. package/bundle/.next/server/app/api/workspaces/[workspaceId]/surfaces/reconcile/route_client-reference-manifest.js +1 -0
  106. package/bundle/.next/server/app/api/workspaces/route.js +2 -2
  107. package/bundle/.next/server/app/api/workspaces/route.js.nft.json +1 -1
  108. package/bundle/.next/server/app/files/page.js +2 -2
  109. package/bundle/.next/server/app/files/page.js.nft.json +1 -1
  110. package/bundle/.next/server/app/files/page_client-reference-manifest.js +1 -1
  111. package/bundle/.next/server/app/integrations/page.js +2 -2
  112. package/bundle/.next/server/app/integrations/page.js.nft.json +1 -1
  113. package/bundle/.next/server/app/integrations/page_client-reference-manifest.js +1 -1
  114. package/bundle/.next/server/app/models/page.js +2 -2
  115. package/bundle/.next/server/app/models/page.js.nft.json +1 -1
  116. package/bundle/.next/server/app/models/page_client-reference-manifest.js +1 -1
  117. package/bundle/.next/server/app/page.js +2 -2
  118. package/bundle/.next/server/app/page.js.nft.json +1 -1
  119. package/bundle/.next/server/app/page_client-reference-manifest.js +1 -1
  120. package/bundle/.next/server/app/settings/page.js +2 -2
  121. package/bundle/.next/server/app/settings/page.js.nft.json +1 -1
  122. package/bundle/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  123. package/bundle/.next/server/app/tasks/page.js +2 -2
  124. package/bundle/.next/server/app/tasks/page.js.nft.json +1 -1
  125. package/bundle/.next/server/app/tasks/page_client-reference-manifest.js +1 -1
  126. package/bundle/.next/server/app-paths-manifest.json +10 -9
  127. package/bundle/.next/server/chunks/1718.js +3 -3
  128. package/bundle/.next/server/chunks/2082.js +183 -0
  129. package/bundle/.next/server/chunks/262.js +1 -0
  130. package/bundle/.next/server/chunks/4391.js +8 -8
  131. package/bundle/.next/server/chunks/4767.js +6 -6
  132. package/bundle/.next/server/chunks/4983.js +1 -1
  133. package/bundle/.next/server/chunks/6476.js +3 -3
  134. package/bundle/.next/server/chunks/707.js +1 -0
  135. package/bundle/.next/server/chunks/7661.js +1 -1
  136. package/bundle/.next/server/functions-config-manifest.json +2 -1
  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/chunks/{2083-7a341dd360f54c8b.js → 2083-d45e8f4c93715147.js} +1 -1
  143. package/bundle/.next/static/chunks/6672-b36e3759495f9ac7.js +1 -0
  144. package/bundle/.next/static/chunks/7197.2385ee563e32813a.js +1 -0
  145. package/bundle/.next/static/chunks/{7442-5ed5b8f501838da4.js → 7442-2dc44f100f1573ea.js} +24 -24
  146. package/bundle/.next/static/chunks/app/_global-error/{page-8443c62570b9a078.js → page-a5154759aeb4c2c4.js} +1 -1
  147. package/bundle/.next/static/chunks/app/_not-found/{page-8443c62570b9a078.js → page-a5154759aeb4c2c4.js} +1 -1
  148. package/bundle/.next/static/chunks/app/agents/page-8acb55d794d87f71.js +1 -0
  149. package/bundle/.next/static/chunks/app/api/agents/[agentId]/chat/{route-8443c62570b9a078.js → route-a5154759aeb4c2c4.js} +1 -1
  150. package/bundle/.next/static/chunks/app/api/agents/{route-8443c62570b9a078.js → route-a5154759aeb4c2c4.js} +1 -1
  151. package/bundle/.next/static/chunks/app/api/diagnostics/route-a5154759aeb4c2c4.js +1 -0
  152. package/bundle/.next/static/chunks/app/api/files/reveal/route-a5154759aeb4c2c4.js +1 -0
  153. package/bundle/.next/static/chunks/app/api/gateway/control/route-a5154759aeb4c2c4.js +1 -0
  154. package/bundle/.next/static/chunks/app/api/integrations/[integrationId]/status/route-a5154759aeb4c2c4.js +1 -0
  155. package/bundle/.next/static/chunks/app/api/mission/route-a5154759aeb4c2c4.js +1 -0
  156. package/bundle/.next/static/chunks/app/api/models/catalog/route-a5154759aeb4c2c4.js +1 -0
  157. package/bundle/.next/static/chunks/app/api/models/providers/route-a5154759aeb4c2c4.js +1 -0
  158. package/bundle/.next/static/chunks/app/api/onboarding/models/route-a5154759aeb4c2c4.js +1 -0
  159. package/bundle/.next/static/chunks/app/api/onboarding/route-a5154759aeb4c2c4.js +1 -0
  160. package/bundle/.next/static/chunks/app/api/openclaw/capabilities/route-a5154759aeb4c2c4.js +1 -0
  161. package/bundle/.next/static/chunks/app/api/openclaw/compatibility-smoke/route-a5154759aeb4c2c4.js +1 -0
  162. package/bundle/.next/static/chunks/app/api/planner/[planId]/deploy/route-a5154759aeb4c2c4.js +1 -0
  163. package/bundle/.next/static/chunks/app/api/planner/[planId]/document-rewrite/route-a5154759aeb4c2c4.js +1 -0
  164. package/bundle/.next/static/chunks/app/api/planner/[planId]/route-a5154759aeb4c2c4.js +1 -0
  165. package/bundle/.next/static/chunks/app/api/planner/[planId]/simulate/route-a5154759aeb4c2c4.js +1 -0
  166. package/bundle/.next/static/chunks/app/api/planner/[planId]/turn/route-a5154759aeb4c2c4.js +1 -0
  167. package/bundle/.next/static/chunks/app/api/planner/route-a5154759aeb4c2c4.js +1 -0
  168. package/bundle/.next/static/chunks/app/api/reset/route-a5154759aeb4c2c4.js +1 -0
  169. package/bundle/.next/static/chunks/app/api/runtimes/[runtimeId]/route-a5154759aeb4c2c4.js +1 -0
  170. package/bundle/.next/static/chunks/app/api/settings/gateway/route-a5154759aeb4c2c4.js +1 -0
  171. package/bundle/.next/static/chunks/app/api/settings/openclaw-binary/route-a5154759aeb4c2c4.js +1 -0
  172. package/bundle/.next/static/chunks/app/api/settings/workspace-root/route-a5154759aeb4c2c4.js +1 -0
  173. package/bundle/.next/static/chunks/app/api/snapshot/route-a5154759aeb4c2c4.js +1 -0
  174. package/bundle/.next/static/chunks/app/api/stream/route-a5154759aeb4c2c4.js +1 -0
  175. package/bundle/.next/static/chunks/app/api/system/open-terminal/route-a5154759aeb4c2c4.js +1 -0
  176. package/bundle/.next/static/chunks/app/api/tasks/[taskId]/abort/route-a5154759aeb4c2c4.js +1 -0
  177. package/bundle/.next/static/chunks/app/api/tasks/[taskId]/control/route-a5154759aeb4c2c4.js +1 -0
  178. package/bundle/.next/static/chunks/app/api/tasks/[taskId]/stream/route-a5154759aeb4c2c4.js +1 -0
  179. package/bundle/.next/static/chunks/app/api/update/route-a5154759aeb4c2c4.js +1 -0
  180. package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/channels/discovered-groups/route-a5154759aeb4c2c4.js +1 -0
  181. package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/channels/route-a5154759aeb4c2c4.js +1 -0
  182. package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/edit-draft/route-a5154759aeb4c2c4.js +1 -0
  183. package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/files/route-a5154759aeb4c2c4.js +1 -0
  184. package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/surfaces/discovery/route-a5154759aeb4c2c4.js +1 -0
  185. package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/surfaces/reconcile/route-a5154759aeb4c2c4.js +1 -0
  186. package/bundle/.next/static/chunks/app/api/workspaces/route-a5154759aeb4c2c4.js +1 -0
  187. package/bundle/.next/static/chunks/app/files/page-3e166ac1009662a0.js +1 -0
  188. package/bundle/.next/static/chunks/app/integrations/page-a58f85dfc4c23468.js +1 -0
  189. package/bundle/.next/static/chunks/app/models/page-45a41bff0c708600.js +1 -0
  190. package/bundle/.next/static/chunks/app/not-found-a5154759aeb4c2c4.js +1 -0
  191. package/bundle/.next/static/chunks/app/page-78b8c43dceba02d6.js +1 -0
  192. package/bundle/.next/static/chunks/app/settings/page-dc8c5f99e93317b5.js +1 -0
  193. package/bundle/.next/static/chunks/app/tasks/page-4c8cc3fefa0a18bb.js +1 -0
  194. package/bundle/.next/static/chunks/next/dist/client/components/builtin/app-error-a5154759aeb4c2c4.js +1 -0
  195. package/bundle/.next/static/chunks/next/dist/client/components/builtin/forbidden-a5154759aeb4c2c4.js +1 -0
  196. package/bundle/.next/static/chunks/next/dist/client/components/builtin/unauthorized-a5154759aeb4c2c4.js +1 -0
  197. package/bundle/.next/static/chunks/{webpack-1e021d6850c9ac01.js → webpack-13c3a46c1cdfa6e4.js} +1 -1
  198. package/bundle/.next/static/css/dabe7b13ad484ddd.css +3 -0
  199. package/bundle/package.json +1 -1
  200. package/bundle/server.js +1 -1
  201. package/package.json +2 -2
  202. package/bundle/.next/server/chunks/5151.js +0 -183
  203. package/bundle/.next/server/chunks/8849.js +0 -1
  204. package/bundle/.next/static/chunks/1994.2c1ce6369c0b31aa.js +0 -1
  205. package/bundle/.next/static/chunks/2396-395f5ed99e66819d.js +0 -1
  206. package/bundle/.next/static/chunks/app/agents/page-a48b3909fe8cc49b.js +0 -1
  207. package/bundle/.next/static/chunks/app/api/diagnostics/route-8443c62570b9a078.js +0 -1
  208. package/bundle/.next/static/chunks/app/api/files/reveal/route-8443c62570b9a078.js +0 -1
  209. package/bundle/.next/static/chunks/app/api/gateway/control/route-8443c62570b9a078.js +0 -1
  210. package/bundle/.next/static/chunks/app/api/integrations/[integrationId]/status/route-8443c62570b9a078.js +0 -1
  211. package/bundle/.next/static/chunks/app/api/mission/route-8443c62570b9a078.js +0 -1
  212. package/bundle/.next/static/chunks/app/api/models/catalog/route-8443c62570b9a078.js +0 -1
  213. package/bundle/.next/static/chunks/app/api/models/providers/route-8443c62570b9a078.js +0 -1
  214. package/bundle/.next/static/chunks/app/api/onboarding/models/route-8443c62570b9a078.js +0 -1
  215. package/bundle/.next/static/chunks/app/api/onboarding/route-8443c62570b9a078.js +0 -1
  216. package/bundle/.next/static/chunks/app/api/openclaw/capabilities/route-8443c62570b9a078.js +0 -1
  217. package/bundle/.next/static/chunks/app/api/openclaw/compatibility-smoke/route-8443c62570b9a078.js +0 -1
  218. package/bundle/.next/static/chunks/app/api/planner/[planId]/deploy/route-8443c62570b9a078.js +0 -1
  219. package/bundle/.next/static/chunks/app/api/planner/[planId]/document-rewrite/route-8443c62570b9a078.js +0 -1
  220. package/bundle/.next/static/chunks/app/api/planner/[planId]/route-8443c62570b9a078.js +0 -1
  221. package/bundle/.next/static/chunks/app/api/planner/[planId]/simulate/route-8443c62570b9a078.js +0 -1
  222. package/bundle/.next/static/chunks/app/api/planner/[planId]/turn/route-8443c62570b9a078.js +0 -1
  223. package/bundle/.next/static/chunks/app/api/planner/route-8443c62570b9a078.js +0 -1
  224. package/bundle/.next/static/chunks/app/api/reset/route-8443c62570b9a078.js +0 -1
  225. package/bundle/.next/static/chunks/app/api/runtimes/[runtimeId]/route-8443c62570b9a078.js +0 -1
  226. package/bundle/.next/static/chunks/app/api/settings/gateway/route-8443c62570b9a078.js +0 -1
  227. package/bundle/.next/static/chunks/app/api/settings/openclaw-binary/route-8443c62570b9a078.js +0 -1
  228. package/bundle/.next/static/chunks/app/api/settings/workspace-root/route-8443c62570b9a078.js +0 -1
  229. package/bundle/.next/static/chunks/app/api/snapshot/route-8443c62570b9a078.js +0 -1
  230. package/bundle/.next/static/chunks/app/api/stream/route-8443c62570b9a078.js +0 -1
  231. package/bundle/.next/static/chunks/app/api/system/open-terminal/route-8443c62570b9a078.js +0 -1
  232. package/bundle/.next/static/chunks/app/api/tasks/[taskId]/abort/route-8443c62570b9a078.js +0 -1
  233. package/bundle/.next/static/chunks/app/api/tasks/[taskId]/control/route-8443c62570b9a078.js +0 -1
  234. package/bundle/.next/static/chunks/app/api/tasks/[taskId]/stream/route-8443c62570b9a078.js +0 -1
  235. package/bundle/.next/static/chunks/app/api/update/route-8443c62570b9a078.js +0 -1
  236. package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/channels/discovered-groups/route-8443c62570b9a078.js +0 -1
  237. package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/channels/route-8443c62570b9a078.js +0 -1
  238. package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/edit-draft/route-8443c62570b9a078.js +0 -1
  239. package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/files/route-8443c62570b9a078.js +0 -1
  240. package/bundle/.next/static/chunks/app/api/workspaces/[workspaceId]/surfaces/discovery/route-8443c62570b9a078.js +0 -1
  241. package/bundle/.next/static/chunks/app/api/workspaces/route-8443c62570b9a078.js +0 -1
  242. package/bundle/.next/static/chunks/app/files/page-a0e2fdb9c72008d3.js +0 -1
  243. package/bundle/.next/static/chunks/app/integrations/page-fbeb03fb416b56e4.js +0 -1
  244. package/bundle/.next/static/chunks/app/models/page-a22fedc08112e7a0.js +0 -1
  245. package/bundle/.next/static/chunks/app/not-found-8443c62570b9a078.js +0 -1
  246. package/bundle/.next/static/chunks/app/page-4f990fddc5f18dcf.js +0 -1
  247. package/bundle/.next/static/chunks/app/settings/page-28f1484e79b1be1f.js +0 -1
  248. package/bundle/.next/static/chunks/app/tasks/page-89536b0bec007ced.js +0 -1
  249. package/bundle/.next/static/chunks/next/dist/client/components/builtin/app-error-8443c62570b9a078.js +0 -1
  250. package/bundle/.next/static/chunks/next/dist/client/components/builtin/forbidden-8443c62570b9a078.js +0 -1
  251. package/bundle/.next/static/chunks/next/dist/client/components/builtin/unauthorized-8443c62570b9a078.js +0 -1
  252. package/bundle/.next/static/css/288b13e5308447b9.css +0 -3
  253. /package/bundle/.next/static/{JwIu-FqrfB4Nerk5vBqR2 → TYnwoX4LkzaMAP7sSiIpk}/_buildManifest.js +0 -0
  254. /package/bundle/.next/static/{JwIu-FqrfB4Nerk5vBqR2 → TYnwoX4LkzaMAP7sSiIpk}/_ssgManifest.js +0 -0
@@ -1 +0,0 @@
1
- exports.id=8849,exports.ids=[8849],exports.modules={607:(a,b,c)=>{"use strict";c.d(b,{z:()=>Q});var d=c(3814),e=c(6247),f=c(47221),g=c(55421),h=c.n(g),i=c(46032),j=c(90752),k=c(26931),l=c(78282),m=c(218),n=c(63685),o=c(96493),p=c(86959),q=c(11081),r=c(25393),s=c(73596),t=c(26532),u=c(13999),v=c(45821),w=c(68123),x=c(33506),y=c(76179),z=c(45738),A=c(61727),B=c(84086),C=c(32905);function D({tone:a,pulse:b=!1,className:c}){return(0,d.jsxs)("span",{className:(0,C.cn)("relative inline-flex h-2.5 w-2.5 items-center justify-center",c),children:[b?(0,d.jsx)(B.P.span,{className:(0,C.cn)("absolute inset-0 rounded-full",a),animate:{opacity:[.4,0],scale:[1,2.2]},transition:{duration:1.8,repeat:1/0,ease:"easeOut"}}):null,(0,d.jsx)("span",{className:(0,C.cn)("relative inline-flex h-2.5 w-2.5 rounded-full",a)})]})}var E=c(5813),F=c(80990),G=c(37674),H=c(49444),I=c(34118),J=c(43081),K=c(92078),L=c(9494),M=c(45084),N=c(90665);let O=[{id:"overview",label:"Overview"},{id:"operations",label:"Operations"},{id:"system",label:"System"}],P=[{label:"Mission Control",href:"/",icon:j.A,section:"overview"},{label:"Dashboard",href:"/#dashboard",hash:"dashboard",icon:k.A,section:"overview"},{label:"Agents",href:"/agents",icon:l.A,section:"operations"},{label:"Tasks",href:"/tasks",icon:m.A,section:"operations"},{label:"Files",href:"/files",icon:n.A,section:"operations"},{label:"Models",href:"/models",icon:o.A,section:"operations"},{label:"Integrations",href:"/integrations",icon:p.A,section:"operations"},{label:"Settings",href:"/settings",icon:q.A,section:"system"},{label:"Diagnostics",href:"/settings#diagnostics",hash:"diagnostics",icon:r.A,section:"system"}];function Q({snapshot:a,surfaceTheme:b,activeWorkspaceId:c,requestedAgentAction:f,connectionState:g,collapsed:h,onExpandCollapsed:j,onToggleCollapsed:k,onSelectWorkspace:l,onRefresh:m,onOpenWorkspaceCreate:n,onSnapshotChange:o}){var p,q,r;let t=(0,i.usePathname)(),[u,v]=(0,e.useState)(""),[w,x]=(0,e.useState)(!1),[y,A]=(0,e.useState)(!1),[B,C]=(0,e.useState)(!1),[D,E]=(0,e.useState)(!1),[I,P]=(0,e.useState)(!1),[T,V]=(0,e.useState)(null),[X,ab]=(0,e.useState)([]),[ac,ad]=(0,e.useState)(null),[ae,af]=(0,e.useState)("");(0,e.useRef)(null);let ag=(c?a.workspaces.find(a=>a.id===c):null)??a.workspaces[0]??null,ah=(p=a.diagnostics.health,"live"===(q=g)&&"healthy"===p?"bg-emerald-400":"retrying"===q||"degraded"===p?"bg-amber-300":"bg-rose-300"),ai="live"===g?"Online":"retrying"===g?"Retrying":"Connecting",aj=(0,e.useCallback)(a=>{v(a.hash??"")},[]),ak=a=>{x(a),a||(V(null),ab([]),A(!1))};(0,e.useCallback)(b=>{let c=(0,M.XS)(a,b.workspaceId,b.id);V({...function(a,b={}){let c=(0,K.g0)(b.policy?.preset??"worker",b.policy),d=(0,K.Cf)(c.preset),e=(0,L.iq)(c.preset,b.heartbeat);return{id:b.id??"",workspaceId:a,modelId:b.modelId??"",name:b.name??d.defaultName,emoji:b.emoji??d.defaultEmoji,theme:b.theme??d.defaultTheme,avatar:b.avatar??"",policy:c,heartbeat:e,channelIds:Array.from(new Set((b.channelIds??[]).filter(a=>"string"==typeof a&&!!a.trim())))}}(b.workspaceId,{id:b.id,modelId:"unassigned"===b.modelId?"":b.modelId,name:(0,N.CK)(b),emoji:b.identity.emoji??"",theme:b.identity.theme??"",avatar:b.identity.avatar??"",policy:b.policy,heartbeat:(0,L.iq)(b.policy.preset,{enabled:b.heartbeat.enabled,every:b.heartbeat.every??void 0}),channelIds:c})}),ab(c),A(!1),x(!0)},[a]),(0,e.useCallback)(a=>{ad(a),af(""),E(!0)},[]);let al=async()=>{if(!T)return;let b=a.workspaces.find(a=>a.id===T.workspaceId)??null;C(!0);let c=!1;try{let a=await fetch("/api/agents",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(T)}),d=await a.json();if(!a.ok||d.error)throw Error(d.error||"OpenClaw could not update the agent.");b&&await (0,M.rz)({workspaceId:T.workspaceId,workspacePath:b.path,agentId:T.id,currentChannelIds:X,nextChannelIds:T.channelIds,onRegistryChange:o}),ak(!1),c=!0}catch(a){J.o.error("Agent update failed.",{description:a instanceof Error?a.message:"Unknown agent error."})}finally{C(!1)}c&&(m().catch(()=>{}),J.o.success("Agent updated in OpenClaw.",{description:T.id}))},am=async()=>{if(!ac)return;P(!0);let a=!1,b=ac.id;try{let c=await fetch("/api/agents",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({agentId:ac.id})}),d=await c.json();if(!c.ok||d.error)throw Error(d.error||"OpenClaw could not delete the agent.");T?.id===ac.id&&ak(!1),E(!1),ad(null),af(""),b=d.agentId||ac.id,a=!0}catch(a){J.o.error("Agent deletion failed.",{description:a instanceof Error?a.message:"Unknown agent error."})}finally{P(!1)}a&&(m().catch(()=>{}),J.o.success("Agent deleted from OpenClaw.",{description:b}))},an=!!T&&(y||"monitoring"===T.policy.preset);return(0,d.jsxs)(d.Fragment,{children:[h?(0,d.jsx)(W,{activeHash:u,pathname:t,statusTone:ah,surfaceTheme:b,onItemNavigate:aj,onExpandCollapsed:j??k}):(0,d.jsxs)("aside",{className:"relative flex h-full w-full flex-col overflow-hidden border-r border-white/[0.08] bg-[radial-gradient(circle_at_18%_0%,rgba(56,102,170,0.20),transparent_34%),linear-gradient(180deg,rgba(18,26,41,0.98)_0%,rgba(10,16,27,0.98)_48%,rgba(5,10,18,0.99)_100%)] text-slate-100 shadow-[18px_0_60px_rgba(0,0,0,0.34)]",children:[(0,d.jsx)("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 bg-[linear-gradient(90deg,rgba(255,255,255,0.055),transparent_38%),radial-gradient(circle_at_55%_0%,rgba(59,130,246,0.10),transparent_30%)]"}),(0,d.jsx)("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-y-0 right-0 w-px bg-white/[0.08]"}),(0,d.jsxs)("div",{className:"relative flex h-full min-h-0 flex-col px-4 py-5",children:[(0,d.jsx)(R,{onToggleCollapsed:k}),(0,d.jsx)(S,{activeWorkspaceId:c,snapshot:a,workspace:ag,statusLabel:ai,statusTone:ah,onSelectWorkspace:l,onOpenWorkspaceCreate:n}),(0,d.jsx)("nav",{"aria-label":"Primary",className:"sidebar-scroll mt-6 min-h-0 flex-1 overflow-y-auto overscroll-contain pr-1",children:(0,d.jsx)("div",{className:"flex flex-col gap-5",children:O.map(a=>(0,d.jsx)(U,{activeHash:u,pathname:t,section:a,onNavigate:aj},a.id))})})]})]}),(0,d.jsx)(G.lG,{open:D,onOpenChange:E,children:(0,d.jsxs)(G.Cf,{children:[(0,d.jsxs)(G.c7,{children:[(0,d.jsx)(G.L3,{children:"Delete OpenClaw agent"}),(0,d.jsx)(G.rr,{children:"This removes the selected agent from OpenClaw and detaches its workspace binding."})]}),ac?(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsx)("div",{className:"rounded-[20px] border border-rose-400/20 bg-rose-500/[0.08] px-4 py-3.5",children:(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("div",{className:"mt-0.5 rounded-full border border-rose-300/20 bg-rose-400/10 p-2 text-rose-200",children:(0,d.jsx)(s.A,{className:"h-4 w-4"})}),(0,d.jsxs)("div",{className:"flex flex-col gap-1.5 text-sm text-rose-50",children:[(0,d.jsx)("p",{className:"font-medium",children:"This action cannot be undone."}),(0,d.jsx)("p",{className:"text-rose-100/80",children:"OpenClaw will delete this agent, remove its config entry, remove its manifest record, and clean up agent-specific policy/state files. Shared workspace docs and files will remain."})]})]})}),(0,d.jsxs)("div",{className:"grid gap-3 sm:grid-cols-3",children:[(0,d.jsx)(aa,{label:"Status",value:ac.status,danger:"engaged"===(r=ac).status||"monitoring"===r.status||"ready"===r.status}),(0,d.jsx)(aa,{label:"Runs",value:String(a.runtimes.filter(a=>a.agentId===ac.id).length)}),(0,d.jsx)(aa,{label:"Workspace",value:a.workspaces.find(a=>a.id===ac.workspaceId)?.name??"Unknown"})]}),(0,d.jsxs)("div",{className:"rounded-[18px] border border-white/10 bg-white/[0.03] px-3.5 py-3",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.2em] text-slate-500",children:"Agent id"}),(0,d.jsx)("p",{className:"mt-1.5 break-all font-mono text-xs text-slate-300",children:ac.id})]}),(0,d.jsx)(Y,{label:`Type ${ac.id} to confirm`,htmlFor:"delete-agent-confirm",children:(0,d.jsx)(H.p,{id:"delete-agent-confirm",value:ae,onChange:a=>af(a.target.value),placeholder:ac.id})})]}):null,(0,d.jsxs)(G.Es,{children:[(0,d.jsx)(F.$,{variant:"secondary",onClick:()=>{E(!1),ad(null),af("")},children:"Cancel"}),(0,d.jsx)(F.$,{variant:"destructive",onClick:am,disabled:I||!ac||ae.trim()!==ac.id,children:I?"Deleting...":"Delete agent"})]})]})}),(0,d.jsx)(G.lG,{open:w,onOpenChange:ak,children:(0,d.jsxs)(G.Cf,{className:"max-h-[90vh] overflow-y-auto sm:max-w-3xl",children:[(0,d.jsxs)(G.c7,{children:[(0,d.jsx)(G.L3,{children:"Edit OpenClaw agent"}),(0,d.jsx)(G.rr,{children:"Update the selected agent identity, preset, and operating policy."})]}),T?(0,d.jsxs)("div",{className:"flex flex-col gap-5",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsx)("p",{className:"text-[11px] uppercase tracking-[0.18em] text-slate-400",children:"Agent preset"}),(0,d.jsx)("div",{className:"grid gap-3 sm:grid-cols-2",children:K.bt.map(a=>(0,d.jsx)(Z,{label:a.label,description:a.description,active:T.policy.preset===a.value,badgeVariant:(0,K.Cf)(a.value).badgeVariant,onClick:()=>V(b=>{var c,d;let e,f,g;return b?(c=b,d=a.value,e=(0,K.Cf)(c.policy.preset),f=(0,K.Cf)(d),g=(0,K.g0)(d),{...c,name:c.name&&c.name!==e.defaultName?c.name:f.defaultName,emoji:c.emoji&&c.emoji!==e.defaultEmoji?c.emoji:f.defaultEmoji,theme:c.theme&&c.theme!==e.defaultTheme?c.theme:f.defaultTheme,policy:g,heartbeat:(0,L.I$)(c.heartbeat,c.policy.preset,d)}):b})},a.value))})]}),(0,d.jsx)($,{policy:T.policy}),(0,d.jsx)(Y,{label:"Agent id",htmlFor:"edit-agent-id",children:(0,d.jsx)(H.p,{id:"edit-agent-id",value:T.id,disabled:!0})}),(0,d.jsx)(Y,{label:"Display name",htmlFor:"edit-agent-name",children:(0,d.jsx)(H.p,{id:"edit-agent-name",value:T.name,onChange:a=>V(b=>b?{...b,name:a.target.value}:b),placeholder:(0,K.Cf)(T.policy.preset).defaultName})}),(0,d.jsx)(Y,{label:"Workspace",htmlFor:"edit-agent-workspace",children:(0,d.jsx)(H.p,{id:"edit-agent-workspace",value:a.workspaces.find(a=>a.id===T.workspaceId)?.name||T.workspaceId,disabled:!0})}),(0,d.jsx)(Y,{label:"Model",htmlFor:"edit-agent-model",children:(0,d.jsxs)("select",{id:"edit-agent-model",value:T.modelId,onChange:a=>V(b=>b?{...b,modelId:a.target.value}:b),className:"flex h-11 w-full rounded-2xl border border-white/10 bg-white/5 px-4 py-2 text-sm text-white outline-none focus-visible:ring-2 focus-visible:ring-cyan-300/40",children:[(0,d.jsx)("option",{value:"",children:"Use OpenClaw default"}),a.models.map(a=>(0,d.jsx)("option",{value:a.id,children:a.id},a.id))]})}),(0,d.jsxs)("div",{className:"grid gap-4 sm:grid-cols-2",children:[(0,d.jsx)(Y,{label:"Emoji",htmlFor:"edit-agent-emoji",children:(0,d.jsx)(H.p,{id:"edit-agent-emoji",value:T.emoji,onChange:a=>V(b=>b?{...b,emoji:a.target.value}:b),placeholder:(0,K.Cf)(T.policy.preset).defaultEmoji})}),(0,d.jsx)(Y,{label:"Theme",htmlFor:"edit-agent-theme",children:(0,d.jsx)(H.p,{id:"edit-agent-theme",value:T.theme,onChange:a=>V(b=>b?{...b,theme:a.target.value}:b),placeholder:(0,K.Cf)(T.policy.preset).defaultTheme})})]}),(0,d.jsx)(Y,{label:"Avatar URL",htmlFor:"edit-agent-avatar",children:(0,d.jsx)(H.p,{id:"edit-agent-avatar",value:T.avatar,onChange:a=>V(b=>b?{...b,avatar:a.target.value}:b),placeholder:"https://example.com/avatar.png"})}),(0,d.jsx)(z.X,{snapshot:a,workspaceId:T.workspaceId,channelIds:T.channelIds,agentId:T.id,isSaving:B,surfaceTheme:"dark",onChange:a=>V(b=>b?{...b,channelIds:a}:b)}),(0,d.jsxs)("div",{className:"rounded-[20px] border border-white/10 bg-white/[0.03] p-4",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium text-white",children:"Advanced policy"}),(0,d.jsx)("p",{className:"mt-1 text-xs leading-5 text-slate-400",children:"Override how this agent handles missing tools, installs, file scope, and network usage."})]}),(0,d.jsx)(F.$,{type:"button",variant:"secondary",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",onClick:()=>A(a=>!a),children:y?"Hide":"Show"})]}),an?(0,d.jsxs)("div",{className:"mt-4 rounded-[18px] border border-white/10 bg-slate-950/40 p-4",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium text-white",children:"Heartbeat"}),(0,d.jsx)("p",{className:"mt-1 text-xs leading-5 text-slate-400",children:"Use this only for periodic watch or triage agents. Leave it off for normal task execution."})]}),(0,d.jsx)(F.$,{type:"button",variant:T.heartbeat.enabled?"default":"secondary",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",onClick:()=>V(a=>a?{...a,heartbeat:a.heartbeat.enabled?{...a.heartbeat,enabled:!1}:{...a.heartbeat,enabled:!0,every:a.heartbeat.every||(0,L.A6)(a.policy.preset).every}}:a),children:T.heartbeat.enabled?"On":"Off"})]}),T.heartbeat.enabled?(0,d.jsx)("div",{className:"mt-3",children:(0,d.jsx)(Y,{label:"Interval",htmlFor:"edit-agent-heartbeat-every",children:(0,d.jsx)("select",{id:"edit-agent-heartbeat-every",value:T.heartbeat.every,onChange:a=>V(b=>b?{...b,heartbeat:{...b.heartbeat,every:a.target.value}}:b),className:"flex h-11 w-full rounded-2xl border border-white/10 bg-white/5 px-4 py-2 text-sm text-white outline-none focus-visible:ring-2 focus-visible:ring-cyan-300/40",children:L.MQ.map(a=>(0,d.jsx)("option",{value:a.value,children:a.label},a.value))})})}):null]}):null,y?(0,d.jsxs)("div",{className:"mt-4 grid gap-4 sm:grid-cols-2",children:[(0,d.jsx)(_,{label:"Missing tool behavior",htmlFor:"edit-agent-missing-tools",value:T.policy.missingToolBehavior,options:K.A_,onChange:a=>V(b=>b?{...b,policy:{...b.policy,missingToolBehavior:a}}:b)}),(0,d.jsx)(_,{label:"Install scope",htmlFor:"edit-agent-install-scope",value:T.policy.installScope,options:K.sH,onChange:a=>V(b=>b?{...b,policy:{...b.policy,installScope:a}}:b)}),(0,d.jsx)(_,{label:"File access",htmlFor:"edit-agent-file-access",value:T.policy.fileAccess,options:K.$x,onChange:a=>V(b=>b?{...b,policy:{...b.policy,fileAccess:a}}:b)}),(0,d.jsx)(_,{label:"Network access",htmlFor:"edit-agent-network-access",value:T.policy.networkAccess,options:K.DS,onChange:a=>V(b=>b?{...b,policy:{...b.policy,networkAccess:a}}:b)})]}):null]})]}):null,(0,d.jsxs)(G.Es,{children:[(0,d.jsx)(F.$,{variant:"secondary",onClick:()=>ak(!1),children:"Cancel"}),(0,d.jsx)(F.$,{onClick:al,disabled:B||!T,children:B?"Saving...":"Save changes"})]})]})})]})}function R({onToggleCollapsed:a}){return(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,d.jsxs)(h(),{href:"/",className:"group flex min-w-0 items-center gap-3 rounded-[16px] outline-none transition-colors focus-visible:ring-2 focus-visible:ring-cyan-300/40","aria-label":"AgentOS Mission Control",children:[(0,d.jsx)("span",{className:"relative flex h-9 w-9 shrink-0 items-center justify-center overflow-hidden rounded-[11px] border border-cyan-200/18 bg-white/[0.06] shadow-[0_12px_28px_rgba(0,0,0,0.24)]",children:(0,d.jsx)(f.default,{src:"/assets/logo.webp",alt:"",width:36,height:36,"aria-hidden":"true",className:"h-full w-full object-cover",priority:!0})}),(0,d.jsx)("span",{className:"truncate py-0.5 font-display text-[1.15rem] font-semibold leading-[1.25] text-white",children:"AgentOS"})]}),(0,d.jsx)("button",{type:"button",onClick:a,"aria-label":"Collapse sidebar",className:"inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-[10px] border border-white/[0.08] bg-white/[0.04] text-slate-400 transition-all hover:border-cyan-300/24 hover:bg-white/[0.08] hover:text-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cyan-300/40",children:(0,d.jsx)(t.A,{className:"h-4 w-4"})})]})}function S({activeWorkspaceId:a,snapshot:b,workspace:c,statusLabel:f,statusTone:g,onSelectWorkspace:h,onOpenWorkspaceCreate:i}){let[j,k]=(0,e.useState)(!1),l=(0,e.useRef)(null);return(0,d.jsxs)("div",{className:"relative mt-5",ref:l,children:[(0,d.jsxs)("button",{type:"button","aria-expanded":j,"aria-haspopup":"menu",onClick:()=>k(a=>!a),className:"group flex w-full items-center gap-3 rounded-[16px] border border-white/[0.09] bg-[linear-gradient(180deg,rgba(255,255,255,0.075),rgba(255,255,255,0.035))] px-3 py-3 text-left shadow-[inset_0_1px_0_rgba(255,255,255,0.06),0_14px_30px_rgba(0,0,0,0.20)] transition-all hover:border-cyan-200/20 hover:bg-white/[0.075] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cyan-300/40",children:[(0,d.jsx)("span",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-[12px] border border-cyan-200/16 bg-cyan-300/[0.10] text-cyan-200",children:(0,d.jsx)(u.A,{className:"h-4 w-4"})}),(0,d.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,d.jsx)("span",{className:"block truncate text-[0.95rem] font-semibold leading-5 text-white",children:null===a?"All workspaces":c?.name||"No workspace"}),(0,d.jsxs)("span",{className:"mt-0.5 flex items-center gap-1.5 text-[0.63rem] font-semibold uppercase leading-none tracking-[0.22em] text-slate-500",children:[(0,d.jsx)(D,{tone:g,pulse:"bg-emerald-400"===g,className:"h-2 w-2"}),null===a?`${b.workspaces.length} workspaces`:"Workspace"]})]}),(0,d.jsxs)("span",{className:"flex flex-col items-end gap-1",children:[(0,d.jsx)(v.A,{className:(0,C.cn)("h-4 w-4 text-slate-400 transition-transform group-hover:text-slate-200",j&&"rotate-180")}),(0,d.jsx)("span",{className:"text-[0.6rem] font-medium text-slate-500",children:f})]})]}),j?(0,d.jsxs)("div",{role:"menu",className:"absolute left-0 right-0 top-[calc(100%+8px)] z-50 rounded-[16px] border border-white/[0.10] bg-slate-950/96 p-1.5 shadow-[0_24px_56px_rgba(0,0,0,0.42)] backdrop-blur-xl",children:[(0,d.jsx)(T,{label:"All workspaces",detail:`${b.workspaces.length} total`,selected:null===a,onClick:()=>{h(null),k(!1)}}),b.workspaces.map(b=>(0,d.jsx)(T,{label:b.name,detail:`${b.agentIds.length} agents`,selected:b.id===a,onClick:()=>{h(b.id),k(!1)}},b.id)),(0,d.jsx)("div",{className:"mt-1 border-t border-white/[0.08] pt-1",children:(0,d.jsxs)("button",{type:"button",role:"menuitem",onClick:()=>{i(),k(!1)},className:"flex w-full items-center gap-3 rounded-[12px] px-3 py-2.5 text-left text-cyan-100 transition-colors hover:bg-cyan-300/[0.10] hover:text-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cyan-300/40",children:[(0,d.jsx)("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-[9px] border border-cyan-300/20 bg-cyan-300/[0.12] text-cyan-200",children:(0,d.jsx)(w.A,{className:"h-3.5 w-3.5"})}),(0,d.jsxs)("span",{className:"min-w-0",children:[(0,d.jsx)("span",{className:"block truncate text-[0.82rem] font-medium",children:"Create Workspace"}),(0,d.jsx)("span",{className:"mt-0.5 block text-[0.67rem] text-slate-500",children:"Start a new workspace"})]})]})})]}):null]})}function T({label:a,detail:b,selected:c,onClick:e}){return(0,d.jsxs)("button",{type:"button",role:"menuitem",onClick:e,className:(0,C.cn)("flex w-full items-center justify-between gap-3 rounded-[12px] px-3 py-2.5 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cyan-300/40",c?"bg-cyan-400/[0.12] text-cyan-50":"text-slate-300 hover:bg-white/[0.06] hover:text-white"),children:[(0,d.jsxs)("span",{className:"min-w-0",children:[(0,d.jsx)("span",{className:"block truncate text-[0.82rem] font-medium",children:a}),(0,d.jsx)("span",{className:"mt-0.5 block text-[0.67rem] text-slate-500",children:b})]}),c?(0,d.jsx)(x.A,{className:"h-3.5 w-3.5 shrink-0 text-cyan-300"}):null]})}function U({activeHash:a,onNavigate:b,pathname:c,section:e}){return(0,d.jsxs)("section",{className:"flex flex-col gap-2","aria-labelledby":`sidebar-${e.id}`,children:[(0,d.jsx)("h2",{id:`sidebar-${e.id}`,className:"px-2 text-[0.64rem] font-semibold uppercase leading-none tracking-[0.22em] text-slate-500",children:e.label}),(0,d.jsx)("div",{className:"flex flex-col gap-1",children:P.filter(a=>a.section===e.id).map(e=>(0,d.jsx)(V,{item:e,active:X(e,c,a),onNavigate:()=>b(e)},e.label))})]})}function V({item:a,active:b,onNavigate:c}){let e=a.icon;return(0,d.jsxs)(h(),{href:a.href??"#",scroll:!a.href?.startsWith("/settings#")&&void 0,"aria-current":b?"page":void 0,onClick:c,className:(0,C.cn)("group relative flex h-10 items-center gap-3 rounded-[12px] border px-3 text-[0.84rem] font-medium outline-none transition-all focus-visible:ring-2 focus-visible:ring-cyan-300/40",b?"border-blue-300/28 bg-[linear-gradient(90deg,rgba(37,99,235,0.34),rgba(14,165,233,0.16))] text-cyan-50 shadow-[inset_0_1px_0_rgba(255,255,255,0.08),0_12px_28px_rgba(37,99,235,0.16)]":"border-transparent text-slate-300 hover:border-white/[0.08] hover:bg-white/[0.055] hover:text-white"),children:[b?(0,d.jsx)("span",{className:"absolute left-0 top-2 h-6 w-1 rounded-r-full bg-cyan-300 shadow-[0_0_18px_rgba(34,211,238,0.36)]"}):null,(0,d.jsx)(e,{className:(0,C.cn)("h-[1.05rem] w-[1.05rem] shrink-0",b?"text-cyan-200":"text-slate-400 group-hover:text-slate-200")}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate",children:a.label}),"number"==typeof a.badge?(0,d.jsx)(E.E,{className:"ml-auto flex h-5 min-w-5 justify-center border-white/[0.08] bg-white/[0.08] px-1.5 py-0 text-[0.64rem] tracking-normal text-slate-200",children:a.badge}):null]})}function W({activeHash:a,pathname:b,statusTone:c,surfaceTheme:e,onItemNavigate:g,onExpandCollapsed:i}){return(0,d.jsxs)("aside",{className:"relative flex h-full w-full flex-col items-center overflow-hidden border-r border-white/[0.08] bg-[linear-gradient(180deg,rgba(15,23,38,0.98),rgba(6,10,18,0.99))] px-1 py-4 text-slate-100 shadow-[14px_0_44px_rgba(0,0,0,0.32)]",children:[(0,d.jsx)("button",{type:"button",onClick:i,"aria-label":"Expand sidebar",className:"flex h-10 w-10 items-center justify-center overflow-hidden rounded-[13px] border border-cyan-200/18 bg-white/[0.06] shadow-[0_12px_26px_rgba(0,0,0,0.26)] transition-colors hover:border-cyan-200/28 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cyan-300/40",children:(0,d.jsx)(f.default,{src:"/assets/logo.webp",alt:"",width:40,height:40,"aria-hidden":"true",className:"h-full w-full object-cover",priority:!0})}),(0,d.jsx)("nav",{"aria-label":"Primary",className:"sidebar-scroll mt-5 flex min-h-0 w-12 flex-1 flex-col items-center gap-4 overflow-y-auto overscroll-contain",children:O.map(c=>(0,d.jsx)("div",{className:"flex flex-col items-center gap-1.5",children:P.filter(a=>a.section===c.id).map(c=>{let f=X(c,b,a),i=c.icon;return(0,d.jsx)(A.A,{label:c.label,side:"right",surfaceTheme:e,panelCollapsed:!0,children:(0,d.jsxs)(h(),{href:c.href??"#",scroll:!c.href?.startsWith("/settings#")&&void 0,"aria-label":c.label,"aria-current":f?"page":void 0,onClick:()=>{g(c)},className:(0,C.cn)("relative inline-flex h-10 w-10 items-center justify-center rounded-[12px] border outline-none transition-all focus-visible:ring-2 focus-visible:ring-cyan-300/40",f?"border-blue-300/28 bg-cyan-300 text-slate-950 shadow-[0_14px_30px_rgba(56,189,248,0.24)]":"border-white/[0.08] bg-white/[0.035] text-slate-400 hover:border-white/[0.14] hover:bg-white/[0.08] hover:text-white"),children:[(0,d.jsx)(i,{className:"h-4 w-4"}),"number"==typeof c.badge?(0,d.jsx)("span",{className:"absolute -right-1 -top-1 flex h-4 min-w-4 items-center justify-center rounded-full border border-slate-950 bg-slate-200 px-1 text-[0.58rem] font-bold leading-none text-slate-950 shadow-[0_4px_10px_rgba(0,0,0,0.24)]",children:c.badge}):null]})},c.label)})},c.id))}),(0,d.jsxs)("div",{className:"mt-4 flex flex-col items-center gap-3",children:[(0,d.jsx)(D,{tone:c,pulse:"bg-emerald-400"===c}),(0,d.jsx)("button",{type:"button",onClick:i,"aria-label":"Expand sidebar",className:"inline-flex h-9 w-9 items-center justify-center rounded-[11px] border border-white/[0.08] bg-white/[0.04] text-slate-400 transition-colors hover:bg-white/[0.08] hover:text-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cyan-300/40",children:(0,d.jsx)(y.A,{className:"h-4 w-4"})})]})]})}function X(a,b,c){return"Mission Control"===a.label?"/"===b&&(!c||"mission-control"===c):!a.href||a.hash||"/"===a.href||a.href.startsWith("/settings")?a.href?.startsWith("/settings")?"/settings"===b&&(a.hash?c===a.hash:!c||"settings"===c):"/"===b&&!!a.hash&&c===a.hash:b===a.href||b.startsWith(`${a.href}/`)}function Y({label:a,htmlFor:b,children:c}){return(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsx)(I.J,{htmlFor:b,className:"text-[11px] uppercase tracking-[0.18em] text-slate-400",children:a}),c]})}function Z({label:a,description:b,active:c,badgeVariant:e,onClick:f}){return(0,d.jsx)("button",{type:"button",onClick:f,className:(0,C.cn)("rounded-[20px] border p-4 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cyan-300/40",c?"border-cyan-300/30 bg-cyan-400/10":"border-white/10 bg-white/[0.03]"),children:(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,d.jsx)("p",{className:"text-sm font-medium text-white",children:a}),(0,d.jsx)("p",{className:"text-xs leading-5 text-slate-400",children:b})]}),(0,d.jsx)(E.E,{variant:e,children:c?"selected":"preset"})]})})}function $({policy:a}){let b=(0,K.Cf)(a.preset);return(0,d.jsxs)("div",{className:"rounded-[20px] border border-white/10 bg-slate-950/50 p-4",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium text-white",children:b.label}),(0,d.jsx)("p",{className:"mt-1 text-xs leading-5 text-slate-400",children:b.description})]}),(0,d.jsx)(E.E,{variant:b.badgeVariant,children:b.label})]}),(0,d.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",children:[(0,d.jsx)(E.E,{variant:"muted",children:(0,K.zR)(a.missingToolBehavior)}),(0,d.jsx)(E.E,{variant:"muted",children:(0,K.UJ)(a.installScope)}),(0,d.jsx)(E.E,{variant:"muted",children:(0,K.bQ)(a.fileAccess)}),(0,d.jsxs)(E.E,{variant:"muted",children:["Network ",(0,K.Bw)(a.networkAccess)]})]})]})}function _({label:a,htmlFor:b,value:c,options:e,onChange:f}){return(0,d.jsx)(Y,{label:a,htmlFor:b,children:(0,d.jsx)("select",{id:b,value:c,onChange:a=>f(a.target.value),className:"flex h-11 w-full rounded-2xl border border-white/10 bg-white/5 px-4 py-2 text-sm text-white outline-none focus-visible:ring-2 focus-visible:ring-cyan-300/40",children:e.map(a=>(0,d.jsxs)("option",{value:a.value,children:[a.label," - ",a.description]},a.value))})})}function aa({label:a,value:b,danger:c=!1}){return(0,d.jsxs)("div",{className:(0,C.cn)("rounded-[18px] border px-3.5 py-3",c?"border-amber-300/20 bg-amber-400/[0.08]":"border-white/10 bg-white/[0.03]"),children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.2em] text-slate-500",children:a}),(0,d.jsx)("p",{className:(0,C.cn)("mt-1.5 font-display text-lg",c?"text-amber-100":"text-white"),children:b})]})}},927:(a,b,c)=>{"use strict";c.d(b,{Toaster:()=>e});var d=c(57196);let e=(0,d.registerClientReference)(function(){throw Error("Attempted to call Toaster() from the server but Toaster is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Users/kazimakgul/Documents/GitHub/AgentOS/components/ui/sonner.tsx","Toaster");(0,d.registerClientReference)(function(){throw Error("Attempted to call toast() from the server but toast is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Users/kazimakgul/Documents/GitHub/AgentOS/components/ui/sonner.tsx","toast")},1994:(a,b,c)=>{"use strict";c.d(b,{W:()=>x});var d=c(3814),e=c(6247),f=c(56815),g=c(11917),h=c(43039),i=c(73596),j=c(28494),k=c(90162),l=c(61524),m=c(45821),n=c(63685),o=c(81187),p=c(71899),q=c(5813),r=c(80990),s=c(37674),t=c(74952),u=c(43081),v=c(32905);let w={context:"Context",memory:"Memory",identity:"Identity",tools:"Tools",boot:"Boot",skills:"Skills","project-config":"Project Config","agent-policy-config":"Agent Policy/Config"};function x({snapshot:a,workspaceId:b,open:c,onOpenChange:m}){let n=(0,e.useMemo)(()=>a.workspaces.find(a=>a.id===b)??null,[a.workspaces,b]),[o,p]=(0,e.useState)([]),[w,C]=(0,e.useState)(null),[H,I]=(0,e.useState)(null),[J,K]=(0,e.useState)(""),[L,M]=(0,e.useState)(""),[N,O]=(0,e.useState)(!1),[P,Q]=(0,e.useState)(!1),[R,S]=(0,e.useState)(!1),[T,U]=(0,e.useState)(null),[V,W]=(0,e.useState)(null),[X,Y]=(0,e.useState)(!0),[Z,$]=(0,e.useState)([]),[_,aa]=(0,e.useState)(!1),ab=J!==L,ac=H??o.find(a=>a.path===w)??null,ad=!!(ac?.editable&&!P),ae=(0,e.useMemo)(()=>{if(!b)return[];let c=a.agents.filter(a=>a.workspaceId===b),d=new Map((n?.agentIds??[]).map((a,b)=>[a,b]));return c.toSorted((a,b)=>(d.get(a.id)??Number.MAX_SAFE_INTEGER)-(d.get(b.id)??Number.MAX_SAFE_INTEGER)||a.name.localeCompare(b.name))},[a.agents,n?.agentIds,b]),af=(0,e.useMemo)(()=>(function(a,b){let c=[],d=new Map(b.map(a=>[a.id,[]]));for(let e of a){let a=F(e,b);if(!a){c.push(e);continue}let f=d.get(a)??[];f.push(e),d.set(a,f)}for(let a of b)d.set(a.id,(d.get(a.id)??[]).toSorted((a,b)=>Number(D(b))-Number(D(a))||Number(E(a))-Number(E(b))||a.path.localeCompare(b.path)));return{workspaceFiles:c,agentFilesByAgentId:d,agentGroups:b.map(a=>({agent:a,files:d.get(a.id)??[]}))}})(o,ae),[o,ae]),ag=(0,e.useMemo)(()=>ac?F(ac,ae):null,[ac,ae]),ah=!!(ac&&!ag),ai=(0,e.useCallback)(async()=>{if(b){O(!0),U(null);try{let a=await fetch(`/api/workspaces/${encodeURIComponent(b)}/files`,{cache:"no-store"}),c=await a.json();if(!a.ok||c.error)throw Error(c.error||"Workspace file list could not be loaded.");p(c.files),W(c.maxFileBytes),C(a=>{var b;return a&&c.files.some(b=>b.path===a)?a:(b=c.files,b.find(a=>"AGENTS.md"===a.path)?.path??b.find(a=>a.exists)?.path??b[0]?.path??null)})}catch(a){p([]),C(null),I(null),K(""),M(""),U(a instanceof Error?a.message:"Workspace file list could not be loaded.")}finally{O(!1)}}},[b]),aj=(0,e.useCallback)(a=>a.path===w||(!ab||!!window.confirm("Discard unsaved changes?"))&&(C(a.path),I(a),!0),[ab,w]),ak=(0,e.useCallback)(a=>{if(!Z.includes(a)){let b=af.agentFilesByAgentId.get(a)?.[0];if(b&&!aj(b))return}$(b=>b.includes(a)?b.filter(b=>b!==a):[...b,a])},[Z,af.agentFilesByAgentId,aj]),al=(0,e.useCallback)(()=>{if(!X){let a=af.workspaceFiles[0];if(a&&!aj(a))return}Y(a=>!a)},[af.workspaceFiles,aj,X]),am=(0,e.useCallback)(async()=>{if(b&&ac&&ac.editable){if(V&&new Blob([J]).size>V)return void U(`File exceeds ${G(V)}.`);if("json"===ac.language)try{JSON.parse(J)}catch(a){U(a instanceof Error?`Invalid JSON: ${a.message}`:"Invalid JSON.");return}S(!0),U(null);try{let a=!ac.exists,c=await fetch(`/api/workspaces/${encodeURIComponent(b)}/files`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:ac.path,content:J})}),d=await c.json();if(!c.ok||d.error)throw Error(d.error||"Workspace file could not be saved.");I(d.file),p(a=>{var b,c;return b=a,c=d.file,b.some(a=>a.path===c.path)?b.map(a=>a.path===c.path?c:a):[...b,c]}),K(d.content),M(d.content),W(d.maxFileBytes),u.o.success(a?"Workspace file created.":"Workspace file saved.")}catch(b){let a=b instanceof Error?b.message:"Workspace file could not be saved.";U(a),u.o.error("Workspace file save failed.",{description:a})}finally{S(!1)}}},[ac,J,V,b]),an=(0,e.useCallback)(()=>{K(L),U(null)},[L]);return(0,d.jsx)(s.lG,{open:c,onOpenChange:m,children:(0,d.jsxs)(s.Cf,{className:"flex h-[min(780px,calc(100vh-48px))] max-w-[min(1120px,calc(100vw-32px))] flex-col gap-0 overflow-hidden rounded-[24px] p-0",children:[(0,d.jsxs)(s.c7,{className:"border-b border-white/10 px-6 py-5",children:[(0,d.jsx)(s.L3,{className:"text-lg",children:"OpenClaw Workspace Files"}),(0,d.jsx)(s.rr,{className:"truncate",children:n?`${n.name} \xb7 ${n.path}`:"Workspace context, memory, policy, and config files."})]}),(0,d.jsxs)("div",{className:"grid min-h-0 flex-1 grid-cols-1 md:grid-cols-[340px_minmax(0,1fr)]",children:[(0,d.jsxs)("aside",{className:"min-h-0 overflow-y-auto border-b border-white/10 bg-white/[0.02] p-3 md:border-b-0 md:border-r",children:[(0,d.jsxs)("div",{className:"mb-3 flex items-center justify-between gap-3",children:[(0,d.jsx)("p",{className:"text-xs font-medium uppercase tracking-[0.16em] text-slate-400",children:"Files"}),(0,d.jsxs)(r.$,{type:"button",variant:"ghost",size:"sm",onClick:()=>void ai(),disabled:N||!b,className:"h-8 rounded-xl px-2 text-xs",children:[(0,d.jsx)(f.A,{className:(0,v.cn)("mr-1.5 h-3.5 w-3.5",N&&"animate-spin")}),"Refresh"]})]}),N?(0,d.jsxs)("div",{className:"flex items-center gap-2 rounded-2xl border border-white/10 bg-white/[0.03] px-3 py-3 text-xs text-slate-300",children:[(0,d.jsx)(g.A,{className:"h-3.5 w-3.5 animate-spin"}),"Loading workspace files"]}):0===o.length?(0,d.jsx)("div",{className:"rounded-2xl border border-white/10 bg-white/[0.03] px-3 py-3 text-xs text-slate-400",children:"No editable OpenClaw workspace files were found."}):(0,d.jsxs)("div",{className:"space-y-5",children:[(0,d.jsx)("div",{className:"space-y-2",children:(0,d.jsx)(A,{files:af.workspaceFiles,expanded:X,active:ah,activePath:ac?.path??null,onToggle:al,onSelectFile:aj})}),(0,d.jsxs)("div",{className:"space-y-1.5",children:[(0,d.jsx)(z,{label:"Agents",detail:`${ae.length} members`}),(0,d.jsx)("div",{className:"space-y-2",children:0===ae.length?(0,d.jsx)("div",{className:"rounded-2xl border border-white/10 bg-white/[0.03] px-3 py-3 text-xs text-slate-400",children:"No agents are assigned to this workspace."}):af.agentGroups.map(a=>(0,d.jsx)(B,{group:a,expanded:Z.includes(a.agent.id),active:ag===a.agent.id,activePath:ac?.path??null,onToggle:ak,onSelectFile:aj},a.agent.id))})]}),ae.length>0&&af.agentGroups.every(a=>0===a.files.length)?(0,d.jsx)("div",{className:"rounded-2xl border border-white/10 bg-white/[0.03] px-3 py-3 text-xs text-slate-400",children:"No agent-specific editable files were found."}):null]})]}),(0,d.jsxs)("section",{className:"flex min-h-0 flex-col",children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-4 border-b border-white/10 px-5 py-4",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,d.jsx)("p",{className:"truncate font-display text-base text-white",children:ac?.path??"Select a workspace file"}),ac?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(q.E,{variant:"muted",className:"rounded-full px-2 py-0.5 text-[10px] uppercase",children:ac.language}),!ac.exists&&ac.createable?(0,d.jsx)(q.E,{variant:"muted",className:"rounded-full px-2 py-0.5 text-[10px] uppercase",children:"New file"}):null]}):null]}),(0,d.jsx)("p",{className:"mt-1 text-xs text-slate-500",children:ac?.description??(ac?.size?`${G(ac.size)}`:"Markdown and JSON only.")})]}),ac?(0,d.jsxs)("div",{className:"relative flex shrink-0 items-center gap-2",children:[(0,d.jsx)(r.$,{type:"button",variant:"ghost",size:"icon","aria-label":`Show information for ${ac.path}`,"aria-expanded":_,onClick:()=>aa(a=>!a),className:"h-8 w-8 rounded-full border border-white/10 bg-white/[0.03] text-slate-300 hover:bg-white/[0.08] hover:text-white",children:(0,d.jsx)(h.A,{className:"h-4 w-4"})}),ac.source?(0,d.jsx)(q.E,{variant:"muted",className:"rounded-full px-2.5 py-1 text-[10px] uppercase",children:ac.source}):null,_?(0,d.jsx)(y,{file:ac}):null]}):null]}),(0,d.jsxs)("div",{className:"min-h-0 flex-1 p-5",children:[T?(0,d.jsxs)("div",{className:"mb-3 flex items-start gap-2 rounded-2xl border border-rose-300/20 bg-rose-400/10 px-3 py-2 text-xs text-rose-100",children:[(0,d.jsx)(i.A,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),(0,d.jsx)("span",{children:T})]}):null,ac?P?(0,d.jsxs)("div",{className:"flex h-full items-center justify-center gap-2 rounded-2xl border border-white/10 bg-white/[0.02] text-sm text-slate-300",children:[(0,d.jsx)(g.A,{className:"h-4 w-4 animate-spin"}),"Loading file"]}):ac.editable?(0,d.jsx)(t.T,{value:J,onChange:a=>K(a.target.value),spellCheck:!1,className:"h-full min-h-[360px] resize-none rounded-2xl font-mono text-xs leading-5"}):(0,d.jsx)("div",{className:"flex h-full items-center justify-center rounded-2xl border border-white/10 bg-white/[0.02] px-6 text-center text-sm text-slate-400",children:ac.reason??"This file is not editable from AgentOS."}):(0,d.jsx)("div",{className:"flex h-full items-center justify-center rounded-2xl border border-dashed border-white/10 bg-white/[0.02] text-sm text-slate-400",children:"Select an OpenClaw workspace file."})]}),(0,d.jsxs)(s.Es,{className:"border-t border-white/10 px-5 py-4",children:[(0,d.jsxs)(r.$,{type:"button",variant:"secondary",onClick:an,disabled:!ab||R,children:[(0,d.jsx)(j.A,{className:"mr-2 h-4 w-4"}),"Discard"]}),(0,d.jsxs)(r.$,{type:"button",onClick:()=>void am(),disabled:!ad||ac?.exists!==!1&&!ab||R,children:[R?(0,d.jsx)(g.A,{className:"mr-2 h-4 w-4 animate-spin"}):ac?.exists?(0,d.jsx)(k.A,{className:"mr-2 h-4 w-4"}):(0,d.jsx)(l.A,{className:"mr-2 h-4 w-4"}),ac?.exists?"Save":"Create"]})]})]})]})]})})}function y({file:a}){return(0,d.jsxs)("div",{className:"absolute right-0 top-10 z-20 w-[min(360px,calc(100vw-48px))] rounded-2xl border border-white/10 bg-[#0b1220] p-3 text-left shadow-[0_18px_70px_rgba(0,0,0,0.42)]",children:[(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)(h.A,{className:"mt-0.5 h-4 w-4 shrink-0 text-cyan-200"}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"truncate text-sm font-medium text-white",children:a.path}),(0,d.jsx)("p",{className:"mt-1 text-xs leading-5 text-slate-300",children:a.description??"Workspace-managed OpenClaw Markdown or JSON file."})]})]}),a.usage?(0,d.jsxs)("div",{className:"mt-3 rounded-xl border border-white/10 bg-white/[0.03] p-2.5",children:[(0,d.jsx)("p",{className:"text-[10px] font-medium uppercase tracking-[0.16em] text-slate-500",children:"How to use it"}),(0,d.jsx)("p",{className:"mt-1 text-xs leading-5 text-slate-300",children:a.usage})]}):null,a.runtimeBehavior?(0,d.jsxs)("div",{className:"mt-2 rounded-xl border border-cyan-300/10 bg-cyan-300/[0.04] p-2.5",children:[(0,d.jsx)("p",{className:"text-[10px] font-medium uppercase tracking-[0.16em] text-cyan-200/80",children:"Runtime behavior"}),(0,d.jsx)("p",{className:"mt-1 text-xs leading-5 text-slate-300",children:a.runtimeBehavior})]}):null]})}function z({label:a,detail:b}){return(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3 px-2",children:[(0,d.jsx)("p",{className:"text-[10px] font-medium uppercase tracking-[0.18em] text-slate-500",children:a}),b?(0,d.jsx)("p",{className:"shrink-0 text-[10px] text-slate-600",children:b}):null]})}function A({files:a,expanded:b,active:c,activePath:e,onToggle:f,onSelectFile:g}){let h="workspace-core-files",i=a.length>0;return(0,d.jsxs)("div",{className:(0,v.cn)("rounded-2xl border bg-white/[0.025] p-1.5 transition-colors",c?"border-cyan-300/35 bg-cyan-300/10":"border-white/5"),children:[(0,d.jsxs)("button",{type:"button",onClick:f,disabled:!i,"aria-expanded":i?b:void 0,"aria-controls":i?h:void 0,className:(0,v.cn)("flex w-full min-w-0 items-center gap-2 rounded-xl px-2 py-2 text-left transition-colors disabled:cursor-default",c?"text-white":"text-slate-300 hover:bg-white/[0.04] disabled:text-slate-500 disabled:hover:bg-transparent"),children:[(0,d.jsx)(m.A,{className:(0,v.cn)("h-3.5 w-3.5 shrink-0 text-slate-500 transition-transform",b?"rotate-0":"-rotate-90",c&&"text-cyan-200")}),(0,d.jsx)(n.A,{className:"h-3.5 w-3.5 shrink-0 text-cyan-200"}),(0,d.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,d.jsx)("span",{className:"block truncate text-xs font-medium",children:"Workspace Files"}),(0,d.jsx)("span",{className:"mt-0.5 block truncate text-[10px] text-slate-500",children:"Shared project context and config"})]}),(0,d.jsx)(q.E,{variant:"muted",className:"shrink-0 rounded-full px-1.5 py-0 text-[10px]",children:a.length})]}),b&&i?(0,d.jsx)("div",{id:h,className:"ml-6 mt-1 space-y-1 border-l border-white/10 pl-2",children:a.map(a=>(0,d.jsx)(C,{file:a,active:a.path===e,onSelect:g},a.path))}):null]})}function B({group:a,expanded:b,active:c,activePath:e,onToggle:f,onSelectFile:g}){let h=`workspace-agent-files-${a.agent.id}`,i=a.files.length>0;return(0,d.jsxs)("div",{className:(0,v.cn)("rounded-2xl border bg-white/[0.025] p-1.5 transition-colors",c?"border-cyan-300/35 bg-cyan-300/10":"border-white/5"),children:[(0,d.jsxs)("button",{type:"button",onClick:()=>f(a.agent.id),disabled:!i,"aria-expanded":i?b:void 0,"aria-controls":i?h:void 0,className:(0,v.cn)("flex w-full min-w-0 items-center gap-2 rounded-xl px-2 py-2 text-left transition-colors disabled:cursor-default",c?"text-white":"text-slate-300 hover:bg-white/[0.04] disabled:text-slate-500 disabled:hover:bg-transparent"),children:[(0,d.jsx)(m.A,{className:(0,v.cn)("h-3.5 w-3.5 shrink-0 text-slate-500 transition-transform",b?"rotate-0":"-rotate-90",c&&"text-cyan-200")}),(0,d.jsx)(o.A,{className:"h-3.5 w-3.5 shrink-0 text-cyan-200"}),(0,d.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,d.jsx)("span",{className:"block truncate text-xs font-medium",children:a.agent.name}),(0,d.jsx)("span",{className:"mt-0.5 block truncate text-[10px] text-slate-500",children:a.agent.id})]}),(0,d.jsx)(q.E,{variant:"muted",className:"shrink-0 rounded-full px-1.5 py-0 text-[10px]",children:a.files.length})]}),b&&i?(0,d.jsx)("div",{id:h,className:"ml-6 mt-1 space-y-1 border-l border-white/10 pl-2",children:a.files.map(a=>(0,d.jsx)(C,{file:a,active:a.path===e,onSelect:g},a.path))}):null]})}function C({file:a,active:b,onSelect:c}){return(0,d.jsxs)("button",{type:"button",onClick:()=>c(a),className:(0,v.cn)("w-full rounded-2xl border px-3 py-2 text-left transition-colors",b?"border-cyan-300/40 bg-cyan-300/10 text-white":"border-transparent text-slate-300 hover:border-white/10 hover:bg-white/[0.04]"),children:[(0,d.jsxs)("span",{className:"flex min-w-0 items-center gap-2",children:["json"===a.language?(0,d.jsx)(p.A,{className:"h-3.5 w-3.5 shrink-0 text-cyan-200"}):(0,d.jsx)(n.A,{className:"h-3.5 w-3.5 shrink-0 text-slate-300"}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate text-xs font-medium",children:a.label}),(0,d.jsx)(q.E,{variant:"muted",className:"rounded-full px-1.5 py-0 text-[10px]",children:w[a.category]}),!a.exists&&a.createable?(0,d.jsx)(q.E,{variant:"muted",className:"rounded-full px-1.5 py-0 text-[10px]",children:"Create"}):null]}),(0,d.jsx)("span",{className:"mt-1 block truncate text-[10px] text-slate-500",children:a.path})]})}function D(a){return/^agents\/[^/]+\/PROFILE\.md$/.test(a.path)}function E(a){return"HEARTBEAT.md"===a.path||a.path.endsWith("/HEARTBEAT.md")}function F(a,b){let c=/^agents\/([^/]+)\/PROFILE\.md$/.exec(a.path);if(c?.[1]&&b.some(a=>a.id===c[1]))return c[1];let d=/^\.openclaw\/agents\/([^/]+)\/agent\//.exec(a.path);if(d?.[1]&&b.some(a=>a.id===d[1]))return d[1];let e=b.find(b=>{var c;return a.path===`skills/${c=b.id,`agent-policy-${c.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,64)||"agent"}`}/SKILL.md`});return e?.id??null}function G(a){return a<1024?`${a} B`:`${Math.round(a/1024)} KB`}},5813:(a,b,c)=>{"use strict";c.d(b,{E:()=>h});var d=c(3814);c(6247);var e=c(9082),f=c(32905);let g=(0,e.F)("inline-flex items-center rounded-full border px-2.5 py-0.5 text-[11px] font-medium tracking-[0.14em] uppercase transition-colors",{variants:{variant:{default:"border-cyan-400/30 bg-cyan-400/10 text-cyan-200",muted:"border-white/10 bg-white/5 text-slate-300",success:"border-emerald-400/25 bg-emerald-400/10 text-emerald-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"}},defaultVariants:{variant:"default"}});function h({className:a,variant:b,...c}){return(0,d.jsx)("div",{className:(0,f.cn)(g({variant:b}),a),...c})}},8910:(a,b,c)=>{"use strict";c.d(b,{Xi:()=>j,av:()=>k,j7:()=>i,tU:()=>h});var d=c(3814),e=c(6247),f=c(97101),g=c(32905);let h=f.bL,i=e.forwardRef(({className:a,...b},c)=>(0,d.jsx)(f.B8,{ref:c,className:(0,g.cn)("inline-flex h-11 items-center rounded-2xl border border-white/10 bg-white/5 p-1 text-slate-400",a),...b}));i.displayName=f.B8.displayName;let j=e.forwardRef(({className:a,...b},c)=>(0,d.jsx)(f.l9,{ref:c,className:(0,g.cn)("inline-flex items-center justify-center whitespace-nowrap rounded-xl px-3 py-2 text-sm transition-all data-[state=active]:bg-white/10 data-[state=active]:text-white",a),...b}));j.displayName=f.l9.displayName;let k=e.forwardRef(({className:a,...b},c)=>(0,d.jsx)(f.UC,{ref:c,className:(0,g.cn)("mt-4 outline-none focus-visible:ring-0",a),...b}));k.displayName=f.UC.displayName},9494:(a,b,c)=>{"use strict";c.d(b,{A6:()=>e,I$:()=>g,MQ:()=>d,iq:()=>f});let d=[{value:"15m",label:"15 min"},{value:"30m",label:"30 min"},{value:"60m",label:"1 hour"},{value:"240m",label:"4 hours"}];function e(a){return"monitoring"===a?{enabled:!0,every:"30m"}:{enabled:!1,every:"30m"}}function f(a,b){let c=e(a),d="string"==typeof b?.every&&b.every.trim()&&"disabled"!==b.every?b.every.trim():c.every;return"boolean"==typeof b?.enabled?{enabled:b.enabled,every:d}:b?.every==="disabled"?{enabled:!1,every:d}:c}function g(a,b,c){let d=e(b);return a.enabled!==d.enabled||a.every!==d.every?a:e(c)}},12557:(a,b,c)=>{"use strict";function d(a){var b,c;let d,e;return(b=a,(d=b?.trim()??"")&&(/\bgateway\b[\s\S]*\btoken mismatch\b/i.test(d)||/\btoken mismatch\b[\s\S]*\bgateway\b/i.test(d)||/\bprovide gateway auth token\b/i.test(d)))?{apiAction:"generateLocalToken",cta:"Repair token",label:"Gateway token",detail:"Generate a fresh local Gateway token, restart the Gateway, then retry."}:(c=a,(e=c?.trim()??"")&&(/scope upgrade pending approval/i.test(e)||/pairing_pending/i.test(e)||/device token scope mismatch/i.test(e)||/connected_no_operator_scope/i.test(e)||/more scopes than currently approved/i.test(e)||/\bmissing scope:\s*operator\.(?:read|write|admin)\b/i.test(e)||/\bmissing operator\.(?:read|write|admin) scope\b/i.test(e)))?{apiAction:"repairDeviceAccess",cta:"Repair access",label:"Gateway access",detail:"Approve the local AgentOS device scope request, then retry."}:null}c.d(b,{Ek:()=>d})},13395:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,77990,23)),Promise.resolve().then(c.t.bind(c,82681,23)),Promise.resolve().then(c.t.bind(c,55585,23)),Promise.resolve().then(c.t.bind(c,36568,23)),Promise.resolve().then(c.t.bind(c,80040,23)),Promise.resolve().then(c.t.bind(c,15804,23)),Promise.resolve().then(c.t.bind(c,22125,23)),Promise.resolve().then(c.bind(c,90700))},14447:(a,b,c)=>{"use strict";c.d(b,{r:()=>r});var d=c(3814),e=c(6247),f=c(14847),g=c(29075),h=c(68123),i=c(11917),j=c(5813),k=c(80990),l=c(37674),m=c(49444),n=c(43081),o=c(60557),p=c(90665),q=c(32905);function r({open:a,agentId:b,snapshot:c,onOpenChange:v,onSnapshotChange:w,onRefresh:x,onOpenAddModels:y}){let z=b?c.agents.find(a=>a.id===b)??null:null,A=z?.modelId&&"unassigned"!==z.modelId?z.modelId:"",B=A?c.models.find(a=>a.id===A)??null:null,C=!!B&&s(B),[D,E]=(0,e.useState)(A),[F,G]=(0,e.useState)(""),[H,I]=(0,e.useState)(!1),[J,K]=(0,e.useState)(null);(0,e.useRef)(c);let L=(0,e.useMemo)(()=>{let a=F.trim().toLowerCase();return[...c.models].sort((a,b)=>{let c=!s(a);if(!s(b)!==c)return c?1:-1;let d=a.provider.localeCompare(b.provider);if(0!==d)return d;let e=a.name.localeCompare(b.name);return 0!==e?e:a.id.localeCompare(b.id)}).filter(b=>!a||`${b.name} ${b.id} ${b.provider} ${b.input} ${b.tags.join(" ")}`.toLowerCase().includes(a))},[F,c.models]),M=D?c.models.find(a=>a.id===D)??null:null,N=!!M&&s(M),O=!!D&&D!==A,P=c.models.filter(a=>s(a)).length,Q=B?u(B):A?"Unknown":"Default route",R=B?s(B)?B.local?"success":"default":"warning":A?"warning":"muted",S=async()=>{if(z&&M&&N&&O){I(!0),K(null);try{let a=await fetch("/api/agents",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:z.id,modelId:D})}),b=await a.json();if(!a.ok||b.error)throw Error(b.error||"Unable to update the agent model.");w?.(a=>(function(a,b,c){let d=a.agents.map(a=>a.id===b?{...a,modelId:c}:a),e=new Map;for(let a of d){let b=a.modelId?.trim();b&&"unassigned"!==b&&e.set(b,(e.get(b)??0)+1)}return{...a,agents:d,models:a.models.map(a=>({...a,usageCount:e.get(a.id)??0}))}})(a,z.id,D)),n.o.success("Agent model updated.",{description:M.name}),v(!1);let c=x?.();c&&c.catch(()=>void 0)}catch(b){let a=b instanceof Error?b.message:"Unable to update the agent model.";K(a),n.o.error(a)}finally{I(!1)}}};return z?(0,d.jsx)(l.lG,{open:a,onOpenChange:v,children:(0,d.jsxs)(l.Cf,{className:"flex h-[80dvh] max-h-[80dvh] w-[calc(100vw-16px)] max-w-[760px] flex-col gap-0 overflow-hidden p-0 sm:h-[min(80dvh,720px)] sm:max-h-[min(80dvh,720px)] sm:w-[min(760px,calc(100vw-40px))]",children:[(0,d.jsxs)(l.c7,{className:"shrink-0 border-b border-white/10 bg-[linear-gradient(180deg,rgba(12,18,31,0.96),rgba(9,13,24,0.98))] px-4 py-3.5 pr-10",children:[(0,d.jsx)(l.L3,{className:"text-[1.05rem]",children:"Change model"}),(0,d.jsx)(l.rr,{className:"max-w-[520px] text-[11px] leading-[1rem] text-slate-400",children:"Pick a model already available in AgentOS, or add more models if the right one is not listed yet."})]}),(0,d.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain",children:(0,d.jsxs)("div",{className:"space-y-4 px-3 py-3 sm:px-4 sm:py-4",children:[(0,d.jsxs)("div",{className:"rounded-[20px] border border-white/10 bg-[linear-gradient(180deg,rgba(13,20,34,0.94),rgba(9,13,24,0.96))] p-3",children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"font-display text-[0.84rem] text-white",children:(0,p.CK)(z)}),(0,d.jsx)("p",{className:"mt-1 text-[9px] leading-[0.95rem] text-slate-400",children:z.id})]}),(0,d.jsx)(j.E,{variant:R,className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:Q})]}),(0,d.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[(0,d.jsx)(j.E,{variant:B?C?"default":B.missing?"danger":"warning":"muted",className:"max-w-full truncate px-2 py-0.5 text-[9px] tracking-[0.12em]",children:B?.name||A||"OpenClaw default"}),(0,d.jsx)("p",{className:"text-[11px] leading-5 text-slate-400",children:B?`${(0,o.S)(B.provider)} \xb7 ${(0,p.FO)(B.contextWindow)} ctx`:A?"Model metadata unavailable.":"No model is assigned yet."})]}),B&&!C?(0,d.jsx)("p",{className:"mt-2 text-[11px] leading-5 text-amber-100/85",children:t(B)}):null]}),(0,d.jsxs)("div",{className:"rounded-[20px] border border-white/10 bg-[linear-gradient(180deg,rgba(11,18,32,0.96),rgba(6,10,18,0.98))] p-3",children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"font-display text-[0.84rem] text-white",children:"Available models"}),(0,d.jsx)("p",{className:"mt-1 text-[9px] leading-[0.95rem] text-slate-400",children:"Select one of the models currently known to this workspace."})]}),(0,d.jsxs)(j.E,{variant:"muted",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:[P," ready"]})]}),(0,d.jsxs)("div",{className:"relative mt-2.5",children:[(0,d.jsx)(f.A,{className:"pointer-events-none absolute left-3 top-1/2 h-3 w-3 -translate-y-1/2 text-slate-500"}),(0,d.jsx)(m.p,{value:F,onChange:a=>G(a.target.value),placeholder:"Search models",className:"h-8 pl-8 text-[11px]"})]}),(0,d.jsx)("div",{className:"mt-3 max-h-[min(36vh,300px)] space-y-1 overflow-y-auto pr-1",children:L.length>0?L.map(a=>{var b;let c=D===a.id,e=s(a);return(0,d.jsxs)("button",{type:"button",disabled:!e,"aria-pressed":c,onClick:()=>{e&&E(a.id)},className:(0,q.cn)("flex w-full items-start justify-between gap-2 rounded-[14px] border px-2.5 py-2 text-left transition-all",c?"border-cyan-300/35 bg-cyan-300/[0.08]":"border-white/8 bg-white/[0.03] hover:border-white/16 hover:bg-white/[0.05]",!e&&"cursor-not-allowed opacity-70"),children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-start gap-2",children:[(0,d.jsx)("div",{className:(0,q.cn)("mt-0.5 flex h-[16px] w-[16px] shrink-0 items-center justify-center rounded-md border",c?"border-cyan-300/50 bg-cyan-300/15 text-cyan-100":"border-white/12 bg-white/[0.03] text-transparent",!e&&"border-white/10 bg-white/[0.02] text-slate-500"),children:c?(0,d.jsx)(g.A,{className:"h-2 w-2"}):null}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"truncate text-[11px] font-medium text-white",children:a.name}),(0,d.jsx)("p",{className:"mt-0.5 truncate text-[9px] uppercase tracking-[0.16em] text-slate-500",children:(0,p.JZ)(a.id)}),(0,d.jsxs)("div",{className:"mt-1 flex flex-wrap gap-1.5 text-[9px] text-slate-400",children:[(0,d.jsx)("span",{children:(0,o.S)(a.provider)}),a.input?(0,d.jsx)("span",{children:a.input}):null,a.contextWindow?(0,d.jsxs)("span",{children:[Intl.NumberFormat().format(a.contextWindow)," ctx"]}):null]}),e?null:(0,d.jsx)("p",{className:"mt-1 text-[9px] leading-4 text-amber-100/85",children:t(a)})]})]}),(0,d.jsx)("div",{className:"shrink-0",children:(0,d.jsx)(j.E,{variant:(b=a).missing?"danger":!1===b.available?"warning":b.local?"success":"muted",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:u(a)})})]},a.id)}):(0,d.jsx)("div",{className:"rounded-[16px] border border-dashed border-white/10 bg-white/[0.03] px-3 py-5 text-center text-[11px] text-slate-400",children:F.trim()?"No models matched this search.":"No usable models are available yet. Add models to connect a provider or discover local routes."})})]}),(0,d.jsxs)("div",{className:"rounded-[16px] border border-white/10 bg-white/[0.03] p-3",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-slate-500",children:"Selection"}),(0,d.jsxs)("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[(0,d.jsx)(j.E,{variant:N?"default":"muted",className:"max-w-full truncate px-2 py-0.5 text-[9px] tracking-[0.12em]",children:M?.name||D||"No model selected"}),(0,d.jsx)("p",{className:"text-[11px] leading-5 text-slate-400",children:M?N?`${(0,o.S)(M.provider)} \xb7 ${(0,p.FO)(M.contextWindow)} ctx`:t(M):"Pick a model above, then save the assignment."})]})]}),J?(0,d.jsx)("div",{className:"rounded-[16px] border border-rose-400/20 bg-rose-400/[0.08] px-3 py-2 text-[11px] text-rose-100",children:J}):null]})}),(0,d.jsx)("div",{className:"shrink-0 border-t border-white/[0.08] px-4 py-3",children:(0,d.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,d.jsxs)(k.$,{type:"button",variant:"secondary",className:"h-8 rounded-full px-3 text-[10px]",disabled:H,onClick:()=>{y(null),v(!1)},children:[(0,d.jsx)(h.A,{className:"mr-1.5 h-3 w-3"}),"Add models"]}),(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,d.jsx)(k.$,{type:"button",variant:"secondary",className:"h-8 rounded-full px-3 text-[10px]",disabled:H,onClick:()=>v(!1),children:"Cancel"}),(0,d.jsxs)(k.$,{type:"button",className:"h-8 rounded-full px-3 text-[10px]",disabled:H||!O||!N,onClick:()=>{S()},children:[H?(0,d.jsx)(i.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):null,"Save model"]})]})]})})]})}):null}function s(a){return!a.missing&&!1!==a.available}function t(a){let b=(0,o.a3)(a.provider)?(0,o.W2)(a.provider):null;return a.missing?b?.connectKind==="local"?`${b.shortLabel} is installed, but this model is not pulled locally yet.`:b?`${b.shortLabel} does not have this model available yet. Open Add Models > Providers to connect or refresh it.`:"This model is not available yet.":!1===a.available?b?.connectKind==="apiKey"?`Connect your ${b.shortLabel} API key in Add Models > Providers to use this model.`:b?.connectKind==="oauth"?`Connect your ${b.shortLabel} account in Add Models > Providers to use this model.`:b?.connectKind==="local"?"Pull this model locally with Ollama, then refresh the list.":b?`Open Add Models > Providers to finish setup for ${b.shortLabel}.`:"Open Add Models > Providers to finish setup.":"This model is not ready for assignment."}function u(a){return a.missing?"Missing":!1===a.available?"Unavailable":a.local?"Local":"Remote"}},14890:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>m,metadata:()=>l,viewport:()=>k});var d=c(30248),e=c(927);c(63381);let f="AgentOS | Control Plane",g="Human Control Layer for AI Agents and Companies | Built on OpenClaw.",h="/readme/readme.jpeg",i=process.env.NEXT_PUBLIC_SITE_URL??process.env.VERCEL_URL,j=new URL(i?i.startsWith("http")?i:`https://${i}`:"http://localhost:3000"),k={themeColor:"#09101c"},l={metadataBase:j,title:f,description:g,applicationName:"AgentOS | Control Plane",manifest:"/site.webmanifest",openGraph:{type:"website",siteName:"AgentOS | Control Plane",title:f,description:g,images:[{url:h,width:1536,height:1024,alt:"AgentOS control-plane interface"}]},twitter:{card:"summary_large_image",title:f,description:g,images:[h]},icons:{icon:[{url:"/favicon.ico",sizes:"any"},{url:"/favicon-16x16.png",sizes:"16x16",type:"image/png"},{url:"/favicon-32x32.png",sizes:"32x32",type:"image/png"}],apple:[{url:"/apple-touch-icon.png",sizes:"180x180",type:"image/png"}],shortcut:["/favicon.ico"]}};function m({children:a}){return(0,d.jsx)("html",{lang:"en",className:"dark",suppressHydrationWarning:!0,children:(0,d.jsxs)("body",{children:[a,(0,d.jsx)(e.Toaster,{theme:"dark",richColors:!0,closeButton:!0})]})})}},23446:(a,b,c)=>{"use strict";c.d(b,{CP:()=>j,DK:()=>D,EE:()=>L,GU:()=>t,Id:()=>H,Ig:()=>s,Ku:()=>h,MG:()=>v,QO:()=>y,R:()=>n,SG:()=>i,SW:()=>B,Uh:()=>q,YI:()=>F,Zc:()=>u,_9:()=>J,cY:()=>A,hZ:()=>z,iy:()=>G,mr:()=>C,n:()=>K,oA:()=>E,oc:()=>r,sL:()=>o,ss:()=>p,to:()=>k,zr:()=>I});var d=c(90665),e=c(72349);let f="__all__",g="canvas-handoff";function h(a){return"running"===a?"Updating OpenClaw":"success"===a?"Update complete":"error"===a?"Update failed":"Update OpenClaw"}function i(a){return"running"===a?"OpenClaw is being updated now. Local gateway activity may pause briefly while the CLI is replaced.":"success"===a?"The CLI update finished. Review the result below, then close this panel when you are done.":"error"===a?"The update did not complete cleanly. Review the result and captured output before trying again.":"This runs openclaw update against the installed CLI and may briefly interrupt local gateway activity."}function j(a,b){return"success"===a?"light"===b?"border-emerald-300 bg-emerald-50/80 text-emerald-950":"border-emerald-300/25 bg-emerald-300/10 text-emerald-50":"light"===b?"border-rose-300 bg-rose-50/90 text-rose-950":"border-rose-300/25 bg-rose-300/10 text-rose-50"}function k(a,b){return"success"===a?"light"===b?"border-emerald-300 bg-white/80 text-emerald-700":"border-emerald-300/25 bg-emerald-300/10 text-emerald-200":"light"===b?"border-rose-300 bg-white/80 text-rose-700":"border-rose-300/25 bg-rose-300/10 text-rose-200"}function l(a){return!!(a&&/[\\/]\.openclaw([\\/]|$)/.test(a))}function m(a){return!!(a&&/[\\/]node_modules[\\/]/.test(a))}function n(a){let b=a.diagnostics.updateRoot?.trim()||null,c=a.diagnostics.updateInstallKind?.trim().toLowerCase()||null,e=a.diagnostics.updatePackageManager?.trim().toLowerCase()||null,f=function(a){let{root:b,installKind:c,packageManager:d}=a,e=d?.trim()||null;return"git"===c?"Git checkout":"package"===c?l(b)?e?`Local prefix \xb7 ${e}`:"Local prefix":(m(b),e?`${e} package`:"Package install"):l(b)?e?`Local prefix \xb7 ${e}`:"Local prefix":m(b)?e?`${e} package`:"Package install":e?`${e} package`:b?"Detected install":"Install unavailable"}({root:b,installKind:c,packageManager:e}),g=[];return b&&g.push(`Install root: ${(0,d.$7)(b)}`),e&&g.push(`Updater: ${e}`),0===g.length&&g.push("Install root unavailable."),{label:f,detail:g.join(" \xb7 "),root:b}}function o(a){return a.mission?.trim()?a.mission.trim():a.title.trim()?a.title.trim():a.subtitle.trim()||"Continue this task."}function p(a){let b,c;if(b="string"==typeof a.metadata.dispatchStatus?a.metadata.dispatchStatus:null,c=a.status,"cancelled"===b||"aborted"===b||"cancelled"===c||"aborted"===c)return!1;let d=a.status;return"running"===d||"queued"===d}function q(a,b){if(0===b.length)return a;let c=b.filter(b=>!r(a.tasks,b)).map(a=>a.task);return 0===c.length?a:{...a,tasks:[...c,...a.tasks]}}function r(a,b){return a.find(a=>{var c,d;let e;return c=a,d=b,!!(e=d.dispatchId?.trim())&&(c.dispatchId===e||c.key===`dispatch:${e}`)})??null}function s(a,b){let c=new Date(a.submittedAt).toISOString(),e=b.agents.find(b=>b.id===a.agentId),f={id:`optimistic:${a.requestId}:submitted`,kind:"user",timestamp:c,title:"Mission submitted",detail:x(a.mission,220),agentId:a.agentId};return{requestId:a.requestId,dispatchId:null,task:{id:`optimistic-task:${a.requestId}`,key:`optimistic:${a.requestId}`,title:x(a.mission,86),mission:a.mission,subtitle:"Sending mission to AgentOS. Waiting for a dispatch id.",status:"queued",updatedAt:a.submittedAt,ageMs:0,workspaceId:a.workspaceId??void 0,primaryAgentId:a.agentId,primaryAgentName:(0,d.CK)(e??{name:"OpenClaw"}),runtimeIds:[],agentIds:[a.agentId],sessionIds:[],runIds:[],runtimeCount:0,updateCount:0,liveRunCount:0,artifactCount:0,warningCount:0,metadata:{optimistic:!0,optimisticRequestId:a.requestId,bootstrapStage:"submitting",dispatchSubmittedAt:c,optimisticEvents:[f]}}}}function t(a,b){let c,d=(Array.isArray(c=a.metadata.optimisticEvents)?c.filter(w):[]).concat(b.feedEvent);return{...a,dispatchId:b.dispatchId??a.dispatchId,status:b.status,subtitle:b.subtitle,updatedAt:Date.now(),liveRunCount:+("stalled"!==b.status&&"cancelled"!==b.status),warningCount:"stalled"===b.status||"cancelled"===b.status?1:a.warningCount,metadata:{...a.metadata,bootstrapStage:b.bootstrapStage,optimisticEvents:function(a){let b=new Map;for(let c of a)b.set(c.id,c);return[...b.values()].sort((a,b)=>Date.parse(a.timestamp)-Date.parse(b.timestamp))}(d)}}}function u(a,b,c,d){let e=Array.isArray(b)?b:[],f=Array.isArray(c)?c:[];return!(Array.isArray(d)?d:[]).includes(a.key)&&(!!f.includes(a.key)||0!==a.runtimeIds.length&&a.runtimeIds.every(a=>e.includes(a)))}function v(a){return"string"==typeof a.metadata.kind&&"direct"===a.metadata.kind}function w(a){return"object"==typeof a&&null!==a&&"string"==typeof a.id&&"string"==typeof a.kind&&"string"==typeof a.timestamp&&"string"==typeof a.title&&"string"==typeof a.detail}function x(a,b){let c=a.replace(/\s+/g," ").trim();return c.length<=b?c:`${c.slice(0,Math.max(b-1,1)).trimEnd()}…`}function y(a){return(a.diagnostics.configuredGatewayUrl||a.diagnostics.gatewayUrl).replace(/\/$/,"")}function z(a){return(0,d.$7)(a.diagnostics.configuredWorkspaceRoot||a.diagnostics.workspaceRoot)}function A(a){return`mission-control-active-workspace-id:${a}`}function B(a){return a??f}function C(a,b,c=null){return b===f?null:b&&a.includes(b)?b:c&&a.includes(c)?c:a[0]??null}function D(a){return"fallback"===a.mode&&a.diagnostics.loaded&&!a.diagnostics.rpcOk}function E(a){return"refresh"===a?"refreshing":"discover"===a?"discovering":"set-default"===a?"configuring-default":"detecting"}function F(a){return"discover"===a?{statusMessage:"Scanning models...",successTitle:"Models discovered.",errorTitle:"Model discovery failed."}:"login-provider"===a?{statusMessage:"Checking auth...",successTitle:"Provider connected.",errorTitle:"Provider auth needs attention."}:"refresh"===a?{statusMessage:"Refreshing...",successTitle:"Model setup refreshed.",errorTitle:"Model refresh failed."}:"set-default"===a?{statusMessage:"Saving default model...",successTitle:"Default model saved.",errorTitle:"Default model save failed."}:{statusMessage:"Checking models...",successTitle:"Model setup ready.",errorTitle:"Model setup failed."}}function G(a){return a.diagnostics.installed?(0,e.h6)(a)?H(a)?{label:"Enter AgentOS",description:"OpenClaw is online. Runtime checks continue in the background."}:{label:"Continue setup",description:"Create the first AgentOS workspace and agent before entering the canvas."}:a.diagnostics.loaded?(!a.diagnostics.rpcOk,{label:"Start OpenClaw",description:"Start the local gateway and wait for RPC."}):{label:"Prepare local gateway",description:"Register and start the local gateway."}:{label:"Install OpenClaw",description:"Download the CLI and get AgentOS ready."}}function H(a){return(a.workspaces?.length??0)>0&&(a.agents?.length??0)>0}function I(a,b){let c=b?a.workspaces.find(a=>a.id===b.workspaceId)??null:a.workspaces[0]??null,d=c?a.agents.filter(a=>a.workspaceId===c.id):[],e=new Set(b?.agentIds?.filter(Boolean)??c?.agentIds?.filter(Boolean)??[]),f=e.size>0?d.filter(a=>e.has(a.id)).length:d.length,g=Math.max(e.size,+(d.length>0)),h=b?.primaryAgentId?d.some(a=>a.id===b.primaryAgentId):d.length>0,i=e.size>0?f>=e.size:d.length>0,j=!!c;return{workspaceVisible:j,primaryAgentVisible:h,agentsVisible:i,ready:j&&h&&i,workspaceName:c?.name??null,workspacePath:c?.path??null,visibleAgentCount:f,expectedAgentCount:g}}function J(a){return a.workspaceVisible?a.primaryAgentVisible?a.agentsVisible?"Workspace and starter agent are visible. Opening the AgentOS canvas.":`Starter agent is visible. Waiting for ${Math.max(1,a.expectedAgentCount-a.visibleAgentCount)} workspace agent${a.expectedAgentCount-a.visibleAgentCount==1?"":"s"} to sync.`:"Workspace shell is visible. Waiting for the starter agent to appear on the canvas.":"Waiting for the workspace shell to appear in the AgentOS snapshot."}function K(a){var b;let c="ready"===a.state||"error"===a.state?100:a.readiness.primaryAgentVisible?82:a.readiness.workspaceVisible?58:34,d="ready"===a.state?"done":"error"===a.state?"error":"active",e=[...(a.progress?.steps??[]).filter(a=>a.id!==g).map(a=>({...a,status:"done",percent:100})),{id:g,label:"Opening workspace canvas",description:"AgentOS is refreshing the graph and waiting for the starter agent before leaving setup.",status:d,percent:c,detail:a.errorDetail??J(a.readiness),activities:[{id:"handoff-workspace",message:a.readiness.workspaceVisible?"Workspace shell is visible in AgentOS.":"Waiting for workspace shell in AgentOS.",status:a.readiness.workspaceVisible?"done":d},{id:"handoff-agent",message:a.readiness.primaryAgentVisible?"Starter agent is visible on the canvas.":"Waiting for the starter agent card.",status:a.readiness.primaryAgentVisible?"done":a.readiness.workspaceVisible?d:"pending"},{id:"handoff-open",message:"ready"===a.state?"Opening the workspace.":"error"===a.state?"Canvas handoff needs attention.":"Keeping setup open until the graph is usable.",status:"ready"===a.state?"done":"error"===a.state?"error":"pending"}]}];return{title:"error"===a.state?"Workspace setup needs attention":"Opening workspace",description:"ready"===a.state?"The workspace and starter agent are ready on the canvas.":"AgentOS is waiting for OpenClaw state to sync before showing the canvas.",percent:0===(b=e).length?0:Math.round(b.reduce((a,b)=>a+b.percent,0)/b.length),steps:e}}function L(a,b={}){var c;let d;if(!(0,e.h6)(a))return!1;return!!b.hasSeenMissionReady||!!b.modelSwitchSucceeded||(d=a.diagnostics.modelReadiness.resolvedDefaultModel||a.diagnostics.modelReadiness.defaultModel||null,H(a)&&(!!d||!!(c=a).agents.map(a=>{var b;let c;return b=a.modelId,(c=b?.trim())&&"unassigned"!==c?c:null}).find(a=>{var b,d;let e;return a&&(b=c,d=a,!!(e=b.models.find(a=>a.id===d))&&!0!==e.missing&&!1!==e.available)})))}},29849:(a,b,c)=>{"use strict";c.d(b,{d:()=>I});var d=c(3814),e=c(6247),f=c(49113),g=c(11917),h=c(74234),i=c(84086),j=c(80990),k=c(74952),l=c(43081);function m(a){return`mission-control-agent-chat:v1:${a}`}function n(a){return"object"==typeof a&&null!==a&&("user"===a.role||"assistant"===a.role||"system"===a.role)&&"string"==typeof a.id&&"string"==typeof a.text&&"number"==typeof a.createdAt&&(void 0===a.errorMessage||null===a.errorMessage||"string"==typeof a.errorMessage)&&(void 0===a.status||"sending"===a.status||"sent"===a.status||"error"===a.status)}function o(a){try{let b=globalThis.localStorage?.getItem(m(a));if(!b)return[];let c=JSON.parse(b);if(!Array.isArray(c))return[];return c.filter(n).slice(-60)}catch{return[]}}function p(a,b){try{globalThis.localStorage?.setItem(m(a),JSON.stringify(b.slice(-60)))}catch{}}var q=c(30094);function r(a){let b=a.toLowerCase();return(b.includes("couldn't recover")||b.includes("couldn’t recover"))&&b.includes("prior")&&b.includes("context")||b.includes("no prior transcript")&&b.includes("memory")||b.includes("send me")&&b.includes("last goal")&&b.includes("file")||b.includes("can't continue")&&b.includes("recoverable task context")||b.includes("can’t continue")&&b.includes("recoverable task context")||b.includes("checked")&&b.includes("workspace files")&&b.includes("recent session metadata")||b.includes("task state")&&b.includes("resume")||b.includes("failed attempt")&&b.includes("last task")&&b.includes("error")||b.includes("workspace")&&b.includes("memory")&&b.includes("session metadata")&&(b.includes("resume")||b.includes("continue"))}function s(a){let b=a.toLowerCase();return/\b(name|ad[ıi]n|ismin|called)\b/.test(b)&&/\b(age|old|ya[sş][ıi]n|kaç yaş)\b/.test(b)||/\b(who are you|kimsin)\b/.test(b)}let t="mission-control-action";function u(a){return function(a){if(!a)return"";let b=a.toLowerCase(),c=`<${t}>`,d=`</${t}>`,e=b.lastIndexOf(c),f=b.lastIndexOf(d);return e>=0&&e>f?a.slice(0,e).trim():a}(function(a){if("string"!=typeof a||!a.trim())return{action:null,cleanText:""};let b=RegExp(`<${t}>\\s*([\\s\\S]*?)\\s*<\\/${t}>`,"gi"),c=null,d=a.replace(b,(a,b)=>(c||(c=function(a){try{let b=JSON.parse(a);if("rename_agent"!==b.type)return null;let c=function(a){if("string"!=typeof a)return null;let b=a.trim().replace(/^["'`“”‘’]+|["'`“”‘’]+$/g,"").trim();return b.length>0?b:null}(b.name);if(!c)return null;return{type:"rename_agent",name:c}}catch{return null}}(b)),"")).replace(/\n{3,}/g,"\n\n").trim();return{action:c,cleanText:d}}("string"!=typeof a?"":function(a){if(!v(a))return a;let b=Math.max(a.lastIndexOf("\nOperator:"),a.startsWith("Operator:")?0:-1),c=(b>=0?a.slice(b):a).match(/\n(?:Agent|Assistant):\s*([\s\S]+)$/i),d=c?.[1]?.trim()??"";return d&&!v(d)?d:""}(function(a){if(!a||!/^\[thinking\]\b/i.test(a))return a;let b=a.split(/\n{2,}/).map(a=>a.trim()).filter(Boolean);return b.length<=2?"":b.slice(2).join("\n\n").trim()}(a.trim()))).cleanText)}function v(a){return/^You are chatting directly with the operator inside AgentOS\./i.test(a)||/You are chatting directly with the operator inside AgentOS\./i.test(a)&&/Do not create tasks or mention task cards\./i.test(a)||/Use the workspace root `AGENTS\.md` file as the source of truth/i.test(a)&&/Direct chat mode takes priority over workspace operating docs/i.test(a)}let w=new Map;function x({agentId:a,agentName:b,text:c,onRefresh:d,onSnapshotChange:e,onError:f}){let g=c.trim();if(!g)return Promise.resolve();let h=w.get(a);if(h)return h.promise;let i=Date.now(),j=globalThis.crypto?.randomUUID?.()||`user:${i}`,k=globalThis.crypto?.randomUUID?.()||`assistant:${i}`,l=o(a),m={userMessageId:j,assistantMessageId:k,statusMessage:"Starting agent turn...",promise:Promise.resolve()};w.set(a,m),p(a,[...l,{id:j,role:"user",text:g,createdAt:i,status:"sending"},{id:k,role:"assistant",text:"",createdAt:i+1,status:"sending"}].slice(-60));let n=l.filter(a=>("user"===a.role||"assistant"===a.role)&&"error"!==a.status&&a.text.trim().length>0).slice(-16).map(a=>({role:a.role,text:a.text})),q=new Set(n.filter(a=>"assistant"===a.role).map(a=>A(a.text)).filter(Boolean));return m.promise=y({agentId:a,payload:{message:g,rawMessage:g,history:n,thinking:"low"},agentName:b,userMessageId:j,assistantMessageId:k,previousAssistantTexts:q,run:m,onRefresh:d,onSnapshotChange:e,onError:f}),m.promise}async function y({agentId:a,payload:b,agentName:c,userMessageId:d,assistantMessageId:e,previousAssistantTexts:f,run:g,onRefresh:h,onSnapshotChange:i,onError:j}){let k="",l=!1;try{let j=await fetch(`/api/agents/${encodeURIComponent(a)}/chat`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)}),m=j.headers.get("content-type")||"";if(!j.ok||!m.includes("application/x-ndjson")){let a=await j.json().catch(()=>null);throw Error(a?.error||"OpenClaw rejected the message.")}z(a,a=>a.map(a=>a.id===d?{...a,status:"sent"}:a));let n=null;if(await (0,q.z)(j,async j=>{var m;if("status"===j.type){g.statusMessage=j.message;return}if("assistant"===j.type){let c=u(j.text),h=A(c),i=s(b.rawMessage)&&r(c);if(!c){g.statusMessage="Agent is thinking...";return}if(i||!l&&h&&f.has(h)){g.statusMessage="Agent is drafting a reply...";return}l=!0,k=c,g.statusMessage="Agent is drafting a reply...",z(a,a=>a.map(a=>a.id===d?{...a,status:"sent"}:a.id===e?{...a,text:c,status:"sending"}:a));return}if(!j.ok)throw Error(j.message);n=j.response??null;let o=function(a,b,c){return s(c)&&r(a)?`My name is ${b}. I do not have a real age; I am an AI agent running inside AgentOS.`:a}(n?(m=n).payloads.map(a=>u(a.text)).filter(Boolean).join("\n\n")||u(m.summary):k,c,b.rawMessage);n&&(k=o),z(a,a=>a.map(a=>a.id===d?{...a,status:"sent"}:a.id===e?{...a,text:o,status:"sent",runId:n?.runId??a.runId}:a));let p=n?function(a){let b=a?.missionControlAction;if(!b||"object"!=typeof b||"rename_agent"!==b.type||!0!==b.applied||"string"!=typeof b.name)return null;let c=b.name.trim();return c.length>0?c:null}(n.meta):null;p&&i&&i(b=>{var c,d,e;return c=b,d=a,e=p,{...c,agents:c.agents.map(a=>a.id===d?{...a,name:e,identityName:e}:a),tasks:c.tasks.map(a=>a.primaryAgentId===d?{...a,primaryAgentName:e}:a)}}),h?.().catch(()=>null)}),!n)throw Error("OpenClaw completed without returning a response.")}catch(f){let b=f instanceof Error?f.message:"Unknown send error.",c=l?k.trim():"";z(a,a=>a.map(a=>a.id===d?{...a,status:"error",errorMessage:b}:a.id===e&&c.length>0?{...a,text:c,status:"error",errorMessage:b}:a).filter(a=>a.id!==e||c.length>0)),j?.(b)}finally{w.delete(a)}}function z(a,b){p(a,b(o(a)).slice(-60))}function A(a){return a.replace(/\s+/g," ").trim()}var B=c(60557),C=c(12557),D=c(90665),E=c(32905);function F({surfaceTheme:a}){return(0,d.jsx)("span",{className:"inline-flex items-center gap-[3px] align-middle",children:[0,1,2].map(b=>(0,d.jsx)(i.P.span,{animate:{opacity:[.35,1,.35],y:[0,-1,0]},transition:{duration:1.1,repeat:1/0,delay:.14*b,ease:"easeInOut"},className:(0,E.cn)("h-1.5 w-1.5 rounded-full","light"===a?"bg-[#8f7263]":"bg-cyan-300")},b))})}function G({agentLabel:a,statusLabel:b,surfaceTheme:c}){return(0,d.jsxs)("div",{className:(0,E.cn)("flex min-w-0 items-center justify-between gap-3 text-[9px] uppercase tracking-[0.24em]","light"===c?"text-[#8b7262]":"text-slate-400"),children:[(0,d.jsx)("span",{className:"min-w-0 truncate",children:a}),b?(0,d.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1.5",children:[(0,d.jsx)("span",{children:b}),(0,d.jsx)(F,{surfaceTheme:c})]}):null]})}function H({statusMessage:a,expanded:b,onToggle:c,surfaceTheme:e}){var f;let g,h=function(a){let b,c=(b=a?.toLowerCase()??"").includes("finalizing")||b.includes("drafting")?"Shaping the reply before it appears here.":b.includes("thinking")?"Checking recent context before answering.":"Reading your message and preparing a reply.";return c.includes("Shaping")?["Shaping the reply","Preparing the final wording"]:c.includes("Checking")?["Reading your message","Checking recent context"]:["Reading your message","Preparing a reply"]}(a),j=(f=a,(g=f?.toLowerCase()??"").includes("finalizing")||g.includes("drafting")?["The agent has enough context to answer.","It is tightening the response before showing it here.","Raw reasoning stays hidden; only the final reply is saved."]:g.includes("thinking")?["The agent is reading the direct message.","It is checking recent chat and workspace context.","It will replace this activity card with the final reply."]:["The message was sent to the selected agent.","AgentOS is waiting for the first response signal.","This activity is temporary and is not saved to chat history."]);return(0,d.jsxs)("div",{className:(0,E.cn)("mt-2 overflow-hidden rounded-[14px] border px-3 py-2","light"===e?"border-[#e7d8cc] bg-[#fff7f1]/70":"border-cyan-300/10 bg-slate-950/24"),children:[(0,d.jsx)("div",{className:"space-y-1.5",children:h.map((a,b)=>(0,d.jsx)(i.P.div,{animate:{opacity:[.48,.92,.48]},transition:{duration:1.8,repeat:1/0,delay:.18*b,ease:"easeInOut"},className:(0,E.cn)("h-3.5 rounded-full","light"===e?"bg-[linear-gradient(90deg,rgba(139,114,98,0.16),rgba(139,114,98,0.34),rgba(139,114,98,0.14))]":"bg-[linear-gradient(90deg,rgba(125,211,252,0.10),rgba(125,211,252,0.27),rgba(125,211,252,0.08))]",0===b?"w-[72%]":"w-[54%]"),children:(0,d.jsx)("span",{className:(0,E.cn)("block truncate px-2 text-[10px] leading-3.5","light"===e?"text-[#7d6556]/78":"text-slate-300/72"),children:a})},a))}),(0,d.jsx)("div",{className:"mt-2 flex justify-end",children:(0,d.jsx)("button",{type:"button",onClick:c,className:(0,E.cn)("text-[8px] uppercase tracking-[0.18em] transition hover:opacity-80","light"===e?"text-[#8b7262]":"text-cyan-200/70"),children:b?"Hide details":"Show details"})}),b?(0,d.jsx)(i.P.ul,{initial:{opacity:0,y:-3},animate:{opacity:1,y:0},className:(0,E.cn)("mt-2 space-y-1 border-t pt-2 text-[11px] leading-4","light"===e?"border-[#e7d8cc] text-[#7d6556]":"border-white/[0.07] text-slate-400"),children:j.map(a=>(0,d.jsxs)("li",{className:"flex gap-2",children:[(0,d.jsx)("span",{className:(0,E.cn)("mt-[7px] h-1 w-1 shrink-0 rounded-full","light"===e?"bg-[#b28f78]":"bg-cyan-300/70")}),(0,d.jsx)("span",{children:a})]},a))}):null]})}function I({agent:a,surfaceTheme:b,isVisible:c,onRefresh:m,onSnapshotChange:n,onConnectModelProvider:o}){let[p,q]=(0,e.useState)(""),[r,s]=(0,e.useState)([]),[t,u]=(0,e.useState)(()=>{var b;let c;return b=a.id,{isRunning:!!(c=w.get(b)),userMessageId:c?.userMessageId??null,assistantMessageId:c?.assistantMessageId??null,statusMessage:c?.statusMessage??null}}),[v,y]=(0,e.useState)(null),[z,A]=(0,e.useState)({}),[F,J]=(0,e.useState)({}),[K,L]=(0,e.useState)(null),M=(0,e.useRef)(null),N=(0,e.useRef)(null),O=(0,e.useRef)(c),P=(0,D.CK)(a),Q=!!p.trim()&&!t.isRunning,R=t.assistantMessageId,S=r.length>0?r:[{id:"system:empty",role:"system",text:"Start a direct chat with this agent. Messages stay in this drawer and are stored locally in your browser.",createdAt:Date.now()}],T=async()=>{let b=p.trim();if(b&&!t.isRunning){q("");try{await x({agentId:a.id,agentName:P,text:b,onRefresh:m,onSnapshotChange:n,onError:a=>{l.o.error("Chat message failed.",{description:a})}})}finally{O.current&&requestAnimationFrame(()=>N.current?.focus())}}},U=async(b,c,d)=>{let e=c.trim();if(e&&!K&&!t.isRunning){L(b);try{let b=await fetch("/api/settings/gateway",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:d.apiAction})}),c=await b.json().catch(()=>null);if(!b.ok)throw Error(c?.error||"Gateway access could not be repaired.");if(c?.authStatus?.native&&!1===c.authStatus.native.ok)throw Error(c.authStatus.native.issue||"Gateway access still needs attention.");l.o.success(`${d.label} repaired.`,{description:"Retrying the chat message."}),await m?.().catch(()=>void 0),L(null),await x({agentId:a.id,agentName:P,text:e,onRefresh:m,onSnapshotChange:n,onError:a=>{l.o.error("Chat message failed.",{description:a})}})}catch(a){l.o.error("Gateway repair failed.",{description:a instanceof Error?a.message:"Unable to repair Gateway access."})}finally{L(null),O.current&&requestAnimationFrame(()=>N.current?.focus())}}};return(0,d.jsxs)("div",{className:(0,E.cn)("flex h-full min-h-0 flex-col overflow-hidden","light"===b?"text-[#4a382c]":"text-slate-200"),children:[(0,d.jsx)("div",{ref:M,className:(0,E.cn)("mission-scroll min-h-0 flex-1 overflow-y-auto overscroll-contain pr-1","light"===b?"text-[#4a382c]":"text-slate-200"),children:(0,d.jsx)("div",{className:"space-y-2.5",children:S.map(c=>{let e="user"===c.role,h="system"===c.role,k="assistant"===c.role,l=k&&c.id===R&&t.isRunning,m=l&&!c.text.trim(),n=k?z[c.id]:void 0,p=n??c.text,q=k&&!!n&&p!==c.text,r=l||q,s=m?"Thinking":r?"Replying":null,u="user"===c.role&&c.id===t.userMessageId&&t.isRunning,v="sending"===c.status&&u,w=c.errorMessage?.trim(),x=w?(0,C.Ek)(w):null,y=w&&!x?function(a,b){var c,d,e,f;let g,h,i=a?.trim()??"";if(!i||(c=i,!/\b(auth|authentication|authenticate|unauthorized|unauthorised|forbidden|expired|token|oauth|api[-\s]?key|credential|login|sign[ -]?in|reconnect|401|403)\b/i.test(c)))return null;let j=(g=(d=i).match(/\bmodels\s+auth\s+(?:login|paste-token)\b[\s\S]*?--provider(?:=|\s+)(["']?)([a-z0-9_-]+)\1/i)??d.match(/\b--provider(?:=|\s+)(["']?)([a-z0-9_-]+)\1/i),(0,B.d4)(g?.[2]??null)??function(a){if(/\bChatGPT\/Codex\b|\bChatGPT\b|\bCodex\b/i.test(a))return"openai-codex";let b=a.toLowerCase();for(let a of B.y8){let c=a.id.toLowerCase(),d=a.label.toLowerCase(),e=a.shortLabel.toLowerCase();if(b.includes(c)||b.includes(d)||b.includes(e))return a.id}return null}(i)??(e=b,f=i,(h=e?.split("/",1)[0]?.trim()??"")?"openai"===h&&/\bChatGPT\b|\bCodex\b/i.test(f)?"openai-codex":(0,B.d4)(h):null));if(!j)return null;let k=(0,B.S)(j);return{provider:j,label:k,detail:`Connect ${k}, then retry this chat message.`}}(w,a.modelId):null;return(0,d.jsx)("div",{className:(0,E.cn)("flex",e?"justify-end":"justify-start"),children:(0,d.jsxs)("div",{className:(0,E.cn)("min-w-0 max-w-[92%] rounded-[18px] border px-3 py-2 text-[13px] leading-5 shadow-[0_14px_34px_rgba(0,0,0,0.14)]",u&&"opacity-85",h?"light"===b?"border-[#e3d4c8] bg-[#fffaf6] text-[#6c5647]":"border-white/[0.08] bg-white/[0.03] text-slate-400":e?"light"===b?"border-[#e3d4c8] bg-[#fff3f6] text-[#4a382c]":"border-white/[0.08] bg-[linear-gradient(180deg,rgba(255,255,255,0.07),rgba(255,255,255,0.03))] text-slate-100":"light"===b?"border-[#e3d4c8] bg-[#fffaf6] text-[#4a382c]":"border-cyan-300/12 bg-[linear-gradient(180deg,rgba(34,211,238,0.10),rgba(59,130,246,0.06))] text-slate-100"),children:[m?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(G,{agentLabel:P,statusLabel:s,surfaceTheme:b}),(0,d.jsx)(H,{statusMessage:t.statusMessage,expanded:!!F[c.id],onToggle:()=>J(a=>({...a,[c.id]:!a[c.id]})),surfaceTheme:b})]}):(0,d.jsxs)(d.Fragment,{children:[k?(0,d.jsx)(G,{agentLabel:P,statusLabel:s,surfaceTheme:b}):null,(0,d.jsx)("p",{className:(0,E.cn)("whitespace-pre-wrap break-words [overflow-wrap:anywhere]",k&&"mt-1.5"),children:k?p:c.text}),r?(0,d.jsx)(i.P.span,{"aria-hidden":"true",animate:{opacity:[.2,1,.2]},transition:{duration:.9,repeat:1/0,ease:"easeInOut"},className:"ml-0.5 inline-block h-[1em] w-[1px] translate-y-[2px] bg-current"}):null]}),!m&&v?(0,d.jsx)("p",{className:(0,E.cn)("mt-1.5 text-[10px] uppercase tracking-[0.18em]","light"===b?"text-[#8b7262]":"text-slate-500"),children:e?"Sending…":"Drafting…"}):m||"error"!==c.status?null:(0,d.jsxs)("div",{className:"mt-1.5 space-y-1",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.18em] text-rose-300",children:"Failed to send"}),w?(0,d.jsx)("p",{className:(0,E.cn)("text-[11px] leading-4 [overflow-wrap:anywhere]","light"===b?"text-rose-700":"text-rose-200"),children:w}):null,y&&o?(0,d.jsxs)(j.$,{type:"button",variant:"secondary",size:"sm",onClick:()=>o(y.provider),className:(0,E.cn)("mt-1 h-8 rounded-full px-3 text-[11px]","light"===b?"border-rose-200 bg-white text-rose-800 hover:bg-rose-50":"border-rose-300/20 bg-rose-300/10 text-rose-100 hover:bg-rose-300/16"),children:[(0,d.jsx)(f.A,{className:"mr-1.5 h-3.5 w-3.5"}),"Connect ",y.label]}):null,x?(0,d.jsxs)(j.$,{type:"button",variant:"secondary",size:"sm",onClick:()=>void U(c.id,c.text,x),disabled:!!K||t.isRunning,title:x.detail,className:(0,E.cn)("mt-1 h-8 rounded-full px-3 text-[11px]","light"===b?"border-emerald-200 bg-white text-emerald-800 hover:bg-emerald-50":"border-emerald-300/20 bg-emerald-300/10 text-emerald-100 hover:bg-emerald-300/16"),children:[K===c.id?(0,d.jsx)(g.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):(0,d.jsx)(f.A,{className:"mr-1.5 h-3.5 w-3.5"}),x.cta]}):null]})]})},c.id)})})}),(0,d.jsxs)("div",{className:(0,E.cn)("mt-2 shrink-0 rounded-[18px] border p-3","light"===b?"border-[#e3d4c8] bg-[#fffaf6]":"border-white/[0.08] bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))]"),onPointerDown:a=>{let b=a.target;!b||b.closest("textarea")||b.closest("button")||N.current?.focus()},children:[(0,d.jsx)(k.T,{ref:N,value:p,onChange:a=>q(a.target.value),onKeyDown:async a=>{"Enter"!==a.key||a.shiftKey||a.nativeEvent.isComposing||(a.preventDefault(),await T())},placeholder:`Message to ${P}...`,className:(0,E.cn)("min-h-[60px] cursor-text resize-none border-0 bg-transparent px-3.5 py-2.5 text-[13px] leading-[1.5] shadow-none focus-visible:ring-0 focus-visible:ring-offset-0","light"===b?"text-[#3f2f24] placeholder:text-[#8f7664]":"text-white placeholder:text-slate-500")}),(0,d.jsx)("div",{className:"mt-1.5 flex items-center justify-end gap-1.5",children:(0,d.jsxs)(j.$,{disabled:!Q,className:(0,E.cn)("h-8 rounded-full px-3 shadow-none","light"===b?"bg-[#4a382c] text-[#fffaf6] hover:bg-[#3f2f24]":"bg-white text-slate-950 hover:bg-white/92"),onClick:T,children:[t.isRunning?(0,d.jsx)(g.A,{className:"mr-[5px] h-[13px] w-[13px] animate-spin"}):(0,d.jsx)(h.A,{className:"mr-[5px] h-[13px] w-[13px]"}),"Send"]})})]})]})}},30094:(a,b,c)=>{"use strict";async function d(a,b){if(!a.body)throw Error("The server did not return a readable stream.");let c=a.body.getReader(),d=new TextDecoder,e="";for(;;){let{value:a,done:f}=await c.read();if(f)break;let g=(e+=d.decode(a,{stream:!0})).indexOf("\n");for(;g>=0;){let a=e.slice(0,g).trim();e=e.slice(g+1),a&&await b(JSON.parse(a)),g=e.indexOf("\n")}}let f=e.trim();f&&await b(JSON.parse(f))}c.d(b,{z:()=>d})},30540:(a,b,c)=>{"use strict";c.d(b,{T:()=>e,j:()=>d});let d=[{name:"exec",description:"Run shell commands and manage background processes.",source:"OpenClaw built-in",category:"builtin"},{name:"process",description:"Run shell commands and manage background processes.",source:"OpenClaw built-in",category:"builtin"},{name:"bash",description:"Run shell commands and manage background processes.",source:"OpenClaw built-in",category:"builtin"},{name:"code_execution",description:"Run sandboxed remote Python analysis.",source:"OpenClaw built-in",category:"builtin"},{name:"browser",description:"Control a Chromium browser (navigate, click, screenshot).",source:"OpenClaw built-in",category:"builtin"},{name:"web_search",description:"Search the web and fetch search results.",source:"OpenClaw built-in",category:"builtin"},{name:"x_search",description:"Search X posts.",source:"OpenClaw built-in",category:"builtin"},{name:"web_fetch",description:"Fetch page content.",source:"OpenClaw built-in",category:"builtin"},{name:"read",description:"Read files in the workspace.",source:"OpenClaw built-in",category:"builtin"},{name:"write",description:"Write files in the workspace.",source:"OpenClaw built-in",category:"builtin"},{name:"edit",description:"Edit files in the workspace.",source:"OpenClaw built-in",category:"builtin"},{name:"apply_patch",description:"Apply structured multi-hunk patches.",source:"OpenClaw built-in",category:"builtin"},{name:"message",description:"Send messages across channels.",source:"OpenClaw built-in",category:"builtin"},{name:"canvas",description:"Drive node canvas workflows.",source:"OpenClaw built-in",category:"builtin"},{name:"nodes",description:"Discover and target paired devices.",source:"OpenClaw built-in",category:"builtin"},{name:"cron",description:"Manage scheduled jobs.",source:"OpenClaw built-in",category:"builtin"},{name:"gateway",description:"Inspect and restart gateway services.",source:"OpenClaw built-in",category:"builtin"},{name:"image",description:"Analyze images.",source:"OpenClaw built-in",category:"builtin"},{name:"image_generate",description:"Generate or edit images.",source:"OpenClaw built-in",category:"builtin"},{name:"sessions_list",description:"Session management and sub-agent discovery.",source:"OpenClaw built-in",category:"builtin"},{name:"sessions_history",description:"Session management and sub-agent discovery.",source:"OpenClaw built-in",category:"builtin"},{name:"sessions_send",description:"Session management and sub-agent discovery.",source:"OpenClaw built-in",category:"builtin"},{name:"sessions_spawn",description:"Session management and sub-agent discovery.",source:"OpenClaw built-in",category:"builtin"},{name:"sessions_yield",description:"Session management and sub-agent discovery.",source:"OpenClaw built-in",category:"builtin"},{name:"subagents",description:"Session management and sub-agent discovery.",source:"OpenClaw built-in",category:"builtin"},{name:"session_status",description:"Session management and sub-agent discovery.",source:"OpenClaw built-in",category:"builtin"},{name:"agents_list",description:"Session management and sub-agent discovery.",source:"OpenClaw built-in",category:"builtin"}],e=[{name:"group:runtime",description:"exec, bash, process, code_execution",source:"OpenClaw docs",category:"group"},{name:"group:fs",description:"read, write, edit, apply_patch",source:"OpenClaw docs",category:"group"},{name:"group:sessions",description:"sessions_list, sessions_history, sessions_send, sessions_spawn, sessions_yield, subagents, session_status",source:"OpenClaw docs",category:"group"},{name:"group:memory",description:"memory_search, memory_get",source:"OpenClaw docs",category:"group"},{name:"group:web",description:"web_search, x_search, web_fetch",source:"OpenClaw docs",category:"group"},{name:"group:ui",description:"browser, canvas",source:"OpenClaw docs",category:"group"},{name:"group:automation",description:"cron, gateway",source:"OpenClaw docs",category:"group"},{name:"group:messaging",description:"message",source:"OpenClaw docs",category:"group"},{name:"group:nodes",description:"nodes",source:"OpenClaw docs",category:"group"},{name:"group:openclaw",description:"All built-in OpenClaw tools (excludes plugin tools).",source:"OpenClaw docs",category:"group"}]},31210:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>e});var d=c(30248);function e(){return(0,d.jsx)("main",{className:"flex min-h-screen items-center justify-center bg-[#050816] px-6 text-white",children:(0,d.jsxs)("div",{className:"rounded-[24px] border border-white/10 bg-white/[0.03] px-8 py-10 text-center shadow-[0_24px_80px_rgba(0,0,0,0.35)] backdrop-blur-xl",children:[(0,d.jsx)("p",{className:"text-[11px] uppercase tracking-[0.32em] text-slate-500",children:"OpenClaw"}),(0,d.jsx)("h1",{className:"mt-3 font-display text-3xl",children:"Page not found"}),(0,d.jsx)("p",{className:"mt-3 max-w-md text-sm leading-6 text-slate-400",children:"The requested AgentOS route does not exist in this workspace."})]})})}},32905:(a,b,c)=>{"use strict";c.d(b,{cn:()=>f});var d=c(81938),e=c(53077);function f(...a){return(0,e.QP)((0,d.$)(a))}},34118:(a,b,c)=>{"use strict";c.d(b,{J:()=>j});var d=c(3814),e=c(6247),f=c(10011),g=c(9082),h=c(32905);let i=(0,g.F)("text-xs font-medium uppercase tracking-[0.18em] text-slate-400"),j=e.forwardRef(({className:a,...b},c)=>(0,d.jsx)(f.b,{ref:c,className:(0,h.cn)(i(),a),...b}));j.displayName=f.b.displayName},37674:(a,b,c)=>{"use strict";c.d(b,{Cf:()=>n,Es:()=>p,HM:()=>l,L3:()=>q,c7:()=>o,lG:()=>i,rr:()=>r,zM:()=>j});var d=c(3814),e=c(6247),f=c(58346),g=c(57531),h=c(32905);let i=f.bL,j=f.l9,k=f.ZL,l=f.bm,m=e.forwardRef(({className:a,...b},c)=>(0,d.jsx)(f.hJ,{ref:c,className:(0,h.cn)("fixed inset-0 z-50 bg-slate-950/75 backdrop-blur-md",a),...b}));m.displayName=f.hJ.displayName;let n=e.forwardRef(({className:a,children:b,overlayClassName:c,closeClassName:e,...i},j)=>(0,d.jsxs)(k,{children:[(0,d.jsx)(m,{className:c}),(0,d.jsxs)(f.UC,{ref:j,className:(0,h.cn)("fixed left-1/2 top-1/2 z-50 grid w-full max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 rounded-[28px] border border-white/10 bg-slate-950/90 p-6 shadow-panel backdrop-blur-xl duration-200",a),...i,children:[b,(0,d.jsxs)(f.bm,{className:(0,h.cn)("absolute right-4 top-4 rounded-full p-2 text-slate-400 transition-colors hover:bg-white/5 hover:text-white",e),children:[(0,d.jsx)(g.A,{className:"h-4 w-4"}),(0,d.jsx)("span",{className:"sr-only",children:"Close"})]})]})]}));n.displayName=f.UC.displayName;let o=({className:a,...b})=>(0,d.jsx)("div",{className:(0,h.cn)("flex flex-col space-y-2 text-left",a),...b}),p=({className:a,...b})=>(0,d.jsx)("div",{className:(0,h.cn)("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",a),...b}),q=e.forwardRef(({className:a,...b},c)=>(0,d.jsx)(f.hE,{ref:c,className:(0,h.cn)("font-display text-xl text-white",a),...b}));q.displayName=f.hE.displayName;let r=e.forwardRef(({className:a,...b},c)=>(0,d.jsx)(f.VY,{ref:c,className:(0,h.cn)("text-sm text-slate-400",a),...b}));r.displayName=f.VY.displayName},40299:(a,b,c)=>{"use strict";c.d(b,{rY:()=>f,yQ:()=>h,yp:()=>d});let d=[{provider:"telegram",label:"Telegram",kind:"chat",description:"Bot accounts, public groups, and delegated community routing.",iconKey:"siTelegram",accentColor:"#26A5E4",supportsProvisioning:!0,provisionFields:[{key:"token",label:"Bot token",placeholder:"123456:ABC...",inputType:"password",secret:!0,required:!0,section:"basic"}],supportsRouteDiscovery:!0,providerManagedByOpenClaw:!0},{provider:"discord",label:"Discord",kind:"chat",description:"Servers, channels, DMs, and thread-aware team routing.",iconKey:"siDiscord",accentColor:"#5865F2",supportsProvisioning:!0,provisionFields:[{key:"token",label:"Bot token",placeholder:"Discord bot token",inputType:"password",secret:!0,required:!0,section:"basic"}],supportsRouteDiscovery:!0,providerManagedByOpenClaw:!0},{provider:"slack",label:"Slack",kind:"chat",description:"Workspace apps, channels, and internal team handoffs.",iconKey:"siSlack",accentColor:"#4A154B",supportsProvisioning:!0,provisionFields:[{key:"botToken",label:"Bot token",placeholder:"xoxb-...",inputType:"password",secret:!0,required:!0,section:"basic"}],supportsRouteDiscovery:!1,providerManagedByOpenClaw:!0},{provider:"googlechat",label:"Google Chat",kind:"chat",description:"Spaces and enterprise chat surfaces backed by OpenClaw.",iconKey:"siGooglechat",accentColor:"#34A853",supportsProvisioning:!0,provisionFields:[{key:"webhookUrl",label:"Webhook URL",placeholder:"https://chat.googleapis.com/...",inputType:"url",secret:!0,required:!0,section:"basic"}],supportsRouteDiscovery:!1,providerManagedByOpenClaw:!0},{provider:"gmail",label:"Gmail",kind:"inbox",description:"Inbox ownership, draft/send workflows, and Gmail-triggered automations.",iconKey:"siGmail",accentColor:"#EA4335",supportsProvisioning:!0,provisionFields:[{key:"account",label:"Account email",placeholder:"agent@example.com",inputType:"text",required:!0,section:"basic"},{key:"project",label:"Project ID",placeholder:"openclaw-project",section:"basic"},{key:"label",label:"Label",placeholder:"inbox",section:"basic"},{key:"hookToken",label:"Hook token",placeholder:"shared-secret",inputType:"password",secret:!0,section:"basic"},{key:"hookUrl",label:"Hook URL",placeholder:"https://your-host.example/gmail-pubsub",inputType:"url",section:"advanced"},{key:"topic",label:"Topic",placeholder:"gmail-topic",section:"advanced"},{key:"subscription",label:"Subscription",placeholder:"gmail-subscription",section:"advanced"},{key:"pushToken",label:"Push token",placeholder:"push-secret",inputType:"password",secret:!0,section:"advanced"},{label:"Serve port",placeholder:"8788",key:"serve.port",inputType:"number",section:"advanced"},{key:"serve.bind",label:"Serve bind",placeholder:"127.0.0.1",section:"advanced"},{key:"serve.path",label:"Serve path",placeholder:"/",section:"advanced"},{key:"includeBody",label:"Include body",inputType:"checkbox",defaultValue:!0,section:"advanced"},{key:"maxBytes",label:"Max bytes",placeholder:"20000",inputType:"number",section:"advanced"},{key:"renewEveryMinutes",label:"Renew interval (minutes)",placeholder:"720",inputType:"number",section:"advanced"},{key:"tailscale.mode",label:"Tailscale mode",placeholder:"funnel",defaultValue:"funnel",inputType:"select",options:[{label:"Off",value:"off"},{label:"Serve",value:"serve"},{label:"Funnel",value:"funnel"}],helpText:"One of funnel, serve, or off.",section:"advanced"},{key:"tailscale.path",label:"Tailscale path",placeholder:"/gmail-pubsub",section:"advanced"},{key:"tailscale.target",label:"Tailscale target",placeholder:"http://127.0.0.1:8788/gmail-pubsub",inputType:"url",section:"advanced"},{key:"pushEndpoint",label:"Push endpoint",placeholder:"https://public.example/gmail-push",inputType:"url",section:"advanced"},{key:"model",label:"Model",placeholder:"openrouter/meta-llama/llama-3.3-70b-instruct:free",section:"advanced"},{key:"thinking",label:"Thinking",placeholder:"off",section:"advanced"}],supportsRouteDiscovery:!1,providerManagedByOpenClaw:!0},{provider:"email",label:"Email",kind:"inbox",description:"Generic email inboxes and send/read workflows exposed through OpenClaw.",iconKey:"siMaildotru",accentColor:"#0F172A",supportsProvisioning:!0,provisionFields:[{key:"address",label:"Address",placeholder:"inbox@example.com",inputType:"text",required:!0,section:"basic"},{key:"oauth",label:"OAuth config",placeholder:'{"clientId":"...","clientSecret":"..."}',inputType:"textarea",helpText:"Paste JSON or a provider-specific OAuth configuration blob.",section:"basic"},{key:"watch",label:"Watch",inputType:"checkbox",defaultValue:!0,section:"basic"},{key:"pubsub",label:"Pub/Sub",placeholder:"projects/project-id/topics/email-events",section:"basic"},{key:"imap.host",label:"IMAP host",placeholder:"imap.example.com",inputType:"text",section:"advanced"},{key:"imap.port",label:"IMAP port",placeholder:"993",inputType:"number",section:"advanced"},{key:"smtp.host",label:"SMTP host",placeholder:"smtp.example.com",inputType:"text",section:"advanced"},{key:"smtp.port",label:"SMTP port",placeholder:"587",inputType:"number",section:"advanced"},{key:"username",label:"Username",placeholder:"mailbox-user",inputType:"text",section:"advanced"},{key:"password",label:"Password",placeholder:"app password",inputType:"password",secret:!0,section:"advanced"}],supportsRouteDiscovery:!1,providerManagedByOpenClaw:!0},{provider:"webhook",label:"Webhook",kind:"trigger",description:"External event triggers delivered into OpenClaw automations.",iconKey:"siWebhook",accentColor:"#0EA5E9",supportsProvisioning:!0,provisionFields:[{key:"token",label:"Hook token",placeholder:"shared-secret",inputType:"password",secret:!0,required:!0,section:"basic"},{key:"path",label:"Path",placeholder:"/hooks",section:"basic"}],supportsRouteDiscovery:!1,providerManagedByOpenClaw:!0},{provider:"cron",label:"Cron",kind:"trigger",description:"Scheduled tasks and recurring automation entry points.",iconKey:"siClockify",accentColor:"#F59E0B",supportsProvisioning:!0,provisionFields:[{key:"webhookToken",label:"Webhook token",placeholder:"replace-with-dedicated-webhook-token",inputType:"password",secret:!0,required:!0,section:"basic"},{key:"sessionRetention",label:"Session retention",placeholder:"24h",section:"basic"},{key:"maxConcurrentRuns",label:"Max concurrent runs",placeholder:"1",inputType:"number",section:"basic"},{key:"store",label:"Store path",placeholder:"~/.openclaw/cron/jobs.json",section:"advanced"},{key:"runLog.maxBytes",label:"Run log max bytes",placeholder:"2mb",section:"advanced"},{key:"runLog.keepLines",label:"Run log keep lines",placeholder:"2000",inputType:"number",section:"advanced"}],supportsRouteDiscovery:!1,providerManagedByOpenClaw:!0}],e=new Map(d.map(a=>[a.provider,a]));function f(a){return e.get(a)??{provider:a,label:g(a),kind:"chat",description:"OpenClaw-managed integration surface.",supportsProvisioning:!1,provisionFields:[],supportsRouteDiscovery:!1,providerManagedByOpenClaw:!0}}function g(a){let b=e.get(a);return b?b.label:a.split(/[-_]/).filter(Boolean).map(a=>a.slice(0,1).toUpperCase()+a.slice(1)).join(" ")}function h(a){return[...a].sort((a,b)=>{let c=f(a.type),d=f(b.type);return c.kind!==d.kind?c.kind.localeCompare(d.kind):a.type!==b.type?g(a.type).localeCompare(g(b.type)):a.name.localeCompare(b.name)})}},42180:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,77990,23))},42974:(a,b,c)=>{"use strict";c.d(b,{_:()=>F});var d=c(3814),e=c(6247),f=c(11917),g=c(33500),h=c(36130),i=c(98773),j=c(68123),k=c(56815),l=c(73596),m=c(98036),n=c(40299),o=c(32905);function p({provider:a,className:b}){let c=(0,n.rY)(a),e=c.iconKey?m[c.iconKey]:void 0;return(0,d.jsx)("div",{className:(0,o.cn)("flex items-center justify-center rounded-full border border-white/12 bg-slate-950/72 text-white shadow-[0_8px_18px_rgba(0,0,0,0.28)] backdrop-blur-xl",b),"aria-hidden":"true",children:e?(0,d.jsx)("svg",{viewBox:"0 0 24 24",className:"h-[58%] w-[58%] select-none",fill:c.accentColor||`#${e.hex}`,children:(0,d.jsx)("path",{d:e.path})}):(0,d.jsx)("span",{className:"text-[10px] font-semibold uppercase tracking-[0.16em] text-white/88",children:c.label.slice(0,1)})})}var q=c(5813),r=c(80990),s=c(37674),t=c(49444),u=c(34118),v=c(8910),w=c(74952),x=c(43081),y=c(45084);function z(a,b){let c=a[b];return"string"==typeof c?c:""}function A(a){let b={name:""};for(let c of a.provisionFields){if("boolean"==typeof c.defaultValue||"string"==typeof c.defaultValue){b[c.key]=c.defaultValue;continue}b[c.key]="checkbox"!==c.inputType&&""}return b}function B(a,b){let c={};for(let d of a){let a,e=b[d.key];if("checkbox"===d.inputType)a=!!e;else if("number"===d.inputType){let b="string"==typeof e?Number(e.trim()):Number(e);if(!Number.isFinite(b))continue;a=b}else{if("string"!=typeof e)continue;let b=e.trim();if(0===b.length)continue;a=function(a){if(a.startsWith("{")&&a.endsWith("}")||a.startsWith("[")&&a.endsWith("]"))try{return JSON.parse(a)}catch{}return a}(b)}!function(a,b,c){let d=b.split(".").filter(Boolean);if(d.length<=1){a[b]=c;return}let e=a;for(let a of d.slice(0,-1)){var f;(f=e[a])&&"object"==typeof f&&!Array.isArray(f)||(e[a]={}),e=e[a]}e[d[d.length-1]]=c}(c,d.key,a)}return c}var C=c(12557),D=c(90665);let E=["chat","inbox","trigger"];function F({snapshot:a,workspaceId:b,open:c,initialProvider:m=null,onOpenChange:u,onRefresh:L,onSnapshotChange:M}){let N=(0,e.useMemo)(()=>a.workspaces.find(a=>a.id===b)??null,[a.workspaces,b]),O=(0,e.useMemo)(()=>a.agents.filter(a=>a.workspaceId===N?.id),[a.agents,N?.id]),P=(0,e.useMemo)(()=>N?(0,y.mG)(a,N.id):[],[a,N]),Q=(0,e.useMemo)(()=>(0,n.yQ)(a.channelAccounts),[a.channelAccounts]),R=(0,e.useMemo)(()=>{let a=new Set(n.yp.map(a=>a.kind));return E.filter(b=>a.has(b))},[]),[S,T]=(0,e.useState)("chat"),[U,V]=(0,e.useState)("telegram"),[W,X]=(0,e.useState)(!1),[Y,Z]=(0,e.useState)(null),[$,_]=(0,e.useState)(""),[aa,ab]=(0,e.useState)({}),[ac,ad]=(0,e.useState)({}),[ae,af]=(0,e.useState)({}),[ag,ah]=(0,e.useState)({}),[ai,aj]=(0,e.useState)({}),[ak,al]=(0,e.useState)(null),[am,an]=(0,e.useState)(""),[ao,ap]=(0,e.useState)(A((0,n.rY)(U))),aq=(0,e.useMemo)(()=>Q.filter(a=>a.type===U),[U,Q]),ar=(0,e.useMemo)(()=>P.filter(a=>a.type===U),[U,P]),as=(0,e.useMemo)(()=>(0,n.rY)(U),[U]),at=as.provisionFields.filter(a=>"advanced"!==a.section),au=as.provisionFields.filter(a=>"advanced"===a.section),av=(0,e.useCallback)(a=>ar.some(b=>b.id===a||b.id===K(a)),[ar]),aw=(0,e.useCallback)((b,c="Unset")=>b?(0,D.CK)(a.agents.find(a=>a.id===b)??{name:b}):c,[a.agents]),ax=(0,e.useCallback)(b=>a.workspaces.find(a=>a.id===b)?.name??b,[a.workspaces]),ay=(0,e.useMemo)(()=>{let a=n.yp.filter(a=>a.kind===S),b=new Set(a.map(a=>a.provider)),c=Q.filter(a=>(0,n.rY)(a.type).kind===S&&!b.has(a.type)).map(a=>a.type);return[...a.map(a=>a.provider),...Array.from(new Set(c))]},[S,Q]),az=(0,e.useCallback)(async(a,b)=>{if(N?.id){ah(b=>({...b,[a]:!0})),aj(b=>({...b,[a]:null}));try{let c=await fetch(`/api/workspaces/${encodeURIComponent(N.id)}/surfaces/discovery?provider=${encodeURIComponent(b)}&accountId=${encodeURIComponent(a)}`),d=await c.json();if(!c.ok||d.error)throw Error(d.error||`${(0,n.rY)(b).label} route discovery failed.`);if(af(b=>({...b,[a]:!1!==d.supported&&Array.isArray(d.routes)?d.routes:[]})),"telegram"===b&&Array.isArray(d.routes)&&d.routes.length>0){let b=P.find(b=>b.id===a)??null,c=b?.workspaces.find(a=>a.workspaceId===N.id)??null;if(b&&c){let b=(c.groupAssignments??[]).filter(a=>!1!==a.enabled),e=new Set(b.map(a=>a.chatId)),f=d.routes.filter(a=>a.routeId&&!e.has(a.routeId)),g=new Map(d.routes.filter(a=>a.routeId&&a.title?.trim()).map(a=>[a.routeId,a.title?.trim()??null])),h=b.map(a=>{let b=g.get(a.chatId);return b&&a.title!==b?{...a,title:b}:a}),i=h.some((a,c)=>a.title!==b[c]?.title);if(f.length>0||i)try{let b=await fetch(`/api/workspaces/${encodeURIComponent(N.id)}/channels`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"groups",channelId:a,groupAssignments:[...h,...f.map(a=>({chatId:a.routeId,title:a.title??null,agentId:null,enabled:!0}))]})}),c=await b.json();if(!b.ok||c.error)throw Error(c.error||"Discovered groups could not be enabled.");c.registry&&M&&M(a=>(0,y.z$)(a,c.registry)),x.o.success("Telegram routes enabled.",{description:1===f.length?`${f[0].title??f[0].routeId} now falls back to the primary agent.`:f.length>1?`${f.length} discovered groups now fall back to the primary agent.`:"Discovered group names were synced."}),L().catch(()=>{})}catch(a){x.o.error("Telegram route sync failed.",{description:a instanceof Error?a.message:"Discovered groups could not be enabled."})}}}}catch(c){aj(d=>({...d,[a]:c instanceof Error?c.message:`${(0,n.rY)(b).label} discovery failed.`}))}finally{ah(b=>({...b,[a]:!1}))}}},[L,M,N,P]),aA=a=>{X(!0),Z(a)},aB=()=>{X(!1),Z(null)},aC=async a=>{if(!N)throw Error("Workspace was not found.");let b=await fetch(`/api/workspaces/${encodeURIComponent(N.id)}/channels`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),c=await b.json();if(!b.ok||c.error)throw Error(c.error||"OpenClaw could not update this surface right now.");return c},aD=async a=>{if(!N)throw Error("Workspace was not found.");let b=await fetch(`/api/workspaces/${encodeURIComponent(N.id)}/channels`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),c=await b.json();if(!b.ok||c.error)throw Error(c.error||"OpenClaw could not update this surface right now.");return c},aE=async a=>{if(!N)throw Error("Workspace was not found.");let b=await fetch(`/api/workspaces/${encodeURIComponent(N.id)}/channels`,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),c=await b.json();if(!b.ok||c.error)throw Error(c.error||"OpenClaw could not update this surface right now.");return c},aF=a=>{a.registry&&M&&M(b=>{let c=(0,y.z$)(b,a.registry);return a.account&&(c=(0,y.Iz)(c,a.account)),c})},aG=async a=>{let b=(0,C.Ek)(a);if(b)return b;if(!H(a))return null;try{let b=await fetch("/api/settings/gateway",{method:"GET"}),c=await b.json().catch(()=>null),d=c?.authStatus?.native?.issue??null,e=c?.authStatus?.recommendation??null;return(0,C.Ek)([a,d,e].filter(Boolean).join("\n"))}catch{return null}},aH=async(a,b)=>{aA(`${a.label} repair...`);try{let c=await fetch("/api/settings/gateway",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:a.apiAction})}),d=await c.json().catch(()=>null);if(!c.ok)throw Error(d?.error||"Gateway access could not be repaired.");if(d?.authStatus?.native&&!1===d.authStatus.native.ok)throw Error(d.authStatus.native.issue||"Gateway access still needs attention.");x.o.success(`${a.label} repaired.`,{description:"Retrying the surface operation."}),await L().catch(()=>void 0),await b()}catch(a){x.o.error("Gateway repair failed.",{description:a instanceof Error?a.message:"Unable to repair Gateway access."})}finally{aB()}},aI=async(a,b,c)=>{var d;let e=(d=b)instanceof Error?d.message:"Unknown surface error.",f=await aG(e)??(H(e)?{apiAction:"repairDeviceAccess",cta:"Repair access",label:"Gateway access",detail:"Approve any pending local AgentOS Gateway scope request, then retry."}:null);f&&c?x.o.error(a,{description:`${e} ${f.detail}`,duration:12e3,action:{label:"Repair & retry",onClick:()=>void aH(f,c)}}):H(e)&&c?x.o.error(a,{description:`${e} Wait for the OpenClaw Gateway to finish restarting, then retry.`,duration:1e4,action:{label:"Retry",onClick:()=>void c()}}):x.o.error(a,{description:e})},aJ=async a=>{if(N){aA(`Connecting ${a.name}...`);try{let b=await aC({channelId:a.id,type:U,name:a.name,workspacePath:N.path,primaryAgentId:$||null,agentId:$||void 0});aF(b),x.o.success(`${(0,n.rY)(U).label} connected to this workspace.`),L().catch(()=>{})}catch(b){await aI("Surface connection failed.",b,()=>aJ(a))}finally{aB()}}},aK=async()=>{if(N){if(!z(ao,"name").trim())return void x.o.error("A surface name is required.");aA(`Provisioning ${as.label}...`);try{let a=B(as.provisionFields,ao),b={type:U,name:z(ao,"name").trim(),workspacePath:N.path,config:a,primaryAgentId:$||null,agentId:$||void 0};for(let c of as.provisionFields)"token"===c.key&&"string"==typeof a.token&&(b.token=a.token),"botToken"===c.key&&"string"==typeof a.botToken&&(b.botToken=a.botToken),"webhookUrl"===c.key&&"string"==typeof a.webhookUrl&&(b.webhookUrl=a.webhookUrl);let c=await aC(b);aF(c),ap(A(as)),x.o.success(`${as.label} provisioned and connected.`),L().catch(()=>{})}catch(a){await aI("Surface provisioning failed.",a,aK)}finally{aB()}}},aL=async(a,b)=>{if(N&&b){aA("Updating owner agent...");try{let c=P.find(b=>b.id===a)??null,d=c?.workspaces.find(a=>a.workspaceId===N.id)??null;if(c&&d&&!d.agentIds.includes(b)){let c=await aD({action:"bind-agent",channelId:a,agentId:b,workspacePath:N.path});aF(c)}let e=await aD({action:"primary",channelId:a,primaryAgentId:b});aF(e),x.o.success("Owner agent updated."),L().catch(()=>{})}catch(a){x.o.error("Surface update failed.",{description:a instanceof Error?a.message:"Unknown surface error."})}finally{aB()}}},aM=async a=>{aA("Disconnecting surface from workspace...");try{let b=await aE({channelId:a});aF(b),x.o.success("Surface disconnected from this workspace."),L().catch(()=>{})}catch(a){x.o.error("Surface disconnect failed.",{description:a instanceof Error?a.message:"Unknown surface error."})}finally{aB()}},aN=async a=>{let b=aa[a]?.trim(),c=ac[a]?.trim();if(N&&b){aA(c?"Adding assistant and assigning route...":"Adding assistant agent...");try{let d=await aD({action:"bind-agent",channelId:a,agentId:b,workspacePath:N.path});aF(d);let e=null;if(c){let d=P.find(b=>b.id===a)??null,f=d?.workspaces.find(a=>a.workspaceId===N.id)??null;if(!d||!f)throw Error("Surface route binding was not found.");let g=(f.groupAssignments??[]).filter(a=>!1!==a.enabled),h=d.workspaces.flatMap(a=>(a.groupAssignments??[]).filter(a=>!1!==a.enabled)),i=I(ae[a]??[],h,d.type).find(a=>a.routeId===c)??null;e=i?.title??c;let j={chatId:c,title:i?.title??g.find(a=>a.chatId===c)?.title??null,agentId:b,enabled:!0},k=g.some(a=>a.chatId===c)?g.map(a=>a.chatId===c?{...a,...j}:a):[...g,j],l=await aD({action:"groups",channelId:a,groupAssignments:k});aF(l)}ab(b=>({...b,[a]:""})),ad(b=>({...b,[a]:""})),x.o.success(c?"Assistant added and assigned.":"Assistant agent added.",{description:c&&e?`${aw(b,b)} now owns ${e}.`:void 0}),L().catch(()=>{})}catch(a){x.o.error("Assistant update failed.",{description:a instanceof Error?a.message:"Unknown surface error."})}finally{aB()}}},aO=async(a,b)=>{aA("Removing assistant agent...");try{let c=await aD({action:"unbind-agent",channelId:a,agentId:b});aF(c),x.o.success("Assistant agent removed."),L().catch(()=>{})}catch(a){x.o.error("Assistant update failed.",{description:a instanceof Error?a.message:"Unknown surface error."})}finally{aB()}},aP=async(a,b)=>{aA("Updating surface routes...");try{let c=await aD({action:"groups",channelId:a,groupAssignments:b});aF(c),L().catch(()=>{})}catch(a){x.o.error("Surface route update failed.",{description:a instanceof Error?a.message:"Unknown surface routing error."})}finally{aB()}},aQ=async()=>{if(ak){aA(`Deleting ${ak.name} from OpenClaw...`);try{let a=await aE({channelId:ak.id,scope:"global"});a.registry&&M&&M(b=>(0,y.fY)((0,y.z$)(b,a.registry),ak.id)),al(null),an(""),x.o.success("Surface account deleted everywhere."),L().catch(()=>{})}catch(a){x.o.error("Surface deletion failed.",{description:a instanceof Error?a.message:"Unknown surface error."})}finally{aB()}}},aR=!!ak&&am.trim().toLowerCase()===ak.name.trim().toLowerCase(),aS="chat"===as.kind?null:B(as.provisionFields,ao),aT="chat"===as.kind?null:function(a){switch(a){case"gmail":return"hooks.gmail";case"email":return"email";case"webhook":return"hooks";case"cron":return"cron";default:return a}}(as.provider),aU=as.provisionFields.every(a=>(function(a,b){if(!a.required)return!0;let c=b[a.key];return"checkbox"===a.inputType?!0===c:"number"===a.inputType?"string"==typeof c&&c.trim().length>0&&Number.isFinite(Number(c.trim())):"string"==typeof c&&c.trim().length>0})(a,ao)),aV=as.supportsProvisioning&&!W&&!!$&&!!z(ao,"name").trim()&&aU,aW=a=>{let b=`surface-${a.key}`,c=ao[a.key];return"checkbox"===a.inputType?(0,d.jsxs)("label",{htmlFor:b,className:"flex cursor-pointer items-start gap-3 rounded-xl border border-white/8 bg-white/[0.02] px-3 py-2.5 transition-colors hover:bg-white/[0.04]",children:[(0,d.jsx)("input",{id:b,type:"checkbox",checked:!!c,disabled:W,onChange:b=>ap(c=>({...c,[a.key]:b.target.checked})),className:"mt-0.5 h-4 w-4 rounded border-white/20 bg-white/5 text-cyan-400 focus:ring-cyan-400/60"}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"text-sm font-medium text-white",children:a.label}),a.helpText?(0,d.jsx)("p",{className:"mt-1 text-[11px] leading-4 text-slate-500",children:a.helpText}):null]})]},a.key):(0,d.jsxs)(G,{label:a.label,htmlFor:b,children:["select"===a.inputType?(0,d.jsxs)("select",{id:b,value:"string"==typeof c?c:"",onChange:b=>ap(c=>({...c,[a.key]:b.target.value})),className:"flex h-10 w-full rounded-xl border border-white/10 bg-white/5 px-3 py-2 text-sm text-white outline-none",disabled:W,children:[(0,d.jsx)("option",{value:"",children:"Select one"}),(a.options??[]).map(a=>(0,d.jsx)("option",{value:a.value,children:a.label},a.value))]}):"textarea"===a.inputType?(0,d.jsx)(w.T,{id:b,value:"string"==typeof c?c:"",onChange:b=>ap(c=>({...c,[a.key]:b.target.value})),placeholder:a.placeholder,disabled:W,className:"min-h-20 rounded-xl px-3 py-2"}):(0,d.jsx)(t.p,{id:b,type:"number"===a.inputType?"number":a.secret?"password":a.inputType??"text",value:"string"==typeof c?c:"",onChange:b=>ap(c=>({...c,[a.key]:b.target.value})),placeholder:a.placeholder,disabled:W,className:"h-10 rounded-xl px-3"}),a.helpText?(0,d.jsx)("p",{className:"text-[11px] leading-4 text-slate-500",children:a.helpText}):null]},a.key)};return(0,d.jsxs)(s.lG,{open:c,onOpenChange:u,children:[(0,d.jsx)(s.Cf,{className:"flex max-h-[calc(100dvh-2rem)] w-[calc(100vw-1rem)] max-w-5xl flex-col overflow-hidden rounded-[22px] p-0",closeClassName:"right-3 top-3",children:(0,d.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,d.jsx)(s.c7,{className:"border-b border-white/10 px-4 py-3 pr-12 sm:px-5",children:(0,d.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)(s.L3,{className:"text-lg",children:"Workspace surfaces"}),(0,d.jsx)(s.rr,{className:"mt-1 text-xs",children:"Manage accounts, owners, and routes for this workspace."})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2 text-[10px] text-slate-400",children:[(0,d.jsxs)(q.E,{variant:"muted",className:"h-6 rounded-full px-2 text-[10px]",children:[P.length," linked"]}),(0,d.jsxs)(q.E,{variant:"muted",className:"h-6 rounded-full px-2 text-[10px]",children:[Q.length," accounts"]})]})]})}),W&&Y?(0,d.jsx)("div",{className:"mx-4 mt-4 rounded-2xl border border-cyan-300/20 bg-cyan-400/[0.08] px-3 py-2 sm:mx-6",children:(0,d.jsxs)("div",{className:"flex items-center gap-2 text-[11px] text-cyan-50",children:[(0,d.jsx)(f.A,{className:"h-3.5 w-3.5 animate-spin"}),(0,d.jsx)("span",{children:Y})]})}):null,(0,d.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto px-4 py-4 sm:px-5",children:(0,d.jsxs)("div",{className:"grid min-h-0 gap-4 sm:grid-cols-[220px_minmax(0,1fr)]",children:[(0,d.jsxs)("aside",{className:"h-fit rounded-2xl border border-white/10 bg-white/[0.025] p-2.5 sm:sticky sm:top-0",children:[(0,d.jsx)(v.tU,{value:S,onValueChange:a=>T(a),children:(0,d.jsx)(v.j7,{className:"grid h-9 w-full grid-cols-3 rounded-xl",children:R.map(a=>(0,d.jsx)(v.Xi,{className:"h-7 rounded-lg px-2 text-[11px]",value:a,children:J(a)},a))})}),(0,d.jsx)("div",{className:"mt-2.5 space-y-1.5",children:ay.map(a=>{let b=(0,n.rY)(a),c=P.filter(b=>b.type===a).length,e=Q.filter(b=>b.type===a).length;return(0,d.jsxs)("button",{type:"button",onClick:()=>V(a),className:(0,o.cn)("flex w-full items-center justify-between gap-3 rounded-xl border px-2.5 py-2 text-left transition-colors",U===a?"border-cyan-300/35 bg-cyan-400/[0.08]":"border-white/8 bg-white/[0.02] hover:bg-white/[0.04]"),children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-2.5",children:[(0,d.jsx)(p,{provider:a,className:"h-8 w-8 shrink-0"}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"truncate text-sm font-medium text-white",children:b.label}),(0,d.jsxs)("p",{className:"mt-0.5 truncate text-[10px] text-slate-500",children:[e," account",1===e?"":"s"]})]})]}),(0,d.jsx)(q.E,{variant:"muted",className:"h-5 shrink-0 rounded-full px-2 text-[10px]",children:c})]},a)})})]}),(0,d.jsxs)("div",{className:"min-w-0 space-y-4",children:[(0,d.jsxs)("section",{className:"rounded-2xl border border-white/10 bg-white/[0.025] p-3.5",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,d.jsxs)("p",{className:"min-w-0 truncate text-sm font-medium text-white",children:[as.label," surfaces"]}),(0,d.jsxs)(q.E,{variant:"muted",className:"h-6 rounded-full px-2 text-[10px]",children:[ar.length," linked"]})]}),ar.length>0?(0,d.jsx)("div",{className:"mt-3 space-y-2.5",children:ar.map(a=>{var b;let c=a.workspaces.find(a=>a.workspaceId===N?.id)??null,e=(c?.agentIds??[]).filter(b=>b!==a.primaryAgentId),l=O.filter(b=>b.id!==a.primaryAgentId&&!(c?.agentIds??[]).includes(b.id)),m=(c?.groupAssignments??[]).filter(a=>!1!==a.enabled),o=a.workspaces.flatMap(a=>(a.groupAssignments??[]).filter(a=>!1!==a.enabled)),s=a.workspaces.filter(a=>a.workspaceId!==N?.id).flatMap(b=>(b.groupAssignments??[]).filter(a=>!1!==a.enabled&&a.chatId).map(c=>({routeId:c.chatId,workspaceName:ax(b.workspaceId),ownerName:c.agentId?aw(c.agentId,c.agentId):`${aw(a.primaryAgentId,"Primary agent")} fallback`}))).reduce((a,b)=>({...a,[b.routeId]:[...a[b.routeId]??[],{workspaceName:b.workspaceName,ownerName:b.ownerName}]}),{}),t=ae[a.id]??[],u=!!ag[a.id],v=ai[a.id]??null,w=I(t,o.length>0?o:m,a.type),x=O.some(b=>b.id===a.primaryAgentId);return(0,d.jsxs)("div",{className:"rounded-2xl border border-white/8 bg-white/[0.02] p-3",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,d.jsx)(p,{provider:a.type,className:"h-9 w-9 shrink-0"}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,d.jsx)("p",{className:"truncate text-sm font-medium text-white",children:a.name}),(0,d.jsx)(q.E,{variant:"muted",className:"h-5 rounded-full px-2 text-[10px]",children:J(as.kind)})]}),(0,d.jsx)("p",{className:"mt-1 truncate text-[11px] text-slate-500",children:a.id})]})]}),(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[(0,d.jsxs)(r.$,{type:"button",variant:"secondary",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",disabled:W,onClick:()=>void aM(a.id),children:[(0,d.jsx)(g.A,{className:"mr-1.5 h-3.5 w-3.5"}),"Disconnect"]}),(0,d.jsx)(r.$,{type:"button",variant:"destructive",size:"sm",className:"h-8 w-8 rounded-full p-0",disabled:W,"aria-label":`Delete ${a.name}`,title:"Delete everywhere",onClick:()=>{let b=aq.find(b=>b.id===a.id)??null,c=b??aq.find(b=>K(b.id)===a.id)??null,d=b??(c?{...c,id:a.id}:null);d&&(al(d),an(""))},children:(0,d.jsx)(h.A,{className:"h-3.5 w-3.5"})})]})]}),(0,d.jsxs)("div",{className:"mt-3 grid gap-3 lg:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]",children:[(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsx)(G,{label:"chat"===as.kind?"Primary agent":"Owner agent",htmlFor:`primary-${a.id}`,children:(0,d.jsxs)("select",{id:`primary-${a.id}`,value:a.primaryAgentId??"",disabled:W,onChange:b=>void aL(a.id,b.target.value),className:"flex h-9 w-full rounded-xl border border-white/10 bg-white/5 px-3 text-sm text-white outline-none",children:[(0,d.jsx)("option",{value:"",children:"Select agent"}),a.primaryAgentId&&!x?(0,d.jsxs)("option",{value:a.primaryAgentId,children:[aw(a.primaryAgentId,a.primaryAgentId)," \xb7 outside this workspace"]}):null,O.map(a=>(0,d.jsx)("option",{value:a.id,children:(0,D.CK)(a)},a.id))]})}),(0,d.jsxs)("p",{className:"flex items-center gap-1.5 text-[11px] text-slate-500",children:[(0,d.jsx)(i.A,{className:"h-3 w-3"}),aw(a.primaryAgentId)]})]}),(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsxs)("div",{className:"space-y-1",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.16em] text-slate-400",children:"Assistants available for routes"}),(0,d.jsx)("p",{className:"text-[11px] leading-4 text-slate-500",children:"Add an agent to the surface, then optionally assign it to a route."})]}),e.length>0?(0,d.jsx)("div",{className:"flex flex-wrap gap-2",children:e.map(b=>(0,d.jsxs)("button",{type:"button",disabled:W,onClick:()=>void aO(a.id,b),className:"inline-flex items-center gap-2 rounded-full border border-white/10 bg-white/[0.04] px-2.5 py-1 text-[11px] text-slate-200 transition-colors hover:bg-white/[0.08]",children:[(0,d.jsx)("span",{children:aw(b,b)}),(0,d.jsx)("span",{className:"text-slate-500",children:"remove"})]},`${a.id}-${b}`))}):(0,d.jsx)("p",{className:"text-[11px] text-slate-400",children:"No assistant agents attached yet."}),l.length>0?(0,d.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-end",children:[(0,d.jsxs)("div",{className:"grid flex-1 gap-2 sm:grid-cols-2",children:[(0,d.jsxs)("select",{value:aa[a.id]??"",disabled:W,"aria-label":"Assistant agent",onChange:b=>ab(c=>({...c,[a.id]:b.target.value})),className:"flex h-9 w-full rounded-xl border border-white/10 bg-white/5 px-3 text-sm text-white outline-none",children:[(0,d.jsx)("option",{value:"",children:"Select assistant"}),l.map(a=>(0,d.jsx)("option",{value:a.id,children:(0,D.CK)(a)},a.id))]}),(0,d.jsxs)("select",{value:ac[a.id]??"",disabled:W||0===w.length,"aria-label":"Initial route assignment",onChange:b=>ad(c=>({...c,[a.id]:b.target.value})),className:"flex h-9 w-full rounded-xl border border-white/10 bg-white/5 px-3 text-sm text-white outline-none disabled:cursor-not-allowed disabled:opacity-50",children:[(0,d.jsx)("option",{value:"",children:w.length>0?"No route yet":"No discovered routes"}),w.map(b=>(0,d.jsxs)("option",{value:b.routeId,children:["Assign to ",b.title??b.routeId]},`${a.id}-target-${b.routeId}`))]})]}),(0,d.jsxs)(r.$,{type:"button",size:"sm",className:"h-9 rounded-full px-3 text-[11px] sm:shrink-0",disabled:W||!(aa[a.id]??"").trim(),onClick:()=>void aN(a.id),children:[(0,d.jsx)(j.A,{className:"mr-1.5 h-3.5 w-3.5"}),"Add"]})]}):null]})]}),as.supportsRouteDiscovery?(0,d.jsxs)("div",{className:"mt-3 rounded-2xl border border-white/8 bg-white/[0.025] p-3",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("p",{className:"text-sm font-medium text-white",children:[(0,n.rY)(a.type).label," routes"]}),(0,d.jsx)("p",{className:"mt-0.5 text-[11px] text-slate-500",children:"Unassigned routes use the primary agent."})]}),(0,d.jsxs)(r.$,{type:"button",variant:"ghost",size:"sm",className:"h-8 rounded-full px-3 text-[11px]",disabled:W||u,onClick:()=>void az(a.id,a.type),children:[u?(0,d.jsx)(f.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):(0,d.jsx)(k.A,{className:"mr-1.5 h-3.5 w-3.5"}),"Routes"]})]}),v?(0,d.jsx)("p",{className:"mt-3 text-[11px] text-rose-300",children:v}):null,w.length>0?(0,d.jsx)("div",{className:"mt-3 space-y-2",children:w.map(b=>{var c;let e,f=m.find(a=>a.chatId===b.routeId)??null,g=s[b.routeId]??[],h=!!f,i=h?m.filter(a=>a.chatId!==b.routeId):[...m,{chatId:b.routeId,title:b.title??null,agentId:null,enabled:!0}];return(0,d.jsx)("div",{className:"rounded-xl border border-white/8 bg-white/[0.02] px-3 py-2.5",children:(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("input",{type:"checkbox",className:"mt-0.5 h-4 w-4 rounded border-white/15 bg-white/5 accent-cyan-300",checked:h,disabled:W,onChange:()=>void aP(a.id,i)}),(0,d.jsx)("div",{className:"min-w-0 flex-1",children:(0,d.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,d.jsx)("p",{className:"truncate text-sm font-medium text-white",children:b.title??b.routeId}),(0,d.jsx)(q.E,{variant:"muted",className:"h-5 rounded-full px-2 text-[10px]",children:b.kind})]}),(0,d.jsxs)("p",{className:"mt-1 truncate text-[11px] text-slate-500",children:[b.subtitle??b.routeId,b.lastSeen?` \xb7 seen ${Number.isNaN(e=Date.parse(c=b.lastSeen))?c:new Date(e).toISOString().replace("T"," ").slice(0,16)}`:""]}),g.length>0?(0,d.jsxs)("p",{className:"mt-1 text-[11px] leading-4 text-amber-100/75",children:["Also routed in"," ",g.map(a=>`${a.workspaceName} by ${a.ownerName}`).join(", ")]}):null]}),(0,d.jsxs)("div",{className:"min-w-[190px] space-y-1",children:[(0,d.jsx)("p",{className:"px-1 text-[9px] uppercase tracking-[0.14em] text-slate-500",children:"Route owner"}),(0,d.jsxs)("select",{value:f?.agentId??"",disabled:W||!h,onChange:c=>void aP(a.id,m.map(a=>a.chatId===b.routeId?{...a,title:b.title??a.title??null,agentId:c.target.value||null}:a)),className:"flex h-8 w-full rounded-full border border-white/10 bg-white/5 px-3 text-[11px] text-white outline-none disabled:cursor-not-allowed disabled:opacity-50",children:[(0,d.jsx)("option",{value:"",children:"Primary fallback"}),O.map(a=>(0,d.jsx)("option",{value:a.id,children:(0,D.CK)(a)},a.id))]})]})]})})]})},`${a.id}:${b.routeId}`)})}):(0,d.jsx)("div",{className:"mt-3 rounded-xl border border-dashed border-white/10 bg-white/[0.02] px-3 py-3 text-[11px] text-slate-500",children:"telegram"===(b=a.type)?"No Telegram groups found yet. Send one message in the target group, then refresh surface discovery.":"discord"===b?"No Discord surfaces were discovered yet. Send one message in the target server, then refresh surface discovery.":"No surfaces were discovered yet for this provider."})]}):null]},a.id)})}):(0,d.jsxs)("div",{className:"mt-3 rounded-xl border border-dashed border-white/10 bg-white/[0.02] px-3 py-3 text-sm text-slate-500",children:["No ",as.label," surfaces are linked to this workspace yet."]})]}),(0,d.jsxs)("section",{className:"rounded-2xl border border-white/10 bg-white/[0.025] p-3.5",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,d.jsxs)("p",{className:"min-w-0 truncate text-sm font-medium text-white",children:["Connect ",as.label]}),(0,d.jsxs)(q.E,{variant:"muted",className:"h-6 rounded-full px-2 text-[10px]",children:[aq.length," available"]})]}),(0,d.jsxs)("div",{className:"mt-3 grid gap-3 xl:grid-cols-[minmax(0,1.1fr)_minmax(0,0.9fr)]",children:[(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.16em] text-slate-500",children:"Existing accounts"}),aq.length>0?aq.map(a=>{let b=av(a.id);return(0,d.jsxs)("div",{className:"flex flex-col gap-3 rounded-xl border border-white/8 bg-white/[0.02] px-3 py-2.5 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,d.jsx)(p,{provider:a.type,className:"h-8 w-8 shrink-0"}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"truncate text-sm font-medium text-white",children:a.name}),(0,d.jsx)("p",{className:"mt-1 truncate text-[11px] text-slate-500",children:a.id})]})]}),(0,d.jsx)(r.$,{type:"button",size:"sm",variant:b?"secondary":"default",className:"h-8 rounded-full px-3 text-[11px]",disabled:W||b,onClick:()=>void aJ(a),children:b?"Linked":(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(g.A,{className:"mr-1.5 h-3.5 w-3.5"}),"Connect"]})})]},a.id)}):(0,d.jsxs)("div",{className:"rounded-xl border border-dashed border-white/10 bg-white/[0.02] px-3 py-3 text-sm text-slate-500",children:["No ",as.label," accounts found."]})]}),(0,d.jsxs)("div",{className:"space-y-3 rounded-xl border border-white/8 bg-white/[0.02] p-3",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,d.jsx)("p",{className:"text-sm font-medium text-white",children:"Provision"}),(0,d.jsx)(q.E,{variant:"muted",className:"h-5 rounded-full px-2 text-[10px]",children:as.supportsProvisioning?"AgentOS":"OpenClaw"})]}),(0,d.jsx)(G,{label:"Surface name",htmlFor:"surface-name",children:(0,d.jsx)(t.p,{id:"surface-name",value:z(ao,"name"),onChange:a=>ap(b=>({...b,name:a.target.value})),placeholder:`${as.label} workspace surface`,className:"h-10 rounded-xl px-3"})}),at.length>0?(0,d.jsx)("div",{className:"grid gap-3 md:grid-cols-2",children:at.map(aW)}):null,au.length>0?(0,d.jsxs)("details",{className:"rounded-xl border border-white/8 bg-white/[0.015] p-3",children:[(0,d.jsx)("summary",{className:"cursor-pointer list-none text-xs font-medium uppercase tracking-[0.16em] text-slate-500",children:"Advanced settings"}),(0,d.jsx)("div",{className:"mt-3 grid gap-3 md:grid-cols-2",children:au.map(aW)})]}):null,aS&&aT?(0,d.jsxs)("details",{className:"rounded-xl border border-cyan-300/15 bg-cyan-400/[0.04] p-3",children:[(0,d.jsx)("summary",{className:"cursor-pointer list-none text-xs font-medium uppercase tracking-[0.16em] text-cyan-100",children:"Config preview"}),(0,d.jsx)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:(0,d.jsx)(q.E,{variant:"muted",className:"h-6 rounded-full px-2 text-[10px]",children:aT})}),"gmail"===as.provider?(0,d.jsx)("p",{className:"mt-2 text-[11px] leading-5 text-cyan-100/70",children:"Includes Gmail hook enablement."}):null,(0,d.jsx)("pre",{className:"mt-3 max-h-52 overflow-auto rounded-xl border border-white/10 bg-slate-950/80 p-3 text-[11px] leading-5 text-slate-100",children:JSON.stringify(aS,null,2)})]}):null,(0,d.jsx)(G,{label:"Primary agent",htmlFor:"surface-primary-agent",children:(0,d.jsxs)("select",{id:"surface-primary-agent",value:$,onChange:a=>_(a.target.value),className:"flex h-10 w-full rounded-xl border border-white/10 bg-white/5 px-3 py-2 text-sm text-white outline-none",children:[(0,d.jsx)("option",{value:"",children:"Select agent"}),O.map(a=>(0,d.jsx)("option",{value:a.id,children:(0,D.CK)(a)},a.id))]})}),(0,d.jsx)(r.$,{type:"button",className:"h-10 rounded-full px-4 text-sm",disabled:!aV,onClick:()=>void aK(),children:W?"Provisioning...":(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(j.A,{className:"mr-1.5 h-4 w-4"}),"Provision"]})})]})]})]})]})]})}),(0,d.jsx)(s.Es,{className:"border-t border-white/10 px-4 py-3 sm:px-5",children:(0,d.jsx)(r.$,{variant:"secondary",onClick:()=>u(!1),children:"Close"})})]})}),(0,d.jsx)(s.lG,{open:!!ak,onOpenChange:a=>!a&&al(null),children:(0,d.jsxs)(s.Cf,{className:"sm:max-w-2xl",children:[(0,d.jsxs)(s.c7,{children:[(0,d.jsx)(s.L3,{children:"Delete OpenClaw account"}),(0,d.jsx)(s.rr,{children:"This removes the account from every workspace overlay. For provider-backed chat accounts, AgentOS also asks OpenClaw to delete the underlying account when supported."})]}),(0,d.jsx)("div",{className:"rounded-[20px] border border-rose-500/25 bg-rose-500/[0.08] p-4",children:(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)(l.A,{className:"mt-0.5 h-4 w-4 shrink-0 text-rose-200"}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("p",{className:"text-sm font-medium text-rose-50",children:["Type ",ak?.name??"the account name"," to confirm deletion."]}),(0,d.jsx)("p",{className:"mt-1 text-xs leading-5 text-rose-100/80",children:"This action removes the account overlay everywhere and may delete the underlying OpenClaw provider account if the provider supports it."})]})]})}),(0,d.jsx)(G,{label:`Type ${ak?.name??""} to confirm`,htmlFor:"delete-surface-confirm",children:(0,d.jsx)(t.p,{id:"delete-surface-confirm",value:am,onChange:a=>an(a.target.value),placeholder:ak?.name??""})}),(0,d.jsxs)(s.Es,{children:[(0,d.jsx)(r.$,{variant:"secondary",onClick:()=>{al(null),an("")},children:"Cancel"}),(0,d.jsx)(r.$,{variant:"destructive",disabled:!aR||W,onClick:()=>void aQ(),children:W?"Deleting...":"Delete everywhere"})]})]})})]})}function G({label:a,htmlFor:b,children:c}){return(0,d.jsxs)("div",{className:"space-y-1.5",children:[(0,d.jsx)(u.J,{htmlFor:b,className:"text-[10px] uppercase tracking-[0.16em] text-slate-400",children:a}),c]})}function H(a){return/gateway|websocket|connection closed|service restart|ECONNREFUSED|ECONNRESET|socket hang up|unreachable|not reachable|timed out|timeout|scope upgrade|scope mismatch|missing operator/i.test(a)}function I(a,b,c){let d=new Map;for(let b of a)d.set(b.routeId,b);for(let a of b)d.set(a.chatId,{routeId:a.chatId,provider:c,kind:function(a,b){if("telegram"===a)return"group";if("discord"===a){if(b.startsWith("thread:"))return"thread";if(b.startsWith("role:"))return"role"}return"channel"}(c,a.chatId),title:a.title??d.get(a.chatId)?.title??null,subtitle:d.get(a.chatId)?.subtitle??null,lastSeen:d.get(a.chatId)?.lastSeen??null});return Array.from(d.values()).sort((a,b)=>{let c=a.title??a.routeId,d=b.title??b.routeId;return c.localeCompare(d)})}function J(a){return a.slice(0,1).toUpperCase()+a.slice(1)}function K(a){return a.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}},43081:(a,b,c)=>{"use strict";c.d(b,{Toaster:()=>d.l$,o:()=>d.oR});var d=c(57825)},45084:(a,b,c)=>{"use strict";c.d(b,{Iz:()=>i,XS:()=>g,fY:()=>j,mG:()=>f,rz:()=>k,z$:()=>h});var d=c(40299);function e(a){return Array.from(new Set(a.map(a=>a.trim()).filter(Boolean).filter(Boolean)))}function f(a,b){return a.channelRegistry.channels.filter(a=>a.workspaces.some(a=>a.workspaceId===b)).sort((a,b)=>{let c=(0,d.rY)(a.type).kind,e=(0,d.rY)(b.type).kind;return c!==e?c.localeCompare(e):a.type!==b.type?(0,d.rY)(a.type).label.localeCompare((0,d.rY)(b.type).label):a.name.localeCompare(b.name)})}function g(a,b,c){return f(a,b).filter(a=>a.primaryAgentId===c||a.workspaces.some(a=>a.workspaceId===b&&(a.agentIds.includes(c)||a.groupAssignments.some(a=>!1!==a.enabled&&a.agentId===c)))).map(a=>a.id)}function h(a,b){return{...a,channelRegistry:b}}function i(a,b){let c=a.channelAccounts.filter(a=>a.id!==b.id);return{...a,channelAccounts:[...c,b]}}function j(a,b){return{...a,channelAccounts:a.channelAccounts.filter(a=>a.id!==b)}}async function k(a){let b=e(a.currentChannelIds),c=e(a.nextChannelIds),d=c.filter(a=>!b.includes(a)),f=b.filter(a=>!c.includes(a));for(let b of d){let c=await fetch(`/api/workspaces/${encodeURIComponent(a.workspaceId)}/channels`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"bind-agent",channelId:b,agentId:a.agentId,workspacePath:a.workspacePath})}),d=await c.json();if(!c.ok||d.error)throw Error(d.error||"OpenClaw could not bind the channel.");d.registry&&a.onRegistryChange&&a.onRegistryChange(a=>h(a,d.registry))}for(let b of f){let c=await fetch(`/api/workspaces/${encodeURIComponent(a.workspaceId)}/channels`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"unbind-agent",channelId:b,agentId:a.agentId})}),d=await c.json();if(!c.ok||d.error)throw Error(d.error||"OpenClaw could not unbind the channel.");d.registry&&a.onRegistryChange&&a.onRegistryChange(a=>h(a,d.registry))}}},45100:(a,b,c)=>{"use strict";c.d(b,{I:()=>l});var d=c(3814),e=c(5813),f=c(47221),g=c(98036),h=c(32905);let i={"openai-codex":{kind:"image",src:"/assets/provider-logos/openai.svg"},openai:{kind:"image",src:"/assets/provider-logos/openai.svg"},anthropic:{kind:"simple",icon:j("siAnthropic","Anthropic")},google:{kind:"simple",icon:j("siGooglegemini","Gemini")},gemini:{kind:"simple",icon:j("siGooglegemini","Gemini")},deepseek:{kind:"image",src:"/assets/provider-logos/deepseek.svg"},mistral:{kind:"simple",icon:j("siMistralai","Mistral")},openrouter:{kind:"simple",icon:j("siOpenrouter","OpenRouter")},ollama:{kind:"simple",icon:j("siOllama","Ollama")},xai:{kind:"image",src:"/assets/provider-logos/xai.svg"}};function j(a,b){let c=g[a];return c||{title:b,hex:"ffffff",path:"M0 0h24v24H0z"}}function k({provider:a,className:b}){let c=i[a.trim().toLowerCase()];return c?(0,d.jsx)("div",{className:(0,h.cn)("flex shrink-0 items-center justify-center overflow-hidden rounded-[16px] border border-black/5 bg-white/95 text-slate-900 shadow-[0_1px_1px_rgba(0,0,0,0.04)]",b),"aria-hidden":"true",children:"image"===c.kind?(0,d.jsx)(f.default,{src:c.src,alt:"",width:18,height:18,className:"h-[72%] w-[72%] select-none object-contain",unoptimized:!0}):(0,d.jsx)("svg",{viewBox:"0 0 24 24",className:"h-[72%] w-[72%] select-none",fill:`#${c.icon.hex}`,children:(0,d.jsx)("path",{d:c.icon.path})})}):null}function l({descriptor:a,active:b,compact:c=!1,micro:f=!1,connected:g=!1,detail:i,onClick:j}){return(0,d.jsxs)("button",{type:"button",onClick:j,className:(0,h.cn)("group w-full rounded-[20px] border text-left transition-all",f?"rounded-[16px] p-1.5":c?"p-2.5":"p-3.5",b?f?"border-cyan-300/40 bg-[linear-gradient(180deg,rgba(23,32,52,0.98),rgba(11,18,31,0.98))] shadow-[0_8px_16px_rgba(10,16,28,0.18)]":c?"border-cyan-300/40 bg-[linear-gradient(180deg,rgba(23,32,52,0.98),rgba(11,18,31,0.98))] shadow-[0_12px_26px_rgba(10,16,28,0.22)]":"border-cyan-300/40 bg-[linear-gradient(180deg,rgba(23,32,52,0.98),rgba(11,18,31,0.98))] shadow-[0_16px_36px_rgba(10,16,28,0.26)]":"border-white/10 bg-[linear-gradient(180deg,rgba(15,23,42,0.92),rgba(10,15,28,0.92))] hover:border-white/18 hover:bg-[linear-gradient(180deg,rgba(20,29,49,0.96),rgba(12,18,31,0.96))]"),children:[(0,d.jsxs)("div",{className:(0,h.cn)("flex items-start justify-between",f?"gap-1.5":"gap-2.5"),children:[(0,d.jsx)(k,{className:(0,h.cn)(f?"h-5 w-5":c?"h-7 w-7":"h-9 w-9",b?"ring-1 ring-cyan-300/20":""),provider:a.id}),(0,d.jsx)(e.E,{variant:g?"success":b?"default":"muted",className:(0,h.cn)("tracking-[0.12em]",f?"px-1 py-0.5 text-[7px]":c?"px-1.5 py-0.5 text-[9px]":"px-2 py-0.5 text-[10px]"),children:g?"Connected":b?"Selected":"Provider"})]}),(0,d.jsxs)("div",{className:(0,h.cn)(f?"mt-1.5":c?"mt-2":"mt-3.5"),children:[(0,d.jsx)("p",{className:(0,h.cn)("font-display text-white",f?"text-[0.72rem]":c?"text-[0.82rem]":"text-[0.94rem]"),children:a.label}),(0,d.jsx)("p",{className:(0,h.cn)("mt-1 text-slate-300",f?"line-clamp-2 text-[8px] leading-[0.85rem]":c?"text-[9px] leading-[0.95rem]":"text-[11px] leading-5"),children:a.description}),(0,d.jsx)("p",{className:(0,h.cn)("mt-2.5 uppercase tracking-[0.18em] text-slate-500",f?"line-clamp-1 text-[7px]":c?"text-[8px]":"text-[9px]"),children:i||a.helperText})]})]})}},45723:(a,b,c)=>{Promise.resolve().then(c.bind(c,927))},45738:(a,b,c)=>{"use strict";c.d(b,{X:()=>k});var d=c(3814),e=c(5813),f=c(80990),g=c(90665),h=c(32905),i=c(45084),j=c(11917);function k({snapshot:a,workspaceId:b,channelIds:c,agentId:l,isSaving:m,onChange:n,surfaceTheme:o="dark"}){let p=(0,i.mG)(a,b),q=new Set(c),r="light"===o;return 0===p.length?(0,d.jsx)("div",{className:(0,h.cn)("rounded-[22px] border p-3.5",r?"border-[#e1d5c8] bg-white/92 shadow-[0_14px_34px_rgba(161,125,101,0.08)]":"border-white/10 bg-white/[0.03]"),children:(0,d.jsx)("div",{className:"flex items-start justify-between gap-3",children:(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:(0,h.cn)("text-[13px] font-medium",r?"text-[#3f2f24]":"text-white"),children:"Surface participation"}),(0,d.jsx)("p",{className:(0,h.cn)("mt-1 text-[11px] leading-4",r?"text-[#7b6657]":"text-slate-400"),children:"Connect workspace surfaces first. Primary agents own the surface; selected agents assist behind the scenes."})]})})}):(0,d.jsxs)("div",{className:(0,h.cn)("rounded-[22px] border p-3.5",r?"border-[#e1d5c8] bg-white/92 shadow-[0_14px_34px_rgba(161,125,101,0.08)]":"border-white/10 bg-white/[0.03]"),children:[(0,d.jsx)("div",{className:"flex items-start justify-between gap-3",children:(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:(0,h.cn)("text-[13px] font-medium",r?"text-[#3f2f24]":"text-white"),children:"Surface participation"}),(0,d.jsx)("p",{className:(0,h.cn)("mt-1 text-[11px] leading-4",r?"text-[#7b6657]":"text-slate-400"),children:"Primary agents own the surface. Selected surfaces let this agent assist the owner internally."})]})}),m?(0,d.jsxs)("div",{className:(0,h.cn)("mt-3 inline-flex items-center gap-2 rounded-full border px-3 py-1 text-[10px]",r?"border-[#c89e73]/25 bg-[#f5eadf] text-[#6b4f39]":"border-cyan-300/20 bg-cyan-400/[0.08] text-cyan-50"),children:[(0,d.jsx)(j.A,{className:"h-3.5 w-3.5 animate-spin"}),(0,d.jsx)("span",{children:"Applying surface changes..."})]}):null,(0,d.jsx)("div",{className:"mt-4 space-y-3",children:p.map(i=>{var j;let k=q.has(i.id),o=!!(l&&i.primaryAgentId===l),p=(j=i.primaryAgentId)?(0,g.CK)(a.agents.find(a=>a.id===j)??{name:j}):null,s=i.workspaces.find(a=>a.workspaceId===b)??null,t=s?.agentIds.length??0;return(0,d.jsxs)("div",{className:(0,h.cn)("flex items-center justify-between gap-3 rounded-[18px] border px-3.5 py-2.5",k?r?"border-[#c89e73]/45 bg-[#fff7ef]":"border-cyan-300/40 bg-cyan-400/[0.08]":r?"border-[#e2d6ca] bg-white":"border-white/8 bg-white/[0.02]"),children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("p",{className:(0,h.cn)("truncate text-[13px] font-medium",r?"text-[#3f2f24]":"text-white"),children:i.name}),(0,d.jsx)(e.E,{variant:"muted",className:(0,h.cn)("h-4 rounded-full px-2 text-[9px]",r?"border-[#e1d5c8] bg-[#fbf7f2] text-[#6f5747]":""),children:i.type}),o?(0,d.jsx)(e.E,{className:(0,h.cn)("h-4 rounded-full px-2 text-[9px]",r?"border-[#c89e73]/35 bg-[#f5e7d8] text-[#6a4a34]":""),children:"Owner"}):k?(0,d.jsx)(e.E,{className:(0,h.cn)("h-4 rounded-full px-2 text-[9px]",r?"border-[#c89e73]/35 bg-[#f5e7d8] text-[#6a4a34]":""),children:"Assistant"}):null,t>1?(0,d.jsx)(e.E,{variant:"muted",className:(0,h.cn)("h-4 rounded-full px-2 text-[9px]",r?"border-[#e1d5c8] bg-[#fbf7f2] text-[#6f5747]":""),children:"Team"}):null]}),(0,d.jsxs)("p",{className:(0,h.cn)("mt-1 truncate text-[10px]",r?"text-[#7f6958]":"text-slate-400"),children:[i.id,p?` \xb7 owner ${p}`:""]})]}),(0,d.jsx)(f.$,{type:"button",variant:k?"secondary":"default",size:"sm",className:(0,h.cn)("h-8 rounded-full px-2.5 text-[10px]",r&&!k?"shadow-none":""),disabled:!!m||k&&o,onClick:()=>n(q.has(i.id)?c.filter(a=>a!==i.id):[...c,i.id]),children:k?o?"Owner":"Remove":"Assist"})]},i.id)})})]})}},46856:(a,b,c)=>{"use strict";c.d(b,{o:()=>F});var d=c(3814),e=c(6247),f=c(11917),g=c(25393),h=c(67882),i=c(56815),j=c(23761),k=c(14847),l=c(32956),m=c(29075),n=c(73596),o=c(5813),p=c(80990),q=c(49444),r=c(60557),s=c(90665),t=c(32905);function u({models:a,selectedModelIds:b,search:c,onSearchChange:e,onToggleModel:g,onAddSelected:h,onOpenProviders:i,onLoadMore:j,visibleModelCount:v,isAdding:w,isLoading:x}){let y,z=(y=c.trim().toLowerCase())?a.filter(a=>`${a.name} ${a.id} ${a.provider} ${a.input} ${a.tags.join(" ")}`.toLowerCase().includes(y)):a,A=c.trim().length>0,B=A?z:z.slice(0,v),C=!A&&v<z.length,D=z.length-v,E=b.filter(b=>{let c=a.find(a=>a.id===b);return!!c&&!c.alreadyAdded}).length,F=new Set(a.map(a=>a.provider)).size,G=a.filter(a=>a.alreadyAdded).length;return(0,d.jsxs)("div",{className:"rounded-[18px] border border-white/10 bg-[linear-gradient(180deg,rgba(10,15,26,0.94),rgba(7,11,20,0.96))] p-3",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"font-display text-[0.84rem] text-white",children:"Catalog"}),(0,d.jsx)("p",{className:"mt-1 text-[10px] leading-[0.98rem] text-slate-400",children:"Browse the full OpenClaw catalog. Unavailable entries show which provider setup is missing."})]}),(0,d.jsxs)("div",{className:"flex flex-wrap gap-1.5",children:[(0,d.jsxs)(o.E,{variant:"muted",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:[a.length," models"]}),(0,d.jsxs)(o.E,{variant:"muted",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:[F," providers"]}),(0,d.jsxs)(o.E,{variant:"muted",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:[G," added"]})]})]}),(0,d.jsxs)("div",{className:"relative mt-3",children:[(0,d.jsx)(k.A,{className:"pointer-events-none absolute left-3 top-1/2 h-3 w-3 -translate-y-1/2 text-slate-500"}),(0,d.jsx)(q.p,{value:c,onChange:a=>e(a.target.value),placeholder:"Search all discovered models",className:"h-8 pl-8 text-[11px]"})]}),x?(0,d.jsxs)("div",{className:"mt-3 rounded-[16px] border border-white/10 bg-white/[0.03] px-3 py-5 text-center text-[11px] text-slate-400",children:[(0,d.jsx)(f.A,{className:"mx-auto mb-2 h-4 w-4 animate-spin text-slate-400"}),"Loading OpenClaw catalog..."]}):B.length>0?(0,d.jsxs)("div",{className:"mt-3 max-h-[min(38vh,340px)] space-y-1 overflow-y-auto pr-1",children:[B.map(a=>{var c,e;let f=b.includes(a.id),h=a.alreadyAdded,i=!h&&(!1===a.available||a.missing),j=(0,r.a3)(a.provider)?(0,r.W2)(a.provider):null,k=(c=a,e=j?.shortLabel??a.provider,c.missing?`${e} is configured, but this model is not available locally yet. You can still add it now, then finish setup in Providers.`:!1===c.available?`${e} needs a one-time setup before this model can be used. You can add it now, then connect it in Add Models > Providers.`:"");return(0,d.jsxs)("button",{type:"button",disabled:h,"aria-pressed":f,onClick:()=>{h||g(a.provider,a.id)},className:(0,t.cn)("flex w-full items-start justify-between gap-2 rounded-[14px] border px-2.5 py-2 text-left transition-all",h?"cursor-not-allowed border-white/8 bg-white/[0.02] opacity-70":f?"border-cyan-300/35 bg-cyan-300/[0.08]":i?"border-amber-300/20 bg-amber-300/[0.06] hover:border-amber-300/30 hover:bg-amber-300/[0.08]":"border-white/8 bg-white/[0.03] hover:border-white/16 hover:bg-white/[0.05]"),children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-start gap-2",children:[(0,d.jsx)("div",{className:(0,t.cn)("mt-0.5 flex h-[16px] w-[16px] shrink-0 items-center justify-center rounded-md border",h?"border-white/10 bg-white/[0.03] text-slate-500":f?"border-cyan-300/50 bg-cyan-300/15 text-cyan-100":i?"border-amber-300/30 bg-amber-300/10 text-amber-100":"border-white/12 bg-white/[0.03] text-transparent"),children:h?(0,d.jsx)(l.A,{className:"h-2 w-2"}):f?(0,d.jsx)(m.A,{className:"h-2 w-2"}):(0,d.jsx)(n.A,{className:"h-2 w-2"})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"truncate text-[11px] font-medium text-white",children:a.name}),(0,d.jsx)("p",{className:"mt-0.5 truncate text-[9px] uppercase tracking-[0.16em] text-slate-500",children:a.id}),(0,d.jsxs)("div",{className:"mt-1 flex flex-wrap gap-1.5 text-[9px] text-slate-400",children:[(0,d.jsx)("span",{children:(0,r.S)(a.provider)}),a.input?(0,d.jsx)("span",{children:a.input}):null,a.contextWindow?(0,d.jsxs)("span",{children:[(0,s.FO)(a.contextWindow)," ctx"]}):null]}),i?(0,d.jsx)("p",{className:"mt-1 text-[9px] leading-4 text-amber-100/85",children:k}):null]})]}),(0,d.jsx)("div",{className:"shrink-0",children:h?(0,d.jsx)(o.E,{variant:"muted",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:"Already added"}):i?(0,d.jsx)(o.E,{variant:"warning",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:"Needs setup"}):a.recommended?(0,d.jsx)(o.E,{variant:"default",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:"Recommended"}):a.local?(0,d.jsx)(o.E,{variant:"success",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:"Local"}):(0,d.jsx)(o.E,{variant:"muted",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:"Remote"})})]},a.id)}),C?(0,d.jsx)("div",{className:"pt-2",children:(0,d.jsxs)(p.$,{type:"button",variant:"secondary",onClick:j,className:"h-8 w-full rounded-full px-3 text-[10px]",children:["Load ",Math.min(5,D)," more"]})}):null]}):(0,d.jsxs)("div",{className:"mt-3 rounded-[16px] border border-dashed border-white/10 bg-white/[0.03] px-3 py-5 text-center text-[11px] text-slate-400",children:[c.trim()?"No models matched this search.":"OpenClaw did not return any supported models yet.",(0,d.jsx)("div",{className:"mt-3",children:(0,d.jsx)(p.$,{type:"button",variant:"secondary",className:"h-8 rounded-full px-3 text-[10px]",onClick:()=>i(),children:"Open providers"})})]}),(0,d.jsxs)("div",{className:"mt-3 flex items-center justify-between gap-2 border-t border-white/10 pt-3",children:[(0,d.jsx)("p",{className:"text-[9px] leading-4 text-slate-400",children:E>0?`${E} model${1===E?"":"s"} selected`:"Choose one or more models to add"}),(0,d.jsx)(p.$,{type:"button",onClick:h,disabled:0===E||w,className:"h-7 rounded-full px-2.5 text-[10px]",children:w?"Adding...":"Add selected models"})]})]})}var v=c(8910);function w(a,b){let c=b.trim().toLowerCase();return c?a.filter(a=>`${a.name} ${a.id} ${a.tags.join(" ")}`.toLowerCase().includes(c)):a}function x({provider:a,models:b,selectedModelIds:c,search:e,onSearchChange:f,onToggleModel:g,onAddSelected:h,isAdding:i}){let j=b.filter(a=>a.recommended),l=c.filter(a=>!b.find(b=>b.id===a)?.alreadyAdded).length,m="openrouter"===a,n=(0,r.W2)(a).searchPlaceholder,s=b.length>8||!!n,t=w(j,e),u=w(b,e);return(0,d.jsxs)("div",{className:"rounded-[18px] border border-white/10 bg-[linear-gradient(180deg,rgba(10,15,26,0.94),rgba(7,11,20,0.96))] p-3",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,d.jsx)("div",{children:(0,d.jsx)("p",{className:"font-display text-[0.84rem] text-white",children:"Select models to add"})}),(0,d.jsxs)(o.E,{variant:"muted",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:[b.filter(a=>a.alreadyAdded).length," already added"]})]}),s?(0,d.jsxs)("div",{className:"relative mt-3",children:[(0,d.jsx)(k.A,{className:"pointer-events-none absolute left-3 top-1/2 h-3 w-3 -translate-y-1/2 text-slate-500"}),(0,d.jsx)(q.p,{value:e,onChange:a=>f(a.target.value),placeholder:n??"Search models",className:"h-8 pl-8 text-[11px]"})]}):null,m?(0,d.jsxs)(v.tU,{defaultValue:"recommended",className:"mt-3",children:[(0,d.jsxs)(v.j7,{className:"h-8 rounded-[16px] p-0.5",children:[(0,d.jsx)(v.Xi,{value:"recommended",className:"rounded-[13px] px-2 py-1 text-[10px]",children:"Recommended"}),(0,d.jsx)(v.Xi,{value:"all",className:"rounded-[13px] px-2 py-1 text-[10px]",children:"All models"})]}),(0,d.jsx)(v.av,{value:"recommended",children:(0,d.jsx)(y,{models:t,selectedModelIds:c,onToggleModel:g,emptyMessage:"No recommended matches. Switch to All models to browse the full catalog."})}),(0,d.jsx)(v.av,{value:"all",children:(0,d.jsx)(y,{models:u,selectedModelIds:c,onToggleModel:g,emptyMessage:"No models matched this search."})})]}):(0,d.jsx)("div",{className:"mt-3",children:(0,d.jsx)(y,{models:u,selectedModelIds:c,onToggleModel:g,emptyMessage:"No models matched this search."})}),(0,d.jsxs)("div",{className:"mt-3 flex items-center justify-between gap-2 border-t border-white/10 pt-3",children:[(0,d.jsx)("p",{className:"text-[9px] leading-4 text-slate-400",children:l>0?`${l} model${1===l?"":"s"} selected`:"Choose at least one model to add"}),(0,d.jsx)(p.$,{type:"button",onClick:h,disabled:0===l||i,className:"h-7 rounded-full px-2.5 text-[10px]",children:i?"Adding...":"Add selected models"})]})]})}function y({models:a,selectedModelIds:b,onToggleModel:c,emptyMessage:e}){return 0===a.length?(0,d.jsx)("div",{className:"rounded-[16px] border border-dashed border-white/10 bg-white/[0.03] px-3 py-5 text-center text-[11px] text-slate-400",children:e}):(0,d.jsx)("div",{className:"max-h-[min(28vh,220px)] space-y-1 overflow-y-auto pr-1",children:a.map(a=>{var e;let f=b.includes(a.id),g=!a.alreadyAdded&&(!1===a.available||a.missing);return(0,d.jsxs)("button",{type:"button",disabled:a.alreadyAdded,onClick:()=>c(a.id),className:(0,t.cn)("flex w-full items-start justify-between gap-2 rounded-[14px] border px-2.5 py-2 text-left transition-all",a.alreadyAdded?"cursor-not-allowed border-white/8 bg-white/[0.02] opacity-70":f?"border-cyan-300/35 bg-cyan-300/[0.08]":g?"border-amber-300/20 bg-amber-300/[0.06] hover:border-amber-300/30 hover:bg-amber-300/[0.08]":"border-white/8 bg-white/[0.03] hover:border-white/16 hover:bg-white/[0.05]"),children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-start gap-2",children:[(0,d.jsx)("div",{className:(0,t.cn)("mt-0.5 flex h-[16px] w-[16px] shrink-0 items-center justify-center rounded-md border",a.alreadyAdded?"border-white/10 bg-white/[0.03] text-slate-500":f?"border-cyan-300/50 bg-cyan-300/15 text-cyan-100":g?"border-amber-300/30 bg-amber-300/10 text-amber-100":"border-white/12 bg-white/[0.03] text-transparent"),children:a.alreadyAdded?(0,d.jsx)(l.A,{className:"h-2 w-2"}):f?(0,d.jsx)(m.A,{className:"h-2 w-2"}):(0,d.jsx)(n.A,{className:"h-2 w-2"})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"truncate text-[11px] font-medium text-white",children:a.name}),(0,d.jsx)("p",{className:"mt-0.5 truncate text-[9px] uppercase tracking-[0.16em] text-slate-500",children:a.id}),(0,d.jsxs)("div",{className:"mt-1 flex flex-wrap gap-1.5 text-[9px] text-slate-400",children:[(0,d.jsx)("span",{children:a.input}),a.contextWindow?(0,d.jsxs)("span",{children:[Intl.NumberFormat().format(a.contextWindow)," ctx"]}):null,a.isFree?(0,d.jsx)("span",{children:"free"}):null]}),g?(0,d.jsx)("p",{className:"mt-1 text-[9px] leading-4 text-amber-100/85",children:(e=a).missing?"This model is configured, but not available locally yet. You can still add it now, then finish setup in Providers.":!1===e.available?"This model needs provider setup before it will work. You can add it now, then connect the provider in Add Models > Providers.":""}):null]})]}),(0,d.jsx)("div",{className:"shrink-0",children:a.alreadyAdded?(0,d.jsx)(o.E,{variant:"muted",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:"Already added"}):g?(0,d.jsx)(o.E,{variant:"warning",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:"Needs setup"}):a.recommended?(0,d.jsx)(o.E,{variant:"default",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:"Recommended"}):a.local?(0,d.jsx)(o.E,{variant:"success",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:"Local"}):(0,d.jsx)(o.E,{variant:"muted",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:"Remote"})})]},a.id)})})}var z=c(45100),A=c(37674),B=c(89478),C=c(58372),D=c(43081);let E=()=>({flowState:"idle",connection:null,statusMessage:null,errorMessage:null,emptyState:null,manualCommand:null,docsUrl:null,models:[],selectedModelIds:[],apiKey:"",search:"",loaded:!1});function F({open:a,onOpenChange:b,snapshot:c,initialProvider:k=null,onSnapshotChange:l}){var m,n,s;let w,y,K,L,M=(0,r.d4)(k),[N,O]=(0,e.useState)("providers"),[P,Q]=(0,e.useState)(M),[R,S]=(0,e.useState)({}),[T,U]=(0,e.useState)(!1),[V,W]=(0,e.useState)(!1),[X,Y]=(0,e.useState)(""),[Z,$]=(0,e.useState)(5),[_,aa]=(0,e.useState)([]),[ab,ac]=(0,e.useState)(!1),[ad,ae]=(0,e.useState)(null);(0,e.useEffectEvent)(a=>{O("providers"),ay(a)}),(0,e.useEffectEvent)(async()=>{ac(!0),ae(null);try{let a=await fetch("/api/models/catalog"),b=await a.json().catch(()=>null);if(!a.ok||!b)throw Error(b?.error||"OpenClaw catalog could not be loaded.");aa(Array.isArray(b.models)?b.models:[])}catch(b){let a=b instanceof Error?b.message:"OpenClaw catalog could not be loaded.";aa([]),ae(a),D.o.error("OpenClaw catalog could not be loaded.",{description:a})}finally{ac(!1)}});let af=(0,r.a3)(P)?P:null,ag=af?H(R[af]):E(),ah=af?(0,r.W2)(af):null,ai=af?J(c,R,af):null,aj=!!(af&&ah)&&("discovery-loading"===ag.flowState||"connecting"===ag.flowState&&!ag.manualCommand||ag.statusMessage?.startsWith("Checking ")===!0&&!ai?.connected),ak="discovery-loading"===ag.flowState?`Discovering ${ah?.shortLabel??"provider"} models...`:"connecting"===ag.flowState?ag.statusMessage||`Connecting ${ah?.shortLabel??"provider"}...`:ag.statusMessage||`Checking ${ah?.shortLabel??"provider"}...`,al="discovery-loading"===ag.flowState?"Pulling the provider catalog into AgentOS.":"connecting"===ag.flowState?"Preparing the provider connection.":"Checking provider status before discovery.",am=!!(af&&ah),an="discovery-loading"===ag.flowState,ao=ag.models.length>0?"Refresh discovery":"Discover models",ap=an?"Discovering...":ao,aq=ai?.connected?"The provider is connected. Pull the available models into this workspace before choosing one.":ah?.connectKind==="oauth"?"Use your account login first, then pull the available models into this workspace.":"Connect the provider first, then pull the available models into this workspace.",ar=!!(ag.errorMessage&&ag.manualCommand&&(/gateway/i.test(ag.errorMessage)||/\bgateway\s+status\b/i.test(ag.manualCommand))),as=(0,e.useMemo)(()=>{let a=new Set(c.models.map(a=>a.id));return _.map(b=>({...b,alreadyAdded:a.has(b.id)})).sort((a,b)=>{let c=a.alreadyAdded;if(c!==b.alreadyAdded)return c?1:-1;let d=a.provider.localeCompare(b.provider);if(0!==d)return d;let e=!I(a);if(!I(b)!==e)return e?1:-1;let f=Number(a.recommended)+Number(a.local),g=Number(b.recommended)+Number(b.local);if(f!==g)return g-f;let h=a.name.localeCompare(b.name);return 0!==h?h:a.id.localeCompare(b.id)})},[_,c.models]),at=(0,e.useMemo)(()=>Object.values(R).flatMap(a=>a?.selectedModelIds??[]),[R]),au=(0,e.useMemo)(()=>new Map(as.map(a=>[a.id,a])),[as]),av=(0,e.useMemo)(()=>new Set(as.map(a=>a.provider)).size,[as]),aw=(0,e.useMemo)(()=>as.filter(a=>a.alreadyAdded).length,[as]),ax=(0,e.useMemo)(()=>{let a=new Set(at),b=new Map;for(let c of as){let d=c.provider;if(!a.has(c.id)||c.alreadyAdded)continue;let e=b.get(d)??[];e.push(c.id),b.set(d,e)}return b},[as,at]);async function ay(a){Q(a),O("providers");let b=H(R[a]);if(b.loaded&&b.models.length>0)return;let c=await az(a);"ollama"===a&&c?.connection.connected&&await aB(a,!0)}async function az(a){let b=(0,B.oZ)(a);aH(a,{flowState:"idle",errorMessage:null});try{let c=await b.getConnectionStatus(),d=H(R[a]);return aJ(a,c,c.emptyState?"discovery-empty":"idle",{models:d.loaded&&d.models.length>0?d.models:c.models}),c.snapshot&&l(c.snapshot),c}catch(b){return aH(a,{flowState:"auth-error",errorMessage:b instanceof Error?b.message:"Provider status could not be loaded.",loaded:!0}),null}}async function aA(a){let b=(0,B.oZ)(a),c=H(R[a]);aH(a,{flowState:"connecting",errorMessage:null,statusMessage:"openai-codex"===a?"Opening the ChatGPT connection flow...":`Connecting ${(0,r.W2)(a).shortLabel}...`});try{let d=await b.connect({apiKey:c.apiKey});aJ(a,d,"openai-codex"===a?"connecting":d.models.length?"discovery-success":"idle"),d.snapshot&&l(d.snapshot)}catch(b){aH(a,{flowState:"auth-error",errorMessage:b instanceof Error?b.message:"Provider connection failed."})}}async function aB(a,b=!1){let c=(0,B.oZ)(a),d=H(R[a]);if(b||"discovery-loading"!==d.flowState){aH(a,{flowState:"discovery-loading",errorMessage:null,statusMessage:"ollama"===a?"Checking the local Ollama runtime...":"Discovering available models..."});try{let b=await c.discoverModels();return aJ(a,b,b.models.length>0?"discovery-success":b.emptyState?"discovery-empty":"idle"),b.snapshot&&l(b.snapshot),b}catch(c){let b=aI(c);return aH(a,{flowState:"auth-error",errorMessage:c instanceof Error?c.message:"Model discovery failed.",manualCommand:b?.manualCommand??null,docsUrl:b?.docsUrl??null}),null}}}async function aC(a,b){let c=(0,B.oZ)(a),d=H(R[a]),e=(b?.selectedModelIds??d.selectedModelIds).filter(a=>{let b=au.get(a)??d.models.find(b=>b.id===a);return!!b&&!b.alreadyAdded});if(0===e.length)return!1;aH(a,{flowState:"connecting",errorMessage:null,statusMessage:"Adding selected models..."});try{let f=await c.addModels(e);return aJ(a,f,"add-success",{selectedModelIds:b?.selectedModelIds?d.selectedModelIds.filter(a=>!e.includes(a)):[]}),f.snapshot&&l(f.snapshot),b?.silent||D.o.success("Models added.",{description:f.message}),!0}catch(c){let b=aI(c);return aH(a,{flowState:"add-error",errorMessage:c instanceof Error?c.message:"Models could not be added.",connection:b?.connection??d.connection,models:b?.models??d.models,manualCommand:b?.manualCommand??null,docsUrl:b?.docsUrl??null}),!1}}async function aD(){let a=[...ax.keys()];if(0!==a.length){W(!0);try{let b=0;for(let[a,c]of ax.entries())((0,r.a3)(a)?await aC(a,{silent:!0,selectedModelIds:c}):await aE(a,c))&&(b+=c.length);b>0?D.o.success("Models added.",{description:`Added ${b} model${1===b?"":"s"} from ${a.length} provider${1===a.length?"":"s"}.`}):D.o.error("Models could not be added.",{description:"Select a different catalog entry or open the Providers tab and try again."})}catch(a){D.o.error("Models could not be added.",{description:a instanceof Error?a.message:"Select a different catalog entry or open the Providers tab and try again."})}finally{W(!1)}}}async function aE(a,b){let c=b.filter(a=>{let b=au.get(a);return b&&!b.alreadyAdded});if(0===c.length)return!1;let d=await fetch("/api/models/catalog",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:a,modelIds:c})}),e=await d.json().catch(()=>null);if(!d.ok||!e)throw Error(e?.error||e?.message||"Catalog models could not be added.");return e.snapshot&&l(e.snapshot),S(a=>Object.fromEntries(Object.entries(a).map(([a,b])=>[a,b?{...b,selectedModelIds:b.selectedModelIds.filter(a=>!c.includes(a))}:b]))),!0}async function aF(a){try{U(!0);let b=await fetch("/api/system/open-terminal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:a})}),c=await b.json().catch(()=>null);if(!b.ok)throw Error(c?.error||"Terminal could not be opened.");D.o.success("Terminal opened.",{description:"Finish the provider login there, then return here to discover models."})}catch(a){D.o.error("Unable to open Terminal.",{description:a instanceof Error?a.message:"Unknown terminal error."})}finally{U(!1)}}async function aG(a){try{await navigator.clipboard.writeText(a),D.o.success("Copied.",{description:"Command copied to your clipboard."})}catch{D.o.error("Copy failed.",{description:"Clipboard access is not available."})}}function aH(a,b){S(c=>({...c,[a]:{...H(c[a]),...b}}))}function aI(a){return a instanceof B.jZ?a.result:null}function aJ(a,b,c,d){aH(a,{flowState:c,connection:b.connection,statusMessage:b.message,errorMessage:null,emptyState:b.emptyState??null,manualCommand:b.manualCommand??null,docsUrl:b.docsUrl??null,models:b.models,loaded:!0,...d})}return(0,d.jsx)(A.lG,{open:a,onOpenChange:b,children:(0,d.jsxs)(A.Cf,{className:"flex h-[80dvh] max-h-[80dvh] w-[calc(100vw-16px)] max-w-[760px] flex-col gap-0 overflow-hidden p-0 sm:h-[min(80dvh,700px)] sm:max-h-[min(80dvh,700px)] sm:w-[min(760px,calc(100vw-40px))]",children:[(0,d.jsxs)(A.c7,{className:"shrink-0 border-b border-white/10 bg-[linear-gradient(180deg,rgba(12,18,31,0.96),rgba(9,13,24,0.98))] px-4 py-3.5 pr-10",children:[(0,d.jsx)(A.L3,{className:"text-[1.05rem]",children:"Add Models"}),(0,d.jsx)(A.rr,{className:"max-w-[560px] text-[11px] leading-[1rem] text-slate-400",children:"Connect or refresh providers first, then browse the catalog when you want to add models in bulk."})]}),(0,d.jsxs)(v.tU,{value:N,onValueChange:a=>O(a),className:"min-h-0 flex flex-1 flex-col",children:[(0,d.jsx)("div",{className:"shrink-0 border-b border-white/10 px-4 py-3",children:(0,d.jsxs)(v.j7,{className:"h-8 rounded-[16px] p-0.5",children:[(0,d.jsx)(v.Xi,{value:"providers",className:"rounded-[13px] px-2.5 py-1 text-[10px]",children:"Providers"}),(0,d.jsx)(v.Xi,{value:"catalog",className:"rounded-[13px] px-2.5 py-1 text-[10px]",children:"Catalog"})]})}),(0,d.jsxs)("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain",children:[(0,d.jsx)(v.av,{value:"providers",className:"!mt-0 m-0 h-full",children:(0,d.jsxs)("div",{className:"space-y-4 px-3 py-3 sm:px-4 sm:py-4",children:[(0,d.jsxs)("div",{className:"rounded-[22px] border border-white/10 bg-[linear-gradient(180deg,rgba(13,20,34,0.94),rgba(9,13,24,0.96))] p-3",children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"font-display text-[0.84rem] text-white",children:"All providers"}),(0,d.jsx)("p",{className:"mt-1 text-[9px] leading-[0.95rem] text-slate-400",children:"Connect or refresh a provider, then return to the catalog when you want to add models in one pass."})]}),(0,d.jsxs)(o.E,{variant:"muted",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:[r.y8.length," total"]})]}),(0,d.jsxs)("div",{className:"relative mt-2.5",children:[(0,d.jsx)("div",{className:"pointer-events-none absolute inset-y-0 left-0 z-10 w-6 bg-gradient-to-r from-[rgba(13,20,34,0.96)] to-transparent"}),(0,d.jsx)("div",{className:"pointer-events-none absolute inset-y-0 right-0 z-10 w-6 bg-gradient-to-l from-[rgba(13,20,34,0.96)] to-transparent"}),(0,d.jsx)("div",{className:"-mx-1 overflow-x-auto overscroll-x-contain pb-1",children:(0,d.jsx)("div",{className:"flex min-w-max gap-2.5 px-1",children:r.y8.map(a=>(0,d.jsx)("div",{className:"w-[236px] shrink-0 snap-start sm:w-[244px]",children:(0,d.jsx)(z.I,{descriptor:a,active:af===a.id,compact:!0,connected:J(c,R,a.id).connected,detail:J(c,R,a.id).detail,onClick:()=>{ay(a.id)}})},a.id))})}),(0,d.jsx)("div",{className:"pointer-events-none absolute bottom-1.5 right-3 z-10 rounded-full border border-white/10 bg-slate-950/70 px-2 py-0.5 text-[8px] uppercase tracking-[0.14em] text-slate-400",children:"Scroll ->"})]})]}),(0,d.jsx)("div",{className:"rounded-[22px] border border-white/10 bg-[linear-gradient(180deg,rgba(11,18,32,0.96),rgba(6,10,18,0.98))] p-3",children:af&&ah?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,d.jsx)("div",{children:(0,d.jsx)("p",{className:"font-display text-[0.88rem] text-white",children:ah.label})}),(0,d.jsx)(o.E,{variant:ai?.connected?"success":"muted",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:ai?.connected?"Connected":"Not connected"})]}),(0,d.jsx)("div",{className:"mt-3 flex flex-wrap gap-1",children:(m=af,n=ag,s=ai,w="ollama"===m?!!(s?.connected||n.emptyState):!!(s?.connected||n.manualCommand),y=n.models.length>0||!!n.emptyState,K=n.selectedModelIds.length>0,L="add-success"===n.flowState,[{label:"Choose provider",status:"done"},{label:"ollama"===m?"Local check":"Connect",status:"connecting"!==n.flowState||w?w?"done":"pending":"active"},{label:"Discover",status:"discovery-loading"===n.flowState?"active":y?"done":"pending"},{label:"Select",status:L?"done":K?"active":"pending"},{label:"Add",status:L?"done":"add-error"===n.flowState?"active":"pending"}]).map(a=>(0,d.jsxs)("div",{className:(0,t.cn)("inline-flex items-center gap-1.5 rounded-full border px-2 py-0.5 text-[9px] uppercase tracking-[0.14em]","done"===a.status?"border-emerald-300/20 bg-emerald-300/10 text-emerald-100":"active"===a.status?"border-cyan-300/20 bg-cyan-300/10 text-cyan-100":"border-white/10 bg-white/[0.03] text-slate-500"),children:[(0,d.jsx)("span",{className:(0,t.cn)("h-1.5 w-1.5 rounded-full","done"===a.status?"bg-emerald-300":"active"===a.status?"bg-cyan-300":"bg-slate-600")}),a.label]},a.label))}),ag.statusMessage&&!aj?(0,d.jsx)("div",{className:"mt-3 rounded-[16px] border border-white/10 bg-white/[0.04] px-3 py-2",children:(0,d.jsx)("p",{className:"text-[11px] text-slate-200",children:ag.statusMessage})}):null,ag.errorMessage?(0,d.jsx)("div",{className:"mt-3 rounded-[16px] border border-rose-400/20 bg-rose-400/[0.08] px-3 py-2 text-[11px] text-rose-100",children:ag.errorMessage}):null,ar?(0,d.jsxs)("div",{className:"mt-3 rounded-[16px] border border-amber-300/20 bg-amber-300/[0.08] px-3 py-2",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-[11px] font-medium text-amber-50",children:"Gateway recovery"}),(0,d.jsx)("p",{className:"mt-1 max-w-[480px] text-[10px] leading-[0.98rem] text-amber-100/78",children:"Automatic Gateway auth repair did not finish. Inspect Gateway status, then retry adding models."})]}),(0,d.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,C.T)(ag.manualCommand)?(0,d.jsx)(p.$,{type:"button",variant:"secondary",size:"sm",className:"h-7 rounded-full px-2.5 text-[10px]",disabled:T,onClick:()=>{aF(ag.manualCommand||"")},children:T?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(f.A,{className:"mr-1.5 h-3 w-3 animate-spin"}),"Opening..."]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(g.A,{className:"mr-1.5 h-3 w-3"}),"Open Terminal"]})}):null,(0,d.jsxs)(p.$,{type:"button",variant:"ghost",size:"sm",className:"h-7 rounded-full px-2.5 text-[10px]",onClick:()=>{aG(ag.manualCommand||"")},children:[(0,d.jsx)(h.A,{className:"mr-1.5 h-3 w-3"}),"Copy command"]})]})]}),(0,d.jsx)("div",{className:"mt-2.5 overflow-x-auto rounded-[14px] border border-white/10 bg-slate-950/60 px-3 py-2",children:(0,d.jsx)("code",{className:"text-[10px] text-slate-200",children:ag.manualCommand})})]}):null,aj?(0,d.jsx)("div",{className:"mt-4 flex min-h-[260px] items-center justify-center overflow-hidden rounded-[24px] border border-cyan-300/20 bg-[radial-gradient(circle_at_top,rgba(34,211,238,0.16),rgba(8,15,28,0.98)_70%)] px-4 py-10 text-center shadow-[0_22px_52px_rgba(7,11,20,0.32)]",children:(0,d.jsxs)("div",{className:"relative flex max-w-[340px] flex-col items-center",children:[(0,d.jsx)("div",{className:"absolute inset-x-8 top-8 h-px bg-gradient-to-r from-transparent via-cyan-200/70 to-transparent blur-sm animate-pulse"}),(0,d.jsx)("div",{className:"absolute inset-x-8 bottom-8 h-px bg-gradient-to-r from-transparent via-cyan-200/30 to-transparent blur-sm animate-pulse [animation-delay:180ms]"}),(0,d.jsx)("div",{className:"absolute left-8 top-8 h-24 w-24 rounded-full border border-cyan-300/15 bg-cyan-300/[0.04] blur-[1px] animate-pulse"}),(0,d.jsx)("div",{className:"absolute right-10 top-14 h-16 w-16 rounded-full border border-cyan-300/10 bg-cyan-300/[0.03] blur-[1px] animate-pulse [animation-delay:120ms]"}),(0,d.jsx)("div",{className:"absolute bottom-10 left-1/2 h-20 w-20 -translate-x-1/2 rounded-full border border-cyan-300/10 bg-cyan-300/[0.03] blur-[1px] animate-pulse [animation-delay:240ms]"}),(0,d.jsx)("div",{className:"relative mb-4 flex h-16 w-16 items-center justify-center rounded-full border border-cyan-300/20 bg-cyan-300/[0.08] shadow-[0_0_0_8px_rgba(34,211,238,0.05)]",children:(0,d.jsx)(f.A,{className:"h-8 w-8 animate-spin text-cyan-200"})}),(0,d.jsx)("p",{className:"font-display text-[1.1rem] leading-[1.2rem] tracking-[0.01em] text-white",children:ak}),(0,d.jsx)("p",{className:"mt-2 max-w-[280px] text-[11px] leading-[1rem] text-slate-400",children:al}),(0,d.jsxs)("div",{className:"mt-4 flex gap-1.5",children:[(0,d.jsx)("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-cyan-300/90"}),(0,d.jsx)("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-cyan-300/60 [animation-delay:120ms]"}),(0,d.jsx)("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-cyan-300/30 [animation-delay:240ms]"})]})]})}):(0,d.jsxs)(d.Fragment,{children:["openai-codex"===af?(0,d.jsxs)("div",{className:"mt-4 rounded-[20px] border border-white/10 bg-white/[0.03] p-3",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"font-display text-[0.88rem] text-white",children:"Connect your ChatGPT account"}),(0,d.jsx)("p",{className:"mt-1 max-w-[500px] text-[10px] leading-[0.98rem] text-slate-400",children:"This uses OpenClaw's account-based login flow. No API key is required."})]}),(0,d.jsx)(p.$,{type:"button",className:"h-8 rounded-full px-3 text-[10px]",disabled:"connecting"===ag.flowState&&!ag.manualCommand,onClick:()=>{aA(af)},children:"connecting"!==ag.flowState||ag.manualCommand?"Connect ChatGPT":(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(f.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),"Connecting..."]})})]}),ag.manualCommand?(0,d.jsxs)("div",{className:"mt-3 rounded-[16px] border border-cyan-300/15 bg-cyan-300/[0.07] p-3",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-[11px] font-medium text-cyan-50",children:"Finish sign-in in Terminal"}),(0,d.jsx)("p",{className:"mt-1 max-w-[480px] text-[10px] leading-[0.98rem] text-cyan-100/80",children:"Open Terminal, complete the provider login, then return here and check discovery."})]}),(0,d.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,d.jsx)(p.$,{type:"button",variant:"secondary",size:"sm",className:"h-7 rounded-full px-2.5 text-[10px]",disabled:T,onClick:()=>{aF(ag.manualCommand||"")},children:T?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(f.A,{className:"mr-1.5 h-3 w-3 animate-spin"}),"Opening..."]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(g.A,{className:"mr-1.5 h-3 w-3"}),"Open Terminal"]})}),(0,d.jsxs)(p.$,{type:"button",variant:"ghost",size:"sm",className:"h-7 rounded-full px-2.5 text-[10px]",onClick:()=>{aG(ag.manualCommand||"")},children:[(0,d.jsx)(h.A,{className:"mr-1.5 h-3 w-3"}),"Copy command"]}),(0,d.jsxs)(p.$,{type:"button",variant:"ghost",size:"sm",className:"h-7 rounded-full px-2.5 text-[10px]",onClick:()=>{aB(af)},children:[(0,d.jsx)(i.A,{className:"mr-1.5 h-3 w-3"}),"I've connected it"]})]})]}),(0,d.jsx)("div",{className:"mt-2.5 overflow-x-auto rounded-[14px] border border-white/10 bg-slate-950/60 px-3 py-2",children:(0,d.jsx)("code",{className:"text-[10px] text-slate-200",children:ag.manualCommand})})]}):null]}):null,"apiKey"===ah.connectKind?(0,d.jsx)("div",{className:"mt-4 rounded-[20px] border border-white/10 bg-white/[0.03] p-3",children:(0,d.jsxs)("div",{className:"flex flex-wrap items-end gap-3",children:[(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("label",{className:"block text-[9px] uppercase tracking-[0.16em] text-slate-500",children:"API key"}),(0,d.jsx)(q.p,{type:"password",value:ag.apiKey,onChange:a=>aH(af,{apiKey:a.target.value}),placeholder:"openrouter"===af?"sk-or-v1-...":"Paste API key",className:"mt-1.5 h-8 text-[11px]"})]}),(0,d.jsx)(p.$,{type:"button",className:"h-8 rounded-full px-3 text-[10px]",disabled:"connecting"===ag.flowState||!ag.apiKey.trim(),onClick:()=>{aA(af)},children:"connecting"===ag.flowState?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(f.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),"Connecting..."]}):`Connect ${ah.shortLabel}`})]})}):null,am?(0,d.jsx)("div",{className:"mt-4 rounded-[24px] border border-cyan-300/20 bg-[linear-gradient(180deg,rgba(17,28,47,0.98),rgba(10,16,28,0.98))] p-4 shadow-[0_18px_42px_rgba(7,11,20,0.28)]",children:(0,d.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"font-display text-[0.92rem] text-white",children:an?"Discovering models...":ao}),(0,d.jsx)("p",{className:"mt-1 max-w-[520px] text-[11px] leading-[1rem] text-slate-400",children:an?"OpenClaw is pulling the provider catalog into this workspace.":aq})]}),(0,d.jsxs)("div",{className:"flex shrink-0 flex-wrap gap-2",children:[(0,d.jsx)(p.$,{type:"button",variant:"default",className:"h-11 rounded-full px-5 text-[12px] font-medium",disabled:an,onClick:()=>{aB(af)},children:an?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(f.A,{className:"mr-2 h-4 w-4 animate-spin"}),"Discovering..."]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(i.A,{className:"mr-2 h-4 w-4"}),ap]})}),(0,d.jsx)(p.$,{type:"button",variant:"ghost",size:"sm",className:"h-11 rounded-full px-4 text-[10px]",onClick:()=>{az(af)},children:"Refresh status"})]})]})}):null,ag.emptyState?(0,d.jsx)(G,{emptyState:ag.emptyState,onCopyCommand:a=>{aG(a)}}):null,ag.models.length>0?(0,d.jsx)("div",{className:"mt-5",children:(0,d.jsx)(x,{provider:af,models:ag.models,selectedModelIds:ag.selectedModelIds,search:ag.search,onSearchChange:a=>aH(af,{search:a}),onToggleModel:a=>{aH(af,{selectedModelIds:ag.selectedModelIds.includes(a)?ag.selectedModelIds.filter(b=>b!==a):[...ag.selectedModelIds,a]})},onAddSelected:()=>{aC(af)},isAdding:"connecting"===ag.flowState&&"Adding selected models..."===ag.statusMessage})}):null,"add-success"===ag.flowState?(0,d.jsxs)("div",{className:"mt-3 flex items-center gap-2.5 rounded-[16px] border border-emerald-300/20 bg-emerald-300/[0.08] px-3 py-2",children:[(0,d.jsx)(j.A,{className:"h-3.5 w-3.5 text-emerald-200"}),(0,d.jsx)("p",{className:"text-[11px] text-emerald-50",children:ag.statusMessage||"Models were added successfully."})]}):null,ag.docsUrl?(0,d.jsx)("a",{href:ag.docsUrl,target:"_blank",rel:"noreferrer",className:"mt-3 inline-flex text-[10px] text-slate-300 underline underline-offset-4",children:"OpenClaw model docs"}):null]})]}):(0,d.jsx)("div",{className:"flex min-h-[180px] items-center justify-center rounded-[20px] border border-dashed border-white/10 bg-white/[0.02] px-4 py-6 text-center",children:(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"font-display text-[0.88rem] text-white",children:"Choose a provider to begin"}),(0,d.jsx)("p",{className:"mt-1.5 max-w-[360px] text-[11px] leading-[0.98rem] text-slate-400",children:"Start with ChatGPT, OpenRouter, Gemini, DeepSeek, Mistral, or Ollama Local. The flow will guide you through connect, discovery, selection, and add."})]})})})]})}),(0,d.jsx)(v.av,{value:"catalog",className:"!mt-0 m-0 h-full",children:(0,d.jsxs)("div",{className:"space-y-4 px-3 py-3 sm:px-4 sm:py-4",children:[(0,d.jsx)("div",{className:"rounded-[20px] border border-white/10 bg-[linear-gradient(180deg,rgba(11,18,32,0.96),rgba(6,10,18,0.98))] p-3",children:(0,d.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"font-display text-[0.84rem] text-white",children:"OpenClaw catalog"}),(0,d.jsx)("p",{className:"mt-1 text-[9px] leading-[0.95rem] text-slate-400",children:"Search the full OpenClaw model catalog, then load five more whenever you want to extend the list."})]}),(0,d.jsxs)("div",{className:"flex flex-wrap gap-1.5",children:[(0,d.jsxs)(o.E,{variant:"muted",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:[as.length," models"]}),(0,d.jsxs)(o.E,{variant:"muted",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:[av," providers"]}),(0,d.jsxs)(o.E,{variant:"muted",className:"px-1.5 py-0.5 text-[9px] tracking-[0.12em]",children:[aw," added"]})]})]})}),ad?(0,d.jsx)("div",{className:"rounded-[18px] border border-rose-400/20 bg-rose-400/[0.08] px-4 py-3 text-[11px] text-rose-100",children:ad}):null,(0,d.jsx)(u,{models:as,selectedModelIds:at,search:X,onSearchChange:Y,onToggleModel:(a,b)=>{let c=H(R[a]);aH(a,{selectedModelIds:c.selectedModelIds.includes(b)?c.selectedModelIds.filter(a=>a!==b):[...c.selectedModelIds,b]})},onAddSelected:()=>{aD()},onOpenProviders:a=>{O("providers"),(0,r.a3)(a)&&ay(a)},onLoadMore:()=>$(a=>a+5),visibleModelCount:Z,isAdding:V,isLoading:ab&&0===as.length}),ab||0!==as.length||ad?null:(0,d.jsx)("div",{className:"rounded-[18px] border border-dashed border-white/10 bg-white/[0.02] px-4 py-5 text-center text-[11px] text-slate-400",children:"OpenClaw did not return any supported models yet. Check your installation or refresh providers."})]})})]})]})]})})}function G({emptyState:a,onCopyCommand:b}){return(0,d.jsxs)("div",{className:"mt-3 rounded-[20px] border border-white/10 bg-white/[0.03] p-3",children:[(0,d.jsx)("p",{className:"font-display text-[0.88rem] text-white",children:a.title}),(0,d.jsx)("p",{className:"mt-1 max-w-[520px] text-[11px] leading-[0.98rem] text-slate-400",children:a.description}),a.commands?.length?(0,d.jsx)("div",{className:"mt-3 space-y-1.5",children:a.commands.map(a=>(0,d.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2 rounded-[14px] border border-white/10 bg-slate-950/60 px-3 py-2",children:[(0,d.jsx)("code",{className:"text-[10px] text-slate-200",children:a}),(0,d.jsxs)(p.$,{type:"button",size:"sm",variant:"ghost",className:"h-7 rounded-full px-2.5 text-[10px]",onClick:()=>b(a),children:[(0,d.jsx)(h.A,{className:"mr-1.5 h-3 w-3"}),"Copy"]})]},a))}):null]})}function H(a){return a||E()}function I(a){return!a.missing&&!1!==a.available}function J(a,b,c){let d=b[c]?.connection;if(d)return d;let e=a.diagnostics.modelReadiness.authProviders.find(a=>a.provider===c),f=a.models.filter(a=>{var b,d;let e;return b=c,d=a.id,e=a.provider||d.split("/",1)[0]||"","openai-codex"===b?"openai-codex"===e||"openai"===e:e===b}).length;if("ollama"===c)return{provider:c,connected:f>0,canConnect:!0,needsTerminal:!1,detail:f>0?`${f} model${1===f?"":"s"} already visible in AgentOS.`:"Detect local models from this machine."};let g=!!e?.connected;return{provider:c,connected:g,canConnect:!0,needsTerminal:"openai-codex"===c,detail:g?e?.detail||(0,r.W2)(c).helperText:f>0?`${f} model${1===f?"":"s"} are already saved in AgentOS. Connect ${(0,r.W2)(c).shortLabel} to use them.`:(0,r.W2)(c).helperText}}},49444:(a,b,c)=>{"use strict";c.d(b,{p:()=>g});var d=c(3814),e=c(6247),f=c(32905);let g=e.forwardRef(({className:a,type:b,...c},e)=>(0,d.jsx)("input",{type:b,className:(0,f.cn)("flex h-11 w-full rounded-2xl border border-white/10 bg-white/5 px-4 py-2 text-sm text-white placeholder:text-slate-500 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cyan-400/60 disabled:cursor-not-allowed disabled:opacity-50",a),ref:e,...c}));g.displayName="Input"},58372:(a,b,c)=>{"use strict";function d(a){let b=function(a){let b=a?.trim();if(!b)return[];let c=[],d=0,e=0,f="unquoted";for(;e<b.length;){let a=b[e],g=b[e+1];if("single"===f){"'"===a&&(f="unquoted"),e+=1;continue}if("double"===f){if("\\"===a){e+=2;continue}'"'===a&&(f="unquoted"),e+=1;continue}if("'"===a){f="single",e+=1;continue}if('"'===a){f="double",e+=1;continue}if("&"===a&&"&"===g){let a=b.slice(d,e).trim();if(!a)return[];c.push(a),e+=2,d=e;continue}if(";"===a||"|"===a||"\n"===a||"\r"===a||"`"===a||"<"===a||">"===a||"$"===a&&"("===g)return[];e+=1}let g=b.slice(d).trim();return g?(c.push(g),c):[]}(a);return 0!==b.length&&b.every(a=>{var b;return!!("openclaw"===(b=(function(a){let b=a?.trim();if(!b)return null;let c=0;for(;c<b.length&&/\s/.test(b[c]);)c+=1;if(c>=b.length)return null;let d="",e="unquoted";for(;c<b.length;){let a=b[c];if("unquoted"===e){if(/\s/.test(a))break;if("'"===a){e="single",c+=1;continue}if('"'===a){e="double",c+=1;continue}if("\\"===a&&c+1<b.length){d+=b[c+1],c+=2;continue}d+=a,c+=1;continue}if("single"===e){if("'"===a){e="unquoted",c+=1;continue}d+=a,c+=1;continue}if('"'===a){e="unquoted",c+=1;continue}if("\\"===a&&c+1<b.length){d+=b[c+1],c+=2;continue}d+=a,c+=1}return d})(a)?.toLowerCase())||b?.endsWith("/openclaw")||b?.endsWith("\\openclaw"))})}c.d(b,{T:()=>d})},59056:(a,b,c)=>{"use strict";c.d(b,{v:()=>e});var d=c(6247);function e(a){let[b,c]=(0,d.useState)(a),[e,f]=(0,d.useState)("connecting"),g=async(a={})=>{let b=a.force?"/api/snapshot?force=true":"/api/snapshot",e=await fetch(b,{cache:"no-store"}),g=await e.json();return(0,d.startTransition)(()=>{c(a=>!function(a,b){let c=a.revision??0,d=b.revision??0;if(c!==d)return c>d;if("live"===b.mode&&"fallback"===a.mode)return!1;if("fallback"===b.mode&&"live"===a.mode)return!0;let e=Date.parse(a.generatedAt),f=Date.parse(b.generatedAt);return!!(Number.isNaN(e)||Number.isNaN(f))||e>=f}(g,a)?a:g),f("live")}),g};return{snapshot:b,connectionState:e,refresh:async()=>{await g()},refreshSnapshot:g,setSnapshot:c}}},60251:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,83316,23)),Promise.resolve().then(c.t.bind(c,64943,23)),Promise.resolve().then(c.t.bind(c,87907,23)),Promise.resolve().then(c.t.bind(c,966,23)),Promise.resolve().then(c.t.bind(c,19698,23)),Promise.resolve().then(c.t.bind(c,12582,23)),Promise.resolve().then(c.t.bind(c,53635,23)),Promise.resolve().then(c.t.bind(c,4246,23))},60557:(a,b,c)=>{"use strict";c.d(b,{S:()=>h,W2:()=>e,a3:()=>f,d4:()=>g,y8:()=>d});let d=[{id:"openai-codex",label:"ChatGPT",shortLabel:"ChatGPT",description:"Connect your ChatGPT account and pull in Codex-ready models.",category:"primary",connectKind:"oauth",accent:"from-[#d8f5eb] via-[#ebfbf5] to-white",helperText:"Account-based login with the OpenClaw provider flow."},{id:"openrouter",label:"OpenRouter",shortLabel:"OpenRouter",description:"Add an API key, discover the full catalog, and curate the models you want.",category:"primary",connectKind:"apiKey",accent:"from-[#fff2d7] via-[#fff7ea] to-white",helperText:"Best for broad model access and curated remote routes.",searchPlaceholder:"Search OpenRouter models"},{id:"ollama",label:"Ollama Local",shortLabel:"Ollama",description:"Discover models already available on this machine and add them instantly.",category:"primary",connectKind:"local",accent:"from-[#deefff] via-[#f2f8ff] to-white",helperText:"Local-first discovery with helpful pull commands when empty."},{id:"anthropic",label:"Anthropic",shortLabel:"Anthropic",description:"Paste an API key and add Claude models through the same flow.",category:"other",connectKind:"apiKey",accent:"from-[#efe9ff] via-[#f7f3ff] to-white",helperText:"Simple API key connection."},{id:"openai",label:"OpenAI API",shortLabel:"OpenAI",description:"Connect a standard OpenAI API key for direct GPT model access.",category:"other",connectKind:"apiKey",accent:"from-[#e8f8e8] via-[#f4fbf4] to-white",helperText:"Use this for API-key-based OpenAI routing."},{id:"google",label:"Gemini",shortLabel:"Gemini",description:"Add a Gemini API key, discover Google models, and pick the routes you want.",category:"other",connectKind:"apiKey",accent:"from-[#e6f7ff] via-[#f4fbff] to-white",helperText:"Simple API key connection.",searchPlaceholder:"Search Gemini models"},{id:"deepseek",label:"DeepSeek",shortLabel:"DeepSeek",description:"Add a DeepSeek API key, discover the catalog, and add the models you need.",category:"other",connectKind:"apiKey",accent:"from-[#e7eeff] via-[#f4f7ff] to-white",helperText:"Simple API key connection.",searchPlaceholder:"Search DeepSeek models"},{id:"mistral",label:"Mistral",shortLabel:"Mistral",description:"Add a Mistral API key, discover Mistral and Codestral models, and curate your routes.",category:"other",connectKind:"apiKey",accent:"from-[#f2e8ff] via-[#fbf7ff] to-white",helperText:"Simple API key connection.",searchPlaceholder:"Search Mistral models"},{id:"xai",label:"xAI",shortLabel:"xAI",description:"Use an xAI API key to bring Grok models into AgentOS.",category:"other",connectKind:"apiKey",accent:"from-[#ffe6ea] via-[#fff3f5] to-white",helperText:"Simple API key connection."}];function e(a){let b=d.find(b=>b.id===a);if(!b)throw Error(`Unknown model provider: ${a}`);return b}function f(a){return"string"==typeof a&&d.some(b=>b.id===a)}function g(a){if("gemini"===a)return"google";if(f(a))return a;if(a&&"object"==typeof a&&"id"in a){let b=a.id;if("gemini"===b)return"google";if(f(b))return b}return null}function h(a){let b=d.find(b=>b.id===a);return b?b.shortLabel:a.split("-").map(a=>a?a[0].toUpperCase()+a.slice(1):a).join(" ")}d.filter(a=>"primary"===a.category),d.filter(a=>"other"===a.category)},60740:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,83316,23))},61727:(a,b,c)=>{"use strict";c.d(b,{A:()=>l});var d=c(3814),e=c(6247),f=c(20491),g=c(32905);let h=f.Kq,i=f.bL,j=f.l9,k=e.forwardRef(({className:a,sideOffset:b=6,children:c,...e},h)=>(0,d.jsx)(f.ZL,{children:(0,d.jsx)(f.UC,{ref:h,sideOffset:b,className:(0,g.cn)("relative z-[9999] overflow-hidden rounded-[18px] border border-cyan-300/10 bg-slate-950/45 px-4 py-3 text-xs text-slate-100 shadow-[0_18px_50px_rgba(0,0,0,0.24)] backdrop-blur-xl",a),...e,children:(0,d.jsx)("div",{className:"relative z-10",children:c})})}));function l({label:a,side:b,surfaceTheme:c,panelCollapsed:e,children:f}){return(0,d.jsx)(h,{delayDuration:120,children:(0,d.jsxs)(i,{children:[(0,d.jsx)(j,{asChild:!0,children:f}),(0,d.jsx)(k,{side:b,align:"center",sideOffset:10,className:(0,g.cn)("rounded-[10px] px-2.5 py-1.5 text-[10px] font-medium leading-none tracking-[0.12em] whitespace-nowrap shadow-[0_16px_40px_rgba(0,0,0,0.32)]","light"===c?e?"border border-slate-200/80 bg-white/96 text-slate-900 shadow-[0_16px_40px_rgba(15,23,42,0.18)]":"border border-white/10 bg-slate-950/94 text-white shadow-[0_16px_40px_rgba(0,0,0,0.36)]":"border border-white/10 bg-slate-950/92 text-slate-100"),children:a})]})})}k.displayName=f.UC.displayName},63381:()=>{},69903:(a,b,c)=>{"use strict";c.d(b,{nK:()=>l,TY:()=>f,qk:()=>j,nd:()=>g});var d=c(9494),e=c(92078);function f(a,b={}){let c=(0,e.g0)(b.policy?.preset??"worker",b.policy),g=(0,e.Cf)(c.preset),h=(0,d.iq)(c.preset,b.heartbeat);return{workspaceId:a,modelId:b.modelId??"",name:b.name??g.defaultName,emoji:b.emoji??g.defaultEmoji,theme:b.theme??g.defaultTheme,avatar:b.avatar??"",policy:c,heartbeat:h,channelIds:Array.from(new Set((b.channelIds??[]).filter(a=>"string"==typeof a&&!!a.trim())))}}function g(a,b){let c=a.diagnostics.modelReadiness.defaultModelReady?h(a.diagnostics.modelReadiness.resolvedDefaultModel||a.diagnostics.modelReadiness.defaultModel):null;if(c&&i(a,c))return c;let d=a.agents.filter(a=>!b||a.workspaceId===b).map(a=>h(a.modelId)).find(b=>b&&i(a,b));if(d)return d;let e=h(a.diagnostics.modelReadiness.recommendedModelId);return e&&i(a,e)?e:a.models.map(a=>h(a.id)).find(b=>b&&i(a,b))??""}function h(a){let b=a?.trim();return b&&"unassigned"!==b?b:null}function i(a,b){let c=a.models.find(a=>a.id===b);return!!c&&!0!==c.missing&&!1!==c.available}function j(a,b,c){var d,e;let f,g,h=(d=b,e=c,f=k(d??""),g=k(e)||"agent",f?`${f}-${g}`:g);if(!h)return"";let i=new Set(a.map(a=>a.id));if(!i.has(h))return h;let j=2,l=`${h}-${j}`;for(;i.has(l);)j+=1,l=`${h}-${j}`;return l}function k(a){return a.toLowerCase().normalize("NFKD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function l(a,b){let c=(0,e.Cf)(a.policy.preset),f=(0,e.Cf)(b),g=(0,e.g0)(b);return{...a,name:a.name&&a.name!==c.defaultName?a.name:f.defaultName,emoji:a.emoji&&a.emoji!==c.defaultEmoji?a.emoji:f.defaultEmoji,theme:a.theme&&a.theme!==c.defaultTheme?a.theme:f.defaultTheme,policy:g,heartbeat:(0,d.I$)(a.heartbeat,a.policy.preset,b)}}},72349:(a,b,c)=>{"use strict";function d(a){return a.diagnostics.installed&&a.diagnostics.rpcOk}function e(a){var b;return d(a)&&(a.diagnostics.modelReadiness.ready||!!(b=a).agents.map(a=>{var b;let c;return b=a.modelId,(c=b?.trim())&&"unassigned"!==c?c:null}).find(a=>{var c,d,e,f,g;let h;return a&&(c=b,d=a,!!(h=(e=c,f=d,e.models.find(a=>a.id===f)))&&!0!==(g=h).missing&&!1!==g.available)}))}function f(a){var b;return a.diagnostics.installed&&a.diagnostics.rpcOk&&(b=a).diagnostics.runtime.stateWritable&&b.diagnostics.runtime.sessionStoreWritable}c.d(b,{X2:()=>e,h6:()=>d,iN:()=>f})},74952:(a,b,c)=>{"use strict";c.d(b,{T:()=>g});var d=c(3814),e=c(6247),f=c(32905);let g=e.forwardRef(({className:a,...b},c)=>(0,d.jsx)("textarea",{className:(0,f.cn)("flex min-h-[96px] w-full rounded-2xl border border-white/10 bg-white/5 px-4 py-3 text-sm text-white placeholder:text-slate-500 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cyan-400/60 disabled:cursor-not-allowed disabled:opacity-50",a),ref:c,...b}));g.displayName="Textarea"},80990:(a,b,c)=>{"use strict";c.d(b,{$:()=>j});var d=c(3814),e=c(6247),f=c(69598),g=c(9082),h=c(32905);let i=(0,g.F)("inline-flex items-center justify-center whitespace-nowrap rounded-2xl text-sm font-medium transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-cyan-400 text-slate-950 shadow-lg shadow-cyan-400/20 hover:bg-cyan-300",secondary:"border border-white/10 bg-white/5 text-slate-100 hover:bg-white/10 hover:text-white",ghost:"text-slate-200 hover:bg-white/[0.08] hover:text-white",destructive:"bg-rose-500 text-white shadow-lg shadow-rose-500/20 hover:bg-rose-400"},size:{default:"h-11 px-4 py-2",sm:"h-9 rounded-xl px-3",lg:"h-12 rounded-2xl px-5",icon:"h-11 w-11"}},defaultVariants:{variant:"default",size:"default"}}),j=e.forwardRef(({className:a,variant:b,size:c,asChild:e=!1,...g},j)=>{let k=e?f.DX:"button";return(0,d.jsx)(k,{className:(0,h.cn)(i({variant:b,size:c,className:a})),ref:j,...g})});j.displayName="Button"},82425:(a,b,c)=>{"use strict";c.d(b,{z:()=>A});var d=c(3814),e=c(6247),f=c(11917),g=c(57825),h=c(32956),i=c(57531),j=c(5813),k=c(49444),l=c(32905);function m({title:a,selectedValues:b,selectedTone:c,selectedEmptyLabel:e,lockedValues:f=[],observedValues:g=[],inputRef:o,inputValue:p,onInputValueChange:q,onRemove:r,onPick:s,suggestions:t,emptySuggestionLabel:u,loading:v,catalogError:w,helperLabel:x,currentHintLabel:y,highlight:z}){let A="cyan"===c?{border:"border-cyan-300/20",chip:"border-cyan-300/15 bg-cyan-400/10 text-cyan-50",chipHover:"hover:border-cyan-200/30 hover:bg-cyan-400/15"}:{border:"border-amber-300/20",chip:"border-amber-300/15 bg-amber-400/10 text-amber-50",chipHover:"hover:border-amber-200/30 hover:bg-amber-400/15"},B=f.length>0,C=new Set(f),D=`Current ${a.toLowerCase()}`,E=`${a}:${p}:${t.length}:${t[0]?.value??""}`;return(0,d.jsxs)("div",{className:(0,l.cn)("rounded-[18px] border bg-[linear-gradient(180deg,rgba(11,18,32,0.86),rgba(8,13,24,0.82))] p-3.5",A.border,z&&"shadow-[0_0_0_1px_rgba(34,211,238,0.08)]"),children:[(0,d.jsxs)("div",{className:"mb-3 flex items-center justify-between gap-2",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.22em] text-slate-500",children:a}),(0,d.jsx)(j.E,{variant:"muted",children:"Declared"})]}),(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.22em] text-slate-500",children:D}),(0,d.jsx)("p",{className:"text-[10px] leading-4 text-slate-400",children:y})]}),(0,d.jsxs)(j.E,{variant:"muted",children:[b.length," current"]})]}),(0,d.jsx)("div",{className:"flex flex-wrap gap-1.5",children:b.length>0?b.map(a=>{let b=C.has(a);return(0,d.jsxs)("div",{className:(0,l.cn)("inline-flex max-w-full items-center gap-1.5 rounded-full border px-2.5 py-1 text-[11px] transition-colors",A.chip,A.chipHover,b&&"cursor-not-allowed pr-2.5"),title:b?`Managed by policy: ${a}`:a,children:[(0,d.jsx)("span",{className:"max-w-full truncate",children:a}),b?(0,d.jsx)("span",{className:"inline-flex items-center gap-1 text-white/70",children:(0,d.jsx)(h.A,{className:"h-3 w-3"})}):(0,d.jsx)("button",{type:"button","aria-label":`Remove ${a}`,title:`Remove ${a}`,className:"inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-full border border-white/10 bg-white/10 text-white/70 transition-colors hover:border-white/20 hover:bg-white/20 hover:text-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cyan-300/60 focus-visible:ring-offset-0",onClick:()=>r(a),children:(0,d.jsx)(i.A,{className:"h-2.5 w-2.5"})})]},a)}):(0,d.jsx)(j.E,{variant:"muted",children:e})})]}),(0,d.jsx)("div",{children:(0,d.jsx)(k.p,{ref:o,value:p,onChange:a=>q(a.target.value),onKeyDown:a=>(function(a,b,c){if("Enter"!==a.key)return;a.preventDefault();let d=b[0];d&&c(d.value)})(a,t,s),placeholder:"Skills"===a?"Search OpenClaw or workspace skills":"Search built-in tools or plugin tools",className:"h-8 flex-1 rounded-xl border-white/10 bg-white/5 px-3 text-[12px]"})}),(0,d.jsx)("div",{className:"space-y-2",children:(0,d.jsx)(n,{kind:"Skills"===a?"skill":"tool",suggestions:t,onPick:s,emptyLabel:u},E)}),B?(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Policy locked"}),(0,d.jsx)("div",{className:"flex flex-wrap gap-2",children:f.map(a=>(0,d.jsxs)(j.E,{variant:"success",children:[(0,d.jsx)(h.A,{className:"mr-1 h-3 w-3"}),a]},a))})]}):null,g.length>0?(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"mb-2 text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Observed"}),(0,d.jsx)("div",{className:"flex flex-wrap gap-2",children:g.slice(0,10).map(a=>(0,d.jsx)(j.E,{variant:"muted",children:a},a))})]}):null,(0,d.jsx)("p",{className:"text-[11px] leading-5 text-slate-500",children:x}),w?(0,d.jsx)("p",{className:"text-[11px] leading-5 text-slate-500",children:w}):null,v&&0===t.length?(0,d.jsx)("p",{className:"text-[11px] leading-5 text-slate-500",children:"Loading OpenClaw catalog..."}):null]})]})}function n({kind:a,suggestions:b,onPick:c,emptyLabel:f}){let[g,h]=(0,e.useState)(8),i=b.slice(0,g),k=Math.max(b.length-i.length,0);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,d.jsx)("p",{className:"text-[10px] uppercase tracking-[0.22em] text-slate-500",children:"Available to add"}),(0,d.jsxs)(j.E,{variant:"muted",children:[b.length," total"]})]}),(0,d.jsx)("div",{className:"max-h-[280px] space-y-1.5 overflow-y-auto pr-1",children:(0,d.jsxs)("div",{className:"space-y-1.5",children:[(0,d.jsx)(o,{kind:a,options:i,onPick:c,emptyLabel:f}),k>0?(0,d.jsxs)("button",{type:"button",onClick:()=>h(a=>a+8),className:"group flex w-full items-center justify-center gap-2 rounded-xl border border-dashed border-cyan-300/20 bg-cyan-400/[0.04] px-3 py-2 text-[11px] text-cyan-100 transition-colors hover:border-cyan-200/35 hover:bg-cyan-400/[0.08] hover:text-white",children:[(0,d.jsx)("span",{className:"uppercase tracking-[0.18em]",children:"Load more"}),(0,d.jsxs)(j.E,{variant:"muted",className:"h-5 px-2 py-0 text-[10px]",children:["+",k]})]}):null]})})]})}function o({kind:a,options:b,onPick:c,emptyLabel:e}){return 0===b.length?(0,d.jsx)("p",{className:"text-[11px] leading-5 text-slate-500",children:e}):(0,d.jsx)("div",{className:"space-y-1.5",children:b.map(b=>{var e;return(0,d.jsxs)("button",{type:"button",className:(0,l.cn)("group flex w-full items-start justify-between gap-3 rounded-xl border border-white/[0.08] bg-white/[0.03] px-3 py-1.5 text-left transition-colors hover:border-cyan-300/20 hover:bg-cyan-400/[0.05]","tool"===a&&"hover:border-amber-300/20 hover:bg-amber-400/[0.05]"),onClick:()=>c(b.value),title:b.description,children:[(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("p",{className:"truncate text-[12px] leading-4 text-white",children:b.label}),"group"===b.category?(0,d.jsx)(j.E,{variant:"muted",children:"group"}):null]}),(0,d.jsx)("p",{className:"line-clamp-2 text-[11px] leading-4 text-slate-400",children:b.description})]}),(0,d.jsx)(j.E,{variant:"skill"===(e=b).kind?"workspace"===e.category?"success":"custom"===e.category?"muted":"default":"plugin"===e.category?"warning":"group"===e.category||"custom"===e.category?"muted":"default",className:"shrink-0 h-4 max-w-[132px] px-1.5 py-0 text-[8px] font-medium tracking-[0.08em] normal-case",children:(0,d.jsx)("span",{className:"truncate",children:b.sourceLabel})})]},b.value)})})}var p=c(80990),q=c(37674),r=c(92078),s=c(90665);function t(a,b){let c=new Map;for(let e of a){var d;let a=e.value.trim();if(!a)continue;let f=c.get(a);if(!f){c.set(a,{...e,value:a,label:e.label||a,description:e.description||"",sourceLabel:e.sourceLabel||"OpenClaw",sourceRank:e.sourceRank??99,kind:e.kind||b,category:e.category});continue}f.description=f.description||e.description,d=f.sourceLabel,f.sourceLabel=w([d,e.sourceLabel].filter(a=>!!a)).join(" \xb7 "),f.sourceRank=Math.min(f.sourceRank,e.sourceRank??f.sourceRank),f.category=f.category??e.category}return Array.from(c.values()).sort((a,b)=>{let c=a.sourceRank-b.sourceRank;if(0!==c)return c;let d=a.label.localeCompare(b.label);return 0!==d?d:a.value.localeCompare(b.value)})}function u(a,b,c,d=8){let e=b.trim().toLowerCase(),f=new Set(w(c));return a.filter(a=>!f.has(a.value)).filter(a=>!e||5>y(a,e)).sort((a,b)=>{let c=y(a,e),d=y(b,e);if(c!==d)return c-d;let f=a.sourceRank-b.sourceRank;return 0!==f?f:a.label.localeCompare(b.label)}).slice(0,d)}function v(a){return"builtin"===a.category?"OpenClaw built-in":"group"===a.category?"OpenClaw docs":a.source}function w(a){let b=new Set,c=[];for(let d of a){if("string"!=typeof d)continue;let a=d.trim();!a||b.has(a)||(b.add(a),c.push(a))}return c}function x(a,b){return a.length===b.length&&a.every((a,c)=>a===b[c])}function y(a,b){if(!b)return 0;let c=[a.value.toLowerCase(),a.label.toLowerCase(),a.description.toLowerCase(),a.sourceLabel.toLowerCase()];return c.some(a=>a===b)?0:c.some(a=>a.startsWith(b))?1:c.some(a=>a.includes(b))?2:5}var z=c(30540);function A({open:a,agentId:b,initialFocus:c="skills",snapshot:h,onOpenChange:i,onSnapshotChange:k,onRefresh:l}){let n=b?h.agents.find(a=>a.id===b)??null:null,o=h.workspaces.find(a=>a.id===n?.workspaceId),[y,B]=(0,e.useState)(null),[C,D]=(0,e.useState)(null),[E,F]=(0,e.useState)(!1),[G,H]=(0,e.useState)(!1),[I,J]=(0,e.useState)(null),[K,L]=(0,e.useState)(""),[M,N]=(0,e.useState)(""),[O,P]=(0,e.useState)([]),[Q,R]=(0,e.useState)([]),S=(0,e.useRef)(null),T=(0,e.useRef)(null);(0,e.useRef)(h);let U="tools"===c?"tools":"skills",V="skills"===U,W="tools"===U,X=n?(0,r.Cf)(n.policy.preset):null,Y=w(n?.skills??[]),Z=w((n?.tools??[]).filter(a=>"fs.workspaceOnly"!==a)),$=Y.length>0?Y:w(X?.skillIds??[]),_=Z.length>0?Z:w(X?.tools??[]),aa=n?.tools.includes("fs.workspaceOnly")?["fs.workspaceOnly"]:[],ab=w(n?.observedTools??[]),ac=w(o?.bootstrap.localSkillIds??[]),ad=(0,e.useMemo)(()=>[...z.j,...z.T],[]),ae=(0,e.useMemo)(()=>t([...(y?.skills??[]).map(a=>{var b;return{value:a.name,label:a.name,description:a.description,sourceLabel:"openclaw-bundled"===(b=a.source)?"OpenClaw bundled":"workspace"===b?"Workspace":b,sourceRank:+("openclaw-bundled"!==a.source),kind:"skill"}}),...ac.map(a=>({value:a,label:a,description:"Workspace-local SKILL.md scaffold.",sourceLabel:"Workspace",sourceRank:0,kind:"skill",category:"workspace"})),...O.filter(a=>!(y?.skills??[]).some(b=>b.name===a)).map(a=>({value:a,label:a,description:"Already configured on this agent.",sourceLabel:"Current agent",sourceRank:2,kind:"skill",category:"custom"}))],"skill"),[y?.skills,O,ac]),af=(0,e.useMemo)(()=>t([...ad.map(a=>({value:a.name,label:a.name,description:a.description,sourceLabel:v(a),sourceRank:"builtin"===a.category?0:"plugin"===a.category?1:2,kind:"tool",category:a.category})),...(y?.tools??[]).map(a=>({value:a.name,label:a.name,description:a.description,sourceLabel:v(a),sourceRank:"builtin"===a.category?0:"plugin"===a.category?1:2,kind:"tool",category:a.category})),...Q.filter(a=>"fs.workspaceOnly"!==a&&!(y?.tools??[]).some(b=>b.name===a)).map(a=>({value:a,label:a,description:"Already configured on this agent.",sourceLabel:"Current agent",sourceRank:3,kind:"tool",category:"custom"})),...ab.filter(a=>"fs.workspaceOnly"!==a&&!(y?.tools??[]).some(b=>b.name===a)&&!Z.includes(a)).map(a=>({value:a,label:a,description:"Recovered from runtime transcripts.",sourceLabel:"Observed",sourceRank:4,kind:"tool",category:"custom"}))],"tool"),[y?.tools,Z,Q,ad,ab]),ag=(0,e.useMemo)(()=>u(ae,K,O,1/0),[O,K,ae]),ah=(0,e.useMemo)(()=>u(af,M,Q,1/0),[Q,M,af]);if(!n)return null;let ai=V?$:Y,aj=W?_:Z,ak=V?w(O):Y,al=W?w(Q):Z,am=!x(ak,ai)||!x(al,aj),an=async()=>{if(x(ak,ai)&&x(al,aj))return void i(!1);H(!0),J(null);try{let a={id:n.id};V?a.skills=ak:a.tools=al;let b=await fetch("/api/agents",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),c=await b.json();if(!b.ok)throw Error(c.error||"Unable to update agent capabilities.");k?.(a=>(function(a,b,c,d){let e=w(c),f=a.agents.map(a=>a.id===b?{...a,skills:e,tools:w([...d,...a.tools.includes("fs.workspaceOnly")?["fs.workspaceOnly"]:[]])}:a),g=f.find(a=>a.id===b);if(!g)return a;let h=a.workspaces.map(a=>{if(a.id!==g.workspaceId)return a;let b=f.filter(b=>b.workspaceId===a.id);return{...a,capabilities:{...a.capabilities,skills:w(b.flatMap(a=>a.skills)),tools:w(b.flatMap(a=>a.tools)),workspaceOnlyAgentCount:b.filter(a=>a.tools.includes("fs.workspaceOnly")).length}}});return{...a,agents:f,workspaces:h}})(a,n.id,ak,al)),g.oR.success("Agent capabilities updated."),i(!1);let d=l?.();d&&d.catch(()=>void 0)}catch(b){let a=b instanceof Error?b.message:"Unable to update agent capabilities.";J(a),g.oR.error(a)}finally{H(!1)}};return(0,d.jsx)(q.lG,{open:a,onOpenChange:i,children:(0,d.jsx)(q.Cf,{className:"w-[min(680px,calc(100vw-1.5rem))] max-h-[calc(100dvh-1.5rem)] overflow-hidden rounded-[24px] border-white/10 bg-[linear-gradient(180deg,rgba(7,10,18,0.98),rgba(4,7,14,0.98))] p-0",children:(0,d.jsxs)("div",{className:"flex max-h-[calc(100dvh-1.5rem)] min-h-0 flex-col",children:[(0,d.jsxs)(q.c7,{className:"border-b border-white/[0.08] px-4 py-2.5",children:[(0,d.jsx)(q.L3,{className:"text-[0.95rem]",children:`Edit ${V?"skills":"tools"} \xb7 ${(0,s.CK)(n)}`}),(0,d.jsx)(q.rr,{className:"sr-only",children:"Edit the selected agent's skills or tools and save the updated capability set."}),(0,d.jsx)("div",{className:"flex flex-wrap gap-1 pt-0.5",children:(0,d.jsx)(j.E,{variant:"muted",className:"h-5 border-white/[0.08] px-2 py-0 text-[10px] font-normal tracking-[0.06em] normal-case",children:(0,r._P)(n.policy.preset)})})]}),(0,d.jsxs)("div",{className:"min-h-0 flex-1 overflow-y-auto",children:[(0,d.jsx)("div",{className:"px-4 py-4",children:(0,d.jsx)(m,{title:V?"Skills":"Tools",selectedValues:V?O:Q,selectedTone:V?"cyan":"amber",selectedEmptyLabel:V?"No explicit skills":"No explicit tools configured",lockedValues:W?aa:[],observedValues:W?ab:[],inputRef:V?S:T,inputValue:V?K:M,onInputValueChange:V?L:N,onRemove:a=>{V?P(b=>b.filter(b=>b!==a)):R(b=>b.filter(b=>b!==a))},onPick:a=>{V?(P(b=>w([...b,a])),L("")):(R(b=>w([...b,a])),N(""))},suggestions:V?ag:ah,emptySuggestionLabel:E&&(V?ag.length:ah.length)===0?V?"Loading OpenClaw skill catalog...":"Loading OpenClaw tool catalog...":V?"No matching skills found.":"No matching tools found.",loading:E,catalogError:C,helperLabel:V?"Workspace skills and OpenClaw skills are shown first in Available to add.":"Built-ins, plugins, and groups are shown first in Available to add. Observed tools are read-only.",currentHintLabel:V?"Click \xd7 on a current skill to remove it.":"Click \xd7 on a current tool to remove it.",highlight:!0})}),I?(0,d.jsx)("div",{className:"border-t border-white/[0.08] px-4 py-3",children:(0,d.jsx)("p",{className:"text-[12px] leading-5 text-rose-300",children:I})}):null]}),(0,d.jsxs)(q.Es,{className:"border-t border-white/[0.08] px-4 py-2 sm:flex-row",children:[(0,d.jsx)(p.$,{type:"button",variant:"secondary",onClick:()=>i(!1),disabled:G,className:"h-8 rounded-full px-2.5 text-[10px]",children:"Cancel"}),(0,d.jsxs)(p.$,{type:"button",onClick:()=>{an()},disabled:G||!am,className:"h-8 rounded-full px-2.5 text-[10px]",children:[G?(0,d.jsx)(f.A,{className:"mr-1 h-3.5 w-3.5 animate-spin"}):null,"Save changes"]})]})]})})})}},89478:(a,b,c)=>{"use strict";c.d(b,{jZ:()=>e,oZ:()=>h});var d=c(60557);class e extends Error{constructor(a,b){super(a),this.result=b,this.name="ModelProviderActionError"}}async function f(a){let b=await fetch("/api/models/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),c=await b.json().catch(()=>null);if(!b.ok||!c)throw Error(c?.error||c?.message||"Model provider request failed.");if(!c.ok&&c.message)throw new e(c.message,c);return c}let g=Object.fromEntries(d.y8.map(a=>{var b;return[a.id,{id:b=a.id,descriptor:(0,d.W2)(b),getConnectionStatus:()=>f({action:"status",provider:b}),connect:a=>f({action:"connect",provider:b,apiKey:a?.apiKey?.trim()?a.apiKey.trim():void 0,endpoint:a?.endpoint?.trim()?a.endpoint.trim():void 0}),discoverModels:()=>f({action:"discover",provider:b}),addModels:a=>f({action:"add-models",provider:b,modelIds:a})}]}));function h(a){return g[a]}},90665:(a,b,c)=>{"use strict";c.d(b,{$7:()=>n,$m:()=>p,CK:()=>j,FO:()=>g,JZ:()=>i,Uu:()=>l,_y:()=>h,fw:()=>e,hv:()=>f,m_:()=>m,sY:()=>k});var d=c(3844);function e(a,b=Date.now()){return null==a||Number.isNaN(a)?"No activity":`${(0,d.k)(a,b,{addSuffix:!0})}`}function f(a){if(!a)return Date.now();let b=Date.parse(a);return Number.isNaN(b)?Date.now():b}function g(a){return a?a>=1e3?`${Math.round(a/1e3)}k`:String(a):"n/a"}function h(a){return"number"!=typeof a?"n/a":a>=1e3?`${(a/1e3).toFixed(a>=1e4?0:1)}k`:String(a)}function i(a){return a.split("/").at(1)||a}function j(a){return a.name?.trim()||a.identityName?.trim()||"OpenClaw"}function k(a){switch(a){case"running":return"text-cyan-300";case"completed":return"text-emerald-300";case"cancelled":return"text-rose-300";case"stalled":case"queued":return"text-amber-200";default:return"text-slate-400"}}function l(a){switch(a){case"running":return"default";case"completed":return"success";case"cancelled":return"danger";case"stalled":return"warning";default:return"muted"}}function m(a,b=8){return a?a.length<=b?a:a.slice(0,b):"n/a"}function n(a){return a.replace(/^\/Users\/[^/]+/,"~")}let o=[/^Task output routing:/i,/^Agent operating policy:/i];function p(a,b=64){if(!a)return"";let c=function(a){let b=a.replace(/\r\n/g,"\n").trim();if(!b)return"";let c=[];for(let a of b.split("\n")){let b=a.trim();if(o.some(a=>a.test(b)))break;c.push(a)}return c.join(" ").replace(/\s+/g," ").trim()}(a);return c?c.length<=b?c:`${c.slice(0,Math.max(b-1,1)).trimEnd()}…`:""}},92078:(a,b,c)=>{"use strict";c.d(b,{$x:()=>i,A_:()=>g,Bw:()=>r,Cf:()=>k,DS:()=>j,UJ:()=>p,_P:()=>m,aB:()=>n,bQ:()=>q,bt:()=>f,g0:()=>l,sH:()=>h,zR:()=>o}),c(30540).j.map(a=>a.name);let d={worker:{label:"Worker",description:"Default execution agent for code changes, docs, research, and review work. Best when the task stays inside the workspace and does not need system-level changes.",defaultName:"Worker",defaultEmoji:"\uD83D\uDEE0️",defaultTheme:"slate",badgeVariant:"default",tools:["exec","read","write","edit","apply_patch"],skillIds:["project-builder","project-reviewer","project-tester"]},setup:{label:"Setup / Operator",description:"Bootstraps environments, handles installs, and unblocks the workspace so other agents can move faster.",defaultName:"Setup Operator",defaultEmoji:"\uD83E\uDDF0",defaultTheme:"amber",badgeVariant:"warning",tools:["exec","process","gateway","read","write"],skillIds:["project-builder","project-analyst","project-learner"]},browser:{label:"Browser",description:"Captures browser evidence, screenshots, and user-path validation for UI-heavy work.",defaultName:"Browser Agent",defaultEmoji:"\uD83C\uDF10",defaultTheme:"blue",badgeVariant:"success",tools:["browser","web_search","web_fetch","image"],skillIds:["project-browser","project-tester","project-researcher"]},monitoring:{label:"Monitoring",description:"Runs on a watch cycle, checks health and drift, and leaves concise triage handoffs.",defaultName:"Monitoring Agent",defaultEmoji:"\uD83D\uDEF0️",defaultTheme:"teal",badgeVariant:"warning",tools:["cron","gateway","sessions_list","message","web_fetch"],skillIds:["project-analyst","project-reviewer","project-learner"]},custom:{label:"Custom",description:"Starts from the safe baseline and lets you fine-tune identity, policy, and operating style by hand.",defaultName:"Custom Agent",defaultEmoji:"\uD83E\uDDE9",defaultTheme:"violet",badgeVariant:"muted",tools:["exec","read","edit","message"],skillIds:[]}},e={worker:{missingToolBehavior:"fallback",installScope:"none",fileAccess:"workspace-only",networkAccess:"enabled"},setup:{missingToolBehavior:"allow-install",installScope:"workspace",fileAccess:"workspace-only",networkAccess:"enabled"},browser:{missingToolBehavior:"ask-setup",installScope:"none",fileAccess:"workspace-only",networkAccess:"enabled"},monitoring:{missingToolBehavior:"fallback",installScope:"none",fileAccess:"workspace-only",networkAccess:"enabled"},custom:{missingToolBehavior:"fallback",installScope:"none",fileAccess:"workspace-only",networkAccess:"enabled"}},f=Object.entries(d).map(([a,b])=>({value:a,label:b.label,description:b.description})),g=[{value:"fallback",label:"Fallback",description:"Produce the nearest viable output format instead of failing the task."},{value:"ask-setup",label:"Ask for setup",description:"Stop before environment changes and report the missing capability clearly."},{value:"route-setup",label:"Route to setup agent",description:"Leave an explicit setup handoff instead of attempting installs directly."},{value:"allow-install",label:"Allow install",description:"Install missing tooling when policy allows it and the task truly depends on it."}],h=[{value:"none",label:"None",description:"Do not install workspace or system dependencies."},{value:"workspace",label:"Workspace only",description:"Only install dependencies inside the project or workspace environment."},{value:"system",label:"System",description:"Permit system-wide installs when they are necessary and intentional."}],i=[{value:"workspace-only",label:"Workspace only",description:"Keep file work grounded inside the attached workspace."},{value:"extended",label:"Extended",description:"Allow broader file access when the task explicitly needs it."}],j=[{value:"restricted",label:"Off",description:"Avoid network access unless the task explicitly depends on it."},{value:"enabled",label:"On",description:"Use network access when the task needs external information or downloads."}];function k(a){return d[a]}function l(a="worker",b){return{...e[a],...b??{},preset:a}}function m(a){return d[a].label}function n(a){return"fs.workspaceOnly"===a?"Workspace only":a.replace(/^agent-policy-/,"").replace(/^project-/,"").replace(/[._-]+/g," ").trim().replace(/\b\w/g,a=>a.toUpperCase())}function o(a){return g.find(b=>b.value===a)?.label??a}function p(a){return h.find(b=>b.value===a)?.label??a}function q(a){return i.find(b=>b.value===a)?.label??a}function r(a){return j.find(b=>b.value===a)?.label??a}},97078:(a,b,c)=>{"use strict";c.d(b,{O:()=>B});var d=c(3814),e=c(6247),f=c(68123),g=c(58664),h=c(78282),i=c(76179),j=c(11917),k=c(63685),l=c(45738),m=c(5813),n=c(34118),o=c(9494),p=c(92078),q=c(32905);function r({label:a,htmlFor:b,children:c,surfaceTheme:e="dark"}){return(0,d.jsxs)("div",{className:"space-y-1.5",children:[(0,d.jsx)(n.J,{htmlFor:b,className:(0,q.cn)("text-[10px] uppercase tracking-[0.16em]","light"===e?"text-[#8d7766]":"text-slate-400"),children:a}),c]})}function s({preset:a,active:b,onClick:c,surfaceTheme:e="dark"}){let f=(0,p.Cf)(a),h=(0,o.A6)(a),i="light"===e;return(0,d.jsx)("button",{type:"button",onClick:c,"aria-pressed":b,className:(0,q.cn)("flex h-full min-h-[200px] min-w-0 flex-col justify-between rounded-[24px] border p-4 text-left transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 snap-start",i?"border-[#e3d7cc] bg-white/92 shadow-[0_16px_34px_rgba(161,125,101,0.08)] focus-visible:ring-[#c89e73]/30 hover:border-[#d3c0b2] hover:bg-white":"border-white/10 bg-white/[0.03] shadow-[0_12px_28px_rgba(0,0,0,0.22)] focus-visible:ring-cyan-300/40 hover:border-white/20 hover:bg-white/[0.05]",b&&(i?"border-[#c89e73] bg-[#fff8f0] shadow-[0_18px_44px_rgba(161,125,101,0.14)]":"border-cyan-300/30 bg-cyan-400/10 shadow-[0_0_0_1px_rgba(34,211,238,0.08)]")),children:(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-start gap-3",children:[(0,d.jsx)("span",{className:(0,q.cn)("inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-2xl border text-[15px]",i?"border-[#ded0c2] bg-[#faf5ef] text-[#7b604c]":"border-white/10 bg-white/5 text-white"),children:f.defaultEmoji??(0,d.jsx)(g.A,{className:"h-4 w-4"})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:(0,q.cn)("line-clamp-2 break-words text-[14px] font-semibold leading-5",i?"text-[#2f2016]":"text-white"),children:f.label}),(0,d.jsx)("p",{className:(0,q.cn)("mt-1 line-clamp-3 text-[12px] leading-5",i?"text-[#6d5849]":"text-slate-400"),children:f.description})]})]}),(0,d.jsx)(m.E,{variant:b?"default":"muted",className:(0,q.cn)("shrink-0 px-2 py-0.5 text-[9px] normal-case tracking-normal",i?b?"border-[#c89e73]/35 bg-[#f4e6d8] text-[#5f432f]":"border-[#e1d5c8] bg-white text-[#846a58]":b?"border-cyan-300/30 bg-cyan-400/10 text-cyan-50":"border-white/10 bg-white/5 text-slate-300"),children:b?"selected":"preset"})]}),(0,d.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,d.jsxs)(m.E,{variant:"muted",className:(0,q.cn)("px-2 py-0.5 text-[10px] normal-case tracking-normal",i?"border-[#e1d5c8] bg-[#fbf7f2] text-[#6f5747]":""),children:[f.tools.length," tools"]}),(0,d.jsxs)(m.E,{variant:"muted",className:(0,q.cn)("px-2 py-0.5 text-[10px] normal-case tracking-normal",i?"border-[#e1d5c8] bg-[#fbf7f2] text-[#6f5747]":""),children:[f.skillIds.length," skills"]}),(0,d.jsxs)(m.E,{variant:h.enabled?"success":"muted",className:(0,q.cn)("px-2 py-0.5 text-[10px] normal-case tracking-normal",i?h.enabled?"border-emerald-300/40 bg-emerald-100 text-emerald-800":"border-[#e1d5c8] bg-[#fbf7f2] text-[#6f5747]":""),children:["Heartbeat ",h.enabled?h.every:"off"]})]})]})})}function t({label:a,htmlFor:b,value:c,options:e,onChange:f,surfaceTheme:g="dark"}){let h="light"===g,i=e.find(a=>a.value===c);return(0,d.jsxs)(r,{label:a,htmlFor:b,surfaceTheme:g,children:[(0,d.jsx)("select",{id:b,value:c,onChange:a=>f(a.target.value),style:h?{colorScheme:"light"}:void 0,className:(0,q.cn)("flex h-10 w-full rounded-2xl border px-3.5 py-2 text-[13px] outline-none transition-colors",h?"border-[#dccfc3] bg-white text-[#3f2f24] placeholder:text-[#9b8573] focus:border-[#c89e73] focus:ring-2 focus:ring-[#c89e73]/15":"border-white/10 bg-white/5 text-white placeholder:text-slate-500 focus:border-cyan-300/30 focus:ring-2 focus:ring-cyan-300/15"),children:e.map(a=>(0,d.jsx)("option",{value:a.value,children:a.label},a.value))}),i?.description?(0,d.jsx)("p",{className:(0,q.cn)("mt-1 text-[10px] leading-[1.4]",h?"text-[#9a8070]":"text-slate-500"),children:i.description}):null]})}var u=c(80990),v=c(37674),w=c(49444),x=c(43081),y=c(45084),z=c(90665),A=c(69903);function B({snapshot:a,defaultWorkspaceId:b,onRefresh:c,onSnapshotChange:k,onAgentCreated:n,onAgentCreatedVisible:L,trigger:M,surfaceTheme:N="dark"}){var O,P,Q,R,S;let T="light"===N,U=b??a.workspaces[0]?.id??"",[V,W]=(0,e.useState)(!1),[X,Y]=(0,e.useState)(!1),[Z,$]=(0,e.useState)(!1),[_,aa]=(0,e.useState)("start"),[ab,ac]=(0,e.useState)(null),[ad,ae]=(0,e.useState)("worker"),[af,ag]=(0,e.useState)(null),[ah,ai]=(0,e.useState)(""),[aj,ak]=(0,e.useState)(!1),[al,am]=(0,e.useState)("idle"),[an,ao]=(0,e.useState)(null),[ap,aq]=(0,e.useState)(null),ar=(0,e.useRef)(!1),as=(0,e.useRef)(null),[at,au]=(0,e.useState)(()=>C(U,a)),av=(0,e.useRef)(null),aw=a.workspaces.find(a=>a.id===at.workspaceId)??null,ax=(0,A.nd)(a,at.workspaceId||U),ay=at.modelId.trim()||ax,az=(0,p.Cf)(at.policy.preset),aA=(0,A.qk)(a.agents,aw?.slug,at.name||az.defaultName),aB=af?a.agents.find(a=>a.id===af)??null:null,aC=aB?a.workspaces.find(a=>a.id===aB.workspaceId)??null:null,aD=(0,e.useMemo)(()=>{let b=ah.trim().toLowerCase();return[...a.agents].filter(c=>{if(!b)return!0;let d=a.workspaces.find(a=>a.id===c.workspaceId)?.name??c.workspaceId,e=(0,p.Cf)(c.policy.preset).label;return[(0,z.CK)(c),c.id,c.workspaceId,d,e,c.modelId].join(" ").toLowerCase().includes(b)}).sort((a,b)=>{if(af){if(a.id===af)return -1;if(b.id===af)return 1}return(0,z.CK)(a).localeCompare((0,z.CK)(b))})},[ah,af,a.agents,a.workspaces]),aE=D(ab),aF=E(ab,_),aG=!!(aA&&aw&&ay)&&!aj,aH="details"===_?aG:(O=_,P=ab,Q=af,"start"===O?!!P:"preset"===O||"import"!==O||!!Q);an&&a.agents.some(a=>a.id===an);let aI="creating"===al?"Creating the agent and updating the workspace AGENTS.md role section.":"syncing"===al?"Agent created. Waiting for the canvas card to appear.":null,aJ=(0,e.useCallback)(b=>{let c=C(b,a);aa("start"),ac(null),ae("worker"),ag(null),ai(""),au(c),ak(!1),am("idle"),ao(null),aq(null),av.current&&(clearTimeout(av.current),av.current=null),ar.current=!1},[a]),aK=a=>{(a||!aj&&"idle"===al)&&($(a),a||aJ(U))},aL=b=>{let c=at.workspaceId||U,d=C(c,a);d.modelId=at.modelId||(0,A.nd)(a,c),ac(b),ae("worker"),ag(null),ai(""),au(d),"empty"===b?aa("details"):aa("start")},aM=async()=>{if(!ar.current&&aA&&aw){ar.current=!0,ak(!0),am("creating"),ao(null),aq(null);try{let a=await fetch("/api/agents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...at,modelId:ay,id:aA})}),b=await a.json();if(!a.ok||b.error||!b.agentId)throw Error(b.error||"OpenClaw could not create the agent.");at.channelIds.length>0&&await (0,y.rz)({workspaceId:at.workspaceId,workspacePath:aw.path,agentId:b.agentId,currentChannelIds:[],nextChannelIds:at.channelIds,onRegistryChange:k}),am("syncing"),ao(b.agentId),aq(b.warning??b.warnings?.[0]??null),c().catch(()=>{})}catch(a){av.current&&(clearTimeout(av.current),av.current=null),am("idle"),ao(null),aq(null),ak(!1),x.o.error("Agent creation failed.",{description:a instanceof Error?a.message:"Unknown agent error."})}finally{ar.current=!1}}};return V?(0,d.jsxs)(v.lG,{open:Z,onOpenChange:aK,children:[(0,d.jsx)(v.zM,{asChild:!0,children:M}),(0,d.jsx)(v.Cf,{overlayClassName:T?"bg-[#eadfd4]/72 backdrop-blur-[18px]":void 0,closeClassName:"hidden",className:(0,q.cn)("flex h-[min(84dvh,800px)] w-[calc(100vw-10px)] max-w-[920px] flex-col overflow-hidden p-0 sm:w-[min(920px,calc(100vw-20px))]",T?"border-[#dfd2c5] bg-[linear-gradient(180deg,rgba(255,252,248,0.99),rgba(247,239,231,0.99))] text-[#3f2f24] shadow-[0_36px_120px_rgba(161,125,101,0.18)]":"border-white/10 bg-[linear-gradient(180deg,rgba(12,18,29,0.98),rgba(7,11,18,0.98))] text-slate-50 shadow-[0_36px_120px_rgba(0,0,0,0.48)]"),style:T?{colorScheme:"light"}:void 0,children:(0,d.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,d.jsxs)("div",{className:(0,q.cn)("shrink-0 border-b px-4 py-2.5 pr-10",T?"border-[#e5d8cb] bg-[linear-gradient(180deg,rgba(255,252,248,0.98),rgba(244,235,224,0.96))]":"border-white/10 bg-[linear-gradient(180deg,rgba(14,20,34,0.98),rgba(9,13,24,0.99))]"),children:[(0,d.jsx)(v.rr,{className:"sr-only",children:"Create a new OpenClaw agent by choosing a starter mode, editing profile and policy, and saving the workspace agent."}),"start"===_?(0,d.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)(v.L3,{className:(0,q.cn)("text-[18px] font-medium sm:text-[20px]",T?"text-[#37291f]":"text-white"),children:"Create New Agent"}),(0,d.jsx)("p",{className:(0,q.cn)("mt-1 text-[12px] leading-4",T?"text-[#9a8574]":"text-slate-500"),children:"Choose a starting point."})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsxs)("div",{className:(0,q.cn)("inline-flex items-center gap-2 rounded-full border px-3 py-1 text-[11px]",T?"border-[#e2d3c2] bg-[#f5ece1] text-[#7e6554]":"border-white/10 bg-white/[0.04] text-slate-300"),children:[(0,d.jsx)("span",{className:(0,q.cn)("inline-flex h-5 w-5 items-center justify-center rounded-full text-[10px] font-medium",T?"bg-[#eadccf] text-[#6f5646]":"bg-white/10 text-slate-200"),children:"1"}),(0,d.jsx)("span",{children:"Start"})]}),(0,d.jsx)(v.HM,{asChild:!0,children:(0,d.jsx)("button",{type:"button","aria-label":"Close dialog",className:(0,q.cn)("inline-flex h-8 w-8 items-center justify-center rounded-full border transition-colors",T?"border-[#e2d3c2] bg-[#f5ece1] text-[#7b6657] hover:bg-[#f2e8df] hover:text-[#3f2f24]":"border-white/10 bg-white/[0.04] text-slate-300 hover:bg-white/[0.08] hover:text-white"),children:(0,d.jsxs)("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"h-4 w-4",children:[(0,d.jsx)("path",{d:"M18 6 6 18"}),(0,d.jsx)("path",{d:"m6 6 12 12"})]})})})]})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,d.jsx)(v.L3,{className:(0,q.cn)("text-[15px] font-medium sm:text-[17px]",T?"text-[#37291f]":"text-white"),children:"Create New Agent"}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)(G,{labels:aE,activeIndex:aF,surfaceTheme:N,onStepClick:a=>{if(a>=E(ab,_))return;let b=D(ab)[a];"Start"===b?aa("start"):"Preset"===b?aa("preset"):"Import"===b&&aa("import")}}),(0,d.jsx)(v.HM,{asChild:!0,children:(0,d.jsx)("button",{type:"button","aria-label":"Close dialog",className:(0,q.cn)("inline-flex h-8 w-8 items-center justify-center rounded-full border transition-colors",T?"border-[#e2d3c2] bg-[#f5ece1] text-[#7b6657] hover:bg-[#f2e8df] hover:text-[#3f2f24]":"border-white/10 bg-white/[0.04] text-slate-300 hover:bg-white/[0.08] hover:text-white"),children:(0,d.jsxs)("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"h-4 w-4",children:[(0,d.jsx)("path",{d:"M18 6 6 18"}),(0,d.jsx)("path",{d:"m6 6 12 12"})]})})})]})]}),(0,d.jsx)("p",{className:(0,q.cn)("mt-1.5 max-w-[520px] text-[10px] leading-4",T?"text-[#8c7664]":"text-slate-500"),children:(R=ab,"start"===(S=_)?"empty"===R?"Empty / Custom is selected. Continue to details.":"preset"===R?"Preset Library is selected. Click Next to browse presets.":"import"===R?"Import Agent is selected. Click Next to choose a source agent.":"Choose a starting point.":"preset"===S?"Pick a preset. Details come next.":"import"===S?"Select an existing agent to clone.":"empty"===R?"Custom baseline loaded. Finish the details and create it.":"preset"===R?"Preset baseline loaded. Finish the details and create it.":"import"===R?"Imported baseline loaded. Review and create.":"")})]})]}),(0,d.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto px-4 py-3.5",children:"start"===_?(0,d.jsxs)("div",{className:"mx-auto flex h-full w-full max-w-[804px] flex-col items-center justify-center space-y-3 py-6",children:[(0,d.jsxs)("div",{className:"grid w-full gap-4 md:grid-cols-3 md:justify-items-center lg:gap-5",children:[(0,d.jsx)(I,{icon:f.A,title:"Empty / Custom",description:"Start from scratch.",helper:"Fastest if you know the shape.",selected:"empty"===ab,surfaceTheme:N,onSelect:()=>aL("empty")}),(0,d.jsx)(I,{icon:g.A,title:"Preset Library",description:"Use a role template.",helper:"Good for common worker roles.",selected:"preset"===ab,surfaceTheme:N,onSelect:()=>aL("preset")}),(0,d.jsx)(I,{icon:h.A,title:"Import Agent",description:"Clone an existing agent.",helper:"Best when a baseline already exists.",selected:"import"===ab,surfaceTheme:N,onSelect:()=>aL("import")})]}),(0,d.jsx)("p",{className:(0,q.cn)("max-w-[760px] text-center text-[10px] leading-4",T?"text-[#8c7664]":"text-slate-500"),children:"Empty is the fastest path. Preset and import prefill the draft so you only adjust what matters."})]}):"preset"===_?(0,d.jsxs)("div",{className:"grid gap-4 xl:grid-cols-[minmax(0,1fr)_300px]",children:[(0,d.jsx)(H,{title:"Browse presets",description:"Choose the role that fits the first job.",surfaceTheme:N,className:"min-w-0",children:(0,d.jsx)("div",{className:"mt-3.5 grid gap-3 sm:grid-cols-2 xl:grid-cols-2",children:p.bt.map(a=>(0,d.jsx)(s,{preset:a.value,active:ad===a.value,surfaceTheme:N,onClick:()=>{var b;ae(b=a.value),au(a=>(0,A.nK)(a,b))}},a.value))})}),(0,d.jsx)(H,{title:"Selected preset",description:"This seeds the draft before details.",surfaceTheme:N,className:"xl:sticky xl:top-4 xl:self-start xl:h-fit",children:(0,d.jsxs)("div",{className:"space-y-2.5",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:(0,q.cn)("inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-2xl border text-[14px]",T?"border-[#ded0c2] bg-[#faf5ef] text-[#7b604c]":"border-white/10 bg-white/5 text-base"),children:(0,p.Cf)(ad).defaultEmoji}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:(0,q.cn)("truncate text-[13px] font-medium",T?"text-[#3f2f24]":"text-white"),children:(0,p.Cf)(ad).label}),(0,d.jsx)("p",{className:(0,q.cn)("mt-0.5 text-[11px] leading-4",T?"text-[#7f6958]":"text-slate-400"),children:(0,p.Cf)(ad).description})]})]}),(0,d.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,d.jsxs)(m.E,{variant:"muted",className:"px-2 py-0.5 text-[9px] normal-case tracking-normal",children:[(0,p.Cf)(ad).tools.length," tools"]}),(0,d.jsxs)(m.E,{variant:"muted",className:"px-2 py-0.5 text-[9px] normal-case tracking-normal",children:[(0,p.Cf)(ad).skillIds.length," skills"]}),(0,d.jsxs)(m.E,{variant:(0,o.A6)(ad).enabled?"success":"muted",className:"px-2 py-0.5 text-[9px] normal-case tracking-normal",children:["Heartbeat ",(0,o.A6)(ad).enabled?(0,o.A6)(ad).every:"off"]})]}),(0,d.jsx)(K,{surfaceTheme:N}),(0,d.jsx)("div",{className:(0,q.cn)("rounded-[18px] border p-2.5 text-[11px] leading-5",T?"border-[#e2d5c9] bg-[#faf6f1] text-[#7b6657]":"border-white/10 bg-white/[0.03] text-slate-400"),children:"The preset seeds the draft. You can fine-tune the name, model, policy, and heartbeat next."})]})})]}):"import"===_?(0,d.jsxs)("div",{className:"grid gap-4 xl:grid-cols-[minmax(0,1fr)_300px]",children:[(0,d.jsx)(H,{title:"Import an existing agent",description:"Select an agent to clone.",surfaceTheme:N,className:"min-w-0",children:(0,d.jsxs)("div",{className:"mt-3.5 space-y-3",children:[(0,d.jsx)("div",{className:"relative",children:(0,d.jsx)(w.p,{value:ah,onChange:a=>ai(a.target.value),placeholder:"Search by name, id, workspace, preset, or model",className:F(N)})}),(0,d.jsx)("div",{className:"space-y-2.5",children:aD.length>0?aD.map(b=>(0,d.jsx)(J,{agent:b,workspaceName:a.workspaces.find(a=>a.id===b.workspaceId)?.name??b.workspaceId,selected:af===b.id,surfaceTheme:N,onSelect:()=>(b=>{var c,d,e;let f=a.agents.find(a=>a.id===b);if(!f)return;let g=at.workspaceId||U,h=g===f.workspaceId?(0,y.XS)(a,f.workspaceId,f.id):[];ag(b),au((c=g,d=f,e=h,(0,A.TY)(c,{modelId:"unassigned"===d.modelId?"":d.modelId,name:(0,z.CK)(d),emoji:d.identity.emoji??"",theme:d.identity.theme??"",avatar:d.identity.avatar??"",policy:d.policy,heartbeat:(0,o.iq)(d.policy.preset,{enabled:d.heartbeat.enabled,every:d.heartbeat.every??void 0}),channelIds:e})))})(b.id)},b.id)):(0,d.jsx)("div",{className:(0,q.cn)("rounded-[20px] border border-dashed p-4 text-sm leading-6",T?"border-[#e1d5c8] bg-white text-[#7f6958]":"border-white/10 bg-white/[0.02] text-slate-400"),children:"No agents match this search. Clear the search or go back to choose another start."})})]})}),(0,d.jsx)(H,{title:"Import summary",description:"The selected agent seeds the draft.",surfaceTheme:N,className:"xl:sticky xl:top-4 xl:self-start xl:h-fit",children:aB?(0,d.jsxs)("div",{className:"space-y-2.5",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:(0,q.cn)("inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-2xl border text-[14px]",T?"border-[#ded0c2] bg-[#faf5ef] text-[#7b604c]":"border-white/10 bg-white/5 text-base"),children:aB.identity.emoji??"\uD83E\uDD16"}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:(0,q.cn)("truncate text-[13px] font-medium",T?"text-[#3f2f24]":"text-white"),children:(0,z.CK)(aB)}),(0,d.jsx)("p",{className:(0,q.cn)("mt-0.5 text-[11px] leading-4",T?"text-[#7f6958]":"text-slate-400"),children:aB.id})]})]}),(0,d.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,d.jsx)(m.E,{variant:"muted",className:"px-2 py-0.5 text-[9px] normal-case tracking-normal",children:aC?.name??aB.workspaceId}),(0,d.jsx)(m.E,{variant:"muted",className:"px-2 py-0.5 text-[9px] normal-case tracking-normal",children:(0,p.Cf)(aB.policy.preset).label}),(0,d.jsx)(m.E,{variant:"muted",className:"px-2 py-0.5 text-[9px] normal-case tracking-normal",children:"unassigned"===aB.modelId?"default model":aB.modelId})]}),(0,d.jsx)(K,{surfaceTheme:N}),(0,d.jsx)("div",{className:(0,q.cn)("rounded-[18px] border p-2.5 text-[11px] leading-5",T?"border-[#e2d5c9] bg-[#faf6f1] text-[#7b6657]":"border-white/10 bg-white/[0.03] text-slate-400"),children:"The cloned draft keeps the source baseline. You can adjust workspace-specific details next."})]}):(0,d.jsxs)("div",{className:"space-y-2.5",children:[(0,d.jsx)("div",{className:(0,q.cn)("rounded-[18px] border border-dashed p-4 text-sm leading-6",T?"border-[#e1d5c8] bg-white text-[#7f6958]":"border-white/10 bg-white/[0.02] text-slate-400"),children:"Choose an existing agent on the left. Its configuration will be cloned into the new draft."}),(0,d.jsx)(K,{surfaceTheme:N})]})})]}):(0,d.jsxs)("div",{className:"grid gap-4 xl:grid-cols-[minmax(0,1fr)_300px]",children:[(0,d.jsxs)("div",{className:"space-y-3.5",children:[(0,d.jsx)(H,{title:"Core details",description:"Name, workspace, and model.",surfaceTheme:N,children:(0,d.jsxs)("div",{className:"grid gap-3.5 sm:grid-cols-2",children:[(0,d.jsx)(r,{label:"Display name",htmlFor:"create-agent-name",surfaceTheme:N,children:(0,d.jsx)(w.p,{id:"create-agent-name",ref:as,value:at.name,onChange:a=>au(b=>({...b,name:a.target.value})),placeholder:az.defaultName,className:F(N)})}),(0,d.jsx)(r,{label:"Workspace",htmlFor:"create-agent-workspace",surfaceTheme:N,children:(0,d.jsx)("select",{id:"create-agent-workspace",value:at.workspaceId,onChange:b=>au(c=>({...c,workspaceId:b.target.value,modelId:c.modelId.trim()?c.modelId:(0,A.nd)(a,b.target.value),channelIds:[]})),style:T?{colorScheme:"light"}:void 0,className:F(N),children:a.workspaces.map(a=>(0,d.jsx)("option",{value:a.id,children:a.name},a.id))})}),(0,d.jsx)(r,{label:"Model",htmlFor:"create-agent-model",surfaceTheme:N,children:(0,d.jsxs)("select",{id:"create-agent-model",value:at.modelId,onChange:a=>au(b=>({...b,modelId:a.target.value})),style:T?{colorScheme:"light"}:void 0,className:F(N),children:[(0,d.jsx)("option",{value:"",children:a.diagnostics.modelReadiness.defaultModelReady?"Use OpenClaw default":ax?`Use suggested model (${ax})`:"Choose a model"}),a.models.map(a=>(0,d.jsx)("option",{value:a.id,children:a.id},a.id))]})}),(0,d.jsx)("p",{className:(0,q.cn)("text-[10px] leading-4",T?"text-[#9a8070]":"text-slate-500"),children:"OpenClaw generates the agent id automatically. Review it in the Summary panel."})]})}),(0,d.jsx)(H,{title:"Visual identity",description:"Emoji and display customization.",surfaceTheme:N,children:(0,d.jsxs)("div",{className:"space-y-3.5",children:[(0,d.jsx)(r,{label:"Emoji",htmlFor:"create-agent-emoji",surfaceTheme:N,children:(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsx)("span",{"aria-hidden":"true",className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 select-none text-base leading-none",children:at.emoji||az.defaultEmoji}),(0,d.jsx)(w.p,{id:"create-agent-emoji",value:at.emoji,onChange:a=>au(b=>({...b,emoji:a.target.value})),placeholder:az.defaultEmoji,className:(0,q.cn)(F(N),"pl-9")})]})}),(0,d.jsxs)("button",{type:"button",onClick:()=>Y(a=>!a),className:(0,q.cn)("inline-flex items-center gap-1.5 text-[10px] uppercase tracking-[0.16em] transition-colors",T?"text-[#8b7462] hover:text-[#5d4331]":"text-slate-500 hover:text-slate-300"),children:[(0,d.jsx)(i.A,{className:(0,q.cn)("h-3 w-3 transition-transform duration-200",X&&"rotate-90")}),X?"Hide":"Show","theme & avatar"]}),X?(0,d.jsxs)("div",{className:"grid gap-3.5 sm:grid-cols-2",children:[(0,d.jsx)(r,{label:"Theme",htmlFor:"create-agent-theme",surfaceTheme:N,children:(0,d.jsx)(w.p,{id:"create-agent-theme",value:at.theme,onChange:a=>au(b=>({...b,theme:a.target.value})),placeholder:az.defaultTheme,className:F(N)})}),(0,d.jsx)(r,{label:"Avatar URL",htmlFor:"create-agent-avatar",surfaceTheme:N,children:(0,d.jsx)(w.p,{id:"create-agent-avatar",value:at.avatar,onChange:a=>au(b=>({...b,avatar:a.target.value})),placeholder:"https://example.com/avatar.png",className:F(N)})})]}):null]})}),(0,d.jsx)(l.X,{snapshot:a,workspaceId:at.workspaceId,channelIds:at.channelIds,isSaving:aj,surfaceTheme:N,onChange:a=>au(b=>({...b,channelIds:a}))}),(0,d.jsx)(H,{title:"Heartbeat and policy",description:"Only override what you need.",surfaceTheme:N,children:(0,d.jsxs)("div",{className:"space-y-3.5",children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:(0,q.cn)("text-sm font-medium",T?"text-[#3f2f24]":"text-white"),children:"Heartbeat"}),(0,d.jsx)("p",{className:(0,q.cn)("mt-1 text-xs leading-5",T?"text-[#7f6958]":"text-slate-400"),children:"Enable only for periodic watch or triage agents."})]}),(0,d.jsx)("button",{type:"button",role:"switch","aria-checked":at.heartbeat.enabled,"aria-label":"Toggle heartbeat",onClick:()=>au(a=>({...a,heartbeat:a.heartbeat.enabled?{...a.heartbeat,enabled:!1}:{...a.heartbeat,enabled:!0,every:a.heartbeat.every||(0,o.A6)(a.policy.preset).every}})),className:(0,q.cn)("relative inline-flex h-6 w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 focus-visible:outline-none focus-visible:ring-2",T?at.heartbeat.enabled?"bg-[#c89e73] focus-visible:ring-[#c89e73]/40":"bg-[#ddd0c6] focus-visible:ring-[#c89e73]/40":at.heartbeat.enabled?"bg-cyan-400 focus-visible:ring-cyan-300/40":"bg-white/20 focus-visible:ring-cyan-300/40"),children:(0,d.jsx)("span",{className:(0,q.cn)("pointer-events-none inline-block h-5 w-5 rounded-full bg-white shadow-md ring-0 transition-transform duration-200",at.heartbeat.enabled?"translate-x-5":"translate-x-0")})})]}),at.heartbeat.enabled?(0,d.jsx)(r,{label:"Interval",htmlFor:"create-agent-heartbeat-every",surfaceTheme:N,children:(0,d.jsx)("select",{id:"create-agent-heartbeat-every",value:at.heartbeat.every,onChange:a=>au(b=>({...b,heartbeat:{...b.heartbeat,every:a.target.value}})),style:T?{colorScheme:"light"}:void 0,className:F(N),children:o.MQ.map(a=>(0,d.jsx)("option",{value:a.value,children:a.label},a.value))})}):null,(0,d.jsxs)("div",{className:"grid gap-3.5 sm:grid-cols-2",children:[(0,d.jsx)(t,{label:"Missing tool behavior",htmlFor:"create-agent-missing-tools",value:at.policy.missingToolBehavior,options:p.A_,surfaceTheme:N,onChange:a=>au(b=>({...b,policy:{...b.policy,missingToolBehavior:a}}))}),(0,d.jsx)(t,{label:"Install scope",htmlFor:"create-agent-install-scope",value:at.policy.installScope,options:p.sH,surfaceTheme:N,onChange:a=>au(b=>({...b,policy:{...b.policy,installScope:a}}))}),(0,d.jsx)(t,{label:"File access",htmlFor:"create-agent-file-access",value:at.policy.fileAccess,options:p.$x,surfaceTheme:N,onChange:a=>au(b=>({...b,policy:{...b.policy,fileAccess:a}}))}),(0,d.jsx)(t,{label:"Network access",htmlFor:"create-agent-network-access",value:at.policy.networkAccess,options:p.DS,surfaceTheme:N,onChange:a=>au(b=>({...b,policy:{...b.policy,networkAccess:a}}))})]})]})})]}),(0,d.jsx)("div",{className:"space-y-4",children:(0,d.jsx)(H,{title:"Summary",description:"Review the draft before creating.",surfaceTheme:N,className:"xl:sticky xl:top-4 xl:self-start xl:h-fit",children:(0,d.jsxs)("div",{className:"space-y-2.5",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:(0,q.cn)("inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-2xl border text-[14px]",T?"border-[#ded0c2] bg-[#faf5ef] text-[#7b604c]":"border-white/10 bg-white/5 text-base"),children:at.emoji||az.defaultEmoji}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:(0,q.cn)("truncate text-[13px] font-medium",T?"text-[#3f2f24]":"text-white"),children:at.name||az.defaultName}),(0,d.jsx)("p",{className:(0,q.cn)("mt-0.5 text-[11px] leading-4",T?"text-[#7f6958]":"text-slate-400"),children:aw?.name??"No workspace selected"})]})]}),(0,d.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,d.jsx)(m.E,{variant:"muted",className:"px-2 py-0.5 text-[9px] normal-case tracking-normal",children:"empty"===ab?"Empty / Custom":"preset"===ab?`${(0,p.Cf)(ad).label} preset`:"import"===ab?"Imported agent":"Start a flow"}),(0,d.jsx)(m.E,{variant:"muted",className:"px-2 py-0.5 text-[9px] normal-case tracking-normal",children:at.modelId||ax||"OpenClaw default"}),(0,d.jsxs)(m.E,{variant:at.heartbeat.enabled?"success":"muted",className:"px-2 py-0.5 text-[9px] normal-case tracking-normal",children:["Heartbeat ",at.heartbeat.enabled?at.heartbeat.every:"off"]})]}),(0,d.jsx)(K,{surfaceTheme:N}),(0,d.jsxs)("div",{className:(0,q.cn)("rounded-[18px] border p-2.5 text-[11px] leading-5",T?"border-[#e2d5c9] bg-[#faf6f1] text-[#7b6657]":"border-white/10 bg-white/[0.03] text-slate-400"),children:[(0,d.jsx)("p",{className:(0,q.cn)("text-[10px] uppercase tracking-[0.18em]",T?"text-[#8b7462]":"text-slate-500"),children:"Generated id"}),(0,d.jsx)("code",{className:(0,q.cn)("mt-1.5 block break-all rounded-2xl border px-3 py-1.5 text-[11px]",T?"border-[#dccfc3] bg-white text-[#4d392e]":"border-white/10 bg-white/5 text-slate-200"),children:aA||"unavailable"})]})]})})})]})}),(0,d.jsx)(v.Es,{className:(0,q.cn)("shrink-0 border-t px-6 py-4",T?"border-[#e5d8cb] bg-[#faf6f1]":"border-white/10 bg-transparent"),children:(0,d.jsxs)("div",{className:"flex w-full flex-col gap-3",children:[aI?(0,d.jsxs)("div",{className:(0,q.cn)("inline-flex items-start gap-2 rounded-2xl border px-3 py-2 text-[11px] leading-4",T?"border-[#ddcfbf] bg-white text-[#6e5646]":"border-white/10 bg-white/[0.04] text-slate-300"),children:[(0,d.jsx)(j.A,{className:"mt-0.5 h-3.5 w-3.5 animate-spin shrink-0"}),(0,d.jsx)("span",{children:aI})]}):null,(0,d.jsxs)("div",{className:"flex w-full flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsx)(u.$,{type:"button",variant:"secondary",size:"sm",onClick:()=>aK(!1),disabled:aj,className:T?"border-[#d8c7b8] bg-white text-[#4d392f] hover:bg-[#f5efe9]":void 0,children:"Cancel"}),(0,d.jsxs)("div",{className:"flex flex-col-reverse gap-2 sm:flex-row sm:items-center",children:["start"!==_?(0,d.jsx)(u.$,{type:"button",variant:"secondary",size:"sm",onClick:()=>{"details"===_?aa("empty"===ab?"start":ab??"start"):("preset"===_||"import"===_)&&aa("start")},disabled:aj,className:T?"border-[#d8c7b8] bg-white text-[#4d392f] hover:bg-[#f5efe9]":void 0,children:"Back"}):null,(0,d.jsx)(u.$,{type:"button",size:"sm",onClick:()=>{"details"===_?aM():(()=>{if("start"===_){if(!ab)return;if("empty"===ab)return aa("details");if("preset"===ab){au(a=>(0,A.nK)(a,ad)),aa("preset");return}return aa(ab)}if("preset"===_)return aa("details");if("import"===_){if(!af)return;aa("details")}})()},disabled:!aH,className:T?"bg-[#c89e73] text-white shadow-[0_10px_26px_rgba(161,125,101,0.22)] hover:bg-[#b47f53]":void 0,children:"details"===_?aj?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(j.A,{className:"mr-2 h-3.5 w-3.5 animate-spin"}),"syncing"===al?"Syncing canvas...":"Creating..."]}):"Create agent":"start"===_&&"empty"===ab?"Continue":"Next"})]})]})]})})]})})]}):(0,d.jsx)(d.Fragment,{children:M})}function C(a,b){return(0,A.nK)((0,A.TY)(a,{modelId:(0,A.nd)(b,a)}),"custom")}function D(a){return a?"empty"===a?["Start","Details"]:"preset"===a?["Start","Preset","Details"]:["Start","Import","Details"]:["Start"]}function E(a,b){return a&&"start"!==b?"details"===b?"empty"===a?1:2:1:0}function F(a){return(0,q.cn)("flex h-10 w-full rounded-2xl border px-3.5 py-2 text-[13px] outline-none transition-colors","light"===a?"border-[#dccfc3] bg-white text-[#3f2f24] placeholder:text-[#9b8573] focus:border-[#c89e73] focus:ring-2 focus:ring-[#c89e73]/15":"border-white/10 bg-white/5 text-white placeholder:text-slate-500 focus:border-cyan-300/30 focus:ring-2 focus:ring-cyan-300/15")}function G({labels:a,activeIndex:b,surfaceTheme:c="dark",onStepClick:e}){let f="light"===c;return(0,d.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:a.map((a,c)=>{let g=c===b,h=c<b,i=h&&!!e,j=(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:(0,q.cn)("inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-full text-[9px] font-medium",g?f?"bg-[#c89e73]/15 text-[#5d4331]":"bg-cyan-300/20 text-cyan-50":h?f?"bg-[#f0e7de] text-[#7a6556]":"bg-emerald-300/20 text-emerald-50":f?"bg-[#f2ece6] text-[#917866]":"bg-white/10 text-slate-400"),children:c+1}),(0,d.jsx)("span",{children:a})]}),k=(0,q.cn)("inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-[10px] transition-colors",g?f?"border-[#c89e73]/35 bg-[#f8efe4] text-[#5d4331]":"border-cyan-300/30 bg-cyan-400/10 text-cyan-50":h?f?"border-[#dccfc3] bg-white text-[#7e6757]":"border-emerald-300/20 bg-emerald-400/10 text-emerald-50":f?"border-[#e6dbd0] bg-white/80 text-[#8b7563]":"border-white/10 bg-white/[0.04] text-slate-400",i&&(f?"cursor-pointer hover:border-[#c89e73]/50 hover:bg-[#faf3ea]":"cursor-pointer hover:border-emerald-300/30 hover:bg-emerald-400/15"));return i?(0,d.jsx)("button",{type:"button",onClick:()=>e?.(c),className:k,children:j},`${a}-${c}`):(0,d.jsx)("div",{className:k,children:j},`${a}-${c}`)})})}function H({title:a,description:b,children:c,className:e,surfaceTheme:f="dark"}){let g="light"===f;return(0,d.jsxs)("section",{className:(0,q.cn)("rounded-[22px] border p-3.5",g?"border-[#e2d5c9] bg-white/92 shadow-[0_14px_34px_rgba(161,125,101,0.08)]":"border-white/10 bg-white/[0.03] shadow-[0_14px_34px_rgba(0,0,0,0.18)]",e),children:[(0,d.jsx)("div",{className:"flex items-start justify-between gap-3",children:(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:(0,q.cn)("text-[13px] font-medium",g?"text-[#3f2f24]":"text-white"),children:a}),b?(0,d.jsx)("p",{className:(0,q.cn)("mt-1 text-[11px] leading-4",g?"text-[#7f6958]":"text-slate-400"),children:b}):null]})}),(0,d.jsx)("div",{className:"mt-3 min-w-0",children:c})]})}function I({icon:a,title:b,description:c,helper:e,selected:f,surfaceTheme:g="dark",onSelect:h}){let j="light"===g;return(0,d.jsxs)("button",{type:"button",onClick:h,"aria-pressed":f,className:(0,q.cn)("flex w-full min-h-[272px] flex-col rounded-[28px] border p-3.5 text-left transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 md:max-w-[248px]",j?"focus-visible:ring-[#c89e73]/30":"focus-visible:ring-cyan-300/40",f?j?"border-[#d7c1ae] bg-[#fdf7ef] shadow-[0_14px_28px_rgba(161,125,101,0.08)]":"border-cyan-300/30 bg-cyan-400/10 shadow-[0_0_0_1px_rgba(34,211,238,0.1)]":j?"border-[#e7dbcf] bg-[rgba(255,252,247,0.9)] shadow-[0_10px_24px_rgba(161,125,101,0.05)] hover:border-[#d9c7b8] hover:bg-[#fffdf9]":"border-white/10 bg-white/[0.03] hover:border-white/20 hover:bg-white/[0.05]"),children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,d.jsx)("div",{className:(0,q.cn)("inline-flex h-10 w-10 shrink-0 items-center justify-center rounded-[18px] border",j?"border-[#e0d3c6] bg-[#faf6f0] text-[#7a5f4c]":"border-white/10 bg-white/5 text-white"),children:(0,d.jsx)(a,{className:"h-[17px] w-[17px]"})}),(0,d.jsx)(m.E,{variant:f?"default":"muted",className:(0,q.cn)("shrink-0 rounded-full px-2.5 py-0.5 text-[9px] normal-case tracking-normal",j?f?"border-[#d7c1ae] bg-[#f3e5d8] text-[#6a4b38]":"border-[#e3d6c8] bg-[rgba(255,255,255,0.82)] text-[#8a6f5d]":""),children:f?"Selected":"Available"})]}),(0,d.jsxs)("div",{className:"mt-6 space-y-1.5",children:[(0,d.jsx)("p",{className:(0,q.cn)("text-[15px] font-medium leading-5",j?"text-[#413126]":"text-white"),children:b}),(0,d.jsx)("p",{className:(0,q.cn)("text-[12px] leading-5",j?"text-[#8a7463]":"text-slate-400"),children:c})]}),(0,d.jsx)("div",{className:"mt-auto pt-6",children:(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,d.jsx)("span",{className:(0,q.cn)("max-w-[116px] text-[9px] uppercase leading-[1.35] tracking-[0.2em]",j?"text-[#9a8572]":"text-slate-500"),children:e}),(0,d.jsxs)("span",{className:(0,q.cn)("inline-flex items-center gap-1 text-[9px] uppercase tracking-[0.18em]",j?"text-[#7f6958]":"text-slate-400"),children:["Select",(0,d.jsx)(i.A,{className:"h-3 w-3"})]})]})})]})}function J({agent:a,workspaceName:b,selected:c,surfaceTheme:e="dark",onSelect:f}){let g=(0,p.Cf)(a.policy.preset),h="unassigned"===a.modelId?"default model":a.modelId,j="light"===e;return(0,d.jsxs)("button",{type:"button",onClick:f,"aria-pressed":c,className:(0,q.cn)("flex w-full flex-col rounded-[22px] border p-3.5 text-left transition-all duration-200 focus-visible:outline-none focus-visible:ring-2",j?"focus-visible:ring-[#c89e73]/30":"focus-visible:ring-cyan-300/40",c?j?"border-[#c89e73]/45 bg-[#fff8f0] shadow-[0_16px_40px_rgba(161,125,101,0.12)]":"border-cyan-300/30 bg-cyan-400/10 shadow-[0_0_0_1px_rgba(34,211,238,0.1)]":j?"border-[#e3d7cc] bg-white/92 shadow-[0_14px_34px_rgba(161,125,101,0.08)] hover:border-[#d4c2b4] hover:bg-white":"border-white/10 bg-white/[0.03] hover:border-white/20 hover:bg-white/[0.05]"),children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-start gap-3",children:[(0,d.jsx)("span",{className:(0,q.cn)("inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-2xl border text-[15px]",j?"border-[#ded0c2] bg-[#faf5ef] text-[#7b604c]":"border-white/10 bg-white/5"),children:a.identity.emoji??"\uD83E\uDD16"}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:(0,q.cn)("truncate text-[13px] font-medium",j?"text-[#3f2f24]":"text-white"),children:(0,z.CK)(a)}),(0,d.jsx)("p",{className:(0,q.cn)("mt-0.5 truncate text-[11px] leading-4",j?"text-[#7f6958]":"text-slate-500"),children:a.id})]})]}),(0,d.jsx)(m.E,{variant:c?"default":"muted",className:(0,q.cn)("shrink-0 px-2 py-0.5 text-[9px] normal-case tracking-normal",j?c?"border-[#c89e73]/35 bg-[#f5e7d8] text-[#6a4a34]":"border-[#e1d5c8] bg-white text-[#846a58]":""),children:c?"Selected":g.label})]}),(0,d.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2",children:[(0,d.jsx)(m.E,{variant:"muted",className:(0,q.cn)("px-2 py-0.5 text-[9px] normal-case tracking-normal",j?"border-[#e1d5c8] bg-[#fbf7f2] text-[#6f5747]":""),children:b}),(0,d.jsx)(m.E,{variant:"muted",className:(0,q.cn)("px-2 py-0.5 text-[9px] normal-case tracking-normal",j?"border-[#e1d5c8] bg-[#fbf7f2] text-[#6f5747]":""),children:h}),(0,d.jsx)(m.E,{variant:"ready"===a.status?"success":"muted",className:(0,q.cn)("px-2 py-0.5 text-[9px] normal-case tracking-normal",j?"ready"===a.status?"border-emerald-300/40 bg-emerald-100 text-emerald-800":"border-[#e1d5c8] bg-[#fbf7f2] text-[#6f5747]":""),children:a.status})]}),(0,d.jsx)("p",{className:(0,q.cn)("mt-3 text-[12px] leading-5",j?"text-[#7f6958]":"text-slate-400"),children:g.description}),(0,d.jsxs)("div",{className:"mt-3.5 flex items-center justify-between gap-3",children:[(0,d.jsx)("span",{className:(0,q.cn)("text-[10px] uppercase tracking-[0.16em]",j?"text-[#8b7462]":"text-slate-500"),children:"Import this agent as a new draft"}),(0,d.jsxs)("span",{className:(0,q.cn)("inline-flex items-center gap-1 text-[10px] uppercase tracking-[0.16em]",j?"text-[#7f6958]":"text-slate-400"),children:["Select",(0,d.jsx)(i.A,{className:"h-3 w-3"})]})]})]})}function K({surfaceTheme:a}){let b="light"===a;return(0,d.jsx)("div",{className:(0,q.cn)("rounded-[18px] border p-3 text-[11px] leading-5",b?"border-[#e2d5c9] bg-[#faf6f1] text-[#6f5849]":"border-white/10 bg-white/[0.03] text-slate-400"),children:(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)(k.A,{className:(0,q.cn)("mt-0.5 h-3.5 w-3.5 shrink-0",b?"text-[#8b6d56]":"text-cyan-200")}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:(0,q.cn)("text-[12px] font-medium",b?"text-[#3f2f24]":"text-slate-100"),children:"Workspace-root context"}),(0,d.jsxs)("p",{className:"mt-1",children:["This agent profile is written to the workspace root ",(0,d.jsx)("code",{children:"AGENTS.md"}),". OpenClaw loads that file as shared runtime context."]})]})]})})}},98867:(a,b,c)=>{Promise.resolve().then(c.bind(c,43081))}};