hive-am 1.0.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (268) hide show
  1. package/CHANGELOG.md +114 -1
  2. package/README.md +34 -4
  3. package/package.json +13 -2
  4. package/server/dist/api.js +42 -677
  5. package/server/dist/connections/addressing.js +87 -0
  6. package/server/dist/connections/channel-skill.js +62 -0
  7. package/server/dist/connections/fake.js +1 -0
  8. package/server/dist/connections/files.js +45 -1
  9. package/server/dist/connections/format.js +9 -1
  10. package/server/dist/connections/manager.js +60 -3
  11. package/server/dist/connections/outbound.js +2 -1
  12. package/server/dist/connections/prompt.js +12 -3
  13. package/server/dist/connections/rate.js +20 -0
  14. package/server/dist/connections/router.js +55 -22
  15. package/server/dist/connections/secrets.js +52 -0
  16. package/server/dist/connections/store.js +6 -43
  17. package/server/dist/connections/telegram.js +105 -14
  18. package/server/dist/cron.js +138 -0
  19. package/server/dist/db/json.js +16 -0
  20. package/server/dist/db/migrations.js +199 -0
  21. package/server/dist/db.js +98 -196
  22. package/server/dist/errors.js +11 -0
  23. package/server/dist/git/browse.js +99 -0
  24. package/server/dist/git/ops.js +136 -19
  25. package/server/dist/git/repo.js +2 -1
  26. package/server/dist/history/claude.js +33 -20
  27. package/server/dist/history/index.js +17 -9
  28. package/server/dist/history/kiro.js +17 -12
  29. package/server/dist/history/lines.js +12 -0
  30. package/server/dist/history/opencode.js +18 -1
  31. package/server/dist/http/body.js +46 -0
  32. package/server/dist/http/errors.js +21 -0
  33. package/server/dist/http/guards.js +44 -0
  34. package/server/dist/http/router.js +24 -0
  35. package/server/dist/http/routes/agents.js +103 -0
  36. package/server/dist/http/routes/channel.js +16 -0
  37. package/server/dist/http/routes/colonies.js +9 -0
  38. package/server/dist/http/routes/connections.js +36 -0
  39. package/server/dist/http/routes/fs.js +22 -0
  40. package/server/dist/http/routes/git.js +90 -0
  41. package/server/dist/http/routes/meta.js +11 -0
  42. package/server/dist/http/routes/notebook.js +34 -0
  43. package/server/dist/http/routes/orchestration.js +32 -0
  44. package/server/dist/http/routes/resources.js +68 -0
  45. package/server/dist/http/routes/schedules.js +40 -0
  46. package/server/dist/http/routes/skills.js +47 -0
  47. package/server/dist/http/routes/terminals.js +18 -0
  48. package/server/dist/http/routes/types.js +36 -0
  49. package/server/dist/http/validate.js +65 -0
  50. package/server/dist/index.js +74 -4
  51. package/server/dist/instructions.js +23 -11
  52. package/server/dist/objects/agent.js +49 -0
  53. package/server/dist/objects/database.js +451 -0
  54. package/server/dist/objects/db-history.js +79 -0
  55. package/server/dist/objects/docker-info.js +75 -0
  56. package/server/dist/objects/docker.js +285 -0
  57. package/server/dist/objects/driver-props.js +196 -0
  58. package/server/dist/objects/exec.js +16 -0
  59. package/server/dist/objects/http-history.js +44 -0
  60. package/server/dist/objects/http-script.js +644 -0
  61. package/server/dist/objects/http.js +735 -0
  62. package/server/dist/objects/index.js +445 -0
  63. package/server/dist/objects/model.js +250 -0
  64. package/server/dist/objects/runner.js +211 -0
  65. package/server/dist/objects/stats.js +106 -0
  66. package/server/dist/objects/store.js +115 -0
  67. package/server/dist/objects/supervisor.js +111 -0
  68. package/server/dist/objects/templates.js +67 -0
  69. package/server/dist/providers/claude.js +5 -13
  70. package/server/dist/providers/index.js +7 -1
  71. package/server/dist/providers/kiro.js +4 -5
  72. package/server/dist/providers/opencode-server.js +164 -0
  73. package/server/dist/providers/opencode.js +60 -37
  74. package/server/dist/providers/preamble.js +2 -0
  75. package/server/dist/providers/spawn.js +31 -3
  76. package/server/dist/runtime.js +10 -7
  77. package/server/dist/schedules.js +222 -0
  78. package/server/dist/seed.js +15 -11
  79. package/server/dist/services/agents.js +90 -0
  80. package/server/dist/services/colonies.js +38 -0
  81. package/server/dist/services/connections.js +76 -0
  82. package/server/dist/services/notebook.js +22 -0
  83. package/server/dist/services/providers.js +27 -0
  84. package/server/dist/services/schedules.js +18 -0
  85. package/server/dist/sessions-summary.js +51 -0
  86. package/server/dist/skills/defaults.js +120 -0
  87. package/server/dist/skills/notebook.js +3 -8
  88. package/server/dist/terminals.js +177 -0
  89. package/server/dist/wake.js +149 -0
  90. package/server/dist/watch.js +201 -0
  91. package/server/mcp/dispatch.mjs +169 -1
  92. package/web/.next/BUILD_ID +1 -1
  93. package/web/.next/app-build-manifest.json +145 -85
  94. package/web/.next/app-path-routes-manifest.json +5 -2
  95. package/web/.next/build-manifest.json +14 -14
  96. package/web/.next/prerender-manifest.json +85 -37
  97. package/web/.next/react-loadable-manifest.json +26 -1
  98. package/web/.next/required-server-files.json +13 -1
  99. package/web/.next/routes-manifest.json +32 -0
  100. package/web/.next/server/app/_not-found/page.js +2 -2
  101. package/web/.next/server/app/_not-found/page.js.nft.json +1 -1
  102. package/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  103. package/web/.next/server/app/_not-found.html +1 -1
  104. package/web/.next/server/app/_not-found.rsc +12 -11
  105. package/web/.next/server/app/agents/[id]/page.js +4 -4
  106. package/web/.next/server/app/agents/[id]/page.js.nft.json +1 -1
  107. package/web/.next/server/app/agents/[id]/page_client-reference-manifest.js +1 -1
  108. package/web/.next/server/app/agents/page.js +2 -2
  109. package/web/.next/server/app/agents/page.js.nft.json +1 -1
  110. package/web/.next/server/app/agents/page_client-reference-manifest.js +1 -1
  111. package/web/.next/server/app/agents.html +1 -1
  112. package/web/.next/server/app/agents.rsc +14 -13
  113. package/web/.next/server/app/connections/page.js +2 -2
  114. package/web/.next/server/app/connections/page.js.nft.json +1 -1
  115. package/web/.next/server/app/connections/page_client-reference-manifest.js +1 -1
  116. package/web/.next/server/app/connections.html +1 -1
  117. package/web/.next/server/app/connections.rsc +14 -13
  118. package/web/.next/server/app/index.html +1 -1
  119. package/web/.next/server/app/index.rsc +14 -13
  120. package/web/.next/server/app/page.js +2 -2
  121. package/web/.next/server/app/page.js.nft.json +1 -1
  122. package/web/.next/server/app/page_client-reference-manifest.js +1 -1
  123. package/web/.next/server/app/relations/page.js +2 -2
  124. package/web/.next/server/app/relations/page.js.nft.json +1 -1
  125. package/web/.next/server/app/relations/page_client-reference-manifest.js +1 -1
  126. package/web/.next/server/app/relations.html +1 -1
  127. package/web/.next/server/app/relations.rsc +14 -13
  128. package/web/.next/server/app/resources/[id]/page.js +2 -0
  129. package/web/.next/server/app/resources/[id]/page.js.nft.json +1 -0
  130. package/web/.next/server/app/resources/[id]/page_client-reference-manifest.js +1 -0
  131. package/web/.next/server/app/resources/page.js +2 -0
  132. package/web/.next/server/app/resources/page.js.nft.json +1 -0
  133. package/web/.next/server/app/resources/page_client-reference-manifest.js +1 -0
  134. package/web/.next/server/app/resources.html +1 -0
  135. package/web/.next/server/app/resources.meta +15 -0
  136. package/web/.next/server/app/resources.rsc +25 -0
  137. package/web/.next/server/app/schedules/page.js +2 -0
  138. package/web/.next/server/app/schedules/page.js.nft.json +1 -0
  139. package/web/.next/server/app/schedules/page_client-reference-manifest.js +1 -0
  140. package/web/.next/server/app/schedules.html +1 -0
  141. package/web/.next/server/app/schedules.meta +15 -0
  142. package/web/.next/server/app/schedules.rsc +25 -0
  143. package/web/.next/server/app/sessions/page.js +2 -2
  144. package/web/.next/server/app/sessions/page.js.nft.json +1 -1
  145. package/web/.next/server/app/sessions/page_client-reference-manifest.js +1 -1
  146. package/web/.next/server/app/sessions.html +1 -1
  147. package/web/.next/server/app/sessions.rsc +14 -13
  148. package/web/.next/server/app/skills/page.js +2 -2
  149. package/web/.next/server/app/skills/page.js.nft.json +1 -1
  150. package/web/.next/server/app/skills/page_client-reference-manifest.js +1 -1
  151. package/web/.next/server/app/skills.html +1 -1
  152. package/web/.next/server/app/skills.rsc +14 -13
  153. package/web/.next/server/app/types/page.js +2 -2
  154. package/web/.next/server/app/types/page.js.nft.json +1 -1
  155. package/web/.next/server/app/types/page_client-reference-manifest.js +1 -1
  156. package/web/.next/server/app/types.html +1 -1
  157. package/web/.next/server/app/types.rsc +14 -13
  158. package/web/.next/server/app-paths-manifest.json +5 -2
  159. package/web/.next/server/chunks/143.js +1 -1
  160. package/web/.next/server/chunks/274.js +1 -0
  161. package/web/.next/server/chunks/306.js +1 -0
  162. package/web/.next/server/chunks/423.js +1 -0
  163. package/web/.next/server/chunks/505.js +6 -0
  164. package/web/.next/server/chunks/555.js +1 -0
  165. package/web/.next/server/chunks/612.js +1 -0
  166. package/web/.next/server/chunks/638.js +1 -0
  167. package/web/.next/server/chunks/692.js +18 -0
  168. package/web/.next/server/chunks/716.js +2 -0
  169. package/web/.next/server/chunks/790.js +11 -0
  170. package/web/.next/server/chunks/802.js +1 -0
  171. package/web/.next/server/chunks/890.js +1 -1
  172. package/web/.next/server/chunks/919.js +1 -0
  173. package/web/.next/server/chunks/950.js +6 -0
  174. package/web/.next/server/middleware-build-manifest.js +1 -1
  175. package/web/.next/server/middleware-react-loadable-manifest.js +1 -1
  176. package/web/.next/server/next-font-manifest.js +1 -1
  177. package/web/.next/server/next-font-manifest.json +1 -1
  178. package/web/.next/server/pages/404.html +1 -1
  179. package/web/.next/server/pages/500.html +1 -1
  180. package/web/.next/server/server-reference-manifest.json +1 -1
  181. package/web/.next/static/chunks/0937d497-114a2a3de515565e.js +1 -0
  182. package/web/.next/static/chunks/176-aeaf907a6ea5627d.js +1 -0
  183. package/web/.next/static/chunks/291-efae53ea5f7ee92d.js +1 -0
  184. package/web/.next/static/chunks/2b9ff8ee-969e65cc354b2150.js +1 -0
  185. package/web/.next/static/chunks/30-9adcbe92b15a6815.js +1 -0
  186. package/web/.next/static/chunks/316-26da9cc233ba7557.js +1 -0
  187. package/web/.next/static/chunks/350-56599dc3bf06066d.js +1 -0
  188. package/web/.next/static/chunks/486-13e08542f3a1cbac.js +1 -0
  189. package/web/.next/static/chunks/491-6b4e6201f5110dff.js +1 -0
  190. package/web/.next/static/chunks/517-ccaf8cc5c733cbd8.js +1 -0
  191. package/web/.next/static/chunks/545.bfbd92b7632c09de.js +1 -0
  192. package/web/.next/static/chunks/{805-d946ebedb7e85f73.js → 562-7c2e33d838e869bf.js} +1 -1
  193. package/web/.next/static/chunks/581-3ad5c4343dad3f50.js +1 -0
  194. package/web/.next/static/chunks/586-f7017d585a84738d.js +1 -0
  195. package/web/.next/static/chunks/657.b4c39e676c3e20dc.js +1 -0
  196. package/web/.next/static/chunks/701.6abcaf5e60463eef.js +6 -0
  197. package/web/.next/static/chunks/705-a16e1fe09be1ac7f.js +1 -0
  198. package/web/.next/static/chunks/706-fa2be0f10ffebe6a.js +1 -0
  199. package/web/.next/static/chunks/837-33c7480524f48577.js +1 -0
  200. package/web/.next/static/chunks/839-23c5508622fae942.js +1 -0
  201. package/web/.next/static/chunks/844-fe55292e0701f436.js +1 -0
  202. package/web/.next/static/chunks/89-b194fcffe5120c44.js +1 -0
  203. package/web/.next/static/chunks/97.594543c2196de524.js +1 -0
  204. package/web/.next/static/chunks/app/_not-found/page-238a7b80bda6b4ae.js +1 -0
  205. package/web/.next/static/chunks/app/agents/[id]/page-4af6c246c4ca7a97.js +1 -0
  206. package/web/.next/static/chunks/app/agents/page-f4c4c80f955f3967.js +1 -0
  207. package/web/.next/static/chunks/app/connections/page-0936beaf02d863c6.js +1 -0
  208. package/web/.next/static/chunks/app/layout-87ebb70bd9cb8443.js +1 -0
  209. package/web/.next/static/chunks/app/page-a7f292117b7d76bf.js +1 -0
  210. package/web/.next/static/chunks/app/relations/page-fba25393c8688714.js +1 -0
  211. package/web/.next/static/chunks/app/resources/[id]/page-d110d89bb8b5fca7.js +1 -0
  212. package/web/.next/static/chunks/app/resources/page-bbd0b450d3f3131d.js +1 -0
  213. package/web/.next/static/chunks/app/schedules/page-a1124397fc760413.js +1 -0
  214. package/web/.next/static/chunks/app/sessions/page-0e322811b0cde724.js +1 -0
  215. package/web/.next/static/chunks/app/skills/page-22ea0ef89d9f7a13.js +1 -0
  216. package/web/.next/static/chunks/app/types/page-18c4e1db2724d41d.js +1 -0
  217. package/web/.next/static/chunks/fcafe1ac.366e4950d3b0d4b7.js +18 -0
  218. package/web/.next/static/chunks/framework-bbac72adbbe2d328.js +1 -0
  219. package/web/.next/static/chunks/main-app-6086068e5fb5eacd.js +1 -0
  220. package/web/.next/static/chunks/main-c15f3fee674e0303.js +1 -0
  221. package/web/.next/static/chunks/pages/_app-d1670a2c6ce392fc.js +1 -0
  222. package/web/.next/static/chunks/pages/_error-95aac014d202fa7a.js +1 -0
  223. package/web/.next/static/chunks/webpack-ef515e41a83a16ac.js +1 -0
  224. package/web/.next/static/css/945795da867f5250.css +1 -0
  225. package/web/.next/static/css/dd4e32c285f75776.css +1 -0
  226. package/web/.next/static/p4S3i9kvO359GW91DQiHu/_buildManifest.js +1 -0
  227. package/web/.next/trace +29 -23
  228. package/web/.next/types/app/resources/[id]/page.ts +84 -0
  229. package/web/.next/types/app/resources/page.ts +84 -0
  230. package/web/.next/types/app/schedules/page.ts +84 -0
  231. package/web/.next/types/routes.d.ts +7 -2
  232. package/web/.next/types/validator.ts +27 -0
  233. package/web/next.config.mjs +4 -0
  234. package/web/.next/server/chunks/149.js +0 -11
  235. package/web/.next/server/chunks/247.js +0 -1
  236. package/web/.next/server/chunks/851.js +0 -1
  237. package/web/.next/server/chunks/932.js +0 -2
  238. package/web/.next/static/84BpRSahg2BTwk3mX6AG8/_buildManifest.js +0 -1
  239. package/web/.next/static/chunks/0937d497-44abb0f9355ace92.js +0 -1
  240. package/web/.next/static/chunks/2b9ff8ee-c3b61ac1e608c57d.js +0 -1
  241. package/web/.next/static/chunks/351-65da8c1a6e25f93b.js +0 -1
  242. package/web/.next/static/chunks/463-6ae35cdefdc59169.js +0 -1
  243. package/web/.next/static/chunks/493-92266798be872b8f.js +0 -1
  244. package/web/.next/static/chunks/517-eb26c72f6059aa26.js +0 -1
  245. package/web/.next/static/chunks/657.f1e03b7b65eba1d9.js +0 -1
  246. package/web/.next/static/chunks/687-3a4205f51be38602.js +0 -1
  247. package/web/.next/static/chunks/837-fd7623601dc78ed8.js +0 -1
  248. package/web/.next/static/chunks/850-318f32484989dd59.js +0 -1
  249. package/web/.next/static/chunks/89-ace2e1aa63babfdf.js +0 -1
  250. package/web/.next/static/chunks/951-e250b541b67da7ce.js +0 -1
  251. package/web/.next/static/chunks/app/_not-found/page-bbd54d7b9a55d7ae.js +0 -1
  252. package/web/.next/static/chunks/app/agents/[id]/page-5eaf094fec246f1b.js +0 -1
  253. package/web/.next/static/chunks/app/agents/page-e9b17f1c3439ef98.js +0 -1
  254. package/web/.next/static/chunks/app/connections/page-c6afd90abd82d47a.js +0 -1
  255. package/web/.next/static/chunks/app/layout-c415d5a847cd94b3.js +0 -1
  256. package/web/.next/static/chunks/app/page-6fc87fc5a128a204.js +0 -1
  257. package/web/.next/static/chunks/app/relations/page-0355a93a8eb67989.js +0 -1
  258. package/web/.next/static/chunks/app/sessions/page-beae9a74a07d69e0.js +0 -1
  259. package/web/.next/static/chunks/app/skills/page-4f839ac913e26d32.js +0 -1
  260. package/web/.next/static/chunks/app/types/page-4f6b99af3232f861.js +0 -1
  261. package/web/.next/static/chunks/framework-0e68884e76d9a8d3.js +0 -1
  262. package/web/.next/static/chunks/main-app-d6f73ccd41f325c5.js +0 -1
  263. package/web/.next/static/chunks/main-cd22509db15764e2.js +0 -1
  264. package/web/.next/static/chunks/pages/_app-0f75d689c738a6fc.js +0 -1
  265. package/web/.next/static/chunks/pages/_error-d481f6d49fb4455d.js +0 -1
  266. package/web/.next/static/chunks/webpack-d40de72e52f65f79.js +0 -1
  267. package/web/.next/static/css/abe1a6216491f944.css +0 -1
  268. /package/web/.next/static/{84BpRSahg2BTwk3mX6AG8 → p4S3i9kvO359GW91DQiHu}/_ssgManifest.js +0 -0
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[974],{2432:(e,t,l)=>{"use strict";l.d(t,{A:()=>n});let n=(0,l(74955).A)("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]])},3414:(e,t,l)=>{"use strict";l.d(t,{A:()=>n});let n=(0,l(74955).A)("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]])},6261:(e,t,l)=>{"use strict";l.d(t,{A:()=>n});let n=(0,l(74955).A)("Hexagon",[["path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z",key:"yt0hxn"}]])},6673:(e,t,l)=>{"use strict";l.d(t,{A:()=>n});let n=(0,l(74955).A)("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]])},7991:(e,t,l)=>{"use strict";l.d(t,{A:()=>n});let n=(0,l(74955).A)("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]])},26701:(e,t,l)=>{"use strict";l.d(t,{A:()=>n});let n=(0,l(74955).A)("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]])},29416:(e,t,l)=>{"use strict";l.d(t,{A:()=>n});let n=(0,l(74955).A)("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]])},32098:(e,t,l)=>{"use strict";l.d(t,{A:()=>n});let n=(0,l(74955).A)("SlidersHorizontal",[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]])},32335:(e,t,l)=>{"use strict";l.d(t,{A:()=>n});let n=(0,l(74955).A)("LockOpen",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]])},33691:(e,t,l)=>{"use strict";l.d(t,{A:()=>n});let n=(0,l(74955).A)("UserPlus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]])},34265:(e,t,l)=>{"use strict";l.d(t,{A:()=>n});let n=(0,l(74955).A)("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},34978:(e,t,l)=>{"use strict";l.d(t,{A:()=>n});let n=(0,l(74955).A)("Container",[["path",{d:"M22 7.7c0-.6-.4-1.2-.8-1.5l-6.3-3.9a1.72 1.72 0 0 0-1.7 0l-10.3 6c-.5.2-.9.8-.9 1.4v6.6c0 .5.4 1.2.8 1.5l6.3 3.9a1.72 1.72 0 0 0 1.7 0l10.3-6c.5-.3.9-1 .9-1.5Z",key:"1t2lqe"}],["path",{d:"M10 21.9V14L2.1 9.1",key:"o7czzq"}],["path",{d:"m10 14 11.9-6.9",key:"zm5e20"}],["path",{d:"M14 19.8v-8.1",key:"159ecu"}],["path",{d:"M18 17.5V9.4",key:"11uown"}]])},36098:(e,t,l)=>{"use strict";l.r(t),l.d(t,{default:()=>Z});var n=l(94799),s=l(41463),o=l.n(s),a=l(34023),i=l(92947),c=l(6261),r=l(77841),d=l(73784),h=l(75406),m=l(71529),y=l(14910),u=l(32098),x=l(70665);let p=(0,l(74955).A)("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);var g=l(97356),k=l(48538),j=l(77021),f=l(3749),v=l(47890),b=l(86606),w=l(41435),N=l(1517),C=l(12646),A=l(73506),M=l(22214),_=l(69654);let z=v.hg,L=["cwd","permission","skills","prompt"];function S(e){let{colony:t,onClose:l}=e,{t:s}=(0,_.s9)(),{agents:o,skills:i,colonies:c,refresh:r}=(0,k.q5)(),d=(0,b.dj)(),[h,m]=(0,a.useState)(()=>t?{name:t.name,color:t.color,cwd:t.cwd,permission:t.permission,system_prompt:t.system_prompt,skill_ids:t.skill_ids,skill_loads:t.skill_loads,agent_ids:t.agent_ids,inherit:t.inherit}:{name:"",color:z[c.length%z.length],cwd:"",permission:"acceptEdits",system_prompt:"",skill_ids:[],skill_loads:{},agent_ids:[],inherit:{cwd:!0,permission:!0,skills:!0,prompt:!0}}),y=(0,a.useMemo)(()=>JSON.stringify(h),[]),u=JSON.stringify(h)!==y;(0,A.h)(u);let[x,p]=(0,a.useState)(!1),j=()=>{u?p(!0):l()},[v,w]=(0,a.useState)(""),[N,L]=(0,a.useState)(!1),[S,F]=(0,a.useState)(!1),[D,E]=(0,a.useState)(!1),H=(e,t)=>m(l=>({...l,[e]:t})),T=async e=>{E(!0);try{let n={...h,name:h.name.trim(),color:h.color.toLowerCase(),inherit:e};t?await f.FH.patch("/colonies/".concat(t.id),n):await f.FH.post("/colonies",n),await r(["agents","colonies"]),d(t?s("colony.saved"):s("colony.created")),l()}catch(e){L(!1),w(e instanceof Error?e.message:s("edit.saveFailed")),E(!1)}};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(b._s,{title:t?s("colony.editTitle",{name:t.name}):s("colony.newTitle"),subtitle:s("colony.subtitle"),onClose:j,footer:(0,n.jsxs)(n.Fragment,{children:[t&&(0,n.jsxs)("button",{className:"btn danger push-r",onClick:()=>F(!0),children:[(0,n.jsx)(g.A,{size:15}),s("common.delete")]}),(0,n.jsx)("button",{className:"btn ghost",onClick:j,children:s("common.cancel")}),(0,n.jsx)("button",{className:"btn primary",onClick:()=>h.name.trim()?c.some(e=>e.id!==(null==t?void 0:t.id)&&e.name.toLowerCase()===h.name.trim().toLowerCase())?void w(s("colony.err.nameTaken")):/^#[0-9a-f]{6}$/i.test(h.color)?void(w(""),L(!0)):void w(s("colony.err.color")):void w(s("colony.err.name")),children:t?s("colony.save"):s("colony.create")})]}),children:[(0,n.jsx)(b.D0,{label:s("form.name"),error:v,children:(0,n.jsx)("input",{className:"input",value:h.name,onChange:e=>H("name",e.target.value),placeholder:s("colony.name.placeholder"),"data-autofocus":!0})}),(0,n.jsx)(b.D0,{label:s("colony.color"),children:(0,n.jsxs)("div",{className:"swatches",children:[z.map(e=>(0,n.jsx)("button",{type:"button",className:"swatch",style:{"--c":e},"aria-pressed":h.color.toLowerCase()===e,"aria-label":s("colony.colorOption",{color:e}),onClick:()=>H("color",e)},e)),(0,n.jsx)("label",{className:"swatch custom ".concat(z.includes(h.color.toLowerCase())?"":"on"),style:{"--c":/^#[0-9a-f]{6}$/i.test(h.color)?h.color:"transparent"},title:s("colony.colorCustom"),children:(0,n.jsx)("input",{type:"color",value:/^#[0-9a-f]{6}$/i.test(h.color)?h.color:"#2f8f5b",onChange:e=>H("color",e.target.value),"aria-label":s("colony.colorCustom")})}),(0,n.jsx)("input",{className:"input hex-input mono",value:h.color,maxLength:7,spellCheck:!1,"aria-label":s("colony.colorHex"),placeholder:"#2f8f5b",onChange:e=>{let t=e.target.value.trim();H("color",t.startsWith("#")||!t?t:"#".concat(t))}})]})}),(0,n.jsx)(b.dR,{value:h.cwd,onChange:e=>H("cwd",e)}),(0,n.jsx)(b.en,{value:h.permission,onChange:e=>H("permission",e)}),(0,n.jsx)(b.D0,{label:s("inherit.context"),hint:s("colony.context.hint"),children:(0,n.jsx)(C.n,{value:h.system_prompt,onChange:e=>H("system_prompt",e),placeholder:s("colony.context.placeholder"),defaultView:"write",minHeight:160})}),(0,n.jsx)(b.D0,{label:s("form.skills"),children:(0,n.jsx)(b.kV,{skills:i,value:h.skill_ids,loads:h.skill_loads,onChange:(e,t)=>m({...h,skill_ids:e,skill_loads:t})})}),(0,n.jsx)(b.D0,{label:s("colony.members"),hint:s("colony.members.hint"),children:0===o.length?(0,n.jsx)("p",{className:"hint",children:s("colony.members.empty")}):(0,n.jsx)(M.C,{value:h.agent_ids,onChange:e=>H("agent_ids",e),items:o.map(e=>{let l=e.colony_id&&e.colony_id!==(null==t?void 0:t.id)?c.find(t=>t.id===e.colony_id):null;return{id:e.id,name:e.name,note:l?s("colony.currentlyIn",{name:l.name}):e.description||s("role.".concat(e.role))}})})})]}),N&&(0,n.jsx)(q,{draft:h,colony:t,members:o.filter(e=>h.agent_ids.includes(e.id)),busy:D,onBack:()=>L(!1),onConfirm:T}),x&&(0,n.jsx)(b.TM,{danger:!0,title:s("fa.unsaved.title"),body:s("fa.unsaved.body"),confirmLabel:s("fa.unsaved.discard"),cancelLabel:s("fa.unsaved.keep"),onClose:()=>p(!1),onConfirm:l}),S&&t&&(0,n.jsx)(b.TM,{title:s("colony.deleteTitle",{name:t.name}),body:s("colony.deleteBody",{count:t.agent_ids.length}),danger:!0,confirmLabel:s("colony.delete"),cancelLabel:s("colony.keep"),onClose:()=>F(!1),onConfirm:async()=>{await f.FH.del("/colonies/".concat(t.id)),await r(["agents","colonies"]),d(s("colony.deleted")),l()}})]})}function q(e){let{draft:t,colony:l,members:s,busy:o,onBack:i,onConfirm:c}=e,{t:r}=(0,_.s9)(),d={cwd:!!t.cwd,permission:!0,skills:t.skill_ids.length>0,prompt:!!t.system_prompt.trim()},[h,m]=(0,a.useState)(()=>({cwd:(!l||l.inherit.cwd)&&d.cwd,permission:!l||l.inherit.permission,skills:(!l||l.inherit.skills)&&d.skills,prompt:(!l||l.inherit.prompt)&&d.prompt})),y=(0,a.useMemo)(()=>h.cwd&&t.cwd&&s.filter(e=>!e.overrides.includes("cwd")&&e.effective.cwd!==t.cwd).length,[h.cwd,t.cwd,s]);return(0,n.jsxs)(b.aF,{title:r("inheritAsk.title"),onClose:i,children:[(0,n.jsx)("p",{className:"muted small m0",children:r("inheritAsk.intro")}),(0,n.jsx)("div",{className:"col gap-s",children:L.map(e=>(0,n.jsx)(b.Tl,{disabled:!d[e],checked:h[e],onChange:t=>m(l=>({...l,[e]:t})),label:(0,n.jsxs)(n.Fragment,{children:[r("inheritAsk.field.".concat(e)),"cwd"===e&&t.cwd?(0,n.jsxs)("span",{className:"muted mono fw-400",children:[" \xb7 ",(0,v._1)(t.cwd)]}):null,"permission"===e?(0,n.jsxs)("span",{className:"muted fw-400",children:[" \xb7 ",(0,v.Ck)(t.permission)]}):null]}),hint:d[e]?r("inheritAsk.hint.".concat(e)):r("inheritAsk.empty.".concat(e))},e))}),y?(0,n.jsx)(b.lZ,{kind:"honey",children:r("inheritAsk.folderMoves",{count:Number(y)})}):null,(0,n.jsxs)("div",{className:"row push-end",children:[(0,n.jsx)("button",{className:"btn ghost",onClick:i,children:r("common.back")}),(0,n.jsx)("button",{className:"btn primary",disabled:o,onClick:()=>c(h),children:o?r("common.saving"):l?r("colony.save"):r("colony.create")})]})]})}var F=l(5300),D=l(89128);function E(e){let{agent:t,onClose:l}=e,{t:s}=(0,_.s9)(),o=(0,D.A)(t,{onSaved:l,onDeleted:l});return o.draft?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(b._s,{title:s("edit.title",{name:t.name}),subtitle:s("running"===t.status?"edit.subtitleRunning":"edit.subtitleIdle"),onClose:l,footer:o.actions({onCancel:l}),children:(0,n.jsx)(F.SU,{draft:o.draft,onChange:o.setDraft,errors:o.errors,selfId:t.id})}),o.deleteModal]}):null}var H=l(48776),T=l(42366),O=l(5372),I=l(31606),V=l(95587),R=l(74988);let W=74*Math.sqrt(3),P=[[1,0],[1,-1],[0,-1],[-1,0],[-1,1],[0,1]],B=e=>{let[t,l]=e;return{x:W*(t+l/2),y:111*l}},K=(e,t,l)=>Array.from({length:6},(n,s)=>{let o=(60*s-30)*Math.PI/180;return"".concat((e+l*Math.cos(o)).toFixed(1),",").concat((t+l*Math.sin(o)).toFixed(1))}).join(" ");function Z(){var e,t,l;let{t:s}=(0,_.s9)(),{agents:C,colonies:A,objects:M,dispatches:z,ready:L,error:q,retry:F,refresh:D}=(0,k.q5)(),Z=(0,b.dj)(),[J,U]=(0,a.useState)(null),[X,G]=(0,a.useState)(null),[Y,$]=(0,a.useState)(null),[Q,ee]=(0,a.useState)(null),[et,el]=(0,a.useState)(null),[en,es]=(0,a.useState)(null),[eo,ea]=(0,j.ud)("hive-colony-layout",{}),[ei,ec]=(0,a.useState)(null),[er,ed]=(0,j.ud)("hive-colony-zoom",1),eh=er>=.4&&er<=2.5?er:1,em=e=>ed(Math.min(2.5,Math.max(.4,Math.round(100*e)/100))),ey=(0,a.useMemo)(()=>ei?{...eo,[ei.key]:{x:ei.x,y:ei.y}}:eo,[eo,ei]),{clusters:eu,width:ex,height:ep}=(0,a.useMemo)(()=>(function(e,t,l){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},s=e=>!!e&&t.some(t=>t.id===e),o=t.map(t=>({key:t.id,colony:t,members:e.filter(e=>e.colony_id===t.id),things:l.filter(e=>e.colony_id===t.id)}));o.push({key:"free",colony:null,members:e.filter(e=>!s(e.colony_id)),things:l.filter(e=>!s(e.colony_id))});let a=[],i=0,c=0,r=0;for(let t of o){if(!t.members.length&&!t.things.length&&!t.colony&&e.length+l.length>0)continue;let s=function(e){let t=e.filter(e=>"orchestrator"===e.role);for(let l of[...t])for(let n of l.worker_ids){let l=e.find(e=>e.id===n);l&&!t.includes(l)&&t.push(l)}for(let l of e)t.includes(l)||t.push(l);return t}(t.members),o=(function(e){let t=[[0,0]];for(let l=1;t.length<e;l++){let e=P[4][0]*l,n=P[4][1]*l;for(let s=0;s<6;s++)for(let o=0;o<l;o++)t.push([e,n]),e+=P[s][0],n+=P[s][1]}return t.slice(0,e)})(s.length+t.things.length+1).map(B),d=Math.min(...o.map(e=>e.x))-W/2,h=Math.max(...o.map(e=>e.x))+W/2,m=Math.min(...o.map(e=>e.y))-74,y=Math.max(...o.map(e=>e.y))+74,u=h-d+52,x=y-m+52+50,p=t.colony?n[t.key]:void 0;!p&&i>0&&i+u>880&&(i=0,c+=r+36,r=0);let g=p?p.x:i,k=p?p.y:c,j=o.map((e,l)=>{var o,a,i;let c=null!=(a=s[l])?a:null,r=t.things[l-s.length],h=t.colony?void 0:n[null!=(i=null==(o=null!=c?c:r)?void 0:o.id)?i:""];return{agent:c,object:r,x:h?h.x:g+(e.x-d)+26,y:h?h.y:k+(e.y-m)+26+50}});a.push({key:t.key,colony:t.colony,cells:j,x:g,y:k,w:u,h:x}),p||(i+=u+36,r=Math.max(r,x))}let d=0,h=0;for(let e of a)if(e.colony)d=Math.max(d,e.x+e.w),h=Math.max(h,e.y+e.h);else for(let t of e.cells)d=Math.max(d,t.x+W/2+26),h=Math.max(h,t.y+74+26);return{clusters:a,width:d,height:h}})(C,A,M,ey),[C,A,M,ey]),eg=(0,a.useRef)(null),[ek,ej]=(0,a.useState)(0);(0,a.useEffect)(()=>{let e=eg.current;if(!e)return;let t=new ResizeObserver(()=>ej(e.clientWidth));return t.observe(e),ej(e.clientWidth),()=>t.disconnect()},[L,0===C.length]);let ef=(0,a.useRef)(eh);ef.current=eh,(0,a.useEffect)(()=>{let e=eg.current;if(!e)return;let t=e=>{(e.ctrlKey||e.metaKey)&&(e.preventDefault(),em(ef.current*(e.deltaY<0?1.1:1/1.1)))};return e.addEventListener("wheel",t,{passive:!1}),()=>e.removeEventListener("wheel",t)},[L]);let ev=ex+80,eb=ep+80,ew=(ek?Math.min(1,(ek-24)/ev):1)*eh,eN=(0,a.useRef)(null),eC=(0,a.useRef)(!1),eA=function(e,t,l,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{x:0,y:0};if(0===e.button){eN.current={key:t,sx:e.clientX,sy:e.clientY,ox:l,oy:n,min:s,moved:!1};try{e.currentTarget.setPointerCapture(e.pointerId)}catch(e){}}},eM=e=>{let t=eN.current;if(!t)return;let l=(e.clientX-t.sx)/ew,n=(e.clientY-t.sy)/ew;!t.moved&&Math.hypot(l,n)*ew<6||(t.moved=!0,t.last={x:Math.max(t.min.x,t.ox+l),y:Math.max(t.min.y,t.oy+n)},ec({key:t.key,...t.last}))},e_=()=>{let e=eN.current;eN.current=null,(null==e?void 0:e.moved)&&e.last&&(eC.current=!0,setTimeout(()=>{eC.current=!1},0),ea({...eo,[e.key]:e.last}),ec(null))},ez=function(e,t,l,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{x:0,y:0},o={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,-1],ArrowDown:[0,1]}[e.key];if(!o||e.altKey||e.ctrlKey||e.metaKey)return;e.preventDefault();let a=e.shiftKey?64:16;ea({...eo,[t]:{x:Math.max(s.x,l+o[0]*a),y:Math.max(s.y,n+o[1]*a)}})},eL=(e,t,l,n)=>({onPointerDown:s=>eA(s,e,t,l,n),onPointerMove:eM,onPointerUp:e_,onPointerCancel:e_}),eS=new Map;for(let e of eu)for(let t of e.cells)t.agent&&eS.set(t.agent.id,{x:t.x+40,y:t.y+40}),t.object&&eS.set(t.object.id,{x:t.x+40,y:t.y+40});let eq=M.filter(e=>"cluster"===e.kind).flatMap(e=>e.config.members.map(t=>({from:e.id,to:t}))),eF=M.filter(e=>e.manager_id&&eS.has(e.manager_id)&&eS.has(e.id)).map(e=>({from:e.manager_id,to:e.id})),eD=e=>M.filter(t=>t.manager_id===e),[eE,eH]=(0,a.useState)(null),eT=null!=(e=C.find(e=>e.id===J))?e:null,eO=null!=(t=M.find(e=>e.id===J))?t:null,[eI,eV]=(0,a.useState)(null);(0,a.useLayoutEffect)(()=>{eV(J?document.querySelector('[data-sid="'.concat(J,'"]')):null)},[J,C.length,M.length]),(0,a.useEffect)(()=>{if(!J)return;let e=e=>{"Escape"!==e.key||document.querySelector('[role="dialog"]')||U(null)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[J]);let eR=null!=X?X:J,eW=C.filter(e=>"orchestrator"===e.role).flatMap(e=>e.worker_ids.map(t=>({from:e.id,to:t}))),eP=new Set(eR?[eR,...[...eW,...eq,...eF].filter(e=>e.from===eR||e.to===eR).flatMap(e=>[e.from,e.to])]:[]),eB=e=>C.filter(t=>"orchestrator"===t.role&&t.worker_ids.includes(e)),eK=C.filter(e=>"running"===e.status).length,eZ=M.filter(e=>"running"===e.state.status).length,eJ=C.filter(e=>"orchestrator"===e.role).length,eU=e=>{var t,l;return null!=(l=null==(t=C.find(t=>t.id===e))?void 0:t.name)?l:s("colony.removedAgent")},eX=z.filter(e=>"running"===e.status).length,eG=[{id:"agents",n:C.length,label:s("stat.agents",{count:C.length}),href:"/agents"},{id:"colonies",n:A.length,label:s("stat.colonies",{count:A.length})},{id:"objects",n:M.length,label:s("stat.objects",{count:M.length}),href:"/resources",title:M.length?s("obj.running",{count:eZ}):void 0},{id:"queens",n:eJ,label:s("stat.orchestrators",{count:eJ}),href:"/agents"},{id:"working",n:eK,label:s("stat.working"),href:"/agents"},{id:"tasks",n:eX,label:s("stat.tasks"),href:"#recent"}],eY=eT?A.find(e=>e.id===eT.colony_id):void 0,e$=async(e,t)=>{try{var l,n;await f.FH.patch("/agents/".concat(e.id),{colony_id:t||null,overrides:[]}),await D(["agents","colonies"]),Z(t?s("colony.joined",{name:e.name,colony:null!=(n=null==(l=A.find(e=>e.id===t))?void 0:l.name)?n:""}):s("colony.left",{name:e.name}))}catch(e){Z(e instanceof Error?e.message:s("colony.moveFailed"),"err")}};return(0,n.jsxs)("div",{className:"page",children:[(0,n.jsxs)("div",{className:"page-head",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"row gap-s",children:[(0,n.jsx)("h1",{children:s("nav.colony")}),(0,n.jsx)(T.B,{label:s("colony.helpLabel"),title:s("colony.howTitle"),children:s("colony.howBody")})]}),(0,n.jsx)("p",{children:s("colony.page.subtitle")})]}),(0,n.jsx)("div",{className:"cx-head-actions",children:(0,n.jsx)(w.W1,{label:s("cx.new"),icon:(0,n.jsx)(i.A,{size:14}),children:e=>(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(w.Dr,{icon:(0,n.jsx)(c.A,{size:15}),onClick:()=>{e(),$({})},children:s("newAgent.title")}),(0,n.jsx)(w.Dr,{icon:(0,n.jsx)(r.A,{size:15}),onClick:()=>{e(),ee("new")},children:s("colony.newTitle")}),(0,n.jsx)(w.Dr,{icon:(0,n.jsx)(d.A,{size:15}),onClick:()=>{e(),es({})},children:s("obj.new")})]})})})]}),(0,n.jsx)("div",{className:"stats",children:eG.map(e=>{let t=(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("b",{children:e.n}),(0,n.jsx)("span",{children:e.label})]});return e.href?(0,n.jsx)(o(),{href:e.href,className:"card stat",title:e.title,"aria-label":"".concat(e.n," ").concat(e.label,". ").concat(s("cx.stat.open",{label:e.label})),children:t},e.id):(0,n.jsx)("div",{className:"card stat",title:e.title,children:t},e.id)})}),(0,n.jsxs)("div",{className:"colony",children:[(0,n.jsxs)("div",{className:"comb-wrap",ref:eg,children:[L?0===C.length&&0===A.length&&0===M.length?(0,n.jsx)("div",{className:"comb-empty-wrap",children:(0,n.jsx)(b.pp,{icon:(0,n.jsx)(b._h,{size:"lg",queen:!0,label:"+"}),title:s("colony.empty.title"),body:s("colony.empty.body"),action:(0,n.jsxs)("div",{className:"row",children:[(0,n.jsxs)("button",{className:"btn",onClick:()=>ee("new"),children:[(0,n.jsx)(i.A,{size:16}),s("colony.empty.createColony")]}),(0,n.jsxs)("button",{className:"btn primary",onClick:()=>$({}),children:[(0,n.jsx)(i.A,{size:16}),s("colony.empty.createAgent")]})]})})}):(0,n.jsx)("div",{className:"comb-box",style:{width:ev*ew,height:eb*ew},children:(0,n.jsxs)("div",{className:"comb",style:{width:ev,height:eb,transform:"scale(".concat(ew,")"),transformOrigin:"0 0","--w":"".concat(.9*W,"px"),"--h":"".concat(133.20000000000002,"px")},children:[(0,n.jsx)("svg",{className:"links",width:ev,height:eb,children:eu.filter(e=>e.colony).map(e=>{let t=e.colony.color||"var(--honey)";return(0,n.jsxs)("g",{children:[e.cells.map((e,l)=>(0,n.jsx)("polygon",{points:K(e.x+40,e.y+40,74),style:{fill:t,stroke:t},strokeWidth:44,strokeLinejoin:"round"},"o"+l)),e.cells.map((e,l)=>(0,n.jsx)("polygon",{points:K(e.x+40,e.y+40,74),style:{fill:"color-mix(in srgb, ".concat(t," 9%, var(--surface))"),stroke:"color-mix(in srgb, ".concat(t," 9%, var(--surface))")},strokeWidth:38,strokeLinejoin:"round"},"i"+l))]},e.key)})}),eu.map(e=>(0,n.jsxs)("div",{children:[e.colony?(0,n.jsxs)("button",{className:"colony-label draggable ".concat((null==ei?void 0:ei.key)===e.key?"dragging":""),style:{left:e.x+e.w/2+40,top:e.y+50-10+40,"--c":e.colony.color||"var(--honey)"},...eL(e.key,e.x,e.y),onKeyDown:t=>ez(t,e.key,e.x,e.y),onClick:()=>{eC.current||ee(e.colony)},title:"".concat(e.colony.cwd?s("colony.editHover",{path:(0,v._1)(e.colony.cwd)}):s("colony.editHoverShort")," \xb7 ").concat(s("colony.dragHint")," \xb7 ").concat(s("cx.moveHint")),children:[(0,n.jsx)("i",{className:"cdot"}),e.colony.name,(0,n.jsx)("small",{children:s("colony.agentCount",{count:e.cells.filter(e=>e.agent).length})}),(0,n.jsx)(r.A,{size:13,className:"muted"})]}):A.length>0&&e.cells.some(e=>e.agent)?(0,n.jsx)("span",{className:"colony-label cx-unplaced",style:{left:e.x+e.w/2+40,top:e.y+50-10+40},children:(0,n.jsx)("small",{children:s("common.noColony")})}):null,e.cells.map((t,l)=>{let o=t.agent,a={left:t.x+40,top:t.y+40},c=t.object;if(c){let{icon:l,color:o}=R.Nd[c.kind];return(0,n.jsxs)("button",{"data-sid":c.id,className:"cell fill obj st-".concat(c.state.status," ").concat("running"===c.state.status?"running":""," ").concat(eR&&!eP.has(c.id)?"dim":""," ").concat(eR&&eP.has(c.id)&&c.id!==eR?"linked":""," ").concat(e.colony?"":"draggable"),style:{...a,"--c":o},"aria-pressed":J===c.id,onMouseEnter:()=>G(c.id),onMouseLeave:()=>G(null),onFocus:()=>G(c.id),onBlur:()=>G(null),...e.colony?{}:{...eL(c.id,t.x,t.y,{x:W/2,y:74}),onKeyDown:e=>ez(e,c.id,t.x,t.y,{x:W/2,y:74})},onClick:()=>{eC.current||U(c.id===J?null:c.id)},"aria-label":"".concat(c.name,", ").concat(s("obj.kind.".concat(c.kind)),", ").concat(s("obj.status.".concat(c.state.status))),title:c.state.detail?"".concat(s("obj.status.".concat(c.state.status)),": ").concat(c.state.detail):s("obj.status.".concat(c.state.status)),children:[(0,n.jsx)("span",{className:"shape"}),(0,n.jsxs)("span",{className:"label",children:[(0,n.jsx)(l,{size:16}),(0,n.jsx)("b",{children:c.name}),(0,n.jsx)("small",{children:s("obj.status.".concat(c.state.status))})]}),(0,n.jsx)("span",{className:"pip o-".concat(c.state.status)}),c.manager_id&&(0,n.jsxs)("span",{className:"ltag top mgr",title:s("colony.managedBy",{name:eU(c.manager_id)}),children:["⚙ ",eU(c.manager_id)]})]},c.id)}return o?(0,n.jsxs)("button",{"data-sid":o.id,className:"cell fill ".concat("orchestrator"===o.role?"queen":""," ").concat("running"===o.status?"running":""," ").concat(eR&&!eP.has(o.id)?"dim":""," ").concat(eR&&eP.has(o.id)&&o.id!==eR?"linked":""," ").concat(e.colony?"":"draggable"),onMouseEnter:()=>G(o.id),onMouseLeave:()=>G(null),onFocus:()=>G(o.id),onBlur:()=>G(null),style:{...a,"--c":v.xq[o.provider].color},"aria-pressed":J===o.id,...e.colony?{}:{...eL(o.id,t.x,t.y,{x:W/2,y:74}),onKeyDown:e=>ez(e,o.id,t.x,t.y,{x:W/2,y:74}),title:s("cx.moveHint")},onClick:()=>{eC.current||U(o.id===J?null:o.id)},"aria-label":"".concat(o.name,", ").concat(s("role.".concat(o.role)),", ").concat(v.xq[o.provider].short,", ").concat(s("status.".concat(o.status))),children:[(0,n.jsx)("span",{className:"shape"}),(0,n.jsxs)("span",{className:"label",children:[(0,n.jsx)("b",{children:o.name}),(0,n.jsx)("small",{children:v.xq[o.provider].short})]}),"idle"!==o.status&&(0,n.jsx)("span",{className:"pip ".concat("error"===o.status?"err":"")}),eD(o.id).length>0&&(0,n.jsxs)("span",{className:"ltag top mgr",title:s("colony.manages",{names:eD(o.id).map(e=>e.name).join(", ")}),children:["⚙ ",1===eD(o.id).length?eD(o.id)[0].name:eD(o.id).length]}),("orchestrator"===o.role?o.worker_ids.length>0:eB(o.id).length>0)&&(0,n.jsx)("span",{className:"ltag",title:"orchestrator"===o.role?s("colony.delegatesTo",{count:o.worker_ids.length}):s("colony.connectedTo",{names:eB(o.id).map(e=>e.name).join(", ")}),children:"orchestrator"===o.role?"↓ ".concat(o.worker_ids.length):"↑ ".concat(1===eB(o.id).length?eB(o.id)[0].name:eB(o.id).length)})]},o.id):(0,n.jsxs)("button",{className:"cell ghost",style:a,onClick:()=>{var t;return $({colonyId:null==(t=e.colony)?void 0:t.id})},"aria-label":e.colony?s("colony.addTo",{name:e.colony.name}):s("colony.addAgent"),children:[(0,n.jsx)("svg",{className:"ghost-hex",viewBox:"0 0 100 115",preserveAspectRatio:"none","aria-hidden":!0,children:(0,n.jsx)("polygon",{points:"50,2 98,29 98,86 50,113 2,86 2,29"})}),(0,n.jsxs)("span",{className:"label",children:[(0,n.jsx)(i.A,{size:18}),s("colony.addAgent")]})]},e.key+"g"+l)})]},e.key+"l")),(0,n.jsxs)("svg",{className:"links top",width:ev,height:eb,"aria-hidden":!0,children:[eW.filter(e=>!!eR&&(e.from===eR||e.to===eR)).map(e=>{var t;let l=eS.get(e.from),s=eS.get(e.to);if(!l||!s)return null;let o=s.x-l.x,a=s.y-l.y,i=Math.hypot(o,a)||1,c=o/i,r=a/i,d=l.x+45.88*c,h=l.y+45.88*r,m=s.x-45.88*c,y=s.y-45.88*r,u=(null==(t=C.find(t=>t.id===e.to))?void 0:t.status)==="running",x=!!eR&&(e.from===eR||e.to===eR),p=!!eR&&!x;return(0,n.jsxs)("g",{opacity:p?.18:1,children:[(0,n.jsx)("line",{x1:d,y1:h,x2:m,y2:y,stroke:"var(--surface)",strokeWidth:x?8:5,strokeLinecap:"round",opacity:.85}),(0,n.jsx)("line",{x1:d,y1:h,x2:m,y2:y,stroke:"var(--honey)",strokeWidth:x?3.5:2.2,strokeDasharray:u?"7 6":x?void 0:"1 6",strokeLinecap:"round",children:u&&(0,n.jsx)("animate",{attributeName:"stroke-dashoffset",from:"26",to:"0",dur:"0.8s",repeatCount:"indefinite"})}),(0,n.jsx)("circle",{cx:m,cy:y,r:x?5.5:4,fill:"var(--honey)",stroke:"var(--surface)",strokeWidth:2})]},e.from+e.to)}),[...eq.map(e=>({...e,kind:"cluster"})),...eF.map(e=>({...e,kind:"manager"}))].filter(e=>!!eR&&(e.from===eR||e.to===eR)).map(e=>{let t=eS.get(e.from),l=eS.get(e.to);if(!t||!l)return null;let s=l.x-t.x,o=l.y-t.y,a=Math.hypot(s,o)||1,i=s/a,c=o/a,r="cluster"===e.kind?v.Ng:"var(--link-manager)";return(0,n.jsxs)("g",{children:[(0,n.jsx)("line",{x1:t.x+45.88*i,y1:t.y+45.88*c,x2:l.x-45.88*i,y2:l.y-45.88*c,stroke:"var(--surface)",strokeWidth:8,strokeLinecap:"round",opacity:.9}),(0,n.jsx)("line",{x1:t.x+45.88*i,y1:t.y+45.88*c,x2:l.x-45.88*i,y2:l.y-45.88*c,stroke:r,strokeWidth:3,strokeDasharray:"cluster"===e.kind?"3 5":"8 5",strokeLinecap:"round"}),(0,n.jsx)("circle",{cx:l.x-45.88*i,cy:l.y-45.88*c,r:5,fill:r,stroke:"var(--surface)",strokeWidth:2})]},e.kind+e.from+e.to)})]})]})}):q?(0,n.jsx)("div",{className:"comb-skel",children:(0,n.jsx)(b.lZ,{kind:"err",children:(0,n.jsxs)("div",{className:"row gap-s wrap",children:[(0,n.jsxs)("span",{className:"grow",children:[s("cx.loadFailed")," ",q]}),(0,n.jsx)("button",{className:"btn sm",onClick:()=>void F(),children:s("cx.retry")})]})})}):(0,n.jsxs)("div",{className:"comb-skel",role:"status","aria-label":s("cx.loading"),children:[(0,n.jsx)("div",{className:"skel",style:{width:220,height:190}}),(0,n.jsxs)("div",{className:"row gap-l",children:[(0,n.jsx)("div",{className:"skel",style:{width:150,height:130}}),(0,n.jsx)("div",{className:"skel",style:{width:150,height:130}})]})]}),(0,n.jsxs)("div",{className:"comb-zoom",role:"group","aria-label":s("colony.zoom"),children:[Object.keys(eo).length>0&&(0,n.jsx)("button",{className:"btn ghost icon sm",onClick:()=>ea({}),title:s("colony.layout.reset"),"aria-label":s("colony.layout.reset"),children:(0,n.jsx)(h.A,{size:14})}),(0,n.jsx)("button",{className:"btn ghost icon sm",onClick:()=>em(eh/1.2),disabled:eh<=.4,title:s("colony.zoom.out"),"aria-label":s("colony.zoom.out"),children:(0,n.jsx)(m.A,{size:14})}),(0,n.jsxs)("button",{className:"btn ghost sm zoom-pct",onClick:()=>em(1),title:s("colony.zoom.fit"),"aria-label":s("colony.zoom.fit"),children:[Math.round(100*eh),"%"]}),(0,n.jsx)("button",{className:"btn ghost icon sm",onClick:()=>em(1.2*eh),disabled:eh>=2.5,title:s("colony.zoom.in"),"aria-label":s("colony.zoom.in"),children:(0,n.jsx)(i.A,{size:14})}),(0,n.jsx)("button",{className:"btn ghost icon sm",onClick:()=>em(1),title:s("colony.zoom.fit"),"aria-label":s("colony.zoom.fit"),children:(0,n.jsx)(y.A,{size:14})})]}),(0,n.jsxs)("div",{className:"comb-legend",children:[Object.keys(v.xq).map(e=>(0,n.jsxs)("span",{className:"pbadge",style:{"--c":v.xq[e].color},children:[(0,n.jsx)("i",{}),v.xq[e].short]},e)),(0,n.jsxs)("span",{className:"pbadge",style:{"--c":"var(--honey)"},children:[(0,n.jsx)("i",{}),s("role.orchestrator")]})]})]}),eO?(0,n.jsx)(I.wl,{object:eO,target:eI,onClose:()=>U(null),onCreateManager:()=>{var e;return $({colonyId:null!=(e=eO.colony_id)?e:void 0,manager:!0,objectId:eO.id})}},eO.id):eT?(0,n.jsxs)(O.rs,{target:eI,pinned:!0,width:340,label:eT.name,onClose:()=>U(null),children:[(0,n.jsxs)("div",{className:"ap-corner row gap-s",children:[(0,n.jsx)("button",{className:"btn ghost icon sm",onClick:()=>el(eT.id),"aria-label":s("colony.settingsFor",{name:eT.name}),title:s("colony.agentSettings"),children:(0,n.jsx)(u.A,{size:16})}),(0,n.jsx)("button",{className:"btn ghost icon sm",onClick:()=>U(null),"aria-label":s("common.close"),title:"".concat(s("common.close")," (Esc)"),children:(0,n.jsx)(x.A,{size:16})})]}),(0,n.jsx)(O.kh,{agent:eT,hideColony:!0}),(0,n.jsxs)("div",{className:"field ap-pin-field",children:[(0,n.jsx)("label",{children:s("form.colony")}),(0,n.jsxs)("select",{className:"select",value:null!=(l=null==eY?void 0:eY.id)?l:"",onChange:e=>void e$(eT,e.target.value),children:[(0,n.jsx)("option",{value:"",children:s("common.noColony")}),A.map(e=>(0,n.jsx)("option",{value:e.id,children:e.name},e.id))]})]}),(0,n.jsxs)("div",{className:"row ap-pin-actions",children:[(0,n.jsxs)(o(),{className:"btn primary grow",href:"/agents/".concat(eT.id),children:[s("colony.openChat")," ",(0,n.jsx)(p,{size:16})]}),(0,n.jsx)("button",{className:"btn danger icon",onClick:()=>eH(eT.id),"aria-label":s("agent.delete"),title:s("agent.delete"),children:(0,n.jsx)(g.A,{size:16})})]})]},eT.id):null]}),(0,n.jsxs)("div",{className:"card card-pad recent",id:"recent",children:[(0,n.jsx)("div",{className:"eyebrow recent-head",children:s("colony.recent")}),0===z.length?(0,n.jsx)("p",{className:"muted small m0",children:s("colony.recentEmpty")}):(0,n.jsx)("div",{className:"recent-grid",children:z.slice(0,6).map(e=>(0,n.jsxs)("div",{className:"feed-item",children:[(0,n.jsx)("i",{className:"dot ".concat("running"===e.status?"run":"done"===e.status?"ok":"err")}),(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"feed-line",children:[C.some(t=>t.id===e.from_id)?(0,n.jsx)(o(),{href:"/agents/".concat(e.from_id),"aria-label":s("cx.openAgent",{name:eU(e.from_id)}),children:eU(e.from_id)}):(0,n.jsx)("b",{children:eU(e.from_id)})," → ",C.some(t=>t.id===e.to_id)?(0,n.jsx)(o(),{href:"/agents/".concat(e.to_id),"aria-label":s("cx.openAgent",{name:eU(e.to_id)}),children:eU(e.to_id)}):(0,n.jsx)("b",{children:eU(e.to_id)})]}),(0,n.jsx)("div",{className:"muted small ellipsis",children:e.task}),(0,n.jsx)("div",{className:"muted feed-when",children:(0,v.KN)(e.created_at)})]})]},e.id))})]}),eE&&C.find(e=>e.id===eE)&&(0,n.jsx)(H.G,{agent:C.find(e=>e.id===eE),onClose:()=>eH(null),onDeleted:()=>U(null)}),Y&&(0,n.jsx)(N.b,{presetColonyId:Y.colonyId,presetObjectId:Y.objectId,manager:Y.manager,onClose:()=>$(null),onCreated:e=>U(e)}),et&&C.find(e=>e.id===et)&&(0,n.jsx)(E,{agent:C.find(e=>e.id===et),onClose:()=>el(null)},et),en&&(0,n.jsx)(V.X,{presetColonyId:en.colonyId,onClose:()=>es(null),onSaved:e=>U(e)}),Q&&(0,n.jsx)(S,{colony:"new"===Q?void 0:Q,onClose:()=>ee(null)})]})}},47405:(e,t,l)=>{"use strict";l.d(t,{A:()=>n});let n=(0,l(74955).A)("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]])},48776:(e,t,l)=>{"use strict";l.d(t,{G:()=>c});var n=l(94799),s=l(86606),o=l(48538),a=l(3749),i=l(69654);function c(e){let{agent:t,onClose:l,onDeleted:c}=e,{t:r}=(0,i.s9)(),{refresh:d}=(0,o.zd)(),h=(0,s.dj)();return(0,n.jsx)(s.TM,{title:r("agent.deleteTitle",{name:t.name}),body:r("agent.deleteBody"),danger:!0,confirmLabel:r("agent.delete"),cancelLabel:r("agent.keep"),onClose:l,onConfirm:async()=>{await a.FH.del("/agents/".concat(t.id)),await d(["agents","colonies"]),h(r("agent.deleted")),null==c||c()}})}},64883:(e,t,l)=>{"use strict";l.d(t,{A:()=>n});let n=(0,l(74955).A)("Eraser",[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]])},66654:(e,t,l)=>{"use strict";l.d(t,{A:()=>n});let n=(0,l(74955).A)("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]])},66826:(e,t,l)=>{"use strict";l.d(t,{A:()=>n});let n=(0,l(74955).A)("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]])},73784:(e,t,l)=>{"use strict";l.d(t,{A:()=>n});let n=(0,l(74955).A)("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]])},73885:(e,t,l)=>{"use strict";l.d(t,{A:()=>n});let n=(0,l(74955).A)("PlugZap",[["path",{d:"M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z",key:"goz73y"}],["path",{d:"m2 22 3-3",key:"19mgm9"}],["path",{d:"M7.5 13.5 10 11",key:"7xgeeb"}],["path",{d:"M10.5 16.5 13 14",key:"10btkg"}],["path",{d:"m18 3-4 4h6l-4 4",key:"16psg9"}]])},75406:(e,t,l)=>{"use strict";l.d(t,{A:()=>n});let n=(0,l(74955).A)("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]])},77701:(e,t,l)=>{Promise.resolve().then(l.bind(l,36098))},89128:(e,t,l)=>{"use strict";l.d(t,{A:()=>y});var n=l(94799),s=l(34023),o=l(97356),a=l(86606),i=l(5300),c=l(48776),r=l(48538),d=l(73506),h=l(3749),m=l(69654);function y(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{t:l}=(0,m.s9)(),{agents:y,colonies:u,objects:x,refresh:p}=(0,r.q5)(),g=(0,a.dj)(),k=(0,s.useMemo)(()=>e?x.filter(t=>t.manager_id===e.id).map(e=>e.id).sort():[],[x,null==e?void 0:e.id]),j=(0,s.useMemo)(()=>e?JSON.stringify((0,i.TN)(e,k)):"",[e,k]),[f,v]=(0,s.useState)(()=>e?(0,i.TN)(e,k):null),[b,w]=(0,s.useState)(!1),[N,C]=(0,s.useState)(!1);(0,s.useEffect)(()=>{v(e?(0,i.TN)(e,k):null)},[j]);let A=f&&e?(0,i.tf)(f,y,e.id,u):{},M=!!f&&JSON.stringify(f)!==j;(0,d.h)(M);let _=async()=>{if(f&&e){if(Object.keys(A).length)return void g(l("edit.fixFields"),"err");w(!0);try{var n;let{type_id:s,object_ids:o,...a}=f;await h.FH.patch("/agents/".concat(e.id),a),JSON.stringify([...o].sort())!==JSON.stringify(k)&&await h.FH.put("/agents/".concat(e.id,"/resources"),{object_ids:o}),await p(["agents","colonies","objects"]),g(l("edit.saved",{name:f.name.trim()})),null==(n=t.onSaved)||n.call(t)}catch(e){g(e instanceof Error?e.message:l("edit.saveFailed"),"err")}w(!1)}},z=()=>{e&&v((0,i.TN)(e,k))};return{draft:f,setDraft:v,errors:A,dirty:M,saving:b,save:_,discard:z,actions:function(){var e,t,s,a;let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("button",{className:"btn danger push-r ".concat(null!=(e=i.size)?e:""),onClick:()=>C(!0),children:[(0,n.jsx)(o.A,{size:i.size?14:15}),l("agent.delete")]}),i.onCancel?(0,n.jsx)("button",{className:"btn ghost ".concat(null!=(t=i.size)?t:""),onClick:i.onCancel,children:l("common.cancel")}):(0,n.jsx)("button",{className:"btn ghost ".concat(null!=(s=i.size)?s:""),disabled:!M,onClick:z,children:l("common.discard")}),(0,n.jsx)("button",{className:"btn primary ".concat(null!=(a=i.size)?a:""),disabled:!M||b,onClick:_,children:b?l("common.saving"):l("common.saveChanges")})]})},deleteModal:N&&e?(0,n.jsx)(c.G,{agent:e,onClose:()=>C(!1),onDeleted:t.onDeleted}):null}}},94726:(e,t,l)=>{"use strict";l.d(t,{A:()=>n});let n=(0,l(74955).A)("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]])},98392:(e,t,l)=>{"use strict";l.d(t,{A:()=>n});let n=(0,l(74955).A)("ArrowDownToLine",[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]])}},e=>{e.O(0,[586,706,486,839,517,350,291,844,408,89,358],()=>e(e.s=77701)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[964],{27949:(e,r,l)=>{Promise.resolve().then(l.bind(l,86300))},86300:(e,r,l)=>{"use strict";l.r(r),l.d(r,{default:()=>v});var s=l(94799),t=l(34023),a=l(20831),i=l(15334);l(40117);var n=l(70665),o=l(10964),d=l(48538),c=l(77021),h=l(3749),u=l(47890),m=l(86606),x=l(69654);let p=e=>{let r=u.hg[e%u.hg.length];return"color-mix(in srgb, ".concat(r," calc(100% - var(--series-mix, 0%)), white)")},g={agent:function(e){let{data:r}=e,{t:l}=(0,x.s9)(),t=r.agent;return(0,s.jsxs)("div",{className:"rnode ".concat(r.dim?"dim":""," ").concat(r.active?"active":""),children:["worker"===t.role&&(0,s.jsx)(a.h7,{type:"target",position:i.yX.Top}),(0,s.jsx)(m._h,{agent:t}),(0,s.jsx)("b",{children:t.name}),(0,s.jsx)("small",{children:"orchestrator"===t.role?l("role.orchestrator"):u.xq[t.provider].short}),"orchestrator"===t.role&&(0,s.jsx)(a.h7,{type:"source",position:i.yX.Bottom})]})}},j={link:function(e){let{id:r,sourceX:l,sourceY:t,targetX:o,targetY:d,sourcePosition:c,targetPosition:h,data:u}=e,[m,x,p]=(0,i.Fp)({sourceX:l,sourceY:t,targetX:o,targetY:d,sourcePosition:c,targetPosition:h,curvature:.35});return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(a.tE,{id:r,path:m,interactionWidth:26,style:{stroke:u.color,strokeWidth:u.active?4:2.5,opacity:u.dim?.15:1,transition:"opacity .15s, stroke-width .15s"}}),u.show&&(0,s.jsx)(a.rV,{children:(0,s.jsx)("button",{className:"edge-x nodrag nopan",style:{transform:"translate(-50%, -50%) translate(".concat(x,"px, ").concat(p,"px)")},onClick:u.onRemove,"aria-label":u.label,title:u.label,children:(0,s.jsx)(n.A,{size:13,strokeWidth:3})})})]})}};function v(){let{t:e,locale:r}=(0,x.s9)(),{agents:l,refresh:i,ready:u,error:v,retry:k}=(0,d.q5)(),w=(0,m.dj)(),[f,N]=(0,c.ud)("hive-rel-pos-v2",{}),[b,y]=(0,t.useState)([]),[_,C]=(0,t.useState)(null),[E,M]=(0,t.useState)(null),[F,O]=(0,t.useState)(null),[S,W]=(0,t.useState)(0),A=(0,t.useMemo)(()=>(function(e){let r=e.filter(e=>"orchestrator"===e.role),l=e.filter(e=>"worker"===e.role),s=e=>r.find(r=>r.worker_ids.includes(e.id)),t={},a=0;for(let e of r){let r=l.filter(r=>{var l;return(null==(l=s(r))?void 0:l.id)===e.id}),i=Math.max(1,r.length);r.forEach((e,r)=>t[e.id]={x:a+190*r,y:280}),t[e.id]={x:a+(i-1)*190/2,y:0},a+=190*i+114}return l.filter(e=>!s(e)).forEach((e,r)=>t[e.id]={x:a+190*r,y:280}),t})(l),[l]);(0,t.useEffect)(()=>{y(l.map(e=>{var r,l;return{id:e.id,type:"agent",position:null!=(l=null!=(r=f[e.id])?r:A[e.id])?l:{x:0,y:0},data:{agent:e,dim:!1,active:!1}}}))},[l,A,f]);let T=(0,t.useMemo)(()=>new Map(l.filter(e=>"orchestrator"===e.role).map((e,r)=>[e.id,r])),[l]),V=null!=_?_:F,z=e=>{var r,s;return null!=(s=null==(r=l.find(r=>r.id===e))?void 0:r.name)?s:"?"},L=(0,t.useCallback)(async(r,l,s)=>{try{await h.FH.put("/orchestrators/".concat(r,"/workers"),{worker_ids:l}),await i(["agents"]),w(s)}catch(r){w(r instanceof Error?r.message:e("rel.updateFailed"),"err")}},[i,w]),R=(0,t.useCallback)((r,s)=>{let t=l.find(e=>e.id===r);t&&L(r,t.worker_ids.filter(e=>e!==s),e("rel.disconnected",{worker:z(s),orchestrator:t.name}))},[l,L]),Z=(0,t.useCallback)((r,s)=>{let t=l.find(e=>e.id===r);!t||t.worker_ids.includes(s)||L(r,[...t.worker_ids,s],e("rel.connected",{worker:z(s),orchestrator:t.name}))},[l,L]),q=(0,t.useMemo)(()=>l.filter(e=>"orchestrator"===e.role).flatMap(r=>r.worker_ids.map(s=>{var t,a;let i="".concat(r.id,">").concat(s),n=!!V&&(r.id===V||s===V);return{id:i,source:r.id,target:s,type:"link",animated:(null==(t=l.find(e=>e.id===s))?void 0:t.status)==="running",data:{color:p(null!=(a=T.get(r.id))?a:0),dim:!!V&&!n,active:n||E===i,show:n||E===i,label:e("rel.disconnectLabel",{worker:z(s),orchestrator:r.name}),onRemove:()=>R(r.id,s)}}})),[l,V,E,T,R,r]),B=(0,t.useMemo)(()=>{let e=new Set(V?[V]:[]);if(V)for(let r of q)(r.source===V||r.target===V)&&(e.add(r.source),e.add(r.target));return b.map(r=>({...r,selected:r.id===F,data:{...r.data,dim:!!V&&!e.has(r.id),active:r.id===V}}))},[b,q,V,F]),H=(0,t.useCallback)(e=>{y(r=>(0,a._0)(e,r));let r=e.filter(e=>"position"===e.type&&!e.dragging&&e.position);r.length&&N(e=>{let l={...e};for(let e of r)"position"===e.type&&e.position&&(l[e.id]=e.position);return l})},[]),P=l.find(e=>e.id===F),X=l.filter(e=>"orchestrator"===e.role),G=l.filter(e=>"worker"===e.role);return(0,s.jsxs)("div",{className:"page full rel",children:[(0,s.jsxs)("div",{className:"rel-hud",children:[(0,s.jsx)("h1",{children:e("nav.relations")}),(0,s.jsx)("p",{children:e("rel.hud")})]}),(0,s.jsx)("div",{className:"rel-tools",children:(0,s.jsxs)("button",{className:"btn sm",onClick:()=>{N({}),W(e=>e+1),w(e("rel.layoutReset"))},children:[(0,s.jsx)(o.A,{size:14}),e("rel.autoArrange")]})}),u?0===l.length?(0,s.jsx)("div",{className:"rel-empty",children:(0,s.jsx)(m.pp,{title:e("rel.empty.title"),body:e("rel.empty.body")})}):(0,s.jsxs)(a.Gc,{nodes:B,edges:q,nodeTypes:g,edgeTypes:j,onNodesChange:H,onConnect:e=>{e.source&&e.target&&Z(e.source,e.target)},onNodeMouseEnter:(e,r)=>C(r.id),onNodeMouseLeave:()=>C(null),onNodeClick:(e,r)=>O(e=>e===r.id?null:r.id),onPaneClick:()=>O(null),onEdgeMouseEnter:(e,r)=>M(r.id),onEdgeMouseLeave:()=>M(null),fitView:!0,fitViewOptions:{padding:.35,maxZoom:1.1},minZoom:.3,proOptions:{hideAttribution:!0},deleteKeyCode:null,nodesConnectable:!0,children:[(0,s.jsx)(a.VS,{gap:28,color:"var(--line-strong)"}),(0,s.jsx)(a.H2,{showInteractive:!1})]},S):v?(0,s.jsx)("div",{className:"rel-empty",children:(0,s.jsx)(m.lZ,{kind:"err",children:(0,s.jsxs)("div",{className:"row gap-s wrap",children:[(0,s.jsxs)("span",{className:"grow",children:[e("cx.loadFailed")," ",v]}),(0,s.jsx)("button",{className:"btn sm",onClick:()=>void k(),children:e("cx.retry")})]})})}):(0,s.jsx)("div",{className:"rel-empty comb-skel",role:"status","aria-label":e("cx.loading"),children:(0,s.jsx)("div",{className:"skel",style:{width:200,height:120}})}),P&&(0,s.jsxs)("aside",{className:"rel-panel card",children:[(0,s.jsxs)("div",{className:"row gap-l",children:[(0,s.jsx)(m._h,{agent:P}),(0,s.jsxs)("div",{className:"grow",children:[(0,s.jsx)("b",{className:"rel-panel-name",children:P.name}),(0,s.jsx)("div",{className:"muted small",children:e("role.".concat(P.role))})]}),(0,s.jsx)("button",{className:"btn ghost icon sm",onClick:()=>O(null),"aria-label":e("common.close"),children:(0,s.jsx)(n.A,{size:16})})]}),"orchestrator"===P.role?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"eyebrow",children:e("rel.delegatesTo",{count:P.worker_ids.length})}),0===P.worker_ids.length&&(0,s.jsx)("p",{className:"muted small m0",children:e("rel.noWorkers")}),P.worker_ids.map(r=>(0,s.jsxs)("div",{className:"relrow",children:[(0,s.jsx)("span",{className:"grow",children:z(r)}),(0,s.jsx)("button",{className:"btn sm",onClick:()=>R(P.id,r),children:e("rel.disconnect")})]},r)),(0,s.jsxs)("select",{className:"select",value:"",onChange:e=>e.target.value&&Z(P.id,e.target.value),"aria-label":e("rel.connectWorker"),children:[(0,s.jsx)("option",{value:"",children:e("rel.connectWorker")}),G.filter(e=>!P.worker_ids.includes(e.id)).map(e=>(0,s.jsx)("option",{value:e.id,children:e.name},e.id))]})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"eyebrow",children:e("rel.directedBy")}),0===X.filter(e=>e.worker_ids.includes(P.id)).length&&(0,s.jsx)("p",{className:"muted small m0",children:e("rel.noOrchestrators")}),X.filter(e=>e.worker_ids.includes(P.id)).map(r=>{var l;return(0,s.jsxs)("div",{className:"relrow",children:[(0,s.jsx)("i",{className:"cdot cx-chip-dot",style:{background:p(null!=(l=T.get(r.id))?l:0)}}),(0,s.jsx)("span",{className:"grow",children:r.name}),(0,s.jsx)("button",{className:"btn sm",onClick:()=>R(r.id,P.id),children:e("rel.disconnect")})]},r.id)}),(0,s.jsxs)("select",{className:"select",value:"",onChange:e=>e.target.value&&Z(e.target.value,P.id),"aria-label":e("rel.connectOrchestrator"),children:[(0,s.jsx)("option",{value:"",children:e("rel.connectOrchestrator")}),X.filter(e=>!e.worker_ids.includes(P.id)).map(e=>(0,s.jsx)("option",{value:e.id,children:e.name},e.id))]})]})]})]})}}},e=>{e.O(0,[48,986,586,562,839,408,89,358],()=>e(e.s=27949)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[594],{72317:(e,s,u)=>{Promise.resolve().then(u.bind(u,75750))},75750:(e,s,u)=>{"use strict";u.r(s),u.d(s,{default:()=>_});var n=u(94799),r=u(34023),t=u(84491);function _(e){let{params:s}=e,{id:u}=(0,r.use)(s);return(0,n.jsx)(t.D,{id:u})}}},e=>{e.O(0,[586,706,837,486,581,839,517,350,291,844,30,491,408,89,358],()=>e(e.s=72317)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[752],{57933:(e,s,t)=>{Promise.resolve().then(t.bind(t,89976))},89976:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>u});var r=t(94799),i=t(34023),n=t(48538),o=t(84491);function u(){var e;let{objects:s,ready:t}=(0,n.o0)(),u=null==(e=s[0])?void 0:e.id;return(0,i.useEffect)(()=>{t&&u&&window.history.replaceState(window.history.state,"","/resources/".concat(u))},[t,u]),(0,r.jsx)(o.D,{id:u})}}},e=>{e.O(0,[586,706,837,486,581,839,517,350,291,844,30,491,408,89,358],()=>e(e.s=57933)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[547],{14676:(e,s,t)=>{Promise.resolve().then(t.bind(t,95339))},17395:(e,s,t)=>{"use strict";t.d(s,{A:()=>n});let n=(0,t(74955).A)("Pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]])},32480:(e,s,t)=>{"use strict";t.d(s,{A:()=>n});let n=(0,t(74955).A)("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]])},37064:(e,s,t)=>{"use strict";t.d(s,{n:()=>a});var n=t(34023);function a(e,s){let{enabled:t=!0,pauseHidden:a=!0,immediate:c=!0,onError:d}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},l=(0,n.useRef)(e);l.current=e;let i=(0,n.useRef)(d);i.current=d,(0,n.useEffect)(()=>{let e;if(!t)return;let n=!1,d=0,r=!1,h=()=>{clearTimeout(e),n||(e=setTimeout(()=>void u(),s*Math.min(6,2**d)))},u=async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!n&&!r){if(!e&&a&&"undefined"!=typeof document&&"hidden"===document.visibilityState)return void h();r=!0;try{await l.current(),d=0}catch(e){var s;0==d++&&(null==(s=i.current)||s.call(i,e))}finally{r=!1,h()}}},o=()=>{"visible"!==document.visibilityState||r||(clearTimeout(e),u())};return c?u(!0):h(),a&&document.addEventListener("visibilitychange",o),()=>{n=!0,clearTimeout(e),document.removeEventListener("visibilitychange",o)}},[s,t,a,c])}},47405:(e,s,t)=>{"use strict";t.d(s,{A:()=>n});let n=(0,t(74955).A)("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]])},54234:(e,s,t)=>{"use strict";t.d(s,{A:()=>n});let n=(0,t(74955).A)("CalendarClock",[["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M17.5 17.5 16 16.3V14",key:"akvzfd"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]])},95339:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>k});var n=t(94799),a=t(34023),c=t(54234),d=t(17395),l=t(47405),i=t(97356),r=t(32480),h=t(12349),u=t(3749),o=t(48538),m=t(37064),x=t(56072),p=t(47890),j=t(69654),v=t(86606);let y=["failed","skipped_reassigned"];function k(){var e;let{t:s}=(0,j.s9)(),t=(0,v.dj)(),{agents:k,ready:f}=(0,o.q5)(),[b,g]=(0,a.useState)(null),[N,_]=(0,a.useState)(null),[w,A]=(0,a.useState)([]),[M,z]=(0,a.useState)(null),[C,S]=(0,a.useState)(!1),F=(0,a.useCallback)(async()=>{g((await u.FH.get("/schedules")).sort((e,s)=>{var t,n;return(null!=(t=e.next_due)?t:1/0)-(null!=(n=s.next_due)?n:1/0)})),S(!1)},[]);(0,m.n)(F,1e4,{onError:()=>S(!0)});let E=null==b||null==(e=b.find(e=>e.id===N))?void 0:e.fire_count;(0,a.useEffect)(()=>{N&&u.FH.get("/schedules/".concat(N,"/runs")).then(A).catch(()=>A([]))},[N,E]);let T=async e=>{await u.FH.del("/schedules/".concat(e.id)),await F()};return(0,n.jsxs)("div",{className:"page",children:[(0,n.jsx)("div",{className:"page-head",children:(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{children:s("nav.schedules")}),(0,n.jsx)("p",{children:s("sched.subtitle")})]})}),C&&(0,n.jsx)(v.lZ,{kind:"err",children:s("fa.sched.loadFailed")}),f&&b&&0===b.length?(0,n.jsx)(v.pp,{icon:(0,n.jsx)(c.A,{size:28}),title:s("sched.empty.title"),body:s("sched.empty.body")}):(0,n.jsx)("div",{className:"sched-list",children:(null!=b?b:[]).map(e=>{let a=k.find(s=>s.id===e.agent_id),c="once"!==e.kind;return(0,n.jsxs)("div",{className:"card card-pad sched ".concat(e.enabled?"":"off"),children:[(0,n.jsxs)("div",{className:"row gap-s",children:[a?(0,n.jsx)(v._h,{agent:a,size:"sm"}):null,(0,n.jsx)("b",{children:e.agent_name}),(0,n.jsx)("span",{className:"chip",children:s("sched.kind.".concat(e.kind))}),(0,n.jsx)("span",{className:"chip",children:e.thread_id?e.place||"chat":s("sched.where.web")}),!e.enabled&&(0,n.jsx)("span",{className:"chip warn",children:s("sched.paused")}),(0,n.jsx)("span",{className:"grow"}),c&&(0,n.jsx)("button",{className:"btn ghost sm",onClick:()=>{u.FH.patch("/schedules/".concat(e.id),{enabled:!e.enabled}).then(F).catch(e=>t(e.message,"err"))},children:e.enabled?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(d.A,{size:14}),s("sched.pause")]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(l.A,{size:14}),s("sched.resume")]})}),(0,n.jsx)("button",{className:"btn ghost sm","aria-label":s("common.delete"),onClick:()=>z(e),children:(0,n.jsx)(i.A,{size:14})})]}),(c||"watch"===e.kind)&&(0,n.jsx)("div",{className:"small",children:(0,n.jsx)("code",{children:e.description})}),(0,n.jsx)("p",{className:"note",children:e.note}),(0,n.jsxs)("div",{className:"meta muted small",children:[(0,n.jsxs)("span",{children:[s("watch"===e.kind?"sched.until":"sched.next"),": ",e.next_due?"".concat((0,x.v7)(e.next_due)," \xb7 ").concat(s("sched.in",{when:(e=>{let t=Math.max(1,Math.round((e-Date.now())/6e4));if(t<60)return s("sched.minShort",{count:t});let n=Math.round(t/60);return n<48?s("sched.hourShort",{count:n}):s("sched.dayShort",{count:Math.round(n/24)})})(e.next_due)})):s("sched.never")]}),c&&e.last_status&&(0,n.jsxs)("span",{children:[s("sched.last"),": ",(0,n.jsx)("span",{className:"chip ".concat(y.includes(e.last_status)?"warn":""),children:s("sched.status.".concat(e.last_status))})," ",(0,p.KN)(e.last_fired_at)]}),c&&(0,n.jsx)("span",{children:s("sched.runs",{count:e.fire_count})}),c&&(0,n.jsx)("button",{className:"linkbtn",onClick:()=>_(N===e.id?null:e.id),children:N===e.id?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(r.A,{size:13})," ",s("sched.hide")]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(h.A,{size:13})," ",s("sched.history")]})})]}),N===e.id&&(0,n.jsx)("div",{className:"sched-runs",children:0===w.length?(0,n.jsx)("span",{className:"muted",children:s("sched.noRuns")}):w.map(e=>(0,n.jsxs)("div",{className:"r",children:[(0,n.jsx)("span",{className:"muted",children:(0,x.v7)(e.fired_at)}),(0,n.jsx)("span",{className:"chip ".concat(y.includes(e.status)?"warn":""),children:s("sched.status.".concat(e.status))}),e.duration_ms?(0,n.jsxs)("span",{className:"muted",children:[Math.round(e.duration_ms/1e3)," s"]}):null,e.detail?(0,n.jsx)("span",{className:"muted",children:e.detail}):null]},e.id))})]},e.id)})}),M&&(0,n.jsx)(v.TM,{danger:!0,title:s("sched.deleteTitle"),body:s("sched.deleteBody"),confirmLabel:s("common.delete"),onConfirm:()=>T(M),onClose:()=>z(null)})]})}},97356:(e,s,t)=>{"use strict";t.d(s,{A:()=>n});let n=(0,t(74955).A)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])}},e=>{e.O(0,[586,839,408,89,358],()=>e(e.s=14676)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[898],{15065:(e,s,n)=>{Promise.resolve().then(n.bind(n,25382))},25382:(e,s,n)=>{"use strict";n.r(s),n.d(s,{default:()=>p});var t=n(94799),a=n(41463),l=n.n(a),i=n(34023),r=n(3749),c=n(48538),o=n(37064),d=n(61748),u=n(51705),m=n(47890),h=n(56072),g=n(86606),v=n(69654);function p(){let{t:e,locale:s}=(0,v.s9)(),{agents:n}=(0,c.q5)(),[a,p]=(0,i.useState)(null),[x,j]=(0,i.useState)(""),[f,w]=(0,i.useState)("all"),[N,_]=(0,d.Z)("session",""),[y,b]=(0,i.useState)(!1),[k,E]=(0,i.useState)(null),[S,L]=(0,i.useState)(0),[C,R]=(0,i.useState)(100),M=(0,i.useRef)(null),P=null===a||a.some(e=>e.pending);(0,o.n)(async()=>{p(await r.FH.get("/sessions")),b(!1)},2500,{enabled:P,onError:()=>{b(!0),p(e=>null!=e?e:[])}});let q=(0,i.useMemo)(()=>N&&(null==a?void 0:a.find(e=>e.session_id===N))||null,[a,N]);(0,i.useEffect)(()=>{R(100)},[null==q?void 0:q.session_id]),(0,i.useEffect)(()=>{let e=!1;return q?(r.FH.get("/agents/".concat(q.agent_id,"/history?session=").concat(encodeURIComponent(q.session_id),"&limit=").concat(C)).then(s=>{var n;e||(E(s.messages),L(null!=(n=s.total)?n:s.messages.length))}).catch(()=>!e&&E([])),()=>{e=!0}):void E(null)},[null==q?void 0:q.agent_id,null==q?void 0:q.session_id,C]),(0,i.useEffect)(()=>{k&&100===C&&M.current&&(M.current.scrollTop=M.current.scrollHeight)},[k,C]);let F=(0,i.useMemo)(()=>(null!=a?a:[]).filter(e=>("all"===f||e.provider===f)&&(!x||"".concat(e.agent_name," ").concat(e.preview," ").concat(e.cwd).toLowerCase().includes(x.toLowerCase()))),[a,x,f]),O=(0,i.useMemo)(()=>{let e=new Map;for(let n of F){var s;let t=new Date(n.last_seen).toLocaleDateString((0,v.VR)(),{weekday:"long",day:"numeric",month:"short"});e.set(t,[...null!=(s=e.get(t))?s:[],n])}return[...e.entries()]},[F,s]),T=q&&n.find(e=>e.id===q.agent_id),Z=k?S-k.length:0;return(0,t.jsx)("div",{className:"page full",children:!y||(null==a?void 0:a.length)?a&&!a.length?(0,t.jsx)("div",{className:"m-xl",children:(0,t.jsx)(g.pp,{title:e("sessions.empty.title"),body:e("sessions.empty.body"),action:(0,t.jsx)(l(),{className:"btn primary",href:"/agents",children:e("sessions.empty.go")})})}):(0,t.jsxs)("div",{className:"sk-ws sx-ws",children:[(0,t.jsxs)("aside",{className:"switcher","aria-label":e("nav.sessions"),children:[(0,t.jsxs)("div",{className:"switcher-head",children:[(0,t.jsx)("b",{className:"fa-title",children:e("nav.sessions")}),(0,t.jsx)(g.DO,{value:x,onChange:j,placeholder:e("sessions.searchPlaceholder"),label:e("sessions.searchLabel")}),(0,t.jsx)(g.$q,{value:f,onChange:w,options:[{id:"all",label:e("common.all")},...Object.keys(m.xq).map(e=>({id:e,label:m.xq[e].short}))]})]}),(0,t.jsxs)("div",{className:"switcher-list",children:[null===a&&(0,t.jsx)("p",{className:"muted small pad-m",children:e("sessions.reading")}),O.map(s=>{let[n,a]=s;return(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"switcher-group",children:[n,(0,t.jsx)("span",{children:a.length})]}),a.map(s=>{var n;return(0,t.jsxs)("button",{className:"sk-item","aria-current":(null==q?void 0:q.session_id)===s.session_id,onClick:()=>_(s.session_id),children:[(0,t.jsxs)("div",{className:"row gap-xs",children:[(0,t.jsx)("b",{className:"grow",children:s.agent_name}),(0,t.jsx)(g.dJ,{provider:s.provider}),s.current&&(0,t.jsx)("span",{className:"chip honey",children:e("sessions.current")})]}),(0,t.jsx)("span",{className:"sk-desc",children:s.preview||(s.pending?e("sessions.counting"):s.task||e("sessions.emptySession"))}),(0,t.jsxs)("span",{className:"sk-meta",children:[(0,m.KN)(s.last_seen),"delegation"===s.kind&&" \xb7 ".concat(e("sessions.delegatedBy",{name:null!=(n=s.from_name)?n:e("chat.anOrchestrator")})),s.pending&&!s.message_count?" \xb7 …":" \xb7 ".concat(e("sessions.messages",{count:s.message_count})),(0,h.RP)(s.usage)>0&&" \xb7 ".concat((0,h.yj)((0,h.RP)(s.usage))," ").concat(e("stats.tokens")),null!==s.cost&&" \xb7 ≈ ".concat((0,h.F0)(s.cost))]})]},s.agent_id+s.session_id)})]},n)}),a&&a.length>0&&!F.length&&(0,t.jsx)("p",{className:"muted small pad-m",children:e("sessions.noMatch")})]})]}),q?(0,t.jsxs)("section",{className:"sk-main",children:[(0,t.jsxs)("header",{className:"sx-head",children:[(0,t.jsxs)("div",{className:"grow",children:[(0,t.jsx)("b",{className:"fa-title lg",children:q.agent_name}),(0,t.jsxs)("div",{className:"muted small mono ellipsis",children:[(0,m._1)(q.cwd)," \xb7 ",q.session_id]})]}),T&&(0,t.jsx)(l(),{className:"btn sm primary",href:"/agents/".concat(T.id),children:e("sessions.openAgent")})]}),(0,t.jsx)("div",{className:"transcript col sx-transcript",ref:M,children:null===k?(0,t.jsx)("p",{className:"muted",children:e("sessions.loading")}):0===k.length?(0,t.jsx)("p",{className:"muted",children:e("sessions.noMessages")}):(0,t.jsxs)(t.Fragment,{children:[Z>0&&(0,t.jsx)("button",{className:"btn sm push-c",onClick:()=>R(C+200),children:e("sessions.older",{count:Z})}),(0,t.jsx)(u.BZ,{msgs:k,agent:{id:q.agent_id,name:q.agent_name,provider:q.provider,role:q.agent_role}})]})})]}):(0,t.jsx)("section",{className:"sk-main sk-none",children:(0,t.jsx)("p",{className:"muted",children:e("sessions.select")})})]}):(0,t.jsx)("div",{className:"m-xl",children:(0,t.jsx)(g.lZ,{kind:"err",children:e("fa.sessions.loadFailed")})})})}},37064:(e,s,n)=>{"use strict";n.d(s,{n:()=>a});var t=n(34023);function a(e,s){let{enabled:n=!0,pauseHidden:a=!0,immediate:l=!0,onError:i}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=(0,t.useRef)(e);r.current=e;let c=(0,t.useRef)(i);c.current=i,(0,t.useEffect)(()=>{let e;if(!n)return;let t=!1,i=0,o=!1,d=()=>{clearTimeout(e),t||(e=setTimeout(()=>void u(),s*Math.min(6,2**i)))},u=async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!t&&!o){if(!e&&a&&"undefined"!=typeof document&&"hidden"===document.visibilityState)return void d();o=!0;try{await r.current(),i=0}catch(e){var s;0==i++&&(null==(s=c.current)||s.call(c,e))}finally{o=!1,d()}}},m=()=>{"visible"!==document.visibilityState||o||(clearTimeout(e),u())};return l?u(!0):d(),a&&document.addEventListener("visibilitychange",m),()=>{t=!0,clearTimeout(e),document.removeEventListener("visibilitychange",m)}},[s,n,a,l])}},61748:(e,s,n)=>{"use strict";n.d(s,{Z:()=>l});var t=n(34023);let a="hive-am:query";function l(e,s){let[n,l]=(0,t.useState)(s);return(0,t.useEffect)(()=>{let n=()=>{var n;return l(null!=(n=new URLSearchParams(location.search).get(e))?n:s)};return n(),window.addEventListener("popstate",n),window.addEventListener(a,n),()=>{window.removeEventListener("popstate",n),window.removeEventListener(a,n)}},[e,s]),[n,(0,t.useCallback)(n=>{let t=new URL(location.href);n===s?t.searchParams.delete(e):t.searchParams.set(e,n),history.replaceState(history.state,"",t),l(n),window.dispatchEvent(new Event(a))},[e,s])]}}},e=>{e.O(0,[586,706,176,839,350,705,408,89,358],()=>e(e.s=15065)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[501],{3492:(e,s,l)=>{"use strict";l.d(s,{A:()=>t});let t=(0,l(74955).A)("Heading2",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]])},12646:(e,s,l)=>{"use strict";l.d(s,{n:()=>A});var t=l(94799),n=l(34023),i=l(6458),a=l(53983),c=l(3492),d=l(98148),r=l(99579),o=l(55838),u=l(98938),h=l(52263),m=l(20555),k=l(91833),p=l(55712),y=l(71529),v=l(69654);function x(e,s,l,t){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:t,i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"",a=e.slice(s,l)||i;return e.slice(s-t.length,s)===t&&e.slice(l,l+n.length)===n&&s!==l?{value:e.slice(0,s-t.length)+a+e.slice(l+n.length),start:s-t.length,end:l-t.length}:{value:e.slice(0,s)+t+a+n+e.slice(l),start:s+t.length,end:s+t.length+a.length}}function b(e,s,l,t,n){let i=e.lastIndexOf("\n",s-1)+1,a=e.indexOf("\n",l),c=-1===a?e.length:a,d=e.slice(i,c).split("\n"),r=d.every(e=>n.test(e)),o=d.map((e,s)=>r?e.replace(n,""):t(s)+e.replace(n,"")).join("\n");return{value:e.slice(0,i)+o+e.slice(c),start:i,end:i+o.length}}let j=/^\s*[-*+] (\[[ x]\] )?/,f=/^\s*\d+\. /,g=/^#{1,6} /,w=/^> ?/;function A(e){let{value:s,onChange:l,placeholder:A,defaultView:N="split",minHeight:M=340,fill:C=!1}=e,{t:z}=(0,v.s9)(),q=(0,n.useRef)(null),[E,S]=(0,n.useState)(N),L=e=>{let s=q.current;if(!s)return;let t=e(s.value,s.selectionStart,s.selectionEnd);l(t.value),requestAnimationFrame(()=>{s.focus(),s.setSelectionRange(t.start,t.end)})},D=[{id:"h",icon:(0,t.jsx)(c.A,{size:15}),label:z("md.heading"),run:()=>L((e,s,l)=>b(e,s,l,()=>"## ",g))},{id:"b",icon:(0,t.jsx)(d.A,{size:15}),label:z("md.bold"),keys:"B",run:()=>L((e,s,l)=>x(e,s,l,"**","**",z("md.boldPh")))},{id:"i",icon:(0,t.jsx)(r.A,{size:15}),label:z("md.italic"),keys:"I",run:()=>L((e,s,l)=>x(e,s,l,"*","*",z("md.italicPh")))},{id:"c",icon:(0,t.jsx)(o.A,{size:15}),label:z("md.code"),run:()=>L((e,s,l)=>x(e,s,l,"`","`","code"))},{id:"cb",icon:(0,t.jsx)(u.A,{size:15}),label:z("md.codeBlock"),run:()=>L((e,s,l)=>x(e,s,l,"\n```\n","\n```\n","code"))},{id:"ul",icon:(0,t.jsx)(h.A,{size:15}),label:z("md.bullets"),run:()=>L((e,s,l)=>b(e,s,l,()=>"- ",j))},{id:"ol",icon:(0,t.jsx)(m.A,{size:15}),label:z("md.numbered"),run:()=>L((e,s,l)=>b(e,s,l,e=>"".concat(e+1,". "),f))},{id:"q",icon:(0,t.jsx)(k.A,{size:15}),label:z("md.quote"),run:()=>L((e,s,l)=>b(e,s,l,()=>"> ",w))},{id:"l",icon:(0,t.jsx)(p.A,{size:15}),label:z("md.link"),keys:"K",run:()=>L((e,s,l)=>{let t=e.slice(s,l)||z("md.linkPh"),n="[".concat(t,"](https://)");return{value:e.slice(0,s)+n+e.slice(l),start:s+t.length+3,end:s+t.length+11}})},{id:"hr",icon:(0,t.jsx)(y.A,{size:15}),label:z("md.rule"),run:()=>L((e,s,l)=>({value:e.slice(0,s)+"\n\n---\n\n"+e.slice(l),start:s+7,end:s+7}))}],O=s.trim()?s.trim().split(/\s+/).length:0;return(0,t.jsxs)("div",{className:"mde".concat(C?" fill":""),children:[(0,t.jsxs)("div",{className:"mde-bar",role:"toolbar","aria-label":z("md.toolbar"),children:[D.map(e=>(0,t.jsx)("button",{type:"button",className:"mde-btn",title:e.keys?"".concat(e.label," (Ctrl+").concat(e.keys,")"):e.label,"aria-label":e.label,onMouseDown:e=>e.preventDefault(),onClick:e.run,disabled:"preview"===E,children:e.icon},e.id)),(0,t.jsx)("span",{className:"grow"}),(0,t.jsx)("div",{className:"mde-views",role:"group",children:["write","split","preview"].map(e=>(0,t.jsx)("button",{type:"button",className:E===e?"on":"","aria-pressed":E===e,onClick:()=>S(e),children:z("md.view.".concat(e))},e))})]}),(0,t.jsxs)("div",{className:"mde-body v-".concat(E),style:{minHeight:M},children:["preview"!==E&&(0,t.jsx)("textarea",{ref:q,className:"mde-text mono",style:{minHeight:M},value:s,onChange:e=>l(e.target.value),onKeyDown:e=>{let s=e.currentTarget;if(e.ctrlKey||e.metaKey){let s=D.find(s=>s.keys&&s.keys.toLowerCase()===e.key.toLowerCase());if(s){e.preventDefault(),s.run();return}}if("Tab"===e.key){e.preventDefault(),L((s,l,t)=>{if(l===t&&!e.shiftKey)return{value:s.slice(0,l)+" "+s.slice(t),start:l+2,end:l+2};let n=s.lastIndexOf("\n",l-1)+1,i=s.indexOf("\n",t),a=-1===i?s.length:i,c=s.slice(n,a).split("\n").map(s=>e.shiftKey?s.replace(/^ {1,2}/,""):" "+s).join("\n");return{value:s.slice(0,n)+c+s.slice(a),start:n,end:n+c.length}});return}if("Enter"===e.key&&!e.shiftKey&&s.selectionStart===s.selectionEnd){let t=s.value,n=s.selectionStart,i=t.lastIndexOf("\n",n-1)+1,a=t.slice(i,n),c=/^(\s*)([-*+] (?:\[[ x]\] )?|(\d+)\. )(.*)$/.exec(a);if(!c)return;if(e.preventDefault(),!c[4]){l(t.slice(0,i)+t.slice(n)),requestAnimationFrame(()=>s.setSelectionRange(i,i));return}let d=c[3]?"".concat(c[1]).concat(Number(c[3])+1,". "):c[1]+c[2].replace("[x]","[ ]");l(t.slice(0,n)+"\n"+d+t.slice(n)),requestAnimationFrame(()=>{let e=n+1+d.length;s.setSelectionRange(e,e)})}},placeholder:A,spellCheck:!1}),"write"!==E&&(0,t.jsx)("div",{className:"mde-prev md",children:(0,t.jsx)(i.oz,{remarkPlugins:[a.A],children:s||z("skills.previewEmpty")})})]}),(0,t.jsxs)("div",{className:"mde-foot muted",children:[z("md.stats",{words:O,chars:s.length})," \xb7 ",z("md.tips")]})]})}},20353:(e,s,l)=>{"use strict";l.r(s),l.d(s,{default:()=>k});var t=l(94799),n=l(34023),i=l(92947),a=l(97356),c=l(48538),d=l(3749),r=l(86606),o=l(73506),u=l(69654),h=l(12646),m=l(82397);function k(){var e,s,l,k;let{t:p}=(0,u.s9)(),{skills:y,refresh:v,ready:x}=(0,c.o0)(),b=(0,r.dj)(),[j,f]=(0,n.useState)(null),[g,w]=(0,n.useState)(""),[A,N]=(0,n.useState)({name:"",description:"",content:""}),[M,C]=(0,n.useState)({}),[z,q]=(0,n.useState)(""),[E,S]=(0,n.useState)(!1),[L,D]=(0,n.useState)(void 0);(0,n.useEffect)(()=>{d.FH.get("/skills/usage").then(C).catch(()=>void 0)},[y]),(0,n.useEffect)(()=>{null===j&&y.length&&f(y[0].id)},[y,j]),(0,n.useEffect)(()=>{if("new"===j)N({name:"",description:"",content:""});else{let e=y.find(e=>e.id===j);e&&N({name:e.name,description:e.description,content:e.content})}q("")},[j]);let O=(0,n.useMemo)(()=>y.filter(e=>!g||"".concat(e.name," ").concat(e.description).toLowerCase().includes(g.toLowerCase())),[y,g]),H=y.find(e=>e.id===j),F="new"===j?!!(A.name||A.content):!!H&&(H.name!==A.name||H.description!==A.description||H.content!==A.content);(0,o.h)(F);let T=e=>{e!==j&&(F?D(e):f(e))},V=async()=>{if(!A.name.trim())return void q(p("skills.err.name"));try{if("new"===j){let e=await d.FH.post("/skills",A);await v(["skills"]),f(e.id),b(p("skills.created"))}else await d.FH.patch("/skills/".concat(j),A),await v(["skills"]),b(p("skills.saved"));q("")}catch(e){q(e instanceof Error?e.message:p("edit.saveFailed"))}};return(0,t.jsxs)("div",{className:"page full",children:[x&&!y.length&&"new"!==j?(0,t.jsx)("div",{className:"m-xl",children:(0,t.jsx)(r.pp,{title:p("skills.empty.title"),body:p("skills.empty.body"),action:(0,t.jsxs)("button",{className:"btn primary",onClick:()=>f("new"),children:[(0,t.jsx)(i.A,{size:16}),p("skills.empty.create")]})})}):(0,t.jsxs)("div",{className:"sk-ws",children:[(0,t.jsxs)("aside",{className:"switcher","aria-label":p("nav.skills"),children:[(0,t.jsxs)("div",{className:"switcher-head",children:[(0,t.jsxs)("div",{className:"row",children:[(0,t.jsx)("b",{className:"fa-title grow",children:p("nav.skills")}),(0,t.jsx)("button",{className:"btn ghost icon sm",onClick:()=>T("new"),"aria-label":p("skills.new"),title:p("skills.new"),children:(0,t.jsx)(i.A,{size:16})})]}),(0,t.jsx)(r.DO,{value:g,onChange:w,placeholder:p("skills.search"),label:p("skills.search")})]}),(0,t.jsxs)("div",{className:"switcher-list",children:["new"===j&&(0,t.jsxs)("button",{className:"sk-item","aria-current":"true",children:[(0,t.jsx)("b",{children:p("skills.new")}),(0,t.jsx)("span",{className:"muted small",children:p("skills.unsaved")})]}),O.map(e=>{var s,l,n,i;return(0,t.jsxs)("button",{className:"sk-item","aria-current":j===e.id,onClick:()=>T(e.id),children:[(0,t.jsx)("b",{children:e.name}),(0,t.jsx)("span",{className:"sk-desc",children:e.description||p("common.noDescription")}),(0,t.jsxs)("span",{className:"sk-meta",children:[p("skills.nAgents",{count:null!=(n=null==(s=M[e.id])?void 0:s.agents)?n:0})," \xb7 ",p("skills.nTypes",{count:null!=(i=null==(l=M[e.id])?void 0:l.types)?i:0})," \xb7 ~",(0,m.Aq)((0,m.NO)(e.content))," tokens"]})]},e.id)}),!O.length&&"new"!==j&&(0,t.jsx)("p",{className:"muted small pad-m",children:p("skills.noMatch",{query:g})})]})]}),j?(0,t.jsxs)("section",{className:"sk-main",children:[(0,t.jsxs)("header",{className:"sk-head",children:[(0,t.jsxs)("div",{className:"sk-fields",children:[(0,t.jsx)(r.D0,{label:p("form.name"),error:z,children:(0,t.jsx)("input",{className:"input",value:A.name,onChange:e=>N({...A,name:e.target.value}),placeholder:p("skills.name.placeholder")})}),(0,t.jsx)(r.D0,{label:p("types.description"),hint:p("skills.description.hint"),children:(0,t.jsx)("input",{className:"input",value:A.description,onChange:e=>N({...A,description:e.target.value})})})]}),(0,t.jsxs)("div",{className:"sk-actions",children:[H&&(0,t.jsxs)("button",{className:"btn danger",onClick:()=>S(!0),children:[(0,t.jsx)(a.A,{size:15}),p("common.delete")]}),F&&(0,t.jsx)("button",{className:"btn ghost",onClick:()=>{var e,s;if("new"===j)f(null!=(s=null==(e=y[0])?void 0:e.id)?s:null);else{if("new"===j)N({name:"",description:"",content:""});else{let e=y.find(e=>e.id===j);e&&N({name:e.name,description:e.description,content:e.content})}q("")}},children:p("common.discard")}),(0,t.jsx)("button",{className:"btn primary",disabled:!F,onClick:V,children:"new"===j?p("skills.create"):p("skills.save")})]})]}),(0,t.jsxs)("div",{className:"sk-editor",children:[(0,t.jsx)("label",{className:"label",children:p("skills.instructions")}),(0,t.jsx)(h.n,{fill:!0,value:A.content,onChange:e=>N({...A,content:e}),placeholder:p("skills.content.placeholder")})]})]}):(0,t.jsx)("section",{className:"sk-main sk-none",children:(0,t.jsx)("p",{className:"muted",children:p("skills.subtitle")})})]}),E&&H&&(0,t.jsx)(r.TM,{danger:!0,title:p("skills.deleteTitle",{name:H.name}),body:p("skills.deleteBody",{agents:p("skills.nAgents",{count:null!=(l=null==(e=M[H.id])?void 0:e.agents)?l:0}),types:p("skills.nTypes",{count:null!=(k=null==(s=M[H.id])?void 0:s.types)?k:0})}),cancelLabel:p("skills.keep"),confirmLabel:p("skills.delete"),onClose:()=>S(!1),onConfirm:async()=>{await d.FH.del("/skills/".concat(H.id)),await v(["skills","agents","types"]),f(null),b(p("skills.deleted"))}}),void 0!==L&&(0,t.jsx)(r.TM,{danger:!0,title:p("fa.unsaved.title"),body:p("fa.unsaved.body"),confirmLabel:p("fa.unsaved.discard"),cancelLabel:p("fa.unsaved.keep"),onClose:()=>D(void 0),onConfirm:()=>{f(L),D(void 0)}})]})}},20555:(e,s,l)=>{"use strict";l.d(s,{A:()=>t});let t=(0,l(74955).A)("ListOrdered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]])},52263:(e,s,l)=>{"use strict";l.d(s,{A:()=>t});let t=(0,l(74955).A)("List",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]])},53824:(e,s,l)=>{Promise.resolve().then(l.bind(l,20353))},55712:(e,s,l)=>{"use strict";l.d(s,{A:()=>t});let t=(0,l(74955).A)("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]])},55838:(e,s,l)=>{"use strict";l.d(s,{A:()=>t});let t=(0,l(74955).A)("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]])},71529:(e,s,l)=>{"use strict";l.d(s,{A:()=>t});let t=(0,l(74955).A)("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]])},73506:(e,s,l)=>{"use strict";l.d(s,{h:()=>n});var t=l(34023);function n(e){(0,t.useEffect)(()=>{if(!e)return;let s=e=>{e.preventDefault(),e.returnValue=""};return window.addEventListener("beforeunload",s),()=>window.removeEventListener("beforeunload",s)},[e])}},91833:(e,s,l)=>{"use strict";l.d(s,{A:()=>t});let t=(0,l(74955).A)("Quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]])},92947:(e,s,l)=>{"use strict";l.d(s,{A:()=>t});let t=(0,l(74955).A)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},97356:(e,s,l)=>{"use strict";l.d(s,{A:()=>t});let t=(0,l(74955).A)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},98148:(e,s,l)=>{"use strict";l.d(s,{A:()=>t});let t=(0,l(74955).A)("Bold",[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]])},98938:(e,s,l)=>{"use strict";l.d(s,{A:()=>t});let t=(0,l(74955).A)("CodeXml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]])},99579:(e,s,l)=>{"use strict";l.d(s,{A:()=>t});let t=(0,l(74955).A)("Italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]])}},e=>{e.O(0,[586,706,839,408,89,358],()=>e(e.s=53824)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[192],{3492:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(74955).A)("Heading2",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]])},11108:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>k});var a=t(94799),l=t(34023),i=t(12646),n=t(92947),r=t(97356),d=t(48538),o=t(3749),c=t(47890),p=t(86606),h=t(1517),y=t(69654),m=t(56072),u=t(73506);let x={name:"",description:"",role:"worker",provider:"claude",model:"",system_prompt:"",permission:"acceptEdits",skill_ids:[],skill_loads:{}};function k(){let{t:e}=(0,y.s9)(),{types:s,agents:t,skills:k,providers:j,refresh:v,ready:b}=(0,d.o0)(),g=(0,p.dj)(),[f,M]=(0,l.useState)(null),[A,N]=(0,l.useState)(""),[C,w]=(0,l.useState)(null),[_,z]=(0,l.useState)(null),[q,H]=(0,l.useState)(!1),D=(0,l.useRef)(""),S=e=>{D.current=JSON.stringify(e),M(e),N("")},V=!!f&&JSON.stringify(f)!==D.current;(0,u.h)(V);let L=()=>{V?H(!0):M(null)},T=async()=>{if(f){if(!f.name.trim())return void N(e("types.err.name"));try{f.id?await o.FH.patch("/types/".concat(f.id),f):await o.FH.post("/types",f),await v(["types"]),g(f.id?e("types.updated"):e("types.created")),M(null),N("")}catch(s){N(s instanceof Error?s.message:e("edit.saveFailed"))}}},E=(e,s)=>M(t=>t&&{...t,[e]:s});return(0,a.jsxs)("div",{className:"page",children:[(0,a.jsxs)("div",{className:"page-head",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{children:e("nav.types")}),(0,a.jsx)("p",{children:e("types.subtitle")})]}),(0,a.jsxs)("button",{className:"btn primary",onClick:()=>S(x),children:[(0,a.jsx)(n.A,{size:16}),e("types.new")]})]}),b&&!s.length?(0,a.jsx)(p.pp,{title:e("types.empty.title"),body:e("types.empty.body"),action:(0,a.jsxs)("button",{className:"btn primary",onClick:()=>S(x),children:[(0,a.jsx)(n.A,{size:16}),e("types.empty.create")]})}):(0,a.jsx)("div",{className:"typegrid",children:s.map(s=>{let l=t.filter(e=>e.type_id===s.id).length;return(0,a.jsxs)("div",{className:"card typecard",children:[(0,a.jsxs)("div",{className:"row gap-l",children:[(0,a.jsx)(p._h,{color:c.xq[s.provider].color,queen:"orchestrator"===s.role,label:s.name.slice(0,2).toUpperCase()}),(0,a.jsxs)("div",{className:"grow",children:[(0,a.jsx)("h3",{className:"fa-card-title",children:s.name}),(0,a.jsx)("div",{className:"row gap-s mt-xs",children:(0,a.jsx)(p.PW,{role:s.role})})]})]}),(0,a.jsx)("p",{className:"muted small m0 fa-desc",children:s.description||e("types.noDescription")}),(0,a.jsxs)("div",{className:"row gap-s wrap",children:[(0,a.jsx)("span",{className:"chip",children:c.xq[s.provider].label}),(0,a.jsx)("span",{className:"chip",children:s.model||e("types.defaultModel")}),(0,a.jsx)("span",{className:"chip",children:e("types.skillsCount",{count:s.skill_ids.length})})]}),(0,a.jsxs)("div",{className:"row mt-xs",children:[(0,a.jsx)("span",{className:"muted small grow",children:e("types.usedBy",{count:l})}),(0,a.jsx)("button",{className:"btn sm",onClick:()=>S({...s}),children:e("common.edit")}),(0,a.jsx)("button",{className:"btn sm primary",onClick:()=>z(s.id),children:e("newAgent.create")})]})]},s.id)})}),f&&(0,a.jsxs)(p._s,{title:f.id?e("types.editTitle",{name:f.name||e("types.typeWord")}):e("types.newTitle"),subtitle:e("types.drawerSubtitle"),onClose:L,footer:(0,a.jsxs)(a.Fragment,{children:[f.id&&(0,a.jsxs)("button",{className:"btn danger push-r",onClick:()=>{var e;return w(null!=(e=s.find(e=>e.id===f.id))?e:null)},children:[(0,a.jsx)(r.A,{size:15}),e("common.delete")]}),(0,a.jsx)("button",{className:"btn ghost",onClick:L,children:e("common.cancel")}),(0,a.jsx)("button",{className:"btn primary",onClick:T,children:f.id?e("types.save"):e("types.create")})]}),children:[(0,a.jsx)(p.D0,{label:e("form.name"),error:A,children:(0,a.jsx)("input",{className:"input",value:f.name,onChange:e=>E("name",e.target.value),placeholder:e("types.name.placeholder"),autoFocus:!0})}),(0,a.jsx)(p.D0,{label:e("types.description"),hint:e("types.description.hint"),children:(0,a.jsx)("input",{className:"input",value:f.description,onChange:e=>E("description",e.target.value)})}),(0,a.jsx)(p.D0,{label:e("form.role"),children:(0,a.jsx)(p.$q,{value:f.role,onChange:e=>E("role",e),options:[{id:"worker",label:e("role.worker")},{id:"orchestrator",label:e("role.orchestrator")}]})}),(0,a.jsx)(p.D0,{label:e("form.provider"),children:(0,a.jsx)(p.YO,{value:f.provider,onChange:e=>M({...f,provider:e,model:""}),providers:j})}),(0,a.jsx)(p.CD,{provider:f.provider,value:f.model,onChange:e=>E("model",e)}),(0,a.jsx)(p.en,{value:f.permission,onChange:e=>E("permission",e)}),(0,a.jsx)(p.D0,{label:e("form.systemPrompt"),hint:e("types.chars",{count:f.system_prompt.length,n:(0,m._E)(f.system_prompt.length)}),children:(0,a.jsx)(i.n,{value:f.system_prompt,onChange:e=>E("system_prompt",e),minHeight:260})}),(0,a.jsx)(p.D0,{label:e("form.skills"),children:(0,a.jsx)(p.kV,{skills:k,value:f.skill_ids,loads:f.skill_loads,onChange:(e,s)=>M({...f,skill_ids:e,skill_loads:s})})})]}),C&&(0,a.jsx)(p.TM,{danger:!0,title:e("types.deleteTitle",{name:C.name}),body:e("types.deleteBody"),cancelLabel:e("types.keep"),confirmLabel:e("types.delete"),onClose:()=>w(null),onConfirm:async()=>{await o.FH.del("/types/".concat(C.id)),await v(["types","agents"]),M(null),g(e("types.deleted"))}}),q&&(0,a.jsx)(p.TM,{danger:!0,title:e("fa.unsaved.title"),body:e("fa.unsaved.body"),confirmLabel:e("fa.unsaved.discard"),cancelLabel:e("fa.unsaved.keep"),onClose:()=>H(!1),onConfirm:()=>M(null)}),_&&(0,a.jsx)(h.b,{presetTypeId:_,onClose:()=>z(null)})]})}},20555:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(74955).A)("ListOrdered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]])},32021:(e,s,t)=>{Promise.resolve().then(t.bind(t,11108))},52263:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(74955).A)("List",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]])},55712:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(74955).A)("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]])},55838:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(74955).A)("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]])},71529:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(74955).A)("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]])},91833:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(74955).A)("Quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]])},92947:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(74955).A)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},97356:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(74955).A)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},98148:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(74955).A)("Bold",[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]])},98938:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(74955).A)("CodeXml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]])},99579:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});let a=(0,t(74955).A)("Italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]])}},e=>{e.O(0,[586,706,839,517,408,89,358],()=>e(e.s=32021)),_N_E=e.O()}]);