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,1044 @@
1
+ import { a as closeAgentPosition, b as sendAgentMessage, i as cancelAgentOrder } from "./agents-CZq-0mna.js";
2
+ import { i as agentQueryOptions, n as agentDashboardQueryOptions } from "./agent-queries-Cmx8RiUx.js";
3
+ import { n as dashboardSubagentsQueryOptions } from "./subagent-queries-sAwBjFxC.js";
4
+ import { t as riskQueryOptions } from "./risk-queries-JQpByHT2.js";
5
+ import { t as Route } from "./_authenticated.agents._agentId.index-DJgrupvW.js";
6
+ import { f as randomUuid } from "./contracts-CG-nZuYJ.js";
7
+ import { i as formatMoneyText, n as compareDecimals, r as formatAmountText, t as addDecimals } from "./decimal-BthtZ77w.js";
8
+ import { t as subagentMutations } from "./subagent-mutations-dUo3B_SG.js";
9
+ import { i as useAgentEventsStatus, r as useAgentEvent } from "./agent-events-DK9Yz5__.js";
10
+ import { t as InstrumentLabel } from "./instrument-label-C-tTGGsD.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 { i as runUrl, n as RunStatus, t as RelativeTime } from "./subagent-run-history-C_xmucO-.js";
14
+ import { t as amount } from "./journal-decimal-Bh9EL029.js";
15
+ import { t as ToggleTimestamp } from "./toggle-timestamp-CToUVn67.js";
16
+ import { useEffect, useRef, useState } from "react";
17
+ import { useRouter } from "@tanstack/react-router";
18
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
19
+ import { useMutation, useQuery, useQueryClient, useSuspenseQuery } from "@tanstack/react-query";
20
+ import { toast } from "sonner";
21
+ import { format } from "timeago.js";
22
+ //#region src/hyperliquid/dashboard-equity.ts
23
+ /**
24
+ * Equity for the dashboard's USDC/main-DEX scope, not non-USDC portfolio assets.
25
+ * https://hyperliquid.gitbook.io/hyperliquid-docs/trading/account-abstraction-modes
26
+ */
27
+ function dashboardTotalEquity(snapshot) {
28
+ const live = snapshot.live;
29
+ if (live && (live.status !== "connected" || !live.sections.mode.fresh || !live.sections.spot.fresh)) return null;
30
+ switch (snapshot.accountAbstraction) {
31
+ case "unifiedAccount": return snapshot.spotUsdc;
32
+ case "disabled":
33
+ case "default":
34
+ if (live && !live.sections.perps.fresh) return null;
35
+ return snapshot.perpEquity === null || snapshot.spotUsdc === null ? null : addDecimals(snapshot.perpEquity, snapshot.spotUsdc);
36
+ default: return null;
37
+ }
38
+ }
39
+ //#endregion
40
+ //#region src/components/dashboard-subagents.tsx
41
+ function DashboardSubagents({ agentId, subagents, agentEnabled, error }) {
42
+ const [runTarget, setRunTarget] = useState(null);
43
+ const workers = subagents;
44
+ const loadError = error;
45
+ const [refreshError, setRefreshError] = useState("");
46
+ useEffect(() => {
47
+ if (!agentEnabled) setRunTarget(null);
48
+ }, [agentEnabled]);
49
+ const { interrupted, controlMessage, streamErrors } = useAgentEventsStatus();
50
+ useEffect(() => {
51
+ const topicError = streamErrors["subagents"];
52
+ if (topicError) setRefreshError(topicError);
53
+ else if (interrupted) setRefreshError(controlMessage || "Live sub-agent updates interrupted. Reconnecting… Activity may be out of date.");
54
+ else setRefreshError("");
55
+ }, [
56
+ interrupted,
57
+ controlMessage,
58
+ streamErrors
59
+ ]);
60
+ const base = `/agents/${encodeURIComponent(agentId)}/sub-agents`;
61
+ return /* @__PURE__ */ jsxs("section", {
62
+ "aria-label": "Sub-agents",
63
+ className: "flex min-h-0 flex-1 flex-col rounded-2xl border border-zinc-800 bg-[#0d0d10] p-4",
64
+ children: [
65
+ /* @__PURE__ */ jsx("header", {
66
+ className: "mb-3 shrink-0",
67
+ children: /* @__PURE__ */ jsx("h3", {
68
+ className: "text-lg font-medium text-white",
69
+ children: "Sub-agents"
70
+ })
71
+ }),
72
+ loadError ? /* @__PURE__ */ jsxs("p", {
73
+ role: "alert",
74
+ className: "text-sm text-amber-200",
75
+ children: ["Sub-agents unavailable: ", loadError]
76
+ }) : !workers.length ? /* @__PURE__ */ jsxs("p", {
77
+ className: "text-sm text-zinc-500",
78
+ children: [
79
+ "No sub-agents yet. ",
80
+ /* @__PURE__ */ jsx("a", {
81
+ href: `${base}/new`,
82
+ className: "cursor-pointer text-violet-400 hover:text-violet-300 hover:underline",
83
+ children: "Create a new sub-agent"
84
+ }),
85
+ " to get started."
86
+ ]
87
+ }) : /* @__PURE__ */ jsx("ul", {
88
+ className: "min-h-0 overflow-y-auto overscroll-contain space-y-2",
89
+ children: workers.map((subagent) => /* @__PURE__ */ jsxs("li", {
90
+ className: "overflow-hidden rounded-xl border border-zinc-800",
91
+ children: [/* @__PURE__ */ jsxs("div", {
92
+ className: "flex flex-wrap items-center gap-2 bg-zinc-900/50 px-3 py-2",
93
+ children: [/* @__PURE__ */ jsx("h4", {
94
+ className: "min-w-0",
95
+ children: /* @__PURE__ */ jsx("a", {
96
+ href: `${base}/${encodeURIComponent(subagent.id)}`,
97
+ className: "cursor-pointer font-medium text-zinc-100 hover:text-violet-300",
98
+ children: subagent.name
99
+ })
100
+ }), /* @__PURE__ */ jsx(DashboardWorkerControls, {
101
+ agentId,
102
+ agentEnabled,
103
+ definition: subagent,
104
+ onRun: () => setRunTarget(subagent.id)
105
+ })]
106
+ }), !subagent.runs.length ? /* @__PURE__ */ jsx("p", {
107
+ className: "px-3 py-2 text-sm text-zinc-500",
108
+ children: "No runs yet."
109
+ }) : /* @__PURE__ */ jsx("ul", {
110
+ className: "divide-y divide-zinc-800/60",
111
+ children: subagent.runs.slice(0, subagent.runs[0]?.status === "running" || subagent.runs[0]?.status === "queued" ? 2 : 1).map((run) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs("a", {
112
+ href: runUrl(agentId, subagent.id, run.id),
113
+ className: "flex cursor-pointer items-center gap-3 px-3 py-2 text-sm hover:bg-zinc-900 focus-visible:outline-violet-400",
114
+ children: [
115
+ /* @__PURE__ */ jsx(RunStatus, { status: run.status }),
116
+ /* @__PURE__ */ jsx("span", {
117
+ className: "min-w-0 flex-1 truncate text-zinc-300",
118
+ children: run.result || (run.status === "running" ? "Running…" : run.status === "queued" ? "Waiting to run…" : "No result message.")
119
+ }),
120
+ /* @__PURE__ */ jsx("span", {
121
+ className: "shrink-0 text-xs text-zinc-500",
122
+ children: /* @__PURE__ */ jsx(RelativeTime, { timestamp: run.createdAt })
123
+ })
124
+ ]
125
+ }) }, run.id))
126
+ })]
127
+ }, subagent.id))
128
+ }),
129
+ refreshError && /* @__PURE__ */ jsx("p", {
130
+ role: "alert",
131
+ className: "mt-3 shrink-0 text-sm text-amber-200",
132
+ children: refreshError
133
+ }),
134
+ agentEnabled && runTarget && /* @__PURE__ */ jsx(DashboardRunDialog, {
135
+ agentId,
136
+ subagentId: runTarget,
137
+ onClose: () => setRunTarget(null)
138
+ }, `${agentId}:${runTarget}`)
139
+ ]
140
+ });
141
+ }
142
+ function NextRun({ timestamp }) {
143
+ const [, tick] = useState(0);
144
+ useEffect(() => {
145
+ const timer = setInterval(() => tick((value) => value + 1), 1e3);
146
+ return () => clearInterval(timer);
147
+ }, []);
148
+ const exact = new Date(timestamp).toISOString();
149
+ return /* @__PURE__ */ jsxs("span", {
150
+ className: "text-xs text-zinc-400",
151
+ children: ["Next run: ", /* @__PURE__ */ jsx("time", {
152
+ dateTime: exact,
153
+ title: exact,
154
+ suppressHydrationWarning: true,
155
+ children: timestamp > Date.now() ? format(timestamp) : "due now"
156
+ })]
157
+ });
158
+ }
159
+ function DashboardWorkerControls({ agentId, definition, agentEnabled, onRun }) {
160
+ const [settings, setSettings] = useState(definition);
161
+ const mutation = useMutation({
162
+ mutationFn: subagentMutations(useQueryClient(), agentId).saveSection,
163
+ onSuccess: (row) => {
164
+ setSettings((current) => ({
165
+ ...current,
166
+ enabled: row.enabled,
167
+ schedule: row.schedule,
168
+ nextRunAt: row.nextRunAt
169
+ }));
170
+ toast.success(row.enabled ? "Sub-agent enabled" : "Sub-agent paused");
171
+ }
172
+ });
173
+ const pending = mutation.isPending, error = mutation.error?.message;
174
+ useEffect(() => {
175
+ setSettings(definition);
176
+ }, [definition]);
177
+ return /* @__PURE__ */ jsxs("div", {
178
+ className: "flex flex-1 flex-wrap items-center gap-2",
179
+ children: [agentEnabled && settings.enabled && settings.schedule && settings.nextRunAt !== null && /* @__PURE__ */ jsx(NextRun, { timestamp: settings.nextRunAt }), /* @__PURE__ */ jsxs("div", {
180
+ className: "ml-auto flex items-center gap-2",
181
+ children: [
182
+ /* @__PURE__ */ jsx("button", {
183
+ type: "button",
184
+ "aria-label": `Run now: ${definition.name}`,
185
+ title: agentEnabled ? "Run now" : "Enable the agent to run workers",
186
+ disabled: !agentEnabled,
187
+ "aria-haspopup": "dialog",
188
+ onClick: onRun,
189
+ className: "inline-flex shrink-0 cursor-pointer items-center justify-center rounded-full p-1.5 text-violet-300 hover:bg-violet-950 disabled:cursor-not-allowed disabled:opacity-50",
190
+ children: /* @__PURE__ */ jsx("svg", {
191
+ "aria-hidden": "true",
192
+ viewBox: "0 0 24 24",
193
+ fill: "none",
194
+ stroke: "currentColor",
195
+ strokeWidth: 1.5,
196
+ strokeLinecap: "round",
197
+ strokeLinejoin: "round",
198
+ className: "size-4",
199
+ children: /* @__PURE__ */ jsx("path", { d: "m13 2-9 12h7l-1 8 10-12h-7z" })
200
+ })
201
+ }),
202
+ agentEnabled ? /* @__PURE__ */ jsx(SubagentEnabledToggle, {
203
+ enabled: settings.enabled,
204
+ disabled: pending,
205
+ onClick: () => mutation.mutate({
206
+ id: definition.id,
207
+ section: "enabled",
208
+ settings: { enabled: !settings.enabled }
209
+ })
210
+ }) : /* @__PURE__ */ jsx("span", {
211
+ role: "status",
212
+ className: "text-xs text-amber-300",
213
+ children: "Agent disabled"
214
+ }),
215
+ error && /* @__PURE__ */ jsx("p", {
216
+ role: "alert",
217
+ className: "text-xs text-red-300",
218
+ children: error
219
+ })
220
+ ]
221
+ })]
222
+ });
223
+ }
224
+ function DashboardRunDialog({ agentId, subagentId, onClose }) {
225
+ const router = useRouter();
226
+ const [task, setTask] = useState("");
227
+ const assignmentId = useRef(null);
228
+ const client = useQueryClient();
229
+ const mutation = useMutation({
230
+ mutationFn: async () => {
231
+ if (assignmentId.current?.task !== task) assignmentId.current = {
232
+ task,
233
+ id: randomUuid()
234
+ };
235
+ try {
236
+ return await subagentMutations(client, agentId).run({
237
+ id: subagentId,
238
+ task,
239
+ requestId: assignmentId.current.id
240
+ });
241
+ } catch (cause) {
242
+ throw new Error(`${cause instanceof Error ? cause.message : "Unable to confirm the assignment."} Retry with the same task to reuse its request ID.`, { cause });
243
+ }
244
+ },
245
+ onSuccess: async (run) => {
246
+ toast.success("Assignment started");
247
+ await router.navigate({
248
+ to: "/agents/$agentId/sub-agents/$subagentId/runs/$runId",
249
+ params: {
250
+ agentId,
251
+ subagentId,
252
+ runId: run.id
253
+ }
254
+ });
255
+ onClose();
256
+ }
257
+ });
258
+ async function startRun() {
259
+ await mutation.mutateAsync();
260
+ }
261
+ return /* @__PURE__ */ jsx(RunSubagentDialog, {
262
+ task,
263
+ onTaskChange: setTask,
264
+ onCancel: onClose,
265
+ onRun: startRun
266
+ });
267
+ }
268
+ //#endregion
269
+ //#region src/components/balance-sparkline.tsx
270
+ function BalanceSparkline({ label, points }) {
271
+ const values = points?.map((point) => amount(point.balance)) ?? [];
272
+ const first = values[0];
273
+ const last = values.at(-1);
274
+ const change = first && last ? last.sub(first) : null;
275
+ let polyline = "";
276
+ if (points && values.length > 1) {
277
+ let min = values[0];
278
+ let max = min;
279
+ for (const value of values) {
280
+ if (value.cmp(min) < 0) min = value;
281
+ if (value.cmp(max) > 0) max = value;
282
+ }
283
+ const span = max.sub(min);
284
+ const start = points[0].time;
285
+ const duration = points.at(-1).time - start;
286
+ polyline = values.map((value, index) => {
287
+ const x = duration ? (points[index].time - start) / duration * 240 : 120;
288
+ const y = span.zero ? 24 : 44 - Number(value.sub(min).div(span).toString()) * 40;
289
+ return `${x.toFixed(2)},${y.toFixed(2)}`;
290
+ }).join(" ");
291
+ }
292
+ const color = change && change.sign !== 0 ? change.sign < 0 ? "text-red-400" : "text-emerald-400" : "text-zinc-400";
293
+ return /* @__PURE__ */ jsxs("div", {
294
+ className: "min-w-0 p-1",
295
+ children: [/* @__PURE__ */ jsxs("dt", {
296
+ className: "text-xs uppercase tracking-[0.16em] text-zinc-500",
297
+ children: [label, " balance"]
298
+ }), /* @__PURE__ */ jsx("dd", {
299
+ className: "mt-2",
300
+ title: "Realized USDC balance, including transfers, fees and funding. Excludes unrealized P&L.",
301
+ children: polyline ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("span", {
302
+ className: `font-mono text-sm tabular-nums ${color}`,
303
+ children: [
304
+ change.sign > 0 ? "+" : "",
305
+ formatMoneyText(change.toString()),
306
+ " USDC"
307
+ ]
308
+ }), /* @__PURE__ */ jsxs("svg", {
309
+ role: "img",
310
+ "aria-label": `${label} realized account balance`,
311
+ viewBox: "0 0 240 48",
312
+ className: `mt-2 h-12 w-full ${color}`,
313
+ preserveAspectRatio: "none",
314
+ children: [/* @__PURE__ */ jsx("title", { children: `${label} realized account balance (USDC)` }), /* @__PURE__ */ jsx("polyline", {
315
+ points: polyline,
316
+ fill: "none",
317
+ stroke: "currentColor",
318
+ strokeWidth: "2",
319
+ vectorEffect: "non-scaling-stroke"
320
+ })]
321
+ })] }) : /* @__PURE__ */ jsx("span", {
322
+ className: "text-sm text-zinc-500",
323
+ children: "Balance history unavailable"
324
+ })
325
+ })]
326
+ });
327
+ }
328
+ //#endregion
329
+ //#region src/components/close-position-button.tsx
330
+ function ClosePositionButton({ agentId, symbol }) {
331
+ const request = useRef(null);
332
+ const inFlight = useRef(false);
333
+ const trigger = useRef(null);
334
+ const [confirmation, setConfirmation] = useState(null);
335
+ const armed = confirmation !== null && confirmation.agentId === agentId && confirmation.symbol === symbol;
336
+ useEffect(() => {
337
+ if (!confirmation) return;
338
+ if (!armed) {
339
+ setConfirmation(null);
340
+ return;
341
+ }
342
+ const timeout = window.setTimeout(() => setConfirmation(null), 8e3);
343
+ const escape = (event) => {
344
+ if (event.key === "Escape") {
345
+ event.preventDefault();
346
+ setConfirmation(null);
347
+ trigger.current?.focus();
348
+ }
349
+ };
350
+ document.addEventListener("keydown", escape);
351
+ return () => {
352
+ window.clearTimeout(timeout);
353
+ document.removeEventListener("keydown", escape);
354
+ };
355
+ }, [confirmation, armed]);
356
+ const client = useQueryClient();
357
+ const mutation = useMutation({
358
+ mutationFn: async () => {
359
+ request.current ??= randomUuid();
360
+ return closeAgentPosition({ data: {
361
+ id: agentId,
362
+ symbol,
363
+ requestId: request.current
364
+ } });
365
+ },
366
+ onSettled: async () => {
367
+ await client.invalidateQueries({ queryKey: ["agent-dashboard", agentId] });
368
+ }
369
+ });
370
+ async function close() {
371
+ if (inFlight.current) return;
372
+ if (!armed) {
373
+ setConfirmation({
374
+ agentId,
375
+ symbol
376
+ });
377
+ return;
378
+ }
379
+ setConfirmation(null);
380
+ inFlight.current = true;
381
+ try {
382
+ const result = await mutation.mutateAsync();
383
+ if (!result.cancel.uncertain && !result.close.uncertain && result.remainingSize !== null) request.current = null;
384
+ } catch {} finally {
385
+ inFlight.current = false;
386
+ }
387
+ }
388
+ const result = mutation.data;
389
+ const label = mutation.isPending ? `Closing ${symbol}…` : armed ? `Confirm close ${symbol} at market` : request.current ? `Check / retry ${symbol} close` : `Close ${symbol} at market`;
390
+ return /* @__PURE__ */ jsxs("div", {
391
+ className: "w-36 whitespace-normal",
392
+ children: [
393
+ /* @__PURE__ */ jsx("div", {
394
+ role: "group",
395
+ "aria-label": `Close ${symbol} position`,
396
+ className: "inline-flex h-9 w-36",
397
+ children: /* @__PURE__ */ jsxs("button", {
398
+ ref: trigger,
399
+ type: "button",
400
+ title: label,
401
+ "aria-label": label,
402
+ "aria-busy": mutation.isPending,
403
+ disabled: mutation.isPending,
404
+ onClick: () => {
405
+ close();
406
+ },
407
+ className: `inline-flex h-full cursor-pointer items-center justify-start gap-2 overflow-hidden rounded-full border bg-transparent pl-1.5 text-xs text-red-300 transition-[width,border-color] duration-150 hover:text-red-200 disabled:cursor-wait disabled:opacity-50 ${armed ? "w-36 border-red-900/60 hover:border-red-500" : "w-9 border-transparent"}`,
408
+ children: [/* @__PURE__ */ jsx("svg", {
409
+ xmlns: "http://www.w3.org/2000/svg",
410
+ "aria-hidden": "true",
411
+ fill: "none",
412
+ viewBox: "0 0 24 24",
413
+ strokeWidth: "1.5",
414
+ stroke: "currentColor",
415
+ className: "size-6 shrink-0",
416
+ children: /* @__PURE__ */ jsx("path", {
417
+ strokeLinecap: "round",
418
+ strokeLinejoin: "round",
419
+ d: "m9.75 9.75 4.5 4.5m0-4.5-4.5 4.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"
420
+ })
421
+ }), armed && /* @__PURE__ */ jsx("span", {
422
+ className: "shrink-0 whitespace-nowrap",
423
+ children: "Confirm close"
424
+ })]
425
+ })
426
+ }),
427
+ mutation.error && /* @__PURE__ */ jsxs("p", {
428
+ role: "alert",
429
+ className: "mt-2 text-xs text-red-300",
430
+ children: [mutation.error.message, " Retry uses the same request ID."]
431
+ }),
432
+ result && /* @__PURE__ */ jsxs("div", {
433
+ role: "status",
434
+ className: `mt-2 text-xs ${result.complete ? "text-emerald-300" : "text-amber-200"}`,
435
+ children: [
436
+ /* @__PURE__ */ jsx("p", { children: result.complete ? "Position closed; no market orders remain." : `Close incomplete or unconfirmed. Remaining size: ${result.remainingSize ?? "unknown"}; orders: ${result.remainingOrders ?? "unknown"}.` }),
437
+ !result.complete && /* @__PURE__ */ jsxs("p", {
438
+ className: "break-all",
439
+ children: ["Close request: ", result.close.requestId]
440
+ }),
441
+ [...result.cancel.results, ...result.close.results].filter((order) => order.error).map((order) => /* @__PURE__ */ jsx("p", { children: order.error }, order.id)),
442
+ result.warnings.map((warning) => /* @__PURE__ */ jsx("p", { children: warning }, warning))
443
+ ]
444
+ })
445
+ ]
446
+ });
447
+ }
448
+ //#endregion
449
+ //#region src/components/cancel-order-button.tsx
450
+ function CancelOrderButton({ agentId, symbol, oid }) {
451
+ const request = useRef(null);
452
+ const inFlight = useRef(false);
453
+ const trigger = useRef(null);
454
+ const [armed, setArmed] = useState(false);
455
+ useEffect(() => {
456
+ if (!armed) return;
457
+ const timeout = window.setTimeout(() => setArmed(false), 8e3);
458
+ const escape = (event) => {
459
+ if (event.key === "Escape") {
460
+ event.preventDefault();
461
+ setArmed(false);
462
+ trigger.current?.focus();
463
+ }
464
+ };
465
+ document.addEventListener("keydown", escape);
466
+ return () => {
467
+ window.clearTimeout(timeout);
468
+ document.removeEventListener("keydown", escape);
469
+ };
470
+ }, [armed]);
471
+ const client = useQueryClient();
472
+ const mutation = useMutation({
473
+ mutationFn: async () => {
474
+ request.current ??= randomUuid();
475
+ return cancelAgentOrder({ data: {
476
+ id: agentId,
477
+ symbol,
478
+ oid,
479
+ requestId: request.current
480
+ } });
481
+ },
482
+ onSettled: async () => {
483
+ await client.invalidateQueries({ queryKey: ["agent-dashboard", agentId] });
484
+ }
485
+ });
486
+ async function cancel() {
487
+ if (inFlight.current) return;
488
+ if (!armed) {
489
+ setArmed(true);
490
+ return;
491
+ }
492
+ setArmed(false);
493
+ inFlight.current = true;
494
+ try {
495
+ await mutation.mutateAsync();
496
+ } catch {} finally {
497
+ inFlight.current = false;
498
+ }
499
+ }
500
+ const result = mutation.data;
501
+ const complete = result && !result.uncertain && result.results.length > 0 && result.results.every((order) => order.orderStatus === "canceled");
502
+ const label = mutation.isPending ? `Canceling ${symbol} order ${oid}…` : armed ? `Confirm cancel ${symbol} order ${oid}` : request.current ? `Check / retry ${symbol} order ${oid} cancellation` : `Cancel ${symbol} order ${oid}`;
503
+ return /* @__PURE__ */ jsxs("div", {
504
+ className: "w-36 whitespace-normal",
505
+ children: [
506
+ /* @__PURE__ */ jsx("div", {
507
+ role: "group",
508
+ "aria-label": `Cancel ${symbol} order ${oid}`,
509
+ className: "inline-flex h-9 w-36",
510
+ children: /* @__PURE__ */ jsxs("button", {
511
+ ref: trigger,
512
+ type: "button",
513
+ title: label,
514
+ "aria-label": label,
515
+ "aria-busy": mutation.isPending,
516
+ disabled: mutation.isPending || Boolean(complete),
517
+ onClick: () => {
518
+ cancel();
519
+ },
520
+ className: `inline-flex h-full cursor-pointer items-center justify-start gap-2 overflow-hidden rounded-full border bg-transparent pl-1.5 text-xs text-red-300 transition-[width,border-color] duration-150 hover:text-red-200 disabled:cursor-not-allowed disabled:opacity-50 ${armed ? "w-36 border-red-900/60 hover:border-red-500" : "w-9 border-transparent"}`,
521
+ children: [/* @__PURE__ */ jsx("svg", {
522
+ xmlns: "http://www.w3.org/2000/svg",
523
+ "aria-hidden": "true",
524
+ fill: "none",
525
+ viewBox: "0 0 24 24",
526
+ strokeWidth: "1.5",
527
+ stroke: "currentColor",
528
+ className: "size-6 shrink-0",
529
+ children: /* @__PURE__ */ jsx("path", {
530
+ strokeLinecap: "round",
531
+ strokeLinejoin: "round",
532
+ d: "m9.75 9.75 4.5 4.5m0-4.5-4.5 4.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"
533
+ })
534
+ }), armed && /* @__PURE__ */ jsx("span", {
535
+ className: "shrink-0 whitespace-nowrap",
536
+ children: "Confirm cancel"
537
+ })]
538
+ })
539
+ }),
540
+ mutation.error && /* @__PURE__ */ jsxs("p", {
541
+ role: "alert",
542
+ className: "mt-2 text-xs text-red-300",
543
+ children: [mutation.error.message, " Retry uses the same request ID."]
544
+ }),
545
+ result && /* @__PURE__ */ jsxs("div", {
546
+ role: "status",
547
+ className: `mt-2 text-xs ${complete ? "text-emerald-300" : "text-amber-200"}`,
548
+ children: [
549
+ /* @__PURE__ */ jsx("p", { children: complete ? "Order canceled." : "Cancellation incomplete or unconfirmed. Check the order before issuing another request." }),
550
+ !complete && /* @__PURE__ */ jsxs("p", {
551
+ className: "break-all",
552
+ children: ["Cancel request: ", result.requestId]
553
+ }),
554
+ result.results.filter((order) => order.error).map((order) => /* @__PURE__ */ jsx("p", { children: order.error }, order.id)),
555
+ result.warnings.map((warning) => /* @__PURE__ */ jsx("p", { children: warning }, warning))
556
+ ]
557
+ })
558
+ ]
559
+ });
560
+ }
561
+ //#endregion
562
+ //#region src/components/dashboard-chat.tsx
563
+ function DashboardChat({ agentId, enabled = true }) {
564
+ const router = useRouter();
565
+ const [message, setMessage] = useState("");
566
+ const mutation = useMutation({
567
+ mutationFn: async () => {
568
+ if (request.current?.message !== message) request.current = {
569
+ message,
570
+ id: randomUuid()
571
+ };
572
+ return sendAgentMessage({ data: {
573
+ id: agentId,
574
+ message,
575
+ requestId: request.current.id
576
+ } });
577
+ },
578
+ onSuccess: async () => {
579
+ await router.navigate({
580
+ to: "/agents/$agentId/chat",
581
+ params: { agentId }
582
+ });
583
+ }
584
+ });
585
+ const pending = mutation.isPending;
586
+ const error = mutation.error ? `${mutation.error.message} Retry with the same message to avoid submitting it twice.` : "";
587
+ const inFlight = useRef(false);
588
+ const request = useRef(null);
589
+ async function send() {
590
+ if (!enabled || inFlight.current || !message.trim()) return;
591
+ inFlight.current = true;
592
+ try {
593
+ await mutation.mutateAsync();
594
+ } catch {} finally {
595
+ inFlight.current = false;
596
+ }
597
+ }
598
+ return /* @__PURE__ */ jsxs("section", {
599
+ "aria-label": "Chat",
600
+ className: "shrink-0 rounded-2xl border border-zinc-800 bg-[#0d0d10] p-6",
601
+ children: [
602
+ /* @__PURE__ */ jsx("h3", {
603
+ className: "mb-4 text-lg font-medium text-white",
604
+ children: "Chat"
605
+ }),
606
+ !enabled && /* @__PURE__ */ jsx("p", {
607
+ role: "status",
608
+ className: "mb-3 text-sm text-amber-200",
609
+ children: "Agent disabled. Enable it to chat or run workers. Exchange orders and positions remain unchanged."
610
+ }),
611
+ /* @__PURE__ */ jsxs("form", {
612
+ onSubmit: (event) => {
613
+ event.preventDefault();
614
+ send();
615
+ },
616
+ children: [/* @__PURE__ */ jsxs("div", {
617
+ className: "flex items-end gap-3",
618
+ children: [/* @__PURE__ */ jsx("textarea", {
619
+ "aria-label": "Message to orchestrator",
620
+ placeholder: "Message the orchestrator…",
621
+ value: message,
622
+ onChange: (event) => setMessage(event.target.value),
623
+ rows: 2,
624
+ maxLength: 16e3,
625
+ disabled: pending || !enabled,
626
+ onKeyDown: (event) => {
627
+ if (event.key === "Enter" && !event.shiftKey && !event.nativeEvent.isComposing) {
628
+ event.preventDefault();
629
+ send();
630
+ }
631
+ },
632
+ className: "min-w-0 flex-1 resize-none rounded-xl border border-zinc-700 bg-zinc-950 px-4 py-3 text-sm text-zinc-100 outline-none focus:border-violet-500 disabled:opacity-50"
633
+ }), /* @__PURE__ */ jsx("button", {
634
+ type: "submit",
635
+ disabled: pending || !enabled || !message.trim(),
636
+ className: "shrink-0 cursor-pointer rounded-full bg-violet-600 px-5 py-2.5 text-sm font-medium text-white hover:bg-violet-500 disabled:cursor-not-allowed disabled:opacity-50",
637
+ children: pending ? "Sending…" : "Send"
638
+ })]
639
+ }), error && /* @__PURE__ */ jsx("p", {
640
+ role: "alert",
641
+ className: "mt-3 text-sm text-red-300",
642
+ children: error
643
+ })]
644
+ })
645
+ ]
646
+ });
647
+ }
648
+ //#endregion
649
+ //#region src/components/agent-setup-checklist.tsx
650
+ function AgentSetupChecklist({ agentId, tradingEnabled, subagents }) {
651
+ const subagentEnabled = subagents.some((subagent) => subagent.enabled);
652
+ if (tradingEnabled && subagentEnabled || subagents.some((subagent) => subagent.runs.length > 0)) return null;
653
+ const base = `/agents/${encodeURIComponent(agentId)}`;
654
+ const steps = [{
655
+ label: "Enable Trading",
656
+ href: `${base}/settings#risk-management`,
657
+ complete: tradingEnabled
658
+ }, subagents.length > 0 ? {
659
+ label: "Enable sub-agents",
660
+ href: `${base}/sub-agents`,
661
+ complete: subagentEnabled
662
+ } : {
663
+ label: "Create a new sub-agent",
664
+ href: `${base}/sub-agents/new`,
665
+ complete: false
666
+ }];
667
+ const next = steps.findIndex((step) => !step.complete);
668
+ return /* @__PURE__ */ jsxs("section", {
669
+ "aria-label": "Agent setup",
670
+ className: "shrink-0 rounded-xl border border-violet-800 bg-violet-950/30 p-4 text-sm text-violet-200",
671
+ children: [/* @__PURE__ */ jsx("h2", {
672
+ className: "font-semibold",
673
+ children: "Finish setting up your agent"
674
+ }), /* @__PURE__ */ jsx("ol", {
675
+ className: "mt-3 flex flex-wrap gap-x-6 gap-y-3",
676
+ children: steps.map((step, index) => /* @__PURE__ */ jsxs("li", {
677
+ "aria-current": index === next ? "step" : void 0,
678
+ className: step.complete ? "text-zinc-400" : index === next ? "font-semibold text-violet-100" : "text-violet-300/70",
679
+ children: [
680
+ /* @__PURE__ */ jsx("span", {
681
+ "aria-hidden": "true",
682
+ className: "mr-2",
683
+ children: step.complete ? "✓" : `${index + 1}.`
684
+ }),
685
+ /* @__PURE__ */ jsx("span", {
686
+ className: "sr-only",
687
+ children: step.complete ? "Completed: " : index === next ? "Next: " : ""
688
+ }),
689
+ /* @__PURE__ */ jsx("a", {
690
+ href: step.href,
691
+ className: "cursor-pointer underline underline-offset-4 hover:text-white",
692
+ children: step.label
693
+ })
694
+ ]
695
+ }, step.href))
696
+ })]
697
+ });
698
+ }
699
+ //#endregion
700
+ //#region src/components/agent-dashboard-page.tsx
701
+ function Panel({ title, children }) {
702
+ return /* @__PURE__ */ jsxs("section", {
703
+ className: "rounded-2xl border border-zinc-800 bg-[#0d0d10] p-6",
704
+ children: [/* @__PURE__ */ jsx("h3", {
705
+ className: "mb-4 text-lg font-medium text-white",
706
+ children: title
707
+ }), children]
708
+ });
709
+ }
710
+ function pnlColor(value) {
711
+ const sign = value === null ? null : compareDecimals(value, "0");
712
+ return sign === null || sign === 0 ? null : sign < 0 ? "text-red-400" : "text-emerald-400";
713
+ }
714
+ function positionSizeText(value) {
715
+ const sign = compareDecimals(value, "0");
716
+ if (sign === null || sign === 0) return formatAmountText(value);
717
+ return `${sign < 0 ? "Short" : "Long"} ${formatAmountText(value.replace(/^-/, ""))}`;
718
+ }
719
+ function Statistic({ label, value, pnl = false }) {
720
+ const color = (pnl ? pnlColor(value) : null) ?? "text-zinc-100";
721
+ return /* @__PURE__ */ jsxs("div", {
722
+ className: "p-1",
723
+ children: [/* @__PURE__ */ jsx("dt", {
724
+ className: "text-xs uppercase tracking-[0.16em] text-zinc-500",
725
+ children: label
726
+ }), /* @__PURE__ */ jsx("dd", {
727
+ className: "mt-1 flex items-baseline gap-2",
728
+ children: value === null ? /* @__PURE__ */ jsx("span", {
729
+ className: "text-base italic text-zinc-500",
730
+ children: "Unavailable"
731
+ }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
732
+ className: `font-mono text-2xl font-semibold tabular-nums ${color}`,
733
+ children: formatMoneyText(value)
734
+ }), /* @__PURE__ */ jsx("span", {
735
+ className: "text-xs text-zinc-500",
736
+ children: "USDC"
737
+ })] })
738
+ })]
739
+ });
740
+ }
741
+ var cell = "whitespace-nowrap px-3 py-3 text-left";
742
+ var noSubagents = [];
743
+ function AgentDashboardPage({ id, initial, enabled = true, tradingEnabled, subagents, subagentsError }) {
744
+ const [snapshot, setSnapshot] = useState(initial);
745
+ const [workers, setWorkers] = useState(subagents);
746
+ const [workersError, setWorkersError] = useState(subagentsError);
747
+ const [workersCurrent, setWorkersCurrent] = useState(true);
748
+ useEffect(() => {
749
+ setWorkers(subagents);
750
+ setWorkersError(subagentsError);
751
+ setWorkersCurrent(true);
752
+ }, [
753
+ id,
754
+ subagents,
755
+ subagentsError
756
+ ]);
757
+ useAgentEvent("subagents", (event) => {
758
+ setWorkers(JSON.parse(event.data));
759
+ setWorkersError(void 0);
760
+ setWorkersCurrent(true);
761
+ });
762
+ const [error, setError] = useState("");
763
+ const { interrupted, controlMessage, streamErrors } = useAgentEventsStatus();
764
+ useEffect(() => {
765
+ if (interrupted || streamErrors.subagents) setWorkersCurrent(false);
766
+ }, [interrupted, streamErrors.subagents]);
767
+ const hasAddress = Boolean(initial.address);
768
+ useAgentEvent("dashboard", (event) => {
769
+ setSnapshot(JSON.parse(event.data));
770
+ setError("");
771
+ }, hasAddress);
772
+ useEffect(() => {
773
+ setSnapshot(initial);
774
+ setError("");
775
+ }, [id, initial]);
776
+ useEffect(() => {
777
+ if (!hasAddress) return;
778
+ const topicError = streamErrors["dashboard"];
779
+ if (topicError) setError(topicError);
780
+ else if (interrupted) setError(controlMessage || "Live connection interrupted. Reconnecting… Displayed data is from the last snapshot, not current.");
781
+ }, [
782
+ hasAddress,
783
+ interrupted,
784
+ controlMessage,
785
+ streamErrors
786
+ ]);
787
+ const connected = !error && snapshot.live?.status === "connected";
788
+ const current = connected && Object.values(snapshot.live.sections).every((section) => section.fresh) && snapshot.errors.length === 0;
789
+ const connectionLabel = current ? "Connected" : connected ? "Connected · Data stale" : "Disconnected";
790
+ const connectionColor = current ? "bg-emerald-400" : connected ? "bg-amber-400" : "bg-red-400";
791
+ const totalEquity = dashboardTotalEquity(snapshot);
792
+ const unrealizedPnl = snapshot.positions?.reduce((total, position) => total === null ? null : addDecimals(total, position.unrealizedPnl), "0") ?? null;
793
+ return /* @__PURE__ */ jsxs("div", {
794
+ className: "flex h-[calc(100dvh-4.5rem)] min-h-0 w-full flex-col gap-2 overflow-hidden sm:h-[calc(100dvh-5rem)]",
795
+ children: [
796
+ /* @__PURE__ */ jsx("h2", {
797
+ className: "sr-only",
798
+ children: "Dashboard"
799
+ }),
800
+ /* @__PURE__ */ jsxs("div", {
801
+ className: "max-h-[55%] shrink-0 space-y-2 overflow-y-auto",
802
+ children: [tradingEnabled !== void 0 && workers && workersCurrent && !workersError && !streamErrors.subagents && !interrupted && /* @__PURE__ */ jsx(AgentSetupChecklist, {
803
+ agentId: id,
804
+ tradingEnabled,
805
+ subagents: workers
806
+ }), !snapshot.address ? /* @__PURE__ */ jsx(Panel, {
807
+ title: "Trading account",
808
+ children: /* @__PURE__ */ jsx("p", {
809
+ className: "text-sm text-zinc-400",
810
+ children: "This agent is missing its required Hyperliquid account. Create a new agent with a linked account."
811
+ })
812
+ }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [
813
+ /* @__PURE__ */ jsxs("section", {
814
+ "aria-label": "Account overview",
815
+ className: "rounded-2xl border border-zinc-800 bg-[#0d0d10] p-6",
816
+ children: [
817
+ /* @__PURE__ */ jsxs("p", {
818
+ role: "status",
819
+ className: "mb-5 flex items-center gap-2 text-xs text-zinc-400",
820
+ children: [/* @__PURE__ */ jsx("span", {
821
+ "aria-hidden": "true",
822
+ className: `h-2 w-2 rounded-full ${connectionColor}`
823
+ }), connectionLabel]
824
+ }),
825
+ error && /* @__PURE__ */ jsx("p", {
826
+ role: "alert",
827
+ className: "mb-4 rounded-xl border border-amber-900 p-3 text-sm text-amber-200",
828
+ children: error
829
+ }),
830
+ snapshot.errors.length > 0 && /* @__PURE__ */ jsx("div", {
831
+ role: "status",
832
+ className: "mb-4 rounded-xl border border-amber-900 p-3 text-sm text-amber-200",
833
+ children: snapshot.errors.map((message) => /* @__PURE__ */ jsx("p", { children: message }, message))
834
+ }),
835
+ /* @__PURE__ */ jsxs("dl", {
836
+ className: "grid grid-cols-1 gap-6 sm:grid-cols-2 xl:grid-cols-4",
837
+ children: [
838
+ /* @__PURE__ */ jsx(Statistic, {
839
+ label: "Total equity",
840
+ value: totalEquity
841
+ }),
842
+ /* @__PURE__ */ jsx(Statistic, {
843
+ label: "Unrealized",
844
+ value: unrealizedPnl,
845
+ pnl: true
846
+ }),
847
+ /* @__PURE__ */ jsx(BalanceSparkline, {
848
+ label: "24h",
849
+ points: snapshot.balanceHistory?.day
850
+ }),
851
+ /* @__PURE__ */ jsx(BalanceSparkline, {
852
+ label: "30d",
853
+ points: snapshot.balanceHistory?.month
854
+ })
855
+ ]
856
+ })
857
+ ]
858
+ }),
859
+ /* @__PURE__ */ jsx(Panel, {
860
+ title: "Positions",
861
+ children: snapshot.positions === null ? /* @__PURE__ */ jsx("p", {
862
+ className: "text-sm text-amber-200",
863
+ children: "Positions unavailable."
864
+ }) : snapshot.positions.length === 0 ? /* @__PURE__ */ jsx("p", {
865
+ className: "text-sm text-zinc-500",
866
+ children: "No open positions."
867
+ }) : /* @__PURE__ */ jsx("div", {
868
+ className: "overflow-x-auto",
869
+ children: /* @__PURE__ */ jsxs("table", {
870
+ className: "w-full text-sm text-zinc-300",
871
+ children: [/* @__PURE__ */ jsx("thead", {
872
+ className: "text-xs text-zinc-500",
873
+ children: /* @__PURE__ */ jsx("tr", { children: [
874
+ "Market",
875
+ "Size",
876
+ "Leverage",
877
+ "Entry price",
878
+ "Unrealized P&L",
879
+ "Liquidation price",
880
+ "Actions"
881
+ ].map((label) => /* @__PURE__ */ jsx("th", {
882
+ className: cell,
883
+ children: label
884
+ }, label)) })
885
+ }), /* @__PURE__ */ jsx("tbody", {
886
+ className: "divide-y divide-zinc-800",
887
+ children: snapshot.positions.map((position) => /* @__PURE__ */ jsxs("tr", { children: [
888
+ /* @__PURE__ */ jsx("td", {
889
+ className: cell,
890
+ children: /* @__PURE__ */ jsx(InstrumentLabel, { symbol: position.coin })
891
+ }),
892
+ /* @__PURE__ */ jsx("td", {
893
+ className: cell,
894
+ children: /* @__PURE__ */ jsx("span", {
895
+ className: "font-mono tabular-nums",
896
+ children: positionSizeText(position.size)
897
+ })
898
+ }),
899
+ /* @__PURE__ */ jsxs("td", {
900
+ className: cell,
901
+ children: [position.leverage, "×"]
902
+ }),
903
+ /* @__PURE__ */ jsx("td", {
904
+ className: cell,
905
+ children: /* @__PURE__ */ jsx("span", {
906
+ className: "font-mono tabular-nums",
907
+ children: formatAmountText(position.entryPrice)
908
+ })
909
+ }),
910
+ /* @__PURE__ */ jsx("td", {
911
+ className: cell,
912
+ children: /* @__PURE__ */ jsx("span", {
913
+ className: `font-mono tabular-nums ${pnlColor(position.unrealizedPnl) ?? "text-zinc-300"}`,
914
+ children: formatMoneyText(position.unrealizedPnl)
915
+ })
916
+ }),
917
+ /* @__PURE__ */ jsx("td", {
918
+ className: cell,
919
+ children: /* @__PURE__ */ jsx("span", {
920
+ className: "font-mono tabular-nums",
921
+ children: formatMoneyText(position.liquidationPrice, 2)
922
+ })
923
+ }),
924
+ /* @__PURE__ */ jsx("td", {
925
+ className: cell,
926
+ children: /* @__PURE__ */ jsx(ClosePositionButton, {
927
+ agentId: id,
928
+ symbol: position.coin
929
+ })
930
+ })
931
+ ] }, position.coin))
932
+ })]
933
+ })
934
+ })
935
+ }),
936
+ /* @__PURE__ */ jsx(Panel, {
937
+ title: "Open orders",
938
+ children: snapshot.orders === null ? /* @__PURE__ */ jsx("p", {
939
+ className: "text-sm text-amber-200",
940
+ children: "Orders unavailable."
941
+ }) : snapshot.orders.length === 0 ? /* @__PURE__ */ jsx("p", {
942
+ className: "text-sm text-zinc-500",
943
+ children: "No open orders."
944
+ }) : /* @__PURE__ */ jsx("div", {
945
+ className: "overflow-x-auto",
946
+ children: /* @__PURE__ */ jsxs("table", {
947
+ className: "w-full text-sm text-zinc-300",
948
+ children: [/* @__PURE__ */ jsx("thead", {
949
+ className: "text-xs text-zinc-500",
950
+ children: /* @__PURE__ */ jsx("tr", { children: [
951
+ "Market",
952
+ "Timestamp",
953
+ "Side",
954
+ "Type",
955
+ "Size",
956
+ "Price / trigger",
957
+ "Actions"
958
+ ].map((label) => /* @__PURE__ */ jsx("th", {
959
+ className: cell,
960
+ children: label
961
+ }, label)) })
962
+ }), /* @__PURE__ */ jsx("tbody", {
963
+ className: "divide-y divide-zinc-800",
964
+ children: snapshot.orders.map((order) => /* @__PURE__ */ jsxs("tr", { children: [
965
+ /* @__PURE__ */ jsx("td", {
966
+ className: cell,
967
+ children: /* @__PURE__ */ jsx(InstrumentLabel, { symbol: order.coin })
968
+ }),
969
+ /* @__PURE__ */ jsx("td", {
970
+ className: `${cell} text-xs text-zinc-400`,
971
+ children: order.timestamp === void 0 ? "—" : /* @__PURE__ */ jsx(ToggleTimestamp, {
972
+ timestamp: order.timestamp,
973
+ label: "order"
974
+ })
975
+ }),
976
+ /* @__PURE__ */ jsx("td", {
977
+ className: cell,
978
+ children: order.side
979
+ }),
980
+ /* @__PURE__ */ jsx("td", {
981
+ className: cell,
982
+ children: order.type
983
+ }),
984
+ /* @__PURE__ */ jsx("td", {
985
+ className: cell,
986
+ children: /* @__PURE__ */ jsx("span", {
987
+ className: "font-mono tabular-nums",
988
+ children: formatAmountText(order.size)
989
+ })
990
+ }),
991
+ /* @__PURE__ */ jsx("td", {
992
+ className: cell,
993
+ children: /* @__PURE__ */ jsx("span", {
994
+ className: "font-mono tabular-nums",
995
+ children: formatAmountText(order.triggerPrice ?? order.price)
996
+ })
997
+ }),
998
+ /* @__PURE__ */ jsx("td", {
999
+ className: cell,
1000
+ children: /* @__PURE__ */ jsx(CancelOrderButton, {
1001
+ agentId: id,
1002
+ symbol: order.coin,
1003
+ oid: String(order.id)
1004
+ }, `${id}:${order.coin}:${order.id}`)
1005
+ })
1006
+ ] }, order.id))
1007
+ })]
1008
+ })
1009
+ })
1010
+ })
1011
+ ] })]
1012
+ }),
1013
+ /* @__PURE__ */ jsx(DashboardSubagents, {
1014
+ agentId: id,
1015
+ agentEnabled: enabled,
1016
+ subagents: workers ?? noSubagents,
1017
+ error: workersError
1018
+ }),
1019
+ /* @__PURE__ */ jsx(DashboardChat, {
1020
+ agentId: id,
1021
+ enabled
1022
+ }, id)
1023
+ ]
1024
+ });
1025
+ }
1026
+ //#endregion
1027
+ //#region src/routes/_authenticated.agents.$agentId.index.tsx?tsr-split=component
1028
+ function DashboardRoute() {
1029
+ const { agentId } = Route.useParams();
1030
+ const { data: agent } = useSuspenseQuery(agentQueryOptions(agentId));
1031
+ const { data: dashboard } = useSuspenseQuery(agentDashboardQueryOptions(agentId));
1032
+ const { data: subagents, error } = useQuery(dashboardSubagentsQueryOptions(agentId));
1033
+ const { data: risk, error: riskError } = useQuery(riskQueryOptions(agentId));
1034
+ return /* @__PURE__ */ jsx(AgentDashboardPage, {
1035
+ id: agentId,
1036
+ enabled: agent.enabled,
1037
+ tradingEnabled: riskError ? void 0 : risk?.tradingEnabled,
1038
+ initial: dashboard,
1039
+ subagents,
1040
+ subagentsError: error?.message
1041
+ }, agentId);
1042
+ }
1043
+ //#endregion
1044
+ export { DashboardRoute as component };