@elizaos/agent 0.25.8 → 2.0.0-alpha.83

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 (607) hide show
  1. package/LICENSE +1 -1
  2. package/package.json +994 -34
  3. package/packages/agent/src/actions/emote.d.ts +14 -0
  4. package/packages/agent/src/actions/emote.d.ts.map +1 -0
  5. package/packages/agent/src/actions/emote.js +91 -0
  6. package/packages/agent/src/actions/restart.d.ts +19 -0
  7. package/packages/agent/src/actions/restart.d.ts.map +1 -0
  8. package/packages/agent/src/actions/restart.js +86 -0
  9. package/packages/agent/src/actions/send-message.d.ts +3 -0
  10. package/packages/agent/src/actions/send-message.d.ts.map +1 -0
  11. package/packages/agent/src/actions/send-message.js +144 -0
  12. package/packages/agent/src/actions/stream-control.d.ts +15 -0
  13. package/packages/agent/src/actions/stream-control.d.ts.map +1 -0
  14. package/packages/agent/src/actions/stream-control.js +357 -0
  15. package/packages/agent/src/actions/switch-stream-source.d.ts +16 -0
  16. package/packages/agent/src/actions/switch-stream-source.d.ts.map +1 -0
  17. package/packages/agent/src/actions/switch-stream-source.js +94 -0
  18. package/packages/agent/src/actions/terminal.d.ts +14 -0
  19. package/packages/agent/src/actions/terminal.d.ts.map +1 -0
  20. package/packages/agent/src/actions/terminal.js +154 -0
  21. package/packages/agent/src/api/agent-admin-routes.d.ts +38 -0
  22. package/packages/agent/src/api/agent-admin-routes.d.ts.map +1 -0
  23. package/packages/agent/src/api/agent-admin-routes.js +93 -0
  24. package/packages/agent/src/api/agent-lifecycle-routes.d.ts +16 -0
  25. package/packages/agent/src/api/agent-lifecycle-routes.d.ts.map +1 -0
  26. package/packages/agent/src/api/agent-lifecycle-routes.js +80 -0
  27. package/packages/agent/src/api/agent-model.d.ts +12 -0
  28. package/packages/agent/src/api/agent-model.d.ts.map +1 -0
  29. package/packages/agent/src/api/agent-model.js +123 -0
  30. package/packages/agent/src/api/agent-transfer-routes.d.ts +16 -0
  31. package/packages/agent/src/api/agent-transfer-routes.d.ts.map +1 -0
  32. package/packages/agent/src/api/agent-transfer-routes.js +124 -0
  33. package/packages/agent/src/api/apps-routes.d.ts +19 -0
  34. package/packages/agent/src/api/apps-routes.d.ts.map +1 -0
  35. package/packages/agent/src/api/apps-routes.js +128 -0
  36. package/packages/agent/src/api/auth-routes.d.ts +11 -0
  37. package/packages/agent/src/api/auth-routes.d.ts.map +1 -0
  38. package/packages/agent/src/api/auth-routes.js +54 -0
  39. package/packages/agent/src/api/bsc-trade.d.ts +34 -0
  40. package/packages/agent/src/api/bsc-trade.d.ts.map +1 -0
  41. package/packages/agent/src/api/bsc-trade.js +567 -0
  42. package/packages/agent/src/api/bug-report-routes.d.ts +7 -0
  43. package/packages/agent/src/api/bug-report-routes.d.ts.map +1 -0
  44. package/packages/agent/src/api/bug-report-routes.js +124 -0
  45. package/packages/agent/src/api/character-routes.d.ts +50 -0
  46. package/packages/agent/src/api/character-routes.d.ts.map +1 -0
  47. package/packages/agent/src/api/character-routes.js +302 -0
  48. package/packages/agent/src/api/cloud-billing-routes.d.ts +14 -0
  49. package/packages/agent/src/api/cloud-billing-routes.d.ts.map +1 -0
  50. package/packages/agent/src/api/cloud-billing-routes.js +400 -0
  51. package/packages/agent/src/api/cloud-compat-routes.d.ts +15 -0
  52. package/packages/agent/src/api/cloud-compat-routes.d.ts.map +1 -0
  53. package/packages/agent/src/api/cloud-compat-routes.js +131 -0
  54. package/packages/agent/src/api/cloud-routes.d.ts +62 -0
  55. package/packages/agent/src/api/cloud-routes.d.ts.map +1 -0
  56. package/packages/agent/src/api/cloud-routes.js +339 -0
  57. package/packages/agent/src/api/cloud-status-routes.d.ts +15 -0
  58. package/packages/agent/src/api/cloud-status-routes.d.ts.map +1 -0
  59. package/packages/agent/src/api/cloud-status-routes.js +165 -0
  60. package/packages/agent/src/api/compat-utils.d.ts +49 -0
  61. package/packages/agent/src/api/compat-utils.d.ts.map +1 -0
  62. package/packages/agent/src/api/compat-utils.js +126 -0
  63. package/packages/agent/src/api/connector-health.d.ts +34 -0
  64. package/packages/agent/src/api/connector-health.d.ts.map +1 -0
  65. package/packages/agent/src/api/connector-health.js +109 -0
  66. package/packages/agent/src/api/coordinator-wiring.d.ts +46 -0
  67. package/packages/agent/src/api/coordinator-wiring.d.ts.map +1 -0
  68. package/packages/agent/src/api/coordinator-wiring.js +101 -0
  69. package/packages/agent/src/api/credit-detection.d.ts +9 -0
  70. package/packages/agent/src/api/credit-detection.d.ts.map +1 -0
  71. package/packages/agent/src/api/credit-detection.js +41 -0
  72. package/packages/agent/src/api/database.d.ts +33 -0
  73. package/packages/agent/src/api/database.d.ts.map +1 -0
  74. package/packages/agent/src/api/database.js +1019 -0
  75. package/packages/agent/src/api/diagnostics-routes.d.ts +46 -0
  76. package/packages/agent/src/api/diagnostics-routes.d.ts.map +1 -0
  77. package/packages/agent/src/api/diagnostics-routes.js +241 -0
  78. package/packages/agent/src/api/drop-service.d.ts +26 -0
  79. package/packages/agent/src/api/drop-service.d.ts.map +1 -0
  80. package/packages/agent/src/api/drop-service.js +134 -0
  81. package/packages/agent/src/api/early-logs.d.ts +29 -0
  82. package/packages/agent/src/api/early-logs.d.ts.map +1 -0
  83. package/packages/agent/src/api/early-logs.js +96 -0
  84. package/packages/agent/src/api/http-helpers.d.ts +50 -0
  85. package/packages/agent/src/api/http-helpers.d.ts.map +1 -0
  86. package/packages/agent/src/api/http-helpers.js +145 -0
  87. package/packages/agent/src/api/index.d.ts +61 -0
  88. package/packages/agent/src/api/index.d.ts.map +1 -0
  89. package/packages/agent/src/api/index.js +59 -0
  90. package/packages/agent/src/api/knowledge-routes.d.ts +23 -0
  91. package/packages/agent/src/api/knowledge-routes.d.ts.map +1 -0
  92. package/packages/agent/src/api/knowledge-routes.js +931 -0
  93. package/packages/agent/src/api/knowledge-service-loader.d.ts +51 -0
  94. package/packages/agent/src/api/knowledge-service-loader.d.ts.map +1 -0
  95. package/packages/agent/src/api/knowledge-service-loader.js +34 -0
  96. package/packages/agent/src/api/memory-bounds.d.ts +51 -0
  97. package/packages/agent/src/api/memory-bounds.d.ts.map +1 -0
  98. package/packages/agent/src/api/memory-bounds.js +81 -0
  99. package/packages/agent/src/api/memory-routes.d.ts +9 -0
  100. package/packages/agent/src/api/memory-routes.d.ts.map +1 -0
  101. package/packages/agent/src/api/memory-routes.js +241 -0
  102. package/packages/agent/src/api/merkle-tree.d.ts +90 -0
  103. package/packages/agent/src/api/merkle-tree.d.ts.map +1 -0
  104. package/packages/agent/src/api/merkle-tree.js +174 -0
  105. package/packages/agent/src/api/models-routes.d.ts +14 -0
  106. package/packages/agent/src/api/models-routes.d.ts.map +1 -0
  107. package/packages/agent/src/api/models-routes.js +37 -0
  108. package/packages/agent/src/api/nfa-routes.d.ts +5 -0
  109. package/packages/agent/src/api/nfa-routes.d.ts.map +1 -0
  110. package/packages/agent/src/api/nfa-routes.js +125 -0
  111. package/packages/agent/src/api/og-tracker.d.ts +28 -0
  112. package/packages/agent/src/api/og-tracker.d.ts.map +1 -0
  113. package/packages/agent/src/api/og-tracker.js +60 -0
  114. package/packages/agent/src/api/parse-action-block.d.ts +36 -0
  115. package/packages/agent/src/api/parse-action-block.d.ts.map +1 -0
  116. package/packages/agent/src/api/parse-action-block.js +110 -0
  117. package/packages/agent/src/api/permissions-routes.d.ts +32 -0
  118. package/packages/agent/src/api/permissions-routes.d.ts.map +1 -0
  119. package/packages/agent/src/api/permissions-routes.js +149 -0
  120. package/packages/agent/src/api/plugin-validation.d.ts +86 -0
  121. package/packages/agent/src/api/plugin-validation.d.ts.map +1 -0
  122. package/packages/agent/src/api/plugin-validation.js +259 -0
  123. package/packages/agent/src/api/provider-switch-config.d.ts +37 -0
  124. package/packages/agent/src/api/provider-switch-config.d.ts.map +1 -0
  125. package/packages/agent/src/api/provider-switch-config.js +317 -0
  126. package/packages/agent/src/api/registry-routes.d.ts +26 -0
  127. package/packages/agent/src/api/registry-routes.d.ts.map +1 -0
  128. package/packages/agent/src/api/registry-routes.js +90 -0
  129. package/packages/agent/src/api/registry-service.d.ts +77 -0
  130. package/packages/agent/src/api/registry-service.d.ts.map +1 -0
  131. package/packages/agent/src/api/registry-service.js +190 -0
  132. package/packages/agent/src/api/route-helpers.d.ts +16 -0
  133. package/packages/agent/src/api/route-helpers.d.ts.map +1 -0
  134. package/packages/agent/src/api/route-helpers.js +1 -0
  135. package/packages/agent/src/api/sandbox-routes.d.ts +12 -0
  136. package/packages/agent/src/api/sandbox-routes.d.ts.map +1 -0
  137. package/packages/agent/src/api/sandbox-routes.js +1334 -0
  138. package/packages/agent/src/api/server.d.ts +418 -0
  139. package/packages/agent/src/api/server.d.ts.map +1 -0
  140. package/packages/agent/src/api/server.js +13614 -0
  141. package/packages/agent/src/api/signal-routes.d.ts +39 -0
  142. package/packages/agent/src/api/signal-routes.d.ts.map +1 -0
  143. package/packages/agent/src/api/signal-routes.js +168 -0
  144. package/packages/agent/src/api/stream-persistence.d.ts +64 -0
  145. package/packages/agent/src/api/stream-persistence.d.ts.map +1 -0
  146. package/packages/agent/src/api/stream-persistence.js +231 -0
  147. package/packages/agent/src/api/stream-route-state.d.ts +50 -0
  148. package/packages/agent/src/api/stream-route-state.d.ts.map +1 -0
  149. package/packages/agent/src/api/stream-route-state.js +1 -0
  150. package/packages/agent/src/api/stream-routes.d.ts +45 -0
  151. package/packages/agent/src/api/stream-routes.d.ts.map +1 -0
  152. package/packages/agent/src/api/stream-routes.js +809 -0
  153. package/packages/agent/src/api/stream-voice-routes.d.ts +36 -0
  154. package/packages/agent/src/api/stream-voice-routes.d.ts.map +1 -0
  155. package/packages/agent/src/api/stream-voice-routes.js +133 -0
  156. package/packages/agent/src/api/streaming-text.d.ts +9 -0
  157. package/packages/agent/src/api/streaming-text.d.ts.map +1 -0
  158. package/packages/agent/src/api/streaming-text.js +85 -0
  159. package/packages/agent/src/api/streaming-types.d.ts +30 -0
  160. package/packages/agent/src/api/streaming-types.d.ts.map +1 -0
  161. package/packages/agent/src/api/streaming-types.js +1 -0
  162. package/packages/agent/src/api/subscription-routes.d.ts +20 -0
  163. package/packages/agent/src/api/subscription-routes.d.ts.map +1 -0
  164. package/packages/agent/src/api/subscription-routes.js +191 -0
  165. package/packages/agent/src/api/terminal-run-limits.d.ts +5 -0
  166. package/packages/agent/src/api/terminal-run-limits.d.ts.map +1 -0
  167. package/packages/agent/src/api/terminal-run-limits.js +22 -0
  168. package/packages/agent/src/api/training-backend-check.d.ts +8 -0
  169. package/packages/agent/src/api/training-backend-check.d.ts.map +1 -0
  170. package/packages/agent/src/api/training-backend-check.js +28 -0
  171. package/packages/agent/src/api/training-routes.d.ts +44 -0
  172. package/packages/agent/src/api/training-routes.d.ts.map +1 -0
  173. package/packages/agent/src/api/training-routes.js +195 -0
  174. package/packages/agent/src/api/training-service-like.d.ts +38 -0
  175. package/packages/agent/src/api/training-service-like.d.ts.map +1 -0
  176. package/packages/agent/src/api/training-service-like.js +1 -0
  177. package/packages/agent/src/api/trajectory-routes.d.ts +17 -0
  178. package/packages/agent/src/api/trajectory-routes.d.ts.map +1 -0
  179. package/packages/agent/src/api/trajectory-routes.js +405 -0
  180. package/packages/agent/src/api/trigger-routes.d.ts +72 -0
  181. package/packages/agent/src/api/trigger-routes.d.ts.map +1 -0
  182. package/packages/agent/src/api/trigger-routes.js +268 -0
  183. package/packages/agent/src/api/twitter-verify.d.ts +25 -0
  184. package/packages/agent/src/api/twitter-verify.d.ts.map +1 -0
  185. package/packages/agent/src/api/twitter-verify.js +168 -0
  186. package/packages/agent/src/api/tx-service.d.ts +47 -0
  187. package/packages/agent/src/api/tx-service.d.ts.map +1 -0
  188. package/packages/agent/src/api/tx-service.js +156 -0
  189. package/packages/agent/src/api/wallet-dex-prices.d.ts +43 -0
  190. package/packages/agent/src/api/wallet-dex-prices.d.ts.map +1 -0
  191. package/packages/agent/src/api/wallet-dex-prices.js +149 -0
  192. package/packages/agent/src/api/wallet-evm-balance.d.ts +65 -0
  193. package/packages/agent/src/api/wallet-evm-balance.d.ts.map +1 -0
  194. package/packages/agent/src/api/wallet-evm-balance.js +663 -0
  195. package/packages/agent/src/api/wallet-routes.d.ts +33 -0
  196. package/packages/agent/src/api/wallet-routes.d.ts.map +1 -0
  197. package/packages/agent/src/api/wallet-routes.js +292 -0
  198. package/packages/agent/src/api/wallet-rpc.d.ts +61 -0
  199. package/packages/agent/src/api/wallet-rpc.d.ts.map +1 -0
  200. package/packages/agent/src/api/wallet-rpc.js +367 -0
  201. package/packages/agent/src/api/wallet-trading-profile.d.ts +51 -0
  202. package/packages/agent/src/api/wallet-trading-profile.d.ts.map +1 -0
  203. package/packages/agent/src/api/wallet-trading-profile.js +547 -0
  204. package/packages/agent/src/api/wallet.d.ts +31 -0
  205. package/packages/agent/src/api/wallet.d.ts.map +1 -0
  206. package/packages/agent/src/api/wallet.js +513 -0
  207. package/packages/agent/src/api/whatsapp-routes.d.ts +39 -0
  208. package/packages/agent/src/api/whatsapp-routes.d.ts.map +1 -0
  209. package/packages/agent/src/api/whatsapp-routes.js +182 -0
  210. package/packages/agent/src/api/zip-utils.d.ts +8 -0
  211. package/packages/agent/src/api/zip-utils.d.ts.map +1 -0
  212. package/packages/agent/src/api/zip-utils.js +115 -0
  213. package/packages/agent/src/auth/anthropic.d.ts +25 -0
  214. package/packages/agent/src/auth/anthropic.d.ts.map +1 -0
  215. package/packages/agent/src/auth/anthropic.js +40 -0
  216. package/packages/agent/src/auth/apply-stealth.d.ts +8 -0
  217. package/packages/agent/src/auth/apply-stealth.d.ts.map +1 -0
  218. package/packages/agent/src/auth/apply-stealth.js +35 -0
  219. package/packages/agent/src/auth/claude-code-stealth.d.ts +2 -0
  220. package/packages/agent/src/auth/claude-code-stealth.d.ts.map +1 -0
  221. package/packages/agent/src/auth/claude-code-stealth.js +104 -0
  222. package/packages/agent/src/auth/credentials.d.ts +55 -0
  223. package/packages/agent/src/auth/credentials.d.ts.map +1 -0
  224. package/packages/agent/src/auth/credentials.js +182 -0
  225. package/packages/agent/src/auth/index.d.ts +7 -0
  226. package/packages/agent/src/auth/index.d.ts.map +1 -0
  227. package/packages/agent/src/auth/index.js +3 -0
  228. package/packages/agent/src/auth/openai-codex.d.ts +27 -0
  229. package/packages/agent/src/auth/openai-codex.d.ts.map +1 -0
  230. package/packages/agent/src/auth/openai-codex.js +72 -0
  231. package/packages/agent/src/auth/types.d.ts +18 -0
  232. package/packages/agent/src/auth/types.d.ts.map +1 -0
  233. package/packages/agent/src/auth/types.js +8 -0
  234. package/packages/agent/src/awareness/registry.d.ts +27 -0
  235. package/packages/agent/src/awareness/registry.d.ts.map +1 -0
  236. package/packages/agent/src/awareness/registry.js +161 -0
  237. package/packages/agent/src/benchmark-server.d.ts +2 -0
  238. package/packages/agent/src/benchmark-server.d.ts.map +1 -0
  239. package/packages/agent/src/benchmark-server.js +773 -0
  240. package/packages/agent/src/bin.d.ts +3 -0
  241. package/packages/agent/src/bin.d.ts.map +1 -0
  242. package/packages/agent/src/bin.js +6 -0
  243. package/packages/agent/src/cli/index.d.ts +2 -0
  244. package/packages/agent/src/cli/index.d.ts.map +1 -0
  245. package/packages/agent/src/cli/index.js +40 -0
  246. package/packages/agent/src/cli/parse-duration.d.ts +5 -0
  247. package/packages/agent/src/cli/parse-duration.d.ts.map +1 -0
  248. package/packages/agent/src/cli/parse-duration.js +27 -0
  249. package/packages/agent/src/cloud/auth.d.ts +19 -0
  250. package/packages/agent/src/cloud/auth.d.ts.map +1 -0
  251. package/packages/agent/src/cloud/auth.js +107 -0
  252. package/packages/agent/src/cloud/backup.d.ts +18 -0
  253. package/packages/agent/src/cloud/backup.d.ts.map +1 -0
  254. package/packages/agent/src/cloud/backup.js +42 -0
  255. package/packages/agent/src/cloud/base-url.d.ts +3 -0
  256. package/packages/agent/src/cloud/base-url.d.ts.map +1 -0
  257. package/packages/agent/src/cloud/base-url.js +40 -0
  258. package/packages/agent/src/cloud/bridge-client.d.ts +56 -0
  259. package/packages/agent/src/cloud/bridge-client.d.ts.map +1 -0
  260. package/packages/agent/src/cloud/bridge-client.js +190 -0
  261. package/packages/agent/src/cloud/cloud-manager.d.ts +32 -0
  262. package/packages/agent/src/cloud/cloud-manager.d.ts.map +1 -0
  263. package/packages/agent/src/cloud/cloud-manager.js +119 -0
  264. package/packages/agent/src/cloud/cloud-proxy.d.ts +20 -0
  265. package/packages/agent/src/cloud/cloud-proxy.d.ts.map +1 -0
  266. package/packages/agent/src/cloud/cloud-proxy.js +34 -0
  267. package/packages/agent/src/cloud/index.d.ts +7 -0
  268. package/packages/agent/src/cloud/index.d.ts.map +1 -0
  269. package/packages/agent/src/cloud/index.js +6 -0
  270. package/packages/agent/src/cloud/reconnect.d.ts +26 -0
  271. package/packages/agent/src/cloud/reconnect.d.ts.map +1 -0
  272. package/packages/agent/src/cloud/reconnect.js +86 -0
  273. package/packages/agent/src/cloud/validate-url.d.ts +2 -0
  274. package/packages/agent/src/cloud/validate-url.d.ts.map +1 -0
  275. package/packages/agent/src/cloud/validate-url.js +162 -0
  276. package/packages/agent/src/config/character-schema.d.ts +25 -0
  277. package/packages/agent/src/config/character-schema.d.ts.map +1 -0
  278. package/packages/agent/src/config/character-schema.js +39 -0
  279. package/packages/agent/src/config/config.d.ts +6 -0
  280. package/packages/agent/src/config/config.d.ts.map +1 -0
  281. package/packages/agent/src/config/config.js +118 -0
  282. package/packages/agent/src/config/env-vars.d.ts +3 -0
  283. package/packages/agent/src/config/env-vars.d.ts.map +1 -0
  284. package/packages/agent/src/config/env-vars.js +76 -0
  285. package/packages/agent/src/config/includes.d.ts +26 -0
  286. package/packages/agent/src/config/includes.d.ts.map +1 -0
  287. package/packages/agent/src/config/includes.js +148 -0
  288. package/packages/agent/src/config/index.d.ts +16 -0
  289. package/packages/agent/src/config/index.d.ts.map +1 -0
  290. package/packages/agent/src/config/index.js +15 -0
  291. package/packages/agent/src/config/object-utils.d.ts +2 -0
  292. package/packages/agent/src/config/object-utils.d.ts.map +1 -0
  293. package/packages/agent/src/config/object-utils.js +6 -0
  294. package/packages/agent/src/config/paths.d.ts +13 -0
  295. package/packages/agent/src/config/paths.d.ts.map +1 -0
  296. package/packages/agent/src/config/paths.js +67 -0
  297. package/packages/agent/src/config/plugin-auto-enable.d.ts +16 -0
  298. package/packages/agent/src/config/plugin-auto-enable.d.ts.map +1 -0
  299. package/packages/agent/src/config/plugin-auto-enable.js +384 -0
  300. package/packages/agent/src/config/schema.d.ts +87 -0
  301. package/packages/agent/src/config/schema.d.ts.map +1 -0
  302. package/packages/agent/src/config/schema.js +928 -0
  303. package/packages/agent/src/config/telegram-custom-commands.d.ts +25 -0
  304. package/packages/agent/src/config/telegram-custom-commands.d.ts.map +1 -0
  305. package/packages/agent/src/config/telegram-custom-commands.js +71 -0
  306. package/packages/agent/src/config/types.agent-defaults.d.ts +331 -0
  307. package/packages/agent/src/config/types.agent-defaults.d.ts.map +1 -0
  308. package/packages/agent/src/config/types.agent-defaults.js +1 -0
  309. package/packages/agent/src/config/types.agents.d.ts +110 -0
  310. package/packages/agent/src/config/types.agents.d.ts.map +1 -0
  311. package/packages/agent/src/config/types.agents.js +1 -0
  312. package/packages/agent/src/config/types.d.ts +8 -0
  313. package/packages/agent/src/config/types.d.ts.map +1 -0
  314. package/packages/agent/src/config/types.eliza.d.ts +636 -0
  315. package/packages/agent/src/config/types.eliza.d.ts.map +1 -0
  316. package/packages/agent/src/config/types.eliza.js +1 -0
  317. package/packages/agent/src/config/types.gateway.d.ts +216 -0
  318. package/packages/agent/src/config/types.gateway.d.ts.map +1 -0
  319. package/packages/agent/src/config/types.gateway.js +1 -0
  320. package/packages/agent/src/config/types.hooks.d.ts +107 -0
  321. package/packages/agent/src/config/types.hooks.d.ts.map +1 -0
  322. package/packages/agent/src/config/types.hooks.js +1 -0
  323. package/packages/agent/src/config/types.js +7 -0
  324. package/packages/agent/src/config/types.messages.d.ts +176 -0
  325. package/packages/agent/src/config/types.messages.d.ts.map +1 -0
  326. package/packages/agent/src/config/types.messages.js +1 -0
  327. package/packages/agent/src/config/types.tools.d.ts +400 -0
  328. package/packages/agent/src/config/types.tools.d.ts.map +1 -0
  329. package/packages/agent/src/config/types.tools.js +1 -0
  330. package/packages/agent/src/config/zod-schema.agent-runtime.d.ts +1062 -0
  331. package/packages/agent/src/config/zod-schema.agent-runtime.d.ts.map +1 -0
  332. package/packages/agent/src/config/zod-schema.agent-runtime.js +721 -0
  333. package/packages/agent/src/config/zod-schema.core.d.ts +1021 -0
  334. package/packages/agent/src/config/zod-schema.core.d.ts.map +1 -0
  335. package/packages/agent/src/config/zod-schema.core.js +694 -0
  336. package/packages/agent/src/config/zod-schema.d.ts +4817 -0
  337. package/packages/agent/src/config/zod-schema.d.ts.map +1 -0
  338. package/packages/agent/src/config/zod-schema.hooks.d.ts +88 -0
  339. package/packages/agent/src/config/zod-schema.hooks.d.ts.map +1 -0
  340. package/packages/agent/src/config/zod-schema.hooks.js +133 -0
  341. package/packages/agent/src/config/zod-schema.js +778 -0
  342. package/packages/agent/src/config/zod-schema.providers-core.d.ts +2976 -0
  343. package/packages/agent/src/config/zod-schema.providers-core.d.ts.map +1 -0
  344. package/packages/agent/src/config/zod-schema.providers-core.js +1006 -0
  345. package/packages/agent/src/config/zod-schema.session.d.ts +183 -0
  346. package/packages/agent/src/config/zod-schema.session.d.ts.map +1 -0
  347. package/packages/agent/src/config/zod-schema.session.js +86 -0
  348. package/packages/agent/src/contracts/apps.d.ts +42 -0
  349. package/packages/agent/src/contracts/apps.d.ts.map +1 -0
  350. package/packages/agent/src/contracts/apps.js +4 -0
  351. package/packages/agent/src/contracts/awareness.d.ts +38 -0
  352. package/packages/agent/src/contracts/awareness.d.ts.map +1 -0
  353. package/packages/agent/src/contracts/awareness.js +7 -0
  354. package/packages/agent/src/contracts/config.d.ts +146 -0
  355. package/packages/agent/src/contracts/config.d.ts.map +1 -0
  356. package/packages/agent/src/contracts/config.js +4 -0
  357. package/packages/agent/src/contracts/drop.d.ts +20 -0
  358. package/packages/agent/src/contracts/drop.d.ts.map +1 -0
  359. package/packages/agent/src/contracts/drop.js +4 -0
  360. package/packages/agent/src/contracts/index.d.ts +9 -0
  361. package/packages/agent/src/contracts/index.d.ts.map +1 -0
  362. package/packages/agent/src/contracts/index.js +8 -0
  363. package/packages/agent/src/contracts/onboarding.d.ts +379 -0
  364. package/packages/agent/src/contracts/onboarding.d.ts.map +1 -0
  365. package/packages/agent/src/contracts/onboarding.js +290 -0
  366. package/packages/agent/src/contracts/permissions.d.ts +35 -0
  367. package/packages/agent/src/contracts/permissions.d.ts.map +1 -0
  368. package/packages/agent/src/contracts/permissions.js +4 -0
  369. package/packages/agent/src/contracts/verification.d.ts +9 -0
  370. package/packages/agent/src/contracts/verification.d.ts.map +1 -0
  371. package/packages/agent/src/contracts/verification.js +4 -0
  372. package/packages/agent/src/contracts/wallet.d.ts +409 -0
  373. package/packages/agent/src/contracts/wallet.d.ts.map +1 -0
  374. package/packages/agent/src/contracts/wallet.js +60 -0
  375. package/packages/agent/src/diagnostics/integration-observability.d.ts +40 -0
  376. package/packages/agent/src/diagnostics/integration-observability.d.ts.map +1 -0
  377. package/packages/agent/src/diagnostics/integration-observability.js +68 -0
  378. package/packages/agent/src/emotes/catalog.d.ts +31 -0
  379. package/packages/agent/src/emotes/catalog.d.ts.map +1 -0
  380. package/packages/agent/src/emotes/catalog.js +618 -0
  381. package/packages/agent/src/hooks/discovery.d.ts +13 -0
  382. package/packages/agent/src/hooks/discovery.d.ts.map +1 -0
  383. package/packages/agent/src/hooks/discovery.js +184 -0
  384. package/packages/agent/src/hooks/eligibility.d.ts +12 -0
  385. package/packages/agent/src/hooks/eligibility.d.ts.map +1 -0
  386. package/packages/agent/src/hooks/eligibility.js +100 -0
  387. package/packages/agent/src/hooks/index.d.ts +3 -0
  388. package/packages/agent/src/hooks/index.d.ts.map +1 -0
  389. package/packages/agent/src/hooks/index.js +2 -0
  390. package/packages/agent/src/hooks/loader.d.ts +34 -0
  391. package/packages/agent/src/hooks/loader.d.ts.map +1 -0
  392. package/packages/agent/src/hooks/loader.js +176 -0
  393. package/packages/agent/src/hooks/registry.d.ts +11 -0
  394. package/packages/agent/src/hooks/registry.d.ts.map +1 -0
  395. package/packages/agent/src/hooks/registry.js +58 -0
  396. package/packages/agent/src/hooks/types.d.ts +104 -0
  397. package/packages/agent/src/hooks/types.d.ts.map +1 -0
  398. package/packages/agent/src/hooks/types.js +8 -0
  399. package/packages/agent/src/index.d.ts +20 -0
  400. package/packages/agent/src/index.d.ts.map +1 -0
  401. package/packages/agent/src/index.js +19 -0
  402. package/packages/agent/src/onboarding-presets.d.ts +78 -0
  403. package/packages/agent/src/onboarding-presets.d.ts.map +1 -0
  404. package/packages/agent/src/onboarding-presets.js +1352 -0
  405. package/packages/agent/src/plugins/custom-rtmp/index.d.ts +12 -0
  406. package/packages/agent/src/plugins/custom-rtmp/index.d.ts.map +1 -0
  407. package/packages/agent/src/plugins/custom-rtmp/index.js +26 -0
  408. package/packages/agent/src/providers/admin-trust.d.ts +4 -0
  409. package/packages/agent/src/providers/admin-trust.d.ts.map +1 -0
  410. package/packages/agent/src/providers/admin-trust.js +53 -0
  411. package/packages/agent/src/providers/session-bridge.d.ts +24 -0
  412. package/packages/agent/src/providers/session-bridge.d.ts.map +1 -0
  413. package/packages/agent/src/providers/session-bridge.js +85 -0
  414. package/packages/agent/src/providers/session-utils.d.ts +20 -0
  415. package/packages/agent/src/providers/session-utils.d.ts.map +1 -0
  416. package/packages/agent/src/providers/session-utils.js +33 -0
  417. package/packages/agent/src/providers/simple-mode.d.ts +4 -0
  418. package/packages/agent/src/providers/simple-mode.d.ts.map +1 -0
  419. package/packages/agent/src/providers/simple-mode.js +85 -0
  420. package/packages/agent/src/providers/ui-catalog.d.ts +3 -0
  421. package/packages/agent/src/providers/ui-catalog.d.ts.map +1 -0
  422. package/packages/agent/src/providers/ui-catalog.js +123 -0
  423. package/packages/agent/src/providers/workspace-provider.d.ts +22 -0
  424. package/packages/agent/src/providers/workspace-provider.d.ts.map +1 -0
  425. package/packages/agent/src/providers/workspace-provider.js +167 -0
  426. package/packages/agent/src/providers/workspace.d.ts +54 -0
  427. package/packages/agent/src/providers/workspace.d.ts.map +1 -0
  428. package/packages/agent/src/providers/workspace.js +405 -0
  429. package/packages/agent/src/runtime/agent-event-service.d.ts +35 -0
  430. package/packages/agent/src/runtime/agent-event-service.d.ts.map +1 -0
  431. package/packages/agent/src/runtime/agent-event-service.js +16 -0
  432. package/packages/agent/src/runtime/cloud-onboarding.d.ts +55 -0
  433. package/packages/agent/src/runtime/cloud-onboarding.d.ts.map +1 -0
  434. package/packages/agent/src/runtime/cloud-onboarding.js +279 -0
  435. package/packages/agent/src/runtime/core-plugins.d.ts +14 -0
  436. package/packages/agent/src/runtime/core-plugins.d.ts.map +1 -0
  437. package/packages/agent/src/runtime/core-plugins.js +51 -0
  438. package/packages/agent/src/runtime/custom-actions.d.ts +40 -0
  439. package/packages/agent/src/runtime/custom-actions.d.ts.map +1 -0
  440. package/packages/agent/src/runtime/custom-actions.js +454 -0
  441. package/packages/agent/src/runtime/eliza-plugin.d.ts +16 -0
  442. package/packages/agent/src/runtime/eliza-plugin.d.ts.map +1 -0
  443. package/packages/agent/src/runtime/eliza-plugin.js +108 -0
  444. package/packages/agent/src/runtime/eliza.d.ts +205 -0
  445. package/packages/agent/src/runtime/eliza.d.ts.map +1 -0
  446. package/packages/agent/src/runtime/eliza.js +3935 -0
  447. package/packages/agent/src/runtime/embedding-presets.d.ts +19 -0
  448. package/packages/agent/src/runtime/embedding-presets.d.ts.map +1 -0
  449. package/packages/agent/src/runtime/embedding-presets.js +53 -0
  450. package/packages/agent/src/runtime/index.d.ts +9 -0
  451. package/packages/agent/src/runtime/index.d.ts.map +1 -0
  452. package/packages/agent/src/runtime/index.js +8 -0
  453. package/packages/agent/src/runtime/onboarding-names.d.ts +11 -0
  454. package/packages/agent/src/runtime/onboarding-names.d.ts.map +1 -0
  455. package/packages/agent/src/runtime/onboarding-names.js +74 -0
  456. package/packages/agent/src/runtime/release-plugin-policy.d.ts +20 -0
  457. package/packages/agent/src/runtime/release-plugin-policy.d.ts.map +1 -0
  458. package/packages/agent/src/runtime/release-plugin-policy.js +87 -0
  459. package/packages/agent/src/runtime/restart.d.ts +45 -0
  460. package/packages/agent/src/runtime/restart.d.ts.map +1 -0
  461. package/packages/agent/src/runtime/restart.js +45 -0
  462. package/packages/agent/src/runtime/trajectory-persistence.d.ts +214 -0
  463. package/packages/agent/src/runtime/trajectory-persistence.d.ts.map +1 -0
  464. package/packages/agent/src/runtime/trajectory-persistence.js +1957 -0
  465. package/packages/agent/src/runtime/version.d.ts +2 -0
  466. package/packages/agent/src/runtime/version.d.ts.map +1 -0
  467. package/packages/agent/src/runtime/version.js +5 -0
  468. package/packages/agent/src/security/audit-log.d.ts +49 -0
  469. package/packages/agent/src/security/audit-log.d.ts.map +1 -0
  470. package/packages/agent/src/security/audit-log.js +161 -0
  471. package/packages/agent/src/security/network-policy.d.ts +6 -0
  472. package/packages/agent/src/security/network-policy.d.ts.map +1 -0
  473. package/packages/agent/src/security/network-policy.js +85 -0
  474. package/packages/agent/src/server/index.d.ts +3 -0
  475. package/packages/agent/src/server/index.d.ts.map +1 -0
  476. package/packages/agent/src/server/index.js +1 -0
  477. package/packages/agent/src/services/agent-export.d.ts +100 -0
  478. package/packages/agent/src/services/agent-export.d.ts.map +1 -0
  479. package/packages/agent/src/services/agent-export.js +729 -0
  480. package/packages/agent/src/services/app-manager.d.ts +34 -0
  481. package/packages/agent/src/services/app-manager.d.ts.map +1 -0
  482. package/packages/agent/src/services/app-manager.js +425 -0
  483. package/packages/agent/src/services/browser-capture.d.ts +39 -0
  484. package/packages/agent/src/services/browser-capture.d.ts.map +1 -0
  485. package/packages/agent/src/services/browser-capture.js +162 -0
  486. package/packages/agent/src/services/coding-agent-context.d.ts +310 -0
  487. package/packages/agent/src/services/coding-agent-context.d.ts.map +1 -0
  488. package/packages/agent/src/services/coding-agent-context.js +281 -0
  489. package/packages/agent/src/services/fallback-training-service.d.ts +78 -0
  490. package/packages/agent/src/services/fallback-training-service.d.ts.map +1 -0
  491. package/packages/agent/src/services/fallback-training-service.js +126 -0
  492. package/packages/agent/src/services/index.d.ts +18 -0
  493. package/packages/agent/src/services/index.d.ts.map +1 -0
  494. package/packages/agent/src/services/index.js +17 -0
  495. package/packages/agent/src/services/mcp-marketplace.d.ts +89 -0
  496. package/packages/agent/src/services/mcp-marketplace.d.ts.map +1 -0
  497. package/packages/agent/src/services/mcp-marketplace.js +200 -0
  498. package/packages/agent/src/services/plugin-manager-types.d.ts +139 -0
  499. package/packages/agent/src/services/plugin-manager-types.d.ts.map +1 -0
  500. package/packages/agent/src/services/plugin-manager-types.js +18 -0
  501. package/packages/agent/src/services/privy-wallets.d.ts +18 -0
  502. package/packages/agent/src/services/privy-wallets.d.ts.map +1 -0
  503. package/packages/agent/src/services/privy-wallets.js +225 -0
  504. package/packages/agent/src/services/registry-client-app-meta.d.ts +6 -0
  505. package/packages/agent/src/services/registry-client-app-meta.d.ts.map +1 -0
  506. package/packages/agent/src/services/registry-client-app-meta.js +147 -0
  507. package/packages/agent/src/services/registry-client-endpoints.d.ts +7 -0
  508. package/packages/agent/src/services/registry-client-endpoints.d.ts.map +1 -0
  509. package/packages/agent/src/services/registry-client-endpoints.js +183 -0
  510. package/packages/agent/src/services/registry-client-local.d.ts +4 -0
  511. package/packages/agent/src/services/registry-client-local.d.ts.map +1 -0
  512. package/packages/agent/src/services/registry-client-local.js +377 -0
  513. package/packages/agent/src/services/registry-client-network.d.ts +9 -0
  514. package/packages/agent/src/services/registry-client-network.d.ts.map +1 -0
  515. package/packages/agent/src/services/registry-client-network.js +109 -0
  516. package/packages/agent/src/services/registry-client-queries.d.ts +15 -0
  517. package/packages/agent/src/services/registry-client-queries.d.ts.map +1 -0
  518. package/packages/agent/src/services/registry-client-queries.js +150 -0
  519. package/packages/agent/src/services/registry-client-types.d.ts +115 -0
  520. package/packages/agent/src/services/registry-client-types.d.ts.map +1 -0
  521. package/packages/agent/src/services/registry-client-types.js +1 -0
  522. package/packages/agent/src/services/registry-client.d.ts +39 -0
  523. package/packages/agent/src/services/registry-client.d.ts.map +1 -0
  524. package/packages/agent/src/services/registry-client.js +249 -0
  525. package/packages/agent/src/services/remote-signing-service.d.ts +58 -0
  526. package/packages/agent/src/services/remote-signing-service.d.ts.map +1 -0
  527. package/packages/agent/src/services/remote-signing-service.js +185 -0
  528. package/packages/agent/src/services/sandbox-engine.d.ts +96 -0
  529. package/packages/agent/src/services/sandbox-engine.d.ts.map +1 -0
  530. package/packages/agent/src/services/sandbox-engine.js +604 -0
  531. package/packages/agent/src/services/sandbox-manager.d.ts +104 -0
  532. package/packages/agent/src/services/sandbox-manager.d.ts.map +1 -0
  533. package/packages/agent/src/services/sandbox-manager.js +353 -0
  534. package/packages/agent/src/services/self-updater.d.ts +21 -0
  535. package/packages/agent/src/services/self-updater.d.ts.map +1 -0
  536. package/packages/agent/src/services/self-updater.js +162 -0
  537. package/packages/agent/src/services/signal-pairing.d.ts +37 -0
  538. package/packages/agent/src/services/signal-pairing.d.ts.map +1 -0
  539. package/packages/agent/src/services/signal-pairing.js +124 -0
  540. package/packages/agent/src/services/signing-policy.d.ts +44 -0
  541. package/packages/agent/src/services/signing-policy.d.ts.map +1 -0
  542. package/packages/agent/src/services/signing-policy.js +165 -0
  543. package/packages/agent/src/services/skill-catalog-client.d.ts +47 -0
  544. package/packages/agent/src/services/skill-catalog-client.d.ts.map +1 -0
  545. package/packages/agent/src/services/skill-catalog-client.js +130 -0
  546. package/packages/agent/src/services/skill-marketplace.d.ts +42 -0
  547. package/packages/agent/src/services/skill-marketplace.d.ts.map +1 -0
  548. package/packages/agent/src/services/skill-marketplace.js +680 -0
  549. package/packages/agent/src/services/stream-manager.d.ts +121 -0
  550. package/packages/agent/src/services/stream-manager.d.ts.map +1 -0
  551. package/packages/agent/src/services/stream-manager.js +604 -0
  552. package/packages/agent/src/services/tts-stream-bridge.d.ts +83 -0
  553. package/packages/agent/src/services/tts-stream-bridge.d.ts.map +1 -0
  554. package/packages/agent/src/services/tts-stream-bridge.js +349 -0
  555. package/packages/agent/src/services/update-checker.d.ts +29 -0
  556. package/packages/agent/src/services/update-checker.d.ts.map +1 -0
  557. package/packages/agent/src/services/update-checker.js +134 -0
  558. package/packages/agent/src/services/version-compat.d.ts +99 -0
  559. package/packages/agent/src/services/version-compat.d.ts.map +1 -0
  560. package/packages/agent/src/services/version-compat.js +195 -0
  561. package/packages/agent/src/services/whatsapp-pairing.d.ts +41 -0
  562. package/packages/agent/src/services/whatsapp-pairing.d.ts.map +1 -0
  563. package/packages/agent/src/services/whatsapp-pairing.js +209 -0
  564. package/packages/agent/src/shared/ui-catalog-prompt.d.ts +52 -0
  565. package/packages/agent/src/shared/ui-catalog-prompt.d.ts.map +1 -0
  566. package/packages/agent/src/shared/ui-catalog-prompt.js +1028 -0
  567. package/packages/agent/src/test-support/process-helpers.d.ts +13 -0
  568. package/packages/agent/src/test-support/process-helpers.d.ts.map +1 -0
  569. package/packages/agent/src/test-support/process-helpers.js +23 -0
  570. package/packages/agent/src/test-support/route-test-helpers.d.ts +37 -0
  571. package/packages/agent/src/test-support/route-test-helpers.d.ts.map +1 -0
  572. package/packages/agent/src/test-support/route-test-helpers.js +54 -0
  573. package/packages/agent/src/test-support/test-helpers.d.ts +77 -0
  574. package/packages/agent/src/test-support/test-helpers.d.ts.map +1 -0
  575. package/packages/agent/src/test-support/test-helpers.js +210 -0
  576. package/packages/agent/src/testing/index.d.ts +4 -0
  577. package/packages/agent/src/testing/index.d.ts.map +1 -0
  578. package/packages/agent/src/testing/index.js +3 -0
  579. package/packages/agent/src/triggers/action.d.ts +3 -0
  580. package/packages/agent/src/triggers/action.d.ts.map +1 -0
  581. package/packages/agent/src/triggers/action.js +267 -0
  582. package/packages/agent/src/triggers/runtime.d.ts +24 -0
  583. package/packages/agent/src/triggers/runtime.d.ts.map +1 -0
  584. package/packages/agent/src/triggers/runtime.js +322 -0
  585. package/packages/agent/src/triggers/scheduling.d.ts +70 -0
  586. package/packages/agent/src/triggers/scheduling.d.ts.map +1 -0
  587. package/packages/agent/src/triggers/scheduling.js +355 -0
  588. package/packages/agent/src/triggers/types.d.ts +115 -0
  589. package/packages/agent/src/triggers/types.d.ts.map +1 -0
  590. package/packages/agent/src/triggers/types.js +1 -0
  591. package/packages/agent/src/utils/exec-safety.d.ts +2 -0
  592. package/packages/agent/src/utils/exec-safety.d.ts.map +1 -0
  593. package/packages/agent/src/utils/exec-safety.js +21 -0
  594. package/packages/agent/src/utils/number-parsing.d.ts +26 -0
  595. package/packages/agent/src/utils/number-parsing.d.ts.map +1 -0
  596. package/packages/agent/src/utils/number-parsing.js +52 -0
  597. package/packages/agent/src/utils/spoken-text.d.ts +2 -0
  598. package/packages/agent/src/utils/spoken-text.d.ts.map +1 -0
  599. package/packages/agent/src/utils/spoken-text.js +56 -0
  600. package/packages/agent/src/version-resolver.d.ts +3 -0
  601. package/packages/agent/src/version-resolver.d.ts.map +1 -0
  602. package/packages/agent/src/version-resolver.js +51 -0
  603. package/jest.config.js +0 -17
  604. package/src/__tests__/client-type-identification.test.ts +0 -59
  605. package/src/defaultCharacter.ts +0 -530
  606. package/src/index.ts +0 -865
  607. package/tsconfig.json +0 -16
@@ -0,0 +1,34 @@
1
+ /**
2
+ * App Manager — manages app lifecycle: discover, install plugin, show viewer.
3
+ *
4
+ * Apps are hosted services. The manager's job is:
5
+ * 1. List/search apps from the registry
6
+ * 2. Install the game's plugin onto the agent (triggers restart)
7
+ * 3. Return the viewer URL so the UI can embed the game client in an iframe
8
+ *
9
+ * @module services/app-manager
10
+ */
11
+ import type { IAgentRuntime } from "@elizaos/core";
12
+ import type { AppLaunchResult, AppStopResult, InstalledAppInfo } from "../contracts/apps";
13
+ import type { InstallProgressLike, PluginManagerLike, RegistryPluginInfo, RegistrySearchResult } from "./plugin-manager-types";
14
+ export type { AppLaunchResult, AppStopResult, AppViewerAuthMessage, InstalledAppInfo, } from "../contracts/apps";
15
+ export declare class AppManager {
16
+ private readonly activeSessions;
17
+ listAvailable(pluginManager: PluginManagerLike): Promise<RegistryPluginInfo[]>;
18
+ search(pluginManager: PluginManagerLike, query: string, limit?: number): Promise<RegistrySearchResult[]>;
19
+ getInfo(pluginManager: PluginManagerLike, name: string): Promise<RegistryPluginInfo | null>;
20
+ /**
21
+ * Launch an app: install its plugin (if needed) and return the viewer URL.
22
+ *
23
+ * The plugin connects the agent to the game server. The viewer URL is what
24
+ * the UI shows in an iframe so the user can watch the agent play.
25
+ *
26
+ * After installing a new plugin, the agent needs to restart. The UI should
27
+ * handle this by showing "connecting..." while the runtime restarts.
28
+ */
29
+ launch(pluginManager: PluginManagerLike, name: string, onProgress?: (progress: InstallProgressLike) => void, _runtime?: IAgentRuntime | null): Promise<AppLaunchResult>;
30
+ stop(pluginManager: PluginManagerLike, name: string): Promise<AppStopResult>;
31
+ /** List apps whose plugins are currently installed on the agent. */
32
+ listInstalled(pluginManager: PluginManagerLike): Promise<InstalledAppInfo[]>;
33
+ }
34
+ //# sourceMappingURL=app-manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-manager.d.ts","sourceRoot":"","sources":["../../../../../src/services/app-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAGnD,OAAO,KAAK,EACV,eAAe,EACf,aAAa,EAEb,gBAAgB,EACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAEV,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACrB,MAAM,wBAAwB,CAAC;AAKhC,YAAY,EACV,eAAe,EACf,aAAa,EACb,oBAAoB,EACpB,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAmR3B,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAuC;IAEhE,aAAa,CACjB,aAAa,EAAE,iBAAiB,GAC/B,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAwC1B,MAAM,CACV,aAAa,EAAE,iBAAiB,EAChC,KAAK,EAAE,MAAM,EACb,KAAK,SAAK,GACT,OAAO,CAAC,oBAAoB,EAAE,CAAC;IAU5B,OAAO,CACX,aAAa,EAAE,iBAAiB,EAChC,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC;IAIrC;;;;;;;;OAQG;IACG,MAAM,CACV,aAAa,EAAE,iBAAiB,EAChC,IAAI,EAAE,MAAM,EACZ,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,mBAAmB,KAAK,IAAI,EACpD,QAAQ,CAAC,EAAE,aAAa,GAAG,IAAI,GAC9B,OAAO,CAAC,eAAe,CAAC;IAuGrB,IAAI,CACR,aAAa,EAAE,iBAAiB,EAChC,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,aAAa,CAAC;IAyDzB,oEAAoE;IAC9D,aAAa,CACjB,aAAa,EAAE,iBAAiB,GAC/B,OAAO,CAAC,gBAAgB,EAAE,CAAC;CAkB/B"}
@@ -0,0 +1,425 @@
1
+ /**
2
+ * App Manager — manages app lifecycle: discover, install plugin, show viewer.
3
+ *
4
+ * Apps are hosted services. The manager's job is:
5
+ * 1. List/search apps from the registry
6
+ * 2. Install the game's plugin onto the agent (triggers restart)
7
+ * 3. Return the viewer URL so the UI can embed the game client in an iframe
8
+ *
9
+ * @module services/app-manager
10
+ */
11
+ import * as fs from "node:fs";
12
+ import * as path from "node:path";
13
+ import { logger } from "@elizaos/core";
14
+ import { deriveEvmAddress, deriveSolanaAddress } from "../api/wallet";
15
+ import { getPluginInfo, getRegistryPlugins } from "./registry-client";
16
+ const LOCAL_PLUGINS_DIR = "plugins";
17
+ const DEFAULT_VIEWER_SANDBOX = "allow-scripts allow-same-origin allow-popups";
18
+ const RS_2004SCAPE_APP_NAME = "@elizaos/app-2004scape";
19
+ const RS_2004SCAPE_AUTH_MESSAGE_TYPE = "RS_2004SCAPE_AUTH";
20
+ const SAFE_APP_URL_PROTOCOLS = new Set(["http:", "https:"]);
21
+ const ALLOWED_APP_URL_TEMPLATE_KEYS = new Set([
22
+ // Public display identity only.
23
+ "BOT_NAME",
24
+ "RS_SDK_BOT_NAME",
25
+ ]);
26
+ function resolvePluginPackageName(appInfo) {
27
+ const npmPackage = appInfo.npm.package.trim();
28
+ return npmPackage && npmPackage.length > 0 ? npmPackage : appInfo.name;
29
+ }
30
+ function mergeAppMeta(appInfo, meta) {
31
+ if (!meta)
32
+ return;
33
+ appInfo.viewer = meta.viewer ?? appInfo.viewer;
34
+ appInfo.launchUrl = meta.launchUrl ?? appInfo.launchUrl;
35
+ appInfo.launchType = meta.launchType ?? appInfo.launchType;
36
+ appInfo.displayName = meta.displayName ?? appInfo.displayName;
37
+ appInfo.category = meta.category ?? appInfo.category;
38
+ appInfo.capabilities = meta.capabilities ?? appInfo.capabilities;
39
+ appInfo.icon = meta.icon ?? appInfo.icon;
40
+ }
41
+ function isAutoInstallable(appInfo) {
42
+ const supportsRuntime = appInfo.supports.v0 || appInfo.supports.v1 || appInfo.supports.v2;
43
+ const hasVersion = Boolean(appInfo.npm.v0Version || appInfo.npm.v1Version || appInfo.npm.v2Version);
44
+ return supportsRuntime && hasVersion;
45
+ }
46
+ /**
47
+ * Check if a plugin exists locally in the plugins/ directory.
48
+ * Local plugins don't need to be installed - they're already available.
49
+ */
50
+ function isLocalPlugin(appInfo) {
51
+ const pluginsDir = path.resolve(process.cwd(), LOCAL_PLUGINS_DIR);
52
+ if (!fs.existsSync(pluginsDir)) {
53
+ return false;
54
+ }
55
+ // Check for directory names that match the app
56
+ // E.g., @elizaos/app-babylon -> app-babylon
57
+ const bareName = appInfo.name.replace(/^@[^/]+\//, "");
58
+ const possibleDirs = [bareName, appInfo.name.replace("/", "-")];
59
+ for (const dirName of possibleDirs) {
60
+ const pluginPath = path.join(pluginsDir, dirName);
61
+ const pluginJsonPath = path.join(pluginPath, "elizaos.plugin.json");
62
+ if (fs.existsSync(pluginJsonPath)) {
63
+ return true;
64
+ }
65
+ }
66
+ return false;
67
+ }
68
+ function getTemplateFallbackValue(key) {
69
+ if (key === "RS_SDK_BOT_NAME") {
70
+ const runtimeBotName = process.env.BOT_NAME?.trim();
71
+ if (runtimeBotName && runtimeBotName.length > 0) {
72
+ return runtimeBotName;
73
+ }
74
+ return "testbot";
75
+ }
76
+ return undefined;
77
+ }
78
+ function substituteTemplateVars(raw) {
79
+ return raw.replace(/\{([A-Z0-9_]+)\}/g, (_full, key) => {
80
+ if (!ALLOWED_APP_URL_TEMPLATE_KEYS.has(key)) {
81
+ return getTemplateFallbackValue(key) ?? "";
82
+ }
83
+ const value = process.env[key];
84
+ if (value && value.trim().length > 0) {
85
+ return value.trim();
86
+ }
87
+ return getTemplateFallbackValue(key) ?? "";
88
+ });
89
+ }
90
+ function buildViewerUrl(baseUrl, embedParams) {
91
+ if (!embedParams || Object.keys(embedParams).length === 0) {
92
+ return substituteTemplateVars(baseUrl);
93
+ }
94
+ const resolvedBaseUrl = substituteTemplateVars(baseUrl);
95
+ const [beforeHash, hashPartRaw] = resolvedBaseUrl.split("#", 2);
96
+ const [pathPart, queryPartRaw] = beforeHash.split("?", 2);
97
+ const queryParams = new URLSearchParams(queryPartRaw ?? "");
98
+ for (const [key, rawValue] of Object.entries(embedParams)) {
99
+ queryParams.set(key, substituteTemplateVars(rawValue));
100
+ }
101
+ const query = queryParams.toString();
102
+ const hash = hashPartRaw ? `#${hashPartRaw}` : "";
103
+ return `${pathPart}${query.length > 0 ? `?${query}` : ""}${hash}`;
104
+ }
105
+ function normalizeSafeAppUrl(url) {
106
+ const trimmed = url.trim();
107
+ if (!trimmed)
108
+ return null;
109
+ if (trimmed.startsWith("/")) {
110
+ // Disallow protocol-relative form (`//evil.test`) which escapes same-origin.
111
+ return trimmed.startsWith("//") ? null : trimmed;
112
+ }
113
+ try {
114
+ const parsed = new URL(trimmed);
115
+ if (!SAFE_APP_URL_PROTOCOLS.has(parsed.protocol)) {
116
+ return null;
117
+ }
118
+ return trimmed;
119
+ }
120
+ catch {
121
+ return null;
122
+ }
123
+ }
124
+ function buildViewerAuthMessage(appName, postMessageAuth) {
125
+ if (!postMessageAuth)
126
+ return undefined;
127
+ // 2004scape auth - uses bot name and password from environment
128
+ if (appName === RS_2004SCAPE_APP_NAME) {
129
+ // Get username from RS_SDK_BOT_NAME or BOT_NAME, fallback to testbot
130
+ const username = process.env.RS_SDK_BOT_NAME?.trim() ||
131
+ process.env.BOT_NAME?.trim() ||
132
+ "testbot";
133
+ // Get password from RS_SDK_BOT_PASSWORD or BOT_PASSWORD
134
+ const password = process.env.RS_SDK_BOT_PASSWORD?.trim() ||
135
+ process.env.BOT_PASSWORD?.trim() ||
136
+ "";
137
+ return {
138
+ type: RS_2004SCAPE_AUTH_MESSAGE_TYPE,
139
+ authToken: username, // Using authToken field for username
140
+ sessionToken: password, // Using sessionToken field for password
141
+ };
142
+ }
143
+ return undefined;
144
+ }
145
+ function buildViewerConfig(appInfo, launchUrl) {
146
+ const viewerInfo = appInfo.viewer;
147
+ if (viewerInfo) {
148
+ const requestedPostMessageAuth = Boolean(viewerInfo.postMessageAuth);
149
+ const authMessage = buildViewerAuthMessage(appInfo.name, requestedPostMessageAuth);
150
+ const postMessageAuth = requestedPostMessageAuth && Boolean(authMessage);
151
+ if (requestedPostMessageAuth && !authMessage) {
152
+ logger.warn(`[app-manager] ${appInfo.name} requires postMessage auth but no auth payload was generated.`);
153
+ }
154
+ const viewerUrl = normalizeSafeAppUrl(buildViewerUrl(viewerInfo.url, viewerInfo.embedParams));
155
+ if (!viewerUrl) {
156
+ throw new Error(`Refusing to launch app "${appInfo.name}": unsafe viewer URL`);
157
+ }
158
+ return {
159
+ url: viewerUrl,
160
+ embedParams: viewerInfo.embedParams,
161
+ postMessageAuth,
162
+ sandbox: viewerInfo.sandbox ?? DEFAULT_VIEWER_SANDBOX,
163
+ authMessage,
164
+ };
165
+ }
166
+ if ((appInfo.launchType === "connect" || appInfo.launchType === "local") &&
167
+ launchUrl) {
168
+ const viewerUrl = normalizeSafeAppUrl(launchUrl);
169
+ if (!viewerUrl) {
170
+ throw new Error(`Refusing to launch app "${appInfo.name}": unsafe launch URL`);
171
+ }
172
+ return {
173
+ url: viewerUrl,
174
+ sandbox: DEFAULT_VIEWER_SANDBOX,
175
+ };
176
+ }
177
+ return null;
178
+ }
179
+ /**
180
+ * Get wallet addresses from agent runtime settings (character secrets).
181
+ * Falls back to process.env if runtime is not available.
182
+ */
183
+ function _getWalletAddressesFromRuntime(runtime) {
184
+ const PLACEHOLDER_RE = /^\[?\s*(REDACTED|PLACEHOLDER|TODO|CHANGEME|EMPTY)\s*]?$/i;
185
+ let evmAddress = null;
186
+ let solanaAddress = null;
187
+ // Try runtime settings first (character secrets), fall back to process.env
188
+ const evmKey = runtime?.getSetting?.("EVM_PRIVATE_KEY")?.trim() ||
189
+ process.env.EVM_PRIVATE_KEY?.trim();
190
+ if (evmKey && !PLACEHOLDER_RE.test(evmKey)) {
191
+ try {
192
+ evmAddress = deriveEvmAddress(evmKey);
193
+ }
194
+ catch (e) {
195
+ logger.warn(`[app-manager] Bad EVM key: ${e}`);
196
+ }
197
+ }
198
+ const solKey = runtime?.getSetting?.("SOLANA_PRIVATE_KEY")?.trim() || process.env.SOLANA_PRIVATE_KEY?.trim();
199
+ if (solKey && !PLACEHOLDER_RE.test(solKey)) {
200
+ try {
201
+ solanaAddress = deriveSolanaAddress(solKey);
202
+ }
203
+ catch (e) {
204
+ logger.warn(`[app-manager] Bad SOL key: ${e}`);
205
+ }
206
+ }
207
+ return { evmAddress, solanaAddress };
208
+ }
209
+ export class AppManager {
210
+ activeSessions = new Map();
211
+ async listAvailable(pluginManager) {
212
+ const registry = await pluginManager.refreshRegistry();
213
+ // Merge in local workspace app entries that are discovered by our
214
+ // registry-client but not by the elizaos
215
+ // plugin-manager service.
216
+ try {
217
+ const localRegistry = await getRegistryPlugins();
218
+ for (const [name, info] of localRegistry) {
219
+ if (!registry.has(name) && info.kind === "app") {
220
+ registry.set(name, info);
221
+ }
222
+ }
223
+ }
224
+ catch {
225
+ // local discovery is best-effort
226
+ }
227
+ // Include app packages: those with "/app-" in the name OR kind === "app"
228
+ const apps = Array.from(registry.values()).filter((plugin) => {
229
+ if (plugin.kind === "app")
230
+ return true;
231
+ const name = plugin.name.toLowerCase();
232
+ const npmPackage = plugin.npm.package.toLowerCase();
233
+ return name.includes("/app-") || npmPackage.includes("/app-");
234
+ });
235
+ // Flatten appMeta into top-level fields for the frontend
236
+ return apps.map((p) => {
237
+ const meta = p.appMeta;
238
+ if (!meta)
239
+ return p;
240
+ return {
241
+ ...p,
242
+ displayName: meta.displayName,
243
+ launchType: meta.launchType,
244
+ launchUrl: meta.launchUrl,
245
+ icon: meta.icon,
246
+ category: meta.category,
247
+ capabilities: meta.capabilities,
248
+ uiExtension: meta.uiExtension,
249
+ viewer: meta.viewer,
250
+ };
251
+ });
252
+ }
253
+ async search(pluginManager, query, limit = 15) {
254
+ const results = await pluginManager.searchRegistry(query, limit);
255
+ // Filter to only include app packages
256
+ return results.filter((result) => {
257
+ const name = result.name.toLowerCase();
258
+ const npmPackage = result.npmPackage.toLowerCase();
259
+ return name.includes("/app-") || npmPackage.includes("/app-");
260
+ });
261
+ }
262
+ async getInfo(pluginManager, name) {
263
+ return pluginManager.getRegistryPlugin(name);
264
+ }
265
+ /**
266
+ * Launch an app: install its plugin (if needed) and return the viewer URL.
267
+ *
268
+ * The plugin connects the agent to the game server. The viewer URL is what
269
+ * the UI shows in an iframe so the user can watch the agent play.
270
+ *
271
+ * After installing a new plugin, the agent needs to restart. The UI should
272
+ * handle this by showing "connecting..." while the runtime restarts.
273
+ */
274
+ async launch(pluginManager, name, onProgress, _runtime) {
275
+ let appInfo = (await pluginManager.getRegistryPlugin(name));
276
+ // Supplement with local registry metadata since the elizaos plugin-manager
277
+ // service doesn't include our local workspace app discovery.
278
+ try {
279
+ const localInfo = await getPluginInfo(name);
280
+ if (localInfo) {
281
+ const meta = localInfo.appMeta;
282
+ if (!appInfo) {
283
+ appInfo = { ...localInfo };
284
+ mergeAppMeta(appInfo, meta);
285
+ }
286
+ else if (meta && !appInfo.viewer) {
287
+ // Merge local metadata into existing registry entry
288
+ mergeAppMeta(appInfo, meta);
289
+ appInfo.kind = localInfo.kind ?? appInfo.kind;
290
+ }
291
+ }
292
+ }
293
+ catch {
294
+ // local lookup is best-effort
295
+ }
296
+ if (!appInfo) {
297
+ throw new Error(`App "${name}" not found in the registry.`);
298
+ }
299
+ // The app's plugin is what the agent needs to play the game.
300
+ // It's the same npm package name as the app, or a separate plugin ref.
301
+ const pluginName = resolvePluginPackageName(appInfo);
302
+ // Check if this is a local plugin (already present in plugins/ directory)
303
+ const isLocal = isLocalPlugin(appInfo);
304
+ // Check if the plugin is already installed
305
+ const installed = await pluginManager.listInstalledPlugins();
306
+ const alreadyInstalled = installed.some((p) => p.name === pluginName);
307
+ let pluginInstalled = alreadyInstalled || isLocal;
308
+ let needsRestart = false;
309
+ if (isLocal) {
310
+ // Local plugins are already available, no installation needed
311
+ logger.info(`[app-manager] Using local plugin for ${name}: ${pluginName}`);
312
+ }
313
+ else if (!alreadyInstalled) {
314
+ if (isAutoInstallable(appInfo)) {
315
+ logger.info(`[app-manager] Installing plugin for app: ${pluginName}`);
316
+ const result = await pluginManager.installPlugin(pluginName, onProgress);
317
+ if (!result.success) {
318
+ throw new Error(`Failed to install plugin "${pluginName}": ${result.error}`);
319
+ }
320
+ pluginInstalled = true;
321
+ needsRestart = result.requiresRestart;
322
+ logger.info(`[app-manager] Plugin installed: ${pluginName} v${result.version}`);
323
+ }
324
+ else {
325
+ logger.info(`[app-manager] Skipping plugin install for ${name}: no installable runtime package/version in registry metadata.`);
326
+ }
327
+ }
328
+ else {
329
+ logger.info(`[app-manager] Plugin already installed: ${pluginName}`);
330
+ }
331
+ // Build viewer config from registry app metadata
332
+ const resolvedLaunchUrl = appInfo.launchUrl
333
+ ? substituteTemplateVars(appInfo.launchUrl)
334
+ : null;
335
+ const launchUrl = resolvedLaunchUrl
336
+ ? normalizeSafeAppUrl(resolvedLaunchUrl)
337
+ : null;
338
+ if (resolvedLaunchUrl && !launchUrl) {
339
+ throw new Error(`Refusing to launch app "${appInfo.name}": unsafe launch URL`);
340
+ }
341
+ const viewer = buildViewerConfig(appInfo, launchUrl);
342
+ this.activeSessions.set(name, {
343
+ appName: name,
344
+ pluginName,
345
+ launchType: appInfo.launchType ?? "connect",
346
+ launchUrl,
347
+ viewerUrl: viewer?.url ?? null,
348
+ startedAt: new Date().toISOString(),
349
+ });
350
+ return {
351
+ pluginInstalled,
352
+ needsRestart,
353
+ displayName: appInfo.displayName ?? appInfo.name,
354
+ launchType: appInfo.launchType ?? "connect",
355
+ launchUrl,
356
+ viewer,
357
+ };
358
+ }
359
+ async stop(pluginManager, name) {
360
+ const appInfo = (await pluginManager.getRegistryPlugin(name));
361
+ if (!appInfo) {
362
+ throw new Error(`App "${name}" not found in the registry.`);
363
+ }
364
+ const hadSession = this.activeSessions.delete(name);
365
+ const pluginName = resolvePluginPackageName(appInfo);
366
+ const installed = await pluginManager.listInstalledPlugins();
367
+ const isPluginInstalled = installed.some((plugin) => plugin.name === pluginName);
368
+ if (!hadSession && !isPluginInstalled) {
369
+ return {
370
+ success: false,
371
+ appName: name,
372
+ stoppedAt: new Date().toISOString(),
373
+ pluginUninstalled: false,
374
+ needsRestart: false,
375
+ stopScope: "no-op",
376
+ message: `No active session or installed plugin found for "${name}".`,
377
+ };
378
+ }
379
+ if (isPluginInstalled) {
380
+ const uninstallResult = await pluginManager.uninstallPlugin(pluginName);
381
+ if (!uninstallResult.success) {
382
+ throw new Error(`Failed to stop "${name}": ${uninstallResult.error ?? "plugin uninstall failed"}`);
383
+ }
384
+ return {
385
+ success: true,
386
+ appName: name,
387
+ stoppedAt: new Date().toISOString(),
388
+ pluginUninstalled: true,
389
+ needsRestart: uninstallResult.requiresRestart,
390
+ stopScope: "plugin-uninstalled",
391
+ message: uninstallResult.requiresRestart
392
+ ? `${name} disconnected and plugin uninstalled. Agent restart required.`
393
+ : `${name} disconnected and plugin uninstalled.`,
394
+ };
395
+ }
396
+ return {
397
+ success: true,
398
+ appName: name,
399
+ stoppedAt: new Date().toISOString(),
400
+ pluginUninstalled: false,
401
+ needsRestart: false,
402
+ stopScope: "viewer-session",
403
+ message: `${name} viewer session stopped.`,
404
+ };
405
+ }
406
+ /** List apps whose plugins are currently installed on the agent. */
407
+ async listInstalled(pluginManager) {
408
+ const installed = await pluginManager.listInstalledPlugins();
409
+ // Filter to only include app plugins (by name convention or known game plugins)
410
+ const appPlugins = installed.filter((p) => {
411
+ const name = p.name.toLowerCase();
412
+ return name.includes("/app-");
413
+ });
414
+ return appPlugins.map((p) => ({
415
+ name: p.name,
416
+ displayName: p.name
417
+ .replace(/^@elizaos\/(app-|plugin-)/, "")
418
+ .replace(/-/g, " ")
419
+ .replace(/\b\w/g, (c) => c.toUpperCase()),
420
+ pluginName: p.name,
421
+ version: p.version ?? "unknown",
422
+ installedAt: new Date().toISOString(), // Ejected plugins don't track install time yet
423
+ }));
424
+ }
425
+ }
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Headless browser capture — opens the StreamView in headless Chrome and
3
+ * saves screenshots to a temp file. FFmpeg reads the temp file using
4
+ * -loop 1 to continuously re-read the latest frame.
5
+ *
6
+ * This approach avoids the pipe bottleneck — FFmpeg reads at its own
7
+ * pace while the browser updates the file independently.
8
+ *
9
+ * Visual parity with the desktop shell:
10
+ * - Appends `?popout` to the URL so the app renders StreamView directly
11
+ * (skips onboarding, auth gates, navigation chrome).
12
+ * - Enables SwiftShader for WebGL so VRM avatar renders identically.
13
+ * - Seeds localStorage with overlay layout, theme, and avatar index so
14
+ * the first rendered frame matches the configured appearance.
15
+ * - Uses `waitUntil: "networkidle0"` to ensure all assets load before capture.
16
+ * - Keeps CSS animations/transitions enabled for visual parity.
17
+ */
18
+ /** Path to the temp frame file that FFmpeg reads */
19
+ export declare const FRAME_FILE: string;
20
+ export interface BrowserCaptureConfig {
21
+ url: string;
22
+ width?: number;
23
+ height?: number;
24
+ fps?: number;
25
+ quality?: number;
26
+ /** Optional overlay layout JSON to seed into localStorage before page load. */
27
+ overlayLayout?: string;
28
+ /** Theme name to apply (e.g. "eliza", "haxor", "psycho"). */
29
+ theme?: string;
30
+ /** Avatar VRM index (1–8). */
31
+ avatarIndex?: number;
32
+ /** Destination ID — seeds the destination-specific localStorage key. */
33
+ destinationId?: string;
34
+ }
35
+ export declare function startBrowserCapture(config: BrowserCaptureConfig): Promise<void>;
36
+ export declare function stopBrowserCapture(): Promise<void>;
37
+ export declare function isBrowserCaptureRunning(): boolean;
38
+ export declare function hasFrameFile(): boolean;
39
+ //# sourceMappingURL=browser-capture.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser-capture.d.ts","sourceRoot":"","sources":["../../../../../src/services/browser-capture.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAiBH,oDAAoD;AACpD,eAAO,MAAM,UAAU,QAA2C,CAAC;AAEnE,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,+EAA+E;IAC/E,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,6DAA6D;IAC7D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8BAA8B;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wEAAwE;IACxE,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAgCD,wBAAsB,mBAAmB,CAAC,MAAM,EAAE,oBAAoB,iBAiHrE;AAED,wBAAsB,kBAAkB,kBASvC;AAED,wBAAgB,uBAAuB,IAAI,OAAO,CAEjD;AAED,wBAAgB,YAAY,IAAI,OAAO,CAEtC"}
@@ -0,0 +1,162 @@
1
+ /**
2
+ * Headless browser capture — opens the StreamView in headless Chrome and
3
+ * saves screenshots to a temp file. FFmpeg reads the temp file using
4
+ * -loop 1 to continuously re-read the latest frame.
5
+ *
6
+ * This approach avoids the pipe bottleneck — FFmpeg reads at its own
7
+ * pace while the browser updates the file independently.
8
+ *
9
+ * Visual parity with the desktop shell:
10
+ * - Appends `?popout` to the URL so the app renders StreamView directly
11
+ * (skips onboarding, auth gates, navigation chrome).
12
+ * - Enables SwiftShader for WebGL so VRM avatar renders identically.
13
+ * - Seeds localStorage with overlay layout, theme, and avatar index so
14
+ * the first rendered frame matches the configured appearance.
15
+ * - Uses `waitUntil: "networkidle0"` to ensure all assets load before capture.
16
+ * - Keeps CSS animations/transitions enabled for visual parity.
17
+ */
18
+ import { existsSync, writeFileSync } from "node:fs";
19
+ import { tmpdir } from "node:os";
20
+ import { join } from "node:path";
21
+ import puppeteer from "puppeteer-core";
22
+ const CHROME_PATH = process.platform === "darwin"
23
+ ? "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
24
+ : process.platform === "win32"
25
+ ? "C:\\Program Files\\Google Chrome\\Application\\chrome.exe"
26
+ : "/usr/bin/google-chrome-stable";
27
+ let activeBrowser = null;
28
+ let stopSignal = false;
29
+ /** Path to the temp frame file that FFmpeg reads */
30
+ export const FRAME_FILE = join(tmpdir(), "eliza-stream-frame.jpg");
31
+ /**
32
+ * Ensure the URL includes the `?popout` parameter so the app renders only
33
+ * StreamView, skipping startup gates and navigation chrome.
34
+ */
35
+ function ensurePopoutUrl(raw) {
36
+ try {
37
+ const u = new URL(raw);
38
+ // Handle both query and hash-based routing
39
+ if (u.hash?.includes("?")) {
40
+ if (!u.hash.includes("popout")) {
41
+ u.hash = `${u.hash}&popout`;
42
+ }
43
+ }
44
+ else if (u.hash) {
45
+ u.hash = `${u.hash}?popout`;
46
+ }
47
+ else if (!u.searchParams.has("popout")) {
48
+ u.searchParams.set("popout", "");
49
+ }
50
+ return u.toString();
51
+ }
52
+ catch {
53
+ // Fallback: just append
54
+ const sep = raw.includes("?") ? "&" : "?";
55
+ return `${raw}${sep}popout`;
56
+ }
57
+ }
58
+ export async function startBrowserCapture(config) {
59
+ if (activeBrowser) {
60
+ console.log("[browser-capture] Already running");
61
+ return;
62
+ }
63
+ const { url, width = 1280, height = 720, quality = 70 } = config;
64
+ const captureUrl = ensurePopoutUrl(url);
65
+ stopSignal = false;
66
+ console.log(`[browser-capture] Launching headless Chrome → ${captureUrl}`);
67
+ const browser = await puppeteer.launch({
68
+ executablePath: CHROME_PATH,
69
+ headless: true,
70
+ args: [
71
+ `--window-size=${width},${height}`,
72
+ "--no-sandbox",
73
+ "--disable-dev-shm-usage",
74
+ "--disable-extensions",
75
+ "--mute-audio",
76
+ // WebGL / SwiftShader — required for VRM avatar rendering parity
77
+ "--use-gl=swiftshader",
78
+ "--enable-webgl",
79
+ "--ignore-gpu-blocklist",
80
+ ],
81
+ });
82
+ activeBrowser = browser;
83
+ const page = await browser.newPage();
84
+ await page.setViewport({ width, height, deviceScaleFactor: 1 });
85
+ // Seed localStorage before navigation so the first render matches the desktop shell.
86
+ // Keys must match exactly what the React app reads:
87
+ // - "eliza:theme" → ThemeName
88
+ // - "eliza_avatar_index" → VRM index (1–8)
89
+ // - "eliza.stream.overlay-layout.v1[.destId]" → OverlayLayout JSON
90
+ await page.evaluateOnNewDocument((overlayLayout, theme, avatarIndex, destinationId) => {
91
+ if (overlayLayout) {
92
+ // Seed both global and destination-specific keys so the hook
93
+ // resolves correctly regardless of when activeDestination loads.
94
+ localStorage.setItem("eliza.stream.overlay-layout.v1", overlayLayout);
95
+ if (destinationId) {
96
+ localStorage.setItem(`eliza.stream.overlay-layout.v1.${destinationId}`, overlayLayout);
97
+ }
98
+ }
99
+ if (theme) {
100
+ localStorage.setItem("eliza:theme", theme);
101
+ }
102
+ if (avatarIndex != null) {
103
+ localStorage.setItem("eliza_avatar_index", String(avatarIndex));
104
+ }
105
+ }, config.overlayLayout, config.theme, config.avatarIndex, config.destinationId);
106
+ // Use networkidle0 so fonts, VRM models, and preview images finish loading
107
+ await page.goto(captureUrl, {
108
+ waitUntil: "networkidle0",
109
+ timeout: 60_000,
110
+ });
111
+ console.log(`[browser-capture] Page loaded, writing frames to ${FRAME_FILE}`);
112
+ // Use CDP screencast for efficient frame delivery
113
+ const cdp = await page.createCDPSession();
114
+ let frameCount = 0;
115
+ cdp.on("Page.screencastFrame", async (params) => {
116
+ if (stopSignal)
117
+ return;
118
+ try {
119
+ const buf = Buffer.from(params.data, "base64");
120
+ if (buf.length > 0) {
121
+ writeFileSync(FRAME_FILE, buf);
122
+ frameCount++;
123
+ if (frameCount % 100 === 0) {
124
+ console.log(`[browser-capture] ${frameCount} frames written`);
125
+ }
126
+ }
127
+ await cdp.send("Page.screencastFrameAck", {
128
+ sessionId: params.sessionId,
129
+ });
130
+ }
131
+ catch {
132
+ // Ignore
133
+ }
134
+ });
135
+ // Capture every frame from Chrome's compositor (~60fps internally,
136
+ // limited by everyNthFrame to ~15-30fps actual delivery)
137
+ await cdp.send("Page.startScreencast", {
138
+ format: "jpeg",
139
+ quality,
140
+ maxWidth: width,
141
+ maxHeight: height,
142
+ everyNthFrame: 2, // ~30fps from 60fps compositor
143
+ });
144
+ console.log(`[browser-capture] CDP screencast active, saving to ${FRAME_FILE}`);
145
+ }
146
+ export async function stopBrowserCapture() {
147
+ stopSignal = true;
148
+ if (activeBrowser) {
149
+ try {
150
+ await activeBrowser.close();
151
+ }
152
+ catch { }
153
+ activeBrowser = null;
154
+ }
155
+ console.log("[browser-capture] Stopped");
156
+ }
157
+ export function isBrowserCaptureRunning() {
158
+ return activeBrowser !== null;
159
+ }
160
+ export function hasFrameFile() {
161
+ return existsSync(FRAME_FILE);
162
+ }