hypervibes 0.0.0-stage → 0.4.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 (362) hide show
  1. package/.build/client/assets/_authenticated-C87LKvH0.js +1 -0
  2. package/.build/client/assets/_authenticated.account-D-nTh_fC.js +1 -0
  3. package/.build/client/assets/_authenticated.agents-HwcveLyB.js +1 -0
  4. package/.build/client/assets/_authenticated.agents._agentId-DuE8Lv62.js +1 -0
  5. package/.build/client/assets/_authenticated.agents._agentId.chart-Bb_XkvQx.js +4 -0
  6. package/.build/client/assets/_authenticated.agents._agentId.chat-ClMMKw_N.js +1 -0
  7. package/.build/client/assets/_authenticated.agents._agentId.index-DNJwBwn9.js +1 -0
  8. package/.build/client/assets/_authenticated.agents._agentId.indicators-BmVjLtRI.js +1 -0
  9. package/.build/client/assets/_authenticated.agents._agentId.indicators_._indicatorId-CMqaaFQf.js +2 -0
  10. package/.build/client/assets/_authenticated.agents._agentId.indicators_._indicatorId-DtgkoNV5.js +6 -0
  11. package/.build/client/assets/_authenticated.agents._agentId.memories-O-4f6a4G.js +1 -0
  12. package/.build/client/assets/_authenticated.agents._agentId.memories_._memoryRef-BUPtUcj3.js +1 -0
  13. package/.build/client/assets/_authenticated.agents._agentId.notifications-2lyhXCSk.js +1 -0
  14. package/.build/client/assets/_authenticated.agents._agentId.notifications_._notificationId-Da3ZVT4v.js +1 -0
  15. package/.build/client/assets/_authenticated.agents._agentId.settings-C5cWHoYw.js +1 -0
  16. package/.build/client/assets/_authenticated.agents._agentId.sub-agents-HwcveLyB.js +1 -0
  17. package/.build/client/assets/_authenticated.agents._agentId.sub-agents._subagentId-CZ4MeRy4.js +1 -0
  18. package/.build/client/assets/_authenticated.agents._agentId.sub-agents._subagentId_.runs._runId-dVbo5kMU.js +3 -0
  19. package/.build/client/assets/_authenticated.agents._agentId.sub-agents.index-DeWTOYJD.js +1 -0
  20. package/.build/client/assets/_authenticated.agents._agentId.sub-agents.new-D02TflCE.js +37 -0
  21. package/.build/client/assets/_authenticated.agents._agentId.transactions-D3a8Glgj.js +1 -0
  22. package/.build/client/assets/_authenticated.agents.index-CEqeDEgP.js +1 -0
  23. package/.build/client/assets/_authenticated.agents.new-DLRWK5Uk.js +1 -0
  24. package/.build/client/assets/_authenticated.providers-D0iPLXra.js +1 -0
  25. package/.build/client/assets/agent-chat-page-C5eYFgxw.js +1 -0
  26. package/.build/client/assets/agent-enablement-control-CUzOp9ce.js +1 -0
  27. package/.build/client/assets/agent-events-DC8eDZf3.js +1 -0
  28. package/.build/client/assets/agent-input-aolvZ47U.js +1 -0
  29. package/.build/client/assets/agent-notifications-page-B0mr-Zz8.js +1 -0
  30. package/.build/client/assets/agent-queries-CNMBImun.js +1 -0
  31. package/.build/client/assets/app-DjmsvbUC.css +2 -0
  32. package/.build/client/assets/artifact-content-COO4VTSZ.js +1 -0
  33. package/.build/client/assets/auth-client-K13li9H1.js +3 -0
  34. package/.build/client/assets/call-DxlGie4_.js +31 -0
  35. package/.build/client/assets/ccip-BgPlVPYP.js +1 -0
  36. package/.build/client/assets/chart-contracts-Cr5SFCbE.js +1 -0
  37. package/.build/client/assets/chart-queries-Bpvrgd0-.js +1 -0
  38. package/.build/client/assets/chat-bubble-CAJkT-vL.js +1 -0
  39. package/.build/client/assets/config-dialog-C9x9gKW9.js +1 -0
  40. package/.build/client/assets/contracts-HhAL7Tt7.js +1 -0
  41. package/.build/client/assets/createServerFn-DfZIp2Fu.js +3 -0
  42. package/.build/client/assets/custom-BeqXuIIS.js +5 -0
  43. package/.build/client/assets/decimal-B0DEG-1V.js +1 -0
  44. package/.build/client/assets/esm-BTb2nBdW.js +1 -0
  45. package/.build/client/assets/identicon-Lb9pS4O1.js +1 -0
  46. package/.build/client/assets/index-B4hvjMmI.js +10 -0
  47. package/.build/client/assets/indicator-input-fields-CtmrfVfS.js +1 -0
  48. package/.build/client/assets/indicator-queries-CzZ6u1Mh.js +1 -0
  49. package/.build/client/assets/indicator-renderer-CfccsIt2.js +1 -0
  50. package/.build/client/assets/instrument-label-BZYlWXR5.js +1 -0
  51. package/.build/client/assets/instrument-picker-DLPpryOm.js +1 -0
  52. package/.build/client/assets/journal-decimal-DBvd_Ibi.js +1 -0
  53. package/.build/client/assets/jsx-runtime-CIazjfqY.js +1 -0
  54. package/.build/client/assets/lazyRouteComponent-CJgUa7_r.js +1 -0
  55. package/.build/client/assets/lightweight-charts.production-BiBiFZSH.js +1 -0
  56. package/.build/client/assets/login-MNgYxCOY.js +3 -0
  57. package/.build/client/assets/memory-badge-BbN-DJQi.js +1 -0
  58. package/.build/client/assets/memory-contracts-Doi_Q1XJ.js +1 -0
  59. package/.build/client/assets/memory-queries-BttL580R.js +1 -0
  60. package/.build/client/assets/model-picker-YCQNNmyw.js +1 -0
  61. package/.build/client/assets/notification-queries-B12DG3aS.js +1 -0
  62. package/.build/client/assets/preload-helper-Czpn1I53.js +1 -0
  63. package/.build/client/assets/provider-logo-Ddb77aBD.js +1 -0
  64. package/.build/client/assets/provider-queries-DxPwhDOU.js +1 -0
  65. package/.build/client/assets/query-nvK_95Jo.js +1 -0
  66. package/.build/client/assets/random-uuid-DJR3ygJS.js +1 -0
  67. package/.build/client/assets/react-dom-C6bOPxes.js +1 -0
  68. package/.build/client/assets/risk-queries-D_6PHwus.js +1 -0
  69. package/.build/client/assets/run-subagent-dialog-B4yQe9T9.js +1 -0
  70. package/.build/client/assets/secp256k1-BbZnIgDP.js +1 -0
  71. package/.build/client/assets/setup-checklist-CUW-K484.js +1 -0
  72. package/.build/client/assets/sha2-hT-Q4pur.js +1 -0
  73. package/.build/client/assets/subagent-enabled-toggle-Bk5wfScg.js +1 -0
  74. package/.build/client/assets/subagent-input-TQke90I1.js +1 -0
  75. package/.build/client/assets/subagent-mutations-DfsDbmFu.js +1 -0
  76. package/.build/client/assets/subagent-queries-DVv5JCfs.js +1 -0
  77. package/.build/client/assets/subagent-run-history-D55Uh5VK.js +1 -0
  78. package/.build/client/assets/toggle-timestamp-B50FTPmA.js +1 -0
  79. package/.build/client/assets/useBaseQuery-Bxruo_mV.js +1 -0
  80. package/.build/client/assets/useMutation-DrF53EQG.js +1 -0
  81. package/.build/client/assets/useQuery-BMSU16jY.js +1 -0
  82. package/.build/client/assets/useRouter-c0I1aURm.js +1 -0
  83. package/.build/client/assets/useSelector-ERD9RroG.js +2 -0
  84. package/.build/client/assets/useSuspenseQuery-vODFwDb8.js +1 -0
  85. package/.build/client/assets/utils-Bpv4vmSW.js +1 -0
  86. package/.build/client/assets/worker-triggers-DtXyn40O.js +1 -0
  87. package/.build/server/assets/_authenticated-Bch0_2QH.js +264 -0
  88. package/.build/server/assets/_authenticated-DGV5cZYE.js +22 -0
  89. package/.build/server/assets/_authenticated.account-6qu6oQ1y.js +685 -0
  90. package/.build/server/assets/_authenticated.agents-DYDnQxli.js +5 -0
  91. package/.build/server/assets/_authenticated.agents._agentId-4HvB3mhd.js +17 -0
  92. package/.build/server/assets/_authenticated.agents._agentId-Cl608F1T.js +260 -0
  93. package/.build/server/assets/_authenticated.agents._agentId-G2jAHjma.js +15 -0
  94. package/.build/server/assets/_authenticated.agents._agentId.chart-BIA8wy73.js +2644 -0
  95. package/.build/server/assets/_authenticated.agents._agentId.chart-D4aj8Qy9.js +22 -0
  96. package/.build/server/assets/_authenticated.agents._agentId.chat-ClsVle4g.js +13 -0
  97. package/.build/server/assets/_authenticated.agents._agentId.chat-JV3FDsTp.js +18 -0
  98. package/.build/server/assets/_authenticated.agents._agentId.index-Ct4kbu2f.js +1044 -0
  99. package/.build/server/assets/_authenticated.agents._agentId.index-DJgrupvW.js +18 -0
  100. package/.build/server/assets/_authenticated.agents._agentId.indicators-DrKd0aP5.js +184 -0
  101. package/.build/server/assets/_authenticated.agents._agentId.indicators-wiVaY8fW.js +18 -0
  102. package/.build/server/assets/_authenticated.agents._agentId.indicators_._indicatorId-C4Ox2R-a.js +25 -0
  103. package/.build/server/assets/_authenticated.agents._agentId.indicators_._indicatorId-D8Q0hCW0.js +489 -0
  104. package/.build/server/assets/_authenticated.agents._agentId.memories-BUTyVLYy.js +42 -0
  105. package/.build/server/assets/_authenticated.agents._agentId.memories-E8-nSEMT.js +362 -0
  106. package/.build/server/assets/_authenticated.agents._agentId.memories_._memoryRef-C-SC6wzq.js +14 -0
  107. package/.build/server/assets/_authenticated.agents._agentId.memories_._memoryRef-ZCrdrc8C.js +490 -0
  108. package/.build/server/assets/_authenticated.agents._agentId.notifications-DQeQqTzh.js +14 -0
  109. package/.build/server/assets/_authenticated.agents._agentId.notifications-DlFyYyHh.js +16 -0
  110. package/.build/server/assets/_authenticated.agents._agentId.notifications_._notificationId-B0RosY_R.js +15 -0
  111. package/.build/server/assets/_authenticated.agents._agentId.notifications_._notificationId-C1NikQ9e.js +13 -0
  112. package/.build/server/assets/_authenticated.agents._agentId.settings-DDwjT3Ui.js +42 -0
  113. package/.build/server/assets/_authenticated.agents._agentId.settings-PEzEvOfo.js +751 -0
  114. package/.build/server/assets/_authenticated.agents._agentId.sub-agents-z34-J3Tu.js +5 -0
  115. package/.build/server/assets/_authenticated.agents._agentId.sub-agents._subagentId-D-6TOi1U.js +1371 -0
  116. package/.build/server/assets/_authenticated.agents._agentId.sub-agents._subagentId-DipzVdnr.js +13 -0
  117. package/.build/server/assets/_authenticated.agents._agentId.sub-agents._subagentId_.runs._runId-BZR3VLV7.js +610 -0
  118. package/.build/server/assets/_authenticated.agents._agentId.sub-agents._subagentId_.runs._runId-DsYJKfGm.js +12 -0
  119. package/.build/server/assets/_authenticated.agents._agentId.sub-agents.index-BF8Cuzcr.js +231 -0
  120. package/.build/server/assets/_authenticated.agents._agentId.sub-agents.index-D2x0qCnt.js +12 -0
  121. package/.build/server/assets/_authenticated.agents._agentId.sub-agents.new-CYm_vuDD.js +13 -0
  122. package/.build/server/assets/_authenticated.agents._agentId.sub-agents.new-CiVShIka.js +497 -0
  123. package/.build/server/assets/_authenticated.agents._agentId.transactions-BC_XfGqw.js +95 -0
  124. package/.build/server/assets/_authenticated.agents._agentId.transactions-WtBW3xmh.js +495 -0
  125. package/.build/server/assets/_authenticated.agents.index-C8zmu8T8.js +78 -0
  126. package/.build/server/assets/_authenticated.agents.new-Bt-tBR47.js +302 -0
  127. package/.build/server/assets/_authenticated.providers-C0pb-ujV.js +672 -0
  128. package/.build/server/assets/_tanstack-start-manifest_v-Baw5u9sk.js +354 -0
  129. package/.build/server/assets/account-XvMwzRXh.js +66 -0
  130. package/.build/server/assets/account-queries-AJJVkLAV.js +32 -0
  131. package/.build/server/assets/agent-chat-page-DChiz8KQ.js +686 -0
  132. package/.build/server/assets/agent-enablement-control-C90f0uIb.js +143 -0
  133. package/.build/server/assets/agent-events-DK9Yz5__.js +217 -0
  134. package/.build/server/assets/agent-notifications-page-BdyKAyds.js +276 -0
  135. package/.build/server/assets/agent-queries-Cmx8RiUx.js +51 -0
  136. package/.build/server/assets/agents-CZq-0mna.js +106 -0
  137. package/.build/server/assets/agents-CfjmtW7A.js +278 -0
  138. package/.build/server/assets/artifact-content-B6uHmPz7.js +35 -0
  139. package/.build/server/assets/artifacts-HtLwHs8q.js +42 -0
  140. package/.build/server/assets/auth-DTikZAVz.js +12 -0
  141. package/.build/server/assets/auth-client-Vb3O0v7P.js +1897 -0
  142. package/.build/server/assets/auth-user-DkLo8ojH.js +108 -0
  143. package/.build/server/assets/chart-queries-Bc3AfsEb.js +109 -0
  144. package/.build/server/assets/charts-C4dKuwTJ.js +130 -0
  145. package/.build/server/assets/chat-bubble-ik3itVbx.js +109 -0
  146. package/.build/server/assets/config-dialog-9gSAjwwT.js +55 -0
  147. package/.build/server/assets/contracts-CG-nZuYJ.js +155 -0
  148. package/.build/server/assets/createServerRpc-DNqhdU4z.js +12 -0
  149. package/.build/server/assets/decimal-BthtZ77w.js +97 -0
  150. package/.build/server/assets/empty-plugin-adapters-MOWBbCMw.js +5 -0
  151. package/.build/server/assets/errors-DaZqUftX.js +151 -0
  152. package/.build/server/assets/gateway-CHkruO_a.js +193 -0
  153. package/.build/server/assets/identicon-CyawcVnx.js +41 -0
  154. package/.build/server/assets/indicator-input-fields-bzuhIh6t.js +75 -0
  155. package/.build/server/assets/indicator-queries-4dY1-LXx.js +171 -0
  156. package/.build/server/assets/indicator-renderer-B2muPS-8.js +395 -0
  157. package/.build/server/assets/indicators-ENxAHN42.js +192 -0
  158. package/.build/server/assets/insight-contracts-B5rmUDfO.js +14 -0
  159. package/.build/server/assets/instrument-label-C-tTGGsD.js +40 -0
  160. package/.build/server/assets/instrument-picker-CRroLwVq.js +381 -0
  161. package/.build/server/assets/journal-9aE-um9f.js +107 -0
  162. package/.build/server/assets/journal-decimal-Bh9EL029.js +66 -0
  163. package/.build/server/assets/login-BsEFUvTX.js +125 -0
  164. package/.build/server/assets/memories-2WF2fW1G.js +100 -0
  165. package/.build/server/assets/memory-badge-DVYLTtRR.js +53 -0
  166. package/.build/server/assets/memory-contracts-DQGN2IKV.js +22 -0
  167. package/.build/server/assets/memory-queries--4RbPRrk.js +92 -0
  168. package/.build/server/assets/model-picker-CA1uYb--.js +225 -0
  169. package/.build/server/assets/notification-queries-0CJUkBt9.js +52 -0
  170. package/.build/server/assets/notifications-Cn7BiCyw.js +72 -0
  171. package/.build/server/assets/provider-logo-BRdbOr9I.js +32 -0
  172. package/.build/server/assets/provider-queries-BaZWLw8J.js +78 -0
  173. package/.build/server/assets/providers-CyoN_jgW.js +89 -0
  174. package/.build/server/assets/risk-Bqrb6hKQ.js +34 -0
  175. package/.build/server/assets/risk-queries-JQpByHT2.js +18 -0
  176. package/.build/server/assets/router-Hkr5TH_I.js +419 -0
  177. package/.build/server/assets/run-subagent-dialog-C7iUOZa-.js +59 -0
  178. package/.build/server/assets/setup-DqMlwgNr.js +30 -0
  179. package/.build/server/assets/setup-checklist-BICTmBo2.js +60 -0
  180. package/.build/server/assets/start-C-GPoWRt.js +4 -0
  181. package/.build/server/assets/subagent-enabled-toggle-Djte00oo.js +22 -0
  182. package/.build/server/assets/subagent-input-BHQKs2cW.js +57 -0
  183. package/.build/server/assets/subagent-mutations-dUo3B_SG.js +32 -0
  184. package/.build/server/assets/subagent-queries-sAwBjFxC.js +146 -0
  185. package/.build/server/assets/subagent-run-history-C_xmucO-.js +186 -0
  186. package/.build/server/assets/subagents-CIoilC66.js +180 -0
  187. package/.build/server/assets/toggle-timestamp-CToUVn67.js +28 -0
  188. package/.build/server/assets/trading-contracts-zWq1Hxnb.js +26 -0
  189. package/.build/server/assets/validation-BX-krL0i.js +33 -0
  190. package/.build/server/assets/worker-triggers-CJF5HWzR.js +51 -0
  191. package/.build/server/server.js +7501 -0
  192. package/LICENSE +661 -0
  193. package/README.md +145 -2
  194. package/bin/hypervibes.js +24 -0
  195. package/dist/agents/agent-enablement.js +10 -0
  196. package/dist/agents/agent-input.js +38 -0
  197. package/dist/agents/agent-service.js +1004 -0
  198. package/dist/agents/cancel-task-scope.js +52 -0
  199. package/dist/agents/candle-intervals.js +1 -0
  200. package/dist/agents/default-subagents.js +36 -0
  201. package/dist/agents/execution-context-contracts.js +1 -0
  202. package/dist/agents/execution-context.js +206 -0
  203. package/dist/agents/execution-warnings.js +33 -0
  204. package/dist/agents/orchestrator-insights.js +14 -0
  205. package/dist/agents/run-inspection.js +99 -0
  206. package/dist/agents/subagent-dashboard.js +1 -0
  207. package/dist/agents/subagent-extension.js +156 -0
  208. package/dist/agents/subagent-history.js +5 -0
  209. package/dist/agents/subagent-input.js +73 -0
  210. package/dist/agents/subagent-service.js +1177 -0
  211. package/dist/agents/subagent-templates.js +20 -0
  212. package/dist/agents/template-manifest.js +34 -0
  213. package/dist/agents/templates/basic-analysis.json +40 -0
  214. package/dist/agents/templates/basic-review.json +48 -0
  215. package/dist/agents/templates/basic-trading.json +45 -0
  216. package/dist/agents/templates/indicator-developer.json +16 -0
  217. package/dist/agents/time-guidance.js +29 -0
  218. package/dist/agents/worker-events.js +18 -0
  219. package/dist/agents/worker-inbox.js +28 -0
  220. package/dist/agents/worker-triggers.js +23 -0
  221. package/dist/auth-options.js +98 -0
  222. package/dist/auth-user.js +15 -0
  223. package/dist/auth.js +28 -0
  224. package/dist/cache/svg-logo-cache.js +155 -0
  225. package/dist/canonical.js +13 -0
  226. package/dist/charts/chart-service.js +236 -0
  227. package/dist/charts/contracts.js +118 -0
  228. package/dist/charts/durable-extension.js +27 -0
  229. package/dist/charts/trading-contracts.js +14 -0
  230. package/dist/config.js +85 -0
  231. package/dist/db/agent-schema.js +26 -0
  232. package/dist/db/auth-schema.js +122 -0
  233. package/dist/db/database.js +31 -0
  234. package/dist/db/exchange-schema.js +23 -0
  235. package/dist/db/gateway-schema.js +24 -0
  236. package/dist/db/indicator-schema.js +19 -0
  237. package/dist/db/migrations/20261015221717_auth/migration.sql +62 -0
  238. package/dist/db/migrations/20261015231224_agents/migration.sql +35 -0
  239. package/dist/db/migrations/20261016040641_provider_connections/migration.sql +19 -0
  240. package/dist/db/migrations/20261016061831_trade_journal/migration.sql +48 -0
  241. package/dist/db/migrations/20261016080320_order_execution/migration.sql +62 -0
  242. package/dist/db/migrations/20261016181110_subagents/migration.sql +51 -0
  243. package/dist/db/migrations/20261017222959_research_artifacts/migration.sql +37 -0
  244. package/dist/db/migrations/20261018061531_memories_and_insights/migration.sql +162 -0
  245. package/dist/db/migrations/20261020091156_worker_event_inbox/migration.sql +54 -0
  246. package/dist/db/migrations/20261021051229_chart_workspace/migration.sql +33 -0
  247. package/dist/db/migrations/20261021222116_gateways/migration.sql +15 -0
  248. package/dist/db/migrations/20261022015813_pine_indicators/migration.sql +43 -0
  249. package/dist/db/migrations/20261022101559_notifications/migration.sql +51 -0
  250. package/dist/db/migrations.js +12 -0
  251. package/dist/db/order-provenance-schema.js +17 -0
  252. package/dist/db/order-schema.js +32 -0
  253. package/dist/db/profile-lock.js +12 -0
  254. package/dist/db/provider-schema.js +16 -0
  255. package/dist/db/shared-database.js +128 -0
  256. package/dist/db/subagent-schema.js +79 -0
  257. package/dist/gateway/bridge-service.js +223 -0
  258. package/dist/gateway/gateway-store.js +77 -0
  259. package/dist/gateway/handlers.js +122 -0
  260. package/dist/gateway/telegram/connector.js +115 -0
  261. package/dist/gateway/telegram/transport.js +96 -0
  262. package/dist/hyperliquid/account-info.js +117 -0
  263. package/dist/hyperliquid/account-status.js +64 -0
  264. package/dist/hyperliquid/agent-dashboard.js +56 -0
  265. package/dist/hyperliquid/chart-contracts.js +9 -0
  266. package/dist/hyperliquid/constants.js +25 -0
  267. package/dist/hyperliquid/crypto.js +29 -0
  268. package/dist/hyperliquid/currency-logo.js +7 -0
  269. package/dist/hyperliquid/decimal.js +98 -0
  270. package/dist/hyperliquid/durable-extension.js +39 -0
  271. package/dist/hyperliquid/errors.js +8 -0
  272. package/dist/hyperliquid/exchange.js +118 -0
  273. package/dist/hyperliquid/journal-decimal.js +48 -0
  274. package/dist/hyperliquid/journal-model.js +167 -0
  275. package/dist/hyperliquid/journal-service.js +648 -0
  276. package/dist/hyperliquid/live-dashboard.js +245 -0
  277. package/dist/hyperliquid/logo-cache.js +27 -0
  278. package/dist/hyperliquid/market-charts.js +242 -0
  279. package/dist/hyperliquid/market-snapshot.js +45 -0
  280. package/dist/hyperliquid/orders/order-contracts.js +42 -0
  281. package/dist/hyperliquid/orders/order-math.js +89 -0
  282. package/dist/hyperliquid/orders/order-outcomes.js +74 -0
  283. package/dist/hyperliquid/orders/order-prepare.js +109 -0
  284. package/dist/hyperliquid/orders/order-service.js +432 -0
  285. package/dist/hyperliquid/orders/order-store.js +134 -0
  286. package/dist/hyperliquid/orders/order-tools.js +40 -0
  287. package/dist/hyperliquid/orders/protection.js +35 -0
  288. package/dist/hyperliquid/orders/risk-settings.js +44 -0
  289. package/dist/hyperliquid/orders/trade-admission.js +117 -0
  290. package/dist/hyperliquid/orders/trade-planning.js +60 -0
  291. package/dist/hyperliquid/service.js +529 -0
  292. package/dist/hyperliquid/shared-feeds.js +40 -0
  293. package/dist/hyperliquid/signing.js +89 -0
  294. package/dist/indicators/builtin-catalog.js +59 -0
  295. package/dist/indicators/builtins/adx.pine +22 -0
  296. package/dist/indicators/builtins/atr.pine +11 -0
  297. package/dist/indicators/builtins/bollinger.pine +10 -0
  298. package/dist/indicators/builtins/ema.pine +5 -0
  299. package/dist/indicators/builtins/macd.pine +18 -0
  300. package/dist/indicators/builtins/rsi.pine +18 -0
  301. package/dist/indicators/builtins/sma.pine +5 -0
  302. package/dist/indicators/candle-window.js +36 -0
  303. package/dist/indicators/chart-contracts.js +64 -0
  304. package/dist/indicators/contracts.js +14 -0
  305. package/dist/indicators/durable-extension.js +32 -0
  306. package/dist/indicators/indicator-service.js +300 -0
  307. package/dist/indicators/indicator-store.js +137 -0
  308. package/dist/indicators/normalize.js +149 -0
  309. package/dist/indicators/result-schema.js +79 -0
  310. package/dist/indicators/runtime-wrapper.js +52 -0
  311. package/dist/indicators/runtime.js +201 -0
  312. package/dist/indicators/validation.js +124 -0
  313. package/dist/indicators/worker-queue.js +48 -0
  314. package/dist/initialize-config.js +160 -0
  315. package/dist/main.js +59 -0
  316. package/dist/memory/decision-audit.js +47 -0
  317. package/dist/memory/durable-extension.js +40 -0
  318. package/dist/memory/execution-audit.js +83 -0
  319. package/dist/memory/insight-contracts.js +33 -0
  320. package/dist/memory/insight-service.js +117 -0
  321. package/dist/memory/memory-contracts.js +113 -0
  322. package/dist/memory/memory-service.js +179 -0
  323. package/dist/memory/operations.js +46 -0
  324. package/dist/memory/tool-schemas.js +44 -0
  325. package/dist/memory/validation.js +42 -0
  326. package/dist/notifications/contracts.js +1 -0
  327. package/dist/notifications/delivery.js +11 -0
  328. package/dist/notifications/durable-extension.js +20 -0
  329. package/dist/notifications/notification-service.js +324 -0
  330. package/dist/providers/credential-store.js +86 -0
  331. package/dist/providers/ollama-cloud.js +148 -0
  332. package/dist/providers/provider-logo-url.js +18 -0
  333. package/dist/providers/provider-logo.js +31 -0
  334. package/dist/providers/provider-service.js +295 -0
  335. package/dist/research/artifacts.js +151 -0
  336. package/dist/research/call-queue.js +43 -0
  337. package/dist/research/contracts.js +37 -0
  338. package/dist/research/evidence.js +43 -0
  339. package/dist/research/journal.js +30 -0
  340. package/dist/research/research-service.js +191 -0
  341. package/dist/research/tool-activity.js +49 -0
  342. package/dist/research/tool-response.js +25 -0
  343. package/dist/runtime.js +145 -0
  344. package/dist/web/agent-events.js +418 -0
  345. package/dist/web/app.js +206 -0
  346. package/dist/web/artifact-downloads.js +23 -0
  347. package/dist/web/middleware.js +25 -0
  348. package/dist/web/random-uuid.js +14 -0
  349. package/dist/web/start.js +56 -0
  350. package/package.json +93 -3
  351. package/scripts/check-node.mjs +24 -0
  352. package/static/android-chrome-192x192.png +0 -0
  353. package/static/android-chrome-512x512.png +0 -0
  354. package/static/apple-touch-icon.png +0 -0
  355. package/static/favicon-16x16.png +0 -0
  356. package/static/favicon-32x32.png +0 -0
  357. package/static/favicon.ico +0 -0
  358. package/static/github.svg +3 -0
  359. package/static/hypervibes.png +0 -0
  360. package/static/logo.png +0 -0
  361. package/static/site.webmanifest +1 -0
  362. package/static/telegram.svg +1 -0
@@ -0,0 +1,1371 @@
1
+ import { r as modelChoicesQueryOptions } from "./provider-queries-BaZWLw8J.js";
2
+ import { d as saveSubagentAssignments, f as saveSubagentIdentity, g as unarchiveSubagent, i as subagentQueryOptions, m as saveSubagentTools, s as archiveSubagent, t as cacheSubagent } from "./subagent-queries-sAwBjFxC.js";
3
+ import { f as randomUuid, t as chartToolNames } from "./contracts-CG-nZuYJ.js";
4
+ import { r as candleIntervals, t as defaultWorkerTriggers } from "./worker-triggers-CJF5HWzR.js";
5
+ import { t as memoryToolNames } from "./memory-contracts-DQGN2IKV.js";
6
+ import { t as Route } from "./_authenticated.agents._agentId.sub-agents._subagentId-DipzVdnr.js";
7
+ import { t as subagentMutations } from "./subagent-mutations-dUo3B_SG.js";
8
+ import { n as configButton, r as configInput, t as ConfigDialog } from "./config-dialog-9gSAjwwT.js";
9
+ import { t as ProviderLogo } from "./provider-logo-BRdbOr9I.js";
10
+ import { a as modelKey, n as ModelPicker } from "./model-picker-CA1uYb--.js";
11
+ import { t as SubagentEnabledToggle } from "./subagent-enabled-toggle-Djte00oo.js";
12
+ import { t as RunSubagentDialog } from "./run-subagent-dialog-C7iUOZa-.js";
13
+ import { r as SubagentRunHistory } from "./subagent-run-history-C_xmucO-.js";
14
+ import { a as normalizeDelegationTools, i as indicatorReadToolNames, n as hyperliquidToolNames, o as researchToolNames, r as indicatorDevelopToolNames, t as defaultMainInstructions } from "./subagent-input-BHQKs2cW.js";
15
+ import { useEffect, useId, useRef, useState } from "react";
16
+ import { useRouter } from "@tanstack/react-router";
17
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
18
+ import { useMutation, useQueryClient, useSuspenseQuery } from "@tanstack/react-query";
19
+ import { toast } from "sonner";
20
+ import { format } from "timeago.js";
21
+ //#region src/components/worker-trigger-config.tsx
22
+ function WorkerTriggerConfig({ value = defaultWorkerTriggers, workers, onChange }) {
23
+ const [open, setOpen] = useState(false);
24
+ return /* @__PURE__ */ jsxs("section", {
25
+ className: "space-y-2",
26
+ children: [
27
+ /* @__PURE__ */ jsxs("header", {
28
+ className: "flex items-center justify-between gap-4",
29
+ children: [/* @__PURE__ */ jsx("h3", {
30
+ className: "font-medium text-white",
31
+ children: "Event triggers"
32
+ }), /* @__PURE__ */ jsx("button", {
33
+ type: "button",
34
+ "aria-haspopup": "dialog",
35
+ onClick: () => setOpen(true),
36
+ className: configButton,
37
+ children: "Edit triggers"
38
+ })]
39
+ }),
40
+ /* @__PURE__ */ jsx("p", {
41
+ className: "text-sm text-zinc-400",
42
+ children: value.inboxEnabled ? "Event-driven inbox enabled" : "Event-driven inbox disabled"
43
+ }),
44
+ value.inboxEnabled && /* @__PURE__ */ jsxs("p", {
45
+ className: "text-sm text-zinc-400",
46
+ children: [
47
+ [
48
+ value.researchSources.length ? `${value.researchSources.length} research sources` : "",
49
+ value.fills ? "Order fills" : "",
50
+ value.orderChanges ? "Order status changes" : ""
51
+ ].filter(Boolean).join(" · ") || "No automatic events selected",
52
+ " · ",
53
+ value.workerDelegates.length,
54
+ " approved worker callers"
55
+ ]
56
+ }),
57
+ open && /* @__PURE__ */ jsx(TriggerDialog, {
58
+ value,
59
+ workers,
60
+ onCancel: () => setOpen(false),
61
+ onApply: async (next) => {
62
+ await onChange(next);
63
+ setOpen(false);
64
+ }
65
+ })
66
+ ]
67
+ });
68
+ }
69
+ function TriggerDialog({ value, workers, onCancel, onApply }) {
70
+ const [draft, setDraft] = useState(value);
71
+ const [saving, setSaving] = useState(false), [error, setError] = useState("");
72
+ const inFlight = useRef(false);
73
+ async function apply() {
74
+ if (inFlight.current) return;
75
+ inFlight.current = true;
76
+ setSaving(true);
77
+ setError("");
78
+ try {
79
+ await onApply(draft);
80
+ } catch (cause) {
81
+ setError(cause instanceof Error ? cause.message : "Unable to save triggers");
82
+ } finally {
83
+ inFlight.current = false;
84
+ setSaving(false);
85
+ }
86
+ }
87
+ const sources = (key, title) => /* @__PURE__ */ jsxs("fieldset", {
88
+ className: "space-y-2",
89
+ children: [/* @__PURE__ */ jsx("legend", {
90
+ className: "mb-2 text-sm font-medium text-white",
91
+ children: title
92
+ }), workers.length ? workers.map((worker) => /* @__PURE__ */ jsxs("label", {
93
+ className: "flex cursor-pointer items-center gap-3 text-sm",
94
+ children: [
95
+ /* @__PURE__ */ jsx("input", {
96
+ type: "checkbox",
97
+ checked: draft[key].includes(worker.id),
98
+ disabled: worker.archived && !draft[key].includes(worker.id),
99
+ onChange: (event) => setDraft((current) => ({
100
+ ...current,
101
+ [key]: event.target.checked ? [...current[key], worker.id] : current[key].filter((id) => id !== worker.id)
102
+ })),
103
+ className: "cursor-pointer"
104
+ }),
105
+ worker.name,
106
+ worker.archived ? " (archived)" : ""
107
+ ]
108
+ }, worker.id)) : /* @__PURE__ */ jsx("p", {
109
+ className: "text-xs text-zinc-500",
110
+ children: "Create another worker first."
111
+ })]
112
+ });
113
+ return /* @__PURE__ */ jsxs(ConfigDialog, {
114
+ title: "Event triggers",
115
+ onCancel: () => {
116
+ if (!inFlight.current) onCancel();
117
+ },
118
+ onApply: () => {
119
+ apply();
120
+ },
121
+ applyDisabled: saving,
122
+ children: [/* @__PURE__ */ jsxs("fieldset", {
123
+ disabled: saving,
124
+ className: "space-y-5 disabled:opacity-60",
125
+ children: [/* @__PURE__ */ jsxs("label", {
126
+ className: "flex cursor-pointer items-center gap-3 text-sm",
127
+ children: [/* @__PURE__ */ jsx("input", {
128
+ type: "checkbox",
129
+ checked: draft.inboxEnabled,
130
+ onChange: (event) => setDraft(event.target.checked ? {
131
+ ...draft,
132
+ inboxEnabled: true
133
+ } : { ...defaultWorkerTriggers }),
134
+ className: "cursor-pointer"
135
+ }), "Enable event triggers"]
136
+ }), draft.inboxEnabled && /* @__PURE__ */ jsxs(Fragment$1, { children: [
137
+ sources("researchSources", "Research published"),
138
+ sources("workerDelegates", "Allow research delegation from"),
139
+ workers.filter((worker) => draft.workerDelegates.includes(worker.id) && worker.tools !== void 0 && !normalizeDelegationTools(worker.tools).includes("delegate_subagent")).map((worker) => /* @__PURE__ */ jsxs("p", {
140
+ role: "status",
141
+ className: "text-xs text-amber-200",
142
+ children: [worker.name, " cannot delegate: enable delegate_subagent in its Tools."]
143
+ }, worker.id)),
144
+ /* @__PURE__ */ jsxs("label", {
145
+ className: "flex cursor-pointer items-center gap-3 text-sm",
146
+ children: [/* @__PURE__ */ jsx("input", {
147
+ type: "checkbox",
148
+ checked: draft.fills,
149
+ onChange: (event) => setDraft((current) => ({
150
+ ...current,
151
+ fills: event.target.checked
152
+ })),
153
+ className: "cursor-pointer"
154
+ }), "Order fills — partial or complete"]
155
+ }),
156
+ /* @__PURE__ */ jsxs("label", {
157
+ className: "flex cursor-pointer items-center gap-3 text-sm",
158
+ children: [/* @__PURE__ */ jsx("input", {
159
+ type: "checkbox",
160
+ checked: draft.orderChanges,
161
+ onChange: (event) => setDraft((current) => ({
162
+ ...current,
163
+ orderChanges: event.target.checked
164
+ })),
165
+ className: "cursor-pointer"
166
+ }), "Order status changes — canceled, rejected, expired"]
167
+ })
168
+ ] })]
169
+ }), error && /* @__PURE__ */ jsx("p", {
170
+ role: "alert",
171
+ className: "text-sm text-red-300",
172
+ children: error
173
+ })]
174
+ });
175
+ }
176
+ function runPagination(total, requestedPage = 1) {
177
+ const pages = Math.max(1, Math.ceil(total / 50));
178
+ return {
179
+ page: Math.min(requestedPage, pages),
180
+ pages,
181
+ total,
182
+ pageSize: 50
183
+ };
184
+ }
185
+ //#endregion
186
+ //#region src/components/use-subagent-runs.ts
187
+ /** One page-scoped subscription; reconnects receive a fresh backend snapshot. */
188
+ function useSubagentRuns(agentId, subagentId, initial) {
189
+ const [history, setHistory] = useState(() => ({
190
+ runs: initial?.runs ?? [],
191
+ pagination: initial?.pagination ?? runPagination(initial?.runs.length ?? 0),
192
+ schedulerError: initial?.schedulerError ?? null
193
+ }));
194
+ const [page, setPage] = useState(1);
195
+ const [loading, setLoading] = useState(false);
196
+ const [connectionError, setConnectionError] = useState("");
197
+ useEffect(() => {
198
+ if (!subagentId) return;
199
+ let active = true;
200
+ setLoading(true);
201
+ setConnectionError("");
202
+ const source = new EventSource(`/api/agents/${encodeURIComponent(agentId)}/sub-agents/${encodeURIComponent(subagentId)}/runs/events?page=${page}`);
203
+ const interrupted = (event, fallback) => {
204
+ if (!active) return;
205
+ setLoading(false);
206
+ setConnectionError(event ? JSON.parse(event.data).message ?? fallback : fallback);
207
+ };
208
+ source.addEventListener("runs", (event) => {
209
+ if (!active) return;
210
+ const snapshot = JSON.parse(event.data);
211
+ setHistory(snapshot);
212
+ setLoading(false);
213
+ setConnectionError("");
214
+ if (snapshot.pagination.page !== page) setPage(snapshot.pagination.page);
215
+ });
216
+ source.addEventListener("unauthorized", () => {
217
+ if (active) window.location.assign("/login");
218
+ });
219
+ source.addEventListener("shutdown", () => interrupted(void 0, "Server is restarting. Reconnecting…"));
220
+ source.addEventListener("unavailable", (event) => interrupted(event, "Run history updates interrupted. Reconnecting…"));
221
+ source.addEventListener("stream-error", (event) => interrupted(event, "Run history could not be streamed."));
222
+ source.onerror = () => interrupted(void 0, "Live updates interrupted. Showing the last received history. Reconnecting…");
223
+ return () => {
224
+ active = false;
225
+ source.close();
226
+ };
227
+ }, [
228
+ agentId,
229
+ subagentId,
230
+ page
231
+ ]);
232
+ return {
233
+ history,
234
+ loading,
235
+ connectionError,
236
+ setPage
237
+ };
238
+ }
239
+ //#endregion
240
+ //#region src/components/archive-subagent-dialog.tsx
241
+ function ArchiveSubagentDialog({ name, onCancel, onConfirm }) {
242
+ const dialog = useRef(null);
243
+ const titleId = useId();
244
+ useEffect(() => {
245
+ const element = dialog.current;
246
+ element.showModal();
247
+ return () => element.close();
248
+ }, []);
249
+ return /* @__PURE__ */ jsxs("dialog", {
250
+ ref: dialog,
251
+ "aria-labelledby": titleId,
252
+ "aria-describedby": `${titleId}-description`,
253
+ onCancel: (event) => {
254
+ event.preventDefault();
255
+ onCancel();
256
+ },
257
+ className: "m-auto w-[calc(100%_-_2rem)] max-w-md rounded-2xl border border-zinc-800 bg-[#0d0d10] p-6 text-zinc-100 shadow-2xl backdrop:bg-black/70 backdrop:backdrop-blur-sm",
258
+ children: [
259
+ /* @__PURE__ */ jsx("h3", {
260
+ id: titleId,
261
+ className: "text-lg font-semibold text-white",
262
+ children: "Archive sub-agent?"
263
+ }),
264
+ /* @__PURE__ */ jsxs("p", {
265
+ id: `${titleId}-description`,
266
+ className: "mt-2 text-sm leading-6 text-zinc-400",
267
+ children: [
268
+ "Archive “",
269
+ name,
270
+ "”? New assignments will be disabled. Its configuration and run history will be preserved."
271
+ ]
272
+ }),
273
+ /* @__PURE__ */ jsxs("div", {
274
+ className: "mt-6 flex flex-col-reverse gap-3 sm:flex-row sm:justify-end",
275
+ children: [/* @__PURE__ */ jsx("button", {
276
+ type: "button",
277
+ autoFocus: true,
278
+ onClick: onCancel,
279
+ className: "cursor-pointer rounded-full border border-zinc-800 px-4 py-2 text-sm font-medium text-zinc-300 hover:border-zinc-700 hover:text-white",
280
+ children: "Cancel"
281
+ }), /* @__PURE__ */ jsx("button", {
282
+ type: "button",
283
+ onClick: onConfirm,
284
+ className: "cursor-pointer rounded-full bg-red-600 px-4 py-2 text-sm font-medium text-white hover:bg-red-500",
285
+ children: "Archive sub-agent"
286
+ })]
287
+ })
288
+ ]
289
+ });
290
+ }
291
+ //#endregion
292
+ //#region src/components/subagent-config.tsx
293
+ function SubagentIdentity({ value, main, agentId, enabled, onToggleEnabled, onChange, actions }) {
294
+ const [open, setOpen] = useState(false);
295
+ return /* @__PURE__ */ jsxs("section", {
296
+ className: "space-y-2",
297
+ children: [
298
+ /* @__PURE__ */ jsxs("header", {
299
+ className: "flex flex-wrap items-center justify-between gap-3",
300
+ children: [/* @__PURE__ */ jsxs("nav", {
301
+ "aria-label": "Sub-agent breadcrumb",
302
+ className: "flex min-w-0 flex-1 flex-wrap items-center gap-2",
303
+ children: [
304
+ /* @__PURE__ */ jsxs("a", {
305
+ href: `/agents/${agentId}/sub-agents`,
306
+ className: "cursor-pointer text-sm text-zinc-400 hover:text-white",
307
+ children: [/* @__PURE__ */ jsx("span", {
308
+ "aria-hidden": "true",
309
+ children: "← "
310
+ }), "Sub-agents"]
311
+ }),
312
+ /* @__PURE__ */ jsx("span", {
313
+ "aria-hidden": "true",
314
+ className: "text-zinc-600",
315
+ children: "/"
316
+ }),
317
+ /* @__PURE__ */ jsxs("h2", {
318
+ "aria-current": "page",
319
+ className: "break-words text-lg font-medium text-white",
320
+ children: [value.name || "Create subagent", main && " · Main conversation"]
321
+ }),
322
+ !main && /* @__PURE__ */ jsx(SubagentEnabledToggle, {
323
+ enabled,
324
+ onClick: onToggleEnabled
325
+ }),
326
+ /* @__PURE__ */ jsx("span", {
327
+ className: "min-w-0 break-words text-sm text-zinc-400",
328
+ children: value.description || "No description"
329
+ }),
330
+ /* @__PURE__ */ jsx("button", {
331
+ type: "button",
332
+ "aria-label": "Edit name and description",
333
+ title: "Edit name and description",
334
+ "aria-haspopup": "dialog",
335
+ onClick: () => setOpen(true),
336
+ className: "inline-flex shrink-0 cursor-pointer items-center justify-center rounded-md p-1 text-zinc-400 hover:bg-zinc-800 hover:text-white",
337
+ children: /* @__PURE__ */ jsx("svg", {
338
+ "aria-hidden": "true",
339
+ viewBox: "0 0 24 24",
340
+ fill: "none",
341
+ stroke: "currentColor",
342
+ strokeWidth: 1.5,
343
+ strokeLinecap: "round",
344
+ strokeLinejoin: "round",
345
+ className: "size-4",
346
+ children: /* @__PURE__ */ jsx("path", { d: "m16 4 4 4M4 20l4-1L21 6a2.8 2.8 0 0 0-4-4L4 15z" })
347
+ })
348
+ })
349
+ ]
350
+ }), actions && /* @__PURE__ */ jsx("div", {
351
+ className: "flex shrink-0 items-center gap-2",
352
+ children: actions
353
+ })]
354
+ }),
355
+ /* @__PURE__ */ jsx("hr", { className: "border-zinc-800" }),
356
+ open && /* @__PURE__ */ jsx(IdentityDialog, {
357
+ value,
358
+ onCancel: () => setOpen(false),
359
+ onApply: async (next) => {
360
+ await onChange(next);
361
+ setOpen(false);
362
+ }
363
+ })
364
+ ]
365
+ });
366
+ }
367
+ function IdentityDialog({ value, onCancel, onApply }) {
368
+ const [draft, setDraft] = useState(value);
369
+ const [saving, setSaving] = useState(false);
370
+ const [error, setError] = useState("");
371
+ const inFlight = useRef(false);
372
+ const descriptionHintId = useId();
373
+ async function apply() {
374
+ if (inFlight.current || !draft.name.trim()) return;
375
+ inFlight.current = true;
376
+ setSaving(true);
377
+ setError("");
378
+ try {
379
+ await onApply({
380
+ name: draft.name.trim(),
381
+ description: draft.description.trim()
382
+ });
383
+ } catch (cause) {
384
+ setError(cause instanceof Error ? cause.message : "Unable to save name and description. Please retry.");
385
+ } finally {
386
+ inFlight.current = false;
387
+ setSaving(false);
388
+ }
389
+ }
390
+ return /* @__PURE__ */ jsxs(ConfigDialog, {
391
+ title: "Edit name and description",
392
+ onCancel: () => {
393
+ if (!inFlight.current) onCancel();
394
+ },
395
+ onApply: () => {
396
+ apply();
397
+ },
398
+ applyDisabled: saving || !draft.name.trim(),
399
+ children: [
400
+ /* @__PURE__ */ jsxs("fieldset", {
401
+ disabled: saving,
402
+ className: "space-y-5 disabled:opacity-60",
403
+ children: [/* @__PURE__ */ jsxs("label", {
404
+ className: "block space-y-2 text-sm",
405
+ children: ["Name", /* @__PURE__ */ jsx("input", {
406
+ autoFocus: true,
407
+ required: true,
408
+ maxLength: 80,
409
+ value: draft.name,
410
+ onChange: (event) => setDraft((current) => ({
411
+ ...current,
412
+ name: event.target.value
413
+ })),
414
+ className: configInput
415
+ })]
416
+ }), /* @__PURE__ */ jsxs("label", {
417
+ className: "block space-y-2 text-sm",
418
+ children: [
419
+ "Description",
420
+ /* @__PURE__ */ jsx("input", {
421
+ "aria-describedby": descriptionHintId,
422
+ maxLength: 500,
423
+ value: draft.description,
424
+ onChange: (event) => setDraft((current) => ({
425
+ ...current,
426
+ description: event.target.value
427
+ })),
428
+ className: configInput
429
+ }),
430
+ /* @__PURE__ */ jsx("span", {
431
+ id: descriptionHintId,
432
+ className: "block text-xs text-zinc-400",
433
+ children: "Human-readable description."
434
+ })
435
+ ]
436
+ })]
437
+ }),
438
+ saving && /* @__PURE__ */ jsx("p", {
439
+ role: "status",
440
+ className: "text-sm text-zinc-400",
441
+ children: "Saving…"
442
+ }),
443
+ error && /* @__PURE__ */ jsx("p", {
444
+ role: "alert",
445
+ className: "text-sm text-red-300",
446
+ children: error
447
+ })
448
+ ]
449
+ });
450
+ }
451
+ var toolGroups = [
452
+ {
453
+ name: "Hyperliquid",
454
+ tools: hyperliquidToolNames
455
+ },
456
+ {
457
+ name: "Research · Code Mode & Artifacts",
458
+ tools: researchToolNames
459
+ },
460
+ {
461
+ name: "Indicators — Read & Calculate",
462
+ tools: indicatorReadToolNames
463
+ },
464
+ {
465
+ name: "Indicators — Develop",
466
+ tools: indicatorDevelopToolNames
467
+ },
468
+ {
469
+ name: "Memories & Insights",
470
+ tools: memoryToolNames
471
+ },
472
+ {
473
+ name: "Chart workspace · Orchestrator only",
474
+ tools: chartToolNames
475
+ },
476
+ {
477
+ name: "HyperVibes · Notifications",
478
+ tools: ["send_notification"]
479
+ },
480
+ {
481
+ name: "HyperVibes · Subagents",
482
+ tools: [
483
+ "list_subagents",
484
+ "delegate_subagent",
485
+ "list_subagent_runs",
486
+ "get_subagent_run"
487
+ ]
488
+ }
489
+ ];
490
+ function ToolPicker({ tools, onChange, main = false }) {
491
+ const [open, setOpen] = useState(false);
492
+ return /* @__PURE__ */ jsxs("section", {
493
+ className: "space-y-2",
494
+ children: [
495
+ /* @__PURE__ */ jsxs("header", {
496
+ className: "flex items-center justify-between gap-4",
497
+ children: [/* @__PURE__ */ jsx("h3", {
498
+ className: "font-medium text-white",
499
+ children: "Tools"
500
+ }), /* @__PURE__ */ jsx("button", {
501
+ type: "button",
502
+ "aria-haspopup": "dialog",
503
+ onClick: () => setOpen(true),
504
+ className: configButton,
505
+ children: "Edit tools"
506
+ })]
507
+ }),
508
+ /* @__PURE__ */ jsx("p", {
509
+ className: "text-sm text-zinc-400",
510
+ children: tools.length ? `${tools.length} ${tools.length === 1 ? "tool" : "tools"} allowed` : "No tools allowed"
511
+ }),
512
+ toolGroups.map((group) => {
513
+ const enabled = group.tools.filter((name) => tools.includes(name));
514
+ if (!enabled.length) return null;
515
+ return /* @__PURE__ */ jsxs("p", {
516
+ className: "line-clamp-2 break-words text-sm text-zinc-200",
517
+ title: `${group.name}: ${enabled.join(", ")}`,
518
+ children: [
519
+ group.name,
520
+ ": ",
521
+ /* @__PURE__ */ jsx("span", {
522
+ className: "font-mono",
523
+ children: enabled.join(", ")
524
+ })
525
+ ]
526
+ }, group.name);
527
+ }),
528
+ open && /* @__PURE__ */ jsx(ToolDialog, {
529
+ tools,
530
+ main,
531
+ onCancel: () => setOpen(false),
532
+ onApply: async (next) => {
533
+ await onChange(next);
534
+ setOpen(false);
535
+ }
536
+ })
537
+ ]
538
+ });
539
+ }
540
+ function ToolDialog({ tools, onCancel, onApply, main }) {
541
+ const [draft, setDraft] = useState(tools);
542
+ const [search, setSearch] = useState("");
543
+ const [saving, setSaving] = useState(false);
544
+ const [error, setError] = useState("");
545
+ const inFlight = useRef(false);
546
+ async function apply() {
547
+ if (inFlight.current) return;
548
+ inFlight.current = true;
549
+ setSaving(true);
550
+ setError("");
551
+ try {
552
+ await onApply(draft);
553
+ } catch (cause) {
554
+ setError(cause instanceof Error ? cause.message : "Unable to save tools. Please retry.");
555
+ } finally {
556
+ inFlight.current = false;
557
+ setSaving(false);
558
+ }
559
+ }
560
+ const groups = toolGroups.filter((group) => main || group.tools !== chartToolNames).map((group) => ({
561
+ ...group,
562
+ visibleTools: group.tools.filter((name) => `${group.name} ${name}`.toLowerCase().includes(search.trim().toLowerCase()))
563
+ })).filter((group) => group.visibleTools.length);
564
+ return /* @__PURE__ */ jsxs(ConfigDialog, {
565
+ title: "Allowed tools",
566
+ onCancel: () => {
567
+ if (!inFlight.current) onCancel();
568
+ },
569
+ onApply: () => {
570
+ apply();
571
+ },
572
+ applyDisabled: saving,
573
+ children: [/* @__PURE__ */ jsxs("fieldset", {
574
+ disabled: saving,
575
+ className: "space-y-4 disabled:opacity-60",
576
+ children: [
577
+ /* @__PURE__ */ jsxs("label", {
578
+ className: "block space-y-2 text-sm",
579
+ children: ["Search extensions and tools", /* @__PURE__ */ jsx("input", {
580
+ autoFocus: true,
581
+ type: "search",
582
+ value: search,
583
+ onChange: (event) => setSearch(event.target.value),
584
+ className: configInput
585
+ })]
586
+ }),
587
+ /* @__PURE__ */ jsxs("div", {
588
+ className: "max-h-80 space-y-4 overflow-y-auto",
589
+ children: [groups.map((group) => /* @__PURE__ */ jsxs("fieldset", {
590
+ className: "space-y-3 rounded-xl border border-zinc-800 p-4",
591
+ children: [/* @__PURE__ */ jsx("legend", {
592
+ className: "px-2 text-sm font-medium text-white",
593
+ children: /* @__PURE__ */ jsxs("span", {
594
+ className: "inline-flex flex-wrap items-center gap-3",
595
+ children: [/* @__PURE__ */ jsx("span", { children: group.name }), /* @__PURE__ */ jsxs("span", {
596
+ className: "inline-flex items-center gap-2 text-xs font-normal",
597
+ children: [
598
+ /* @__PURE__ */ jsx("button", {
599
+ type: "button",
600
+ "aria-label": `All tools in ${group.name}`,
601
+ onClick: () => setDraft((current) => [.../* @__PURE__ */ new Set([...current, ...group.tools])]),
602
+ className: "cursor-pointer text-zinc-400 hover:text-violet-300 hover:underline",
603
+ children: "All"
604
+ }),
605
+ /* @__PURE__ */ jsx("span", {
606
+ "aria-hidden": "true",
607
+ className: "text-zinc-700",
608
+ children: "/"
609
+ }),
610
+ /* @__PURE__ */ jsx("button", {
611
+ type: "button",
612
+ "aria-label": `No tools in ${group.name}`,
613
+ onClick: () => setDraft((current) => current.filter((tool) => !group.tools.some((name) => name === tool))),
614
+ className: "cursor-pointer text-zinc-400 hover:text-violet-300 hover:underline",
615
+ children: "None"
616
+ })
617
+ ]
618
+ })]
619
+ })
620
+ }), /* @__PURE__ */ jsx("div", {
621
+ className: "grid gap-3 sm:grid-cols-2",
622
+ children: group.visibleTools.map((name) => /* @__PURE__ */ jsxs("label", {
623
+ className: "flex cursor-pointer items-center gap-3 font-mono text-xs",
624
+ children: [/* @__PURE__ */ jsx("input", {
625
+ type: "checkbox",
626
+ checked: draft.includes(name),
627
+ onChange: (event) => setDraft((current) => event.target.checked ? [...current, name] : current.filter((tool) => tool !== name)),
628
+ className: "cursor-pointer"
629
+ }), name]
630
+ }, name))
631
+ })]
632
+ }, group.name)), !groups.length && /* @__PURE__ */ jsx("p", {
633
+ className: "text-sm text-zinc-400",
634
+ children: "No matching tools."
635
+ })]
636
+ }),
637
+ /* @__PURE__ */ jsxs("p", {
638
+ className: "text-sm text-zinc-400",
639
+ children: [
640
+ draft.length,
641
+ " selected",
642
+ saving ? " · Saving…" : ""
643
+ ]
644
+ })
645
+ ]
646
+ }), error && /* @__PURE__ */ jsx("p", {
647
+ role: "alert",
648
+ className: "text-sm text-red-300",
649
+ children: error
650
+ })]
651
+ });
652
+ }
653
+ function AssignmentConfig({ value, onChange }) {
654
+ const [open, setOpen] = useState(false);
655
+ return /* @__PURE__ */ jsxs("section", {
656
+ className: "space-y-2",
657
+ children: [
658
+ /* @__PURE__ */ jsxs("header", {
659
+ className: "flex items-center justify-between gap-4",
660
+ children: [/* @__PURE__ */ jsx("h3", {
661
+ className: "font-medium text-white",
662
+ children: "Assignments & context"
663
+ }), /* @__PURE__ */ jsx("button", {
664
+ type: "button",
665
+ "aria-haspopup": "dialog",
666
+ onClick: () => setOpen(true),
667
+ className: configButton,
668
+ children: "Edit assignments"
669
+ })]
670
+ }),
671
+ /* @__PURE__ */ jsxs("p", {
672
+ className: "text-sm text-zinc-200",
673
+ children: ["Orchestrator delegation ", value.delegatable ? "allowed" : "disabled"]
674
+ }),
675
+ /* @__PURE__ */ jsxs("p", {
676
+ className: "text-sm text-zinc-200",
677
+ children: [
678
+ value.persistent ? "Persistent conversation" : "Fresh context per assignment",
679
+ " · Timeout: ",
680
+ value.timeoutSeconds,
681
+ "s"
682
+ ]
683
+ }),
684
+ open && /* @__PURE__ */ jsx(AssignmentDialog, {
685
+ value,
686
+ onCancel: () => setOpen(false),
687
+ onApply: async (next) => {
688
+ await onChange(next);
689
+ setOpen(false);
690
+ }
691
+ })
692
+ ]
693
+ });
694
+ }
695
+ function AssignmentDialog({ value, onCancel, onApply }) {
696
+ const [draft, setDraft] = useState({
697
+ delegatable: value.delegatable,
698
+ persistent: value.persistent,
699
+ timeoutSeconds: value.timeoutSeconds
700
+ });
701
+ const [saving, setSaving] = useState(false);
702
+ const [error, setError] = useState("");
703
+ const inFlight = useRef(false);
704
+ const valid = Number.isInteger(draft.timeoutSeconds) && draft.timeoutSeconds >= 30 && draft.timeoutSeconds <= 3600;
705
+ async function apply() {
706
+ if (inFlight.current || !valid) return;
707
+ inFlight.current = true;
708
+ setSaving(true);
709
+ setError("");
710
+ try {
711
+ await onApply(draft);
712
+ } catch (cause) {
713
+ setError(cause instanceof Error ? cause.message : "Unable to save assignment settings. Please retry.");
714
+ } finally {
715
+ inFlight.current = false;
716
+ setSaving(false);
717
+ }
718
+ }
719
+ const toggle = (key, label) => /* @__PURE__ */ jsxs("label", {
720
+ className: "flex cursor-pointer items-center gap-3 text-sm",
721
+ children: [/* @__PURE__ */ jsx("input", {
722
+ type: "checkbox",
723
+ checked: draft[key],
724
+ onChange: (event) => setDraft((current) => ({
725
+ ...current,
726
+ [key]: event.target.checked
727
+ })),
728
+ className: "cursor-pointer"
729
+ }), label]
730
+ });
731
+ return /* @__PURE__ */ jsxs(ConfigDialog, {
732
+ title: "Assignments & context",
733
+ onCancel: () => {
734
+ if (!inFlight.current) onCancel();
735
+ },
736
+ onApply: () => {
737
+ apply();
738
+ },
739
+ applyDisabled: saving || !valid,
740
+ children: [
741
+ /* @__PURE__ */ jsxs("fieldset", {
742
+ disabled: saving,
743
+ className: "space-y-4 disabled:opacity-60",
744
+ children: [
745
+ toggle("delegatable", "Allow orchestrator delegation"),
746
+ toggle("persistent", "Reuse a persistent conversation (otherwise fresh context per assignment)"),
747
+ /* @__PURE__ */ jsxs("label", {
748
+ className: "block space-y-2 text-sm",
749
+ children: ["Assignment timeout (seconds)", /* @__PURE__ */ jsx("input", {
750
+ required: true,
751
+ type: "number",
752
+ min: 30,
753
+ max: 3600,
754
+ step: 1,
755
+ value: draft.timeoutSeconds,
756
+ onChange: (event) => setDraft((current) => ({
757
+ ...current,
758
+ timeoutSeconds: Number(event.target.value)
759
+ })),
760
+ className: configInput
761
+ })]
762
+ })
763
+ ]
764
+ }),
765
+ saving && /* @__PURE__ */ jsx("p", {
766
+ role: "status",
767
+ className: "text-sm text-zinc-400",
768
+ children: "Saving…"
769
+ }),
770
+ error && /* @__PURE__ */ jsx("p", {
771
+ role: "alert",
772
+ className: "text-sm text-red-300",
773
+ children: error
774
+ })
775
+ ]
776
+ });
777
+ }
778
+ var completionLabels = {
779
+ save: "Save only",
780
+ notify: "Notify orchestrator without a model call",
781
+ wake: "Notify and wake orchestrator"
782
+ };
783
+ function NextScheduledRun({ timestamp }) {
784
+ const [, tick] = useState(0);
785
+ useEffect(() => {
786
+ const timer = setInterval(() => tick((value) => value + 1), 1e3);
787
+ return () => clearInterval(timer);
788
+ }, []);
789
+ const exact = new Date(timestamp).toISOString();
790
+ return /* @__PURE__ */ jsxs("p", {
791
+ className: "text-sm text-violet-300",
792
+ children: ["Next run ", /* @__PURE__ */ jsx("time", {
793
+ dateTime: exact,
794
+ title: exact,
795
+ suppressHydrationWarning: true,
796
+ children: timestamp > Date.now() ? format(timestamp) : "due now"
797
+ })]
798
+ });
799
+ }
800
+ function ScheduleConfig({ value, nextRunAt, onChange }) {
801
+ const [open, setOpen] = useState(false);
802
+ return /* @__PURE__ */ jsxs("section", {
803
+ className: "space-y-2",
804
+ children: [
805
+ /* @__PURE__ */ jsxs("header", {
806
+ className: "flex items-center justify-between gap-4",
807
+ children: [/* @__PURE__ */ jsx("h3", {
808
+ className: "font-medium text-white",
809
+ children: "Schedule"
810
+ }), /* @__PURE__ */ jsx("button", {
811
+ type: "button",
812
+ "aria-haspopup": "dialog",
813
+ onClick: () => setOpen(true),
814
+ className: configButton,
815
+ children: "Edit schedule"
816
+ })]
817
+ }),
818
+ /* @__PURE__ */ jsx("p", {
819
+ className: "text-sm text-zinc-400",
820
+ children: value.schedule ? `Every ${value.schedule} candle close (UTC) · ${value.delaySeconds}s delay` : "No schedule · manual, delegated or configured event assignments"
821
+ }),
822
+ value.schedule && nextRunAt != null && /* @__PURE__ */ jsx(NextScheduledRun, { timestamp: nextRunAt }),
823
+ /* @__PURE__ */ jsxs("p", {
824
+ className: "text-xs text-zinc-500",
825
+ children: ["Scheduled / manual / event completion: ", completionLabels[value.completion]]
826
+ }),
827
+ open && /* @__PURE__ */ jsx(ScheduleDialog, {
828
+ value,
829
+ onCancel: () => setOpen(false),
830
+ onApply: async (next) => {
831
+ await onChange(next);
832
+ setOpen(false);
833
+ }
834
+ })
835
+ ]
836
+ });
837
+ }
838
+ function ScheduleDialog({ value, onCancel, onApply }) {
839
+ const [draft, setDraft] = useState(() => value.schedule ? value : {
840
+ ...value,
841
+ delaySeconds: 1
842
+ });
843
+ const interval = candleIntervals[draft.schedule];
844
+ const [saving, setSaving] = useState(false);
845
+ const [error, setError] = useState("");
846
+ const inFlight = useRef(false);
847
+ const valid = !draft.schedule || Number.isInteger(draft.delaySeconds) && draft.delaySeconds >= 0 && draft.delaySeconds <= 300 && draft.delaySeconds < interval;
848
+ async function apply() {
849
+ if (inFlight.current || !valid) return;
850
+ inFlight.current = true;
851
+ setSaving(true);
852
+ setError("");
853
+ try {
854
+ await onApply({
855
+ schedule: draft.schedule,
856
+ delaySeconds: draft.delaySeconds,
857
+ completion: draft.completion
858
+ });
859
+ } catch (cause) {
860
+ setError(cause instanceof Error ? cause.message : "Unable to save schedule. Please retry.");
861
+ } finally {
862
+ inFlight.current = false;
863
+ setSaving(false);
864
+ }
865
+ }
866
+ return /* @__PURE__ */ jsxs(ConfigDialog, {
867
+ title: "Configure schedule",
868
+ onCancel: () => {
869
+ if (!inFlight.current) onCancel();
870
+ },
871
+ onApply: () => {
872
+ apply();
873
+ },
874
+ applyDisabled: saving || !valid,
875
+ children: [
876
+ /* @__PURE__ */ jsxs("fieldset", {
877
+ disabled: saving,
878
+ className: "space-y-5 disabled:opacity-60",
879
+ children: [
880
+ /* @__PURE__ */ jsx("p", {
881
+ className: "text-sm text-zinc-400",
882
+ children: "Run after a UTC candle closes."
883
+ }),
884
+ /* @__PURE__ */ jsxs("label", {
885
+ className: "block space-y-2 text-sm",
886
+ children: ["UTC candle close", /* @__PURE__ */ jsxs("select", {
887
+ value: draft.schedule,
888
+ onChange: (event) => setDraft((current) => ({
889
+ ...current,
890
+ schedule: event.target.value
891
+ })),
892
+ className: `${configInput} cursor-pointer`,
893
+ children: [/* @__PURE__ */ jsx("option", {
894
+ value: "",
895
+ children: "No schedule"
896
+ }), Object.keys(candleIntervals).map((interval) => /* @__PURE__ */ jsx("option", {
897
+ value: interval,
898
+ children: interval === "1d" ? "1d / every 24 hours" : interval
899
+ }, interval))]
900
+ })]
901
+ }),
902
+ draft.schedule && /* @__PURE__ */ jsxs("label", {
903
+ className: "block space-y-2 text-sm",
904
+ children: ["Delay after candle close (seconds)", /* @__PURE__ */ jsx("input", {
905
+ required: true,
906
+ type: "number",
907
+ min: 0,
908
+ max: Math.min(300, interval - 1),
909
+ step: 1,
910
+ value: draft.delaySeconds,
911
+ onChange: (event) => setDraft((current) => ({
912
+ ...current,
913
+ delaySeconds: Number(event.target.value)
914
+ })),
915
+ className: "block w-full rounded-xl border border-zinc-700 bg-zinc-950 p-3 text-sm text-white"
916
+ })]
917
+ }),
918
+ /* @__PURE__ */ jsxs("label", {
919
+ className: "block space-y-2 text-sm",
920
+ children: ["Scheduled / manual completion", /* @__PURE__ */ jsx("select", {
921
+ value: draft.completion,
922
+ onChange: (event) => setDraft((current) => ({
923
+ ...current,
924
+ completion: event.target.value
925
+ })),
926
+ className: `${configInput} cursor-pointer`,
927
+ children: Object.entries(completionLabels).map(([key, label]) => /* @__PURE__ */ jsx("option", {
928
+ value: key,
929
+ children: label
930
+ }, key))
931
+ })]
932
+ })
933
+ ]
934
+ }),
935
+ saving && /* @__PURE__ */ jsx("p", {
936
+ role: "status",
937
+ className: "text-sm text-zinc-400",
938
+ children: "Saving…"
939
+ }),
940
+ error && /* @__PURE__ */ jsx("p", {
941
+ role: "alert",
942
+ className: "text-sm text-red-300",
943
+ children: error
944
+ })
945
+ ]
946
+ });
947
+ }
948
+ //#endregion
949
+ //#region src/components/subagent-detail-page.tsx
950
+ var panel = "space-y-4 rounded-2xl border border-zinc-800 bg-[#0d0d10] p-6";
951
+ var inputClass = "mt-2 block w-full rounded-lg border border-zinc-700 bg-zinc-950 p-3 text-sm text-white";
952
+ var button = "cursor-pointer rounded-full bg-violet-600 px-4 py-2 text-sm text-white hover:bg-violet-500 disabled:cursor-not-allowed disabled:opacity-50";
953
+ function SubagentDetailPage({ agentId, subagentId, choices }) {
954
+ const router = useRouter();
955
+ const client = useQueryClient();
956
+ const mutations = subagentMutations(client, agentId);
957
+ const { data: initial, error: refreshError } = useSuspenseQuery(subagentQueryOptions(agentId, subagentId));
958
+ const definition = initial.definition;
959
+ const [form, setForm] = useState(initial.definition);
960
+ const [task, setTask] = useState("");
961
+ const mutation = useMutation({ mutationFn: (operation) => operation() });
962
+ const pending = mutation.isPending;
963
+ const error = mutation.error?.message ?? refreshError?.message;
964
+ const [archiveOpen, setArchiveOpen] = useState(false);
965
+ const [runOpen, setRunOpen] = useState(false);
966
+ const inFlight = useRef(false), assignmentId = useRef(null);
967
+ const main = definition.kind === "orchestrator";
968
+ const { history: { runs, pagination, schedulerError, schedule }, loading, connectionError, setPage } = useSubagentRuns(agentId, main ? void 0 : definition.id, initial);
969
+ const nextRunAt = schedule && schedule.updatedAt >= definition.updatedAt ? schedule.nextRunAt : definition.nextRunAt;
970
+ const selected = choices.find((choice) => modelKey(choice) === modelKey(form));
971
+ const set = (key, value) => setForm((current) => ({
972
+ ...current,
973
+ [key]: value
974
+ }));
975
+ const instructionsChanged = form.instructions !== definition.instructions;
976
+ async function operate(operation) {
977
+ if (inFlight.current) throw new Error("An operation is already in progress. Please retry.");
978
+ inFlight.current = true;
979
+ try {
980
+ await mutation.mutateAsync(operation);
981
+ } finally {
982
+ inFlight.current = false;
983
+ }
984
+ }
985
+ async function saveSection(section, settings) {
986
+ if (definition.archived) throw new Error("Settings cannot be changed right now. Please retry.");
987
+ await operate(async () => {
988
+ const row = await mutations.saveSection({
989
+ id: definition.id,
990
+ section,
991
+ settings
992
+ });
993
+ const saved = section === "enabled" ? { enabled: row.enabled } : section === "instructions" ? { instructions: row.instructions } : section === "model" ? {
994
+ provider: row.provider,
995
+ modelId: row.modelId,
996
+ thinkingLevel: row.thinkingLevel
997
+ } : section === "triggers" ? { triggers: row.triggers } : {
998
+ schedule: row.schedule,
999
+ delaySeconds: row.delaySeconds,
1000
+ completion: row.completion
1001
+ };
1002
+ setForm((current) => ({
1003
+ ...current,
1004
+ ...saved
1005
+ }));
1006
+ toast.success(section === "enabled" ? row.enabled ? "Sub-agent enabled" : "Sub-agent paused" : section === "instructions" ? "Instructions updated" : section === "model" ? "Model updated" : "Schedule updated");
1007
+ });
1008
+ }
1009
+ async function toggleEnabled() {
1010
+ try {
1011
+ await saveSection("enabled", { enabled: !form.enabled });
1012
+ } catch {}
1013
+ }
1014
+ async function saveInstructions() {
1015
+ try {
1016
+ await saveSection("instructions", { instructions: form.instructions });
1017
+ } catch {}
1018
+ }
1019
+ async function saveAssignments(settings) {
1020
+ if (definition.archived) throw new Error("Settings cannot be changed right now. Please retry.");
1021
+ await operate(async () => {
1022
+ const row = await saveSubagentAssignments({ data: {
1023
+ agentId,
1024
+ id: definition.id,
1025
+ settings
1026
+ } });
1027
+ const { delegatable, persistent, timeoutSeconds } = row;
1028
+ setForm((current) => ({
1029
+ ...current,
1030
+ delegatable,
1031
+ persistent,
1032
+ timeoutSeconds
1033
+ }));
1034
+ await cacheSubagent(client, agentId, row);
1035
+ toast.success("Assignment settings updated");
1036
+ });
1037
+ }
1038
+ async function saveIdentity(identity) {
1039
+ if (definition.archived) throw new Error("Settings cannot be changed right now. Please retry.");
1040
+ await operate(async () => {
1041
+ const row = await saveSubagentIdentity({ data: {
1042
+ agentId,
1043
+ id: definition.id,
1044
+ ...identity
1045
+ } });
1046
+ setForm((current) => ({
1047
+ ...current,
1048
+ name: row.name,
1049
+ description: row.description
1050
+ }));
1051
+ await cacheSubagent(client, agentId, row);
1052
+ toast.success("Name and description updated");
1053
+ });
1054
+ }
1055
+ async function saveTools(tools) {
1056
+ if (definition.archived) throw new Error("Settings cannot be changed right now. Please retry.");
1057
+ await operate(async () => {
1058
+ const row = await saveSubagentTools({ data: {
1059
+ agentId,
1060
+ id: definition.id,
1061
+ tools
1062
+ } });
1063
+ setForm((current) => ({
1064
+ ...current,
1065
+ tools: row.tools
1066
+ }));
1067
+ await cacheSubagent(client, agentId, row);
1068
+ toast.success("Tools updated");
1069
+ });
1070
+ }
1071
+ async function startRun() {
1072
+ if (definition.archived) throw new Error("This worker is unavailable for new assignments.");
1073
+ await operate(async () => {
1074
+ if (assignmentId.current?.task !== task) assignmentId.current = {
1075
+ task,
1076
+ id: randomUuid()
1077
+ };
1078
+ const run = await mutations.run({
1079
+ id: definition.id,
1080
+ task,
1081
+ requestId: assignmentId.current.id
1082
+ });
1083
+ assignmentId.current = null;
1084
+ setRunOpen(false);
1085
+ setTask("");
1086
+ toast.success("Assignment started");
1087
+ await router.navigate({
1088
+ to: "/agents/$agentId/sub-agents/$subagentId/runs/$runId",
1089
+ params: {
1090
+ agentId,
1091
+ subagentId: definition.id,
1092
+ runId: run.id
1093
+ }
1094
+ });
1095
+ });
1096
+ }
1097
+ async function perform(action, runId = "") {
1098
+ if (inFlight.current) return;
1099
+ try {
1100
+ await operate(async () => {
1101
+ if (action === "stop") {
1102
+ await mutations.stop(runId);
1103
+ toast.success("Assignment stopped", { description: "Existing exchange orders were not cancelled." });
1104
+ } else if (action === "unarchive") {
1105
+ const row = await unarchiveSubagent({ data: {
1106
+ agentId,
1107
+ id: definition.id
1108
+ } });
1109
+ setForm(row);
1110
+ await cacheSubagent(client, agentId, row);
1111
+ toast.success("Sub-agent unarchived", { description: "Restored paused. Enable it when ready." });
1112
+ } else {
1113
+ await archiveSubagent({ data: {
1114
+ agentId,
1115
+ id: definition.id
1116
+ } });
1117
+ await cacheSubagent(client, agentId, {
1118
+ ...definition,
1119
+ archived: true,
1120
+ enabled: false
1121
+ });
1122
+ toast.success("Sub-agent archived", { description: "History is preserved." });
1123
+ await router.navigate({
1124
+ to: "/agents/$agentId/sub-agents",
1125
+ params: { agentId }
1126
+ });
1127
+ }
1128
+ });
1129
+ } catch {}
1130
+ }
1131
+ return /* @__PURE__ */ jsxs("div", {
1132
+ className: "w-full space-y-3",
1133
+ children: [
1134
+ definition.archived && !main && /* @__PURE__ */ jsxs("section", {
1135
+ className: `${panel} flex flex-wrap items-center justify-between gap-3`,
1136
+ children: [/* @__PURE__ */ jsx("p", {
1137
+ className: "text-sm text-amber-200",
1138
+ children: "Archived — history is preserved. Unarchive to edit or run this sub-agent; it will remain paused."
1139
+ }), /* @__PURE__ */ jsx("button", {
1140
+ type: "button",
1141
+ disabled: pending,
1142
+ onClick: () => {
1143
+ perform("unarchive");
1144
+ },
1145
+ className: button,
1146
+ children: "Unarchive"
1147
+ })]
1148
+ }),
1149
+ /* @__PURE__ */ jsx("form", {
1150
+ onSubmit: (event) => {
1151
+ event.preventDefault();
1152
+ },
1153
+ className: panel,
1154
+ children: /* @__PURE__ */ jsxs("fieldset", {
1155
+ disabled: pending || definition.archived,
1156
+ className: "space-y-4 disabled:opacity-60",
1157
+ children: [
1158
+ /* @__PURE__ */ jsx(SubagentIdentity, {
1159
+ value: form,
1160
+ main,
1161
+ agentId,
1162
+ enabled: form.enabled,
1163
+ onToggleEnabled: () => {
1164
+ toggleEnabled();
1165
+ },
1166
+ onChange: saveIdentity,
1167
+ actions: !main ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("button", {
1168
+ type: "button",
1169
+ disabled: pending || definition.archived,
1170
+ "aria-haspopup": "dialog",
1171
+ onClick: () => setRunOpen(true),
1172
+ className: "inline-flex cursor-pointer items-center gap-2 rounded-full border border-violet-500 px-4 py-2 text-sm text-violet-300 hover:bg-violet-950 disabled:cursor-not-allowed disabled:opacity-50",
1173
+ children: [/* @__PURE__ */ jsx("svg", {
1174
+ "aria-hidden": "true",
1175
+ viewBox: "0 0 24 24",
1176
+ fill: "none",
1177
+ stroke: "currentColor",
1178
+ strokeWidth: 1.5,
1179
+ strokeLinecap: "round",
1180
+ strokeLinejoin: "round",
1181
+ className: "size-4",
1182
+ children: /* @__PURE__ */ jsx("path", { d: "m13 2-9 12h7l-1 8 10-12h-7z" })
1183
+ }), "Run now"]
1184
+ }), /* @__PURE__ */ jsx("button", {
1185
+ type: "button",
1186
+ disabled: pending || definition.archived,
1187
+ "aria-label": "Archive worker",
1188
+ title: "Archive worker",
1189
+ "aria-haspopup": "dialog",
1190
+ onClick: () => setArchiveOpen(true),
1191
+ className: "inline-flex cursor-pointer items-center justify-center rounded-full p-2 text-red-300 hover:bg-red-950 hover:text-red-200 disabled:cursor-not-allowed disabled:opacity-50",
1192
+ children: /* @__PURE__ */ jsx("svg", {
1193
+ "aria-hidden": "true",
1194
+ viewBox: "0 0 24 24",
1195
+ fill: "none",
1196
+ stroke: "currentColor",
1197
+ strokeWidth: 1.5,
1198
+ strokeLinecap: "round",
1199
+ strokeLinejoin: "round",
1200
+ className: "size-5",
1201
+ children: /* @__PURE__ */ jsx("path", { d: "M3 6h18M9 6V3h6v3M5 6l1 15h12l1-15M10 10v7m4-7v7" })
1202
+ })
1203
+ })] }) : void 0
1204
+ }),
1205
+ definition.archived && /* @__PURE__ */ jsx("p", {
1206
+ className: "text-sm text-amber-200",
1207
+ children: "Archived — new assignments are disabled. History remains available."
1208
+ }),
1209
+ !selected && /* @__PURE__ */ jsxs("p", {
1210
+ className: "flex items-center gap-1.5 text-sm text-amber-200",
1211
+ children: [/* @__PURE__ */ jsx(ProviderLogo, {
1212
+ provider: form.provider,
1213
+ className: "h-4 w-4 shrink-0 rounded-sm border border-zinc-800 bg-white p-0.5"
1214
+ }), /* @__PURE__ */ jsxs("span", { children: [
1215
+ "Current model: ",
1216
+ form.provider,
1217
+ "/",
1218
+ form.modelId,
1219
+ ". Reconnect its provider or select an available model."
1220
+ ] })]
1221
+ }),
1222
+ /* @__PURE__ */ jsx(ModelPicker, {
1223
+ choices,
1224
+ value: selected ? modelKey(form) : "",
1225
+ thinkingLevel: form.thinkingLevel,
1226
+ onChange: async (value, thinkingLevel) => {
1227
+ const choice = choices.find((entry) => modelKey(entry) === value);
1228
+ if (choice) await saveSection("model", {
1229
+ provider: choice.provider,
1230
+ modelId: choice.modelId,
1231
+ thinkingLevel
1232
+ });
1233
+ },
1234
+ disabled: pending
1235
+ }),
1236
+ /* @__PURE__ */ jsxs("div", {
1237
+ className: main ? "space-y-4" : "grid gap-6 md:grid-cols-2",
1238
+ children: [/* @__PURE__ */ jsxs("div", {
1239
+ className: "min-w-0 space-y-4",
1240
+ children: [/* @__PURE__ */ jsx(ToolPicker, {
1241
+ tools: form.tools,
1242
+ onChange: saveTools,
1243
+ main
1244
+ }), form.tools.includes("submit_orders") && !form.tools.includes("record_trade_decision") && /* @__PURE__ */ jsx("p", {
1245
+ role: "status",
1246
+ className: "text-sm text-amber-200",
1247
+ children: "Trading readiness: record_trade_decision is not selected. Existing permissions were not widened; select it explicitly for attributable trade rationale."
1248
+ })]
1249
+ }), !main && /* @__PURE__ */ jsxs("div", {
1250
+ className: "min-w-0 space-y-6",
1251
+ children: [
1252
+ /* @__PURE__ */ jsx(AssignmentConfig, {
1253
+ value: form,
1254
+ onChange: saveAssignments
1255
+ }),
1256
+ /* @__PURE__ */ jsx(WorkerTriggerConfig, {
1257
+ value: form.triggers,
1258
+ workers: (initial.workers ?? []).filter((worker) => worker.id !== definition.id),
1259
+ onChange: (triggers) => saveSection("triggers", { triggers })
1260
+ }),
1261
+ /* @__PURE__ */ jsx(ScheduleConfig, {
1262
+ value: form,
1263
+ nextRunAt: definition.enabled && !definition.archived ? nextRunAt : null,
1264
+ onChange: (schedule) => saveSection("schedule", schedule)
1265
+ })
1266
+ ]
1267
+ })]
1268
+ }),
1269
+ /* @__PURE__ */ jsxs("label", {
1270
+ className: "block text-sm text-zinc-300",
1271
+ children: ["Instructions", /* @__PURE__ */ jsx("textarea", {
1272
+ required: true,
1273
+ rows: 7,
1274
+ maxLength: 32e3,
1275
+ value: form.instructions,
1276
+ onChange: (event) => set("instructions", event.target.value),
1277
+ className: inputClass,
1278
+ placeholder: main ? defaultMainInstructions : void 0
1279
+ })]
1280
+ }),
1281
+ instructionsChanged && /* @__PURE__ */ jsxs("div", {
1282
+ className: "flex justify-end gap-2",
1283
+ children: [/* @__PURE__ */ jsx("button", {
1284
+ type: "button",
1285
+ onClick: () => {
1286
+ set("instructions", definition.instructions);
1287
+ mutation.reset();
1288
+ },
1289
+ className: "cursor-pointer rounded-full border border-zinc-700 px-4 py-2 text-sm text-zinc-300 hover:bg-zinc-800",
1290
+ children: "Reset"
1291
+ }), /* @__PURE__ */ jsx("button", {
1292
+ type: "button",
1293
+ disabled: !form.instructions.trim(),
1294
+ onClick: () => {
1295
+ saveInstructions();
1296
+ },
1297
+ className: button,
1298
+ children: "Save instructions"
1299
+ })]
1300
+ })
1301
+ ]
1302
+ })
1303
+ }),
1304
+ runOpen && !main && /* @__PURE__ */ jsx(RunSubagentDialog, {
1305
+ task,
1306
+ onTaskChange: setTask,
1307
+ onCancel: () => setRunOpen(false),
1308
+ onRun: startRun
1309
+ }),
1310
+ !main && /* @__PURE__ */ jsxs("section", {
1311
+ className: panel,
1312
+ children: [
1313
+ /* @__PURE__ */ jsx("header", {
1314
+ className: "flex items-center justify-between",
1315
+ children: /* @__PURE__ */ jsx("h3", {
1316
+ className: "font-medium text-white",
1317
+ children: "Run history"
1318
+ })
1319
+ }),
1320
+ schedulerError && /* @__PURE__ */ jsx("p", {
1321
+ role: "alert",
1322
+ className: "text-sm text-red-300",
1323
+ children: schedulerError
1324
+ }),
1325
+ connectionError && /* @__PURE__ */ jsx("p", {
1326
+ role: "status",
1327
+ className: "text-sm text-amber-200",
1328
+ children: connectionError
1329
+ }),
1330
+ /* @__PURE__ */ jsx(SubagentRunHistory, {
1331
+ agentId,
1332
+ runs,
1333
+ pending,
1334
+ onStop: (id) => {
1335
+ perform("stop", id);
1336
+ },
1337
+ pagination,
1338
+ loading,
1339
+ onPage: setPage
1340
+ })
1341
+ ]
1342
+ }),
1343
+ archiveOpen && !main && /* @__PURE__ */ jsx(ArchiveSubagentDialog, {
1344
+ name: definition.name,
1345
+ onCancel: () => setArchiveOpen(false),
1346
+ onConfirm: () => {
1347
+ setArchiveOpen(false);
1348
+ perform("archive");
1349
+ }
1350
+ }),
1351
+ error && /* @__PURE__ */ jsx("p", {
1352
+ role: "alert",
1353
+ className: "text-sm text-red-300",
1354
+ children: error
1355
+ })
1356
+ ]
1357
+ });
1358
+ }
1359
+ //#endregion
1360
+ //#region src/routes/_authenticated.agents.$agentId.sub-agents.$subagentId.tsx?tsr-split=component
1361
+ function Page() {
1362
+ const { agentId, subagentId } = Route.useParams();
1363
+ const { data: choices } = useSuspenseQuery(modelChoicesQueryOptions());
1364
+ return /* @__PURE__ */ jsx(SubagentDetailPage, {
1365
+ agentId,
1366
+ subagentId,
1367
+ choices
1368
+ }, `${agentId}:${subagentId}`);
1369
+ }
1370
+ //#endregion
1371
+ export { Page as component };