@elizaos/agent 2.0.0-beta.2 → 2.0.3-beta.3

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 (2201) hide show
  1. package/__tests__/plugin-lifecycle-test-utils.d.ts +47 -0
  2. package/__tests__/plugin-lifecycle-test-utils.d.ts.map +1 -0
  3. package/__tests__/plugin-lifecycle-test-utils.js +81 -0
  4. package/__tests__/view-user-journeys.d.ts +55 -0
  5. package/__tests__/view-user-journeys.d.ts.map +1 -0
  6. package/__tests__/view-user-journeys.js +718 -0
  7. package/actions/compact-conversation.d.ts +3 -0
  8. package/actions/compact-conversation.d.ts.map +1 -0
  9. package/actions/compact-conversation.js +256 -0
  10. package/actions/connector-resolver.d.ts.map +1 -0
  11. package/actions/connector-resolver.js +250 -0
  12. package/actions/contact.d.ts.map +1 -0
  13. package/actions/contact.js +1700 -0
  14. package/actions/context-signal-lexicon.d.ts.map +1 -0
  15. package/actions/context-signal.d.ts +48 -0
  16. package/actions/context-signal.d.ts.map +1 -0
  17. package/actions/context-signal.js +153 -0
  18. package/actions/database.d.ts.map +1 -0
  19. package/actions/database.js +674 -0
  20. package/actions/extract-params.d.ts +87 -0
  21. package/actions/extract-params.d.ts.map +1 -0
  22. package/actions/extract-params.js +204 -0
  23. package/actions/files.d.ts +9 -0
  24. package/actions/files.d.ts.map +1 -0
  25. package/actions/files.js +183 -0
  26. package/actions/grounded-action-reply.d.ts.map +1 -0
  27. package/actions/grounded-action-reply.js +287 -0
  28. package/actions/index.d.ts +18 -0
  29. package/actions/index.d.ts.map +1 -0
  30. package/actions/index.js +17 -0
  31. package/actions/logs.d.ts.map +1 -0
  32. package/actions/memories.d.ts +3 -0
  33. package/actions/memories.d.ts.map +1 -0
  34. package/actions/memories.js +357 -0
  35. package/actions/notify.d.ts +14 -0
  36. package/actions/notify.d.ts.map +1 -0
  37. package/actions/notify.js +163 -0
  38. package/actions/page-action-groups.d.ts +9 -0
  39. package/actions/page-action-groups.d.ts.map +1 -0
  40. package/actions/page-action-groups.js +259 -0
  41. package/actions/plugin.d.ts +3 -0
  42. package/actions/plugin.d.ts.map +1 -0
  43. package/actions/plugin.js +755 -0
  44. package/actions/recent-conversation-texts.d.ts.map +1 -0
  45. package/actions/recent-conversation-texts.js +76 -0
  46. package/actions/runtime.d.ts.map +1 -0
  47. package/actions/runtime.js +517 -0
  48. package/actions/settings-actions.d.ts +19 -0
  49. package/actions/settings-actions.d.ts.map +1 -0
  50. package/actions/settings-actions.js +478 -0
  51. package/actions/terminal.d.ts.map +1 -0
  52. package/actions/terminal.js +327 -0
  53. package/actions/trigger.d.ts.map +1 -0
  54. package/actions/trigger.js +511 -0
  55. package/api/accounts-routes.d.ts +38 -0
  56. package/api/accounts-routes.d.ts.map +1 -0
  57. package/api/accounts-routes.js +932 -0
  58. package/api/agent-admin-routes.d.ts +36 -0
  59. package/api/agent-admin-routes.d.ts.map +1 -0
  60. package/api/agent-admin-routes.js +151 -0
  61. package/api/agent-lifecycle-routes.d.ts.map +1 -0
  62. package/api/agent-lifecycle-routes.js +104 -0
  63. package/api/agent-model.d.ts +5 -0
  64. package/api/agent-model.d.ts.map +1 -0
  65. package/api/agent-model.js +172 -0
  66. package/api/agent-status-routes.d.ts +73 -0
  67. package/api/agent-status-routes.d.ts.map +1 -0
  68. package/api/agent-status-routes.js +278 -0
  69. package/api/agent-transfer-routes.d.ts.map +1 -0
  70. package/api/agent-transfer-routes.js +124 -0
  71. package/api/app-package-routes.d.ts +3 -0
  72. package/api/app-package-routes.d.ts.map +1 -0
  73. package/api/app-package-routes.js +59 -0
  74. package/api/approval-routes.d.ts +38 -0
  75. package/api/approval-routes.d.ts.map +1 -0
  76. package/api/approval-routes.js +223 -0
  77. package/api/auth-routes.d.ts.map +1 -0
  78. package/api/auth-routes.js +126 -0
  79. package/api/avatar-routes.d.ts.map +1 -0
  80. package/api/avatar-routes.js +210 -0
  81. package/api/background-routes.d.ts +13 -0
  82. package/api/background-routes.d.ts.map +1 -0
  83. package/api/background-routes.js +91 -0
  84. package/api/background-tasks-routes.d.ts +18 -0
  85. package/api/background-tasks-routes.d.ts.map +1 -0
  86. package/api/background-tasks-routes.js +58 -0
  87. package/api/binance-skill-helpers.d.ts +21 -0
  88. package/api/binance-skill-helpers.d.ts.map +1 -0
  89. package/api/binance-skill-helpers.js +859 -0
  90. package/api/bug-report-routes.d.ts +10 -0
  91. package/api/bug-report-routes.d.ts.map +1 -0
  92. package/api/bug-report-routes.js +276 -0
  93. package/api/builtin-views.d.ts +11 -0
  94. package/api/builtin-views.d.ts.map +1 -0
  95. package/api/builtin-views.js +215 -0
  96. package/api/character-routes.d.ts +52 -0
  97. package/api/character-routes.d.ts.map +1 -0
  98. package/api/character-routes.js +380 -0
  99. package/api/chat-augmentation.d.ts +22 -0
  100. package/api/chat-augmentation.d.ts.map +1 -0
  101. package/api/chat-augmentation.js +366 -0
  102. package/api/chat-routes.d.ts +177 -0
  103. package/api/chat-routes.d.ts.map +1 -0
  104. package/api/chat-routes.js +2670 -0
  105. package/api/chat-text-helpers.d.ts.map +1 -0
  106. package/api/client-chat-admin.d.ts.map +1 -0
  107. package/api/commands-routes.d.ts +32 -0
  108. package/api/commands-routes.d.ts.map +1 -0
  109. package/api/commands-routes.js +57 -0
  110. package/api/compat-utils.d.ts.map +1 -0
  111. package/api/config-env.d.ts.map +1 -0
  112. package/api/config-env.js +283 -0
  113. package/api/config-routes.d.ts +40 -0
  114. package/api/config-routes.d.ts.map +1 -0
  115. package/api/config-routes.js +431 -0
  116. package/api/connector-account-routes.d.ts.map +1 -0
  117. package/api/connector-account-routes.js +740 -0
  118. package/api/connector-health.d.ts.map +1 -0
  119. package/api/connector-oauth-callback-auth.d.ts.map +1 -0
  120. package/api/connector-routes.d.ts +36 -0
  121. package/api/connector-routes.d.ts.map +1 -0
  122. package/api/connector-routes.js +198 -0
  123. package/api/conversation-metadata.d.ts +10 -0
  124. package/api/conversation-metadata.d.ts.map +1 -0
  125. package/api/conversation-metadata.js +117 -0
  126. package/api/conversation-routes.d.ts +65 -0
  127. package/api/conversation-routes.d.ts.map +1 -0
  128. package/api/conversation-routes.js +1828 -0
  129. package/api/coordinator-wiring.d.ts.map +1 -0
  130. package/api/coordinator-wiring.js +108 -0
  131. package/api/credit-detection.d.ts +16 -0
  132. package/api/credit-detection.d.ts.map +1 -0
  133. package/api/credit-detection.js +48 -0
  134. package/api/database.d.ts +33 -0
  135. package/api/database.d.ts.map +1 -0
  136. package/api/database.js +1026 -0
  137. package/api/diagnostics-routes.d.ts +51 -0
  138. package/api/diagnostics-routes.d.ts.map +1 -0
  139. package/api/diagnostics-routes.js +361 -0
  140. package/api/dispatch-route.d.ts +40 -0
  141. package/api/dispatch-route.d.ts.map +1 -0
  142. package/api/dispatch-route.js +387 -0
  143. package/api/documents-service-loader.d.ts +72 -0
  144. package/api/documents-service-loader.d.ts.map +1 -0
  145. package/api/documents-service-loader.js +34 -0
  146. package/api/early-logs.d.ts +24 -0
  147. package/api/early-logs.d.ts.map +1 -0
  148. package/api/files-routes.d.ts +14 -0
  149. package/api/files-routes.d.ts.map +1 -0
  150. package/api/files-routes.js +47 -0
  151. package/api/first-run-routes.d.ts +50 -0
  152. package/api/first-run-routes.d.ts.map +1 -0
  153. package/api/first-run-routes.js +570 -0
  154. package/api/health-routes.d.ts +58 -0
  155. package/api/health-routes.d.ts.map +1 -0
  156. package/api/health-routes.js +554 -0
  157. package/api/hono-adapter.d.ts +29 -0
  158. package/api/hono-adapter.d.ts.map +1 -0
  159. package/api/hono-adapter.js +170 -0
  160. package/api/hono-mount.d.ts +16 -0
  161. package/api/hono-mount.d.ts.map +1 -0
  162. package/api/hono-mount.js +121 -0
  163. package/api/inbox-routes.d.ts.map +1 -0
  164. package/api/inbox-routes.js +1587 -0
  165. package/api/index.d.ts +44 -0
  166. package/api/index.d.ts.map +1 -0
  167. package/api/index.js +53 -0
  168. package/api/interactions-routes.d.ts +33 -0
  169. package/api/interactions-routes.d.ts.map +1 -0
  170. package/api/interactions-routes.js +63 -0
  171. package/api/media-runtime.d.ts +37 -0
  172. package/api/media-runtime.d.ts.map +1 -0
  173. package/api/media-runtime.js +193 -0
  174. package/api/media-store.d.ts +122 -0
  175. package/api/media-store.d.ts.map +1 -0
  176. package/api/media-store.js +600 -0
  177. package/api/media-thumbnail.d.ts +22 -0
  178. package/api/media-thumbnail.d.ts.map +1 -0
  179. package/api/media-thumbnail.js +121 -0
  180. package/api/memory-bounds.d.ts +50 -0
  181. package/api/memory-bounds.d.ts.map +1 -0
  182. package/api/memory-bounds.js +80 -0
  183. package/api/memory-routes.d.ts.map +1 -0
  184. package/api/memory-routes.js +480 -0
  185. package/api/misc-routes.d.ts +64 -0
  186. package/api/misc-routes.d.ts.map +1 -0
  187. package/api/misc-routes.js +569 -0
  188. package/api/mobile-optional-routes.d.ts.map +1 -0
  189. package/api/mobile-optional-routes.js +258 -0
  190. package/api/model-provider-helpers.d.ts +70 -0
  191. package/api/model-provider-helpers.d.ts.map +1 -0
  192. package/api/model-provider-helpers.js +663 -0
  193. package/api/models-routes.d.ts.map +1 -0
  194. package/api/music-player-route-fallback.d.ts.map +1 -0
  195. package/api/notification-routes.d.ts +38 -0
  196. package/api/notification-routes.d.ts.map +1 -0
  197. package/api/notification-routes.js +169 -0
  198. package/api/owner-contact-helpers.d.ts.map +1 -0
  199. package/api/parse-action-block.d.ts +53 -0
  200. package/api/parse-action-block.d.ts.map +1 -0
  201. package/api/pending-request-map.d.ts +30 -0
  202. package/api/pending-request-map.d.ts.map +1 -0
  203. package/api/pending-request-map.js +40 -0
  204. package/api/permission-request-prompt.d.ts +19 -0
  205. package/api/permission-request-prompt.d.ts.map +1 -0
  206. package/api/permission-request-prompt.js +55 -0
  207. package/api/permissions-routes-extra.d.ts +28 -0
  208. package/api/permissions-routes-extra.d.ts.map +1 -0
  209. package/api/permissions-routes.d.ts +27 -0
  210. package/api/permissions-routes.d.ts.map +1 -0
  211. package/api/permissions-routes.js +469 -0
  212. package/api/platform-detect.d.ts +26 -0
  213. package/api/platform-detect.d.ts.map +1 -0
  214. package/api/platform-detect.js +40 -0
  215. package/api/plugin-discovery-helpers.d.ts +117 -0
  216. package/api/plugin-discovery-helpers.d.ts.map +1 -0
  217. package/api/plugin-discovery-helpers.js +1158 -0
  218. package/api/plugin-runtime-apply.d.ts +31 -0
  219. package/api/plugin-runtime-apply.d.ts.map +1 -0
  220. package/api/plugin-runtime-apply.js +291 -0
  221. package/api/plugin-validation.d.ts.map +1 -0
  222. package/api/provider-switch-config.d.ts +59 -0
  223. package/api/provider-switch-config.d.ts.map +1 -0
  224. package/api/provider-switch-config.js +804 -0
  225. package/api/provider-switch-routes.d.ts +29 -0
  226. package/api/provider-switch-routes.d.ts.map +1 -0
  227. package/api/provider-switch-routes.js +133 -0
  228. package/api/push-token-routes.d.ts +30 -0
  229. package/api/push-token-routes.d.ts.map +1 -0
  230. package/api/push-token-routes.js +83 -0
  231. package/api/rate-limiter.d.ts.map +1 -0
  232. package/api/registry-routes.d.ts +29 -0
  233. package/api/registry-routes.d.ts.map +1 -0
  234. package/api/registry-routes.js +98 -0
  235. package/api/registry-service.d.ts +77 -0
  236. package/api/registry-service.d.ts.map +1 -0
  237. package/api/registry-service.js +190 -0
  238. package/api/relationships-routes.d.ts.map +1 -0
  239. package/api/relationships-routes.js +286 -0
  240. package/api/remote-capability-routes.d.ts +26 -0
  241. package/api/remote-capability-routes.d.ts.map +1 -0
  242. package/api/remote-capability-routes.js +631 -0
  243. package/api/runtime-plugin-routes.d.ts.map +1 -0
  244. package/api/runtime-plugin-routes.js +251 -0
  245. package/api/runtime-ready-gate.d.ts +25 -0
  246. package/api/runtime-ready-gate.d.ts.map +1 -0
  247. package/api/runtime-ready-gate.js +35 -0
  248. package/api/server-autonomy-helpers.d.ts +5 -0
  249. package/api/server-autonomy-helpers.d.ts.map +1 -0
  250. package/api/server-helpers-auth.d.ts +72 -0
  251. package/api/server-helpers-auth.d.ts.map +1 -0
  252. package/api/server-helpers-auth.js +695 -0
  253. package/api/server-helpers-config.d.ts +37 -0
  254. package/api/server-helpers-config.d.ts.map +1 -0
  255. package/api/server-helpers-config.js +289 -0
  256. package/api/server-helpers-fetch.d.ts.map +1 -0
  257. package/api/server-helpers-mcp.d.ts +17 -0
  258. package/api/server-helpers-mcp.d.ts.map +1 -0
  259. package/api/server-helpers-mcp.js +60 -0
  260. package/api/server-helpers-plugin.d.ts +13 -0
  261. package/api/server-helpers-plugin.d.ts.map +1 -0
  262. package/api/server-helpers-swarm.d.ts +101 -0
  263. package/api/server-helpers-swarm.d.ts.map +1 -0
  264. package/api/server-helpers-swarm.js +656 -0
  265. package/api/server-helpers-wallet.d.ts +18 -0
  266. package/api/server-helpers-wallet.d.ts.map +1 -0
  267. package/api/server-helpers.d.ts +85 -0
  268. package/api/server-helpers.d.ts.map +1 -0
  269. package/api/server-helpers.js +676 -0
  270. package/api/server-lazy-routes.d.ts +90 -0
  271. package/api/server-lazy-routes.d.ts.map +1 -0
  272. package/api/server-lazy-routes.js +453 -0
  273. package/api/server-route-dispatch.d.ts +30 -0
  274. package/api/server-route-dispatch.d.ts.map +1 -0
  275. package/api/server-route-dispatch.js +134 -0
  276. package/api/server-types.d.ts +199 -0
  277. package/api/server-types.d.ts.map +1 -0
  278. package/api/server.d.ts +61 -0
  279. package/api/server.d.ts.map +1 -0
  280. package/api/server.js +3911 -0
  281. package/api/static-file-server.d.ts +19 -0
  282. package/api/static-file-server.d.ts.map +1 -0
  283. package/api/static-file-server.js +233 -0
  284. package/api/subscription-routes.d.ts +20 -0
  285. package/api/subscription-routes.d.ts.map +1 -0
  286. package/api/subscription-routes.js +293 -0
  287. package/api/suggestions-routes.d.ts +50 -0
  288. package/api/suggestions-routes.d.ts.map +1 -0
  289. package/api/suggestions-routes.js +300 -0
  290. package/api/task-agent-message-routing.d.ts.map +1 -0
  291. package/api/terminal-execution-routing.d.ts +14 -0
  292. package/api/terminal-execution-routing.d.ts.map +1 -0
  293. package/api/terminal-run-limits.d.ts.map +1 -0
  294. package/api/terminal-run-limits.js +20 -0
  295. package/api/trade-safety.d.ts +35 -0
  296. package/api/trade-safety.d.ts.map +1 -0
  297. package/api/trade-safety.js +65 -0
  298. package/api/training-backend-check.d.ts.map +1 -0
  299. package/api/training-service-like.d.ts +39 -0
  300. package/api/training-service-like.d.ts.map +1 -0
  301. package/api/trajectory-fallback-routes.d.ts +10 -0
  302. package/api/trajectory-fallback-routes.d.ts.map +1 -0
  303. package/api/trajectory-fallback-routes.js +180 -0
  304. package/api/tx-service.d.ts +53 -0
  305. package/api/tx-service.d.ts.map +1 -0
  306. package/api/tx-service.js +217 -0
  307. package/api/update-routes.d.ts +19 -0
  308. package/api/update-routes.d.ts.map +1 -0
  309. package/api/update-routes.js +69 -0
  310. package/api/view-registry-types.d.ts +52 -0
  311. package/api/view-registry-types.d.ts.map +1 -0
  312. package/api/view-registry-types.js +9 -0
  313. package/api/views-registry.d.ts +100 -0
  314. package/api/views-registry.d.ts.map +1 -0
  315. package/api/views-registry.js +495 -0
  316. package/api/views-routes.d.ts +66 -0
  317. package/api/views-routes.d.ts.map +1 -0
  318. package/api/views-routes.js +998 -0
  319. package/api/views-search-index.d.ts +56 -0
  320. package/api/views-search-index.d.ts.map +1 -0
  321. package/api/views-search-index.js +128 -0
  322. package/api/wallet-capability.d.ts +32 -0
  323. package/api/wallet-capability.d.ts.map +1 -0
  324. package/api/wallet-capability.js +192 -0
  325. package/api/wallet-dex-prices.d.ts.map +1 -0
  326. package/api/wallet-env-sync.d.ts +2 -0
  327. package/api/wallet-env-sync.d.ts.map +1 -0
  328. package/api/wallet-evm-balance.d.ts.map +1 -0
  329. package/api/wallet-keygen.d.ts +5 -0
  330. package/api/wallet-keygen.d.ts.map +1 -0
  331. package/api/wallet-keygen.js +67 -0
  332. package/api/wallet-rpc.d.ts +64 -0
  333. package/api/wallet-rpc.d.ts.map +1 -0
  334. package/api/wallet-rpc.js +440 -0
  335. package/api/wallet-trading-profile.d.ts.map +1 -0
  336. package/api/wallet-trading-profile.js +544 -0
  337. package/api/wallet.d.ts +64 -0
  338. package/api/wallet.d.ts.map +1 -0
  339. package/api/wallet.js +787 -0
  340. package/api/workbench-context.d.ts +48 -0
  341. package/api/workbench-context.d.ts.map +1 -0
  342. package/api/workbench-context.js +9 -0
  343. package/api/workbench-helpers.d.ts +39 -0
  344. package/api/workbench-helpers.d.ts.map +1 -0
  345. package/api/workbench-helpers.js +137 -0
  346. package/api/workbench-routes.d.ts +5 -0
  347. package/api/workbench-routes.d.ts.map +1 -0
  348. package/api/workbench-routes.js +283 -0
  349. package/api/workbench-vfs-routes.d.ts +3 -0
  350. package/api/workbench-vfs-routes.d.ts.map +1 -0
  351. package/api/workbench-vfs-routes.js +396 -0
  352. package/api/ws-event-replay.d.ts +63 -0
  353. package/api/ws-event-replay.d.ts.map +1 -0
  354. package/api/ws-event-replay.js +83 -0
  355. package/api/x-relay-routes.d.ts +27 -0
  356. package/api/x-relay-routes.d.ts.map +1 -0
  357. package/api/x-relay-routes.js +141 -0
  358. package/api/x402-route-validation.d.ts +4 -0
  359. package/api/x402-route-validation.d.ts.map +1 -0
  360. package/api/x402-route-validation.js +6 -0
  361. package/api/zip-utils.d.ts.map +1 -0
  362. package/assets/view-heroes/automations.png +0 -0
  363. package/assets/view-heroes/background.png +0 -0
  364. package/assets/view-heroes/camera.png +0 -0
  365. package/assets/view-heroes/character.png +0 -0
  366. package/assets/view-heroes/chat.png +0 -0
  367. package/assets/view-heroes/database.png +0 -0
  368. package/assets/view-heroes/help.png +0 -0
  369. package/assets/view-heroes/logs.png +0 -0
  370. package/assets/view-heroes/memories.png +0 -0
  371. package/assets/view-heroes/plugins-page.png +0 -0
  372. package/assets/view-heroes/settings.png +0 -0
  373. package/assets/view-heroes/trajectories.png +0 -0
  374. package/assets/view-heroes/transcripts.png +0 -0
  375. package/assets/view-heroes/tutorial.png +0 -0
  376. package/auth/account-storage.d.ts +35 -0
  377. package/auth/account-storage.d.ts.map +1 -0
  378. package/auth/account-storage.js +135 -0
  379. package/auth/anthropic.d.ts +24 -0
  380. package/auth/anthropic.d.ts.map +1 -0
  381. package/auth/claude-code-stealth.d.ts.map +1 -0
  382. package/auth/claude-code-stealth.js +114 -0
  383. package/auth/credentials.d.ts +131 -0
  384. package/auth/credentials.d.ts.map +1 -0
  385. package/auth/credentials.js +596 -0
  386. package/auth/index.d.ts +8 -0
  387. package/auth/index.d.ts.map +1 -0
  388. package/auth/oauth-flow.d.ts +106 -0
  389. package/auth/oauth-flow.d.ts.map +1 -0
  390. package/auth/oauth-flow.js +349 -0
  391. package/auth/openai-codex.d.ts +27 -0
  392. package/auth/openai-codex.d.ts.map +1 -0
  393. package/auth/openai-codex.js +84 -0
  394. package/auth/refresh-mutex.d.ts +24 -0
  395. package/auth/refresh-mutex.d.ts.map +1 -0
  396. package/auth/refresh-mutex.js +38 -0
  397. package/auth/types.d.ts +65 -0
  398. package/auth/types.d.ts.map +1 -0
  399. package/auth/types.js +157 -0
  400. package/auth/vendor/pi-oauth/anthropic-login.d.ts.map +1 -0
  401. package/auth/vendor/pi-oauth/anthropic-login.js +118 -0
  402. package/auth/vendor/pi-oauth/openai-codex-login.d.ts +28 -0
  403. package/auth/vendor/pi-oauth/openai-codex-login.d.ts.map +1 -0
  404. package/auth/vendor/pi-oauth/openai-codex-login.js +342 -0
  405. package/auth/vendor/pi-oauth/pkce.d.ts.map +1 -0
  406. package/awareness/index.d.ts +2 -0
  407. package/awareness/index.d.ts.map +1 -0
  408. package/awareness/registry.d.ts.map +1 -0
  409. package/bin.d.ts.map +1 -0
  410. package/bin.js +120 -0
  411. package/cli/benchmark.d.ts.map +1 -0
  412. package/cli/benchmark.js +305 -0
  413. package/cli/index.d.ts.map +1 -0
  414. package/cli/index.js +174 -0
  415. package/config/character-schema.d.ts.map +1 -0
  416. package/config/config.d.ts.map +1 -0
  417. package/config/config.js +287 -0
  418. package/config/env-vars.d.ts +9 -0
  419. package/config/env-vars.d.ts.map +1 -0
  420. package/config/env-vars.js +280 -0
  421. package/config/feature-flags.d.ts +26 -0
  422. package/config/feature-flags.d.ts.map +1 -0
  423. package/config/feature-flags.js +48 -0
  424. package/config/includes.d.ts +26 -0
  425. package/config/includes.d.ts.map +1 -0
  426. package/config/includes.js +151 -0
  427. package/config/index.d.ts +11 -0
  428. package/config/index.d.ts.map +1 -0
  429. package/config/model-metadata.d.ts +20 -0
  430. package/config/model-metadata.d.ts.map +1 -0
  431. package/config/model-metadata.js +133 -0
  432. package/config/owner-contacts.d.ts +42 -0
  433. package/config/owner-contacts.d.ts.map +1 -0
  434. package/config/owner-contacts.js +238 -0
  435. package/config/paths.d.ts +16 -0
  436. package/config/paths.d.ts.map +1 -0
  437. package/config/paths.js +61 -0
  438. package/config/plugin-auto-enable.d.ts.map +1 -0
  439. package/config/plugin-widgets.d.ts +26 -0
  440. package/config/plugin-widgets.d.ts.map +1 -0
  441. package/config/plugin-widgets.js +60 -0
  442. package/config/schema.d.ts +87 -0
  443. package/config/schema.d.ts.map +1 -0
  444. package/config/schema.js +928 -0
  445. package/config/telegram-custom-commands.d.ts.map +1 -0
  446. package/config/types.agent-defaults.d.ts.map +1 -0
  447. package/config/types.agents.d.ts.map +1 -0
  448. package/config/types.d.ts.map +1 -0
  449. package/config/types.eliza.d.ts.map +1 -0
  450. package/config/types.hooks.d.ts.map +1 -0
  451. package/config/types.messages.d.ts.map +1 -0
  452. package/config/zod-schema.agent-runtime.d.ts +1166 -0
  453. package/config/zod-schema.agent-runtime.d.ts.map +1 -0
  454. package/config/zod-schema.agent-runtime.js +810 -0
  455. package/config/zod-schema.core.d.ts +1279 -0
  456. package/config/zod-schema.core.d.ts.map +1 -0
  457. package/config/zod-schema.core.js +761 -0
  458. package/config/zod-schema.d.ts +3406 -0
  459. package/config/zod-schema.d.ts.map +1 -0
  460. package/config/zod-schema.hooks.d.ts.map +1 -0
  461. package/config/zod-schema.js +846 -0
  462. package/config/zod-schema.providers-core.d.ts +2752 -0
  463. package/config/zod-schema.providers-core.d.ts.map +1 -0
  464. package/config/zod-schema.providers-core.js +969 -0
  465. package/config/zod-schema.session.d.ts +183 -0
  466. package/config/zod-schema.session.d.ts.map +1 -0
  467. package/contracts/awareness.d.ts.map +1 -0
  468. package/diagnostics/integration-observability.d.ts.map +1 -0
  469. package/hooks/discovery.d.ts +13 -0
  470. package/hooks/discovery.d.ts.map +1 -0
  471. package/hooks/discovery.js +191 -0
  472. package/hooks/eligibility.d.ts +12 -0
  473. package/hooks/eligibility.d.ts.map +1 -0
  474. package/hooks/index.d.ts +3 -0
  475. package/hooks/index.d.ts.map +1 -0
  476. package/hooks/loader.d.ts +34 -0
  477. package/hooks/loader.d.ts.map +1 -0
  478. package/hooks/loader.js +214 -0
  479. package/hooks/registry.d.ts +11 -0
  480. package/hooks/registry.d.ts.map +1 -0
  481. package/hooks/types.d.ts.map +1 -0
  482. package/index.d.ts +99 -0
  483. package/index.d.ts.map +1 -0
  484. package/index.js +136 -0
  485. package/package.json +276 -72
  486. package/providers/admin-panel.d.ts.map +1 -0
  487. package/providers/admin-trust.d.ts.map +1 -0
  488. package/providers/automation-terminal-bridge.d.ts.map +1 -0
  489. package/providers/automation-terminal-bridge.js +77 -0
  490. package/providers/conversation-proximity.d.ts.map +1 -0
  491. package/providers/escalation-trigger.d.ts.map +1 -0
  492. package/providers/media-provider.d.ts +234 -0
  493. package/providers/media-provider.d.ts.map +1 -0
  494. package/providers/media-provider.js +1511 -0
  495. package/providers/page-scoped-context.d.ts.map +1 -0
  496. package/providers/page-scoped-context.js +482 -0
  497. package/providers/pending-permissions-provider.d.ts +19 -0
  498. package/providers/pending-permissions-provider.d.ts.map +1 -0
  499. package/providers/pending-permissions-provider.js +110 -0
  500. package/providers/recent-conversations.d.ts.map +1 -0
  501. package/providers/recent-conversations.js +100 -0
  502. package/providers/relevant-conversations.d.ts.map +1 -0
  503. package/providers/relevant-conversations.js +98 -0
  504. package/providers/role-backfill.d.ts +18 -0
  505. package/providers/role-backfill.d.ts.map +1 -0
  506. package/providers/role-backfill.js +86 -0
  507. package/providers/rolodex.d.ts.map +1 -0
  508. package/providers/rolodex.js +90 -0
  509. package/providers/session-bridge.d.ts.map +1 -0
  510. package/providers/session-bridge.js +71 -0
  511. package/providers/session-utils.d.ts +14 -0
  512. package/providers/session-utils.d.ts.map +1 -0
  513. package/providers/session-utils.js +24 -0
  514. package/providers/skill-provider.d.ts.map +1 -0
  515. package/providers/tasks.d.ts.map +1 -0
  516. package/providers/ui-catalog.d.ts.map +1 -0
  517. package/providers/ui-catalog.js +132 -0
  518. package/providers/user-name.d.ts.map +1 -0
  519. package/providers/workspace-provider.d.ts.map +1 -0
  520. package/providers/workspace-provider.js +183 -0
  521. package/providers/workspace.d.ts +53 -0
  522. package/providers/workspace.d.ts.map +1 -0
  523. package/providers/workspace.js +419 -0
  524. package/runtime/actions/web-fetch.d.ts +28 -0
  525. package/runtime/actions/web-fetch.d.ts.map +1 -0
  526. package/runtime/actions/web-fetch.js +210 -0
  527. package/runtime/actions/web-search.d.ts +32 -0
  528. package/runtime/actions/web-search.d.ts.map +1 -0
  529. package/runtime/actions/web-search.js +245 -0
  530. package/runtime/advanced-capabilities-config.d.ts +8 -0
  531. package/runtime/advanced-capabilities-config.d.ts.map +1 -0
  532. package/runtime/agent-event-service.d.ts.map +1 -0
  533. package/runtime/agent-wallets.d.ts +134 -0
  534. package/runtime/agent-wallets.d.ts.map +1 -0
  535. package/runtime/agent-wallets.js +317 -0
  536. package/runtime/android-app-plugins.d.ts +4 -0
  537. package/runtime/android-app-plugins.d.ts.map +1 -0
  538. package/runtime/android-app-plugins.js +40 -0
  539. package/runtime/boot-telemetry.d.ts +36 -0
  540. package/runtime/boot-telemetry.d.ts.map +1 -0
  541. package/runtime/boot-telemetry.js +198 -0
  542. package/runtime/boot-timer.d.ts +41 -0
  543. package/runtime/boot-timer.d.ts.map +1 -0
  544. package/runtime/boot-timer.js +42 -0
  545. package/runtime/build-character-config.d.ts.map +1 -0
  546. package/runtime/build-character-config.js +220 -0
  547. package/runtime/conversation-compactor-runtime.d.ts +164 -0
  548. package/runtime/conversation-compactor-runtime.d.ts.map +1 -0
  549. package/runtime/conversation-compactor-runtime.js +1114 -0
  550. package/runtime/conversation-compactor.d.ts +38 -0
  551. package/runtime/conversation-compactor.d.ts.map +1 -0
  552. package/runtime/conversation-compactor.js +1238 -0
  553. package/runtime/conversation-compactor.types.d.ts +102 -0
  554. package/runtime/conversation-compactor.types.d.ts.map +1 -0
  555. package/runtime/core-plugins.d.ts +142 -0
  556. package/runtime/core-plugins.d.ts.map +1 -0
  557. package/runtime/core-plugins.js +266 -0
  558. package/runtime/custom-actions.d.ts +80 -0
  559. package/runtime/custom-actions.d.ts.map +1 -0
  560. package/runtime/custom-actions.js +673 -0
  561. package/runtime/default-documents.d.ts +21 -0
  562. package/runtime/default-documents.d.ts.map +1 -0
  563. package/runtime/default-documents.js +283 -0
  564. package/runtime/eliza-plugin.d.ts.map +1 -0
  565. package/runtime/eliza-plugin.js +218 -0
  566. package/runtime/eliza.d.ts +138 -0
  567. package/runtime/eliza.d.ts.map +1 -0
  568. package/runtime/eliza.js +4394 -0
  569. package/runtime/first-run-names.d.ts +20 -0
  570. package/runtime/first-run-names.d.ts.map +1 -0
  571. package/runtime/first-run-names.js +104 -0
  572. package/runtime/first-time-setup.d.ts +49 -0
  573. package/runtime/first-time-setup.d.ts.map +1 -0
  574. package/runtime/first-time-setup.js +714 -0
  575. package/runtime/index.d.ts +19 -0
  576. package/runtime/index.d.ts.map +1 -0
  577. package/runtime/index.js +18 -0
  578. package/runtime/load-plugin-from-directory.d.ts +59 -0
  579. package/runtime/load-plugin-from-directory.d.ts.map +1 -0
  580. package/runtime/load-plugin-from-directory.js +143 -0
  581. package/runtime/load-plugin-from-vfs.d.ts +68 -0
  582. package/runtime/load-plugin-from-vfs.d.ts.map +1 -0
  583. package/runtime/load-plugin-from-vfs.js +100 -0
  584. package/runtime/local-execution-mode.d.ts +11 -0
  585. package/runtime/local-execution-mode.d.ts.map +1 -0
  586. package/runtime/mobile-dns.d.ts +18 -0
  587. package/runtime/mobile-dns.d.ts.map +1 -0
  588. package/runtime/mobile-dns.js +255 -0
  589. package/runtime/model-resolution.d.ts.map +1 -0
  590. package/runtime/model-resolution.js +55 -0
  591. package/runtime/native-runtime-features.d.ts.map +1 -0
  592. package/runtime/operations/classifier.d.ts +36 -0
  593. package/runtime/operations/classifier.d.ts.map +1 -0
  594. package/runtime/operations/classifier.js +72 -0
  595. package/runtime/operations/cold-strategy.d.ts +19 -0
  596. package/runtime/operations/cold-strategy.d.ts.map +1 -0
  597. package/runtime/operations/health-checks.d.ts +25 -0
  598. package/runtime/operations/health-checks.d.ts.map +1 -0
  599. package/runtime/operations/health.d.ts +32 -0
  600. package/runtime/operations/health.d.ts.map +1 -0
  601. package/runtime/operations/index.d.ts +17 -0
  602. package/runtime/operations/index.d.ts.map +1 -0
  603. package/runtime/operations/manager.d.ts +70 -0
  604. package/runtime/operations/manager.d.ts.map +1 -0
  605. package/runtime/operations/manager.js +210 -0
  606. package/runtime/operations/reload-hot.d.ts +43 -0
  607. package/runtime/operations/reload-hot.d.ts.map +1 -0
  608. package/runtime/operations/reload-hot.js +181 -0
  609. package/runtime/operations/repository.d.ts +66 -0
  610. package/runtime/operations/repository.d.ts.map +1 -0
  611. package/runtime/operations/types.d.ts.map +1 -0
  612. package/runtime/operations/vault-bridge.d.ts +81 -0
  613. package/runtime/operations/vault-bridge.d.ts.map +1 -0
  614. package/runtime/owner-entity.d.ts.map +1 -0
  615. package/runtime/owner-entity.js +34 -0
  616. package/runtime/pglite-error-compat.d.ts +27 -0
  617. package/runtime/pglite-error-compat.d.ts.map +1 -0
  618. package/runtime/pglite-error-compat.js +53 -0
  619. package/runtime/plugin-collector.d.ts +27 -0
  620. package/runtime/plugin-collector.d.ts.map +1 -0
  621. package/runtime/plugin-collector.js +592 -0
  622. package/runtime/plugin-lifecycle.d.ts +16 -0
  623. package/runtime/plugin-lifecycle.d.ts.map +1 -0
  624. package/runtime/plugin-lifecycle.js +654 -0
  625. package/runtime/plugin-resolver.d.ts +59 -0
  626. package/runtime/plugin-resolver.d.ts.map +1 -0
  627. package/runtime/plugin-resolver.js +1641 -0
  628. package/runtime/plugin-role-gating.d.ts +23 -0
  629. package/runtime/plugin-role-gating.d.ts.map +1 -0
  630. package/runtime/plugin-role-gating.js +172 -0
  631. package/runtime/plugin-types.d.ts +64 -0
  632. package/runtime/plugin-types.d.ts.map +1 -0
  633. package/runtime/plugin-types.js +310 -0
  634. package/runtime/prompt-compaction.d.ts +100 -0
  635. package/runtime/prompt-compaction.d.ts.map +1 -0
  636. package/runtime/prompt-compaction.js +395 -0
  637. package/runtime/prompt-optimization.d.ts +50 -0
  638. package/runtime/prompt-optimization.d.ts.map +1 -0
  639. package/runtime/prompt-optimization.js +1243 -0
  640. package/runtime/release-plugin-policy.d.ts.map +1 -0
  641. package/runtime/release-plugin-policy.js +115 -0
  642. package/runtime/remote-coding-runner-gate.d.ts +7 -0
  643. package/runtime/remote-coding-runner-gate.d.ts.map +1 -0
  644. package/runtime/remote-coding-runner-gate.js +36 -0
  645. package/runtime/roles/src/index.d.ts +24 -0
  646. package/runtime/roles/src/index.d.ts.map +1 -0
  647. package/runtime/roles/src/index.js +279 -0
  648. package/runtime/roles/src/provider.d.ts.map +1 -0
  649. package/runtime/roles/src/types.d.ts.map +1 -0
  650. package/runtime/roles/src/utils.d.ts.map +1 -0
  651. package/runtime/roles.d.ts +3 -0
  652. package/runtime/roles.d.ts.map +1 -0
  653. package/runtime/sandbox-character.d.ts +61 -0
  654. package/runtime/sandbox-character.d.ts.map +1 -0
  655. package/runtime/sandbox-character.js +193 -0
  656. package/runtime/sandbox-registry.d.ts +96 -0
  657. package/runtime/sandbox-registry.d.ts.map +1 -0
  658. package/runtime/sandbox-registry.js +346 -0
  659. package/runtime/tool-call-cache/cache.d.ts +62 -0
  660. package/runtime/tool-call-cache/cache.d.ts.map +1 -0
  661. package/runtime/tool-call-cache/cache.js +123 -0
  662. package/runtime/tool-call-cache/disk-store.d.ts +23 -0
  663. package/runtime/tool-call-cache/disk-store.d.ts.map +1 -0
  664. package/runtime/tool-call-cache/index.d.ts +7 -0
  665. package/runtime/tool-call-cache/index.d.ts.map +1 -0
  666. package/runtime/tool-call-cache/index.js +4 -0
  667. package/runtime/tool-call-cache/key.d.ts +11 -0
  668. package/runtime/tool-call-cache/key.d.ts.map +1 -0
  669. package/runtime/tool-call-cache/key.js +31 -0
  670. package/runtime/tool-call-cache/lru.d.ts.map +1 -0
  671. package/runtime/tool-call-cache/redact.d.ts +17 -0
  672. package/runtime/tool-call-cache/redact.d.ts.map +1 -0
  673. package/runtime/tool-call-cache/redact.js +77 -0
  674. package/runtime/tool-call-cache/registry.d.ts +18 -0
  675. package/runtime/tool-call-cache/registry.d.ts.map +1 -0
  676. package/runtime/tool-call-cache/registry.js +66 -0
  677. package/runtime/tool-call-cache/types.d.ts.map +1 -0
  678. package/runtime/tool-call-cache-wrapper.d.ts +37 -0
  679. package/runtime/tool-call-cache-wrapper.d.ts.map +1 -0
  680. package/runtime/tool-call-cache-wrapper.js +67 -0
  681. package/runtime/trajectory-export.d.ts +18 -0
  682. package/runtime/trajectory-export.d.ts.map +1 -0
  683. package/runtime/trajectory-export.js +132 -0
  684. package/runtime/trajectory-internals.d.ts +264 -0
  685. package/runtime/trajectory-internals.d.ts.map +1 -0
  686. package/runtime/trajectory-internals.js +1720 -0
  687. package/runtime/trajectory-persistence.d.ts +30 -0
  688. package/runtime/trajectory-persistence.d.ts.map +1 -0
  689. package/runtime/trajectory-persistence.js +47 -0
  690. package/runtime/trajectory-query.d.ts.map +1 -0
  691. package/runtime/trajectory-query.js +29 -0
  692. package/runtime/trajectory-steps-reader.d.ts +41 -0
  693. package/runtime/trajectory-steps-reader.d.ts.map +1 -0
  694. package/runtime/trajectory-steps-reader.js +129 -0
  695. package/runtime/trajectory-steps-writer.d.ts +35 -0
  696. package/runtime/trajectory-steps-writer.d.ts.map +1 -0
  697. package/runtime/trajectory-steps-writer.js +135 -0
  698. package/runtime/trajectory-storage.d.ts +103 -0
  699. package/runtime/trajectory-storage.d.ts.map +1 -0
  700. package/runtime/trajectory-storage.js +1174 -0
  701. package/runtime/vault-profile-resolver.d.ts +37 -0
  702. package/runtime/vault-profile-resolver.d.ts.map +1 -0
  703. package/runtime/vault-profile-resolver.js +79 -0
  704. package/runtime/version.d.ts.map +1 -0
  705. package/runtime/view-action-affinity.d.ts +156 -0
  706. package/runtime/view-action-affinity.d.ts.map +1 -0
  707. package/runtime/view-action-affinity.js +254 -0
  708. package/runtime/web-search-tools.d.ts +34 -0
  709. package/runtime/web-search-tools.d.ts.map +1 -0
  710. package/runtime/web-search-tools.js +198 -0
  711. package/security/access.d.ts.map +1 -0
  712. package/security/access.js +56 -0
  713. package/security/audit-log.d.ts.map +1 -0
  714. package/security/audit-log.js +165 -0
  715. package/security/index.d.ts +4 -0
  716. package/security/index.d.ts.map +1 -0
  717. package/security/mcp-server-config.d.ts +6 -0
  718. package/security/mcp-server-config.d.ts.map +1 -0
  719. package/security/mcp-server-config.js +358 -0
  720. package/security/network-policy.d.ts.map +1 -0
  721. package/services/agent-export.d.ts +100 -0
  722. package/services/agent-export.d.ts.map +1 -0
  723. package/services/agent-export.js +767 -0
  724. package/services/app-manager-agents-list-guard.d.ts.map +1 -0
  725. package/services/app-package-modules.d.ts +26 -0
  726. package/services/app-package-modules.d.ts.map +1 -0
  727. package/services/app-package-modules.js +451 -0
  728. package/services/app-session-gate.d.ts.map +1 -0
  729. package/services/app-session-gate.js +71 -0
  730. package/services/approval/index.d.ts +9 -0
  731. package/services/approval/index.d.ts.map +1 -0
  732. package/services/approval/index.js +8 -0
  733. package/services/approval/service.d.ts +35 -0
  734. package/services/approval/service.d.ts.map +1 -0
  735. package/services/approval/service.js +40 -0
  736. package/services/approval/sql.d.ts +18 -0
  737. package/services/approval/sql.d.ts.map +1 -0
  738. package/services/approval/sql.js +104 -0
  739. package/services/approval/store.d.ts +39 -0
  740. package/services/approval/store.d.ts.map +1 -0
  741. package/services/approval/store.js +534 -0
  742. package/services/approval/types.d.ts +207 -0
  743. package/services/approval/types.d.ts.map +1 -0
  744. package/services/approval/types.js +34 -0
  745. package/services/capability-broker.d.ts.map +1 -0
  746. package/services/capability-broker.js +339 -0
  747. package/services/character-history.d.ts.map +1 -0
  748. package/services/character-persistence.d.ts +25 -0
  749. package/services/character-persistence.d.ts.map +1 -0
  750. package/services/client-chat-sender.d.ts +19 -0
  751. package/services/client-chat-sender.d.ts.map +1 -0
  752. package/services/client-chat-sender.js +88 -0
  753. package/services/config-plugin-manager.d.ts +6 -0
  754. package/services/config-plugin-manager.d.ts.map +1 -0
  755. package/services/connector-setup-service.d.ts +48 -0
  756. package/services/connector-setup-service.d.ts.map +1 -0
  757. package/services/cove-quote-x509.d.ts +143 -0
  758. package/services/cove-quote-x509.d.ts.map +1 -0
  759. package/services/cove-quote-x509.js +424 -0
  760. package/services/cove-quote.d.ts +189 -0
  761. package/services/cove-quote.d.ts.map +1 -0
  762. package/services/cove-quote.js +455 -0
  763. package/services/dstack-tee-provider.d.ts +57 -0
  764. package/services/dstack-tee-provider.d.ts.map +1 -0
  765. package/services/dstack-tee-provider.js +180 -0
  766. package/services/e2b-capability-router.d.ts +139 -0
  767. package/services/e2b-capability-router.d.ts.map +1 -0
  768. package/services/e2b-capability-router.js +1239 -0
  769. package/services/escalation.d.ts.map +1 -0
  770. package/services/escalation.js +378 -0
  771. package/services/evm-signing-capability.d.ts +33 -0
  772. package/services/evm-signing-capability.d.ts.map +1 -0
  773. package/services/evm-signing-capability.js +52 -0
  774. package/services/external-bridge-state.d.ts +11 -0
  775. package/services/external-bridge-state.d.ts.map +1 -0
  776. package/services/external-bridge-state.js +15 -0
  777. package/services/file-storage.d.ts +20 -0
  778. package/services/file-storage.d.ts.map +1 -0
  779. package/services/file-storage.js +70 -0
  780. package/services/global-pause/index.d.ts +8 -0
  781. package/services/global-pause/index.d.ts.map +1 -0
  782. package/services/global-pause/index.js +7 -0
  783. package/services/global-pause/service.d.ts +29 -0
  784. package/services/global-pause/service.d.ts.map +1 -0
  785. package/services/global-pause/service.js +34 -0
  786. package/services/global-pause/store.d.ts +31 -0
  787. package/services/global-pause/store.d.ts.map +1 -0
  788. package/services/global-pause/store.js +83 -0
  789. package/services/handoff/index.d.ts +8 -0
  790. package/services/handoff/index.d.ts.map +1 -0
  791. package/services/handoff/index.js +7 -0
  792. package/services/handoff/service.d.ts +29 -0
  793. package/services/handoff/service.d.ts.map +1 -0
  794. package/services/handoff/service.js +34 -0
  795. package/services/handoff/store.d.ts +76 -0
  796. package/services/handoff/store.d.ts.map +1 -0
  797. package/services/handoff/store.js +148 -0
  798. package/services/hosted-tools.d.ts +77 -0
  799. package/services/hosted-tools.d.ts.map +1 -0
  800. package/services/hosted-tools.js +87 -0
  801. package/services/index.d.ts +31 -0
  802. package/services/index.d.ts.map +1 -0
  803. package/services/index.js +34 -0
  804. package/services/js-runtime-bridge.d.ts.map +1 -0
  805. package/services/js-runtime-bridge.js +222 -0
  806. package/services/knowledge-graph/entity-store.d.ts +94 -0
  807. package/services/knowledge-graph/entity-store.d.ts.map +1 -0
  808. package/services/knowledge-graph/entity-store.js +509 -0
  809. package/services/knowledge-graph/index.d.ts +12 -0
  810. package/services/knowledge-graph/index.d.ts.map +1 -0
  811. package/services/knowledge-graph/index.js +11 -0
  812. package/services/knowledge-graph/relationship-store.d.ts +58 -0
  813. package/services/knowledge-graph/relationship-store.d.ts.map +1 -0
  814. package/services/knowledge-graph/relationship-store.js +303 -0
  815. package/services/knowledge-graph/schema.d.ts +2070 -0
  816. package/services/knowledge-graph/schema.d.ts.map +1 -0
  817. package/services/knowledge-graph/schema.js +119 -0
  818. package/services/knowledge-graph/service.d.ts +35 -0
  819. package/services/knowledge-graph/service.d.ts.map +1 -0
  820. package/services/knowledge-graph/service.js +42 -0
  821. package/services/knowledge-graph/sql.d.ts +22 -0
  822. package/services/knowledge-graph/sql.d.ts.map +1 -0
  823. package/services/knowledge-graph/sql.js +142 -0
  824. package/services/mcp-marketplace.d.ts.map +1 -0
  825. package/services/mcp-marketplace.js +200 -0
  826. package/services/media-generation.d.ts +10 -0
  827. package/services/media-generation.d.ts.map +1 -0
  828. package/services/media-generation.js +102 -0
  829. package/services/overlay-app-presence.d.ts.map +1 -0
  830. package/services/owner-name.d.ts.map +1 -0
  831. package/services/pending-prompts/index.d.ts +8 -0
  832. package/services/pending-prompts/index.d.ts.map +1 -0
  833. package/services/pending-prompts/index.js +7 -0
  834. package/services/pending-prompts/service.d.ts +34 -0
  835. package/services/pending-prompts/service.d.ts.map +1 -0
  836. package/services/pending-prompts/service.js +68 -0
  837. package/services/pending-prompts/store.d.ts +70 -0
  838. package/services/pending-prompts/store.d.ts.map +1 -0
  839. package/services/pending-prompts/store.js +191 -0
  840. package/services/permissions/contracts.d.ts +2 -0
  841. package/services/permissions/contracts.d.ts.map +1 -0
  842. package/services/permissions/contracts.js +1 -0
  843. package/services/permissions/probers/_bridge.d.ts +112 -0
  844. package/services/permissions/probers/_bridge.d.ts.map +1 -0
  845. package/services/permissions/probers/_bridge.js +313 -0
  846. package/services/permissions/probers/accessibility.d.ts.map +1 -0
  847. package/services/permissions/probers/automation.d.ts +17 -0
  848. package/services/permissions/probers/automation.d.ts.map +1 -0
  849. package/services/permissions/probers/automation.js +44 -0
  850. package/services/permissions/probers/calendar.d.ts +6 -0
  851. package/services/permissions/probers/calendar.d.ts.map +1 -0
  852. package/services/permissions/probers/calendar.js +42 -0
  853. package/services/permissions/probers/camera.d.ts.map +1 -0
  854. package/services/permissions/probers/contacts.d.ts +9 -0
  855. package/services/permissions/probers/contacts.d.ts.map +1 -0
  856. package/services/permissions/probers/contacts.js +44 -0
  857. package/services/permissions/probers/full-disk.d.ts.map +1 -0
  858. package/services/permissions/probers/health.d.ts +23 -0
  859. package/services/permissions/probers/health.d.ts.map +1 -0
  860. package/services/permissions/probers/health.js +60 -0
  861. package/services/permissions/probers/index.d.ts.map +1 -0
  862. package/services/permissions/probers/index.js +44 -0
  863. package/services/permissions/probers/location.d.ts +13 -0
  864. package/services/permissions/probers/location.d.ts.map +1 -0
  865. package/services/permissions/probers/location.js +54 -0
  866. package/services/permissions/probers/microphone.d.ts.map +1 -0
  867. package/services/permissions/probers/native-platform.d.ts +3 -0
  868. package/services/permissions/probers/native-platform.d.ts.map +1 -0
  869. package/services/permissions/probers/native-platform.js +27 -0
  870. package/services/permissions/probers/notes.d.ts +18 -0
  871. package/services/permissions/probers/notes.d.ts.map +1 -0
  872. package/services/permissions/probers/notes.js +44 -0
  873. package/services/permissions/probers/notifications.d.ts +18 -0
  874. package/services/permissions/probers/notifications.d.ts.map +1 -0
  875. package/services/permissions/probers/notifications.js +53 -0
  876. package/services/permissions/probers/reminders.d.ts +9 -0
  877. package/services/permissions/probers/reminders.d.ts.map +1 -0
  878. package/services/permissions/probers/reminders.js +44 -0
  879. package/services/permissions/probers/screen-recording.d.ts.map +1 -0
  880. package/services/permissions/probers/screentime.d.ts +21 -0
  881. package/services/permissions/probers/screentime.d.ts.map +1 -0
  882. package/services/permissions/probers/screentime.js +55 -0
  883. package/services/permissions/probers/shell.d.ts +16 -0
  884. package/services/permissions/probers/shell.d.ts.map +1 -0
  885. package/services/permissions/probers/shell.js +28 -0
  886. package/services/permissions/probers/website-blocking.d.ts.map +1 -0
  887. package/services/permissions/register-probers.d.ts +13 -0
  888. package/services/permissions/register-probers.d.ts.map +1 -0
  889. package/services/permissions/register-probers.js +15 -0
  890. package/services/permissions-registry.d.ts.map +1 -0
  891. package/services/permissions-registry.js +209 -0
  892. package/services/plugin-compiler.d.ts +51 -0
  893. package/services/plugin-compiler.d.ts.map +1 -0
  894. package/services/plugin-compiler.js +168 -0
  895. package/services/plugin-installer.d.ts +93 -0
  896. package/services/plugin-installer.d.ts.map +1 -0
  897. package/services/plugin-installer.js +663 -0
  898. package/services/plugin-manager-types.d.ts +114 -0
  899. package/services/plugin-manager-types.d.ts.map +1 -0
  900. package/services/proactive-interaction-decider.d.ts +113 -0
  901. package/services/proactive-interaction-decider.d.ts.map +1 -0
  902. package/services/proactive-interaction-decider.js +333 -0
  903. package/services/proactive-interaction-gate.d.ts +70 -0
  904. package/services/proactive-interaction-gate.d.ts.map +1 -0
  905. package/services/proactive-interaction-gate.js +148 -0
  906. package/services/push/apns-provider.d.ts +58 -0
  907. package/services/push/apns-provider.d.ts.map +1 -0
  908. package/services/push/apns-provider.js +186 -0
  909. package/services/push/fcm-provider.d.ts +49 -0
  910. package/services/push/fcm-provider.d.ts.map +1 -0
  911. package/services/push/fcm-provider.js +206 -0
  912. package/services/push/notification-push-service.d.ts +58 -0
  913. package/services/push/notification-push-service.d.ts.map +1 -0
  914. package/services/push/notification-push-service.js +148 -0
  915. package/services/push/push-token-registry.d.ts +49 -0
  916. package/services/push/push-token-registry.d.ts.map +1 -0
  917. package/services/push/push-token-registry.js +91 -0
  918. package/services/push/push-types.d.ts +41 -0
  919. package/services/push/push-types.d.ts.map +1 -0
  920. package/services/push/push-types.js +16 -0
  921. package/services/registry-client-app-meta.d.ts +6 -0
  922. package/services/registry-client-app-meta.d.ts.map +1 -0
  923. package/services/registry-client-app-meta.js +153 -0
  924. package/services/registry-client-endpoints.d.ts +7 -0
  925. package/services/registry-client-endpoints.d.ts.map +1 -0
  926. package/services/registry-client-endpoints.js +199 -0
  927. package/services/registry-client-local.d.ts +4 -0
  928. package/services/registry-client-local.d.ts.map +1 -0
  929. package/services/registry-client-local.js +563 -0
  930. package/services/registry-client-network.d.ts +27 -0
  931. package/services/registry-client-network.d.ts.map +1 -0
  932. package/services/registry-client-network.js +211 -0
  933. package/services/registry-client-queries.d.ts +26 -0
  934. package/services/registry-client-queries.d.ts.map +1 -0
  935. package/services/registry-client-queries.js +216 -0
  936. package/services/registry-client-types.d.ts +133 -0
  937. package/services/registry-client-types.d.ts.map +1 -0
  938. package/services/registry-client-types.js +1 -0
  939. package/services/registry-client.d.ts +39 -0
  940. package/services/registry-client.d.ts.map +1 -0
  941. package/services/registry-client.js +292 -0
  942. package/services/relationships-graph.d.ts +13 -0
  943. package/services/relationships-graph.d.ts.map +1 -0
  944. package/services/relationships-graph.js +48 -0
  945. package/services/remote-capability-cloud-sandbox.d.ts +45 -0
  946. package/services/remote-capability-cloud-sandbox.d.ts.map +1 -0
  947. package/services/remote-capability-cloud-sandbox.js +253 -0
  948. package/services/remote-capability-endpoint-conformance.d.ts +60 -0
  949. package/services/remote-capability-endpoint-conformance.d.ts.map +1 -0
  950. package/services/remote-capability-endpoint-conformance.js +819 -0
  951. package/services/remote-capability-endpoint-provider.d.ts +54 -0
  952. package/services/remote-capability-endpoint-provider.d.ts.map +1 -0
  953. package/services/remote-capability-endpoint-provider.js +255 -0
  954. package/services/remote-capability-live-report.d.ts +19 -0
  955. package/services/remote-capability-live-report.d.ts.map +1 -0
  956. package/services/remote-capability-live-report.js +147 -0
  957. package/services/remote-capability-router.d.ts +49 -0
  958. package/services/remote-capability-router.d.ts.map +1 -0
  959. package/services/remote-capability-router.js +784 -0
  960. package/services/remote-capability-url-endpoint-providers.d.ts +17 -0
  961. package/services/remote-capability-url-endpoint-providers.d.ts.map +1 -0
  962. package/services/remote-capability-url-endpoint-providers.js +69 -0
  963. package/services/remote-plugin-adapter.d.ts +42 -0
  964. package/services/remote-plugin-adapter.d.ts.map +1 -0
  965. package/services/remote-plugin-adapter.js +1734 -0
  966. package/services/remote-plugin-bridge.d.ts +81 -0
  967. package/services/remote-plugin-bridge.d.ts.map +1 -0
  968. package/services/remote-plugin-bridge.js +669 -0
  969. package/services/remote-signing-service.d.ts +110 -0
  970. package/services/remote-signing-service.d.ts.map +1 -0
  971. package/services/remote-signing-service.js +264 -0
  972. package/services/research-task-executor.d.ts +14 -0
  973. package/services/research-task-executor.d.ts.map +1 -0
  974. package/services/research-task-executor.js +133 -0
  975. package/services/sandbox-engine.d.ts.map +1 -0
  976. package/services/sandbox-manager.d.ts +132 -0
  977. package/services/sandbox-manager.d.ts.map +1 -0
  978. package/services/sandbox-manager.js +440 -0
  979. package/services/self-updater.d.ts +38 -0
  980. package/services/self-updater.d.ts.map +1 -0
  981. package/services/self-updater.js +262 -0
  982. package/services/send-handler-availability.d.ts.map +1 -0
  983. package/services/send-handler-availability.js +23 -0
  984. package/services/shell-execution-router.d.ts +69 -0
  985. package/services/shell-execution-router.d.ts.map +1 -0
  986. package/services/shell-execution-router.js +346 -0
  987. package/services/signing-policy.d.ts +46 -0
  988. package/services/signing-policy.d.ts.map +1 -0
  989. package/services/task-executor.d.ts.map +1 -0
  990. package/services/tee-boot-gate-state.d.ts +29 -0
  991. package/services/tee-boot-gate-state.d.ts.map +1 -0
  992. package/services/tee-boot-gate-state.js +38 -0
  993. package/services/tee-boot-gate.d.ts +45 -0
  994. package/services/tee-boot-gate.d.ts.map +1 -0
  995. package/services/tee-boot-gate.js +80 -0
  996. package/services/tee-confidential-inference.d.ts +177 -0
  997. package/services/tee-confidential-inference.d.ts.map +1 -0
  998. package/services/tee-confidential-inference.js +254 -0
  999. package/services/tee-evidence.d.ts +46 -0
  1000. package/services/tee-evidence.d.ts.map +1 -0
  1001. package/services/tee-evidence.js +149 -0
  1002. package/services/tee-key-release.d.ts +100 -0
  1003. package/services/tee-key-release.d.ts.map +1 -0
  1004. package/services/tee-key-release.js +301 -0
  1005. package/services/tee-model-key-boot.d.ts +82 -0
  1006. package/services/tee-model-key-boot.d.ts.map +1 -0
  1007. package/services/tee-model-key-boot.js +99 -0
  1008. package/services/tee-policy.d.ts +31 -0
  1009. package/services/tee-policy.d.ts.map +1 -0
  1010. package/services/tee-policy.js +233 -0
  1011. package/services/tee-production-profile.d.ts +35 -0
  1012. package/services/tee-production-profile.d.ts.map +1 -0
  1013. package/services/tee-production-profile.js +64 -0
  1014. package/services/tee-release-policy.d.ts +18 -0
  1015. package/services/tee-release-policy.d.ts.map +1 -0
  1016. package/services/tee-release-policy.js +53 -0
  1017. package/services/tee-revocation.d.ts +60 -0
  1018. package/services/tee-revocation.d.ts.map +1 -0
  1019. package/services/tee-revocation.js +150 -0
  1020. package/services/tee-runtime-config.d.ts +9 -0
  1021. package/services/tee-runtime-config.d.ts.map +1 -0
  1022. package/services/tee-runtime-config.js +109 -0
  1023. package/services/tee-sealed-volume.d.ts +114 -0
  1024. package/services/tee-sealed-volume.d.ts.map +1 -0
  1025. package/services/tee-sealed-volume.js +161 -0
  1026. package/services/tee-signer-backend.d.ts +18 -0
  1027. package/services/tee-signer-backend.d.ts.map +1 -0
  1028. package/services/tee-signer-backend.js +26 -0
  1029. package/services/update-checker.d.ts +29 -0
  1030. package/services/update-checker.d.ts.map +1 -0
  1031. package/services/vault-signer-backend.d.ts +32 -0
  1032. package/services/vault-signer-backend.d.ts.map +1 -0
  1033. package/services/vault-signer-backend.js +57 -0
  1034. package/services/version-compat.d.ts.map +1 -0
  1035. package/services/version-compat.js +212 -0
  1036. package/services/vfs-builtin-shell.d.ts +17 -0
  1037. package/services/vfs-builtin-shell.d.ts.map +1 -0
  1038. package/services/vfs-builtin-shell.js +375 -0
  1039. package/services/vfs-git.d.ts +18 -0
  1040. package/services/vfs-git.d.ts.map +1 -0
  1041. package/services/vfs-git.js +315 -0
  1042. package/services/virtual-filesystem.d.ts +100 -0
  1043. package/services/virtual-filesystem.d.ts.map +1 -0
  1044. package/services/virtual-filesystem.js +482 -0
  1045. package/shared/conversation-format.d.ts.map +1 -0
  1046. package/shared/conversation-format.js +69 -0
  1047. package/shared/ui-catalog-prompt.d.ts.map +1 -0
  1048. package/shared/workspace-resolution.d.ts.map +1 -0
  1049. package/shared/workspace-resolution.js +82 -0
  1050. package/test-support/index.d.ts +4 -0
  1051. package/test-support/index.d.ts.map +1 -0
  1052. package/test-support/process-helpers.d.ts.map +1 -0
  1053. package/test-support/route-test-helpers.d.ts.map +1 -0
  1054. package/test-support/test-helpers.d.ts.map +1 -0
  1055. package/triggers/runtime.d.ts +30 -0
  1056. package/triggers/runtime.d.ts.map +1 -0
  1057. package/triggers/runtime.js +486 -0
  1058. package/triggers/scheduling.d.ts +59 -0
  1059. package/triggers/scheduling.d.ts.map +1 -0
  1060. package/triggers/scheduling.js +208 -0
  1061. package/triggers/types.d.ts +30 -0
  1062. package/triggers/types.d.ts.map +1 -0
  1063. package/tui/agent-terminal-tui.d.ts +14 -0
  1064. package/tui/agent-terminal-tui.d.ts.map +1 -0
  1065. package/tui/agent-terminal-tui.js +518 -0
  1066. package/tui/slash-commands.d.ts +107 -0
  1067. package/tui/slash-commands.d.ts.map +1 -0
  1068. package/tui/slash-commands.js +108 -0
  1069. package/tui/tui-enabled.d.ts +8 -0
  1070. package/tui/tui-enabled.d.ts.map +1 -0
  1071. package/tui/tui-enabled.js +17 -0
  1072. package/types/agent-skills.d.ts.map +1 -0
  1073. package/types/config-like.d.ts.map +1 -0
  1074. package/types/index.d.ts +4 -0
  1075. package/types/index.d.ts.map +1 -0
  1076. package/types/trajectory.d.ts +21 -0
  1077. package/types/trajectory.d.ts.map +1 -0
  1078. package/utils/atomic-json.d.ts.map +1 -0
  1079. package/utils/terminal-command.d.ts +10 -0
  1080. package/utils/terminal-command.d.ts.map +1 -0
  1081. package/utils/terminal-command.js +19 -0
  1082. package/version-resolver.d.ts.map +1 -0
  1083. package/packages/agent/src/actions/connector-resolver.d.ts.map +0 -1
  1084. package/packages/agent/src/actions/connector-resolver.js +0 -253
  1085. package/packages/agent/src/actions/contact.d.ts.map +0 -1
  1086. package/packages/agent/src/actions/contact.js +0 -1698
  1087. package/packages/agent/src/actions/context-signal-lexicon.d.ts.map +0 -1
  1088. package/packages/agent/src/actions/context-signal.d.ts +0 -48
  1089. package/packages/agent/src/actions/context-signal.d.ts.map +0 -1
  1090. package/packages/agent/src/actions/context-signal.js +0 -153
  1091. package/packages/agent/src/actions/database.d.ts.map +0 -1
  1092. package/packages/agent/src/actions/database.js +0 -671
  1093. package/packages/agent/src/actions/extract-page.d.ts +0 -3
  1094. package/packages/agent/src/actions/extract-page.d.ts.map +0 -1
  1095. package/packages/agent/src/actions/extract-page.js +0 -153
  1096. package/packages/agent/src/actions/extract-params.d.ts +0 -87
  1097. package/packages/agent/src/actions/extract-params.d.ts.map +0 -1
  1098. package/packages/agent/src/actions/extract-params.js +0 -187
  1099. package/packages/agent/src/actions/grounded-action-reply.d.ts.map +0 -1
  1100. package/packages/agent/src/actions/grounded-action-reply.js +0 -287
  1101. package/packages/agent/src/actions/index.d.ts +0 -22
  1102. package/packages/agent/src/actions/index.d.ts.map +0 -1
  1103. package/packages/agent/src/actions/index.js +0 -21
  1104. package/packages/agent/src/actions/logs.d.ts.map +0 -1
  1105. package/packages/agent/src/actions/media.d.ts +0 -9
  1106. package/packages/agent/src/actions/media.d.ts.map +0 -1
  1107. package/packages/agent/src/actions/media.js +0 -135
  1108. package/packages/agent/src/actions/memories.d.ts +0 -9
  1109. package/packages/agent/src/actions/memories.d.ts.map +0 -1
  1110. package/packages/agent/src/actions/memories.js +0 -369
  1111. package/packages/agent/src/actions/page-action-groups.d.ts +0 -17
  1112. package/packages/agent/src/actions/page-action-groups.d.ts.map +0 -1
  1113. package/packages/agent/src/actions/page-action-groups.js +0 -413
  1114. package/packages/agent/src/actions/plugin.d.ts +0 -32
  1115. package/packages/agent/src/actions/plugin.d.ts.map +0 -1
  1116. package/packages/agent/src/actions/plugin.js +0 -780
  1117. package/packages/agent/src/actions/recent-conversation-texts.d.ts.map +0 -1
  1118. package/packages/agent/src/actions/recent-conversation-texts.js +0 -76
  1119. package/packages/agent/src/actions/runtime.d.ts.map +0 -1
  1120. package/packages/agent/src/actions/runtime.js +0 -517
  1121. package/packages/agent/src/actions/settings-actions.d.ts +0 -19
  1122. package/packages/agent/src/actions/settings-actions.d.ts.map +0 -1
  1123. package/packages/agent/src/actions/settings-actions.js +0 -478
  1124. package/packages/agent/src/actions/skill-command.d.ts +0 -20
  1125. package/packages/agent/src/actions/skill-command.d.ts.map +0 -1
  1126. package/packages/agent/src/actions/skill-command.js +0 -170
  1127. package/packages/agent/src/actions/stream-control.d.ts +0 -20
  1128. package/packages/agent/src/actions/stream-control.d.ts.map +0 -1
  1129. package/packages/agent/src/actions/stream-control.js +0 -166
  1130. package/packages/agent/src/actions/terminal.d.ts.map +0 -1
  1131. package/packages/agent/src/actions/terminal.js +0 -305
  1132. package/packages/agent/src/actions/trajectories.d.ts +0 -8
  1133. package/packages/agent/src/actions/trajectories.d.ts.map +0 -1
  1134. package/packages/agent/src/actions/trajectories.js +0 -135
  1135. package/packages/agent/src/actions/trigger.d.ts.map +0 -1
  1136. package/packages/agent/src/actions/trigger.js +0 -514
  1137. package/packages/agent/src/api/accounts-routes.d.ts +0 -38
  1138. package/packages/agent/src/api/accounts-routes.d.ts.map +0 -1
  1139. package/packages/agent/src/api/accounts-routes.js +0 -927
  1140. package/packages/agent/src/api/agent-admin-routes.d.ts +0 -39
  1141. package/packages/agent/src/api/agent-admin-routes.d.ts.map +0 -1
  1142. package/packages/agent/src/api/agent-admin-routes.js +0 -190
  1143. package/packages/agent/src/api/agent-lifecycle-routes.d.ts.map +0 -1
  1144. package/packages/agent/src/api/agent-lifecycle-routes.js +0 -101
  1145. package/packages/agent/src/api/agent-model.d.ts +0 -5
  1146. package/packages/agent/src/api/agent-model.d.ts.map +0 -1
  1147. package/packages/agent/src/api/agent-model.js +0 -170
  1148. package/packages/agent/src/api/agent-status-routes.d.ts +0 -75
  1149. package/packages/agent/src/api/agent-status-routes.d.ts.map +0 -1
  1150. package/packages/agent/src/api/agent-status-routes.js +0 -264
  1151. package/packages/agent/src/api/agent-transfer-routes.d.ts.map +0 -1
  1152. package/packages/agent/src/api/agent-transfer-routes.js +0 -124
  1153. package/packages/agent/src/api/app-package-routes.d.ts +0 -7
  1154. package/packages/agent/src/api/app-package-routes.d.ts.map +0 -1
  1155. package/packages/agent/src/api/app-package-routes.js +0 -59
  1156. package/packages/agent/src/api/apps-routes.d.ts +0 -32
  1157. package/packages/agent/src/api/apps-routes.d.ts.map +0 -1
  1158. package/packages/agent/src/api/apps-routes.js +0 -998
  1159. package/packages/agent/src/api/auth-routes.d.ts.map +0 -1
  1160. package/packages/agent/src/api/auth-routes.js +0 -119
  1161. package/packages/agent/src/api/avatar-routes.d.ts.map +0 -1
  1162. package/packages/agent/src/api/avatar-routes.js +0 -205
  1163. package/packages/agent/src/api/binance-skill-helpers.d.ts +0 -21
  1164. package/packages/agent/src/api/binance-skill-helpers.d.ts.map +0 -1
  1165. package/packages/agent/src/api/binance-skill-helpers.js +0 -745
  1166. package/packages/agent/src/api/bug-report-routes.d.ts +0 -10
  1167. package/packages/agent/src/api/bug-report-routes.d.ts.map +0 -1
  1168. package/packages/agent/src/api/bug-report-routes.js +0 -271
  1169. package/packages/agent/src/api/build-variant-routes.d.ts +0 -27
  1170. package/packages/agent/src/api/build-variant-routes.d.ts.map +0 -1
  1171. package/packages/agent/src/api/build-variant-routes.js +0 -27
  1172. package/packages/agent/src/api/character-routes.d.ts +0 -52
  1173. package/packages/agent/src/api/character-routes.d.ts.map +0 -1
  1174. package/packages/agent/src/api/character-routes.js +0 -377
  1175. package/packages/agent/src/api/chat-augmentation.d.ts +0 -70
  1176. package/packages/agent/src/api/chat-augmentation.d.ts.map +0 -1
  1177. package/packages/agent/src/api/chat-augmentation.js +0 -464
  1178. package/packages/agent/src/api/chat-routes.d.ts +0 -124
  1179. package/packages/agent/src/api/chat-routes.d.ts.map +0 -1
  1180. package/packages/agent/src/api/chat-routes.js +0 -1841
  1181. package/packages/agent/src/api/chat-text-helpers.d.ts.map +0 -1
  1182. package/packages/agent/src/api/client-chat-admin.d.ts.map +0 -1
  1183. package/packages/agent/src/api/cloud-route-registry.d.ts +0 -22
  1184. package/packages/agent/src/api/cloud-route-registry.d.ts.map +0 -1
  1185. package/packages/agent/src/api/cloud-route-registry.js +0 -20
  1186. package/packages/agent/src/api/compat-utils.d.ts.map +0 -1
  1187. package/packages/agent/src/api/config-env.d.ts.map +0 -1
  1188. package/packages/agent/src/api/config-env.js +0 -284
  1189. package/packages/agent/src/api/config-routes.d.ts +0 -40
  1190. package/packages/agent/src/api/config-routes.d.ts.map +0 -1
  1191. package/packages/agent/src/api/config-routes.js +0 -429
  1192. package/packages/agent/src/api/connector-account-routes.d.ts.map +0 -1
  1193. package/packages/agent/src/api/connector-account-routes.js +0 -740
  1194. package/packages/agent/src/api/connector-health.d.ts.map +0 -1
  1195. package/packages/agent/src/api/connector-oauth-callback-auth.d.ts.map +0 -1
  1196. package/packages/agent/src/api/connector-routes.d.ts +0 -36
  1197. package/packages/agent/src/api/connector-routes.d.ts.map +0 -1
  1198. package/packages/agent/src/api/connector-routes.js +0 -184
  1199. package/packages/agent/src/api/conversation-metadata.d.ts +0 -10
  1200. package/packages/agent/src/api/conversation-metadata.d.ts.map +0 -1
  1201. package/packages/agent/src/api/conversation-metadata.js +0 -107
  1202. package/packages/agent/src/api/conversation-routes.d.ts +0 -43
  1203. package/packages/agent/src/api/conversation-routes.d.ts.map +0 -1
  1204. package/packages/agent/src/api/conversation-routes.js +0 -1208
  1205. package/packages/agent/src/api/coordinator-wiring.d.ts.map +0 -1
  1206. package/packages/agent/src/api/coordinator-wiring.js +0 -108
  1207. package/packages/agent/src/api/credit-detection.d.ts +0 -9
  1208. package/packages/agent/src/api/credit-detection.d.ts.map +0 -1
  1209. package/packages/agent/src/api/credit-detection.js +0 -47
  1210. package/packages/agent/src/api/curated-skills-routes.d.ts +0 -22
  1211. package/packages/agent/src/api/curated-skills-routes.d.ts.map +0 -1
  1212. package/packages/agent/src/api/curated-skills-routes.js +0 -295
  1213. package/packages/agent/src/api/database.d.ts +0 -35
  1214. package/packages/agent/src/api/database.d.ts.map +0 -1
  1215. package/packages/agent/src/api/database.js +0 -1140
  1216. package/packages/agent/src/api/diagnostics-routes.d.ts +0 -59
  1217. package/packages/agent/src/api/diagnostics-routes.d.ts.map +0 -1
  1218. package/packages/agent/src/api/diagnostics-routes.js +0 -365
  1219. package/packages/agent/src/api/documents-routes.d.ts +0 -9
  1220. package/packages/agent/src/api/documents-routes.d.ts.map +0 -1
  1221. package/packages/agent/src/api/documents-routes.js +0 -26
  1222. package/packages/agent/src/api/documents-service-loader.d.ts +0 -76
  1223. package/packages/agent/src/api/documents-service-loader.d.ts.map +0 -1
  1224. package/packages/agent/src/api/documents-service-loader.js +0 -36
  1225. package/packages/agent/src/api/early-logs.d.ts +0 -29
  1226. package/packages/agent/src/api/early-logs.d.ts.map +0 -1
  1227. package/packages/agent/src/api/health-routes.d.ts +0 -46
  1228. package/packages/agent/src/api/health-routes.d.ts.map +0 -1
  1229. package/packages/agent/src/api/health-routes.js +0 -450
  1230. package/packages/agent/src/api/inbox-routes.d.ts.map +0 -1
  1231. package/packages/agent/src/api/inbox-routes.js +0 -1579
  1232. package/packages/agent/src/api/index.d.ts +0 -46
  1233. package/packages/agent/src/api/index.d.ts.map +0 -1
  1234. package/packages/agent/src/api/index.js +0 -49
  1235. package/packages/agent/src/api/memory-bounds.d.ts +0 -51
  1236. package/packages/agent/src/api/memory-bounds.d.ts.map +0 -1
  1237. package/packages/agent/src/api/memory-bounds.js +0 -81
  1238. package/packages/agent/src/api/memory-routes.d.ts.map +0 -1
  1239. package/packages/agent/src/api/memory-routes.js +0 -474
  1240. package/packages/agent/src/api/misc-routes.d.ts +0 -64
  1241. package/packages/agent/src/api/misc-routes.d.ts.map +0 -1
  1242. package/packages/agent/src/api/misc-routes.js +0 -569
  1243. package/packages/agent/src/api/mobile-optional-routes.d.ts.map +0 -1
  1244. package/packages/agent/src/api/mobile-optional-routes.js +0 -91
  1245. package/packages/agent/src/api/model-provider-helpers.d.ts +0 -68
  1246. package/packages/agent/src/api/model-provider-helpers.d.ts.map +0 -1
  1247. package/packages/agent/src/api/model-provider-helpers.js +0 -623
  1248. package/packages/agent/src/api/models-routes.d.ts.map +0 -1
  1249. package/packages/agent/src/api/music-player-route-fallback.d.ts.map +0 -1
  1250. package/packages/agent/src/api/nfa-routes.d.ts +0 -6
  1251. package/packages/agent/src/api/nfa-routes.d.ts.map +0 -1
  1252. package/packages/agent/src/api/nfa-routes.js +0 -125
  1253. package/packages/agent/src/api/onboarding-routes.d.ts +0 -50
  1254. package/packages/agent/src/api/onboarding-routes.d.ts.map +0 -1
  1255. package/packages/agent/src/api/onboarding-routes.js +0 -588
  1256. package/packages/agent/src/api/owner-contact-helpers.d.ts.map +0 -1
  1257. package/packages/agent/src/api/parse-action-block.d.ts +0 -53
  1258. package/packages/agent/src/api/parse-action-block.d.ts.map +0 -1
  1259. package/packages/agent/src/api/permission-request-prompt.d.ts +0 -19
  1260. package/packages/agent/src/api/permission-request-prompt.d.ts.map +0 -1
  1261. package/packages/agent/src/api/permission-request-prompt.js +0 -53
  1262. package/packages/agent/src/api/permissions-routes-extra.d.ts +0 -30
  1263. package/packages/agent/src/api/permissions-routes-extra.d.ts.map +0 -1
  1264. package/packages/agent/src/api/permissions-routes.d.ts +0 -27
  1265. package/packages/agent/src/api/permissions-routes.d.ts.map +0 -1
  1266. package/packages/agent/src/api/permissions-routes.js +0 -352
  1267. package/packages/agent/src/api/plugin-discovery-helpers.d.ts +0 -147
  1268. package/packages/agent/src/api/plugin-discovery-helpers.d.ts.map +0 -1
  1269. package/packages/agent/src/api/plugin-discovery-helpers.js +0 -1118
  1270. package/packages/agent/src/api/plugin-routes.d.ts +0 -144
  1271. package/packages/agent/src/api/plugin-routes.d.ts.map +0 -1
  1272. package/packages/agent/src/api/plugin-routes.js +0 -1285
  1273. package/packages/agent/src/api/plugin-runtime-apply.d.ts +0 -31
  1274. package/packages/agent/src/api/plugin-runtime-apply.d.ts.map +0 -1
  1275. package/packages/agent/src/api/plugin-runtime-apply.js +0 -217
  1276. package/packages/agent/src/api/plugin-validation.d.ts.map +0 -1
  1277. package/packages/agent/src/api/provider-switch-config.d.ts +0 -62
  1278. package/packages/agent/src/api/provider-switch-config.d.ts.map +0 -1
  1279. package/packages/agent/src/api/provider-switch-config.js +0 -719
  1280. package/packages/agent/src/api/provider-switch-routes.d.ts +0 -29
  1281. package/packages/agent/src/api/provider-switch-routes.d.ts.map +0 -1
  1282. package/packages/agent/src/api/provider-switch-routes.js +0 -142
  1283. package/packages/agent/src/api/rate-limiter.d.ts.map +0 -1
  1284. package/packages/agent/src/api/registry-routes.d.ts +0 -29
  1285. package/packages/agent/src/api/registry-routes.d.ts.map +0 -1
  1286. package/packages/agent/src/api/registry-routes.js +0 -98
  1287. package/packages/agent/src/api/registry-service.d.ts +0 -77
  1288. package/packages/agent/src/api/registry-service.d.ts.map +0 -1
  1289. package/packages/agent/src/api/registry-service.js +0 -190
  1290. package/packages/agent/src/api/relationships-routes.d.ts.map +0 -1
  1291. package/packages/agent/src/api/relationships-routes.js +0 -287
  1292. package/packages/agent/src/api/runtime-plugin-routes.d.ts.map +0 -1
  1293. package/packages/agent/src/api/runtime-plugin-routes.js +0 -203
  1294. package/packages/agent/src/api/server-auth.d.ts +0 -46
  1295. package/packages/agent/src/api/server-auth.d.ts.map +0 -1
  1296. package/packages/agent/src/api/server-auth.js +0 -507
  1297. package/packages/agent/src/api/server-autonomy-helpers.d.ts +0 -5
  1298. package/packages/agent/src/api/server-autonomy-helpers.d.ts.map +0 -1
  1299. package/packages/agent/src/api/server-helpers-auth.d.ts +0 -41
  1300. package/packages/agent/src/api/server-helpers-auth.d.ts.map +0 -1
  1301. package/packages/agent/src/api/server-helpers-auth.js +0 -627
  1302. package/packages/agent/src/api/server-helpers-config.d.ts +0 -37
  1303. package/packages/agent/src/api/server-helpers-config.d.ts.map +0 -1
  1304. package/packages/agent/src/api/server-helpers-config.js +0 -293
  1305. package/packages/agent/src/api/server-helpers-fetch.d.ts.map +0 -1
  1306. package/packages/agent/src/api/server-helpers-mcp.d.ts +0 -12
  1307. package/packages/agent/src/api/server-helpers-mcp.d.ts.map +0 -1
  1308. package/packages/agent/src/api/server-helpers-mcp.js +0 -315
  1309. package/packages/agent/src/api/server-helpers-plugin.d.ts +0 -13
  1310. package/packages/agent/src/api/server-helpers-plugin.d.ts.map +0 -1
  1311. package/packages/agent/src/api/server-helpers-swarm.d.ts +0 -101
  1312. package/packages/agent/src/api/server-helpers-swarm.d.ts.map +0 -1
  1313. package/packages/agent/src/api/server-helpers-swarm.js +0 -646
  1314. package/packages/agent/src/api/server-helpers-wallet.d.ts +0 -18
  1315. package/packages/agent/src/api/server-helpers-wallet.d.ts.map +0 -1
  1316. package/packages/agent/src/api/server-helpers.d.ts +0 -96
  1317. package/packages/agent/src/api/server-helpers.d.ts.map +0 -1
  1318. package/packages/agent/src/api/server-helpers.js +0 -595
  1319. package/packages/agent/src/api/server-route-dispatch.d.ts +0 -30
  1320. package/packages/agent/src/api/server-route-dispatch.d.ts.map +0 -1
  1321. package/packages/agent/src/api/server-route-dispatch.js +0 -103
  1322. package/packages/agent/src/api/server-startup.d.ts +0 -16
  1323. package/packages/agent/src/api/server-startup.d.ts.map +0 -1
  1324. package/packages/agent/src/api/server-startup.js +0 -14
  1325. package/packages/agent/src/api/server-types.d.ts +0 -232
  1326. package/packages/agent/src/api/server-types.d.ts.map +0 -1
  1327. package/packages/agent/src/api/server-types.js +0 -6
  1328. package/packages/agent/src/api/server.d.ts +0 -61
  1329. package/packages/agent/src/api/server.d.ts.map +0 -1
  1330. package/packages/agent/src/api/server.js +0 -3215
  1331. package/packages/agent/src/api/skill-discovery-helpers.d.ts +0 -80
  1332. package/packages/agent/src/api/skill-discovery-helpers.d.ts.map +0 -1
  1333. package/packages/agent/src/api/skill-discovery-helpers.js +0 -385
  1334. package/packages/agent/src/api/skills-routes.d.ts +0 -32
  1335. package/packages/agent/src/api/skills-routes.d.ts.map +0 -1
  1336. package/packages/agent/src/api/skills-routes.js +0 -978
  1337. package/packages/agent/src/api/static-file-server.d.ts +0 -19
  1338. package/packages/agent/src/api/static-file-server.d.ts.map +0 -1
  1339. package/packages/agent/src/api/static-file-server.js +0 -234
  1340. package/packages/agent/src/api/subscription-routes.d.ts +0 -20
  1341. package/packages/agent/src/api/subscription-routes.d.ts.map +0 -1
  1342. package/packages/agent/src/api/subscription-routes.js +0 -261
  1343. package/packages/agent/src/api/task-agent-message-routing.d.ts.map +0 -1
  1344. package/packages/agent/src/api/terminal-execution-routing.d.ts +0 -14
  1345. package/packages/agent/src/api/terminal-execution-routing.d.ts.map +0 -1
  1346. package/packages/agent/src/api/terminal-run-limits.d.ts.map +0 -1
  1347. package/packages/agent/src/api/terminal-run-limits.js +0 -20
  1348. package/packages/agent/src/api/trade-safety.d.ts +0 -35
  1349. package/packages/agent/src/api/trade-safety.d.ts.map +0 -1
  1350. package/packages/agent/src/api/trade-safety.js +0 -62
  1351. package/packages/agent/src/api/training-backend-check.d.ts.map +0 -1
  1352. package/packages/agent/src/api/training-service-like.d.ts +0 -39
  1353. package/packages/agent/src/api/training-service-like.d.ts.map +0 -1
  1354. package/packages/agent/src/api/travel-provider-relay-routes.d.ts +0 -9
  1355. package/packages/agent/src/api/travel-provider-relay-routes.d.ts.map +0 -1
  1356. package/packages/agent/src/api/travel-provider-relay-routes.js +0 -143
  1357. package/packages/agent/src/api/tx-service.d.ts +0 -53
  1358. package/packages/agent/src/api/tx-service.d.ts.map +0 -1
  1359. package/packages/agent/src/api/tx-service.js +0 -217
  1360. package/packages/agent/src/api/update-routes.d.ts +0 -19
  1361. package/packages/agent/src/api/update-routes.d.ts.map +0 -1
  1362. package/packages/agent/src/api/update-routes.js +0 -54
  1363. package/packages/agent/src/api/wallet-capability.d.ts +0 -33
  1364. package/packages/agent/src/api/wallet-capability.d.ts.map +0 -1
  1365. package/packages/agent/src/api/wallet-capability.js +0 -193
  1366. package/packages/agent/src/api/wallet-dex-prices.d.ts.map +0 -1
  1367. package/packages/agent/src/api/wallet-env-sync.d.ts +0 -2
  1368. package/packages/agent/src/api/wallet-env-sync.d.ts.map +0 -1
  1369. package/packages/agent/src/api/wallet-evm-balance.d.ts.map +0 -1
  1370. package/packages/agent/src/api/wallet-routes.d.ts +0 -41
  1371. package/packages/agent/src/api/wallet-routes.d.ts.map +0 -1
  1372. package/packages/agent/src/api/wallet-routes.js +0 -848
  1373. package/packages/agent/src/api/wallet-rpc.d.ts +0 -64
  1374. package/packages/agent/src/api/wallet-rpc.d.ts.map +0 -1
  1375. package/packages/agent/src/api/wallet-rpc.js +0 -437
  1376. package/packages/agent/src/api/wallet-trading-profile.d.ts.map +0 -1
  1377. package/packages/agent/src/api/wallet-trading-profile.js +0 -544
  1378. package/packages/agent/src/api/wallet.d.ts +0 -64
  1379. package/packages/agent/src/api/wallet.d.ts.map +0 -1
  1380. package/packages/agent/src/api/wallet.js +0 -780
  1381. package/packages/agent/src/api/workbench-helpers.d.ts +0 -39
  1382. package/packages/agent/src/api/workbench-helpers.d.ts.map +0 -1
  1383. package/packages/agent/src/api/workbench-helpers.js +0 -137
  1384. package/packages/agent/src/api/workbench-routes.d.ts +0 -43
  1385. package/packages/agent/src/api/workbench-routes.d.ts.map +0 -1
  1386. package/packages/agent/src/api/workbench-routes.js +0 -265
  1387. package/packages/agent/src/api/x-relay-routes.d.ts +0 -27
  1388. package/packages/agent/src/api/x-relay-routes.d.ts.map +0 -1
  1389. package/packages/agent/src/api/x-relay-routes.js +0 -134
  1390. package/packages/agent/src/api/zip-utils.d.ts.map +0 -1
  1391. package/packages/agent/src/auth/account-storage.d.ts +0 -48
  1392. package/packages/agent/src/auth/account-storage.d.ts.map +0 -1
  1393. package/packages/agent/src/auth/account-storage.js +0 -229
  1394. package/packages/agent/src/auth/anthropic.d.ts +0 -24
  1395. package/packages/agent/src/auth/anthropic.d.ts.map +0 -1
  1396. package/packages/agent/src/auth/claude-code-stealth-preload.d.ts +0 -2
  1397. package/packages/agent/src/auth/claude-code-stealth-preload.d.ts.map +0 -1
  1398. package/packages/agent/src/auth/claude-code-stealth-preload.js +0 -2
  1399. package/packages/agent/src/auth/claude-code-stealth.d.ts.map +0 -1
  1400. package/packages/agent/src/auth/claude-code-stealth.js +0 -116
  1401. package/packages/agent/src/auth/credentials.d.ts +0 -100
  1402. package/packages/agent/src/auth/credentials.d.ts.map +0 -1
  1403. package/packages/agent/src/auth/credentials.js +0 -553
  1404. package/packages/agent/src/auth/index.d.ts +0 -8
  1405. package/packages/agent/src/auth/index.d.ts.map +0 -1
  1406. package/packages/agent/src/auth/oauth-flow.d.ts +0 -106
  1407. package/packages/agent/src/auth/oauth-flow.d.ts.map +0 -1
  1408. package/packages/agent/src/auth/oauth-flow.js +0 -349
  1409. package/packages/agent/src/auth/openai-codex.d.ts +0 -27
  1410. package/packages/agent/src/auth/openai-codex.d.ts.map +0 -1
  1411. package/packages/agent/src/auth/openai-codex.js +0 -76
  1412. package/packages/agent/src/auth/refresh-mutex.d.ts +0 -19
  1413. package/packages/agent/src/auth/refresh-mutex.d.ts.map +0 -1
  1414. package/packages/agent/src/auth/refresh-mutex.js +0 -33
  1415. package/packages/agent/src/auth/types.d.ts +0 -58
  1416. package/packages/agent/src/auth/types.d.ts.map +0 -1
  1417. package/packages/agent/src/auth/types.js +0 -149
  1418. package/packages/agent/src/auth/vendor/pi-oauth/anthropic-login.d.ts.map +0 -1
  1419. package/packages/agent/src/auth/vendor/pi-oauth/anthropic-login.js +0 -113
  1420. package/packages/agent/src/auth/vendor/pi-oauth/openai-codex-login.d.ts +0 -26
  1421. package/packages/agent/src/auth/vendor/pi-oauth/openai-codex-login.d.ts.map +0 -1
  1422. package/packages/agent/src/auth/vendor/pi-oauth/openai-codex-login.js +0 -343
  1423. package/packages/agent/src/auth/vendor/pi-oauth/pkce.d.ts.map +0 -1
  1424. package/packages/agent/src/autonomy/index.d.ts +0 -48
  1425. package/packages/agent/src/autonomy/index.d.ts.map +0 -1
  1426. package/packages/agent/src/autonomy/index.js +0 -344
  1427. package/packages/agent/src/awareness/index.d.ts +0 -2
  1428. package/packages/agent/src/awareness/index.d.ts.map +0 -1
  1429. package/packages/agent/src/awareness/registry.d.ts.map +0 -1
  1430. package/packages/agent/src/bin.d.ts.map +0 -1
  1431. package/packages/agent/src/bin.js +0 -51
  1432. package/packages/agent/src/cli/benchmark.d.ts.map +0 -1
  1433. package/packages/agent/src/cli/benchmark.js +0 -293
  1434. package/packages/agent/src/cli/index.d.ts.map +0 -1
  1435. package/packages/agent/src/cli/index.js +0 -94
  1436. package/packages/agent/src/cli/parse-duration.d.ts +0 -5
  1437. package/packages/agent/src/cli/parse-duration.d.ts.map +0 -1
  1438. package/packages/agent/src/cli/parse-duration.js +0 -27
  1439. package/packages/agent/src/config/character-schema.d.ts.map +0 -1
  1440. package/packages/agent/src/config/config.d.ts.map +0 -1
  1441. package/packages/agent/src/config/config.js +0 -285
  1442. package/packages/agent/src/config/env-vars.d.ts +0 -9
  1443. package/packages/agent/src/config/env-vars.d.ts.map +0 -1
  1444. package/packages/agent/src/config/env-vars.js +0 -281
  1445. package/packages/agent/src/config/feature-flags.d.ts +0 -17
  1446. package/packages/agent/src/config/feature-flags.d.ts.map +0 -1
  1447. package/packages/agent/src/config/feature-flags.js +0 -37
  1448. package/packages/agent/src/config/includes.d.ts +0 -26
  1449. package/packages/agent/src/config/includes.d.ts.map +0 -1
  1450. package/packages/agent/src/config/includes.js +0 -149
  1451. package/packages/agent/src/config/index.d.ts +0 -11
  1452. package/packages/agent/src/config/index.d.ts.map +0 -1
  1453. package/packages/agent/src/config/model-metadata.d.ts +0 -20
  1454. package/packages/agent/src/config/model-metadata.d.ts.map +0 -1
  1455. package/packages/agent/src/config/model-metadata.js +0 -133
  1456. package/packages/agent/src/config/owner-contacts.d.ts +0 -42
  1457. package/packages/agent/src/config/owner-contacts.d.ts.map +0 -1
  1458. package/packages/agent/src/config/owner-contacts.js +0 -238
  1459. package/packages/agent/src/config/paths.d.ts +0 -17
  1460. package/packages/agent/src/config/paths.d.ts.map +0 -1
  1461. package/packages/agent/src/config/paths.js +0 -65
  1462. package/packages/agent/src/config/plugin-auto-enable.d.ts.map +0 -1
  1463. package/packages/agent/src/config/plugin-widgets.d.ts +0 -29
  1464. package/packages/agent/src/config/plugin-widgets.d.ts.map +0 -1
  1465. package/packages/agent/src/config/plugin-widgets.js +0 -104
  1466. package/packages/agent/src/config/schema.d.ts +0 -87
  1467. package/packages/agent/src/config/schema.d.ts.map +0 -1
  1468. package/packages/agent/src/config/schema.js +0 -928
  1469. package/packages/agent/src/config/telegram-custom-commands.d.ts.map +0 -1
  1470. package/packages/agent/src/config/types.agent-defaults.d.ts.map +0 -1
  1471. package/packages/agent/src/config/types.agents.d.ts.map +0 -1
  1472. package/packages/agent/src/config/types.d.ts.map +0 -1
  1473. package/packages/agent/src/config/types.eliza.d.ts.map +0 -1
  1474. package/packages/agent/src/config/types.gateway.d.ts +0 -2
  1475. package/packages/agent/src/config/types.gateway.d.ts.map +0 -1
  1476. package/packages/agent/src/config/types.gateway.js +0 -1
  1477. package/packages/agent/src/config/types.hooks.d.ts.map +0 -1
  1478. package/packages/agent/src/config/types.messages.d.ts.map +0 -1
  1479. package/packages/agent/src/config/types.tools.d.ts +0 -2
  1480. package/packages/agent/src/config/types.tools.d.ts.map +0 -1
  1481. package/packages/agent/src/config/types.tools.js +0 -1
  1482. package/packages/agent/src/config/zod-schema.agent-runtime.d.ts +0 -1164
  1483. package/packages/agent/src/config/zod-schema.agent-runtime.d.ts.map +0 -1
  1484. package/packages/agent/src/config/zod-schema.agent-runtime.js +0 -808
  1485. package/packages/agent/src/config/zod-schema.core.d.ts +0 -1279
  1486. package/packages/agent/src/config/zod-schema.core.d.ts.map +0 -1
  1487. package/packages/agent/src/config/zod-schema.core.js +0 -761
  1488. package/packages/agent/src/config/zod-schema.d.ts +0 -3404
  1489. package/packages/agent/src/config/zod-schema.d.ts.map +0 -1
  1490. package/packages/agent/src/config/zod-schema.hooks.d.ts.map +0 -1
  1491. package/packages/agent/src/config/zod-schema.js +0 -846
  1492. package/packages/agent/src/config/zod-schema.providers-core.d.ts +0 -2752
  1493. package/packages/agent/src/config/zod-schema.providers-core.d.ts.map +0 -1
  1494. package/packages/agent/src/config/zod-schema.providers-core.js +0 -969
  1495. package/packages/agent/src/config/zod-schema.session.d.ts +0 -183
  1496. package/packages/agent/src/config/zod-schema.session.d.ts.map +0 -1
  1497. package/packages/agent/src/contracts/awareness.d.ts.map +0 -1
  1498. package/packages/agent/src/contracts/index.d.ts +0 -2
  1499. package/packages/agent/src/contracts/index.d.ts.map +0 -1
  1500. package/packages/agent/src/contracts/index.js +0 -1
  1501. package/packages/agent/src/contracts/onboarding-provider-defaults.d.ts +0 -177
  1502. package/packages/agent/src/contracts/onboarding-provider-defaults.d.ts.map +0 -1
  1503. package/packages/agent/src/contracts/onboarding-provider-defaults.js +0 -202
  1504. package/packages/agent/src/diagnostics/index.d.ts +0 -2
  1505. package/packages/agent/src/diagnostics/index.d.ts.map +0 -1
  1506. package/packages/agent/src/diagnostics/index.js +0 -1
  1507. package/packages/agent/src/diagnostics/integration-observability.d.ts.map +0 -1
  1508. package/packages/agent/src/hooks/discovery.d.ts +0 -13
  1509. package/packages/agent/src/hooks/discovery.d.ts.map +0 -1
  1510. package/packages/agent/src/hooks/discovery.js +0 -191
  1511. package/packages/agent/src/hooks/eligibility.d.ts +0 -12
  1512. package/packages/agent/src/hooks/eligibility.d.ts.map +0 -1
  1513. package/packages/agent/src/hooks/index.d.ts +0 -3
  1514. package/packages/agent/src/hooks/index.d.ts.map +0 -1
  1515. package/packages/agent/src/hooks/loader.d.ts +0 -34
  1516. package/packages/agent/src/hooks/loader.d.ts.map +0 -1
  1517. package/packages/agent/src/hooks/loader.js +0 -214
  1518. package/packages/agent/src/hooks/registry.d.ts +0 -11
  1519. package/packages/agent/src/hooks/registry.d.ts.map +0 -1
  1520. package/packages/agent/src/hooks/types.d.ts.map +0 -1
  1521. package/packages/agent/src/index.d.ts +0 -73
  1522. package/packages/agent/src/index.d.ts.map +0 -1
  1523. package/packages/agent/src/index.js +0 -104
  1524. package/packages/agent/src/providers/admin-panel.d.ts.map +0 -1
  1525. package/packages/agent/src/providers/admin-trust.d.ts.map +0 -1
  1526. package/packages/agent/src/providers/automation-terminal-bridge.d.ts.map +0 -1
  1527. package/packages/agent/src/providers/automation-terminal-bridge.js +0 -77
  1528. package/packages/agent/src/providers/conversation-proximity.d.ts.map +0 -1
  1529. package/packages/agent/src/providers/escalation-trigger.d.ts.map +0 -1
  1530. package/packages/agent/src/providers/index.d.ts +0 -19
  1531. package/packages/agent/src/providers/index.d.ts.map +0 -1
  1532. package/packages/agent/src/providers/index.js +0 -18
  1533. package/packages/agent/src/providers/local-models.d.ts +0 -118
  1534. package/packages/agent/src/providers/local-models.d.ts.map +0 -1
  1535. package/packages/agent/src/providers/local-models.js +0 -418
  1536. package/packages/agent/src/providers/media-provider.d.ts +0 -233
  1537. package/packages/agent/src/providers/media-provider.d.ts.map +0 -1
  1538. package/packages/agent/src/providers/media-provider.js +0 -1474
  1539. package/packages/agent/src/providers/page-scoped-context.d.ts.map +0 -1
  1540. package/packages/agent/src/providers/page-scoped-context.js +0 -551
  1541. package/packages/agent/src/providers/pending-permissions-provider.d.ts +0 -19
  1542. package/packages/agent/src/providers/pending-permissions-provider.d.ts.map +0 -1
  1543. package/packages/agent/src/providers/pending-permissions-provider.js +0 -104
  1544. package/packages/agent/src/providers/recent-conversations.d.ts.map +0 -1
  1545. package/packages/agent/src/providers/recent-conversations.js +0 -100
  1546. package/packages/agent/src/providers/relevant-conversations.d.ts.map +0 -1
  1547. package/packages/agent/src/providers/relevant-conversations.js +0 -99
  1548. package/packages/agent/src/providers/role-backfill.d.ts +0 -18
  1549. package/packages/agent/src/providers/role-backfill.d.ts.map +0 -1
  1550. package/packages/agent/src/providers/role-backfill.js +0 -86
  1551. package/packages/agent/src/providers/rolodex.d.ts.map +0 -1
  1552. package/packages/agent/src/providers/rolodex.js +0 -83
  1553. package/packages/agent/src/providers/self-status.d.ts +0 -4
  1554. package/packages/agent/src/providers/self-status.d.ts.map +0 -1
  1555. package/packages/agent/src/providers/self-status.js +0 -22
  1556. package/packages/agent/src/providers/session-bridge.d.ts.map +0 -1
  1557. package/packages/agent/src/providers/session-bridge.js +0 -90
  1558. package/packages/agent/src/providers/session-utils.d.ts +0 -20
  1559. package/packages/agent/src/providers/session-utils.d.ts.map +0 -1
  1560. package/packages/agent/src/providers/session-utils.js +0 -32
  1561. package/packages/agent/src/providers/simple-mode.d.ts +0 -4
  1562. package/packages/agent/src/providers/simple-mode.d.ts.map +0 -1
  1563. package/packages/agent/src/providers/simple-mode.js +0 -49
  1564. package/packages/agent/src/providers/skill-provider.d.ts.map +0 -1
  1565. package/packages/agent/src/providers/tasks.d.ts.map +0 -1
  1566. package/packages/agent/src/providers/ui-catalog.d.ts.map +0 -1
  1567. package/packages/agent/src/providers/ui-catalog.js +0 -100
  1568. package/packages/agent/src/providers/user-name.d.ts.map +0 -1
  1569. package/packages/agent/src/providers/workspace-provider.d.ts.map +0 -1
  1570. package/packages/agent/src/providers/workspace-provider.js +0 -183
  1571. package/packages/agent/src/providers/workspace.d.ts +0 -53
  1572. package/packages/agent/src/providers/workspace.d.ts.map +0 -1
  1573. package/packages/agent/src/providers/workspace.js +0 -418
  1574. package/packages/agent/src/runtime/advanced-capabilities-config.d.ts +0 -8
  1575. package/packages/agent/src/runtime/advanced-capabilities-config.d.ts.map +0 -1
  1576. package/packages/agent/src/runtime/agent-event-service.d.ts.map +0 -1
  1577. package/packages/agent/src/runtime/agent-wallets.d.ts +0 -138
  1578. package/packages/agent/src/runtime/agent-wallets.d.ts.map +0 -1
  1579. package/packages/agent/src/runtime/agent-wallets.js +0 -308
  1580. package/packages/agent/src/runtime/analysis-mode-flag.d.ts +0 -93
  1581. package/packages/agent/src/runtime/analysis-mode-flag.d.ts.map +0 -1
  1582. package/packages/agent/src/runtime/analysis-mode-flag.js +0 -131
  1583. package/packages/agent/src/runtime/android-app-plugins.d.ts +0 -13
  1584. package/packages/agent/src/runtime/android-app-plugins.d.ts.map +0 -1
  1585. package/packages/agent/src/runtime/android-app-plugins.js +0 -48
  1586. package/packages/agent/src/runtime/aosp-dflash-adapter.d.ts +0 -99
  1587. package/packages/agent/src/runtime/aosp-dflash-adapter.d.ts.map +0 -1
  1588. package/packages/agent/src/runtime/aosp-dflash-adapter.js +0 -332
  1589. package/packages/agent/src/runtime/build-character-config.d.ts.map +0 -1
  1590. package/packages/agent/src/runtime/build-character-config.js +0 -176
  1591. package/packages/agent/src/runtime/conversation-compactor-runtime.d.ts +0 -141
  1592. package/packages/agent/src/runtime/conversation-compactor-runtime.d.ts.map +0 -1
  1593. package/packages/agent/src/runtime/conversation-compactor-runtime.js +0 -460
  1594. package/packages/agent/src/runtime/conversation-compactor.d.ts +0 -38
  1595. package/packages/agent/src/runtime/conversation-compactor.d.ts.map +0 -1
  1596. package/packages/agent/src/runtime/conversation-compactor.js +0 -1121
  1597. package/packages/agent/src/runtime/conversation-compactor.types.d.ts +0 -102
  1598. package/packages/agent/src/runtime/conversation-compactor.types.d.ts.map +0 -1
  1599. package/packages/agent/src/runtime/core-plugins.d.ts +0 -64
  1600. package/packages/agent/src/runtime/core-plugins.d.ts.map +0 -1
  1601. package/packages/agent/src/runtime/core-plugins.js +0 -120
  1602. package/packages/agent/src/runtime/custom-actions.d.ts +0 -43
  1603. package/packages/agent/src/runtime/custom-actions.d.ts.map +0 -1
  1604. package/packages/agent/src/runtime/custom-actions.js +0 -533
  1605. package/packages/agent/src/runtime/default-documents.d.ts +0 -21
  1606. package/packages/agent/src/runtime/default-documents.d.ts.map +0 -1
  1607. package/packages/agent/src/runtime/default-documents.js +0 -283
  1608. package/packages/agent/src/runtime/eliza-plugin.d.ts.map +0 -1
  1609. package/packages/agent/src/runtime/eliza-plugin.js +0 -180
  1610. package/packages/agent/src/runtime/eliza.d.ts +0 -109
  1611. package/packages/agent/src/runtime/eliza.d.ts.map +0 -1
  1612. package/packages/agent/src/runtime/eliza.js +0 -3372
  1613. package/packages/agent/src/runtime/embedding-presets.d.ts +0 -19
  1614. package/packages/agent/src/runtime/embedding-presets.d.ts.map +0 -1
  1615. package/packages/agent/src/runtime/embedding-presets.js +0 -60
  1616. package/packages/agent/src/runtime/first-time-setup.d.ts +0 -47
  1617. package/packages/agent/src/runtime/first-time-setup.d.ts.map +0 -1
  1618. package/packages/agent/src/runtime/first-time-setup.js +0 -704
  1619. package/packages/agent/src/runtime/index.d.ts +0 -20
  1620. package/packages/agent/src/runtime/index.d.ts.map +0 -1
  1621. package/packages/agent/src/runtime/index.js +0 -19
  1622. package/packages/agent/src/runtime/load-plugin-from-vfs.d.ts +0 -54
  1623. package/packages/agent/src/runtime/load-plugin-from-vfs.d.ts.map +0 -1
  1624. package/packages/agent/src/runtime/load-plugin-from-vfs.js +0 -86
  1625. package/packages/agent/src/runtime/local-execution-mode.d.ts +0 -11
  1626. package/packages/agent/src/runtime/local-execution-mode.d.ts.map +0 -1
  1627. package/packages/agent/src/runtime/model-resolution.d.ts.map +0 -1
  1628. package/packages/agent/src/runtime/model-resolution.js +0 -55
  1629. package/packages/agent/src/runtime/native-runtime-features.d.ts.map +0 -1
  1630. package/packages/agent/src/runtime/onboarding-names.d.ts +0 -11
  1631. package/packages/agent/src/runtime/onboarding-names.d.ts.map +0 -1
  1632. package/packages/agent/src/runtime/onboarding-names.js +0 -81
  1633. package/packages/agent/src/runtime/operations/classifier.d.ts +0 -36
  1634. package/packages/agent/src/runtime/operations/classifier.d.ts.map +0 -1
  1635. package/packages/agent/src/runtime/operations/classifier.js +0 -72
  1636. package/packages/agent/src/runtime/operations/cold-strategy.d.ts +0 -19
  1637. package/packages/agent/src/runtime/operations/cold-strategy.d.ts.map +0 -1
  1638. package/packages/agent/src/runtime/operations/health-checks.d.ts +0 -25
  1639. package/packages/agent/src/runtime/operations/health-checks.d.ts.map +0 -1
  1640. package/packages/agent/src/runtime/operations/health.d.ts +0 -32
  1641. package/packages/agent/src/runtime/operations/health.d.ts.map +0 -1
  1642. package/packages/agent/src/runtime/operations/index.d.ts +0 -17
  1643. package/packages/agent/src/runtime/operations/index.d.ts.map +0 -1
  1644. package/packages/agent/src/runtime/operations/manager.d.ts +0 -70
  1645. package/packages/agent/src/runtime/operations/manager.d.ts.map +0 -1
  1646. package/packages/agent/src/runtime/operations/manager.js +0 -202
  1647. package/packages/agent/src/runtime/operations/reload-hot.d.ts +0 -43
  1648. package/packages/agent/src/runtime/operations/reload-hot.d.ts.map +0 -1
  1649. package/packages/agent/src/runtime/operations/reload-hot.js +0 -181
  1650. package/packages/agent/src/runtime/operations/repository.d.ts +0 -66
  1651. package/packages/agent/src/runtime/operations/repository.d.ts.map +0 -1
  1652. package/packages/agent/src/runtime/operations/types.d.ts.map +0 -1
  1653. package/packages/agent/src/runtime/operations/vault-bridge.d.ts +0 -81
  1654. package/packages/agent/src/runtime/operations/vault-bridge.d.ts.map +0 -1
  1655. package/packages/agent/src/runtime/owner-entity.d.ts.map +0 -1
  1656. package/packages/agent/src/runtime/owner-entity.js +0 -30
  1657. package/packages/agent/src/runtime/pglite-error-compat.d.ts +0 -28
  1658. package/packages/agent/src/runtime/pglite-error-compat.d.ts.map +0 -1
  1659. package/packages/agent/src/runtime/pglite-error-compat.js +0 -54
  1660. package/packages/agent/src/runtime/plugin-collector.d.ts +0 -22
  1661. package/packages/agent/src/runtime/plugin-collector.d.ts.map +0 -1
  1662. package/packages/agent/src/runtime/plugin-collector.js +0 -503
  1663. package/packages/agent/src/runtime/plugin-lifecycle.d.ts +0 -45
  1664. package/packages/agent/src/runtime/plugin-lifecycle.d.ts.map +0 -1
  1665. package/packages/agent/src/runtime/plugin-lifecycle.js +0 -602
  1666. package/packages/agent/src/runtime/plugin-resolver.d.ts +0 -46
  1667. package/packages/agent/src/runtime/plugin-resolver.d.ts.map +0 -1
  1668. package/packages/agent/src/runtime/plugin-resolver.js +0 -1375
  1669. package/packages/agent/src/runtime/plugin-role-gating.d.ts +0 -24
  1670. package/packages/agent/src/runtime/plugin-role-gating.d.ts.map +0 -1
  1671. package/packages/agent/src/runtime/plugin-role-gating.js +0 -106
  1672. package/packages/agent/src/runtime/plugin-types.d.ts +0 -64
  1673. package/packages/agent/src/runtime/plugin-types.d.ts.map +0 -1
  1674. package/packages/agent/src/runtime/plugin-types.js +0 -306
  1675. package/packages/agent/src/runtime/prompt-compaction.d.ts +0 -98
  1676. package/packages/agent/src/runtime/prompt-compaction.d.ts.map +0 -1
  1677. package/packages/agent/src/runtime/prompt-compaction.js +0 -362
  1678. package/packages/agent/src/runtime/prompt-optimization.d.ts +0 -47
  1679. package/packages/agent/src/runtime/prompt-optimization.d.ts.map +0 -1
  1680. package/packages/agent/src/runtime/prompt-optimization.js +0 -1123
  1681. package/packages/agent/src/runtime/release-plugin-policy.d.ts.map +0 -1
  1682. package/packages/agent/src/runtime/release-plugin-policy.js +0 -85
  1683. package/packages/agent/src/runtime/restart.d.ts +0 -9
  1684. package/packages/agent/src/runtime/restart.d.ts.map +0 -1
  1685. package/packages/agent/src/runtime/restart.js +0 -8
  1686. package/packages/agent/src/runtime/roles/src/index.d.ts +0 -24
  1687. package/packages/agent/src/runtime/roles/src/index.d.ts.map +0 -1
  1688. package/packages/agent/src/runtime/roles/src/index.js +0 -255
  1689. package/packages/agent/src/runtime/roles/src/provider.d.ts.map +0 -1
  1690. package/packages/agent/src/runtime/roles/src/types.d.ts.map +0 -1
  1691. package/packages/agent/src/runtime/roles/src/utils.d.ts.map +0 -1
  1692. package/packages/agent/src/runtime/roles.d.ts +0 -3
  1693. package/packages/agent/src/runtime/roles.d.ts.map +0 -1
  1694. package/packages/agent/src/runtime/subagent-output.d.ts +0 -51
  1695. package/packages/agent/src/runtime/subagent-output.d.ts.map +0 -1
  1696. package/packages/agent/src/runtime/subagent-output.js +0 -173
  1697. package/packages/agent/src/runtime/task-heartbeat.d.ts +0 -22
  1698. package/packages/agent/src/runtime/task-heartbeat.d.ts.map +0 -1
  1699. package/packages/agent/src/runtime/task-heartbeat.js +0 -84
  1700. package/packages/agent/src/runtime/tool-call-cache/cache.d.ts +0 -62
  1701. package/packages/agent/src/runtime/tool-call-cache/cache.d.ts.map +0 -1
  1702. package/packages/agent/src/runtime/tool-call-cache/cache.js +0 -123
  1703. package/packages/agent/src/runtime/tool-call-cache/disk-store.d.ts +0 -23
  1704. package/packages/agent/src/runtime/tool-call-cache/disk-store.d.ts.map +0 -1
  1705. package/packages/agent/src/runtime/tool-call-cache/index.d.ts +0 -7
  1706. package/packages/agent/src/runtime/tool-call-cache/index.d.ts.map +0 -1
  1707. package/packages/agent/src/runtime/tool-call-cache/index.js +0 -4
  1708. package/packages/agent/src/runtime/tool-call-cache/key.d.ts +0 -11
  1709. package/packages/agent/src/runtime/tool-call-cache/key.d.ts.map +0 -1
  1710. package/packages/agent/src/runtime/tool-call-cache/key.js +0 -31
  1711. package/packages/agent/src/runtime/tool-call-cache/lru.d.ts.map +0 -1
  1712. package/packages/agent/src/runtime/tool-call-cache/redact.d.ts +0 -17
  1713. package/packages/agent/src/runtime/tool-call-cache/redact.d.ts.map +0 -1
  1714. package/packages/agent/src/runtime/tool-call-cache/redact.js +0 -77
  1715. package/packages/agent/src/runtime/tool-call-cache/registry.d.ts +0 -18
  1716. package/packages/agent/src/runtime/tool-call-cache/registry.d.ts.map +0 -1
  1717. package/packages/agent/src/runtime/tool-call-cache/registry.js +0 -66
  1718. package/packages/agent/src/runtime/tool-call-cache/types.d.ts.map +0 -1
  1719. package/packages/agent/src/runtime/tool-call-cache-wrapper.d.ts +0 -39
  1720. package/packages/agent/src/runtime/tool-call-cache-wrapper.d.ts.map +0 -1
  1721. package/packages/agent/src/runtime/tool-call-cache-wrapper.js +0 -72
  1722. package/packages/agent/src/runtime/trajectory-export.d.ts +0 -18
  1723. package/packages/agent/src/runtime/trajectory-export.d.ts.map +0 -1
  1724. package/packages/agent/src/runtime/trajectory-export.js +0 -109
  1725. package/packages/agent/src/runtime/trajectory-internals.d.ts +0 -242
  1726. package/packages/agent/src/runtime/trajectory-internals.d.ts.map +0 -1
  1727. package/packages/agent/src/runtime/trajectory-internals.js +0 -1281
  1728. package/packages/agent/src/runtime/trajectory-persistence.d.ts +0 -15
  1729. package/packages/agent/src/runtime/trajectory-persistence.d.ts.map +0 -1
  1730. package/packages/agent/src/runtime/trajectory-persistence.js +0 -29
  1731. package/packages/agent/src/runtime/trajectory-query.d.ts.map +0 -1
  1732. package/packages/agent/src/runtime/trajectory-query.js +0 -27
  1733. package/packages/agent/src/runtime/trajectory-storage.d.ts +0 -91
  1734. package/packages/agent/src/runtime/trajectory-storage.d.ts.map +0 -1
  1735. package/packages/agent/src/runtime/trajectory-storage.js +0 -1093
  1736. package/packages/agent/src/runtime/vault-profile-resolver.d.ts +0 -37
  1737. package/packages/agent/src/runtime/vault-profile-resolver.d.ts.map +0 -1
  1738. package/packages/agent/src/runtime/vault-profile-resolver.js +0 -79
  1739. package/packages/agent/src/runtime/version.d.ts.map +0 -1
  1740. package/packages/agent/src/runtime/web-search-tools.d.ts +0 -22
  1741. package/packages/agent/src/runtime/web-search-tools.d.ts.map +0 -1
  1742. package/packages/agent/src/runtime/web-search-tools.js +0 -151
  1743. package/packages/agent/src/security/access.d.ts.map +0 -1
  1744. package/packages/agent/src/security/access.js +0 -54
  1745. package/packages/agent/src/security/audit-log.d.ts.map +0 -1
  1746. package/packages/agent/src/security/audit-log.js +0 -161
  1747. package/packages/agent/src/security/index.d.ts +0 -4
  1748. package/packages/agent/src/security/index.d.ts.map +0 -1
  1749. package/packages/agent/src/security/network-policy.d.ts.map +0 -1
  1750. package/packages/agent/src/services/agent-export.d.ts +0 -100
  1751. package/packages/agent/src/services/agent-export.d.ts.map +0 -1
  1752. package/packages/agent/src/services/agent-export.js +0 -764
  1753. package/packages/agent/src/services/app-manager-agents-list-guard.d.ts.map +0 -1
  1754. package/packages/agent/src/services/app-manager.d.ts +0 -108
  1755. package/packages/agent/src/services/app-manager.d.ts.map +0 -1
  1756. package/packages/agent/src/services/app-manager.js +0 -1678
  1757. package/packages/agent/src/services/app-package-modules.d.ts +0 -22
  1758. package/packages/agent/src/services/app-package-modules.d.ts.map +0 -1
  1759. package/packages/agent/src/services/app-package-modules.js +0 -397
  1760. package/packages/agent/src/services/app-run-store.d.ts +0 -6
  1761. package/packages/agent/src/services/app-run-store.d.ts.map +0 -1
  1762. package/packages/agent/src/services/app-run-store.js +0 -547
  1763. package/packages/agent/src/services/app-session-gate.d.ts.map +0 -1
  1764. package/packages/agent/src/services/app-session-gate.js +0 -71
  1765. package/packages/agent/src/services/capability-broker.d.ts.map +0 -1
  1766. package/packages/agent/src/services/capability-broker.js +0 -339
  1767. package/packages/agent/src/services/character-history.d.ts.map +0 -1
  1768. package/packages/agent/src/services/character-persistence.d.ts +0 -25
  1769. package/packages/agent/src/services/character-persistence.d.ts.map +0 -1
  1770. package/packages/agent/src/services/client-chat-sender.d.ts +0 -19
  1771. package/packages/agent/src/services/client-chat-sender.d.ts.map +0 -1
  1772. package/packages/agent/src/services/client-chat-sender.js +0 -88
  1773. package/packages/agent/src/services/config-plugin-manager.d.ts +0 -6
  1774. package/packages/agent/src/services/config-plugin-manager.d.ts.map +0 -1
  1775. package/packages/agent/src/services/connector-setup-service.d.ts +0 -48
  1776. package/packages/agent/src/services/connector-setup-service.d.ts.map +0 -1
  1777. package/packages/agent/src/services/escalation.d.ts.map +0 -1
  1778. package/packages/agent/src/services/escalation.js +0 -376
  1779. package/packages/agent/src/services/evm-signing-capability.d.ts +0 -33
  1780. package/packages/agent/src/services/evm-signing-capability.d.ts.map +0 -1
  1781. package/packages/agent/src/services/evm-signing-capability.js +0 -52
  1782. package/packages/agent/src/services/external-bridge-state.d.ts +0 -10
  1783. package/packages/agent/src/services/external-bridge-state.d.ts.map +0 -1
  1784. package/packages/agent/src/services/external-bridge-state.js +0 -14
  1785. package/packages/agent/src/services/hosted-tools.d.ts +0 -70
  1786. package/packages/agent/src/services/hosted-tools.d.ts.map +0 -1
  1787. package/packages/agent/src/services/hosted-tools.js +0 -87
  1788. package/packages/agent/src/services/index.d.ts +0 -27
  1789. package/packages/agent/src/services/index.d.ts.map +0 -1
  1790. package/packages/agent/src/services/index.js +0 -32
  1791. package/packages/agent/src/services/js-runtime-bridge.d.ts.map +0 -1
  1792. package/packages/agent/src/services/js-runtime-bridge.js +0 -217
  1793. package/packages/agent/src/services/mcp-marketplace.d.ts.map +0 -1
  1794. package/packages/agent/src/services/mcp-marketplace.js +0 -200
  1795. package/packages/agent/src/services/media-generation.d.ts +0 -10
  1796. package/packages/agent/src/services/media-generation.d.ts.map +0 -1
  1797. package/packages/agent/src/services/media-generation.js +0 -102
  1798. package/packages/agent/src/services/overlay-app-presence.d.ts.map +0 -1
  1799. package/packages/agent/src/services/owner-name.d.ts.map +0 -1
  1800. package/packages/agent/src/services/permissions/contracts.d.ts +0 -9
  1801. package/packages/agent/src/services/permissions/contracts.d.ts.map +0 -1
  1802. package/packages/agent/src/services/permissions/contracts.js +0 -8
  1803. package/packages/agent/src/services/permissions/probers/_bridge.d.ts +0 -77
  1804. package/packages/agent/src/services/permissions/probers/_bridge.d.ts.map +0 -1
  1805. package/packages/agent/src/services/permissions/probers/_bridge.js +0 -224
  1806. package/packages/agent/src/services/permissions/probers/accessibility.d.ts.map +0 -1
  1807. package/packages/agent/src/services/permissions/probers/automation.d.ts +0 -17
  1808. package/packages/agent/src/services/permissions/probers/automation.d.ts.map +0 -1
  1809. package/packages/agent/src/services/permissions/probers/automation.js +0 -46
  1810. package/packages/agent/src/services/permissions/probers/calendar.d.ts +0 -14
  1811. package/packages/agent/src/services/permissions/probers/calendar.d.ts.map +0 -1
  1812. package/packages/agent/src/services/permissions/probers/calendar.js +0 -33
  1813. package/packages/agent/src/services/permissions/probers/camera.d.ts.map +0 -1
  1814. package/packages/agent/src/services/permissions/probers/contacts.d.ts +0 -13
  1815. package/packages/agent/src/services/permissions/probers/contacts.d.ts.map +0 -1
  1816. package/packages/agent/src/services/permissions/probers/contacts.js +0 -32
  1817. package/packages/agent/src/services/permissions/probers/full-disk.d.ts.map +0 -1
  1818. package/packages/agent/src/services/permissions/probers/health.d.ts +0 -23
  1819. package/packages/agent/src/services/permissions/probers/health.d.ts.map +0 -1
  1820. package/packages/agent/src/services/permissions/probers/health.js +0 -82
  1821. package/packages/agent/src/services/permissions/probers/index.d.ts.map +0 -1
  1822. package/packages/agent/src/services/permissions/probers/index.js +0 -42
  1823. package/packages/agent/src/services/permissions/probers/location.d.ts +0 -21
  1824. package/packages/agent/src/services/permissions/probers/location.d.ts.map +0 -1
  1825. package/packages/agent/src/services/permissions/probers/location.js +0 -47
  1826. package/packages/agent/src/services/permissions/probers/microphone.d.ts.map +0 -1
  1827. package/packages/agent/src/services/permissions/probers/notes.d.ts +0 -19
  1828. package/packages/agent/src/services/permissions/probers/notes.d.ts.map +0 -1
  1829. package/packages/agent/src/services/permissions/probers/notes.js +0 -55
  1830. package/packages/agent/src/services/permissions/probers/notifications.d.ts +0 -24
  1831. package/packages/agent/src/services/permissions/probers/notifications.d.ts.map +0 -1
  1832. package/packages/agent/src/services/permissions/probers/notifications.js +0 -47
  1833. package/packages/agent/src/services/permissions/probers/reminders.d.ts +0 -22
  1834. package/packages/agent/src/services/permissions/probers/reminders.d.ts.map +0 -1
  1835. package/packages/agent/src/services/permissions/probers/reminders.js +0 -44
  1836. package/packages/agent/src/services/permissions/probers/screen-recording.d.ts.map +0 -1
  1837. package/packages/agent/src/services/permissions/probers/screentime.d.ts +0 -21
  1838. package/packages/agent/src/services/permissions/probers/screentime.d.ts.map +0 -1
  1839. package/packages/agent/src/services/permissions/probers/screentime.js +0 -67
  1840. package/packages/agent/src/services/permissions/probers/shell.d.ts +0 -19
  1841. package/packages/agent/src/services/permissions/probers/shell.d.ts.map +0 -1
  1842. package/packages/agent/src/services/permissions/probers/shell.js +0 -31
  1843. package/packages/agent/src/services/permissions/probers/website-blocking.d.ts.map +0 -1
  1844. package/packages/agent/src/services/permissions/register-probers.d.ts +0 -29
  1845. package/packages/agent/src/services/permissions/register-probers.d.ts.map +0 -1
  1846. package/packages/agent/src/services/permissions/register-probers.js +0 -31
  1847. package/packages/agent/src/services/permissions-registry.d.ts.map +0 -1
  1848. package/packages/agent/src/services/permissions-registry.js +0 -213
  1849. package/packages/agent/src/services/plugin-compiler.d.ts +0 -51
  1850. package/packages/agent/src/services/plugin-compiler.d.ts.map +0 -1
  1851. package/packages/agent/src/services/plugin-compiler.js +0 -90
  1852. package/packages/agent/src/services/plugin-installer.d.ts +0 -93
  1853. package/packages/agent/src/services/plugin-installer.d.ts.map +0 -1
  1854. package/packages/agent/src/services/plugin-installer.js +0 -623
  1855. package/packages/agent/src/services/plugin-manager-types.d.ts +0 -114
  1856. package/packages/agent/src/services/plugin-manager-types.d.ts.map +0 -1
  1857. package/packages/agent/src/services/registry-client-app-meta.d.ts +0 -6
  1858. package/packages/agent/src/services/registry-client-app-meta.d.ts.map +0 -1
  1859. package/packages/agent/src/services/registry-client-app-meta.js +0 -168
  1860. package/packages/agent/src/services/registry-client-endpoints.d.ts +0 -7
  1861. package/packages/agent/src/services/registry-client-endpoints.d.ts.map +0 -1
  1862. package/packages/agent/src/services/registry-client-endpoints.js +0 -190
  1863. package/packages/agent/src/services/registry-client-local.d.ts +0 -4
  1864. package/packages/agent/src/services/registry-client-local.d.ts.map +0 -1
  1865. package/packages/agent/src/services/registry-client-local.js +0 -555
  1866. package/packages/agent/src/services/registry-client-network.d.ts +0 -14
  1867. package/packages/agent/src/services/registry-client-network.d.ts.map +0 -1
  1868. package/packages/agent/src/services/registry-client-network.js +0 -147
  1869. package/packages/agent/src/services/registry-client-queries.d.ts +0 -26
  1870. package/packages/agent/src/services/registry-client-queries.d.ts.map +0 -1
  1871. package/packages/agent/src/services/registry-client-queries.js +0 -197
  1872. package/packages/agent/src/services/registry-client-types.d.ts +0 -114
  1873. package/packages/agent/src/services/registry-client-types.d.ts.map +0 -1
  1874. package/packages/agent/src/services/registry-client.d.ts +0 -39
  1875. package/packages/agent/src/services/registry-client.d.ts.map +0 -1
  1876. package/packages/agent/src/services/registry-client.js +0 -349
  1877. package/packages/agent/src/services/relationships-graph.d.ts +0 -13
  1878. package/packages/agent/src/services/relationships-graph.d.ts.map +0 -1
  1879. package/packages/agent/src/services/relationships-graph.js +0 -38
  1880. package/packages/agent/src/services/remote-signing-service.d.ts +0 -58
  1881. package/packages/agent/src/services/remote-signing-service.d.ts.map +0 -1
  1882. package/packages/agent/src/services/remote-signing-service.js +0 -185
  1883. package/packages/agent/src/services/research-task-executor.d.ts +0 -14
  1884. package/packages/agent/src/services/research-task-executor.d.ts.map +0 -1
  1885. package/packages/agent/src/services/research-task-executor.js +0 -138
  1886. package/packages/agent/src/services/sandbox-engine.d.ts.map +0 -1
  1887. package/packages/agent/src/services/sandbox-manager.d.ts +0 -127
  1888. package/packages/agent/src/services/sandbox-manager.d.ts.map +0 -1
  1889. package/packages/agent/src/services/sandbox-manager.js +0 -418
  1890. package/packages/agent/src/services/self-updater.d.ts +0 -21
  1891. package/packages/agent/src/services/self-updater.d.ts.map +0 -1
  1892. package/packages/agent/src/services/self-updater.js +0 -162
  1893. package/packages/agent/src/services/send-handler-availability.d.ts.map +0 -1
  1894. package/packages/agent/src/services/send-handler-availability.js +0 -20
  1895. package/packages/agent/src/services/shell-execution-router.d.ts +0 -67
  1896. package/packages/agent/src/services/shell-execution-router.d.ts.map +0 -1
  1897. package/packages/agent/src/services/shell-execution-router.js +0 -201
  1898. package/packages/agent/src/services/signing-policy.d.ts +0 -44
  1899. package/packages/agent/src/services/signing-policy.d.ts.map +0 -1
  1900. package/packages/agent/src/services/skill-catalog-client.d.ts +0 -47
  1901. package/packages/agent/src/services/skill-catalog-client.d.ts.map +0 -1
  1902. package/packages/agent/src/services/skill-catalog-client.js +0 -130
  1903. package/packages/agent/src/services/skill-marketplace.d.ts +0 -42
  1904. package/packages/agent/src/services/skill-marketplace.d.ts.map +0 -1
  1905. package/packages/agent/src/services/skill-marketplace.js +0 -691
  1906. package/packages/agent/src/services/task-executor.d.ts.map +0 -1
  1907. package/packages/agent/src/services/update-checker.d.ts +0 -29
  1908. package/packages/agent/src/services/update-checker.d.ts.map +0 -1
  1909. package/packages/agent/src/services/version-compat.d.ts.map +0 -1
  1910. package/packages/agent/src/services/version-compat.js +0 -211
  1911. package/packages/agent/src/services/virtual-filesystem.d.ts +0 -88
  1912. package/packages/agent/src/services/virtual-filesystem.d.ts.map +0 -1
  1913. package/packages/agent/src/services/virtual-filesystem.js +0 -410
  1914. package/packages/agent/src/shared/conversation-format.d.ts.map +0 -1
  1915. package/packages/agent/src/shared/conversation-format.js +0 -69
  1916. package/packages/agent/src/shared/index.d.ts +0 -4
  1917. package/packages/agent/src/shared/index.d.ts.map +0 -1
  1918. package/packages/agent/src/shared/index.js +0 -3
  1919. package/packages/agent/src/shared/ui-catalog-prompt.d.ts.map +0 -1
  1920. package/packages/agent/src/shared/workspace-resolution.d.ts.map +0 -1
  1921. package/packages/agent/src/shared/workspace-resolution.js +0 -70
  1922. package/packages/agent/src/templates/skill-scaffold.d.ts +0 -9
  1923. package/packages/agent/src/templates/skill-scaffold.d.ts.map +0 -1
  1924. package/packages/agent/src/templates/skill-scaffold.js +0 -26
  1925. package/packages/agent/src/test-support/index.d.ts +0 -4
  1926. package/packages/agent/src/test-support/index.d.ts.map +0 -1
  1927. package/packages/agent/src/test-support/process-helpers.d.ts.map +0 -1
  1928. package/packages/agent/src/test-support/route-test-helpers.d.ts.map +0 -1
  1929. package/packages/agent/src/test-support/test-helpers.d.ts.map +0 -1
  1930. package/packages/agent/src/test-utils/sqlite-compat.d.ts +0 -23
  1931. package/packages/agent/src/test-utils/sqlite-compat.d.ts.map +0 -1
  1932. package/packages/agent/src/test-utils/sqlite-compat.js +0 -214
  1933. package/packages/agent/src/testing/index.d.ts +0 -4
  1934. package/packages/agent/src/testing/index.d.ts.map +0 -1
  1935. package/packages/agent/src/testing/index.js +0 -3
  1936. package/packages/agent/src/triggers/index.d.ts +0 -5
  1937. package/packages/agent/src/triggers/index.d.ts.map +0 -1
  1938. package/packages/agent/src/triggers/index.js +0 -4
  1939. package/packages/agent/src/triggers/runtime.d.ts +0 -30
  1940. package/packages/agent/src/triggers/runtime.d.ts.map +0 -1
  1941. package/packages/agent/src/triggers/runtime.js +0 -447
  1942. package/packages/agent/src/triggers/scheduling.d.ts +0 -78
  1943. package/packages/agent/src/triggers/scheduling.d.ts.map +0 -1
  1944. package/packages/agent/src/triggers/scheduling.js +0 -436
  1945. package/packages/agent/src/triggers/text-to-workflow.d.ts +0 -58
  1946. package/packages/agent/src/triggers/text-to-workflow.d.ts.map +0 -1
  1947. package/packages/agent/src/triggers/text-to-workflow.js +0 -44
  1948. package/packages/agent/src/triggers/types.d.ts +0 -96
  1949. package/packages/agent/src/triggers/types.d.ts.map +0 -1
  1950. package/packages/agent/src/types/agent-skills.d.ts.map +0 -1
  1951. package/packages/agent/src/types/config-like.d.ts.map +0 -1
  1952. package/packages/agent/src/types/index.d.ts +0 -4
  1953. package/packages/agent/src/types/index.d.ts.map +0 -1
  1954. package/packages/agent/src/types/trajectory.d.ts +0 -20
  1955. package/packages/agent/src/types/trajectory.d.ts.map +0 -1
  1956. package/packages/agent/src/utils/atomic-json.d.ts.map +0 -1
  1957. package/packages/agent/src/utils/exec-safety.d.ts +0 -2
  1958. package/packages/agent/src/utils/exec-safety.d.ts.map +0 -1
  1959. package/packages/agent/src/utils/exec-safety.js +0 -21
  1960. package/packages/agent/src/utils/index.d.ts +0 -2
  1961. package/packages/agent/src/utils/index.d.ts.map +0 -1
  1962. package/packages/agent/src/utils/index.js +0 -1
  1963. package/packages/agent/src/utils/number-parsing.d.ts +0 -26
  1964. package/packages/agent/src/utils/number-parsing.d.ts.map +0 -1
  1965. package/packages/agent/src/utils/number-parsing.js +0 -51
  1966. package/packages/agent/src/version-resolver.d.ts.map +0 -1
  1967. /package/{packages/agent/src/actions → actions}/connector-resolver.d.ts +0 -0
  1968. /package/{packages/agent/src/actions → actions}/contact.d.ts +0 -0
  1969. /package/{packages/agent/src/actions → actions}/context-signal-lexicon.d.ts +0 -0
  1970. /package/{packages/agent/src/actions → actions}/context-signal-lexicon.js +0 -0
  1971. /package/{packages/agent/src/actions → actions}/database.d.ts +0 -0
  1972. /package/{packages/agent/src/actions → actions}/grounded-action-reply.d.ts +0 -0
  1973. /package/{packages/agent/src/actions → actions}/logs.d.ts +0 -0
  1974. /package/{packages/agent/src/actions → actions}/logs.js +0 -0
  1975. /package/{packages/agent/src/actions → actions}/recent-conversation-texts.d.ts +0 -0
  1976. /package/{packages/agent/src/actions → actions}/runtime.d.ts +0 -0
  1977. /package/{packages/agent/src/actions → actions}/terminal.d.ts +0 -0
  1978. /package/{packages/agent/src/actions → actions}/trigger.d.ts +0 -0
  1979. /package/{packages/agent/src/api → api}/agent-lifecycle-routes.d.ts +0 -0
  1980. /package/{packages/agent/src/api → api}/agent-transfer-routes.d.ts +0 -0
  1981. /package/{packages/agent/src/api → api}/auth-routes.d.ts +0 -0
  1982. /package/{packages/agent/src/api → api}/avatar-routes.d.ts +0 -0
  1983. /package/{packages/agent/src/api → api}/chat-text-helpers.d.ts +0 -0
  1984. /package/{packages/agent/src/api → api}/chat-text-helpers.js +0 -0
  1985. /package/{packages/agent/src/api → api}/client-chat-admin.d.ts +0 -0
  1986. /package/{packages/agent/src/api → api}/client-chat-admin.js +0 -0
  1987. /package/{packages/agent/src/api → api}/compat-utils.d.ts +0 -0
  1988. /package/{packages/agent/src/api → api}/compat-utils.js +0 -0
  1989. /package/{packages/agent/src/api → api}/config-env.d.ts +0 -0
  1990. /package/{packages/agent/src/api → api}/connector-account-routes.d.ts +0 -0
  1991. /package/{packages/agent/src/api → api}/connector-health.d.ts +0 -0
  1992. /package/{packages/agent/src/api → api}/connector-health.js +0 -0
  1993. /package/{packages/agent/src/api → api}/connector-oauth-callback-auth.d.ts +0 -0
  1994. /package/{packages/agent/src/api → api}/connector-oauth-callback-auth.js +0 -0
  1995. /package/{packages/agent/src/api → api}/coordinator-wiring.d.ts +0 -0
  1996. /package/{packages/agent/src/api → api}/early-logs.js +0 -0
  1997. /package/{packages/agent/src/api → api}/inbox-routes.d.ts +0 -0
  1998. /package/{packages/agent/src/api → api}/memory-routes.d.ts +0 -0
  1999. /package/{packages/agent/src/api → api}/mobile-optional-routes.d.ts +0 -0
  2000. /package/{packages/agent/src/api → api}/models-routes.d.ts +0 -0
  2001. /package/{packages/agent/src/api → api}/models-routes.js +0 -0
  2002. /package/{packages/agent/src/api → api}/music-player-route-fallback.d.ts +0 -0
  2003. /package/{packages/agent/src/api → api}/music-player-route-fallback.js +0 -0
  2004. /package/{packages/agent/src/api → api}/owner-contact-helpers.d.ts +0 -0
  2005. /package/{packages/agent/src/api → api}/owner-contact-helpers.js +0 -0
  2006. /package/{packages/agent/src/api → api}/parse-action-block.js +0 -0
  2007. /package/{packages/agent/src/api → api}/permissions-routes-extra.js +0 -0
  2008. /package/{packages/agent/src/api → api}/plugin-validation.d.ts +0 -0
  2009. /package/{packages/agent/src/api → api}/plugin-validation.js +0 -0
  2010. /package/{packages/agent/src/api → api}/rate-limiter.d.ts +0 -0
  2011. /package/{packages/agent/src/api → api}/rate-limiter.js +0 -0
  2012. /package/{packages/agent/src/api → api}/relationships-routes.d.ts +0 -0
  2013. /package/{packages/agent/src/api → api}/runtime-plugin-routes.d.ts +0 -0
  2014. /package/{packages/agent/src/api → api}/server-autonomy-helpers.js +0 -0
  2015. /package/{packages/agent/src/api → api}/server-helpers-fetch.d.ts +0 -0
  2016. /package/{packages/agent/src/api → api}/server-helpers-fetch.js +0 -0
  2017. /package/{packages/agent/src/api → api}/server-helpers-plugin.js +0 -0
  2018. /package/{packages/agent/src/api → api}/server-helpers-wallet.js +0 -0
  2019. /package/{packages/agent/src/api/training-service-like.js → api/server-types.js} +0 -0
  2020. /package/{packages/agent/src/api → api}/task-agent-message-routing.d.ts +0 -0
  2021. /package/{packages/agent/src/api → api}/task-agent-message-routing.js +0 -0
  2022. /package/{packages/agent/src/api → api}/terminal-execution-routing.js +0 -0
  2023. /package/{packages/agent/src/api → api}/terminal-run-limits.d.ts +0 -0
  2024. /package/{packages/agent/src/api → api}/training-backend-check.d.ts +0 -0
  2025. /package/{packages/agent/src/api → api}/training-backend-check.js +0 -0
  2026. /package/{packages/agent/src/services/registry-client-types.js → api/training-service-like.js} +0 -0
  2027. /package/{packages/agent/src/api → api}/wallet-dex-prices.d.ts +0 -0
  2028. /package/{packages/agent/src/api → api}/wallet-dex-prices.js +0 -0
  2029. /package/{packages/agent/src/api → api}/wallet-env-sync.js +0 -0
  2030. /package/{packages/agent/src/api → api}/wallet-evm-balance.d.ts +0 -0
  2031. /package/{packages/agent/src/api → api}/wallet-evm-balance.js +0 -0
  2032. /package/{packages/agent/src/api → api}/wallet-trading-profile.d.ts +0 -0
  2033. /package/{packages/agent/src/api → api}/zip-utils.d.ts +0 -0
  2034. /package/{packages/agent/src/api → api}/zip-utils.js +0 -0
  2035. /package/{packages/agent/src/auth → auth}/anthropic.js +0 -0
  2036. /package/{packages/agent/src/auth → auth}/claude-code-stealth.d.ts +0 -0
  2037. /package/{packages/agent/src/auth → auth}/index.js +0 -0
  2038. /package/{packages/agent/src/auth → auth}/vendor/pi-oauth/anthropic-login.d.ts +0 -0
  2039. /package/{packages/agent/src/auth → auth}/vendor/pi-oauth/pkce.d.ts +0 -0
  2040. /package/{packages/agent/src/auth → auth}/vendor/pi-oauth/pkce.js +0 -0
  2041. /package/{packages/agent/src/awareness → awareness}/index.js +0 -0
  2042. /package/{packages/agent/src/awareness → awareness}/registry.d.ts +0 -0
  2043. /package/{packages/agent/src/awareness → awareness}/registry.js +0 -0
  2044. /package/{packages/agent/src/bin.d.ts → bin.d.ts} +0 -0
  2045. /package/{packages/agent/src/cli → cli}/benchmark.d.ts +0 -0
  2046. /package/{packages/agent/src/cli → cli}/index.d.ts +0 -0
  2047. /package/{packages/agent/src/config → config}/character-schema.d.ts +0 -0
  2048. /package/{packages/agent/src/config → config}/character-schema.js +0 -0
  2049. /package/{packages/agent/src/config → config}/config.d.ts +0 -0
  2050. /package/{packages/agent/src/config → config}/index.js +0 -0
  2051. /package/{packages/agent/src/config → config}/plugin-auto-enable.d.ts +0 -0
  2052. /package/{packages/agent/src/config → config}/plugin-auto-enable.js +0 -0
  2053. /package/{packages/agent/src/config → config}/telegram-custom-commands.d.ts +0 -0
  2054. /package/{packages/agent/src/config → config}/telegram-custom-commands.js +0 -0
  2055. /package/{packages/agent/src/config → config}/types.agent-defaults.d.ts +0 -0
  2056. /package/{packages/agent/src/config → config}/types.agent-defaults.js +0 -0
  2057. /package/{packages/agent/src/config → config}/types.agents.d.ts +0 -0
  2058. /package/{packages/agent/src/config → config}/types.agents.js +0 -0
  2059. /package/{packages/agent/src/config → config}/types.d.ts +0 -0
  2060. /package/{packages/agent/src/config → config}/types.eliza.d.ts +0 -0
  2061. /package/{packages/agent/src/config → config}/types.eliza.js +0 -0
  2062. /package/{packages/agent/src/config → config}/types.hooks.d.ts +0 -0
  2063. /package/{packages/agent/src/config → config}/types.hooks.js +0 -0
  2064. /package/{packages/agent/src/config → config}/types.js +0 -0
  2065. /package/{packages/agent/src/config → config}/types.messages.d.ts +0 -0
  2066. /package/{packages/agent/src/config → config}/types.messages.js +0 -0
  2067. /package/{packages/agent/src/config → config}/zod-schema.hooks.d.ts +0 -0
  2068. /package/{packages/agent/src/config → config}/zod-schema.hooks.js +0 -0
  2069. /package/{packages/agent/src/config → config}/zod-schema.session.js +0 -0
  2070. /package/{packages/agent/src/contracts → contracts}/awareness.d.ts +0 -0
  2071. /package/{packages/agent/src/contracts → contracts}/awareness.js +0 -0
  2072. /package/{packages/agent/src/diagnostics → diagnostics}/integration-observability.d.ts +0 -0
  2073. /package/{packages/agent/src/diagnostics → diagnostics}/integration-observability.js +0 -0
  2074. /package/{packages/agent/src/hooks → hooks}/eligibility.js +0 -0
  2075. /package/{packages/agent/src/hooks → hooks}/index.js +0 -0
  2076. /package/{packages/agent/src/hooks → hooks}/registry.js +0 -0
  2077. /package/{packages/agent/src/hooks → hooks}/types.d.ts +0 -0
  2078. /package/{packages/agent/src/hooks → hooks}/types.js +0 -0
  2079. /package/{packages/agent/src/providers → providers}/admin-panel.d.ts +0 -0
  2080. /package/{packages/agent/src/providers → providers}/admin-panel.js +0 -0
  2081. /package/{packages/agent/src/providers → providers}/admin-trust.d.ts +0 -0
  2082. /package/{packages/agent/src/providers → providers}/admin-trust.js +0 -0
  2083. /package/{packages/agent/src/providers → providers}/automation-terminal-bridge.d.ts +0 -0
  2084. /package/{packages/agent/src/providers → providers}/conversation-proximity.d.ts +0 -0
  2085. /package/{packages/agent/src/providers → providers}/conversation-proximity.js +0 -0
  2086. /package/{packages/agent/src/providers → providers}/escalation-trigger.d.ts +0 -0
  2087. /package/{packages/agent/src/providers → providers}/escalation-trigger.js +0 -0
  2088. /package/{packages/agent/src/providers → providers}/page-scoped-context.d.ts +0 -0
  2089. /package/{packages/agent/src/providers → providers}/recent-conversations.d.ts +0 -0
  2090. /package/{packages/agent/src/providers → providers}/relevant-conversations.d.ts +0 -0
  2091. /package/{packages/agent/src/providers → providers}/rolodex.d.ts +0 -0
  2092. /package/{packages/agent/src/providers → providers}/session-bridge.d.ts +0 -0
  2093. /package/{packages/agent/src/providers → providers}/skill-provider.d.ts +0 -0
  2094. /package/{packages/agent/src/providers → providers}/skill-provider.js +0 -0
  2095. /package/{packages/agent/src/providers → providers}/tasks.d.ts +0 -0
  2096. /package/{packages/agent/src/providers → providers}/tasks.js +0 -0
  2097. /package/{packages/agent/src/providers → providers}/ui-catalog.d.ts +0 -0
  2098. /package/{packages/agent/src/providers → providers}/user-name.d.ts +0 -0
  2099. /package/{packages/agent/src/providers → providers}/user-name.js +0 -0
  2100. /package/{packages/agent/src/providers → providers}/workspace-provider.d.ts +0 -0
  2101. /package/{packages/agent/src/runtime → runtime}/advanced-capabilities-config.js +0 -0
  2102. /package/{packages/agent/src/runtime → runtime}/agent-event-service.d.ts +0 -0
  2103. /package/{packages/agent/src/runtime → runtime}/agent-event-service.js +0 -0
  2104. /package/{packages/agent/src/runtime → runtime}/build-character-config.d.ts +0 -0
  2105. /package/{packages/agent/src/runtime → runtime}/conversation-compactor.types.js +0 -0
  2106. /package/{packages/agent/src/runtime → runtime}/eliza-plugin.d.ts +0 -0
  2107. /package/{packages/agent/src/runtime → runtime}/local-execution-mode.js +0 -0
  2108. /package/{packages/agent/src/runtime → runtime}/model-resolution.d.ts +0 -0
  2109. /package/{packages/agent/src/runtime → runtime}/native-runtime-features.d.ts +0 -0
  2110. /package/{packages/agent/src/runtime → runtime}/native-runtime-features.js +0 -0
  2111. /package/{packages/agent/src/runtime → runtime}/operations/cold-strategy.js +0 -0
  2112. /package/{packages/agent/src/runtime → runtime}/operations/health-checks.js +0 -0
  2113. /package/{packages/agent/src/runtime → runtime}/operations/health.js +0 -0
  2114. /package/{packages/agent/src/runtime → runtime}/operations/index.js +0 -0
  2115. /package/{packages/agent/src/runtime → runtime}/operations/repository.js +0 -0
  2116. /package/{packages/agent/src/runtime → runtime}/operations/types.d.ts +0 -0
  2117. /package/{packages/agent/src/runtime → runtime}/operations/types.js +0 -0
  2118. /package/{packages/agent/src/runtime → runtime}/operations/vault-bridge.js +0 -0
  2119. /package/{packages/agent/src/runtime → runtime}/owner-entity.d.ts +0 -0
  2120. /package/{packages/agent/src/runtime → runtime}/release-plugin-policy.d.ts +0 -0
  2121. /package/{packages/agent/src/runtime → runtime}/roles/src/provider.d.ts +0 -0
  2122. /package/{packages/agent/src/runtime → runtime}/roles/src/provider.js +0 -0
  2123. /package/{packages/agent/src/runtime → runtime}/roles/src/types.d.ts +0 -0
  2124. /package/{packages/agent/src/runtime → runtime}/roles/src/types.js +0 -0
  2125. /package/{packages/agent/src/runtime → runtime}/roles/src/utils.d.ts +0 -0
  2126. /package/{packages/agent/src/runtime → runtime}/roles/src/utils.js +0 -0
  2127. /package/{packages/agent/src/runtime → runtime}/roles.js +0 -0
  2128. /package/{packages/agent/src/runtime → runtime}/tool-call-cache/disk-store.js +0 -0
  2129. /package/{packages/agent/src/runtime → runtime}/tool-call-cache/lru.d.ts +0 -0
  2130. /package/{packages/agent/src/runtime → runtime}/tool-call-cache/lru.js +0 -0
  2131. /package/{packages/agent/src/runtime → runtime}/tool-call-cache/types.d.ts +0 -0
  2132. /package/{packages/agent/src/runtime → runtime}/tool-call-cache/types.js +0 -0
  2133. /package/{packages/agent/src/runtime → runtime}/trajectory-query.d.ts +0 -0
  2134. /package/{packages/agent/src/runtime → runtime}/version.d.ts +0 -0
  2135. /package/{packages/agent/src/runtime → runtime}/version.js +0 -0
  2136. /package/{packages/agent/src/security → security}/access.d.ts +0 -0
  2137. /package/{packages/agent/src/security → security}/audit-log.d.ts +0 -0
  2138. /package/{packages/agent/src/security → security}/index.js +0 -0
  2139. /package/{packages/agent/src/security → security}/network-policy.d.ts +0 -0
  2140. /package/{packages/agent/src/security → security}/network-policy.js +0 -0
  2141. /package/{packages/agent/src/services → services}/app-manager-agents-list-guard.d.ts +0 -0
  2142. /package/{packages/agent/src/services → services}/app-manager-agents-list-guard.js +0 -0
  2143. /package/{packages/agent/src/services → services}/app-session-gate.d.ts +0 -0
  2144. /package/{packages/agent/src/services → services}/capability-broker.d.ts +0 -0
  2145. /package/{packages/agent/src/services → services}/character-history.d.ts +0 -0
  2146. /package/{packages/agent/src/services → services}/character-history.js +0 -0
  2147. /package/{packages/agent/src/services → services}/character-persistence.js +0 -0
  2148. /package/{packages/agent/src/services → services}/config-plugin-manager.js +0 -0
  2149. /package/{packages/agent/src/services → services}/connector-setup-service.js +0 -0
  2150. /package/{packages/agent/src/services → services}/escalation.d.ts +0 -0
  2151. /package/{packages/agent/src/services → services}/js-runtime-bridge.d.ts +0 -0
  2152. /package/{packages/agent/src/services → services}/mcp-marketplace.d.ts +0 -0
  2153. /package/{packages/agent/src/services → services}/overlay-app-presence.d.ts +0 -0
  2154. /package/{packages/agent/src/services → services}/overlay-app-presence.js +0 -0
  2155. /package/{packages/agent/src/services → services}/owner-name.d.ts +0 -0
  2156. /package/{packages/agent/src/services → services}/owner-name.js +0 -0
  2157. /package/{packages/agent/src/services → services}/permissions/probers/accessibility.d.ts +0 -0
  2158. /package/{packages/agent/src/services → services}/permissions/probers/accessibility.js +0 -0
  2159. /package/{packages/agent/src/services → services}/permissions/probers/camera.d.ts +0 -0
  2160. /package/{packages/agent/src/services → services}/permissions/probers/camera.js +0 -0
  2161. /package/{packages/agent/src/services → services}/permissions/probers/full-disk.d.ts +0 -0
  2162. /package/{packages/agent/src/services → services}/permissions/probers/full-disk.js +0 -0
  2163. /package/{packages/agent/src/services → services}/permissions/probers/index.d.ts +0 -0
  2164. /package/{packages/agent/src/services → services}/permissions/probers/microphone.d.ts +0 -0
  2165. /package/{packages/agent/src/services → services}/permissions/probers/microphone.js +0 -0
  2166. /package/{packages/agent/src/services → services}/permissions/probers/screen-recording.d.ts +0 -0
  2167. /package/{packages/agent/src/services → services}/permissions/probers/screen-recording.js +0 -0
  2168. /package/{packages/agent/src/services → services}/permissions/probers/website-blocking.d.ts +0 -0
  2169. /package/{packages/agent/src/services → services}/permissions/probers/website-blocking.js +0 -0
  2170. /package/{packages/agent/src/services → services}/permissions-registry.d.ts +0 -0
  2171. /package/{packages/agent/src/services → services}/plugin-manager-types.js +0 -0
  2172. /package/{packages/agent/src/services → services}/sandbox-engine.d.ts +0 -0
  2173. /package/{packages/agent/src/services → services}/sandbox-engine.js +0 -0
  2174. /package/{packages/agent/src/services → services}/send-handler-availability.d.ts +0 -0
  2175. /package/{packages/agent/src/services → services}/signing-policy.js +0 -0
  2176. /package/{packages/agent/src/services → services}/task-executor.d.ts +0 -0
  2177. /package/{packages/agent/src/services → services}/task-executor.js +0 -0
  2178. /package/{packages/agent/src/services → services}/update-checker.js +0 -0
  2179. /package/{packages/agent/src/services → services}/version-compat.d.ts +0 -0
  2180. /package/{packages/agent/src/shared → shared}/conversation-format.d.ts +0 -0
  2181. /package/{packages/agent/src/shared → shared}/ui-catalog-prompt.d.ts +0 -0
  2182. /package/{packages/agent/src/shared → shared}/ui-catalog-prompt.js +0 -0
  2183. /package/{packages/agent/src/shared → shared}/workspace-resolution.d.ts +0 -0
  2184. /package/{packages/agent/src/test-support → test-support}/index.js +0 -0
  2185. /package/{packages/agent/src/test-support → test-support}/process-helpers.d.ts +0 -0
  2186. /package/{packages/agent/src/test-support → test-support}/process-helpers.js +0 -0
  2187. /package/{packages/agent/src/test-support → test-support}/route-test-helpers.d.ts +0 -0
  2188. /package/{packages/agent/src/test-support → test-support}/route-test-helpers.js +0 -0
  2189. /package/{packages/agent/src/test-support → test-support}/test-helpers.d.ts +0 -0
  2190. /package/{packages/agent/src/test-support → test-support}/test-helpers.js +0 -0
  2191. /package/{packages/agent/src/triggers → triggers}/types.js +0 -0
  2192. /package/{packages/agent/src/types → types}/agent-skills.d.ts +0 -0
  2193. /package/{packages/agent/src/types → types}/agent-skills.js +0 -0
  2194. /package/{packages/agent/src/types → types}/config-like.d.ts +0 -0
  2195. /package/{packages/agent/src/types → types}/config-like.js +0 -0
  2196. /package/{packages/agent/src/types → types}/index.js +0 -0
  2197. /package/{packages/agent/src/types → types}/trajectory.js +0 -0
  2198. /package/{packages/agent/src/utils → utils}/atomic-json.d.ts +0 -0
  2199. /package/{packages/agent/src/utils → utils}/atomic-json.js +0 -0
  2200. /package/{packages/agent/src/version-resolver.d.ts → version-resolver.d.ts} +0 -0
  2201. /package/{packages/agent/src/version-resolver.js → version-resolver.js} +0 -0
@@ -0,0 +1,4394 @@
1
+ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
2
+ if (typeof path === "string" && /^\.\.?\//.test(path)) {
3
+ return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
4
+ return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
5
+ });
6
+ }
7
+ return path;
8
+ };
9
+ /**
10
+ * elizaOS runtime entry point for Eliza.
11
+ *
12
+ * Starts the elizaOS agent runtime with Eliza's plugin configuration.
13
+ * Can be run directly via: node --import tsx src/runtime/eliza.ts
14
+ * Or via the CLI: eliza start
15
+ *
16
+ * @module eliza
17
+ */
18
+ import crypto from "node:crypto";
19
+ import { existsSync, mkdirSync, readFileSync, unlinkSync, writeFileSync, } from "node:fs";
20
+ import fs from "node:fs/promises";
21
+ import { createRequire } from "node:module";
22
+ import path from "node:path";
23
+ import process from "node:process";
24
+ import * as readline from "node:readline";
25
+ import { fileURLToPath, pathToFileURL } from "node:url";
26
+ // ---------------------------------------------------------------------------
27
+ // Extracted modules — re-exported for backward compatibility
28
+ // ---------------------------------------------------------------------------
29
+ import { recordBootEvent, recordBootTelemetry, startMemorySampler, } from "./boot-telemetry.js";
30
+ import { BootTimer } from "./boot-timer.js";
31
+ import { runFirstTimeSetup } from "./first-time-setup.js";
32
+ import { resolveConfigEnvForProcess } from "./operations/vault-bridge.js";
33
+ import { resolvePlugins, } from "./plugin-resolver.js";
34
+ import { CUSTOM_PLUGINS_DIRNAME as CUSTOM_RUNTIME_PLUGINS_DIRNAME, STATIC_ELIZA_PLUGINS, } from "./plugin-types.js";
35
+ import { shouldLoadRemoteCodingRunnerForBoot } from "./remote-coding-runner-gate.js";
36
+ export { CHANNEL_PLUGIN_MAP, collectPluginNames, OPTIONAL_PLUGIN_MAP, PROVIDER_PLUGIN_MAP, } from "./plugin-collector.js";
37
+ export { CUSTOM_PLUGINS_DIRNAME, EJECTED_PLUGINS_DIRNAME, ensureBrowserServerLink, findPluginBrowserStagehandDir, findRuntimePluginExport, mergeDropInPlugins, repairBrokenInstallRecord, resolveElizaPluginImportSpecifier, resolvePackageEntry, STATIC_ELIZA_PLUGINS, scanDropInPlugins, } from "./plugin-types.js";
38
+ // resolvePlugins is re-exported via index.ts from ./plugin-resolver
39
+ // `@elizaos/plugin-personal-assistant` and `@elizaos/plugin-companion` are NOT
40
+ // eagerly imported here. Both packages transitively import from
41
+ // `@elizaos/agent` (e.g. `hasOwnerAccess` from this package's barrel) — a
42
+ // top-level static import would form a module-init cycle that leaves named
43
+ // exports (like a plugin's actions array) as `undefined`, crashing
44
+ // `runtime.registerPlugin` when it iterates `plugin.actions`.
45
+ //
46
+ // Both still resolve at plugin-load time via headless dynamic-import
47
+ // entrypoints in `plugin-resolver.ts`, after the static module graph has fully
48
+ // evaluated, so the cycle never forms and browser-only UI exports stay out of
49
+ // the agent process.
50
+ // Keep this here as a single sentinel: if we ever need a static reference,
51
+ // add `as const` data only — never an `import * as` of these packages.
52
+ import { AgentRuntime, AutonomyService, addLogListener, ChannelType, createBasicCapabilitiesPlugin, createMessageMemory, logger, stringToUuid, } from "@elizaos/core";
53
+ import { DEFAULT_ELIZA_CLOUD_TEXT_MODEL, formatError, isElizaSettingsDebugEnabled, isMobilePlatform, migrateLegacyRuntimeConfig, resolveDeploymentTargetInConfig, resolveDesktopApiPort, resolveElizaCloudTopology, resolveServerOnlyPort, resolveServiceRoutingInConfig, settingsDebugCloudSummary, } from "@elizaos/shared";
54
+ let _appCoreRuntimePromise = null;
55
+ function importAppCoreRuntime() {
56
+ // Use a string-literal dynamic import (no indirection through a `const`)
57
+ // so Bun.build can statically follow it and inline `@elizaos/app-core`
58
+ // into the mobile bundle. The previous indirect form
59
+ // (`const moduleId = "@elizaos/app-core"; import(moduleId)`) defeated
60
+ // Bun's resolver and produced a runtime `Cannot find module` on AOSP
61
+ // where there is no node_modules tree.
62
+ //
63
+ // Memoized: boot resolves this ~7x across the pre-resolve-setup phase. The
64
+ // ES module cache already dedupes evaluation, but caching the promise
65
+ // collapses the repeated dynamic-import round-trips into one.
66
+ if (!_appCoreRuntimePromise) {
67
+ _appCoreRuntimePromise = import(
68
+ /* webpackIgnore: true */ "@elizaos/app-core/agent-bridge");
69
+ }
70
+ return _appCoreRuntimePromise;
71
+ }
72
+ function isBundledMobileRuntime() {
73
+ return (globalThis
74
+ .__ELIZA_MOBILE_BUNDLE__ === true);
75
+ }
76
+ import { buildCharacterFromConfig } from "./build-character-config.js";
77
+ import { resolvePreferredProviderId, resolvePreferredProviderPluginName, resolvePrimaryModel, } from "./model-resolution.js";
78
+ const ELIZAMAKER_MODULE = "@elizaos/app-elizamaker";
79
+ const STEWARD_EVM_BRIDGE_MODULE = "@elizaos/app-steward/services/steward-evm-bridge";
80
+ async function loadElizaMakerModule() {
81
+ return (await import(__rewriteRelativeImportExtension(
82
+ /* @vite-ignore */ ELIZAMAKER_MODULE)));
83
+ }
84
+ async function loadStewardEvmBridgeModule() {
85
+ return (await import(__rewriteRelativeImportExtension(
86
+ /* @vite-ignore */ STEWARD_EVM_BRIDGE_MODULE)));
87
+ }
88
+ async function loadE2BCapabilityRouterModule() {
89
+ const moduleId = "../services/e2b-capability-router.ts";
90
+ return (await import(__rewriteRelativeImportExtension(
91
+ /* @vite-ignore */ moduleId)));
92
+ }
93
+ import { debugLogResolvedContext, validateRuntimeContext, } from "../api/plugin-validation.js";
94
+ import { listViews } from "../api/views-registry.js";
95
+ import { getWalletAddresses, syncSolanaPublicKeyEnv } from "../api/wallet.js";
96
+ import { configFileExists, loadElizaConfig, } from "../config/config.js";
97
+ import { CONNECTOR_ENV_MAP, collectConfigEnvVars, collectConnectorEnvVars, } from "../config/env-vars.js";
98
+ import { resolveStateDir, resolveUserPath } from "../config/paths.js";
99
+ import { createHookEvent, loadHooks, triggerHook, } from "../hooks/index.js";
100
+ import { ensureAgentWorkspace } from "../providers/workspace.js";
101
+ import { SandboxAuditLog } from "../security/audit-log.js";
102
+ import { createDstackTeeProvider } from "../services/dstack-tee-provider.js";
103
+ import { bootstrapRemoteCapabilityPlugins } from "../services/remote-plugin-adapter.js";
104
+ import { SandboxManager, } from "../services/sandbox-manager.js";
105
+ import { evaluateTeeBootGate, } from "../services/tee-boot-gate.js";
106
+ import { setTeeBootGateState, teeBootGateBlocksSecrets, } from "../services/tee-boot-gate-state.js";
107
+ import { resolveDefaultAgentWorkspaceDir, shouldBootstrapWorkspaceInitFiles, } from "../shared/workspace-resolution.js";
108
+ import { BLOCKING_CORE_PLUGINS, CORE_PLUGINS, DEFERRED_CORE_PLUGINS, LEAN_CHAT_PLUGINS, OPTIONAL_CORE_PLUGINS, } from "./core-plugins.js";
109
+ import { seedBundledDocuments } from "./default-documents.js";
110
+ import { createElizaPlugin } from "./eliza-plugin.js";
111
+ import { runtimeDocumentsEnabled, runtimeTrajectoriesEnabled, } from "./native-runtime-features.js";
112
+ import { createPgliteInitError, getPgliteErrorCode, PGLITE_ERROR_CODES, } from "./pglite-error-compat.js";
113
+ import { installRuntimePluginLifecycle } from "./plugin-lifecycle.js";
114
+ import { validateIntentActionMap } from "./prompt-compaction.js";
115
+ import rolesPlugin from "./roles.js";
116
+ import { installDatabaseTrajectoryLogger, shouldEnableTrajectoryLoggingByDefault, } from "./trajectory-persistence.js";
117
+ import { validateViewActionMap, validateViewCoverage, } from "./view-action-affinity.js";
118
+ function isPluginSqlResolutionError(err) {
119
+ const message = err instanceof Error ? err.message : String(err);
120
+ return (message.includes("Cannot find module '@elizaos/plugin-sql'") ||
121
+ message.includes('Cannot find module "@elizaos/plugin-sql"') ||
122
+ (message.includes("@elizaos/plugin-sql") &&
123
+ (message.includes("ResolveMessage") ||
124
+ message.includes("Module not found") ||
125
+ message.includes("could not resolve") ||
126
+ message.includes("Could not resolve"))));
127
+ }
128
+ async function loadRequiredPluginSql() {
129
+ try {
130
+ return await import(/* @vite-ignore */ "@elizaos/plugin-sql");
131
+ }
132
+ catch (err) {
133
+ const sourceEntry = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../../../../plugins/plugin-sql/src/index.node.ts");
134
+ if (!isPluginSqlResolutionError(err) || !existsSync(sourceEntry)) {
135
+ throw err;
136
+ }
137
+ logger.debug(`[eliza] Loading @elizaos/plugin-sql from workspace source at ${sourceEntry}`);
138
+ return (await import(__rewriteRelativeImportExtension(pathToFileURL(sourceEntry).href)));
139
+ }
140
+ }
141
+ function resolveWorkspacePluginSourceEntry(packageName) {
142
+ if (!packageName.startsWith("@elizaos/plugin-"))
143
+ return null;
144
+ const shortName = packageName.slice("@elizaos/".length);
145
+ let dir = path.dirname(fileURLToPath(import.meta.url));
146
+ for (let depth = 0; depth < 14; depth += 1) {
147
+ const candidate = path.join(dir, "plugins", shortName, "src", "index.ts");
148
+ if (existsSync(candidate))
149
+ return candidate;
150
+ const parent = path.dirname(dir);
151
+ if (parent === dir)
152
+ break;
153
+ dir = parent;
154
+ }
155
+ return null;
156
+ }
157
+ // Agent orchestrator ships as the standalone @elizaos/plugin-agent-orchestrator package.
158
+ const loadOptionalPlugin = async (packageName) => {
159
+ try {
160
+ if (packageName === "@elizaos/plugin-agent-orchestrator") {
161
+ return await import(
162
+ /* @vite-ignore */ "@elizaos/plugin-agent-orchestrator");
163
+ }
164
+ if (packageName === "@elizaos/plugin-task-coordinator") {
165
+ return await import(
166
+ /* @vite-ignore */ "@elizaos/plugin-task-coordinator");
167
+ }
168
+ if (packageName === "@elizaos/plugin-app-control") {
169
+ const appControlPackageName = packageName;
170
+ return await import(__rewriteRelativeImportExtension(/* @vite-ignore */ appControlPackageName));
171
+ }
172
+ if (packageName === "@elizaos/plugin-shell") {
173
+ return await import(/* @vite-ignore */ "@elizaos/plugin-shell");
174
+ }
175
+ if (packageName === "@elizaos/plugin-coding-tools") {
176
+ return await import(/* @vite-ignore */ "@elizaos/plugin-coding-tools");
177
+ }
178
+ if (packageName === "@elizaos/plugin-ollama") {
179
+ return await import(/* @vite-ignore */ "@elizaos/plugin-ollama");
180
+ }
181
+ if (packageName === "@elizaos/plugin-elizacloud") {
182
+ return await import(/* @vite-ignore */ "@elizaos/plugin-elizacloud");
183
+ }
184
+ if (packageName === "@elizaos/plugin-commands") {
185
+ return await import(/* @vite-ignore */ "@elizaos/plugin-commands");
186
+ }
187
+ if (packageName === "@elizaos/plugin-video") {
188
+ return await import(/* @vite-ignore */ "@elizaos/plugin-video");
189
+ }
190
+ if (packageName === "@elizaos/plugin-background-runner") {
191
+ return await import(
192
+ /* @vite-ignore */ "@elizaos/plugin-background-runner");
193
+ }
194
+ if (packageName === "@elizaos/plugin-anthropic") {
195
+ return await import(/* @vite-ignore */ "@elizaos/plugin-anthropic");
196
+ }
197
+ if (packageName === "@elizaos/plugin-openai") {
198
+ return await import(/* @vite-ignore */ "@elizaos/plugin-openai");
199
+ }
200
+ return await import(__rewriteRelativeImportExtension(packageName));
201
+ }
202
+ catch {
203
+ const sourceEntry = resolveWorkspacePluginSourceEntry(packageName);
204
+ if (sourceEntry) {
205
+ try {
206
+ logger.debug(`[eliza] Loading ${packageName} from workspace source at ${sourceEntry}`);
207
+ return await import(__rewriteRelativeImportExtension(pathToFileURL(sourceEntry).href));
208
+ }
209
+ catch {
210
+ // Fall through to the existing optional-plugin behavior: missing or
211
+ // unbuildable optional plugins are omitted from STATIC_ELIZA_PLUGINS.
212
+ }
213
+ }
214
+ return null;
215
+ }
216
+ };
217
+ // IMPORTANT: Do NOT pull plugin modules in via top-level `await` at module scope.
218
+ //
219
+ // Bun.build (and any cross-module top-level-await scheduling that follows the
220
+ // ESM spec naively) can emit an `init_eliza()` call that is NOT awaited inside
221
+ // a downstream `init_runtime*` function. When that happens, the
222
+ // `Object.assign(STATIC_ELIZA_PLUGINS, ...)` below has not run yet by the time
223
+ // `loadSinglePlugin("@elizaos/plugin-sql")` is dispatched, and the resolver
224
+ // falls through to a dynamic import that throws
225
+ // "Cannot find module '@elizaos/plugin-sql'" from the bundle path.
226
+ //
227
+ // Solution: lazy-load and memoize each module, and register the static map
228
+ // inside `ensureCoreStaticPluginsRegistered()` which is awaited from every
229
+ // runtime entry point (`startEliza`, `startInCloudMode`).
230
+ let _pluginSqlPromise = null;
231
+ async function getPluginSql() {
232
+ if (!_pluginSqlPromise) {
233
+ _pluginSqlPromise = loadRequiredPluginSql();
234
+ }
235
+ return _pluginSqlPromise;
236
+ }
237
+ let _pluginLocalEmbeddingPromise = null;
238
+ async function getPluginLocalEmbedding() {
239
+ if (!_pluginLocalEmbeddingPromise) {
240
+ _pluginLocalEmbeddingPromise = (async () => {
241
+ try {
242
+ return await import(
243
+ /* @vite-ignore */ "@elizaos/plugin-local-inference");
244
+ }
245
+ catch {
246
+ return null;
247
+ }
248
+ })();
249
+ }
250
+ return _pluginLocalEmbeddingPromise;
251
+ }
252
+ let _optionalPluginCache = null;
253
+ function getOptionalPlugin(packageName) {
254
+ if (_optionalPluginCache === null) {
255
+ _optionalPluginCache = new Map();
256
+ }
257
+ const cache = _optionalPluginCache;
258
+ const cached = cache.get(packageName);
259
+ if (cached)
260
+ return cached;
261
+ const promise = loadOptionalPlugin(packageName);
262
+ cache.set(packageName, promise);
263
+ return promise;
264
+ }
265
+ const CORE_STATIC_PLUGIN_REGISTRATIONS = [
266
+ {
267
+ packageName: "@elizaos/plugin-sql",
268
+ phase: "blocking",
269
+ required: true,
270
+ load: () => getPluginSql(),
271
+ },
272
+ {
273
+ packageName: "@elizaos/plugin-local-inference",
274
+ phase: "blocking",
275
+ required: false,
276
+ load: () => getPluginLocalEmbedding(),
277
+ },
278
+ {
279
+ packageName: "@elizaos/plugin-agent-orchestrator",
280
+ registryName: "agent-orchestrator",
281
+ phase: "deferred",
282
+ required: false,
283
+ load: () => getOptionalPlugin("@elizaos/plugin-agent-orchestrator"),
284
+ },
285
+ {
286
+ packageName: "@elizaos/plugin-task-coordinator",
287
+ phase: "deferred",
288
+ required: false,
289
+ load: () => getOptionalPlugin("@elizaos/plugin-task-coordinator"),
290
+ },
291
+ {
292
+ packageName: "@elizaos/plugin-shell",
293
+ phase: "deferred",
294
+ required: false,
295
+ load: () => getOptionalPlugin("@elizaos/plugin-shell"),
296
+ },
297
+ {
298
+ packageName: "@elizaos/plugin-coding-tools",
299
+ phase: "deferred",
300
+ required: false,
301
+ load: () => getOptionalPlugin("@elizaos/plugin-coding-tools"),
302
+ },
303
+ {
304
+ packageName: "@elizaos/plugin-commands",
305
+ phase: "deferred",
306
+ required: false,
307
+ load: () => getOptionalPlugin("@elizaos/plugin-commands"),
308
+ },
309
+ {
310
+ packageName: "@elizaos/plugin-video",
311
+ phase: "deferred",
312
+ required: false,
313
+ load: () => getOptionalPlugin("@elizaos/plugin-video"),
314
+ },
315
+ {
316
+ packageName: "@elizaos/plugin-background-runner",
317
+ phase: "deferred",
318
+ required: false,
319
+ load: () => getOptionalPlugin("@elizaos/plugin-background-runner"),
320
+ },
321
+ {
322
+ packageName: "@elizaos/plugin-elizacloud",
323
+ phase: "deferred",
324
+ required: false,
325
+ load: () => getOptionalPlugin("@elizaos/plugin-elizacloud"),
326
+ },
327
+ {
328
+ packageName: "@elizaos/plugin-ollama",
329
+ phase: "deferred",
330
+ required: false,
331
+ load: () => getOptionalPlugin("@elizaos/plugin-ollama"),
332
+ },
333
+ {
334
+ packageName: "@elizaos/plugin-anthropic",
335
+ phase: "deferred",
336
+ required: false,
337
+ load: () => getOptionalPlugin("@elizaos/plugin-anthropic"),
338
+ },
339
+ {
340
+ packageName: "@elizaos/plugin-openai",
341
+ phase: "deferred",
342
+ required: false,
343
+ load: () => getOptionalPlugin("@elizaos/plugin-openai"),
344
+ },
345
+ {
346
+ packageName: "@elizaos/plugin-gitpathologist",
347
+ phase: "deferred",
348
+ required: false,
349
+ // Not in the mobile bundle — attempting the import there hangs the full
350
+ // 30s deferred-plugin timeout before being skipped. Skip it up front on
351
+ // android/ios (it's a desktop dev tool, already gated in plugin-collector).
352
+ load: () => isMobilePlatform()
353
+ ? Promise.resolve(null)
354
+ : getOptionalPlugin("@elizaos/plugin-gitpathologist"),
355
+ },
356
+ ];
357
+ let _blockingStaticPluginsRegistered = false;
358
+ let _deferredStaticPluginsRegistered = false;
359
+ let _blockingStaticPluginsRegistrationPromise = null;
360
+ let _deferredStaticPluginsRegistrationPromise = null;
361
+ function isTruthyEnvFlag(value) {
362
+ if (!value)
363
+ return false;
364
+ const normalized = value.trim().toLowerCase();
365
+ return normalized === "1" || normalized === "true" || normalized === "yes";
366
+ }
367
+ function shouldBlockDeferredPluginImports() {
368
+ return isTruthyEnvFlag(process.env.ELIZA_BLOCK_DEFERRED_PLUGIN_IMPORTS);
369
+ }
370
+ async function registerStaticPluginPhase(phase) {
371
+ const bootTimeoutMs = Number(process.env.ELIZA_PLUGIN_BOOT_TIMEOUT_MS ?? 30_000);
372
+ const registrations = CORE_STATIC_PLUGIN_REGISTRATIONS.filter((registration) => registration.phase === phase);
373
+ logger.info(`[boot] resolving ${phase} plugins (${registrations.length}, timeout=${bootTimeoutMs}ms)`);
374
+ const trackImport = async (registration) => {
375
+ const startedAt = Date.now();
376
+ let timer = null;
377
+ const timeout = new Promise((_, reject) => {
378
+ timer = setTimeout(() => {
379
+ reject(new Error(`plugin ${registration.packageName} timed out after ${bootTimeoutMs}ms`));
380
+ }, bootTimeoutMs);
381
+ if (typeof timer.unref === "function")
382
+ timer.unref();
383
+ });
384
+ try {
385
+ const mod = await Promise.race([registration.load(), timeout]);
386
+ if (!mod) {
387
+ if (registration.required) {
388
+ throw new Error(`${registration.packageName} resolved to null`);
389
+ }
390
+ logger.warn(`[boot] ${registration.packageName} skipped after ${Date.now() - startedAt}ms: module unavailable`);
391
+ return;
392
+ }
393
+ STATIC_ELIZA_PLUGINS[registration.registryName ?? registration.packageName] = mod;
394
+ logger.info(`[boot] ${registration.packageName} loaded in ${Date.now() - startedAt}ms`);
395
+ }
396
+ catch (err) {
397
+ const elapsed = Date.now() - startedAt;
398
+ if (registration.required) {
399
+ logger.error(`[boot] ${registration.packageName} FAILED after ${elapsed}ms: ${formatError(err)}`);
400
+ throw err;
401
+ }
402
+ logger.warn(`[boot] ${registration.packageName} skipped after ${elapsed}ms: ${formatError(err)}`);
403
+ }
404
+ finally {
405
+ if (timer)
406
+ clearTimeout(timer);
407
+ }
408
+ };
409
+ if (phase === "deferred") {
410
+ // Deferred plugins run in the background after the API server is already
411
+ // listening; they must not hold the ready gate. Importing them one at a
412
+ // time and yielding to the event loop (setImmediate) between each lets the
413
+ // bound HTTP server serve /api/health (and other I/O) between the CPU-bound
414
+ // module evaluations, instead of starving it until the whole batch finishes
415
+ // (observed ready was dominated by this on contended hosts). All plugins
416
+ // still register — only the scheduling changes.
417
+ for (const registration of registrations) {
418
+ await trackImport(registration);
419
+ await new Promise((resolve) => {
420
+ setImmediate(resolve);
421
+ });
422
+ }
423
+ _deferredStaticPluginsRegistered = true;
424
+ }
425
+ else {
426
+ await Promise.all(registrations.map(trackImport));
427
+ _blockingStaticPluginsRegistered = true;
428
+ }
429
+ }
430
+ async function ensureStaticPluginsRegisteredByName(packageNames) {
431
+ const requested = new Set(packageNames);
432
+ if (requested.size === 0)
433
+ return;
434
+ const registrations = CORE_STATIC_PLUGIN_REGISTRATIONS.filter((registration) => requested.has(registration.packageName) ||
435
+ (registration.registryName
436
+ ? requested.has(registration.registryName)
437
+ : false));
438
+ const missing = [...requested].filter((packageName) => !registrations.some((registration) => registration.packageName === packageName ||
439
+ registration.registryName === packageName));
440
+ if (missing.length > 0) {
441
+ logger.debug(`[boot] no static registration for preferred provider plugin(s): ${missing.join(", ")}`);
442
+ }
443
+ await Promise.all(registrations.map(async (registration) => {
444
+ const registryName = registration.registryName ?? registration.packageName;
445
+ if (STATIC_ELIZA_PLUGINS[registryName]) {
446
+ return;
447
+ }
448
+ try {
449
+ const mod = await registration.load();
450
+ if (mod) {
451
+ STATIC_ELIZA_PLUGINS[registryName] = mod;
452
+ logger.info(`[boot] preferred provider plugin ${registration.packageName} loaded before runtime initialization`);
453
+ }
454
+ }
455
+ catch (err) {
456
+ logger.warn(`[boot] preferred provider plugin ${registration.packageName} unavailable before runtime initialization: ${formatError(err)}`);
457
+ }
458
+ }));
459
+ }
460
+ async function ensureBlockingCoreStaticPluginsRegistered() {
461
+ if (_blockingStaticPluginsRegistered)
462
+ return;
463
+ if (!_blockingStaticPluginsRegistrationPromise) {
464
+ _blockingStaticPluginsRegistrationPromise =
465
+ registerStaticPluginPhase("blocking");
466
+ }
467
+ await _blockingStaticPluginsRegistrationPromise;
468
+ }
469
+ export async function ensureDeferredCoreStaticPluginsRegistered() {
470
+ if (_deferredStaticPluginsRegistered)
471
+ return;
472
+ if (!_deferredStaticPluginsRegistrationPromise) {
473
+ _deferredStaticPluginsRegistrationPromise =
474
+ registerStaticPluginPhase("deferred");
475
+ }
476
+ await _deferredStaticPluginsRegistrationPromise;
477
+ }
478
+ /**
479
+ * Static-plugin registration for the CLOUD-HOSTED topology only (the agent runs
480
+ * inside the cloud container and the device connects directly to its API base).
481
+ * No local AgentRuntime boots, so the heavy on-device inference stack
482
+ * (`@elizaos/plugin-local-inference`: catalog, model/embedding/voice warmup,
483
+ * the bun:ffi desktop dylib path) is never used and must not be loaded — it
484
+ * only adds first-paint latency.
485
+ *
486
+ * Register only the registry entry a code path may touch while the cloud proxy
487
+ * is active: `@elizaos/plugin-sql`, so `STATIC_ELIZA_PLUGINS` is populated for
488
+ * any consumer that reaches for it.
489
+ *
490
+ * The two local topologies (local agent → cloud inference, and all-local) keep
491
+ * calling `ensureCoreStaticPluginsRegistered()` and load local-inference
492
+ * exactly as before.
493
+ */
494
+ export async function ensureCloudCoreStaticPluginsRegistered() {
495
+ await ensureStaticPluginsRegisteredByName(["@elizaos/plugin-sql"]);
496
+ }
497
+ /**
498
+ * Resolve and register the baseline `@elizaos/plugin-*` modules into the
499
+ * shared `STATIC_ELIZA_PLUGINS` map. Called from every runtime entry point
500
+ * (`startEliza`, `startInCloudMode`, `bootElizaRuntime`) before any caller
501
+ * touches `loadSinglePlugin`. Memoized so repeated calls are free.
502
+ *
503
+ * Startup is intentionally two-phase:
504
+ * - blocking: only the database and local-inference pre-init hooks needed for
505
+ * runtime readiness;
506
+ * - deferred: provider/feature modules that should not hold the API ready gate.
507
+ *
508
+ * Set ELIZA_BLOCK_DEFERRED_PLUGIN_IMPORTS=1 to restore the legacy behavior and
509
+ * await both phases before plugin resolution. This is useful when debugging
510
+ * import-order or bundling issues.
511
+ *
512
+ * Why this isn't done at module init:
513
+ * - Top-level `await` for these modules at module scope creates a
514
+ * cross-module TLA dependency that `Bun.build` does not always honor in
515
+ * the bundled output (it emits the init call without awaiting it).
516
+ * - Deferring to an explicit awaited call inside an entry function makes the
517
+ * ordering explicit and bundler-independent.
518
+ */
519
+ export async function ensureCoreStaticPluginsRegistered() {
520
+ await ensureBlockingCoreStaticPluginsRegistered();
521
+ if (shouldBlockDeferredPluginImports()) {
522
+ logger.info("[boot] ELIZA_BLOCK_DEFERRED_PLUGIN_IMPORTS=1 — awaiting deferred plugin imports before readiness");
523
+ await ensureDeferredCoreStaticPluginsRegistered();
524
+ }
525
+ else {
526
+ logger.info("[boot] deferred plugin imports scheduled after readiness");
527
+ }
528
+ }
529
+ let activeSignalShutdownContext = null;
530
+ let signalHandlersRegistered = false;
531
+ let signalShutdownPromise = null;
532
+ function registerSignalShutdownHandlers(context) {
533
+ activeSignalShutdownContext = context;
534
+ if (signalHandlersRegistered) {
535
+ return;
536
+ }
537
+ const shutdown = async () => {
538
+ if (signalShutdownPromise) {
539
+ await signalShutdownPromise;
540
+ return;
541
+ }
542
+ signalShutdownPromise = (async () => {
543
+ const current = activeSignalShutdownContext;
544
+ if (!current) {
545
+ process.exit(0);
546
+ }
547
+ try {
548
+ await current?.beforeShutdown?.();
549
+ }
550
+ catch (err) {
551
+ logger.warn(`[eliza] Pre-shutdown cleanup error: ${formatError(err)}`);
552
+ }
553
+ try {
554
+ const sandboxManager = current?.getSandboxManager();
555
+ if (sandboxManager) {
556
+ try {
557
+ await sandboxManager.stop();
558
+ logger.info("[eliza] Sandbox manager stopped");
559
+ }
560
+ catch (err) {
561
+ logger.warn(`[eliza] Sandbox stop error: ${err instanceof Error ? err.message : String(err)}`);
562
+ }
563
+ }
564
+ }
565
+ catch (err) {
566
+ logger.warn(`[eliza] Sandbox shutdown error: ${formatError(err)}`);
567
+ }
568
+ try {
569
+ const runtime = current?.getRuntime();
570
+ if (runtime) {
571
+ // SIGINT/SIGTERM is an interactive/dev teardown — use the capped fast
572
+ // path so the process exits promptly instead of waiting on in-flight
573
+ // deferred service starts or an embedding-queue flush (#9605).
574
+ await shutdownRuntime(runtime, "signal shutdown", { fast: true });
575
+ }
576
+ }
577
+ catch (err) {
578
+ logger.warn(`[eliza] Error during shutdown: ${formatError(err)}`);
579
+ }
580
+ process.exit(0);
581
+ })();
582
+ await signalShutdownPromise;
583
+ };
584
+ process.on("SIGINT", () => void shutdown());
585
+ process.on("SIGTERM", () => void shutdown());
586
+ signalHandlersRegistered = true;
587
+ }
588
+ /**
589
+ * Map of baseline bundled @elizaos plugin names to their statically imported
590
+ * modules.
591
+ *
592
+ * Post-release plugins are intentionally excluded so the packaged runtime can
593
+ * ship a smaller baseline bundle. Those plugins fall through to dynamic
594
+ * import() and can be installed later via the plugin installer.
595
+ *
596
+ * The actual `Object.assign(STATIC_ELIZA_PLUGINS, ...)` registration runs
597
+ * inside `ensureCoreStaticPluginsRegistered()` (defined above), which is
598
+ * called at the top of every runtime entry point. Doing it there instead of
599
+ * at module init avoids a `Bun.build` cross-module top-level-await scheduling
600
+ * bug that strands `@elizaos/plugin-sql` undefined in the bundled runtime.
601
+ */
602
+ // NODE_PATH so dynamic plugin imports (e.g. @elizaos/plugin-*) resolve.
603
+ // WHY: When eliza is loaded from dist/ or by a test runner, Node's resolution does not
604
+ // search repo root node_modules; import("@elizaos/plugin-*") then fails. We prepend
605
+ // repo root node_modules only if not already in NODE_PATH (run-node.mjs may have set it)
606
+ // to avoid duplicate entries; _initPaths() makes Node re-read NODE_PATH. See docs/plugin-resolution-and-node-path.md.
607
+ // We walk up from this file to find node_modules — we do not assume a fixed depth
608
+ // (e.g. two levels for src/runtime/ or dist/runtime/) so we still work if build
609
+ // output structure changes (e.g. flat dist). First directory with node_modules wins.
610
+ const _elizaDir = path.dirname(fileURLToPath(import.meta.url));
611
+ let _dir = _elizaDir;
612
+ let _rootModules = null;
613
+ while (_dir !== path.dirname(_dir)) {
614
+ const candidate = path.join(_dir, "node_modules");
615
+ if (existsSync(candidate)) {
616
+ _rootModules = candidate;
617
+ break;
618
+ }
619
+ _dir = path.dirname(_dir);
620
+ }
621
+ if (_rootModules) {
622
+ const prev = process.env.NODE_PATH ?? "";
623
+ const entries = prev ? prev.split(path.delimiter) : [];
624
+ const normalizedRoot = path.resolve(_rootModules);
625
+ if (!entries.some((e) => path.resolve(e) === normalizedRoot)) {
626
+ process.env.NODE_PATH = prev
627
+ ? `${_rootModules}${path.delimiter}${prev}`
628
+ : _rootModules;
629
+ createRequire(import.meta.url)("node:module").Module._initPaths();
630
+ }
631
+ }
632
+ export async function configureLocalEmbeddingPlugin(_plugin, config) {
633
+ const { detectEmbeddingPreset } = await import("@elizaos/plugin-local-inference/runtime/embedding-presets");
634
+ const detectedPreset = detectEmbeddingPreset();
635
+ const SQL_COMPATIBLE_EMBEDDING_DIMENSIONS = new Set([
636
+ 384, 512, 768, 1024, 1536, 2048, 3072,
637
+ ]);
638
+ const normalizeEmbeddingDimensions = (rawValue) => {
639
+ if (!rawValue)
640
+ return undefined;
641
+ const parsed = Number.parseInt(rawValue, 10);
642
+ if (!Number.isInteger(parsed) || parsed <= 0)
643
+ return undefined;
644
+ return SQL_COMPATIBLE_EMBEDDING_DIMENSIONS.has(parsed)
645
+ ? String(parsed)
646
+ : "384";
647
+ };
648
+ const embeddingConfig = config?.embedding;
649
+ const configuredModel = embeddingConfig?.model?.trim();
650
+ const configuredRepo = embeddingConfig?.modelRepo?.trim();
651
+ const configuredDimensions = normalizeEmbeddingDimensions(typeof embeddingConfig?.dimensions === "number" &&
652
+ Number.isInteger(embeddingConfig.dimensions) &&
653
+ embeddingConfig.dimensions > 0
654
+ ? String(embeddingConfig.dimensions)
655
+ : undefined);
656
+ const detectedDimensions = normalizeEmbeddingDimensions(String(detectedPreset.dimensions));
657
+ const configuredContextSize = typeof embeddingConfig?.contextSize === "number" &&
658
+ Number.isInteger(embeddingConfig.contextSize) &&
659
+ embeddingConfig.contextSize > 0
660
+ ? String(embeddingConfig.contextSize)
661
+ : undefined;
662
+ const configuredGpuLayers = (() => {
663
+ const value = embeddingConfig?.gpuLayers;
664
+ if (typeof value === "number" && Number.isInteger(value) && value >= 0) {
665
+ return String(value);
666
+ }
667
+ if (value === "auto" || value === "max") {
668
+ return "auto";
669
+ }
670
+ return undefined;
671
+ })();
672
+ const setEnvIfMissing = (key, value) => {
673
+ if (!value || process.env[key])
674
+ return;
675
+ process.env[key] = value;
676
+ };
677
+ const setEnvFromConfig = (key, value) => {
678
+ if (!value)
679
+ return;
680
+ process.env[key] = value;
681
+ };
682
+ // Apply Eliza's hardware-adaptive preset selection. Hard-coding the standard
683
+ // preset here forces slower first-run downloads on Windows and low-spec
684
+ // machines.
685
+ setEnvIfMissing("LOCAL_EMBEDDING_MODEL", configuredModel || detectedPreset.model);
686
+ if (configuredRepo) {
687
+ setEnvFromConfig("LOCAL_EMBEDDING_MODEL_REPO", configuredRepo);
688
+ }
689
+ else if (!configuredModel) {
690
+ setEnvIfMissing("LOCAL_EMBEDDING_MODEL_REPO", detectedPreset.modelRepo);
691
+ }
692
+ if (configuredDimensions) {
693
+ setEnvFromConfig("LOCAL_EMBEDDING_DIMENSIONS", configuredDimensions);
694
+ }
695
+ else if (!configuredModel) {
696
+ setEnvIfMissing("LOCAL_EMBEDDING_DIMENSIONS", detectedDimensions);
697
+ }
698
+ if (configuredContextSize) {
699
+ setEnvFromConfig("LOCAL_EMBEDDING_CONTEXT_SIZE", configuredContextSize);
700
+ }
701
+ else if (!configuredModel) {
702
+ setEnvIfMissing("LOCAL_EMBEDDING_CONTEXT_SIZE", String(detectedPreset.contextSize));
703
+ }
704
+ if (configuredGpuLayers) {
705
+ process.env.LOCAL_EMBEDDING_GPU_LAYERS = configuredGpuLayers;
706
+ }
707
+ else if (!process.env.LOCAL_EMBEDDING_GPU_LAYERS) {
708
+ process.env.LOCAL_EMBEDDING_GPU_LAYERS = String(detectedPreset.gpuLayers);
709
+ }
710
+ // Performance tuning
711
+ // Disable mmap on Metal to prevent "different text" errors with some models
712
+ setEnvIfMissing("LOCAL_EMBEDDING_USE_MMAP", detectedPreset.gpuLayers === "auto" ? "false" : "true");
713
+ setEnvIfMissing("MODELS_DIR", path.join(resolveStateDir(), "models"));
714
+ const documentEmbeddingProvider = process.env.EMBEDDING_PROVIDER?.trim();
715
+ if (!documentEmbeddingProvider ||
716
+ !["local", "openai", "google"].includes(documentEmbeddingProvider.toLowerCase())) {
717
+ process.env.EMBEDDING_PROVIDER = "local";
718
+ }
719
+ // Normalize Google AI API key aliases — the elizaOS plugin and @google/genai
720
+ // SDK expect different env var names. Canonicalize to the long form that
721
+ // @elizaos/plugin-google-genai reads via runtime.getSetting(). Users can set
722
+ // any of: GEMINI_API_KEY, GOOGLE_API_KEY, GOOGLE_GENERATIVE_AI_API_KEY.
723
+ setEnvIfMissing("GOOGLE_GENERATIVE_AI_API_KEY", process.env.GEMINI_API_KEY || process.env.GOOGLE_API_KEY);
724
+ // Default Google model names — the Google GenAI plugin's getSetting() returns
725
+ // null (not undefined) for missing keys, but the plugin checks !== undefined
726
+ // causing String(null) = "null" to be sent as the model name. Set sensible
727
+ // defaults so the plugin always has valid model names.
728
+ setEnvIfMissing("GOOGLE_SMALL_MODEL", "gemini-3-flash-preview");
729
+ setEnvIfMissing("GOOGLE_LARGE_MODEL", "gemini-3.1-pro-preview");
730
+ // Default Groq model names — plugin-groq still ships a deprecated large-model
731
+ // fallback. Seed runtime defaults before plugin init so direct Groq provider
732
+ // sessions use the approved GPT-OSS default.
733
+ const currentSharedSmallModel = process.env.OPENAI_SMALL_MODEL ?? process.env.SMALL_MODEL;
734
+ const currentSharedLargeModel = process.env.OPENAI_LARGE_MODEL ?? process.env.LARGE_MODEL;
735
+ setEnvIfMissing("GROQ_SMALL_MODEL", currentSharedSmallModel && !isLikelyOpenAiTextModel(currentSharedSmallModel)
736
+ ? currentSharedSmallModel
737
+ : "openai/gpt-oss-120b");
738
+ setEnvIfMissing("GROQ_LARGE_MODEL", currentSharedLargeModel && !isLikelyOpenAiTextModel(currentSharedLargeModel)
739
+ ? currentSharedLargeModel
740
+ : "openai/gpt-oss-120b");
741
+ // Default Cerebras model — plugin-openai's Cerebras mode otherwise falls
742
+ // back to OpenAI-only ids (gpt-5 / gpt-5.4-mini) when CEREBRAS_MODEL is
743
+ // unset, which 404 on api.cerebras.ai for direct own-key sessions that
744
+ // never hit the first-run / provider-switch path. Seed the approved GPT-OSS
745
+ // default before plugin init (mirrors the Groq handling above; Cerebras
746
+ // shares one CEREBRAS_MODEL for both small and large).
747
+ setEnvIfMissing("CEREBRAS_MODEL", currentSharedLargeModel && !isLikelyOpenAiTextModel(currentSharedLargeModel)
748
+ ? currentSharedLargeModel
749
+ : "gpt-oss-120b");
750
+ logger.info(`[eliza] Configured local embedding env: ${process.env.LOCAL_EMBEDDING_MODEL} (repo: ${process.env.LOCAL_EMBEDDING_MODEL_REPO ?? "auto"}, dims: ${process.env.LOCAL_EMBEDDING_DIMENSIONS ?? "auto"}, ctx: ${process.env.LOCAL_EMBEDDING_CONTEXT_SIZE ?? "auto"}, GPU: ${process.env.LOCAL_EMBEDDING_GPU_LAYERS}, mmap: ${process.env.LOCAL_EMBEDDING_USE_MMAP})`);
751
+ }
752
+ // ---------------------------------------------------------------------------
753
+ // Helpers
754
+ // ---------------------------------------------------------------------------
755
+ function trimEnvString(value) {
756
+ if (typeof value !== "string")
757
+ return undefined;
758
+ const trimmed = value.trim();
759
+ return trimmed.length > 0 ? trimmed : undefined;
760
+ }
761
+ function getMutableConfigEnv(config) {
762
+ if (!config.env ||
763
+ typeof config.env !== "object" ||
764
+ Array.isArray(config.env)) {
765
+ return null;
766
+ }
767
+ return config.env;
768
+ }
769
+ function getMutableConfigEnvVars(configEnv) {
770
+ if (!configEnv.vars ||
771
+ typeof configEnv.vars !== "object" ||
772
+ Array.isArray(configEnv.vars)) {
773
+ return null;
774
+ }
775
+ return configEnv.vars;
776
+ }
777
+ function readConfigEnvValue(config, key) {
778
+ const configEnv = getMutableConfigEnv(config);
779
+ if (!configEnv)
780
+ return undefined;
781
+ const vars = getMutableConfigEnvVars(configEnv);
782
+ return trimEnvString(vars?.[key]) ?? trimEnvString(configEnv[key]);
783
+ }
784
+ function readEffectiveEnvValue(config, key, env = process.env) {
785
+ return trimEnvString(env[key]) ?? readConfigEnvValue(config, key);
786
+ }
787
+ function setConfigEnvValue(config, key, value) {
788
+ if (!config.env ||
789
+ typeof config.env !== "object" ||
790
+ Array.isArray(config.env)) {
791
+ config.env = {};
792
+ }
793
+ const configEnv = config.env;
794
+ const vars = getMutableConfigEnvVars(configEnv);
795
+ if (vars) {
796
+ vars[key] = value;
797
+ delete configEnv[key];
798
+ return;
799
+ }
800
+ configEnv[key] = value;
801
+ }
802
+ function deleteConfigEnvValue(config, key) {
803
+ const configEnv = getMutableConfigEnv(config);
804
+ if (!configEnv)
805
+ return;
806
+ const vars = getMutableConfigEnvVars(configEnv);
807
+ if (vars) {
808
+ delete vars[key];
809
+ if (Object.keys(vars).length === 0) {
810
+ delete configEnv.vars;
811
+ }
812
+ }
813
+ delete configEnv[key];
814
+ }
815
+ function detectOpenAiBaseUrlProvider(baseUrl) {
816
+ try {
817
+ const hostname = new URL(baseUrl).hostname.trim().toLowerCase();
818
+ if (hostname === "api.groq.com" || hostname.endsWith(".groq.com")) {
819
+ return "groq";
820
+ }
821
+ }
822
+ catch {
823
+ return null;
824
+ }
825
+ return null;
826
+ }
827
+ function looksLikeGroqApiKey(value) {
828
+ return Boolean(value && /^gsk[-_]/i.test(value));
829
+ }
830
+ function isLikelyOpenAiTextModel(value) {
831
+ if (!value)
832
+ return false;
833
+ const normalized = value.trim().toLowerCase();
834
+ return normalized.startsWith("gpt-") || normalized.startsWith("openai/");
835
+ }
836
+ /**
837
+ * Normalize known-bad provider compatibility shims before plugin resolution.
838
+ *
839
+ * A common failure mode is routing the OpenAI plugin through Groq's
840
+ * OpenAI-compatible base URL while leaving OpenAI defaults (`gpt-5.5`,
841
+ * `gpt-5-mini`) in place. Structured output generation then fails during
842
+ * message handling because Groq does not serve those model IDs.
843
+ *
844
+ * When we can confidently detect that state, rewrite the effective runtime
845
+ * config to use the Groq plugin directly.
846
+ */
847
+ /** @internal Exported for testing. */
848
+ export function normalizeOpenAiCompatibleProviderConfig(config, env = process.env) {
849
+ const cloudInferenceEnabled = resolveElizaCloudTopology(config).services.inference;
850
+ if (cloudInferenceEnabled) {
851
+ return false;
852
+ }
853
+ const openaiBaseUrl = readEffectiveEnvValue(config, "OPENAI_BASE_URL", env);
854
+ if (!openaiBaseUrl) {
855
+ return false;
856
+ }
857
+ if (detectOpenAiBaseUrlProvider(openaiBaseUrl) !== "groq") {
858
+ return false;
859
+ }
860
+ const openaiApiKey = readEffectiveEnvValue(config, "OPENAI_API_KEY", env);
861
+ const groqApiKey = readEffectiveEnvValue(config, "GROQ_API_KEY", env);
862
+ const inheritedGroqApiKey = groqApiKey ??
863
+ (looksLikeGroqApiKey(openaiApiKey) ? openaiApiKey : undefined);
864
+ if (!inheritedGroqApiKey) {
865
+ return false;
866
+ }
867
+ const currentGroqSmallModel = readEffectiveEnvValue(config, "GROQ_SMALL_MODEL", env);
868
+ const currentGroqLargeModel = readEffectiveEnvValue(config, "GROQ_LARGE_MODEL", env);
869
+ const currentSharedSmallModel = readEffectiveEnvValue(config, "OPENAI_SMALL_MODEL", env) ??
870
+ readEffectiveEnvValue(config, "SMALL_MODEL", env);
871
+ const currentSharedLargeModel = readEffectiveEnvValue(config, "OPENAI_LARGE_MODEL", env) ??
872
+ readEffectiveEnvValue(config, "LARGE_MODEL", env);
873
+ const normalizedGroqSmallModel = currentGroqSmallModel ??
874
+ (currentSharedSmallModel &&
875
+ !isLikelyOpenAiTextModel(currentSharedSmallModel)
876
+ ? currentSharedSmallModel
877
+ : "openai/gpt-oss-120b");
878
+ const normalizedGroqLargeModel = currentGroqLargeModel ??
879
+ (currentSharedLargeModel &&
880
+ !isLikelyOpenAiTextModel(currentSharedLargeModel)
881
+ ? currentSharedLargeModel
882
+ : "openai/gpt-oss-120b");
883
+ env.GROQ_API_KEY = inheritedGroqApiKey;
884
+ env.GROQ_SMALL_MODEL = normalizedGroqSmallModel;
885
+ env.GROQ_LARGE_MODEL = normalizedGroqLargeModel;
886
+ setConfigEnvValue(config, "GROQ_API_KEY", inheritedGroqApiKey);
887
+ setConfigEnvValue(config, "GROQ_SMALL_MODEL", normalizedGroqSmallModel);
888
+ setConfigEnvValue(config, "GROQ_LARGE_MODEL", normalizedGroqLargeModel);
889
+ delete env.OPENAI_BASE_URL;
890
+ deleteConfigEnvValue(config, "OPENAI_BASE_URL");
891
+ const shouldDisableOpenAiKey = !openaiApiKey ||
892
+ openaiApiKey === groqApiKey ||
893
+ looksLikeGroqApiKey(openaiApiKey);
894
+ if (shouldDisableOpenAiKey) {
895
+ delete env.OPENAI_API_KEY;
896
+ deleteConfigEnvValue(config, "OPENAI_API_KEY");
897
+ }
898
+ const primaryModel = trimEnvString(config.agents?.defaults?.model?.primary);
899
+ if (shouldDisableOpenAiKey &&
900
+ primaryModel &&
901
+ (primaryModel.toLowerCase() === "openai" ||
902
+ isLikelyOpenAiTextModel(primaryModel))) {
903
+ config.agents ??= {};
904
+ config.agents.defaults ??= {};
905
+ config.agents.defaults.model = {
906
+ ...config.agents.defaults.model,
907
+ primary: "groq",
908
+ };
909
+ }
910
+ logger.warn("[eliza] Detected Groq routed through OPENAI_BASE_URL; normalizing runtime settings to use @elizaos/plugin-groq");
911
+ return true;
912
+ }
913
+ /** Redact username segments from filesystem paths to avoid leaking user info in logs. */
914
+ function _redactUserSegments(filepath) {
915
+ // Replace /Users/<name>/ or /home/<name>/ with /Users/<redacted>/ etc.
916
+ return filepath.replace(/\/(Users|home)\/[^/]+\//g, "/$1/<redacted>/");
917
+ }
918
+ /**
919
+ * Best-effort runtime shutdown that also closes the database adapter.
920
+ *
921
+ * AgentRuntime.stop() only stops services. plugin-sql keeps a process-global
922
+ * PGlite manager, so restarts must close the adapter or the next runtime can
923
+ * silently reuse the same broken manager instance.
924
+ */
925
+ export async function shutdownRuntime(runtime, context, options = {}) {
926
+ if (!runtime)
927
+ return;
928
+ const adapter = runtime.adapter;
929
+ let firstError = null;
930
+ try {
931
+ // Interactive/signal teardown asks for the capped fast path so Ctrl-C does
932
+ // not block on a slow deferred service start or a long embedding drain.
933
+ await runtime.stop(options.fast ? { fast: true } : undefined);
934
+ }
935
+ catch (err) {
936
+ firstError = err;
937
+ logger.warn(`[eliza] ${context}: runtime stop failed: ${formatError(err)}`);
938
+ }
939
+ if (adapter && typeof adapter.close === "function") {
940
+ try {
941
+ await adapter.close();
942
+ }
943
+ catch (err) {
944
+ if (!firstError) {
945
+ firstError = err;
946
+ }
947
+ logger.warn(`[eliza] ${context}: database adapter close failed: ${formatError(err)}`);
948
+ }
949
+ }
950
+ if (firstError) {
951
+ throw firstError;
952
+ }
953
+ }
954
+ /**
955
+ * Remove duplicate actions across an ordered list of plugins.
956
+ *
957
+ * When multiple plugins define an action with the same `name`, only the first
958
+ * occurrence is kept. This prevents "Action already registered" warnings from
959
+ * elizaOS core. The function mutates each plugin's `actions` array in-place.
960
+ */
961
+ export function deduplicatePluginActions(plugins) {
962
+ const seen = new Set();
963
+ for (const plugin of plugins) {
964
+ if (plugin.actions) {
965
+ plugin.actions = plugin.actions.filter((action) => {
966
+ if (seen.has(action.name)) {
967
+ logger.debug(`[eliza] Skipping duplicate action "${action.name}" from plugin "${plugin.name}"`);
968
+ return false;
969
+ }
970
+ seen.add(action.name);
971
+ return true;
972
+ });
973
+ }
974
+ }
975
+ }
976
+ /**
977
+ * Retrieve the AutonomyService from the runtime, returning null if unavailable.
978
+ * Uses a runtime property check to safely narrow the opaque Service return.
979
+ */
980
+ function getAutonomyService(runtime) {
981
+ const svc = runtime.getService("AUTONOMY") ?? runtime.getService("autonomy");
982
+ if (svc &&
983
+ "enableAutonomy" in svc &&
984
+ typeof svc.enableAutonomy === "function") {
985
+ return svc;
986
+ }
987
+ return null;
988
+ }
989
+ async function startAndRegisterAutonomyService(runtime) {
990
+ const service = await AutonomyService.start(runtime);
991
+ runtime.services.set("AUTONOMY", [service]);
992
+ return service;
993
+ }
994
+ async function waitForTrajectoriesService(runtime, context, timeoutMs = 3000) {
995
+ if (!runtimeTrajectoriesEnabled(runtime)) {
996
+ return;
997
+ }
998
+ const runtimeLike = runtime;
999
+ // Check if already available
1000
+ if (typeof runtimeLike.getService === "function") {
1001
+ const existing = runtimeLike.getService("trajectories");
1002
+ if (existing)
1003
+ return;
1004
+ }
1005
+ const registrationStatus = typeof runtimeLike.getServiceRegistrationStatus === "function"
1006
+ ? runtimeLike.getServiceRegistrationStatus("trajectories")
1007
+ : "unknown";
1008
+ if (registrationStatus !== "pending" &&
1009
+ registrationStatus !== "registering") {
1010
+ return;
1011
+ }
1012
+ if (typeof runtimeLike.getServiceLoadPromise !== "function")
1013
+ return;
1014
+ let timedOut = false;
1015
+ let timeoutHandle;
1016
+ const timeoutPromise = new Promise((resolve) => {
1017
+ timeoutHandle = setTimeout(() => {
1018
+ timedOut = true;
1019
+ resolve();
1020
+ }, timeoutMs);
1021
+ });
1022
+ try {
1023
+ await Promise.race([
1024
+ runtimeLike.getServiceLoadPromise("trajectories").then(() => { }),
1025
+ timeoutPromise,
1026
+ ]);
1027
+ if (timedOut) {
1028
+ logger.debug(`[eliza] trajectories still ${registrationStatus} after ${timeoutMs}ms (${context})`);
1029
+ }
1030
+ }
1031
+ catch (err) {
1032
+ logger.debug(`[eliza] trajectories registration failed while waiting (${context}): ${formatError(err)}`);
1033
+ }
1034
+ finally {
1035
+ if (timeoutHandle)
1036
+ clearTimeout(timeoutHandle);
1037
+ }
1038
+ }
1039
+ function ensureTrajectoryLoggerEnabled(runtime, context) {
1040
+ if (!runtimeTrajectoriesEnabled(runtime)) {
1041
+ logger.info(`[eliza] Native trajectories disabled (${context})`);
1042
+ return;
1043
+ }
1044
+ const trajectoryLogger = runtime.getService("trajectories");
1045
+ if (!trajectoryLogger) {
1046
+ logger.warn(`[eliza] trajectories service unavailable (${context}); trajectory capture disabled`);
1047
+ return;
1048
+ }
1049
+ const isEnabled = typeof trajectoryLogger.isEnabled === "function"
1050
+ ? trajectoryLogger.isEnabled()
1051
+ : shouldEnableTrajectoryLoggingByDefault();
1052
+ const shouldEnable = shouldEnableTrajectoryLoggingByDefault();
1053
+ if (isEnabled !== shouldEnable &&
1054
+ typeof trajectoryLogger.setEnabled === "function") {
1055
+ trajectoryLogger.setEnabled(shouldEnable);
1056
+ logger.info(`[eliza] trajectories defaulted ${shouldEnable ? "on" : "off"} (${context})`);
1057
+ }
1058
+ }
1059
+ async function installPromptOptimizationLayer(runtime, context, config) {
1060
+ try {
1061
+ const { installPromptOptimizations } = await import("./prompt-optimization.js");
1062
+ installPromptOptimizations(runtime, config);
1063
+ }
1064
+ catch (err) {
1065
+ logger.warn(`[eliza] Failed to install prompt optimizations (${context}): ${err instanceof Error ? err.message : err}`);
1066
+ }
1067
+ }
1068
+ async function prepareRuntimeForTrajectoryCapture(runtime, context, config) {
1069
+ await waitForTrajectoriesService(runtime, context);
1070
+ ensureTrajectoryLoggerEnabled(runtime, context);
1071
+ // Bridge the in-memory "trajectories" service to the SQL trajectory_steps
1072
+ // tables that the viewer + collection read. Without this the core service
1073
+ // captures LLM calls only into its own trajectory_step_index store, so every
1074
+ // platform without the plugin-training log-backfill (mobile, cloud) shows a
1075
+ // trajectory with zero recorded LLM calls. Patching here makes capture land
1076
+ // in trajectory_steps universally (local + cloud + mobile).
1077
+ try {
1078
+ await installDatabaseTrajectoryLogger(runtime);
1079
+ }
1080
+ catch (err) {
1081
+ logger.warn(`[eliza] Failed to install database trajectory logger (${context}): ${err instanceof Error ? err.message : err}`);
1082
+ }
1083
+ await installPromptOptimizationLayer(runtime, context, config);
1084
+ }
1085
+ // ---------------------------------------------------------------------------
1086
+ // Channel secret mapping
1087
+ // ---------------------------------------------------------------------------
1088
+ /**
1089
+ * Maps Eliza channel config fields to the environment variable names
1090
+ * that elizaOS plugins expect.
1091
+ *
1092
+ * Eliza stores channel credentials under `config.channels.<name>.<field>`,
1093
+ * while elizaOS plugins read them from process.env.
1094
+ */
1095
+ const CHANNEL_ENV_MAP = CONNECTOR_ENV_MAP;
1096
+ // ---------------------------------------------------------------------------
1097
+ // Plugin resolution
1098
+ // ---------------------------------------------------------------------------
1099
+ export { BLOCKING_CORE_PLUGINS, CORE_PLUGINS, DEFERRED_CORE_PLUGINS, LEAN_CHAT_PLUGINS, OPTIONAL_CORE_PLUGINS, };
1100
+ // CHANNEL_PLUGIN_MAP, PROVIDER_PLUGIN_MAP, and OPTIONAL_PLUGIN_MAP live in
1101
+ // ./plugin-collector.ts and are re-exported from this module for backward compatibility.
1102
+ // ---------------------------------------------------------------------------
1103
+ // Browser server pre-flight
1104
+ // ---------------------------------------------------------------------------
1105
+ /**
1106
+ * Returns true if the given env var key is safe to forward to runtime.settings.
1107
+ * Blocks blockchain private keys, secrets, passwords, tokens, credentials,
1108
+ * mnemonics, and seed phrases while allowing API keys that plugins need.
1109
+ */
1110
+ export function isEnvKeyAllowedForForwarding(key) {
1111
+ const upper = key.toUpperCase();
1112
+ if (upper === "ALLOW_NO_DATABASE")
1113
+ return false;
1114
+ // Block blockchain private keys
1115
+ if (upper.includes("PRIVATE_KEY"))
1116
+ return false;
1117
+ if (upper.startsWith("EVM_") || upper.startsWith("SOLANA_"))
1118
+ return false;
1119
+ // Block secrets, passwords, tokens, and seed phrases (but not API_KEY which plugins need)
1120
+ if (/(SECRET|PASSWORD|CREDENTIAL|MNEMONIC|SEED_PHRASE)/i.test(key))
1121
+ return false;
1122
+ if (/(ACCESS_TOKEN|REFRESH_TOKEN|SESSION_TOKEN|AUTH_TOKEN)$/i.test(key))
1123
+ return false;
1124
+ // Block elizaCloud connection keys — these must only come from config.cloud
1125
+ // via applyCloudConfigToEnv(). Forwarding them from config.env.vars into
1126
+ // runtime.settings would let a stale env-var shadow the live cloud key that
1127
+ // the app sets when the user connects through the UI.
1128
+ if (upper === "ELIZAOS_CLOUD_API_KEY" ||
1129
+ upper === "ELIZAOS_CLOUD_ENABLED" ||
1130
+ upper === "ELIZAOS_CLOUD_BASE_URL" ||
1131
+ upper === "ELIZAOS_CLOUD_NANO_MODEL" ||
1132
+ upper === "ELIZAOS_CLOUD_MEDIUM_MODEL" ||
1133
+ upper === "ELIZAOS_CLOUD_SMALL_MODEL" ||
1134
+ upper === "ELIZAOS_CLOUD_LARGE_MODEL" ||
1135
+ upper === "ELIZAOS_CLOUD_MEGA_MODEL" ||
1136
+ upper === "ELIZAOS_CLOUD_RESPONSE_HANDLER_MODEL" ||
1137
+ upper === "ELIZAOS_CLOUD_SHOULD_RESPOND_MODEL" ||
1138
+ upper === "ELIZAOS_CLOUD_ACTION_PLANNER_MODEL" ||
1139
+ upper === "ELIZAOS_CLOUD_PLANNER_MODEL")
1140
+ return false;
1141
+ return true;
1142
+ }
1143
+ function assertPersistentDatabaseRequired(runtime) {
1144
+ const raw = runtime.getSetting("ALLOW_NO_DATABASE") ?? process.env.ALLOW_NO_DATABASE;
1145
+ const normalized = String(raw ?? "")
1146
+ .trim()
1147
+ .toLowerCase();
1148
+ if (normalized === "true" ||
1149
+ normalized === "1" ||
1150
+ normalized === "yes" ||
1151
+ normalized === "on") {
1152
+ throw new Error(`Eliza requires persistent database storage and does not permit ALLOW_NO_DATABASE (agent ${runtime.agentId}). Remove ALLOW_NO_DATABASE from config/env and use @elizaos/plugin-sql.`);
1153
+ }
1154
+ }
1155
+ function isElizaCloudManagedProcessEnvKey(key) {
1156
+ const upper = key.toUpperCase();
1157
+ return (upper === "ELIZAOS_CLOUD_API_KEY" ||
1158
+ upper === "ELIZAOS_CLOUD_ENABLED" ||
1159
+ upper === "ELIZAOS_CLOUD_BASE_URL" ||
1160
+ upper === "ELIZAOS_CLOUD_NANO_MODEL" ||
1161
+ upper === "ELIZAOS_CLOUD_MEDIUM_MODEL" ||
1162
+ upper === "ELIZAOS_CLOUD_SMALL_MODEL" ||
1163
+ upper === "ELIZAOS_CLOUD_LARGE_MODEL" ||
1164
+ upper === "ELIZAOS_CLOUD_MEGA_MODEL" ||
1165
+ upper === "ELIZAOS_CLOUD_RESPONSE_HANDLER_MODEL" ||
1166
+ upper === "ELIZAOS_CLOUD_SHOULD_RESPOND_MODEL" ||
1167
+ upper === "ELIZAOS_CLOUD_ACTION_PLANNER_MODEL" ||
1168
+ upper === "ELIZAOS_CLOUD_PLANNER_MODEL");
1169
+ }
1170
+ // ---------------------------------------------------------------------------
1171
+ // Config → Character mapping
1172
+ // ---------------------------------------------------------------------------
1173
+ /**
1174
+ * Propagate channel credentials from Eliza config into process.env so
1175
+ * that elizaOS plugins can find them.
1176
+ */
1177
+ /** @internal Exported for testing. */
1178
+ export function applyConnectorSecretsToEnv(config) {
1179
+ // Prefer config.connectors, fall back to config.channels for backward compatibility
1180
+ const connectors = config.connectors ?? config.channels ?? {};
1181
+ for (const [channelName, channelConfig] of Object.entries(connectors)) {
1182
+ if (!channelConfig || typeof channelConfig !== "object")
1183
+ continue;
1184
+ const configObj = channelConfig;
1185
+ // Discord plugins in the ecosystem use both DISCORD_API_TOKEN and
1186
+ // DISCORD_BOT_TOKEN across versions. Mirror to both when available.
1187
+ if (channelName === "discord") {
1188
+ const tokenValue = (typeof configObj.token === "string" && configObj.token.trim()) ||
1189
+ (typeof configObj.botToken === "string" && configObj.botToken.trim()) ||
1190
+ "";
1191
+ if (tokenValue) {
1192
+ process.env.DISCORD_API_TOKEN = tokenValue;
1193
+ process.env.DISCORD_BOT_TOKEN = tokenValue;
1194
+ }
1195
+ }
1196
+ const envMap = CHANNEL_ENV_MAP[channelName];
1197
+ if (!envMap)
1198
+ continue;
1199
+ for (const [configField, envKey] of Object.entries(envMap)) {
1200
+ const value = configObj[configField];
1201
+ if (typeof value === "boolean" || typeof value === "number") {
1202
+ process.env[envKey] = String(value);
1203
+ }
1204
+ else if (typeof value === "string" && value.trim()) {
1205
+ process.env[envKey] = value;
1206
+ }
1207
+ }
1208
+ if (channelName === "whatsapp") {
1209
+ const allowFrom = configObj.allowFrom;
1210
+ if (Array.isArray(allowFrom) && allowFrom.length > 0) {
1211
+ const normalized = allowFrom
1212
+ .map((value) => String(value).trim())
1213
+ .filter(Boolean);
1214
+ if (normalized.length > 0) {
1215
+ process.env.WHATSAPP_ALLOW_FROM = normalized.join(",");
1216
+ }
1217
+ }
1218
+ const groupAllowFrom = configObj.groupAllowFrom;
1219
+ if (Array.isArray(groupAllowFrom) && groupAllowFrom.length > 0) {
1220
+ const normalized = groupAllowFrom
1221
+ .map((value) => String(value).trim())
1222
+ .filter(Boolean);
1223
+ if (normalized.length > 0) {
1224
+ process.env.WHATSAPP_GROUP_ALLOW_FROM = normalized.join(",");
1225
+ }
1226
+ }
1227
+ const accounts = configObj.accounts;
1228
+ if (accounts &&
1229
+ typeof accounts === "object" &&
1230
+ !Array.isArray(accounts)) {
1231
+ const firstEnabledAccount = Object.values(accounts).find((account) => {
1232
+ if (!account ||
1233
+ typeof account !== "object" ||
1234
+ Array.isArray(account)) {
1235
+ return false;
1236
+ }
1237
+ const candidate = account;
1238
+ return (candidate.enabled !== false && typeof candidate.authDir === "string");
1239
+ });
1240
+ if (firstEnabledAccount &&
1241
+ typeof firstEnabledAccount.authDir === "string" &&
1242
+ firstEnabledAccount.authDir.trim()) {
1243
+ process.env.WHATSAPP_AUTH_DIR = firstEnabledAccount.authDir.trim();
1244
+ }
1245
+ }
1246
+ }
1247
+ }
1248
+ }
1249
+ /**
1250
+ * Auto-resolve Discord Application ID from the bot token via Discord API.
1251
+ * Called during async runtime init so that users only need a bot token.
1252
+ */
1253
+ /** @internal Exported for testing. */
1254
+ export async function autoResolveDiscordAppId() {
1255
+ if (process.env.DISCORD_APPLICATION_ID)
1256
+ return;
1257
+ const discordToken = process.env.DISCORD_API_TOKEN || process.env.DISCORD_BOT_TOKEN;
1258
+ if (!discordToken)
1259
+ return;
1260
+ try {
1261
+ const res = await fetch("https://discord.com/api/v10/oauth2/applications/@me", {
1262
+ headers: { Authorization: `Bot ${discordToken}` },
1263
+ signal: AbortSignal.timeout(3_000),
1264
+ });
1265
+ if (!res.ok) {
1266
+ logger.warn(`[eliza] Failed to auto-resolve Discord Application ID: ${res.status}`);
1267
+ return;
1268
+ }
1269
+ const app = (await res.json());
1270
+ if (!app.id)
1271
+ return;
1272
+ process.env.DISCORD_APPLICATION_ID = app.id;
1273
+ logger.info(`[eliza] Auto-resolved Discord Application ID: ${app.id}`);
1274
+ }
1275
+ catch (err) {
1276
+ logger.warn(`[eliza] Could not auto-resolve Discord Application ID: ${err}`);
1277
+ }
1278
+ }
1279
+ /**
1280
+ * Fetch GitHub OAuth token from cloud if available and no local token is set.
1281
+ * Called during async runtime init after cloud config is applied.
1282
+ *
1283
+ * Flow: If the agent has a managed GitHub connection in the cloud, and no
1284
+ * local GITHUB_TOKEN is set, fetch the OAuth token from the cloud API and
1285
+ * inject it into process.env so plugins (plugin-github, git-workspace-service)
1286
+ * can use it for API calls and git credential helpers.
1287
+ */
1288
+ /** @internal Exported for testing. */
1289
+ export async function autoFetchCloudGithubToken(agentId) {
1290
+ // Skip if a local token is already configured
1291
+ if (process.env.GITHUB_TOKEN || process.env.GITHUB_PAT)
1292
+ return;
1293
+ // Need cloud credentials and an agent ID
1294
+ const cloudApiKey = process.env.ELIZAOS_CLOUD_API_KEY?.trim();
1295
+ const cloudBaseUrl = process.env.ELIZAOS_CLOUD_BASE_URL?.trim() || "https://api.elizacloud.ai";
1296
+ if (!cloudApiKey || !agentId)
1297
+ return;
1298
+ const managedNs = process.env.ELIZA_CLOUD_MANAGED_AGENTS_API_SEGMENT?.trim();
1299
+ if (!managedNs)
1300
+ return;
1301
+ try {
1302
+ const url = `${cloudBaseUrl}/api/v1/${managedNs}/agents/${encodeURIComponent(agentId)}/github/token`;
1303
+ const res = await fetch(url, {
1304
+ headers: {
1305
+ Authorization: `Bearer ${cloudApiKey}`,
1306
+ Accept: "application/json",
1307
+ },
1308
+ signal: AbortSignal.timeout(3_000),
1309
+ });
1310
+ if (!res.ok) {
1311
+ // 404 = no GitHub connection for this agent, which is fine
1312
+ if (res.status !== 404) {
1313
+ logger.debug(`[eliza] Failed to fetch cloud GitHub token: ${res.status}`);
1314
+ }
1315
+ return;
1316
+ }
1317
+ const body = (await res.json());
1318
+ if (!body.success || !body.data?.accessToken)
1319
+ return;
1320
+ process.env.GITHUB_TOKEN = body.data.accessToken;
1321
+ logger.info(`[eliza] Fetched GitHub token from cloud for @${body.data.githubUsername || "unknown"}`);
1322
+ }
1323
+ catch (err) {
1324
+ logger.info(`[eliza] Could not fetch cloud GitHub token: ${err}`);
1325
+ }
1326
+ }
1327
+ /**
1328
+ * Propagate cloud config from Eliza config into process.env so the
1329
+ * ElizaCloud plugin can discover settings at startup.
1330
+ */
1331
+ export function applyCloudConfigToEnv(config) {
1332
+ migrateLegacyRuntimeConfig(config);
1333
+ const cloud = config.cloud;
1334
+ const isCloudContainer = process.env.ELIZA_CLOUD_PROVISIONED === "1";
1335
+ if (!cloud && !isCloudContainer)
1336
+ return;
1337
+ const topology = resolveElizaCloudTopology(config);
1338
+ // Cloud inference is selected from the canonical first-run connection, not
1339
+ // just from raw cloud flags. This keeps linked cloud auth from re-enabling
1340
+ // Eliza Cloud after the user has switched to a local or remote provider.
1341
+ const effectivelyEnabled = topology.services.inference || isCloudContainer;
1342
+ const shouldLoadCloudPlugin = topology.shouldLoadPlugin || isCloudContainer;
1343
+ const setCloudUsageEnv = (key, enabled) => {
1344
+ if (enabled) {
1345
+ process.env[key] = "true";
1346
+ }
1347
+ else {
1348
+ delete process.env[key];
1349
+ }
1350
+ };
1351
+ if (isElizaSettingsDebugEnabled()) {
1352
+ const c = (cloud ?? {});
1353
+ logger.debug(`[eliza][settings][runtime] applyCloudConfigToEnv inference=${effectivelyEnabled} shouldLoadPlugin=${shouldLoadCloudPlugin} isCloudContainer=${isCloudContainer} cloud=${JSON.stringify(settingsDebugCloudSummary(c))}`);
1354
+ }
1355
+ setCloudUsageEnv("ELIZAOS_CLOUD_USE_INFERENCE", effectivelyEnabled);
1356
+ setCloudUsageEnv("ELIZAOS_CLOUD_USE_TTS", topology.services.tts || isCloudContainer);
1357
+ setCloudUsageEnv("ELIZAOS_CLOUD_USE_MEDIA", topology.services.media);
1358
+ // Cloud containers always use cloud embeddings: the cloud TEXT_EMBEDDING
1359
+ // handler (1536-dim) must win over plugin-local-inference's gte-small
1360
+ // (384-dim CPU GGUF). Without this, a dedicated cloud agent warms up and
1361
+ // serves local 384-dim embeddings while the SQL column is provisioned for the
1362
+ // cloud dimension → every memory insert is dropped on a dimension mismatch,
1363
+ // and the CPU embedding warmup wastes boot time.
1364
+ setCloudUsageEnv("ELIZAOS_CLOUD_USE_EMBEDDINGS", topology.services.embeddings || isCloudContainer);
1365
+ setCloudUsageEnv("ELIZAOS_CLOUD_USE_RPC", topology.services.rpc);
1366
+ if (effectivelyEnabled) {
1367
+ process.env.ELIZAOS_CLOUD_ENABLED = "true";
1368
+ }
1369
+ else {
1370
+ delete process.env.ELIZAOS_CLOUD_ENABLED;
1371
+ }
1372
+ if (shouldLoadCloudPlugin) {
1373
+ logger.info(`[eliza] Cloud config: inference=${topology.services.inference}, runtime=${topology.runtime}, hasApiKey=${Boolean(cloud?.apiKey || process.env.ELIZAOS_CLOUD_API_KEY)}, baseUrl=${cloud?.baseUrl ?? "(default)"}, isCloudContainer=${isCloudContainer}`);
1374
+ // Only propagate the API key when cloud is enabled AND it is a real
1375
+ // credential — never set the literal "[REDACTED]" placeholder (which can
1376
+ // leak into the config via UI round-trips through the redacted GET → PUT
1377
+ // cycle). WHY: when enabled is false (BYOK / disconnected), leaving the key
1378
+ // in process.env still auto-loads @elizaos/plugin-elizacloud and steals
1379
+ // TEXT_LARGE even if the JSON says cloud is off.
1380
+ const isRealApiKey = cloud?.apiKey && cloud.apiKey.trim().toUpperCase() !== "[REDACTED]";
1381
+ if (isRealApiKey) {
1382
+ process.env.ELIZAOS_CLOUD_API_KEY = cloud.apiKey;
1383
+ }
1384
+ else if (!isCloudContainer) {
1385
+ delete process.env.ELIZAOS_CLOUD_API_KEY;
1386
+ }
1387
+ if (cloud?.baseUrl) {
1388
+ process.env.ELIZAOS_CLOUD_BASE_URL = cloud.baseUrl;
1389
+ }
1390
+ else if (!isCloudContainer) {
1391
+ delete process.env.ELIZAOS_CLOUD_BASE_URL;
1392
+ }
1393
+ }
1394
+ else {
1395
+ delete process.env.ELIZAOS_CLOUD_NANO_MODEL;
1396
+ delete process.env.ELIZAOS_CLOUD_MEDIUM_MODEL;
1397
+ delete process.env.ELIZAOS_CLOUD_SMALL_MODEL;
1398
+ delete process.env.ELIZAOS_CLOUD_LARGE_MODEL;
1399
+ delete process.env.ELIZAOS_CLOUD_MEGA_MODEL;
1400
+ delete process.env.ELIZAOS_CLOUD_RESPONSE_HANDLER_MODEL;
1401
+ delete process.env.ELIZAOS_CLOUD_SHOULD_RESPOND_MODEL;
1402
+ delete process.env.ELIZAOS_CLOUD_ACTION_PLANNER_MODEL;
1403
+ delete process.env.ELIZAOS_CLOUD_PLANNER_MODEL;
1404
+ delete process.env.ELIZAOS_CLOUD_API_KEY;
1405
+ delete process.env.ELIZAOS_CLOUD_BASE_URL;
1406
+ }
1407
+ // Propagate model names so the cloud plugin picks them up. Falls back to
1408
+ // sensible defaults when cloud is enabled but no explicit selection exists.
1409
+ // Skip when inferenceMode is "byok"/"local" or services.inference is off —
1410
+ // user's own keys handle models.
1411
+ // If the user chose a subscription provider, treat that as "byok" unless
1412
+ // they explicitly set inferenceMode to "cloud".
1413
+ const llmText = resolveServiceRoutingInConfig(config)?.llmText;
1414
+ const models = config.models;
1415
+ if (effectivelyEnabled) {
1416
+ const nano = llmText?.nanoModel || models?.nano || DEFAULT_ELIZA_CLOUD_TEXT_MODEL;
1417
+ const small = llmText?.smallModel || models?.small || DEFAULT_ELIZA_CLOUD_TEXT_MODEL;
1418
+ const medium = llmText?.mediumModel || models?.medium || small;
1419
+ const large = llmText?.largeModel || models?.large || DEFAULT_ELIZA_CLOUD_TEXT_MODEL;
1420
+ const mega = llmText?.megaModel || models?.mega || large;
1421
+ const responseHandlerModel = llmText?.responseHandlerModel || llmText?.shouldRespondModel;
1422
+ const actionPlannerModel = llmText?.actionPlannerModel || llmText?.plannerModel;
1423
+ process.env.SMALL_MODEL = small;
1424
+ process.env.NANO_MODEL = nano;
1425
+ process.env.MEDIUM_MODEL = medium;
1426
+ process.env.LARGE_MODEL = large;
1427
+ process.env.MEGA_MODEL = mega;
1428
+ if (responseHandlerModel) {
1429
+ process.env.ELIZAOS_CLOUD_RESPONSE_HANDLER_MODEL = responseHandlerModel;
1430
+ process.env.ELIZAOS_CLOUD_SHOULD_RESPOND_MODEL = responseHandlerModel;
1431
+ }
1432
+ else {
1433
+ delete process.env.ELIZAOS_CLOUD_RESPONSE_HANDLER_MODEL;
1434
+ delete process.env.ELIZAOS_CLOUD_SHOULD_RESPOND_MODEL;
1435
+ }
1436
+ if (actionPlannerModel) {
1437
+ process.env.ELIZAOS_CLOUD_ACTION_PLANNER_MODEL = actionPlannerModel;
1438
+ process.env.ELIZAOS_CLOUD_PLANNER_MODEL = actionPlannerModel;
1439
+ }
1440
+ else {
1441
+ delete process.env.ELIZAOS_CLOUD_ACTION_PLANNER_MODEL;
1442
+ delete process.env.ELIZAOS_CLOUD_PLANNER_MODEL;
1443
+ }
1444
+ process.env.ELIZAOS_CLOUD_NANO_MODEL = nano;
1445
+ process.env.ELIZAOS_CLOUD_MEDIUM_MODEL = medium;
1446
+ process.env.ELIZAOS_CLOUD_SMALL_MODEL = small;
1447
+ process.env.ELIZAOS_CLOUD_LARGE_MODEL = large;
1448
+ process.env.ELIZAOS_CLOUD_MEGA_MODEL = mega;
1449
+ }
1450
+ else if (shouldLoadCloudPlugin) {
1451
+ // Cloud plugin may still be active for non-inference services; keep model
1452
+ // routing local by clearing the cloud model aliases.
1453
+ delete process.env.ELIZAOS_CLOUD_NANO_MODEL;
1454
+ delete process.env.ELIZAOS_CLOUD_MEDIUM_MODEL;
1455
+ delete process.env.ELIZAOS_CLOUD_SMALL_MODEL;
1456
+ delete process.env.ELIZAOS_CLOUD_LARGE_MODEL;
1457
+ delete process.env.ELIZAOS_CLOUD_MEGA_MODEL;
1458
+ delete process.env.ELIZAOS_CLOUD_RESPONSE_HANDLER_MODEL;
1459
+ delete process.env.ELIZAOS_CLOUD_SHOULD_RESPOND_MODEL;
1460
+ delete process.env.ELIZAOS_CLOUD_ACTION_PLANNER_MODEL;
1461
+ delete process.env.ELIZAOS_CLOUD_PLANNER_MODEL;
1462
+ delete process.env.NANO_MODEL;
1463
+ delete process.env.MEDIUM_MODEL;
1464
+ delete process.env.SMALL_MODEL;
1465
+ delete process.env.LARGE_MODEL;
1466
+ delete process.env.MEGA_MODEL;
1467
+ }
1468
+ // Propagate per-service disable flags so downstream code can check them
1469
+ // without needing direct access to the ElizaConfig object.
1470
+ if (!topology.services.tts) {
1471
+ process.env.ELIZA_CLOUD_TTS_DISABLED = "true";
1472
+ }
1473
+ else {
1474
+ delete process.env.ELIZA_CLOUD_TTS_DISABLED;
1475
+ }
1476
+ if (!topology.services.media) {
1477
+ process.env.ELIZA_CLOUD_MEDIA_DISABLED = "true";
1478
+ }
1479
+ else {
1480
+ delete process.env.ELIZA_CLOUD_MEDIA_DISABLED;
1481
+ }
1482
+ if (!topology.services.embeddings && !isCloudContainer) {
1483
+ process.env.ELIZA_CLOUD_EMBEDDINGS_DISABLED = "true";
1484
+ }
1485
+ else {
1486
+ delete process.env.ELIZA_CLOUD_EMBEDDINGS_DISABLED;
1487
+ }
1488
+ if (!topology.services.rpc) {
1489
+ process.env.ELIZA_CLOUD_RPC_DISABLED = "true";
1490
+ }
1491
+ else {
1492
+ delete process.env.ELIZA_CLOUD_RPC_DISABLED;
1493
+ }
1494
+ }
1495
+ /**
1496
+ * Translate `config.database` into the environment variables that
1497
+ * `@elizaos/plugin-sql` reads at init time (`POSTGRES_URL`, `PGLITE_DATA_DIR`).
1498
+ *
1499
+ * When the provider is "postgres", we build a connection string from the
1500
+ * credentials (or use the explicit `connectionString` field) and set
1501
+ * `POSTGRES_URL`. When the provider is "pglite" (the default), we set
1502
+ * `PGLITE_DATA_DIR` to either the configured value or the resolved default
1503
+ * workspace (`<workspace>/.elizadb`) and remove any stale
1504
+ * `POSTGRES_URL`.
1505
+ */
1506
+ /** @internal Exported for testing. */
1507
+ export function applyX402ConfigToEnv(config) {
1508
+ const x402 = config.x402;
1509
+ if (!x402?.enabled)
1510
+ return;
1511
+ if (!process.env.X402_ENABLED)
1512
+ process.env.X402_ENABLED = "true";
1513
+ if (x402.apiKey && !process.env.X402_API_KEY)
1514
+ process.env.X402_API_KEY = x402.apiKey;
1515
+ if (x402.baseUrl && !process.env.X402_BASE_URL)
1516
+ process.env.X402_BASE_URL = x402.baseUrl;
1517
+ }
1518
+ function resolveDefaultPgliteDataDir(config) {
1519
+ const workspaceDir = config.agents?.defaults?.workspace ?? resolveDefaultAgentWorkspaceDir();
1520
+ return path.join(resolveUserPath(workspaceDir), ".elizadb");
1521
+ }
1522
+ /**
1523
+ * The effective database provider. An explicit `config.database.provider` wins;
1524
+ * otherwise a POSTGRES_URL/DATABASE_URL present in the environment means
1525
+ * Postgres. Without this, the provider defaulted to "pglite" whenever the
1526
+ * loaded config lacked an explicit provider — even when Postgres was wired via
1527
+ * env — so the WebAssembly PGlite build was attempted and aborted on runtimes
1528
+ * that have no WASM (e.g. the riscv64 image, which provisions native Postgres).
1529
+ * Keeping env authoritative makes the env-only Postgres path consistent across
1530
+ * applyDatabaseConfigToEnv, resolveActivePgliteDataDir, and the provider log.
1531
+ */
1532
+ function resolveEffectiveDbProvider(config) {
1533
+ if (config.database?.provider) {
1534
+ return config.database.provider === "postgres" ? "postgres" : "pglite";
1535
+ }
1536
+ if (process.env.POSTGRES_URL?.trim() || process.env.DATABASE_URL?.trim()) {
1537
+ return "postgres";
1538
+ }
1539
+ return "pglite";
1540
+ }
1541
+ /** @internal Exported for testing. */
1542
+ export function applyDatabaseConfigToEnv(config) {
1543
+ const db = config.database;
1544
+ const provider = resolveEffectiveDbProvider(config);
1545
+ const databaseUrl = process.env.DATABASE_URL?.trim();
1546
+ const postgresUrl = process.env.POSTGRES_URL?.trim();
1547
+ if (provider === "postgres") {
1548
+ const pg = db?.postgres;
1549
+ let url = pg?.connectionString ?? postgresUrl ?? databaseUrl;
1550
+ if (!url && pg) {
1551
+ const host = pg.host ?? "localhost";
1552
+ const port = pg.port ?? 5432;
1553
+ const user = encodeURIComponent(pg.user ?? "postgres");
1554
+ const password = pg.password ? encodeURIComponent(pg.password) : "";
1555
+ const database = pg.database ?? "postgres";
1556
+ const auth = password ? `${user}:${password}` : user;
1557
+ const sslParam = pg.ssl ? "?sslmode=verify-full" : "";
1558
+ url = `postgresql://${auth}@${host}:${port}/${database}${sslParam}`;
1559
+ }
1560
+ process.env.POSTGRES_URL = url;
1561
+ // Clear PGLite dir so plugin-sql does not fall back to PGLite
1562
+ delete process.env.PGLITE_DATA_DIR;
1563
+ if (!db?.provider &&
1564
+ databaseUrl &&
1565
+ (!postgresUrl || postgresUrl === databaseUrl)) {
1566
+ logger.info("[eliza] DATABASE_URL detected: using Postgres database");
1567
+ }
1568
+ }
1569
+ else {
1570
+ // PGLite mode (default): ensure no leftover POSTGRES_URL and pin
1571
+ // PGLite to the workspace path unless overridden by config/env.
1572
+ delete process.env.POSTGRES_URL;
1573
+ const configuredDataDir = db?.pglite?.dataDir?.trim();
1574
+ if (configuredDataDir) {
1575
+ process.env.PGLITE_DATA_DIR = resolveUserPath(configuredDataDir);
1576
+ // Fall through to directory creation below instead of returning early
1577
+ }
1578
+ const envDataDir = process.env.PGLITE_DATA_DIR?.trim();
1579
+ if (!envDataDir) {
1580
+ process.env.PGLITE_DATA_DIR = resolveDefaultPgliteDataDir(config);
1581
+ }
1582
+ // Ensure the PGlite data directory exists before init so PGlite does
1583
+ // not silently fall back to in-memory mode on first run.
1584
+ const dataDir = process.env.PGLITE_DATA_DIR;
1585
+ if (dataDir) {
1586
+ const alreadyExisted = existsSync(dataDir);
1587
+ mkdirSync(dataDir, { recursive: true });
1588
+ logger.info(`[eliza] PGlite data dir: ${dataDir} (${alreadyExisted ? "existed" : "created"})`);
1589
+ // Remove stale postmaster.pid left by a crashed process. Without this,
1590
+ // PGlite sees the lock and either fails or, with explicit destructive
1591
+ // recovery enabled, triggers the resetPgliteDataDir path.
1592
+ cleanStalePglitePid(dataDir);
1593
+ }
1594
+ }
1595
+ }
1596
+ function reconcilePglitePidFile(dataDir) {
1597
+ const pidPath = path.join(dataDir, "postmaster.pid");
1598
+ if (!existsSync(pidPath))
1599
+ return "missing";
1600
+ try {
1601
+ const content = readFileSync(pidPath, "utf-8");
1602
+ const firstLine = content.split("\n")[0]?.trim();
1603
+ const pid = parseInt(firstLine, 10);
1604
+ if (Number.isNaN(pid) || pid <= 0) {
1605
+ // Malformed pid file — remove it
1606
+ unlinkSync(pidPath);
1607
+ logger.debug(`[eliza] Removed malformed PGlite postmaster.pid`);
1608
+ return "cleared-malformed";
1609
+ }
1610
+ // Check if the process is still alive
1611
+ try {
1612
+ process.kill(pid, 0); // signal 0 = existence check, doesn't kill
1613
+ // Process exists — pid file is NOT stale, leave it alone
1614
+ logger.info(`[eliza] PGlite postmaster.pid references running process ${pid} — leaving intact`);
1615
+ return "active";
1616
+ }
1617
+ catch (killErr) {
1618
+ const code = killErr.code;
1619
+ if (code === "ESRCH") {
1620
+ // Process doesn't exist — stale pid file, safe to remove
1621
+ unlinkSync(pidPath);
1622
+ logger.debug(`[eliza] Removed stale PGlite postmaster.pid (process ${pid} not running)`);
1623
+ return "cleared-stale";
1624
+ }
1625
+ else {
1626
+ // EPERM or other — process may be alive under a different user,
1627
+ // leave the file alone to avoid data directory corruption
1628
+ logger.warn(`[eliza] Cannot confirm postmaster.pid staleness (${code}) — leaving intact`);
1629
+ return "active-unconfirmed";
1630
+ }
1631
+ }
1632
+ }
1633
+ catch (err) {
1634
+ logger.warn(`[eliza] Failed to check PGlite postmaster.pid: ${formatError(err)}`);
1635
+ return "check-failed";
1636
+ }
1637
+ }
1638
+ /**
1639
+ * Check for and remove a stale postmaster.pid in the PGlite data directory.
1640
+ * The pid file is stale if the recorded process is no longer running.
1641
+ */
1642
+ export function cleanStalePglitePid(dataDir) {
1643
+ try {
1644
+ reconcilePglitePidFile(dataDir);
1645
+ }
1646
+ catch (err) {
1647
+ logger.warn(`[eliza] PGlite PID reconciliation failed: ${err}`);
1648
+ }
1649
+ }
1650
+ function collectErrorMessages(err) {
1651
+ const messages = [];
1652
+ const seen = new Set();
1653
+ let current = err;
1654
+ while (current && !seen.has(current)) {
1655
+ seen.add(current);
1656
+ if (typeof current === "string") {
1657
+ messages.push(current);
1658
+ break;
1659
+ }
1660
+ if (current instanceof Error) {
1661
+ if (current.message)
1662
+ messages.push(current.message);
1663
+ if (current.stack)
1664
+ messages.push(current.stack);
1665
+ current = current.cause;
1666
+ continue;
1667
+ }
1668
+ if (typeof current === "object") {
1669
+ const maybeErr = current;
1670
+ if (typeof maybeErr.message === "string" && maybeErr.message) {
1671
+ messages.push(maybeErr.message);
1672
+ }
1673
+ if (maybeErr.cause !== undefined) {
1674
+ current = maybeErr.cause;
1675
+ continue;
1676
+ }
1677
+ }
1678
+ break;
1679
+ }
1680
+ return messages;
1681
+ }
1682
+ function isPgliteLockError(err) {
1683
+ const haystack = collectErrorMessages(err).join("\n").toLowerCase();
1684
+ if (!haystack)
1685
+ return false;
1686
+ const hasPglite = haystack.includes("pglite");
1687
+ const hasSqlite = haystack.includes("sqlite");
1688
+ const hasLockSignal = haystack.includes("database is locked") ||
1689
+ haystack.includes("lock file already exists");
1690
+ return hasLockSignal && (hasPglite || hasSqlite);
1691
+ }
1692
+ /** @internal Exported for testing. */
1693
+ export function isRecoverablePgliteInitError(err) {
1694
+ const code = getPgliteErrorCode(err);
1695
+ if (code === PGLITE_ERROR_CODES.ACTIVE_LOCK ||
1696
+ code === PGLITE_ERROR_CODES.CORRUPT_DATA ||
1697
+ code === PGLITE_ERROR_CODES.MANUAL_RESET_REQUIRED) {
1698
+ return true;
1699
+ }
1700
+ const haystack = collectErrorMessages(err).join("\n").toLowerCase();
1701
+ if (!haystack)
1702
+ return false;
1703
+ const hasAbort = haystack.includes("aborted(). build with -sassertions");
1704
+ const hasPglite = haystack.includes("pglite");
1705
+ const _hasSqlite = haystack.includes("sqlite");
1706
+ const hasMigrationsSchema = haystack.includes("create schema if not exists migrations") ||
1707
+ haystack.includes("failed query: create schema if not exists migrations");
1708
+ const hasRecoverableStorageSignal = [
1709
+ "database disk image is malformed",
1710
+ "file is not a database",
1711
+ "malformed database schema",
1712
+ "database is locked",
1713
+ "lock file already exists",
1714
+ "wal file",
1715
+ "checkpoint failed",
1716
+ "checksum mismatch",
1717
+ "corrupt",
1718
+ "could not read blocks",
1719
+ "read only ",
1720
+ "unreachable code should not be executed",
1721
+ "_pgl_backend",
1722
+ ].some((needle) => haystack.includes(needle));
1723
+ if (hasMigrationsSchema)
1724
+ return true;
1725
+ if (hasAbort && hasPglite)
1726
+ return true;
1727
+ if (hasRecoverableStorageSignal)
1728
+ return true;
1729
+ return false;
1730
+ }
1731
+ /** @internal Exported for testing. */
1732
+ export function getPgliteRecoveryAction(err, dataDir) {
1733
+ const code = getPgliteErrorCode(err);
1734
+ if (code === PGLITE_ERROR_CODES.ACTIVE_LOCK) {
1735
+ return "fail-active-lock";
1736
+ }
1737
+ if (code === PGLITE_ERROR_CODES.CORRUPT_DATA ||
1738
+ code === PGLITE_ERROR_CODES.MANUAL_RESET_REQUIRED) {
1739
+ return "fail-manual-reset";
1740
+ }
1741
+ if (!isRecoverablePgliteInitError(err))
1742
+ return "none";
1743
+ const pidStatus = reconcilePglitePidFile(dataDir);
1744
+ const treatPidAsActiveLock = code === PGLITE_ERROR_CODES.ACTIVE_LOCK || isPgliteLockError(err);
1745
+ if ((treatPidAsActiveLock && pidStatus === "active") ||
1746
+ (treatPidAsActiveLock && pidStatus === "active-unconfirmed") ||
1747
+ (treatPidAsActiveLock && pidStatus === "check-failed")) {
1748
+ return "fail-active-lock";
1749
+ }
1750
+ if (pidStatus === "cleared-stale" || pidStatus === "cleared-malformed") {
1751
+ return "retry-without-reset";
1752
+ }
1753
+ return "fail-manual-reset";
1754
+ }
1755
+ function createActivePgliteLockError(dataDir, err) {
1756
+ if (getPgliteErrorCode(err) === PGLITE_ERROR_CODES.ACTIVE_LOCK &&
1757
+ err instanceof Error) {
1758
+ return err;
1759
+ }
1760
+ return createPgliteInitError(PGLITE_ERROR_CODES.ACTIVE_LOCK, `PGLite data dir is already in use at ${dataDir}. Close the other Eliza or Eliza process, or set a different PGLITE_DATA_DIR before retrying.`, { cause: err, dataDir });
1761
+ }
1762
+ function formatPgliteFailure(err) {
1763
+ return collectErrorMessages(err)[0] ?? formatError(err);
1764
+ }
1765
+ function createManualResetRequiredPgliteError(dataDir, err) {
1766
+ if (getPgliteErrorCode(err) === PGLITE_ERROR_CODES.MANUAL_RESET_REQUIRED &&
1767
+ err instanceof Error) {
1768
+ return err;
1769
+ }
1770
+ const errorText = formatPgliteFailure(err);
1771
+ const cause = getPgliteErrorCode(err) === PGLITE_ERROR_CODES.CORRUPT_DATA
1772
+ ? err
1773
+ : createPgliteInitError(PGLITE_ERROR_CODES.CORRUPT_DATA, `PGlite data dir at ${dataDir} appears corrupt or unreadable: ${errorText}`, { cause: err, dataDir });
1774
+ return createPgliteInitError(PGLITE_ERROR_CODES.MANUAL_RESET_REQUIRED, `PGlite initialization failed for ${dataDir}: ${errorText}. Stop Eliza, then rename or delete only this directory before retrying: ${dataDir}`, { cause, dataDir });
1775
+ }
1776
+ export function isFatalPgliteStartupError(err) {
1777
+ const code = getPgliteErrorCode(err);
1778
+ return (code === PGLITE_ERROR_CODES.ACTIVE_LOCK ||
1779
+ code === PGLITE_ERROR_CODES.CORRUPT_DATA ||
1780
+ code === PGLITE_ERROR_CODES.MANUAL_RESET_REQUIRED);
1781
+ }
1782
+ function resolveActivePgliteDataDir(config) {
1783
+ const provider = resolveEffectiveDbProvider(config);
1784
+ if (provider === "postgres")
1785
+ return null;
1786
+ const configured = process.env.PGLITE_DATA_DIR?.trim();
1787
+ const dataDir = configured || resolveDefaultPgliteDataDir(config);
1788
+ return resolveUserPath(dataDir);
1789
+ }
1790
+ /** Call whichever init method the adapter exposes (.init or .initialize). */
1791
+ async function callAdapterInit(adapter) {
1792
+ const fn = "init" in adapter &&
1793
+ typeof adapter.init === "function"
1794
+ ? adapter.init
1795
+ : adapter.initialize;
1796
+ if (typeof fn === "function")
1797
+ await fn.call(adapter);
1798
+ }
1799
+ async function initializeDatabaseAdapter(runtime, config) {
1800
+ if (!runtime.adapter || (await runtime.adapter.isReady()))
1801
+ return;
1802
+ try {
1803
+ await callAdapterInit(runtime.adapter);
1804
+ logger.info("[eliza] Database adapter initialized early (before plugin inits)");
1805
+ }
1806
+ catch (err) {
1807
+ const pgliteDataDir = resolveActivePgliteDataDir(config);
1808
+ if (!pgliteDataDir) {
1809
+ throw err;
1810
+ }
1811
+ const recoveryAction = getPgliteRecoveryAction(err, pgliteDataDir);
1812
+ if (recoveryAction === "none") {
1813
+ throw err;
1814
+ }
1815
+ if (recoveryAction === "fail-active-lock") {
1816
+ throw createActivePgliteLockError(pgliteDataDir, err);
1817
+ }
1818
+ if (recoveryAction === "fail-manual-reset") {
1819
+ throw createManualResetRequiredPgliteError(pgliteDataDir, err);
1820
+ }
1821
+ logger.warn(`[eliza] PGLite init failed (${formatError(err)}). Cleared a stale PGLite lock in ${pgliteDataDir} and retrying without resetting data.`);
1822
+ await callAdapterInit(runtime.adapter);
1823
+ logger.info("[eliza] Database adapter recovered after clearing a stale PGLite lock");
1824
+ }
1825
+ // Health check: verify PGlite data directory has files after init.
1826
+ // Runs on BOTH the happy path and the recovery path.
1827
+ await verifyPgliteDataDir(config);
1828
+ }
1829
+ /**
1830
+ * Verify PGlite data directory contains files after init.
1831
+ * Warns if the directory is empty (suggests ephemeral/in-memory fallback).
1832
+ */
1833
+ async function verifyPgliteDataDir(config) {
1834
+ const pgliteDataDir = resolveActivePgliteDataDir(config);
1835
+ if (!pgliteDataDir || !existsSync(pgliteDataDir))
1836
+ return;
1837
+ try {
1838
+ const files = await fs.readdir(pgliteDataDir);
1839
+ logger.info(`[eliza] PGlite health check: ${files.length} file(s) in ${pgliteDataDir}`);
1840
+ if (files.length === 0) {
1841
+ logger.warn(`[eliza] PGlite data directory is empty after init — data may not persist across restarts`);
1842
+ }
1843
+ }
1844
+ catch (err) {
1845
+ logger.warn(`[eliza] PGlite health check failed: ${formatError(err)}`);
1846
+ }
1847
+ }
1848
+ function isPluginAlreadyRegisteredError(err) {
1849
+ return formatError(err).toLowerCase().includes("already registered");
1850
+ }
1851
+ function getConstraintName(error) {
1852
+ if (!error || typeof error !== "object")
1853
+ return null;
1854
+ const err = error;
1855
+ if (typeof err.constraint === "string" && err.constraint.length > 0) {
1856
+ return err.constraint;
1857
+ }
1858
+ if (err.cause)
1859
+ return getConstraintName(err.cause);
1860
+ return null;
1861
+ }
1862
+ function isComponentsWorldFkViolation(error) {
1863
+ return getConstraintName(error) === "components_world_id_worlds_id_fk";
1864
+ }
1865
+ function toErrorDetails(error, depth = 0) {
1866
+ if (!error || typeof error !== "object") {
1867
+ return { value: String(error) };
1868
+ }
1869
+ const err = error;
1870
+ const details = {};
1871
+ for (const key of [
1872
+ "name",
1873
+ "message",
1874
+ "code",
1875
+ "detail",
1876
+ "hint",
1877
+ "constraint",
1878
+ "schema",
1879
+ "table",
1880
+ "column",
1881
+ "where",
1882
+ ]) {
1883
+ const value = err[key];
1884
+ if (typeof value === "string" || typeof value === "number") {
1885
+ details[key] = value;
1886
+ }
1887
+ }
1888
+ if (depth < 2 && err.cause) {
1889
+ details.cause = toErrorDetails(err.cause, depth + 1);
1890
+ }
1891
+ return details;
1892
+ }
1893
+ async function withEntityCreateMutex(runtimeWithBindings, fn) {
1894
+ const previous = runtimeWithBindings.__elizaEntityCreateMutex;
1895
+ let release = () => { };
1896
+ runtimeWithBindings.__elizaEntityCreateMutex = new Promise((resolve) => {
1897
+ release = resolve;
1898
+ });
1899
+ if (previous) {
1900
+ await previous;
1901
+ }
1902
+ try {
1903
+ return await fn();
1904
+ }
1905
+ finally {
1906
+ release();
1907
+ }
1908
+ }
1909
+ function uniqueEntitiesById(entities) {
1910
+ const uniqueById = new Map();
1911
+ for (const entity of entities) {
1912
+ if (entity?.id)
1913
+ uniqueById.set(entity.id, entity);
1914
+ }
1915
+ return Array.from(uniqueById.values());
1916
+ }
1917
+ async function findMissingEntities(runtimeWithEntityWrites, deduped) {
1918
+ if (typeof runtimeWithEntityWrites.getEntitiesByIds !== "function") {
1919
+ return deduped;
1920
+ }
1921
+ try {
1922
+ const existing = (await runtimeWithEntityWrites.getEntitiesByIds(deduped.map((entity) => entity.id))) ?? [];
1923
+ const existingIds = new Set();
1924
+ for (const entity of existing) {
1925
+ if (entity?.id)
1926
+ existingIds.add(entity.id);
1927
+ }
1928
+ return deduped.filter((entity) => !existingIds.has(entity.id));
1929
+ }
1930
+ catch (err) {
1931
+ logger.warn(`[eliza] createEntities precheck failed; proceeding with guarded insert: ${formatError(err)}`);
1932
+ return deduped;
1933
+ }
1934
+ }
1935
+ async function recoverMissingEntities(runtimeWithEntityWrites, missing) {
1936
+ if (typeof runtimeWithEntityWrites.ensureEntityExists !== "function") {
1937
+ return false;
1938
+ }
1939
+ let allRecovered = true;
1940
+ for (const entity of missing) {
1941
+ try {
1942
+ const ensured = await runtimeWithEntityWrites.ensureEntityExists(entity);
1943
+ allRecovered = allRecovered && ensured;
1944
+ }
1945
+ catch (err) {
1946
+ allRecovered = false;
1947
+ logger.warn(`[eliza] ensureEntityExists recovery failed for ${String(entity.id)}: ${formatError(err)}`);
1948
+ }
1949
+ }
1950
+ return allRecovered;
1951
+ }
1952
+ async function createEntitiesWithGuard(args) {
1953
+ const deduped = uniqueEntitiesById(args.entities);
1954
+ const dedupedIds = deduped.map((entity) => entity.id);
1955
+ if (deduped.length === 0)
1956
+ return dedupedIds;
1957
+ const missing = await findMissingEntities(args.runtimeWithEntityWrites, deduped);
1958
+ if (missing.length === 0)
1959
+ return dedupedIds;
1960
+ const result = await args.originalCreateEntities(missing);
1961
+ if (Array.isArray(result) ? result.length > 0 : result)
1962
+ return dedupedIds;
1963
+ if (await recoverMissingEntities(args.runtimeWithEntityWrites, missing)) {
1964
+ return dedupedIds;
1965
+ }
1966
+ logger.warn(`[eliza] createEntities unresolved after guarded retries (requested=${args.entities.length}, deduped=${deduped.length}, missing=${missing.length})`);
1967
+ return [];
1968
+ }
1969
+ function summarizeComponentWrite(input) {
1970
+ if (!input || typeof input !== "object" || Array.isArray(input)) {
1971
+ return { inputType: typeof input };
1972
+ }
1973
+ const record = input;
1974
+ const data = record.data;
1975
+ const dataKeys = data && typeof data === "object" && !Array.isArray(data)
1976
+ ? Object.keys(data).slice(0, 20)
1977
+ : [];
1978
+ return {
1979
+ id: record.id,
1980
+ type: record.type,
1981
+ entityId: record.entityId ?? record.entity_id,
1982
+ sourceEntityId: record.sourceEntityId ?? record.source_entity_id,
1983
+ roomId: record.roomId ?? record.room_id,
1984
+ worldId: record.worldId ?? record.world_id,
1985
+ agentId: record.agentId ?? record.agent_id,
1986
+ dataKeys,
1987
+ };
1988
+ }
1989
+ export function installRuntimeMethodBindings(runtime) {
1990
+ const runtimeWithBindings = runtime;
1991
+ if (runtimeWithBindings.__elizaMethodBindingsInstalled) {
1992
+ return;
1993
+ }
1994
+ installRuntimePluginLifecycle(runtime);
1995
+ // Some plugin builds store this method and invoke it later without the
1996
+ // runtime receiver, which breaks private-field access in AgentRuntime.
1997
+ runtime.getConversationLength = runtime.getConversationLength.bind(runtime);
1998
+ // Wrap getSetting() to fall back to process.env for known keys when the
1999
+ // core returns null. elizaOS core returns null for missing keys, but some
2000
+ // plugins (e.g. @elizaos/plugin-google-genai) check `!== undefined` and
2001
+ // convert null to the string "null", causing API calls like `models/null`.
2002
+ // Scoped to an allowlist to avoid leaking arbitrary env vars to plugins.
2003
+ const GETSETTING_ENV_ALLOWLIST = new Set([
2004
+ // Model provider API keys
2005
+ "ANTHROPIC_API_KEY",
2006
+ "OPENAI_API_KEY",
2007
+ "GOOGLE_GENERATIVE_AI_API_KEY",
2008
+ "GOOGLE_API_KEY",
2009
+ "GEMINI_API_KEY",
2010
+ "GROQ_API_KEY",
2011
+ "XAI_API_KEY",
2012
+ "DEEPSEEK_API_KEY",
2013
+ "ZAI_API_KEY",
2014
+ "Z_AI_API_KEY",
2015
+ "MOONSHOT_API_KEY",
2016
+ "KIMI_API_KEY",
2017
+ "OPENAI_BASE_URL",
2018
+ "OPENROUTER_API_KEY",
2019
+ // Database adapter settings. plugin-sql reads these through
2020
+ // runtime.getSetting(), while appliance images may provide them only as
2021
+ // systemd environment variables.
2022
+ "POSTGRES_URL",
2023
+ "DATABASE_URL",
2024
+ "PGLITE_DATA_DIR",
2025
+ // Google model defaults
2026
+ "GOOGLE_SMALL_MODEL",
2027
+ "GOOGLE_LARGE_MODEL",
2028
+ // GitHub
2029
+ "GITHUB_TOKEN",
2030
+ "GITHUB_OAUTH_CLIENT_ID",
2031
+ // Coding agent model preferences
2032
+ "ELIZA_CLAUDE_MODEL_POWERFUL",
2033
+ "ELIZA_CLAUDE_MODEL_FAST",
2034
+ "ELIZA_GEMINI_MODEL_POWERFUL",
2035
+ "ELIZA_GEMINI_MODEL_FAST",
2036
+ "ELIZA_CODEX_MODEL_POWERFUL",
2037
+ "ELIZA_CODEX_MODEL_FAST",
2038
+ "ELIZA_AIDER_PROVIDER",
2039
+ "ELIZA_AIDER_MODEL_POWERFUL",
2040
+ "ELIZA_AIDER_MODEL_FAST",
2041
+ // AOSP/local coding-tool policy and shell runtime controls.
2042
+ "CODING_TOOLS_WORKSPACE_ROOTS",
2043
+ "CODING_TOOLS_BLOCKED_PATHS",
2044
+ "CODING_TOOLS_BLOCKED_PATHS_ADD",
2045
+ "CODING_TOOLS_SHELL",
2046
+ "SHELL_ALLOWED_DIRECTORY",
2047
+ "ELIZA_RUNTIME_MODE",
2048
+ // Custom credential forwarding — intentionally broad: users configure which env vars
2049
+ // to forward to coding agents via this comma-separated key list (e.g. MCP server tokens).
2050
+ "CUSTOM_CREDENTIAL_KEYS",
2051
+ ]);
2052
+ const originalGetSetting = runtime.getSetting.bind(runtime);
2053
+ runtime.getSetting = (key) => {
2054
+ const result = originalGetSetting(key);
2055
+ if (result !== null && result !== undefined)
2056
+ return result;
2057
+ if (GETSETTING_ENV_ALLOWLIST.has(key)) {
2058
+ const envVal = process.env[key];
2059
+ if (envVal !== undefined && envVal.trim() !== "")
2060
+ return envVal;
2061
+ }
2062
+ return result;
2063
+ };
2064
+ // Add targeted diagnostics around component writes. Relationships reflection and
2065
+ // relationship extraction rely heavily on components; when inserts fail,
2066
+ // upstream logs often hide the concrete DB cause/constraint.
2067
+ if (!runtimeWithBindings.__elizaComponentWriteDiagnosticsInstalled) {
2068
+ const runtimeWithComponentWrites = runtime;
2069
+ if (typeof runtimeWithComponentWrites.createComponent === "function") {
2070
+ const originalCreate = runtimeWithComponentWrites.createComponent.bind(runtime);
2071
+ runtimeWithComponentWrites.createComponent = async (input) => {
2072
+ try {
2073
+ return await originalCreate(input);
2074
+ }
2075
+ catch (error) {
2076
+ // Recovery path: some evaluators (e.g. relationship extraction)
2077
+ // compute a synthetic worldId that may not exist yet. If we hit the
2078
+ // components->worlds FK, retry once with the room's canonical worldId.
2079
+ if (isComponentsWorldFkViolation(error) &&
2080
+ input.roomId &&
2081
+ typeof runtime.getRoom === "function") {
2082
+ try {
2083
+ const room = await runtime.getRoom(input.roomId);
2084
+ const fallbackWorldId = room?.worldId ?? null;
2085
+ if (fallbackWorldId !== input.worldId) {
2086
+ logger.warn(`[eliza] createComponent retry with ${fallbackWorldId ? `room worldId (${fallbackWorldId})` : "null worldId"} after FK violation`);
2087
+ const recovered = {
2088
+ ...input,
2089
+ worldId: fallbackWorldId,
2090
+ };
2091
+ return await originalCreate(recovered);
2092
+ }
2093
+ }
2094
+ catch (retryLookupError) {
2095
+ logger.warn(`[eliza] createComponent recovery lookup failed: ${formatError(retryLookupError)}`);
2096
+ }
2097
+ }
2098
+ const component = summarizeComponentWrite(input);
2099
+ logger.error(`[eliza] createComponent failed: ${formatError(error)} | component=${JSON.stringify(component)}`);
2100
+ logger.error(`[eliza] createComponent db details: ${JSON.stringify(toErrorDetails(error))}`);
2101
+ throw error;
2102
+ }
2103
+ };
2104
+ }
2105
+ if (typeof runtimeWithComponentWrites.updateComponent === "function") {
2106
+ const originalUpdate = runtimeWithComponentWrites.updateComponent.bind(runtime);
2107
+ runtimeWithComponentWrites.updateComponent = async (input) => {
2108
+ try {
2109
+ return await originalUpdate(input);
2110
+ }
2111
+ catch (error) {
2112
+ const component = summarizeComponentWrite(input);
2113
+ logger.error(`[eliza] updateComponent failed: ${formatError(error)} | component=${JSON.stringify(component)}`);
2114
+ logger.error(`[eliza] updateComponent db details: ${JSON.stringify(toErrorDetails(error))}`);
2115
+ throw error;
2116
+ }
2117
+ };
2118
+ }
2119
+ runtimeWithBindings.__elizaComponentWriteDiagnosticsInstalled = true;
2120
+ }
2121
+ // Proactive guard for plugin-sql entity creation. Some evaluators may attempt
2122
+ // to create the same entity in rapid succession; plugin-sql's batch insert is
2123
+ // non-idempotent and can fail entire writes on duplicate/conflicting rows.
2124
+ if (!runtimeWithBindings.__elizaEntityWriteDiagnosticsInstalled) {
2125
+ const runtimeWithEntityWrites = runtime;
2126
+ if (typeof runtimeWithEntityWrites.createEntities === "function") {
2127
+ const originalCreateEntities = runtimeWithEntityWrites.createEntities.bind(runtime);
2128
+ runtimeWithEntityWrites.createEntities = async (entities) => {
2129
+ return withEntityCreateMutex(runtimeWithBindings, () => createEntitiesWithGuard({
2130
+ entities,
2131
+ runtimeWithEntityWrites,
2132
+ originalCreateEntities,
2133
+ }));
2134
+ };
2135
+ }
2136
+ runtimeWithBindings.__elizaEntityWriteDiagnosticsInstalled = true;
2137
+ }
2138
+ runtimeWithBindings.__elizaMethodBindingsInstalled = true;
2139
+ }
2140
+ function installActionAliases(runtime) {
2141
+ const runtimeWithAliases = runtime;
2142
+ if (runtimeWithAliases.__elizaActionAliasesInstalled) {
2143
+ return;
2144
+ }
2145
+ const actions = Array.isArray(runtimeWithAliases.actions)
2146
+ ? runtimeWithAliases.actions
2147
+ : [];
2148
+ // Keep compaction automatic-only; do not allow manual COMPACT_SESSION invokes.
2149
+ const compactSessionIndex = actions.findIndex((action) => action?.name?.toUpperCase() === "COMPACT_SESSION");
2150
+ if (compactSessionIndex !== -1) {
2151
+ actions.splice(compactSessionIndex, 1);
2152
+ logger.info("[eliza] Disabled manual COMPACT_SESSION action; auto-compaction remains enabled");
2153
+ }
2154
+ // Compatibility alias: older prompts/docs still reference CODE_TASK,
2155
+ // while agent-orchestrator exposes START_CODING_TASK.
2156
+ const codingTaskAction = actions.find((action) => action?.name?.toUpperCase() === "START_CODING_TASK") ??
2157
+ actions.find((action) => action?.name?.toUpperCase() === "CREATE_TASK");
2158
+ if (codingTaskAction) {
2159
+ const similes = Array.isArray(codingTaskAction.similes)
2160
+ ? codingTaskAction.similes
2161
+ : [];
2162
+ const hasCodeTaskAlias = similes.some((simile) => simile.toUpperCase() === "CODE_TASK");
2163
+ if (!hasCodeTaskAlias) {
2164
+ codingTaskAction.similes = [...similes, "CODE_TASK"];
2165
+ logger.info("[eliza] Added action alias CODE_TASK -> START_CODING_TASK for agent-orchestrator");
2166
+ }
2167
+ }
2168
+ runtimeWithAliases.__elizaActionAliasesInstalled = true;
2169
+ }
2170
+ async function registerSqlPluginWithRecovery(runtime, sqlPlugin, config) {
2171
+ let registerError = null;
2172
+ try {
2173
+ await runtime.registerPlugin(sqlPlugin.plugin);
2174
+ }
2175
+ catch (err) {
2176
+ registerError = err;
2177
+ }
2178
+ if (registerError) {
2179
+ const pgliteDataDir = resolveActivePgliteDataDir(config);
2180
+ if (!pgliteDataDir) {
2181
+ throw registerError;
2182
+ }
2183
+ const recoveryAction = getPgliteRecoveryAction(registerError, pgliteDataDir);
2184
+ if (recoveryAction === "none") {
2185
+ throw registerError;
2186
+ }
2187
+ if (recoveryAction === "fail-active-lock") {
2188
+ throw createActivePgliteLockError(pgliteDataDir, registerError);
2189
+ }
2190
+ if (recoveryAction === "fail-manual-reset") {
2191
+ throw createManualResetRequiredPgliteError(pgliteDataDir, registerError);
2192
+ }
2193
+ logger.warn(`[eliza] SQL plugin registration failed (${formatError(registerError)}). Cleared a stale PGLite lock in ${pgliteDataDir} and retrying without resetting data.`);
2194
+ try {
2195
+ await runtime.registerPlugin(sqlPlugin.plugin);
2196
+ }
2197
+ catch (retryErr) {
2198
+ if (!isPluginAlreadyRegisteredError(retryErr)) {
2199
+ throw retryErr;
2200
+ }
2201
+ }
2202
+ }
2203
+ await initializeDatabaseAdapter(runtime, config);
2204
+ }
2205
+ const CORE_PLUGIN_BOOT_DEPENDENCIES = new Map([
2206
+ ["@elizaos/plugin-coding-tools", ["@elizaos/plugin-shell"]],
2207
+ ["@elizaos/plugin-agent-skills", ["@elizaos/plugin-shell"]],
2208
+ ["@elizaos/plugin-personal-assistant", ["@elizaos/plugin-google"]],
2209
+ ]);
2210
+ async function preregisterCorePluginsInDependencyWaves(args) {
2211
+ const pending = new Map();
2212
+ for (const name of CORE_PLUGINS) {
2213
+ if (args.alreadyPreRegistered.has(name))
2214
+ continue;
2215
+ const resolved = args.resolvedPlugins.find((p) => p.name === name);
2216
+ if (!resolved) {
2217
+ logger.debug(`[eliza] Core plugin ${name} not resolved — skipping pre-registration`);
2218
+ continue;
2219
+ }
2220
+ pending.set(name, resolved);
2221
+ }
2222
+ const registered = new Set(args.alreadyPreRegistered);
2223
+ const timeoutMs = 30_000;
2224
+ const context = args.label ? `${args.label}: ` : "";
2225
+ const registerOne = async (name, resolved) => {
2226
+ try {
2227
+ const regStart = Date.now();
2228
+ logger.info(`[eliza] ${context}Pre-registering core plugin: ${name}...`);
2229
+ await Promise.race([
2230
+ args.runtime.registerPlugin(resolved.plugin),
2231
+ new Promise((_resolve, reject) => setTimeout(() => reject(new Error(`Timed out after ${timeoutMs / 1000}s`)), timeoutMs)),
2232
+ ]);
2233
+ registered.add(name);
2234
+ logger.info(`[eliza] ${context}✓ ${name} pre-registered (${Date.now() - regStart}ms)`);
2235
+ }
2236
+ catch (err) {
2237
+ registered.add(name);
2238
+ logger.warn(`[eliza] ${context}Core plugin ${name} pre-registration failed: ${formatError(err)}`);
2239
+ }
2240
+ finally {
2241
+ pending.delete(name);
2242
+ }
2243
+ };
2244
+ while (pending.size > 0) {
2245
+ const ready = [];
2246
+ for (const [name, resolved] of pending) {
2247
+ const declaredDependencies = resolved.plugin.dependencies ?? [];
2248
+ const bootDependencies = CORE_PLUGIN_BOOT_DEPENDENCIES.get(name) ?? [];
2249
+ const dependencies = [...declaredDependencies, ...bootDependencies];
2250
+ const hasPendingDependency = dependencies.some((dependency) => pending.has(dependency) && !registered.has(dependency));
2251
+ if (!hasPendingDependency) {
2252
+ ready.push([name, resolved]);
2253
+ }
2254
+ }
2255
+ const wave = ready.length > 0 ? ready : Array.from(pending);
2256
+ await Promise.all(wave.map(([name, resolved]) => registerOne(name, resolved)));
2257
+ // Yield to the event loop between waves so the bound HTTP server can serve
2258
+ // /api/health and other I/O between CPU-bound wave registrations, instead
2259
+ // of starving it until every wave finishes. Mirrors the deferred
2260
+ // static-import yield above; pure scheduling, every plugin still registers
2261
+ // in the same wave order.
2262
+ await new Promise((resolve) => {
2263
+ setImmediate(resolve);
2264
+ });
2265
+ }
2266
+ }
2267
+ export { buildCharacterFromConfig, resolvePreferredProviderId, resolvePreferredProviderPluginName, resolvePrimaryModel, };
2268
+ /**
2269
+ * Vision is a heavy optional plugin. When Eliza enables it, keep the service
2270
+ * loaded but idle until the user explicitly selects CAMERA, SCREEN, or BOTH.
2271
+ * This avoids background capture loops during normal app startup.
2272
+ */
2273
+ export function resolveVisionModeSetting(config, env = process.env) {
2274
+ const explicitMode = env.VISION_MODE?.trim();
2275
+ if (explicitMode)
2276
+ return explicitMode;
2277
+ if (config.features?.vision === true)
2278
+ return "OFF";
2279
+ return undefined;
2280
+ }
2281
+ /** @internal Exported for testing. */
2282
+ export function resolveWalletRuntimeSettings(config, env = process.env) {
2283
+ const directRpcUrl = trimEnvString(env.SOLANA_RPC_URL);
2284
+ const solanaNoActions = trimEnvString(env.SOLANA_NO_ACTIONS);
2285
+ const configEnv = config?.env;
2286
+ const configVars = configEnv?.vars &&
2287
+ typeof configEnv.vars === "object" &&
2288
+ !Array.isArray(configEnv.vars)
2289
+ ? configEnv.vars
2290
+ : undefined;
2291
+ const getConfigEnvString = (key) => {
2292
+ const value = configVars?.[key] ?? configEnv?.[key];
2293
+ return typeof value === "string" && value.trim() ? value.trim() : undefined;
2294
+ };
2295
+ const explicitSolanaPublicKey = trimEnvString(env.SOLANA_PUBLIC_KEY) ??
2296
+ trimEnvString(env.WALLET_PUBLIC_KEY) ??
2297
+ getConfigEnvString("SOLANA_PUBLIC_KEY") ??
2298
+ getConfigEnvString("WALLET_PUBLIC_KEY");
2299
+ const derivedSolanaPublicKey = trimEnvString(getWalletAddresses().solanaAddress) ??
2300
+ trimEnvString(syncSolanaPublicKeyEnv(getConfigEnvString("SOLANA_PRIVATE_KEY")));
2301
+ const solanaPublicKey = explicitSolanaPublicKey ?? derivedSolanaPublicKey;
2302
+ const settings = {};
2303
+ if (directRpcUrl) {
2304
+ settings.SOLANA_RPC_URL = directRpcUrl;
2305
+ }
2306
+ if (solanaNoActions) {
2307
+ settings.SOLANA_NO_ACTIONS = solanaNoActions;
2308
+ }
2309
+ if (!solanaPublicKey) {
2310
+ return settings;
2311
+ }
2312
+ settings.SOLANA_PUBLIC_KEY = solanaPublicKey;
2313
+ settings.WALLET_PUBLIC_KEY = solanaPublicKey;
2314
+ return settings;
2315
+ }
2316
+ /**
2317
+ * Boot the elizaOS runtime without starting the readline chat loop.
2318
+ *
2319
+ * This is a convenience wrapper around {@link startEliza} in headless mode,
2320
+ * with optional config guards.
2321
+ */
2322
+ export async function bootElizaRuntime(opts = {}) {
2323
+ if (opts.requireConfig && !configFileExists()) {
2324
+ throw new Error("No config found. Run `eliza start` once to complete setup.");
2325
+ }
2326
+ const runtime = await startEliza({ headless: true });
2327
+ if (!runtime) {
2328
+ throw new Error("Failed to boot runtime");
2329
+ }
2330
+ return runtime;
2331
+ }
2332
+ const LEVEL_TO_NAME = {
2333
+ 10: "trace",
2334
+ 20: "debug",
2335
+ 27: "success",
2336
+ 28: "progress",
2337
+ 29: "log",
2338
+ 30: "info",
2339
+ 40: "warn",
2340
+ 50: "error",
2341
+ 60: "fatal",
2342
+ };
2343
+ export const logToChatListener = (entry) => {
2344
+ const chatEntry = entry;
2345
+ if (chatEntry.roomId && chatEntry.runtime) {
2346
+ const runtime = chatEntry.runtime;
2347
+ // access dynamic property
2348
+ const overrides = runtime.logLevelOverrides;
2349
+ const overrideLevel = overrides?.get(String(chatEntry.roomId));
2350
+ if (overrideLevel) {
2351
+ const levelKey = entry.level;
2352
+ const levelName = (levelKey && LEVEL_TO_NAME[levelKey] ? LEVEL_TO_NAME[levelKey] : "log").toUpperCase();
2353
+ const prefix = `[${levelName}]`;
2354
+ const content = `${prefix} ${entry.msg}`;
2355
+ // Prevent infinite loops by suppressing logs from this action
2356
+ runtime
2357
+ .sendMessageToTarget({ roomId: entry.roomId }, {
2358
+ text: `\`\`\`\n${content}\n\`\`\``,
2359
+ source: "system",
2360
+ isLog: "true",
2361
+ })
2362
+ .catch((err) => {
2363
+ logger.debug(`[runtime] failed to send log message to target: ${err}`);
2364
+ });
2365
+ }
2366
+ }
2367
+ };
2368
+ /**
2369
+ * Start the elizaOS runtime with Eliza's configuration.
2370
+ *
2371
+ * In headless mode the runtime is returned instead of entering the
2372
+ * interactive readline loop.
2373
+ */
2374
+ export async function startEliza(opts) {
2375
+ const bootTimer = new BootTimer("[eliza-boot]");
2376
+ // Record the (re)start at the START of boot so a restart storm — where boots
2377
+ // never complete — is still countable via /api/dev/boot-history. void: never
2378
+ // delay readiness. recordBootTelemetry below captures the completed-boot case.
2379
+ void recordBootEvent("[eliza-boot]");
2380
+ // Resolve and register baseline `@elizaos/plugin-*` modules into the
2381
+ // STATIC_ELIZA_PLUGINS blocking map BEFORE any plugin resolution happens. See the
2382
+ // comment on `ensureCoreStaticPluginsRegistered()` for why this isn't a
2383
+ // module-init top-level await.
2384
+ await ensureCoreStaticPluginsRegistered();
2385
+ bootTimer.lap("static-plugins-blocking-import");
2386
+ // Start buffering logs early so startup messages appear in the UI log viewer
2387
+ const { captureEarlyLogs } = await import("../api/early-logs.js");
2388
+ captureEarlyLogs();
2389
+ // Register log listener for chat mirroring
2390
+ addLogListener(logToChatListener);
2391
+ // 1. Load Eliza config from the resolved state dir.
2392
+ let config;
2393
+ try {
2394
+ config = loadElizaConfig();
2395
+ }
2396
+ catch (err) {
2397
+ if (err.code === "ENOENT") {
2398
+ logger.warn("[eliza] No config found, using defaults");
2399
+ // All ElizaConfig fields are optional, so an empty object is
2400
+ // structurally valid. The `as` cast is safe here.
2401
+ config = {};
2402
+ }
2403
+ else {
2404
+ throw err;
2405
+ }
2406
+ }
2407
+ // 1b. First-run setup — ask for agent name if not configured.
2408
+ // In headless mode (GUI) the first-run setup is handled by the web UI,
2409
+ // so we skip the interactive CLI prompt and let the runtime start
2410
+ // with defaults. The GUI will restart the agent after first-run setup.
2411
+ if (!opts?.headless) {
2412
+ config = await runFirstTimeSetup(config);
2413
+ }
2414
+ // 1c. Apply logging level from config to process.env so the global
2415
+ // @elizaos/core logger (used by plugins) respects it.
2416
+ // config.logging.level is guaranteed to be set (defaults to "error").
2417
+ // Users can still opt into noisy logs via config.logging.level or
2418
+ // an explicit LOG_LEVEL environment variable.
2419
+ if (!process.env.LOG_LEVEL) {
2420
+ process.env.LOG_LEVEL = config.logging?.level ?? "error";
2421
+ }
2422
+ // 2. Push channel secrets into process.env for plugin discovery
2423
+ applyConnectorSecretsToEnv(config);
2424
+ // Cloud sandbox (Path A / double-connect): in a provisioned container that
2425
+ // does NOT own its connectors, strip the connector bot tokens so the
2426
+ // container does not also connect to Discord/Telegram while the gateway
2427
+ // holds the connection. MUST run AFTER applyConnectorSecretsToEnv (which can
2428
+ // repopulate the tokens from config.connectors) and BEFORE plugin
2429
+ // auto-enable / resolvePlugins below. Also clears the matching config
2430
+ // connector blocks so nothing downstream re-derives the token. Skipped
2431
+ // outside a provisioned container or when ELIZA_SANDBOX_OWNS_CONNECTORS=1.
2432
+ {
2433
+ const { applySandboxConnectorOwnership } = await import("./sandbox-character.js");
2434
+ applySandboxConnectorOwnership(process.env, config);
2435
+ }
2436
+ // Kick off the Discord App ID lookup and the cloud GitHub token fetch (both
2437
+ // network, up to a 3s timeout each) without blocking. They only write
2438
+ // DISCORD_APPLICATION_ID and GITHUB_TOKEN respectively — env vars that no
2439
+ // BLOCKING_CORE_PLUGIN reads. The Discord connector and GitHub/git plugins
2440
+ // both live in the DEFERRED set, so these joins are awaited inside
2441
+ // runDeferredBoot() (before the deferred plugin waves register), not on the
2442
+ // gated blocking path. Firing them here lets the round-trips overlap the
2443
+ // vault hydration + setup work below and the entire blocking resolve.
2444
+ //
2445
+ // autoFetchCloudGithubToken needs the cloud agent id. config.cloud?.agentId
2446
+ // is available now; the function falls back to its own skip guards (no cloud
2447
+ // key / no managed namespace) when the id is absent this early.
2448
+ const discordAppIdPromise = autoResolveDiscordAppId();
2449
+ const cloudGithubTokenPromise = autoFetchCloudGithubToken(config.cloud?.agentId?.trim());
2450
+ // 2b. Propagate cloud config into process.env for ElizaCloud plugin
2451
+ applyCloudConfigToEnv(config);
2452
+ // 2c. Propagate x402 config into process.env
2453
+ applyX402ConfigToEnv(config);
2454
+ // 2d. Propagate database config into process.env for plugin-sql
2455
+ applyDatabaseConfigToEnv(config);
2456
+ // Boot-time vault hydration: migrate plaintext sensitive values into the
2457
+ // OS-keychain vault and resolve vault://KEY sentinels in config.env.
2458
+ //
2459
+ // Skipped on mobile AND in cloud-provisioned containers. The vault flow
2460
+ // (`hydrateWalletKeysFromNodePlatformSecureStore` + `runVaultBootstrap`)
2461
+ // reaches for the OS keychain through `defaultMasterKey().load()`
2462
+ // (packages/vault/src/master-key.ts:217) and opens a second PGlite worker
2463
+ // at `<stateDir>/.vault-pglite/`. Both target environments where it's
2464
+ // pointless or actively harmful:
2465
+ // - Android: no D-Bus for libsecret (vault falls back to an
2466
+ // ELIZA_VAULT_PASSPHRASE-derived key, which `ElizaAgentService` already
2467
+ // sets per-install from ANDROID_ID), the spawned bun process has no
2468
+ // plaintext secrets to migrate (env arrives from the service), and the
2469
+ // second PGlite worker doubles disk + RAM pressure on a 4 GB device.
2470
+ // - Cloud sandbox (Docker, ELIZA_CLOUD_PROVISIONED=1): the daemon already
2471
+ // injects every secret as a real env var (ELIZA_API_TOKEN,
2472
+ // ELIZAOS_CLOUD_API_KEY, OPENAI_API_KEY, …), libsecret isn't installed
2473
+ // in the slim image, and the second PGlite worker has been observed to
2474
+ // hang vault-pglite init silently — blocking the HTTP listen and
2475
+ // tripping the 180s health check on every fresh provision.
2476
+ const isCloudProvisioned = process.env.ELIZA_CLOUD_PROVISIONED === "1";
2477
+ if (!isMobilePlatform() && !isCloudProvisioned) {
2478
+ // pre-resolve-setup's two serial cost centers: the OS-keychain hydrate and
2479
+ // the vault PGlite cold-start. Timed separately and surfaced below so the
2480
+ // boot-history telemetry shows which is the long pole. NOTE: the order is
2481
+ // load-bearing: hydrateWalletKeysFromNodePlatformSecureStore writes wallet
2482
+ // keys into process.env that runVaultBootstrap then mirrors into the vault,
2483
+ // so these must stay sequential unless that mirror is decoupled. Measure
2484
+ // here before attempting to overlap them.
2485
+ const keychainStartMs = Date.now();
2486
+ try {
2487
+ const { hydrateWalletKeysFromNodePlatformSecureStore } = await importAppCoreRuntime();
2488
+ await hydrateWalletKeysFromNodePlatformSecureStore();
2489
+ }
2490
+ catch (err) {
2491
+ logger.warn(`[wallet][os-store] boot hydrate skipped: ${err instanceof Error ? err.message : String(err)}`);
2492
+ }
2493
+ const keychainMs = Date.now() - keychainStartMs;
2494
+ const { runVaultBootstrap } = await importAppCoreRuntime();
2495
+ const { sharedVault } = await importAppCoreRuntime();
2496
+ const vaultStartMs = Date.now();
2497
+ const bootResult = await runVaultBootstrap();
2498
+ logger.info(`[vault-bootstrap] migrated=${bootResult.migrated} failed=${bootResult.failed.length} (keychain=${keychainMs}ms vault-pglite=${Date.now() - vaultStartMs}ms)`);
2499
+ const { resolved, missing } = await resolveConfigEnvForProcess(config.env, sharedVault());
2500
+ if (missing.length > 0) {
2501
+ logger.warn(`[vault-bootstrap] sentinel(s) without vault entry: ${missing.join(", ")}`);
2502
+ }
2503
+ if (config.env &&
2504
+ typeof config.env === "object" &&
2505
+ !Array.isArray(config.env)) {
2506
+ for (const [key, value] of Object.entries(resolved)) {
2507
+ config.env[key] = value;
2508
+ }
2509
+ }
2510
+ const varsBag = config.env?.vars;
2511
+ if (varsBag && typeof varsBag === "object" && !Array.isArray(varsBag)) {
2512
+ const varsResult = await resolveConfigEnvForProcess(varsBag, sharedVault());
2513
+ for (const [key, value] of Object.entries(varsResult.resolved)) {
2514
+ varsBag[key] = value;
2515
+ }
2516
+ }
2517
+ }
2518
+ // 2f. Propagate arbitrary env vars from config.env into process.env.
2519
+ // Eliza stores user-defined env vars (plugin settings, API URLs, etc.)
2520
+ // in config.env; elizaOS plugins read them via process.env / getSetting.
2521
+ // Skip ELIZAOS_CLOUD_* — applyCloudConfigToEnv() owns those; otherwise a
2522
+ // stale key in config.env refills process.env after disconnect cleared it.
2523
+ if (config.env &&
2524
+ typeof config.env === "object" &&
2525
+ !Array.isArray(config.env)) {
2526
+ for (const [key, value] of Object.entries(config.env)) {
2527
+ if (isElizaCloudManagedProcessEnvKey(key))
2528
+ continue;
2529
+ if (typeof value === "string" && !process.env[key]) {
2530
+ process.env[key] = value;
2531
+ }
2532
+ }
2533
+ // Also hydrate from config.env.vars — setEnvValue writes API keys to
2534
+ // both config.env["KEY"] and config.env.vars["KEY"]. If the top-level
2535
+ // key was lost (e.g. pruneEnv, config migration), the nested form is
2536
+ // the authoritative source.
2537
+ const vars = config.env.vars;
2538
+ if (vars && typeof vars === "object" && !Array.isArray(vars)) {
2539
+ for (const [key, value] of Object.entries(vars)) {
2540
+ if (isElizaCloudManagedProcessEnvKey(key))
2541
+ continue;
2542
+ if (typeof value === "string" && !process.env[key]) {
2543
+ process.env[key] = value;
2544
+ }
2545
+ }
2546
+ }
2547
+ }
2548
+ // Keep the canonical public key env in sync for Solana plugins that still
2549
+ // read process.env directly instead of runtime settings.
2550
+ syncSolanaPublicKeyEnv();
2551
+ normalizeOpenAiCompatibleProviderConfig(config);
2552
+ // Log active database configuration for debugging persistence issues
2553
+ {
2554
+ const dbProvider = resolveEffectiveDbProvider(config);
2555
+ const pgliteDir = process.env.PGLITE_DATA_DIR;
2556
+ const postgresUrl = process.env.POSTGRES_URL;
2557
+ logger.info(`[eliza] Database provider: ${dbProvider}` +
2558
+ (dbProvider === "pglite" && pgliteDir
2559
+ ? ` | data dir: ${pgliteDir}`
2560
+ : "") +
2561
+ (dbProvider === "postgres" && postgresUrl
2562
+ ? ` | connection: ${(postgresUrl.length > 4096 ? postgresUrl.slice(0, 4096) : postgresUrl).replace(/:\/\/([^:@]{1,1024}):([^@]{1,1024})@/, "://$1:***@")}`
2563
+ : ""));
2564
+ }
2565
+ // 2d-iii. OG tracking code initialization
2566
+ if (!isMobilePlatform()) {
2567
+ try {
2568
+ const { initializeOGCode } = await loadElizaMakerModule();
2569
+ initializeOGCode?.();
2570
+ }
2571
+ catch {
2572
+ // Silent — OG tracking is non-critical
2573
+ }
2574
+ }
2575
+ // 2d-ii. Allow destructive migrations (e.g. dropping tables removed between
2576
+ // plugin versions) so the runtime doesn't silently stall. Without this
2577
+ // the migration system throws an error that gets swallowed, leaving the
2578
+ // app hanging indefinitely with no output.
2579
+ if (!process.env.ELIZA_ALLOW_DESTRUCTIVE_MIGRATIONS) {
2580
+ process.env.ELIZA_ALLOW_DESTRUCTIVE_MIGRATIONS = "true";
2581
+ }
2582
+ // 2e-ii. SECRET_SALT must be stable across boots — multiple consumers key
2583
+ // durable encryption off it (core/settings.ts encryptStringValue,
2584
+ // encryptedCharacter for character.secrets, runtime.ts decryptSecret,
2585
+ // advanced-capabilities settings). Previously we generated a random
2586
+ // value per process, which silently invalidated every persisted
2587
+ // ciphertext on restart (decryptStringValue returns the encrypted
2588
+ // string on failure, so connector logins just stopped working
2589
+ // without an error). Persist to <stateDir>/secret-salt instead.
2590
+ if (!process.env.SECRET_SALT) {
2591
+ const secretSaltPath = path.join(resolveStateDir(), "secret-salt");
2592
+ let salt = null;
2593
+ try {
2594
+ const cached = readFileSync(secretSaltPath, "utf8").trim();
2595
+ if (/^[0-9a-f]{64}$/.test(cached)) {
2596
+ salt = cached;
2597
+ }
2598
+ }
2599
+ catch (err) {
2600
+ if (err.code !== "ENOENT") {
2601
+ throw err;
2602
+ }
2603
+ }
2604
+ if (!salt) {
2605
+ salt = crypto.randomBytes(32).toString("hex");
2606
+ mkdirSync(path.dirname(secretSaltPath), { recursive: true });
2607
+ // 0o600: only the user account that wrote it can read it. The salt
2608
+ // is a key-derivation input — anyone who reads it plus the
2609
+ // ciphertext can decrypt persisted secrets.
2610
+ writeFileSync(secretSaltPath, salt, { encoding: "utf8", mode: 0o600 });
2611
+ logger.info(`[eliza] Generated SECRET_SALT and persisted to ${secretSaltPath}`);
2612
+ }
2613
+ process.env.SECRET_SALT = salt;
2614
+ }
2615
+ // 2e-iii. Pre-flight validation for Google AI API keys. If the key looks
2616
+ // obviously invalid (too short, placeholder, wrong prefix), clear it
2617
+ // to prevent plugin-google-genai from making a failing API call.
2618
+ for (const gkey of [
2619
+ "GEMINI_API_KEY",
2620
+ "GOOGLE_API_KEY",
2621
+ "GOOGLE_GENERATIVE_AI_API_KEY",
2622
+ ]) {
2623
+ const val = process.env[gkey]?.trim();
2624
+ if (val &&
2625
+ (val.length < 20 || val === "your-key-here" || val.startsWith("sk-"))) {
2626
+ logger.warn(`[eliza] ${gkey} appears invalid (length/format), clearing to skip Google AI plugin`);
2627
+ delete process.env[gkey];
2628
+ }
2629
+ }
2630
+ // 2f. Install the multi-account pool shims and apply selected direct API
2631
+ // accounts before plugin resolution snapshots process.env.
2632
+ //
2633
+ // Skipped in cloud containers (ELIZA_CLOUD_PROVISIONED=1): the multi-account
2634
+ // pool is a desktop feature for users juggling several accounts per provider
2635
+ // (work / personal / throwaway). Cloud sandboxes get one set of credentials
2636
+ // injected by the daemon as env vars, so there's nothing to multiplex. The
2637
+ // dynamic `importAppCoreRuntime()` here also pulls in
2638
+ // `app-core/services/account-pool`, which statically imports from
2639
+ // `@elizaos/agent` — completing a circular import that deadlocks Node ESM
2640
+ // module evaluation in the cloud Docker boot path. Manifests as a silent
2641
+ // hang at this await call after the node:sqlite experimental warning; PID 1
2642
+ // sits in `ep_poll`, no listen, 180s health timeout.
2643
+ if (process.env.ELIZA_CLOUD_PROVISIONED !== "1")
2644
+ try {
2645
+ const accountPool = await importAppCoreRuntime();
2646
+ accountPool.getDefaultAccountPool();
2647
+ await accountPool.applyAccountPoolApiCredentials({
2648
+ activeBackend: resolveServiceRoutingInConfig(config)?.llmText?.backend,
2649
+ accountStrategies: config.accountStrategies,
2650
+ serviceRouting: resolveServiceRoutingInConfig(config),
2651
+ });
2652
+ accountPool.startAccountPoolKeepAlive();
2653
+ }
2654
+ catch (err) {
2655
+ logger.debug(`[eliza] Account pool bootstrap skipped: ${formatError(err)}`);
2656
+ }
2657
+ // 2g. Apply subscription-based credentials (Claude Max, Codex Max).
2658
+ // Failure is non-fatal — the agent can still start with other providers.
2659
+ // Config is NOT rolled back on failure; partial mutations may persist in
2660
+ // the in-memory config but are not saved to disk until explicit save.
2661
+ //
2662
+ // Split into the local-only model.primary derivation (synchronous, needed
2663
+ // before resolvePlugins()) and the network-touching Claude Code OAuth
2664
+ // probe (deferred, awaited in runDeferredBoot so it never blocks plugin
2665
+ // resolution). The OAuth probe mutates neither config nor process.env —
2666
+ // it only logs availability — so deferring it changes no resolve input.
2667
+ let subscriptionCredentialsDeferredPromise = Promise.resolve();
2668
+ try {
2669
+ const { applySubscriptionCredentialsLocal } = await import("../auth/index.js");
2670
+ applySubscriptionCredentialsLocal(config);
2671
+ }
2672
+ catch (err) {
2673
+ logger.warn(`[eliza] Failed to apply local subscription credentials (agent will continue without them): ${formatError(err)}`);
2674
+ }
2675
+ subscriptionCredentialsDeferredPromise = (async () => {
2676
+ const { applySubscriptionCredentialsDeferred } = await import("../auth/index.js");
2677
+ await applySubscriptionCredentialsDeferred();
2678
+ })().catch((err) => {
2679
+ logger.warn(`[eliza] Failed to probe Claude Code subscription credentials (agent will continue without them): ${formatError(err)}`);
2680
+ });
2681
+ // 2h. Cloud mode — if the user chose cloud during first-run setup (or on a
2682
+ // subsequent start with cloud config), skip local runtime setup and
2683
+ // connect via the thin client instead.
2684
+ const deploymentTarget = resolveDeploymentTargetInConfig(config);
2685
+ // 2h-pre. Store-variant build: macOS App Sandbox / MAS / MS Store / Flathub
2686
+ // policy is incompatible with running an embedded local AgentRuntime, so
2687
+ // store builds must route to Eliza Cloud. If the cloud config is missing,
2688
+ // fail loudly and route the user to first-run setup.
2689
+ const { isStoreBuild, getBuildVariant } = await importAppCoreRuntime();
2690
+ // Boot-time observability: print the resolved (buildVariant, deploymentTarget,
2691
+ // stateDir, workspaceDir) tuple so support has it for sandbox issues.
2692
+ logger.info(`[eliza] boot tuple: buildVariant=${getBuildVariant()} ` +
2693
+ `deploymentRuntime=${deploymentTarget.runtime} ` +
2694
+ `provider=${deploymentTarget.provider ?? "n/a"} ` +
2695
+ `stateDir=${resolveStateDir()} ` +
2696
+ `workspaceDir=${process.env.ELIZA_WORKSPACE_DIR ?? "(default)"} ` +
2697
+ `platform=${process.platform}`);
2698
+ if (isStoreBuild()) {
2699
+ if (deploymentTarget.runtime === "local") {
2700
+ throw new Error("[eliza] Store-variant builds cannot run a local agent. " +
2701
+ "Pair an Eliza Cloud account in first-run setup, or switch to the direct download build.");
2702
+ }
2703
+ if (!config.cloud?.apiKey?.trim() || !config.cloud?.agentId?.trim()) {
2704
+ throw new Error("[eliza] Store-variant build requires a paired Eliza Cloud account. " +
2705
+ "Run first-run setup to link Eliza Cloud, or switch to the direct download build.");
2706
+ }
2707
+ return startInCloudMode(config, config.cloud.agentId, opts);
2708
+ }
2709
+ if (deploymentTarget.runtime === "cloud" &&
2710
+ deploymentTarget.provider === "elizacloud" &&
2711
+ config.cloud?.apiKey &&
2712
+ config.cloud?.agentId?.trim()) {
2713
+ return startInCloudMode(config, config.cloud.agentId, opts);
2714
+ }
2715
+ // 3. Build elizaOS Character from Eliza config
2716
+ // Cloud sandbox (Path A): if the provisioner injected the assigned
2717
+ // character via ELIZA_AGENT_CHARACTER_JSON, merge it onto the config so the
2718
+ // container boots AS that character (e.g. "Nyx") instead of the bundled
2719
+ // default preset. Skipped when the env var is absent.
2720
+ let sandboxRouteAgentId = null;
2721
+ {
2722
+ const { applySandboxCharacterFromEnv, resolveSandboxRouteAgentId } = await import("./sandbox-character.js");
2723
+ applySandboxCharacterFromEnv(config);
2724
+ sandboxRouteAgentId = resolveSandboxRouteAgentId();
2725
+ }
2726
+ const character = buildCharacterFromConfig(config);
2727
+ // Pin the runtime agent id to the platform character_id so the gateways can
2728
+ // resolve `agent:<id>:server` and address `/agents/<id>/message` against
2729
+ // this container. Without this the runtime would derive an id from the
2730
+ // character name (stringToUuid(name)) which the gateway does not know.
2731
+ // Scoped to provisioned containers via the route-id env var.
2732
+ if (sandboxRouteAgentId) {
2733
+ character.id = sandboxRouteAgentId;
2734
+ }
2735
+ const primaryModel = resolvePrimaryModel(config);
2736
+ const preferredProviderId = resolvePreferredProviderId(config);
2737
+ const preferredProviderPluginName = resolvePreferredProviderPluginName(config);
2738
+ // 4. Ensure workspace exists with required files
2739
+ const workspaceDir = config.agents?.defaults?.workspace ?? resolveDefaultAgentWorkspaceDir();
2740
+ await ensureAgentWorkspace({
2741
+ dir: workspaceDir,
2742
+ ensureInitFiles: shouldBootstrapWorkspaceInitFiles(workspaceDir),
2743
+ });
2744
+ // 4b. Ensure custom plugins directory exists for drop-in plugins
2745
+ await fs.mkdir(path.join(resolveStateDir(), CUSTOM_RUNTIME_PLUGINS_DIRNAME), {
2746
+ recursive: true,
2747
+ });
2748
+ // 5. Create the Eliza bridge plugin (workspace context + session keys + compaction)
2749
+ const agentId = character.name?.toLowerCase().replace(/\s+/g, "-") ?? "main";
2750
+ // 5-pre0. Apply per-agent vault profile overrides to process.env.
2751
+ //
2752
+ // Vault keys with multiple named profiles (work / personal / throwaway)
2753
+ // resolve the active profile for THIS agent through the vault's
2754
+ // routing layer, then write the resolved value into process.env so
2755
+ // the synchronous runtime.getSetting fast path picks it up. Idempotent;
2756
+ // safe to run multiple times. Opt-out via
2757
+ // ELIZA_DISABLE_VAULT_PROFILE_RESOLVER=1. Auto-disabled in cloud containers
2758
+ // (ELIZA_CLOUD_PROVISIONED=1) — vault PGlite init hangs in the slim Docker
2759
+ // image; see the boot-time vault hydration block earlier in this function.
2760
+ if (process.env.ELIZA_DISABLE_VAULT_PROFILE_RESOLVER !== "1" &&
2761
+ process.env.ELIZA_CLOUD_PROVISIONED !== "1") {
2762
+ try {
2763
+ const { sharedVault } = await importAppCoreRuntime();
2764
+ const { applyVaultProfilesForAgent } = await import("./vault-profile-resolver.js");
2765
+ await applyVaultProfilesForAgent(sharedVault(), agentId);
2766
+ }
2767
+ catch (err) {
2768
+ logger.warn(`[vault-profile-resolver] boot-time apply failed agent="${agentId}": ${err instanceof Error ? err.message : String(err)}`);
2769
+ }
2770
+ }
2771
+ // 5-pre. Per-agent EVM + Solana wallet bootstrap is DEFERRED off the boot
2772
+ // critical path: it runs after the runtime is reachable (fired fire-and-forget
2773
+ // from the deferred boot phase via ensureAgentWalletsLazy()), not during
2774
+ // essential boot. This keeps the ~50s EVM/Solana crypto import + vault-write
2775
+ // cost out of the time-to-reachable window. The opt-out
2776
+ // (ELIZA_DISABLE_AGENT_WALLET_BOOTSTRAP) and cloud-container skip
2777
+ // (ELIZA_CLOUD_PROVISIONED) are checked inside ensureAgentWalletsLazy();
2778
+ // the TEE-gate suppression lives inside bridgeAgentWalletsToProcessEnv
2779
+ // (agent-wallets.ts:359, opt-in via ELIZA_AGENT_WALLET_AS_USER=1) and
2780
+ // revealAgentWalletPrivateKey (agent-wallets.ts:155).
2781
+ bootTimer.lap("pre-resolve-setup");
2782
+ const elizaPlugin = createElizaPlugin({
2783
+ workspaceDir,
2784
+ agentId,
2785
+ });
2786
+ // 6. Resolve and load plugins
2787
+ // In headless (GUI) mode before first-run setup, the user hasn't configured a
2788
+ // provider yet. Downgrade diagnostics so the expected "no AI provider"
2789
+ // state doesn't appear as a scary Error in the terminal.
2790
+ const preOnboarding = opts?.headless && !config.agents;
2791
+ const blockDeferredPluginImports = shouldBlockDeferredPluginImports();
2792
+ const initialPluginResolutionPhase = blockDeferredPluginImports ? "all" : "blocking";
2793
+ const initialForceIncludePluginNames = !blockDeferredPluginImports && preferredProviderPluginName
2794
+ ? [preferredProviderPluginName]
2795
+ : [];
2796
+ await ensureStaticPluginsRegisteredByName(initialForceIncludePluginNames);
2797
+ const resolvedPlugins = await resolvePlugins(config, {
2798
+ quiet: preOnboarding,
2799
+ phase: initialPluginResolutionPhase,
2800
+ forceIncludePluginNames: initialForceIncludePluginNames,
2801
+ });
2802
+ bootTimer.lap(`resolve-plugins-${initialPluginResolutionPhase}-import`);
2803
+ if (resolvedPlugins.length === 0) {
2804
+ if (preOnboarding) {
2805
+ logger.info("[eliza] No plugins loaded yet — the first-run setup will configure a model provider");
2806
+ }
2807
+ else {
2808
+ logger.error("[eliza] No plugins loaded — at least one model provider plugin is required");
2809
+ logger.error("[eliza] Set an API key (e.g. ANTHROPIC_API_KEY, OPENAI_API_KEY) in your environment");
2810
+ throw new Error("No plugins loaded");
2811
+ }
2812
+ }
2813
+ // 6b. Debug logging — print full context after provider + plugin resolution
2814
+ {
2815
+ const pluginNames = resolvedPlugins.map((p) => p.name);
2816
+ const providerNames = resolvedPlugins
2817
+ .flatMap((p) => p.plugin.providers ?? [])
2818
+ .map((prov) => prov.name);
2819
+ // Build a context summary for validation
2820
+ const contextSummary = {
2821
+ agentName: character.name,
2822
+ pluginCount: resolvedPlugins.length,
2823
+ providerCount: providerNames.length,
2824
+ primaryModel: primaryModel ?? "(auto-detect)",
2825
+ preferredProvider: preferredProviderId ?? "(auto-detect)",
2826
+ workspaceDir,
2827
+ };
2828
+ debugLogResolvedContext(pluginNames, providerNames, contextSummary, (msg) => logger.debug(msg));
2829
+ // Validate the context and surface issues early
2830
+ const contextValidation = validateRuntimeContext(contextSummary);
2831
+ if (!contextValidation.valid) {
2832
+ const issues = [];
2833
+ if (contextValidation.nullFields.length > 0) {
2834
+ issues.push(`null: ${contextValidation.nullFields.join(", ")}`);
2835
+ }
2836
+ if (contextValidation.undefinedFields.length > 0) {
2837
+ issues.push(`undefined: ${contextValidation.undefinedFields.join(", ")}`);
2838
+ }
2839
+ if (contextValidation.emptyFields.length > 0) {
2840
+ issues.push(`empty: ${contextValidation.emptyFields.join(", ")}`);
2841
+ }
2842
+ logger.warn(`[eliza] Context validation issues detected: ${issues.join("; ")}`);
2843
+ }
2844
+ }
2845
+ // 7. Create the AgentRuntime with Eliza plugin + resolved plugins
2846
+ // All CORE_PLUGINS are pre-registered sequentially (in CORE_PLUGINS
2847
+ // order) before runtime.initialize() so that cross-plugin getService()
2848
+ // calls always resolve. runtime.initialize() registers remaining
2849
+ // characterPlugins (connectors, providers, custom) in parallel — those
2850
+ // are NOT core and don't have ordering dependencies.
2851
+ const PREREGISTER_PLUGINS = new Set(CORE_PLUGINS);
2852
+ const sqlPlugin = resolvedPlugins.find((p) => p.name === "@elizaos/plugin-sql");
2853
+ const otherPlugins = resolvedPlugins.filter((p) => !PREREGISTER_PLUGINS.has(p.name));
2854
+ // Resolve the runtime log level from config (AgentRuntime doesn't support
2855
+ // "silent", so we map it to "fatal" as the quietest supported level).
2856
+ const runtimeLogLevel = (() => {
2857
+ // process.env.LOG_LEVEL is already resolved (set explicitly or from
2858
+ // config.logging.level above), so prefer it to honour the dev-mode
2859
+ // LOG_LEVEL=error override set by eliza/packages/app-core/scripts/dev-ui.mjs.
2860
+ const lvl = process.env.LOG_LEVEL ?? config.logging?.level ?? "error";
2861
+ if (lvl === "silent")
2862
+ return "fatal";
2863
+ return lvl;
2864
+ })();
2865
+ // 7a. Resolve bundled skills directory from @elizaos/skills so
2866
+ // plugin-agent-skills auto-loads them on startup.
2867
+ let bundledSkillsDir = null;
2868
+ try {
2869
+ const { getSkillsDir } = (await import("@elizaos/skills"));
2870
+ bundledSkillsDir = getSkillsDir();
2871
+ logger.info(`[eliza] Bundled skills dir: ${bundledSkillsDir}`);
2872
+ }
2873
+ catch {
2874
+ logger.debug("[eliza] @elizaos/skills not available — bundled skills will not be loaded");
2875
+ }
2876
+ // Workspace skills directory (highest precedence for overrides)
2877
+ const workspaceSkillsDir = workspaceDir ? `${workspaceDir}/skills` : null;
2878
+ const managedSkillsDir = path.join(resolveStateDir(), "skills");
2879
+ // ── Sandbox mode setup ──────────────────────────────────────────────────
2880
+ const sandboxConfig = config.agents?.defaults?.sandbox;
2881
+ const sandboxModeStr = sandboxConfig
2882
+ ?.mode;
2883
+ const sandboxMode = sandboxModeStr === "light" ||
2884
+ sandboxModeStr === "standard" ||
2885
+ sandboxModeStr === "max"
2886
+ ? sandboxModeStr
2887
+ : "off";
2888
+ const isSandboxActive = sandboxMode !== "off";
2889
+ let sandboxManager = null;
2890
+ let sandboxAuditLog = null;
2891
+ if (isSandboxActive) {
2892
+ logger.info(`[eliza] Sandbox mode: ${sandboxMode}`);
2893
+ sandboxAuditLog = new SandboxAuditLog({ console: true });
2894
+ // Standard/max modes also start the container sandbox manager
2895
+ if (sandboxMode === "standard" || sandboxMode === "max") {
2896
+ const dockerSettings = sandboxConfig?.docker;
2897
+ const browserSettings = sandboxConfig?.browser;
2898
+ sandboxManager = new SandboxManager({
2899
+ mode: sandboxMode,
2900
+ image: dockerSettings?.image ?? undefined,
2901
+ containerPrefix: dockerSettings?.containerPrefix ?? undefined,
2902
+ network: dockerSettings?.network ?? undefined,
2903
+ memory: dockerSettings?.memory ?? undefined,
2904
+ cpus: dockerSettings?.cpus ?? undefined,
2905
+ workspaceRoot: workspaceDir ?? undefined,
2906
+ browser: browserSettings
2907
+ ? {
2908
+ enabled: browserSettings.enabled ?? false,
2909
+ image: browserSettings.image ?? undefined,
2910
+ cdpPort: browserSettings.cdpPort ?? undefined,
2911
+ vncPort: browserSettings.vncPort ?? undefined,
2912
+ noVncPort: browserSettings.noVncPort ?? undefined,
2913
+ headless: browserSettings.headless ?? undefined,
2914
+ enableNoVnc: browserSettings.enableNoVnc ?? undefined,
2915
+ autoStart: browserSettings.autoStart ?? true,
2916
+ autoStartTimeoutMs: browserSettings.autoStartTimeoutMs ?? undefined,
2917
+ }
2918
+ : undefined,
2919
+ });
2920
+ try {
2921
+ await sandboxManager.start();
2922
+ logger.info("[eliza] Sandbox manager started");
2923
+ }
2924
+ catch (err) {
2925
+ logger.error(`[eliza] Sandbox manager failed to start: ${err instanceof Error ? err.message : String(err)}`);
2926
+ // Non-fatal: light mode fallback
2927
+ }
2928
+ }
2929
+ sandboxAuditLog.record({
2930
+ type: "sandbox_lifecycle",
2931
+ summary: `Sandbox initialized: mode=${sandboxMode}`,
2932
+ severity: "info",
2933
+ });
2934
+ }
2935
+ // ── End sandbox setup ───────────────────────────────────────────────────
2936
+ // ── Boost preferred provider plugin priority ──────────────────────────
2937
+ // elizaOS selects the model handler with the highest `priority` for each
2938
+ // ModelType. All provider plugins default to priority 0, so whichever
2939
+ // registers first wins — essentially random when using Promise.all.
2940
+ // When the user has explicitly selected a provider or model, prefer that
2941
+ // provider's plugin so its handlers are selected over registration order.
2942
+ const pluginsForRuntime = otherPlugins.map((p) => p.plugin);
2943
+ const visionModeSetting = resolveVisionModeSetting(config);
2944
+ if (preferredProviderPluginName) {
2945
+ for (const plugin of pluginsForRuntime) {
2946
+ if (plugin.name === preferredProviderPluginName) {
2947
+ plugin.priority = (plugin.priority ?? 0) + 10;
2948
+ logger.info(`[eliza] Boosted plugin "${plugin.name}" priority to ${plugin.priority} (preferred provider: ${preferredProviderId ?? "unknown"})`);
2949
+ break;
2950
+ }
2951
+ }
2952
+ }
2953
+ // ── Strip upstream skill providers ──────────────────────────────────────
2954
+ // The upstream @elizaos/plugin-agent-skills registers providers that dump
2955
+ // ALL loaded skills into every prompt (~2000-4000 tokens). Eliza replaces
2956
+ // them with a BM25-lite dynamic provider (see providers/skill-provider.ts)
2957
+ // that injects only the most relevant skills per turn.
2958
+ //
2959
+ // We keep:
2960
+ // - agent_skills_overview (lightweight stats, ~50 tokens)
2961
+ // - all actions (USE_SKILL, SEARCH_SKILLS, INSTALL_SKILL, …)
2962
+ // - the AGENT_SKILLS_SERVICE itself
2963
+ {
2964
+ const UPSTREAM_SKILL_PROVIDERS_TO_STRIP = new Set([
2965
+ "agent_skills",
2966
+ "agent_skill_instructions",
2967
+ "agent_skills_catalog",
2968
+ ]);
2969
+ for (const plugin of pluginsForRuntime) {
2970
+ if (plugin.name === "@elizaos/plugin-agent-skills" &&
2971
+ Array.isArray(plugin.providers)) {
2972
+ const before = plugin.providers.length;
2973
+ plugin.providers = plugin.providers.filter((p) => !UPSTREAM_SKILL_PROVIDERS_TO_STRIP.has(p.name ?? ""));
2974
+ const removed = before - plugin.providers.length;
2975
+ if (removed > 0) {
2976
+ logger.info(`[eliza] Stripped ${removed} upstream skill provider(s) — using dynamic BM25-lite provider instead`);
2977
+ }
2978
+ }
2979
+ }
2980
+ }
2981
+ // Deduplicate actions across all plugins to avoid "Action already registered"
2982
+ // warnings from elizaOS core. basic-capabilities is registered first by the
2983
+ // runtime, so include it in deduplication so its actions take precedence.
2984
+ const settings = character.settings ?? {};
2985
+ const basicCapabilitiesPlugin = createBasicCapabilitiesPlugin({
2986
+ disableBasic: settings.DISABLE_BASIC_CAPABILITIES === true ||
2987
+ settings.DISABLE_BASIC_CAPABILITIES === "true",
2988
+ enableExtended: settings.ENABLE_EXTENDED_CAPABILITIES === true ||
2989
+ settings.ENABLE_EXTENDED_CAPABILITIES === "true" ||
2990
+ settings.ADVANCED_CAPABILITIES === true ||
2991
+ settings.ADVANCED_CAPABILITIES === "true",
2992
+ skipCharacterProvider: false,
2993
+ enableAutonomy: settings.ENABLE_AUTONOMY === true || settings.ENABLE_AUTONOMY === "true",
2994
+ });
2995
+ deduplicatePluginActions([
2996
+ basicCapabilitiesPlugin,
2997
+ elizaPlugin,
2998
+ ...pluginsForRuntime,
2999
+ ]);
3000
+ let runtime = new AgentRuntime({
3001
+ character,
3002
+ // advancedCapabilities: true,
3003
+ actionPlanning: true,
3004
+ // advancedMemory is enabled via character.advancedMemory
3005
+ plugins: [elizaPlugin, ...pluginsForRuntime],
3006
+ ...(runtimeLogLevel ? { logLevel: runtimeLogLevel } : {}),
3007
+ // Sandbox options — only active when mode != "off"
3008
+ ...(isSandboxActive
3009
+ ? {
3010
+ sandboxMode: true,
3011
+ sandboxAuditHandler: sandboxAuditLog
3012
+ ? (event) => {
3013
+ sandboxAuditLog.recordTokenReplacement(event.direction, event.url, event.tokenIds);
3014
+ }
3015
+ : undefined,
3016
+ }
3017
+ : {}),
3018
+ settings: {
3019
+ VALIDATION_LEVEL: "fast",
3020
+ // Forward non-sensitive Eliza config.env vars as runtime settings so
3021
+ // plugins can access them via runtime.getSetting(). This fixes a bug where
3022
+ // plugins (e.g. @elizaos/plugin-google-genai) call runtime.getSetting()
3023
+ // which returns null for keys not in settings, but the plugin checks
3024
+ // !== undefined causing it to use "null" as the model name.
3025
+ //
3026
+ // Security: Filter out blockchain private keys and secrets. API keys are
3027
+ // allowed since plugins need them via runtime.getSetting(). Private keys
3028
+ // should only be accessed via process.env by signing services.
3029
+ ...Object.fromEntries(Object.entries(collectConfigEnvVars(config)).filter(([key]) => isEnvKeyAllowedForForwarding(key))),
3030
+ // Forward connector config vars as-is. The connector env map is curated
3031
+ // and plugins need access to secrets like passwords and tokens via
3032
+ // runtime.getSetting() for real transports to boot.
3033
+ ...collectConnectorEnvVars(config),
3034
+ // Forward Eliza config env vars as runtime settings
3035
+ ...(preferredProviderId ? { MODEL_PROVIDER: preferredProviderId } : {}),
3036
+ ...(visionModeSetting ? { VISION_MODE: visionModeSetting } : {}),
3037
+ ...resolveWalletRuntimeSettings(config),
3038
+ ...(typeof config.agents?.defaults?.adminEntityId === "string" &&
3039
+ config.agents.defaults.adminEntityId.trim().length > 0
3040
+ ? {
3041
+ ELIZA_ADMIN_ENTITY_ID: config.agents.defaults.adminEntityId.trim(),
3042
+ }
3043
+ : {}),
3044
+ ...(config.agents?.defaults?.ownerContacts
3045
+ ? {
3046
+ ELIZA_OWNER_CONTACTS_JSON: JSON.stringify(config.agents.defaults.ownerContacts),
3047
+ }
3048
+ : {}),
3049
+ ...(config.roles?.connectorAdmins
3050
+ ? {
3051
+ ELIZA_ROLES_CONNECTOR_ADMINS_JSON: JSON.stringify(config.roles.connectorAdmins),
3052
+ }
3053
+ : {}),
3054
+ // Forward skills config so plugin-agent-skills can apply allow/deny filtering
3055
+ ...(config.skills?.allowBundled
3056
+ ? { SKILLS_ALLOWLIST: config.skills.allowBundled.join(",") }
3057
+ : {}),
3058
+ ...(config.skills?.denyBundled
3059
+ ? { SKILLS_DENYLIST: config.skills.denyBundled.join(",") }
3060
+ : {}),
3061
+ // Managed skills are stored in the Eliza state dir.
3062
+ SKILLS_DIR: managedSkillsDir,
3063
+ // Tell plugin-agent-skills where to find bundled + workspace skills
3064
+ ...(bundledSkillsDir ? { BUNDLED_SKILLS_DIRS: bundledSkillsDir } : {}),
3065
+ ...(workspaceSkillsDir
3066
+ ? { WORKSPACE_SKILLS_DIR: workspaceSkillsDir }
3067
+ : {}),
3068
+ // Also forward extra dirs from config
3069
+ ...(config.skills?.load?.extraDirs?.length
3070
+ ? { EXTRA_SKILLS_DIRS: config.skills.load.extraDirs.join(",") }
3071
+ : {}),
3072
+ // Disable image description when vision is explicitly toggled off.
3073
+ // The cloud plugin always registers IMAGE_DESCRIPTION, so we need a
3074
+ // runtime setting to prevent the message service from calling it.
3075
+ ...(config.features?.vision === false
3076
+ ? { DISABLE_IMAGE_DESCRIPTION: "true" }
3077
+ : {}),
3078
+ },
3079
+ });
3080
+ installRuntimeMethodBindings(runtime);
3081
+ // 7a. Mobile local inference must be registered before runtime.initialize().
3082
+ // Runtime services probe TEXT_EMBEDDING during init; registering the local
3083
+ // handler only after startEliza() returns leaves mobile local mode booting
3084
+ // with "no provider" diagnostics and disabled embedding services.
3085
+ if (process.env.ELIZA_LOCAL_LLAMA?.trim() === "1") {
3086
+ try {
3087
+ const { ensureAospLocalInferenceHandlers } = await import("@elizaos/plugin-aosp-local-inference");
3088
+ await ensureAospLocalInferenceHandlers(runtime);
3089
+ }
3090
+ catch (err) {
3091
+ logger.warn(`[eliza] AOSP local inference pre-registration skipped: ${formatError(err)}`);
3092
+ }
3093
+ }
3094
+ else if (process.env.ELIZA_DEVICE_BRIDGE_ENABLED?.trim() === "1") {
3095
+ try {
3096
+ const { ensureMobileDeviceBridgeInferenceHandlers } = await import("@elizaos/plugin-capacitor-bridge/mobile-device-bridge-bootstrap");
3097
+ await ensureMobileDeviceBridgeInferenceHandlers(runtime);
3098
+ }
3099
+ catch (err) {
3100
+ logger.warn(`[eliza] Mobile device bridge pre-registration skipped: ${formatError(err)}`);
3101
+ }
3102
+ }
3103
+ // 7b. Pre-register plugin-sql so the adapter is ready before other plugins init.
3104
+ // This is OPTIONAL — without it, some features (memory, todos) won't work.
3105
+ // runtime.db is a getter that returns this.adapter.db and throws when
3106
+ // this.adapter is undefined, so plugins that use runtime.db will fail.
3107
+ if (sqlPlugin) {
3108
+ // 7c. Eagerly initialize the database adapter so it's fully ready
3109
+ // BEFORE other plugins run their init(). When legacy/corrupt PGLite
3110
+ // state causes startup aborts, reset the local DB dir and retry once.
3111
+ await registerSqlPluginWithRecovery(runtime, sqlPlugin, config);
3112
+ bootTimer.lap("register-sql");
3113
+ }
3114
+ else {
3115
+ const loadedNames = resolvedPlugins.map((p) => p.name).join(", ");
3116
+ logger.error(`[eliza] @elizaos/plugin-sql was NOT found among resolved plugins. ` +
3117
+ `Loaded: [${loadedNames}]`);
3118
+ throw new Error("@elizaos/plugin-sql is required but was not loaded. " +
3119
+ "Ensure the package is installed and built (check for import errors above).");
3120
+ }
3121
+ // 7d. Register the roles capability (cheap, gates provider/action visibility).
3122
+ // The remaining core plugins (companion, app-control, device-filesystem,
3123
+ // shell, coding-tools, agent-skills, commands, google, lifeops, browser,
3124
+ // video) are NOT essential to the chat path and are loaded in the
3125
+ // background after the runtime is ready — see runDeferredBoot below.
3126
+ try {
3127
+ logger.info("[eliza] Pre-registering roles capability...");
3128
+ await runtime.registerPlugin(rolesPlugin);
3129
+ logger.info("[eliza] ✓ roles capability pre-registered");
3130
+ }
3131
+ catch (err) {
3132
+ logger.warn(`[eliza] Roles capability pre-registration failed: ${formatError(err)}`);
3133
+ }
3134
+ bootTimer.lap("svc:roles-register");
3135
+ const warmAgentSkillsService = async () => {
3136
+ // Let runtime startup complete first; this warm-up runs asynchronously
3137
+ // so API + agent come online immediately.
3138
+ try {
3139
+ const skillServicePromise = runtime.getServiceLoadPromise("AGENT_SKILLS_SERVICE");
3140
+ const timeout = new Promise((_resolve, reject) => {
3141
+ setTimeout(() => {
3142
+ reject(new Error("AgentSkillsService warm-up timed out (10s) — non-blocking, agent will function without skills"));
3143
+ }, 10_000);
3144
+ });
3145
+ await Promise.race([skillServicePromise, timeout]);
3146
+ const svc = runtime.getService("AGENT_SKILLS_SERVICE");
3147
+ if (svc?.getCatalogStats) {
3148
+ const stats = svc.getCatalogStats();
3149
+ logger.info(`[eliza] AgentSkills ready — ${stats.loaded} skills loaded, ` +
3150
+ `${stats.total} in catalog (storage: ${stats.storageType})`);
3151
+ }
3152
+ // Guard against non-string skill.description values.
3153
+ // The bundled YAML parser produces {} for multi-line descriptions, which
3154
+ // crashes findBestLocalMatch / scoreSkillMatch (call .toLowerCase() on it).
3155
+ // Instead of a one-shot sanitize (which misses skills loaded later by
3156
+ // syncCatalog / autoRefresh), we monkey-patch getLoadedSkills to always
3157
+ // return sanitized values.
3158
+ const svcAny = svc;
3159
+ const origGetLoaded = svcAny?.getLoadedSkills;
3160
+ if (origGetLoaded && svcAny) {
3161
+ svcAny.getLoadedSkills = function (...args) {
3162
+ const skills = origGetLoaded.apply(this, args);
3163
+ for (const skill of skills) {
3164
+ if (typeof skill.description !== "string") {
3165
+ skill.description =
3166
+ skill.description == null
3167
+ ? ""
3168
+ : JSON.stringify(skill.description);
3169
+ }
3170
+ }
3171
+ return skills;
3172
+ };
3173
+ logger.debug("[eliza] Patched getLoadedSkills to guard descriptions");
3174
+ }
3175
+ }
3176
+ catch (err) {
3177
+ // Non-fatal — the agent can operate without skills. This warm-up runs
3178
+ // async so it doesn't block startup.
3179
+ logger.debug(`[eliza] AgentSkillsService warm-up: ${formatError(err)}`);
3180
+ }
3181
+ };
3182
+ const runStewardEvmPreBoot = async () => {
3183
+ try {
3184
+ const { stewardEvmPreBoot } = await loadStewardEvmBridgeModule();
3185
+ await stewardEvmPreBoot?.(runtime);
3186
+ }
3187
+ catch (err) {
3188
+ logger.debug(`[eliza] Steward EVM pre-boot skipped: ${formatError(err)}`);
3189
+ }
3190
+ };
3191
+ const registerConnectorSetupService = async () => {
3192
+ try {
3193
+ const { ConnectorSetupService } = await import("../services/connector-setup-service.js");
3194
+ await runtime.registerService(ConnectorSetupService);
3195
+ }
3196
+ catch (err) {
3197
+ logger.debug(`[eliza] ConnectorSetupService registration skipped: ${formatError(err)}`);
3198
+ }
3199
+ };
3200
+ const registerRemoteCodingRunner = async () => {
3201
+ if (isBundledMobileRuntime())
3202
+ return;
3203
+ if (!shouldLoadRemoteCodingRunnerForBoot(runtime))
3204
+ return;
3205
+ try {
3206
+ const { registerE2BRemoteCapabilityRouterIfEnabled } = await loadE2BCapabilityRouterModule();
3207
+ const result = await registerE2BRemoteCapabilityRouterIfEnabled(runtime);
3208
+ if (result.registered) {
3209
+ logger.info("[eliza] Remote coding runner registered");
3210
+ }
3211
+ }
3212
+ catch (err) {
3213
+ logger.warn(`[eliza] Remote coding runner registration failed: ${formatError(err)}`);
3214
+ }
3215
+ };
3216
+ const initializeCoreRuntime = async () => {
3217
+ assertPersistentDatabaseRequired(runtime);
3218
+ await runtime.initialize();
3219
+ await prepareRuntimeForTrajectoryCapture(runtime, "runtime.initialize()", config);
3220
+ };
3221
+ // One-time TEE boot gate (plan §4.1 / agent A4). Inert when no TEE policy is
3222
+ // configured: `evaluateTeeBootGate` returns secretsEnabled:true and normal/
3223
+ // local-only boots are unaffected. When ELIZA_TEE_REQUIRED (or a production
3224
+ // profile) resolves a required policy and the evidence is not trusted, the
3225
+ // gate fails closed and high-value capabilities (remote plugin sync plus
3226
+ // model-key/signing consumers) are withheld. Boot still proceeds in a
3227
+ // degraded, secret-less mode — it never silently continues with secrets.
3228
+ let teeBootGateResult;
3229
+ const runTeeBootGate = async () => {
3230
+ let teeBootGate;
3231
+ try {
3232
+ teeBootGate = await evaluateTeeBootGate({
3233
+ env: process.env,
3234
+ evidenceProvider: createDstackTeeProvider({ env: process.env }),
3235
+ });
3236
+ }
3237
+ catch (err) {
3238
+ // A TEE policy was configured but evidence could not be collected or
3239
+ // evaluated. Fail closed rather than crash the boot.
3240
+ teeBootGate = {
3241
+ policy: undefined,
3242
+ teeConfigured: true,
3243
+ required: true,
3244
+ productionProfile: process.env.ELIZA_TEE_PRODUCTION_PROFILE === "true",
3245
+ secretsEnabled: false,
3246
+ };
3247
+ logger.error(`[TeeBootGate] TEE evidence evaluation failed; secrets disabled (fail-closed): ${formatError(err)}`);
3248
+ }
3249
+ // Publish the one-time decision so secret-path modules (agent-wallet key
3250
+ // reveal/bridge, remote plugin sync) can consult it via the shared
3251
+ // singleton. Inert when no TEE: the gate's `required` is false.
3252
+ setTeeBootGateState(teeBootGate);
3253
+ teeBootGateResult = teeBootGate;
3254
+ };
3255
+ // TEE-gated remote signing (plan §4.3). Inert unless explicitly enabled:
3256
+ // the host↔guest bridge can request a signature, but the key stays in the
3257
+ // vault and every sign re-attests when the boot-gate policy requires TEE
3258
+ // evidence. Fail-closed: when the boot gate blocks secrets, the service is
3259
+ // not constructed at all.
3260
+ const registerRemoteSigningIfEnabled = async () => {
3261
+ if (process.env.ELIZA_REMOTE_SIGNING_ENABLED !== "true")
3262
+ return;
3263
+ if (teeBootGateBlocksSecrets()) {
3264
+ logger.warn("[RemoteSigning] Skipping remote signing activation: TEE evidence is not trusted.");
3265
+ return;
3266
+ }
3267
+ try {
3268
+ const { sharedVault } = await importAppCoreRuntime();
3269
+ const { VaultSignerBackend } = await import("../services/vault-signer-backend.js");
3270
+ const { createTeeGatedRemoteSigningService, RemoteSigningRuntimeService, } = await import("../services/remote-signing-service.js");
3271
+ const signer = new VaultSignerBackend({
3272
+ vault: sharedVault(),
3273
+ agentId,
3274
+ caller: "remote-signing:boot",
3275
+ });
3276
+ const teePolicy = teeBootGateResult?.policy;
3277
+ const signing = createTeeGatedRemoteSigningService({
3278
+ signer,
3279
+ ...(teePolicy ? { teePolicy } : {}),
3280
+ ...(teePolicy?.required
3281
+ ? { evidenceProvider: createDstackTeeProvider({ env: process.env }) }
3282
+ : {}),
3283
+ });
3284
+ await runtime.registerService(RemoteSigningRuntimeService);
3285
+ const svc = runtime.getService(RemoteSigningRuntimeService.serviceType);
3286
+ if (!svc) {
3287
+ throw new Error("RemoteSigningRuntimeService did not register");
3288
+ }
3289
+ svc.attach(signing);
3290
+ logger.info({ attesting: teePolicy?.required === true }, "[RemoteSigning] TEE-gated remote signing service registered.");
3291
+ }
3292
+ catch (err) {
3293
+ logger.warn(`[RemoteSigning] Remote signing activation failed: ${formatError(err)}`);
3294
+ }
3295
+ };
3296
+ const syncRemoteCapabilityPluginsIfAvailable = async () => {
3297
+ if (teeBootGateBlocksSecrets()) {
3298
+ logger.warn("[TeeBootGate] Skipping remote capability plugin sync: TEE evidence is not trusted.");
3299
+ return;
3300
+ }
3301
+ try {
3302
+ const result = await bootstrapRemoteCapabilityPlugins(runtime, {
3303
+ unloadMissing: true,
3304
+ });
3305
+ if (result.registered.length > 0 ||
3306
+ result.unloaded.length > 0 ||
3307
+ result.skipped.length > 0) {
3308
+ logger.info(`[eliza] Remote capability plugins synced — registered=${result.registered.length}, ` +
3309
+ `unloaded=${result.unloaded.length}, skipped=${result.skipped.length}`);
3310
+ }
3311
+ }
3312
+ catch (err) {
3313
+ logger.warn(`[eliza] Remote capability plugin sync failed: ${formatError(err)}`);
3314
+ }
3315
+ };
3316
+ const applyPluginRoleGatingIfAvailable = async () => {
3317
+ try {
3318
+ const { applyPluginRoleGating } = await import("./plugin-role-gating.js");
3319
+ applyPluginRoleGating(runtime.plugins ?? []);
3320
+ }
3321
+ catch (err) {
3322
+ logger.debug(`[eliza] Plugin provider role gating skipped: ${formatError(err)}`);
3323
+ }
3324
+ };
3325
+ const registerConversationProximityProvider = async () => {
3326
+ try {
3327
+ const { conversationProximityProvider } = await import("../providers/conversation-proximity.js");
3328
+ await runtime.registerPlugin({
3329
+ name: "eliza-conversation-proximity",
3330
+ description: "Read-only co-participant context for post-turn evaluators",
3331
+ providers: [conversationProximityProvider],
3332
+ });
3333
+ logger.info("[eliza] ✓ conversation-proximity provider registered");
3334
+ }
3335
+ catch (err) {
3336
+ logger.debug(`[eliza] Conversation-proximity provider skipped: ${formatError(err)}`);
3337
+ }
3338
+ };
3339
+ const seedBundledDocumentsIfEnabled = async () => {
3340
+ try {
3341
+ if (runtimeDocumentsEnabled(runtime)) {
3342
+ await seedBundledDocuments(runtime);
3343
+ }
3344
+ else {
3345
+ logger.info("[eliza] Native documents disabled; skipping bundled document seeding");
3346
+ }
3347
+ }
3348
+ catch (err) {
3349
+ logger.warn(`[eliza] Failed to seed bundled documents: ${formatError(err)}`);
3350
+ }
3351
+ };
3352
+ const runStewardEvmPostBoot = async () => {
3353
+ try {
3354
+ const { stewardEvmPostBoot } = await loadStewardEvmBridgeModule();
3355
+ await stewardEvmPostBoot?.(runtime);
3356
+ }
3357
+ catch (err) {
3358
+ logger.debug(`[eliza] Steward EVM post-boot skipped: ${formatError(err)}`);
3359
+ }
3360
+ };
3361
+ const installServerSideWebSearchIfAvailable = async () => {
3362
+ try {
3363
+ const { installServerSideWebSearch } = await import("./web-search-tools.js");
3364
+ installServerSideWebSearch();
3365
+ }
3366
+ catch (err) {
3367
+ logger.debug(`[eliza] Server-side web search setup skipped: ${formatError(err)}`);
3368
+ }
3369
+ };
3370
+ // Keyless inline live-info fetch for every runtime (not just Anthropic).
3371
+ // Opt out with ELIZA_WEB_FETCH=0|false|off, mirroring ELIZA_WEB_SEARCH.
3372
+ const registerWebFetchActionIfEnabled = async () => {
3373
+ try {
3374
+ const { webFetch, isWebFetchEnabled } = await import("./actions/web-fetch.js");
3375
+ if (!isWebFetchEnabled()) {
3376
+ logger.info("[eliza] WEB_FETCH action disabled via ELIZA_WEB_FETCH=0|false|off");
3377
+ return;
3378
+ }
3379
+ runtime.registerAction(webFetch);
3380
+ logger.info("[eliza] Registered keyless WEB_FETCH action");
3381
+ }
3382
+ catch (err) {
3383
+ logger.debug(`[eliza] WEB_FETCH action registration skipped: ${formatError(err)}`);
3384
+ }
3385
+ };
3386
+ const registerWebSearchActionIfEnabled = async () => {
3387
+ try {
3388
+ const { webSearch, isWebSearchEnabled } = await import("./actions/web-search.js");
3389
+ if (!isWebSearchEnabled()) {
3390
+ logger.info("[eliza] WEB_SEARCH action disabled; set ELIZA_INLINE_WEB_SEARCH=1 to force inline search, or unset ELIZA_SERVER_WEB_SEARCH when using the default inline surface");
3391
+ return;
3392
+ }
3393
+ runtime.registerAction(webSearch);
3394
+ logger.info("[eliza] Registered keyless WEB_SEARCH action");
3395
+ }
3396
+ catch (err) {
3397
+ logger.debug(`[eliza] WEB_SEARCH action registration skipped: ${formatError(err)}`);
3398
+ }
3399
+ };
3400
+ const isAutonomyEnabled = () => ["true", "1"].includes((process.env.ENABLE_AUTONOMY ?? "").toLowerCase());
3401
+ const startAutonomyServiceIfEnabled = async (autonomyEnabled) => {
3402
+ if (autonomyEnabled && !runtime.getService("AUTONOMY")) {
3403
+ try {
3404
+ await startAndRegisterAutonomyService(runtime);
3405
+ logger.info("[eliza] AutonomyService started for trigger dispatch");
3406
+ }
3407
+ catch (err) {
3408
+ logger.warn(`[eliza] AutonomyService failed to start: ${formatError(err)}`);
3409
+ }
3410
+ }
3411
+ else if (!autonomyEnabled) {
3412
+ logger.info("[eliza] AutonomyService skipped — ENABLE_AUTONOMY=false");
3413
+ }
3414
+ };
3415
+ const enableAutonomyLoopIfAvailable = async (autonomyEnabled) => {
3416
+ if (!autonomyEnabled)
3417
+ return;
3418
+ const autonomySvc = getAutonomyService(runtime);
3419
+ if (!autonomySvc)
3420
+ return;
3421
+ try {
3422
+ await autonomySvc.enableAutonomy();
3423
+ logger.info("[eliza] AutonomyService enabled — trigger instructions will be processed");
3424
+ }
3425
+ catch (err) {
3426
+ logger.warn(`[eliza] Failed to enable autonomy loop: ${formatError(err)}`);
3427
+ }
3428
+ };
3429
+ const startAgentSkillsWarmup = () => {
3430
+ void warmAgentSkillsService().catch((err) => {
3431
+ logger.warn(`[eliza] Skills warm-up failed: ${formatError(err)}`);
3432
+ });
3433
+ };
3434
+ // Prefetch the local TEXT_EMBEDDING GGUF in the background so the first
3435
+ // chat/memory request doesn't stall on a multi-second model download. The
3436
+ // chat/inference provider is separate from embeddings (vector memory / RAG):
3437
+ // API-based model plugins do not implement TEXT_EMBEDDING, so the local model
3438
+ // is the default embedding backend unless Eliza Cloud embeddings are active.
3439
+ // This only ensures the file is present on disk — the GGUF is loaded into
3440
+ // memory lazily on first use — and runs entirely after the readiness gate so
3441
+ // it can never block or crash boot.
3442
+ const warmEmbeddingModel = async () => {
3443
+ if (process.env.NODE_ENV === "test")
3444
+ return;
3445
+ // Mobile bundles do not ship node-llama-cpp and must not pull a multi-GB
3446
+ // GGUF over a data plan; they embed via cloud/device-bridge instead.
3447
+ if (isMobilePlatform() || isBundledMobileRuntime())
3448
+ return;
3449
+ const li = await getPluginLocalEmbedding();
3450
+ if (!li)
3451
+ return;
3452
+ const { shouldWarmupLocalEmbeddingModel, detectEmbeddingPreset, embeddingGgufFilePresent, findExistingEmbeddingModelForWarmupReuse, isEmbeddingWarmupReuseDisabled, ensureModel, DEFAULT_MODELS_DIR, } = await import(
3453
+ /* @vite-ignore */ "@elizaos/plugin-local-inference/runtime");
3454
+ if (!shouldWarmupLocalEmbeddingModel()) {
3455
+ logger.info("[eliza] Skipping local embedding (GGUF) warmup — not needed for this configuration (Eliza Cloud embeddings or local embeddings disabled).");
3456
+ return;
3457
+ }
3458
+ // Populate the LOCAL_EMBEDDING_* env from config + hardware preset so the
3459
+ // warmup and the lazy first-use load resolve the same model.
3460
+ await configureLocalEmbeddingPlugin({}, config);
3461
+ const preset = detectEmbeddingPreset();
3462
+ const modelsDir = process.env.MODELS_DIR?.trim() || DEFAULT_MODELS_DIR;
3463
+ let model = process.env.LOCAL_EMBEDDING_MODEL?.trim() || preset.model;
3464
+ let modelRepo = process.env.LOCAL_EMBEDDING_MODEL_REPO?.trim() || preset.modelRepo;
3465
+ if (!isEmbeddingWarmupReuseDisabled() &&
3466
+ !embeddingGgufFilePresent(modelsDir, model)) {
3467
+ const reuse = findExistingEmbeddingModelForWarmupReuse(modelsDir);
3468
+ if (reuse) {
3469
+ logger.info(`[eliza] Embedding warmup: configured file "${model}" not found in MODELS_DIR — reusing existing ${reuse.model} to avoid a large re-download.`);
3470
+ process.env.LOCAL_EMBEDDING_MODEL = reuse.model;
3471
+ process.env.LOCAL_EMBEDDING_MODEL_REPO = reuse.modelRepo;
3472
+ process.env.LOCAL_EMBEDDING_DIMENSIONS = String(reuse.dimensions);
3473
+ process.env.LOCAL_EMBEDDING_CONTEXT_SIZE = String(reuse.contextSize);
3474
+ process.env.LOCAL_EMBEDDING_GPU_LAYERS = reuse.gpuLayers;
3475
+ model = reuse.model;
3476
+ modelRepo = reuse.modelRepo;
3477
+ }
3478
+ }
3479
+ if (embeddingGgufFilePresent(modelsDir, model)) {
3480
+ return;
3481
+ }
3482
+ logger.info(`[eliza] Local embedding warmup: prefetching ${model} (preset: ${preset.label}). ` +
3483
+ "This GGUF serves TEXT_EMBEDDING / memory only — not your conversation model.");
3484
+ await ensureModel(modelsDir, modelRepo, model, false);
3485
+ };
3486
+ const startEmbeddingWarmup = () => {
3487
+ void warmEmbeddingModel().catch((err) => {
3488
+ // Non-fatal: the embedding plugin downloads on first use if this fails.
3489
+ logger.warn(`[eliza] Embedding model warmup failed (will retry on first use): ${formatError(err)}`);
3490
+ });
3491
+ };
3492
+ // Per-agent EVM + Solana wallet bootstrap is DEFERRED off the boot critical
3493
+ // path: it runs after the runtime is reachable (fired fire-and-forget from
3494
+ // the deferred boot phase below), not synchronously during essential boot.
3495
+ // This keeps the ~50s crypto import cost (EVM + Solana keypair generation +
3496
+ // encrypted vault writes) out of the time-to-reachable window.
3497
+ //
3498
+ // The opt-out (ELIZA_DISABLE_AGENT_WALLET_BOOTSTRAP), cloud-container skip
3499
+ // (ELIZA_CLOUD_PROVISIONED), and TEE-gate suppression (inside
3500
+ // bridgeAgentWalletsToProcessEnv and revealAgentWalletPrivateKey in
3501
+ // agent-wallets.ts) all still apply.
3502
+ //
3503
+ // The init is a singleton: once the first call resolves, subsequent calls
3504
+ // return the cached descriptors; a failure clears the singleton so the next
3505
+ // call retries. This closure is local to startEliza — it is not attached to
3506
+ // the runtime object. If a wallet route or signer needs true on-demand
3507
+ // generation, wire it onto the runtime and call it from that path.
3508
+ let walletInitPromise = null;
3509
+ const ensureAgentWalletsLazy = () => {
3510
+ if (process.env.ELIZA_DISABLE_AGENT_WALLET_BOOTSTRAP === "1" ||
3511
+ process.env.ELIZA_CLOUD_PROVISIONED === "1") {
3512
+ return Promise.resolve([]);
3513
+ }
3514
+ if (walletInitPromise)
3515
+ return walletInitPromise;
3516
+ walletInitPromise = (async () => {
3517
+ try {
3518
+ const { sharedVault } = await importAppCoreRuntime();
3519
+ const { ensureAgentWallets } = await import("./agent-wallets.js");
3520
+ const descriptors = await ensureAgentWallets(sharedVault(), agentId, "agent-bootstrap");
3521
+ const summary = descriptors
3522
+ .map((d) => `${d.chain}:${d.address}`)
3523
+ .join(" ");
3524
+ logger.info(`[agent-wallets] agent="${agentId}" wallets ready (${summary})`);
3525
+ return descriptors;
3526
+ }
3527
+ catch (err) {
3528
+ // Clear the singleton so the next access retries.
3529
+ walletInitPromise = null;
3530
+ logger.warn(`[agent-wallets] failed to ensure wallets for agent="${agentId}": ${err instanceof Error ? err.message : String(err)}`);
3531
+ return [];
3532
+ }
3533
+ })();
3534
+ return walletInitPromise;
3535
+ };
3536
+ // Essential boot: only what the runtime needs to become reachable (sql +
3537
+ // local-inference are already registered above; deferred provider/connector
3538
+ // plugins continue after the ready gate unless legacy blocking mode is
3539
+ // requested). The runtime is reported ready as soon as this resolves.
3540
+ const initializeRuntimeServices = async () => {
3541
+ await runStewardEvmPreBoot();
3542
+ bootTimer.lap("svc:steward-evm");
3543
+ await registerConnectorSetupService();
3544
+ bootTimer.lap("svc:connector-setup");
3545
+ await registerRemoteCodingRunner();
3546
+ bootTimer.lap("svc:pre-init");
3547
+ if (blockDeferredPluginImports) {
3548
+ // In block-deferred mode the Discord/GitHub plugins register here (not in
3549
+ // runDeferredBoot), so join the env-var lookups before this wave.
3550
+ await Promise.all([discordAppIdPromise, cloudGithubTokenPromise]);
3551
+ await preregisterCorePluginsInDependencyWaves({
3552
+ runtime,
3553
+ resolvedPlugins,
3554
+ alreadyPreRegistered: new Set([
3555
+ "@elizaos/plugin-sql",
3556
+ "@elizaos/plugin-local-inference",
3557
+ ]),
3558
+ label: "blocking",
3559
+ });
3560
+ bootTimer.lap("register-core-plugin-waves");
3561
+ }
3562
+ await initializeCoreRuntime();
3563
+ bootTimer.lap("svc:runtime.initialize");
3564
+ };
3565
+ const registerDeferredRuntimePlugins = async (deferredResolvedPlugins) => {
3566
+ if (blockDeferredPluginImports) {
3567
+ return;
3568
+ }
3569
+ const alreadyRegisteredPluginNames = new Set((runtime.plugins ?? [])
3570
+ .map((plugin) => plugin.name)
3571
+ .filter((name) => typeof name === "string"));
3572
+ const deferredPluginsForRuntime = deferredResolvedPlugins
3573
+ .filter((p) => !PREREGISTER_PLUGINS.has(p.name))
3574
+ .filter((p) => !alreadyRegisteredPluginNames.has(p.plugin.name ?? p.name))
3575
+ .map((p) => p.plugin);
3576
+ if (deferredPluginsForRuntime.length === 0) {
3577
+ return;
3578
+ }
3579
+ if (preferredProviderPluginName) {
3580
+ for (const plugin of deferredPluginsForRuntime) {
3581
+ if (plugin.name === preferredProviderPluginName) {
3582
+ plugin.priority = (plugin.priority ?? 0) + 10;
3583
+ logger.info(`[eliza] Boosted deferred plugin "${plugin.name}" priority to ${plugin.priority} (preferred provider: ${preferredProviderId ?? "unknown"})`);
3584
+ break;
3585
+ }
3586
+ }
3587
+ }
3588
+ for (const plugin of deferredPluginsForRuntime) {
3589
+ if (plugin.name === "@elizaos/plugin-agent-skills" &&
3590
+ Array.isArray(plugin.providers)) {
3591
+ const UPSTREAM_SKILL_PROVIDERS_TO_STRIP = new Set([
3592
+ "agent_skills",
3593
+ "agent_skill_instructions",
3594
+ "agent_skills_catalog",
3595
+ ]);
3596
+ const before = plugin.providers.length;
3597
+ plugin.providers = plugin.providers.filter((p) => !UPSTREAM_SKILL_PROVIDERS_TO_STRIP.has(p.name ?? ""));
3598
+ const removed = before - plugin.providers.length;
3599
+ if (removed > 0) {
3600
+ logger.info(`[eliza] Stripped ${removed} deferred upstream skill provider(s) — using dynamic BM25-lite provider instead`);
3601
+ }
3602
+ }
3603
+ }
3604
+ deduplicatePluginActions([
3605
+ basicCapabilitiesPlugin,
3606
+ elizaPlugin,
3607
+ ...(runtime.plugins ?? []),
3608
+ ...deferredPluginsForRuntime,
3609
+ ]);
3610
+ const timeoutMs = 30_000;
3611
+ await Promise.all(deferredPluginsForRuntime.map(async (plugin) => {
3612
+ const startedAt = Date.now();
3613
+ try {
3614
+ logger.info(`[eliza] deferred: Registering plugin: ${plugin.name}...`);
3615
+ await Promise.race([
3616
+ runtime.registerPlugin(plugin),
3617
+ new Promise((_resolve, reject) => setTimeout(() => reject(new Error(`Timed out after ${timeoutMs / 1000}s`)), timeoutMs)),
3618
+ ]);
3619
+ logger.info(`[eliza] deferred: ✓ ${plugin.name} registered (${Date.now() - startedAt}ms)`);
3620
+ }
3621
+ catch (err) {
3622
+ logger.warn(`[eliza] deferred: Plugin ${plugin.name} registration failed: ${formatError(err)}`);
3623
+ }
3624
+ }));
3625
+ };
3626
+ const resolveDeferredPluginsForBoot = async () => {
3627
+ if (blockDeferredPluginImports) {
3628
+ return resolvedPlugins;
3629
+ }
3630
+ await ensureDeferredCoreStaticPluginsRegistered();
3631
+ const deferredResolvedPlugins = await resolvePlugins(config, {
3632
+ quiet: preOnboarding,
3633
+ phase: "deferred",
3634
+ });
3635
+ bootTimer.lap("deferred:resolve-plugins-import");
3636
+ return deferredResolvedPlugins;
3637
+ };
3638
+ // Deferred boot: non-essential core plugins (companion, app-control,
3639
+ // device-filesystem, shell, coding-tools, agent-skills, commands, google,
3640
+ // lifeops, browser, video), auto-enabled providers/connectors, custom
3641
+ // plugins, plus the post-init tail. Runs in the background after the runtime
3642
+ // is ready so the API can bind immediately; deferred capabilities light up as
3643
+ // each plugin registers. The 3 intra-core dependency edges
3644
+ // (coding-tools/agent-skills → shell, lifeops → google) live entirely within
3645
+ // this group, so the existing wave algorithm preserves ordering.
3646
+ const runDeferredBoot = async () => {
3647
+ // Join the boot-time network lookups (Discord App ID, cloud GitHub token)
3648
+ // before resolving the deferred plugin set — the Discord connector and the
3649
+ // GitHub/git plugins live in this deferred wave and read the env vars these
3650
+ // promises write. Also join the Claude Code OAuth probe (informational
3651
+ // logging only). All self-handle their errors, so this only waits.
3652
+ await Promise.all([
3653
+ discordAppIdPromise,
3654
+ cloudGithubTokenPromise,
3655
+ subscriptionCredentialsDeferredPromise,
3656
+ ]);
3657
+ bootTimer.lap("deferred:env-lookups");
3658
+ if (!blockDeferredPluginImports) {
3659
+ const deferredResolvedPlugins = await resolveDeferredPluginsForBoot();
3660
+ await registerDeferredRuntimePlugins(deferredResolvedPlugins);
3661
+ bootTimer.lap("deferred:runtime-plugins");
3662
+ await preregisterCorePluginsInDependencyWaves({
3663
+ runtime,
3664
+ resolvedPlugins: deferredResolvedPlugins,
3665
+ alreadyPreRegistered: new Set([
3666
+ "@elizaos/plugin-sql",
3667
+ "@elizaos/plugin-local-inference",
3668
+ ]),
3669
+ label: "deferred",
3670
+ });
3671
+ bootTimer.lap("deferred:core-plugin-waves");
3672
+ }
3673
+ await runTeeBootGate();
3674
+ bootTimer.lap("deferred:tee-gate");
3675
+ await registerRemoteSigningIfEnabled();
3676
+ await syncRemoteCapabilityPluginsIfAvailable();
3677
+ await applyPluginRoleGatingIfAvailable();
3678
+ await registerConversationProximityProvider();
3679
+ // Probe the embedding dimension BEFORE seeding bundled documents (#8769).
3680
+ // The deferred plugin waves above register the cloud TEXT_EMBEDDING handler
3681
+ // (plugin-elizacloud, 1536-dim); the probe in runtime.initialize() ran ~38s
3682
+ // earlier, before that handler existed, so the SQL adapter kept its
3683
+ // hardcoded dim384 default. seedBundledDocumentsIfEnabled() embeds its docs
3684
+ // at 1536 via the cloud handler, so if the column is still dim384 every
3685
+ // bundled-doc vector is dropped on a "dimension mismatch with configured
3686
+ // column (dim384)" and the agent boots with no recall memory. Snapping the
3687
+ // column to dim1536 here — after the handler is registered, before the seed
3688
+ // writes — lets those embeddings (and all later memory) persist.
3689
+ // ensureEmbeddingDimension() is public, idempotent, and self-guarding (it
3690
+ // no-ops when no TEXT_EMBEDDING handler is registered, e.g. cloud-proxied
3691
+ // agents), so this is safe on every boot path.
3692
+ try {
3693
+ await runtime.ensureEmbeddingDimension();
3694
+ }
3695
+ catch (err) {
3696
+ logger.warn(`[eliza] deferred embedding-dimension re-probe failed: ${err instanceof Error ? err.message : String(err)}`);
3697
+ }
3698
+ await seedBundledDocumentsIfEnabled();
3699
+ await runStewardEvmPostBoot();
3700
+ await installServerSideWebSearchIfAvailable();
3701
+ await registerWebFetchActionIfEnabled();
3702
+ await registerWebSearchActionIfEnabled();
3703
+ bootTimer.lap("deferred:post-init");
3704
+ const autonomyLoopEnabled = isAutonomyEnabled();
3705
+ await startAutonomyServiceIfEnabled(true);
3706
+ await enableAutonomyLoopIfAvailable(autonomyLoopEnabled);
3707
+ startAgentSkillsWarmup();
3708
+ startEmbeddingWarmup();
3709
+ // Trigger the lazy wallet singleton fire-and-forget. This is a safety net
3710
+ // — if no wallet route or signing flow triggers it earlier, wallets are
3711
+ // still generated here. The singleton keeps this harmless if already
3712
+ // resolved by an earlier caller.
3713
+ void ensureAgentWalletsLazy();
3714
+ bootTimer.lap("deferred:autonomy+warmup");
3715
+ // Re-install action aliases now that deferred plugins have registered
3716
+ // their actions; the initial pass after the essential boot only saw the
3717
+ // core message-handler actions.
3718
+ installActionAliases(runtime);
3719
+ // Same timing reason: validate the intent→action map only once the deferred
3720
+ // plugins have registered. Run during blocking init it would warn about
3721
+ // actions like TASKS (agent-orchestrator) and PLAY_EMOTE (companion) that
3722
+ // simply hadn't loaded yet.
3723
+ validateIntentActionMap(runtime.actions.map((a) => a.name), runtime.logger);
3724
+ // Same timing: turn the (previously dead-but-tested) view-coverage validators
3725
+ // into a live drift guard now that all plugins/views are registered (#8798).
3726
+ // Warns when a VIEW_ACTION_MAP entry names an unregistered action, or a
3727
+ // registered view has neither an affinity entry nor a declared ViewCapability.
3728
+ const developerViews = listViews({ developerMode: true });
3729
+ validateViewActionMap(runtime.actions.map((a) => a.name), runtime.logger);
3730
+ validateViewCoverage(developerViews.map((v) => v.id), developerViews.filter((v) => v.capabilities?.length).map((v) => v.id), runtime.logger);
3731
+ bootTimer.lap("deferred:complete");
3732
+ };
3733
+ try {
3734
+ // Time from the register-sql lap up to entering service init (roles
3735
+ // capability registration + any blocking pre-init work). Split out so a
3736
+ // device boot can attribute the dominant cost instead of lumping it into
3737
+ // svc:pre-init (issue #9565): on a bundled mobile runtime the three hooks
3738
+ // below are each fast/no-op, yet svc:pre-init was ~15s of a 16s cold boot.
3739
+ bootTimer.lap("svc:boot-prep");
3740
+ await initializeRuntimeServices();
3741
+ }
3742
+ catch (err) {
3743
+ const pgliteDataDir = resolveActivePgliteDataDir(config);
3744
+ const recoveryAction = !opts?.pgliteRecoveryAttempted && pgliteDataDir
3745
+ ? getPgliteRecoveryAction(err, pgliteDataDir)
3746
+ : "none";
3747
+ if (!pgliteDataDir || recoveryAction === "none") {
3748
+ throw err;
3749
+ }
3750
+ if (recoveryAction === "fail-active-lock") {
3751
+ throw createActivePgliteLockError(pgliteDataDir, err);
3752
+ }
3753
+ if (recoveryAction === "fail-manual-reset") {
3754
+ throw createManualResetRequiredPgliteError(pgliteDataDir, err);
3755
+ }
3756
+ logger.warn(`[eliza] Runtime migrations failed (${formatError(err)}). Cleared a stale PGLite lock in ${pgliteDataDir} and retrying startup once without resetting data.`);
3757
+ try {
3758
+ await shutdownRuntime(runtime, "PGLite recovery");
3759
+ }
3760
+ catch {
3761
+ // Ignore cleanup errors — retry creates a fresh runtime anyway.
3762
+ }
3763
+ return await startEliza({
3764
+ ...opts,
3765
+ pgliteRecoveryAttempted: true,
3766
+ });
3767
+ }
3768
+ bootTimer.summary();
3769
+ void recordBootTelemetry(bootTimer.getSummary());
3770
+ startMemorySampler({ intervalMs: 30_000 });
3771
+ installActionAliases(runtime);
3772
+ // Kick off non-essential plugin loading in the background. The runtime is
3773
+ // already usable for chat; deferred capabilities register as they complete.
3774
+ // Fired AFTER the API server is listening (see below) so the deferred
3775
+ // wave's awaited work cannot starve the API bind off the event loop.
3776
+ const kickoffDeferredBoot = () => {
3777
+ void runDeferredBoot().catch((err) => {
3778
+ logger.warn(`[eliza] Deferred boot failed: ${formatError(err)}`);
3779
+ });
3780
+ };
3781
+ // 9. Graceful shutdown handler
3782
+ //
3783
+ // In headless mode the caller (dev-server / desktop shell) owns the process
3784
+ // lifecycle, so we must NOT register signal handlers here — they would
3785
+ // stack on every hot-restart, close over stale runtime references, and
3786
+ // race with bun --watch's own process teardown.
3787
+ if (!opts?.headless) {
3788
+ registerSignalShutdownHandlers({
3789
+ getRuntime: () => runtime,
3790
+ getSandboxManager: () => sandboxManager,
3791
+ });
3792
+ }
3793
+ const loadHooksSystem = async () => {
3794
+ try {
3795
+ const internalHooksConfig = config.hooks
3796
+ ?.internal;
3797
+ await loadHooks({
3798
+ workspacePath: workspaceDir,
3799
+ internalConfig: internalHooksConfig,
3800
+ elizaConfig: config,
3801
+ });
3802
+ const startupEvent = createHookEvent("gateway", "startup", "system", {
3803
+ cfg: config,
3804
+ });
3805
+ await triggerHook(startupEvent);
3806
+ }
3807
+ catch (err) {
3808
+ logger.warn(`[eliza] Hooks system could not load: ${formatError(err)}`);
3809
+ }
3810
+ };
3811
+ // ── Headless mode — return runtime for API server wiring ──────────────
3812
+ if (opts?.headless) {
3813
+ void loadHooksSystem().catch((err) => {
3814
+ logger.warn(`[eliza] Hooks system load failed: ${formatError(err)}`);
3815
+ });
3816
+ // Defer the deferred-boot kickoff to a macrotask so this function's caller
3817
+ // (dev-server / desktop shell) gets to run its `await startEliza()`
3818
+ // continuation FIRST — that continuation flips agentState to "running" and
3819
+ // broadcasts `ready:true`. Firing kickoffDeferredBoot() synchronously here
3820
+ // started the deferred plugin import storm (CPU-bound module evaluation)
3821
+ // before the readiness continuation could get a turn, so `ready:true`
3822
+ // landed ~13s late even though the blocking boot finished at ~2s
3823
+ // (loadperf research/03 F2). setImmediate yields to the macrotask queue
3824
+ // after the microtask continuation, so readiness flips promptly and the
3825
+ // deferred connectors/feature plugins still register right after.
3826
+ setImmediate(kickoffDeferredBoot);
3827
+ logger.info("[eliza] Runtime initialised in headless mode (autonomy enabled)");
3828
+ return runtime;
3829
+ }
3830
+ // 10. Load hooks system
3831
+ await loadHooksSystem();
3832
+ // ── Start API server for GUI access ──────────────────────────────────────
3833
+ // In CLI mode (non-headless), start the API server in the background so
3834
+ // the GUI can connect to the running agent. This ensures full feature
3835
+ // parity: whether started via `npx elizaos`, `bun run dev`, or the
3836
+ // desktop app, the API server is always available for the GUI admin
3837
+ // surface.
3838
+ try {
3839
+ const { startApiServer } = await import("../api/server.js");
3840
+ // When the desktop launcher embeds this agent it sets ELIZA_API_PORT
3841
+ // (default 31337) to match the renderer's hardcoded API base. The old
3842
+ // `resolveServerOnlyPort` call only reads ELIZA_PORT/ELIZA_UI_PORT,
3843
+ // ignoring ELIZA_API_PORT, so the desktop API ended up on 2138 and
3844
+ // the renderer hit "Failed to fetch". Prefer the desktop API port
3845
+ // resolver when ELIZA_API_PORT is set; otherwise fall back to the
3846
+ // server-only resolver so CLI-mode defaults (2138) stay untouched.
3847
+ const apiPort = process.env.ELIZA_API_PORT
3848
+ ? resolveDesktopApiPort(process.env)
3849
+ : resolveServerOnlyPort(process.env);
3850
+ const { port: actualApiPort } = await startApiServer({
3851
+ port: apiPort,
3852
+ runtime,
3853
+ onRestart: async () => {
3854
+ logger.info("[eliza] Hot-reload: Restarting runtime...");
3855
+ try {
3856
+ // Stop the old runtime to release resources (DB connections, timers, etc.)
3857
+ //
3858
+ // WHY the 2s timeout: some services — notably PTYService —
3859
+ // shut down gracefully by awaiting each active session with a
3860
+ // per-session timeout (up to ~5s). runtime.stop() awaits every
3861
+ // service.stop() sequentially, so a single idle PTY session
3862
+ // turns a provider switch into a multi-second block. During
3863
+ // that window the runtime-operations active-op slot +
3864
+ // agentState === "restarting" guard reject further clicks,
3865
+ // which is why flipping through providers rapidly feels stuck.
3866
+ //
3867
+ // Cap the shutdown window at 2s; if it doesn't finish, log and
3868
+ // bring the new runtime up anyway. Services that miss the
3869
+ // window get GC'd when the process unwinds. This is fine for a
3870
+ // user-initiated restart — the user asked for a new runtime;
3871
+ // in-flight work on the old one is already obsolete.
3872
+ try {
3873
+ const SHUTDOWN_TIMEOUT_MS = 2000;
3874
+ let shutdownTimedOut = false;
3875
+ await Promise.race([
3876
+ shutdownRuntime(runtime, "hot-reload cleanup"),
3877
+ new Promise((resolve) => setTimeout(() => {
3878
+ shutdownTimedOut = true;
3879
+ resolve();
3880
+ }, SHUTDOWN_TIMEOUT_MS)),
3881
+ ]);
3882
+ if (shutdownTimedOut) {
3883
+ logger.warn(`[eliza] Hot-reload: old runtime shutdown exceeded ${SHUTDOWN_TIMEOUT_MS}ms; proceeding with new runtime`);
3884
+ }
3885
+ }
3886
+ catch (stopErr) {
3887
+ logger.warn(`[eliza] Hot-reload: old runtime stop failed: ${formatError(stopErr)}`);
3888
+ }
3889
+ // Reload config from disk (updated by API)
3890
+ const freshConfig = loadElizaConfig();
3891
+ // Propagate secrets & cloud config into process.env so plugins
3892
+ // (especially plugin-elizacloud) can discover them. The initial
3893
+ // startup does this in startEliza(); the hot-reload must repeat it
3894
+ // because the config may have changed (e.g. cloud enabled during
3895
+ // first-run setup).
3896
+ applyConnectorSecretsToEnv(freshConfig);
3897
+ await autoResolveDiscordAppId();
3898
+ applyCloudConfigToEnv(freshConfig);
3899
+ applyX402ConfigToEnv(freshConfig);
3900
+ applyDatabaseConfigToEnv(freshConfig);
3901
+ await autoFetchCloudGithubToken(freshConfig.cloud?.agentId?.trim() || agentId);
3902
+ try {
3903
+ const accountPool = await importAppCoreRuntime();
3904
+ accountPool.getDefaultAccountPool();
3905
+ await accountPool.applyAccountPoolApiCredentials({
3906
+ activeBackend: resolveServiceRoutingInConfig(freshConfig)?.llmText?.backend,
3907
+ accountStrategies: freshConfig.accountStrategies,
3908
+ serviceRouting: resolveServiceRoutingInConfig(freshConfig),
3909
+ });
3910
+ accountPool.startAccountPoolKeepAlive();
3911
+ }
3912
+ catch (poolErr) {
3913
+ logger.debug(`[eliza] Hot-reload: account pool bootstrap skipped: ${formatError(poolErr)}`);
3914
+ }
3915
+ // Apply subscription-based credentials (Claude Max, Codex Max)
3916
+ // that may have been set up during first-run setup.
3917
+ try {
3918
+ const { applySubscriptionCredentials } = await import("../auth/index.js");
3919
+ await applySubscriptionCredentials(freshConfig);
3920
+ }
3921
+ catch (subErr) {
3922
+ logger.warn(`[eliza] Hot-reload: subscription credentials: ${formatError(subErr)}`);
3923
+ }
3924
+ // Resolve plugins using same function as startup
3925
+ const resolvedPlugins = await resolvePlugins(freshConfig);
3926
+ // Rebuild character from the fresh config so first-run changes
3927
+ // (name, bio, style, etc.) are picked up on restart.
3928
+ const freshCharacter = buildCharacterFromConfig(freshConfig);
3929
+ // Recreate Eliza plugin with fresh workspace
3930
+ const freshElizaPlugin = createElizaPlugin({
3931
+ workspaceDir: freshConfig.agents?.defaults?.workspace ?? workspaceDir,
3932
+ agentId: freshCharacter.name?.toLowerCase().replace(/\s+/g, "-") ?? "main",
3933
+ });
3934
+ // Create new runtime with updated plugins.
3935
+ // Filter out pre-registered plugins so they aren't double-loaded
3936
+ // inside initialize()'s Promise.all — same pattern as the initial
3937
+ // startup to avoid the TEXT_EMBEDDING race condition.
3938
+ const freshPreferredProviderId = resolvePreferredProviderId(freshConfig);
3939
+ const freshPreferredProviderPluginName = resolvePreferredProviderPluginName(freshConfig);
3940
+ const freshOtherPlugins = resolvedPlugins.filter((p) => !PREREGISTER_PLUGINS.has(p.name));
3941
+ // Boost the preferred provider plugin priority (same as initial startup)
3942
+ const freshPluginsForRuntime = freshOtherPlugins.map((p) => p.plugin);
3943
+ const freshVisionModeSetting = resolveVisionModeSetting(freshConfig);
3944
+ if (freshPreferredProviderPluginName) {
3945
+ for (const plugin of freshPluginsForRuntime) {
3946
+ if (plugin.name === freshPreferredProviderPluginName) {
3947
+ plugin.priority = (plugin.priority ?? 0) + 10;
3948
+ break;
3949
+ }
3950
+ }
3951
+ }
3952
+ const newRuntime = new AgentRuntime({
3953
+ character: freshCharacter,
3954
+ plugins: [freshElizaPlugin, ...freshPluginsForRuntime],
3955
+ ...(runtimeLogLevel ? { logLevel: runtimeLogLevel } : {}),
3956
+ settings: {
3957
+ ...(freshPreferredProviderId
3958
+ ? { MODEL_PROVIDER: freshPreferredProviderId }
3959
+ : {}),
3960
+ ...(freshVisionModeSetting
3961
+ ? { VISION_MODE: freshVisionModeSetting }
3962
+ : {}),
3963
+ // Disable image description when vision is explicitly toggled off.
3964
+ ...(freshConfig.features?.vision === false
3965
+ ? { DISABLE_IMAGE_DESCRIPTION: "true" }
3966
+ : {}),
3967
+ },
3968
+ });
3969
+ installRuntimeMethodBindings(newRuntime);
3970
+ // Pre-register plugin-sql before initialize() so the adapter is ready,
3971
+ // matching initial startup. local-inference wires its handlers via the
3972
+ // runtime hooks like every other plugin.
3973
+ // Re-derive from freshly resolved plugins (not outer closure) so
3974
+ // hot-reload picks up any plugin updates.
3975
+ const freshSqlPlugin = resolvedPlugins.find((p) => p.name === "@elizaos/plugin-sql");
3976
+ if (freshSqlPlugin) {
3977
+ await registerSqlPluginWithRecovery(newRuntime, freshSqlPlugin, freshConfig);
3978
+ }
3979
+ // Pre-register remaining core plugins sequentially (same as startup)
3980
+ {
3981
+ try {
3982
+ await newRuntime.registerPlugin(rolesPlugin);
3983
+ }
3984
+ catch (err) {
3985
+ logger.warn(`[eliza] Hot-reload: roles capability pre-registration failed: ${formatError(err)}`);
3986
+ }
3987
+ const alreadyPreRegistered = new Set([
3988
+ "@elizaos/plugin-sql",
3989
+ "@elizaos/plugin-local-inference",
3990
+ ]);
3991
+ await preregisterCorePluginsInDependencyWaves({
3992
+ runtime: newRuntime,
3993
+ resolvedPlugins,
3994
+ alreadyPreRegistered,
3995
+ label: "Hot-reload",
3996
+ });
3997
+ }
3998
+ assertPersistentDatabaseRequired(newRuntime);
3999
+ try {
4000
+ const { ConnectorSetupService: CSSReload } = await import("../services/connector-setup-service.js");
4001
+ await newRuntime.registerService(CSSReload);
4002
+ }
4003
+ catch {
4004
+ // non-fatal
4005
+ }
4006
+ if (!isBundledMobileRuntime() &&
4007
+ shouldLoadRemoteCodingRunnerForBoot(newRuntime)) {
4008
+ try {
4009
+ const { registerE2BRemoteCapabilityRouterIfEnabled } = await loadE2BCapabilityRouterModule();
4010
+ await registerE2BRemoteCapabilityRouterIfEnabled(newRuntime);
4011
+ }
4012
+ catch {
4013
+ // non-fatal
4014
+ }
4015
+ }
4016
+ try {
4017
+ const { stewardEvmPreBoot: preBootHR } = await loadStewardEvmBridgeModule();
4018
+ await preBootHR?.(newRuntime);
4019
+ }
4020
+ catch {
4021
+ // non-fatal
4022
+ }
4023
+ assertPersistentDatabaseRequired(newRuntime);
4024
+ await newRuntime.initialize();
4025
+ await prepareRuntimeForTrajectoryCapture(newRuntime, "hot-reload runtime.initialize()", config);
4026
+ try {
4027
+ const { applyPluginRoleGating } = await import("./plugin-role-gating.js");
4028
+ applyPluginRoleGating(newRuntime.plugins ?? []);
4029
+ }
4030
+ catch (err) {
4031
+ logger.debug(`[eliza] Hot-reload plugin provider role gating skipped: ${formatError(err)}`);
4032
+ }
4033
+ try {
4034
+ const { stewardEvmPostBoot: postBootHR } = await loadStewardEvmBridgeModule();
4035
+ await postBootHR?.(newRuntime);
4036
+ }
4037
+ catch {
4038
+ // non-fatal
4039
+ }
4040
+ // Ensure AutonomyService survives hot-reload; the loop remains opt-in.
4041
+ const hotReloadAutonomyLoopEnabled = isAutonomyEnabled();
4042
+ if (!newRuntime.getService("AUTONOMY")) {
4043
+ try {
4044
+ await startAndRegisterAutonomyService(newRuntime);
4045
+ }
4046
+ catch (err) {
4047
+ logger.warn(`[eliza] AutonomyService failed to start after hot-reload: ${formatError(err)}`);
4048
+ }
4049
+ }
4050
+ // Enable the autonomy loop after hot-reload only when explicitly requested.
4051
+ if (hotReloadAutonomyLoopEnabled) {
4052
+ const svc = getAutonomyService(newRuntime);
4053
+ if (svc) {
4054
+ try {
4055
+ await svc.enableAutonomy();
4056
+ }
4057
+ catch (err) {
4058
+ logger.warn(`[eliza] Failed to enable autonomy after hot-reload: ${formatError(err)}`);
4059
+ }
4060
+ }
4061
+ }
4062
+ installActionAliases(newRuntime);
4063
+ runtime = newRuntime;
4064
+ logger.info("[eliza] Hot-reload: Runtime restarted successfully");
4065
+ return newRuntime;
4066
+ }
4067
+ catch (err) {
4068
+ logger.error(`[eliza] Hot-reload failed: ${formatError(err)}`);
4069
+ return null;
4070
+ }
4071
+ },
4072
+ });
4073
+ const dashboardUrl = `http://localhost:${actualApiPort}`;
4074
+ logger.info(`[eliza] Control UI: ${dashboardUrl}`);
4075
+ // API is now listening — safe to begin the deferred plugin waves.
4076
+ kickoffDeferredBoot();
4077
+ }
4078
+ catch (apiErr) {
4079
+ // Log to both stderr (visible to Electrobun agent.ts) and the in-memory
4080
+ // logger so the error is never silently swallowed in packaged builds.
4081
+ const apiErrMsg = `[eliza] Could not start API server: ${formatError(apiErr)}`;
4082
+ console.error(apiErrMsg);
4083
+ logger.error(apiErrMsg);
4084
+ // In server-only mode (Electrobun desktop), a missing API server is fatal
4085
+ // — nothing else can serve requests. Exit so the parent process sees a
4086
+ // non-zero exit code instead of the misleading "Server running" message.
4087
+ if (opts?.serverOnly) {
4088
+ logger.error("[eliza] Exiting: API server is required in server-only mode.");
4089
+ process.exit(1);
4090
+ }
4091
+ // Non-fatal in CLI mode — the interactive chat loop still works.
4092
+ // Still load deferred capabilities even though the API failed.
4093
+ kickoffDeferredBoot();
4094
+ }
4095
+ // ── Server-only mode — keep running without chat loop ────────────────────
4096
+ if (opts?.serverOnly) {
4097
+ logger.info("[eliza] Running in server-only mode (no interactive chat)");
4098
+ // Cloud sandbox self-registration (Path A). When this runtime is the
4099
+ // entrypoint of a Hetzner-provisioned container, the provisioner injects
4100
+ // the SANDBOX_REGISTRY_* env vars. Writing the `agent:<id>:server` +
4101
+ // `server:<name>:url` keys to the shared Upstash Redis lets the
4102
+ // multi-tenant gateways resolve this container as the inference target
4103
+ // and forward inbound platform messages here. Returns null for every
4104
+ // non-provisioned runtime, so this is inert outside the cloud
4105
+ // container. See packages/agent/src/runtime/sandbox-registry.ts.
4106
+ const { buildSandboxRegistryFromEnv } = await import("./sandbox-registry.js");
4107
+ const sandboxRegistry = buildSandboxRegistryFromEnv();
4108
+ if (sandboxRegistry) {
4109
+ try {
4110
+ await sandboxRegistry.register();
4111
+ }
4112
+ catch (err) {
4113
+ logger.error(`[eliza] Failed to register sandbox in Redis (gateways will not route inbound platform messages here until the next hb_signal succeeds): ${formatError(err)}`);
4114
+ }
4115
+ sandboxRegistry.startHeartbeat(30_000);
4116
+ }
4117
+ // Keep process alive — the API server handles all interaction
4118
+ const keepAlive = setInterval(() => { }, 1 << 30); // ~12 days
4119
+ registerSignalShutdownHandlers({
4120
+ getRuntime: () => runtime,
4121
+ getSandboxManager: () => sandboxManager,
4122
+ beforeShutdown: async () => {
4123
+ clearInterval(keepAlive);
4124
+ if (sandboxRegistry) {
4125
+ sandboxRegistry.stopHeartbeat();
4126
+ try {
4127
+ await sandboxRegistry.unregister();
4128
+ }
4129
+ catch (err) {
4130
+ logger.warn(`[eliza] Sandbox unregister failed (keys will expire via TTL): ${formatError(err)}`);
4131
+ }
4132
+ }
4133
+ },
4134
+ });
4135
+ return runtime;
4136
+ }
4137
+ // ── Interactive chat loop ────────────────────────────────────────────────
4138
+ const agentName = character.name ?? "Eliza";
4139
+ const userId = crypto.randomUUID();
4140
+ // Use `let` so the fallback path can reassign to fresh IDs.
4141
+ let roomId = stringToUuid(`${agentName}-chat-room`);
4142
+ try {
4143
+ const worldId = stringToUuid(`${agentName}-chat-world`);
4144
+ // Use a deterministic messageServerId so the settings provider
4145
+ // can reference the world by serverId after it is found.
4146
+ const messageServerId = stringToUuid(`${agentName}-cli-server`);
4147
+ await runtime.ensureConnection({
4148
+ entityId: userId,
4149
+ roomId,
4150
+ worldId,
4151
+ userName: "User",
4152
+ source: "cli",
4153
+ channelId: `${agentName}-chat`,
4154
+ type: ChannelType.DM,
4155
+ messageServerId,
4156
+ metadata: { ownership: { ownerId: userId } },
4157
+ });
4158
+ // Ensure the world has ownership metadata so the settings
4159
+ // provider can locate it via findWorldsForOwner during first-run setup.
4160
+ // This also handles worlds that already exist from a prior session
4161
+ // but were created without ownership metadata.
4162
+ const world = await runtime.getWorld(worldId);
4163
+ if (world) {
4164
+ let needsUpdate = false;
4165
+ if (!world.metadata) {
4166
+ world.metadata = {};
4167
+ needsUpdate = true;
4168
+ }
4169
+ if (!world.metadata.ownership ||
4170
+ typeof world.metadata.ownership !== "object" ||
4171
+ world.metadata.ownership.ownerId !== userId) {
4172
+ world.metadata.ownership = { ownerId: userId };
4173
+ needsUpdate = true;
4174
+ }
4175
+ if (needsUpdate) {
4176
+ await runtime.updateWorld(world);
4177
+ }
4178
+ }
4179
+ }
4180
+ catch (err) {
4181
+ logger.warn(`[eliza] Could not establish chat room, retrying with fresh IDs: ${formatError(err)}`);
4182
+ // Fall back to unique IDs if deterministic ones conflict with stale data.
4183
+ // IMPORTANT: reassign roomId so the message loop below uses the same room.
4184
+ roomId = crypto.randomUUID();
4185
+ const freshWorldId = crypto.randomUUID();
4186
+ const freshServerId = crypto.randomUUID();
4187
+ try {
4188
+ await runtime.ensureConnection({
4189
+ entityId: userId,
4190
+ roomId,
4191
+ worldId: freshWorldId,
4192
+ userName: "User",
4193
+ source: "cli",
4194
+ channelId: `${agentName}-chat`,
4195
+ type: ChannelType.DM,
4196
+ messageServerId: freshServerId,
4197
+ metadata: { ownership: { ownerId: userId } },
4198
+ });
4199
+ // Same ownership metadata fix for the fallback world.
4200
+ const fallbackWorld = await runtime.getWorld(freshWorldId);
4201
+ if (fallbackWorld) {
4202
+ let needsUpdate = false;
4203
+ if (!fallbackWorld.metadata) {
4204
+ fallbackWorld.metadata = {};
4205
+ needsUpdate = true;
4206
+ }
4207
+ if (!fallbackWorld.metadata.ownership ||
4208
+ typeof fallbackWorld.metadata.ownership !== "object" ||
4209
+ fallbackWorld.metadata.ownership.ownerId !==
4210
+ userId) {
4211
+ fallbackWorld.metadata.ownership = { ownerId: userId };
4212
+ needsUpdate = true;
4213
+ }
4214
+ if (needsUpdate) {
4215
+ await runtime.updateWorld(fallbackWorld);
4216
+ }
4217
+ }
4218
+ }
4219
+ catch (retryErr) {
4220
+ logger.error(`[eliza] Chat room setup failed after retry: ${formatError(retryErr)}`);
4221
+ throw retryErr;
4222
+ }
4223
+ }
4224
+ const rl = readline.createInterface({
4225
+ input: process.stdin,
4226
+ output: process.stdout,
4227
+ });
4228
+ console.log(`\n💬 Chat with ${agentName} (type 'exit' to quit)\n`);
4229
+ const prompt = () => {
4230
+ rl.question("You: ", async (input) => {
4231
+ const text = input.trim();
4232
+ if (text.toLowerCase() === "exit" || text.toLowerCase() === "quit") {
4233
+ console.log("\nGoodbye!");
4234
+ rl.close();
4235
+ try {
4236
+ await shutdownRuntime(runtime, "cli shutdown");
4237
+ }
4238
+ catch (err) {
4239
+ logger.warn(`[eliza] Error stopping runtime: ${formatError(err)}`);
4240
+ }
4241
+ process.exit(0);
4242
+ }
4243
+ if (!text) {
4244
+ prompt();
4245
+ return;
4246
+ }
4247
+ try {
4248
+ const message = createMessageMemory({
4249
+ id: crypto.randomUUID(),
4250
+ entityId: userId,
4251
+ roomId,
4252
+ content: {
4253
+ text,
4254
+ source: "client_chat",
4255
+ channelType: ChannelType.DM,
4256
+ },
4257
+ });
4258
+ process.stdout.write(`${agentName}: `);
4259
+ if (!runtime.messageService) {
4260
+ logger.error("[eliza] runtime.messageService is not available — cannot process messages");
4261
+ process.stdout.write("[Error: message service unavailable]\n\n");
4262
+ prompt();
4263
+ return;
4264
+ }
4265
+ await runtime.messageService.handleMessage(runtime, message, async (content) => {
4266
+ if (content?.text) {
4267
+ process.stdout.write(content.text);
4268
+ }
4269
+ return [];
4270
+ });
4271
+ process.stdout.write("\n\n");
4272
+ }
4273
+ catch (err) {
4274
+ // Log the error and continue the prompt loop — don't let a single
4275
+ // failed message kill the interactive session.
4276
+ logger.error(`[eliza] Chat message handling failed: ${formatError(err)}`);
4277
+ process.stdout.write(`\n[Error: ${formatError(err)}]\n\n`);
4278
+ }
4279
+ prompt();
4280
+ });
4281
+ };
4282
+ prompt();
4283
+ }
4284
+ export async function startInCloudMode(config, agentId, opts) {
4285
+ // Cloud mode does not run a local AgentRuntime, but the registry must still
4286
+ // be populated for any code path that touches `STATIC_ELIZA_PLUGINS` while
4287
+ // the cloud proxy is active. A cloud-hosted agent never uses the on-device
4288
+ // inference stack, so register only the SQL registry entry and skip
4289
+ // `@elizaos/plugin-local-inference` (model/embedding/voice warmup, bun:ffi
4290
+ // dylib) — it would only add first-paint latency for a remote agent.
4291
+ await ensureCloudCoreStaticPluginsRegistered();
4292
+ const { CloudManager } = await import(
4293
+ /* @vite-ignore */ "@elizaos/plugin-elizacloud");
4294
+ const cloudConfig = config.cloud;
4295
+ if (!cloudConfig) {
4296
+ throw new Error("Cloud mode requires a cloud configuration block in the config");
4297
+ }
4298
+ logger.info(`[eliza] Starting in cloud mode (agentId=${agentId}, baseUrl=${cloudConfig.baseUrl ?? "(default)"})`);
4299
+ const manager = new CloudManager(cloudConfig, {
4300
+ onStatusChange: (status) => {
4301
+ logger.info(`[eliza] Cloud connection: ${status}`);
4302
+ },
4303
+ });
4304
+ try {
4305
+ await manager.init();
4306
+ const proxy = (await manager.connect(agentId));
4307
+ if (opts?.headless || opts?.serverOnly) {
4308
+ // In headless/server mode, start the API server with the cloud proxy.
4309
+ // The proxy exposes the same interface the API server needs.
4310
+ logger.info(`[eliza] Cloud agent connected (headless). Agent: ${proxy.agentName}`);
4311
+ // Return undefined here; GUI cloud mode is handled through the
4312
+ // dedicated cloud proxy routes instead of a local AgentRuntime.
4313
+ return undefined;
4314
+ }
4315
+ // Interactive CLI mode — simple chat loop against the cloud agent
4316
+ console.log(`\n☁️ Connected to cloud agent "${proxy.agentName}" (${agentId})\n`);
4317
+ console.log("Type a message to chat, or Ctrl+C to quit.\n");
4318
+ const rl = (await import("node:readline")).createInterface({
4319
+ input: process.stdin,
4320
+ output: process.stdout,
4321
+ });
4322
+ const prompt = () => {
4323
+ rl.question("You: ", async (input) => {
4324
+ const text = input.trim();
4325
+ if (!text) {
4326
+ prompt();
4327
+ return;
4328
+ }
4329
+ try {
4330
+ // Use streaming if available
4331
+ let response = "";
4332
+ process.stdout.write(`${proxy.agentName}: `);
4333
+ for await (const chunk of proxy.handleChatMessageStream(text)) {
4334
+ process.stdout.write(chunk);
4335
+ response += chunk;
4336
+ }
4337
+ if (!response) {
4338
+ // Fallback to non-streaming
4339
+ response = await proxy.handleChatMessage(text);
4340
+ process.stdout.write(response);
4341
+ }
4342
+ process.stdout.write("\n\n");
4343
+ }
4344
+ catch (err) {
4345
+ const msg = err instanceof Error ? err.message : String(err);
4346
+ process.stdout.write(`\n[error] ${msg}\n\n`);
4347
+ }
4348
+ prompt();
4349
+ });
4350
+ };
4351
+ rl.on("close", async () => {
4352
+ process.stdout.write("\nDisconnecting from cloud agent...\n");
4353
+ await manager.disconnect();
4354
+ process.exit(0);
4355
+ });
4356
+ prompt();
4357
+ // Keep the process alive
4358
+ return undefined;
4359
+ }
4360
+ catch (err) {
4361
+ const msg = err instanceof Error ? err.message : String(err);
4362
+ logger.error(`[eliza] Failed to connect to cloud agent: ${msg}`);
4363
+ throw new Error(`Failed to connect to cloud agent: ${msg}\n` +
4364
+ "You can retry with `eliza start`, or switch to local mode by setting `deploymentTarget.runtime` to `local`");
4365
+ }
4366
+ }
4367
+ const isDirectRun = (() => {
4368
+ // Mobile (bundled) builds set ELIZA_DISABLE_DIRECT_RUN=1 via Bun's
4369
+ // `--define`. After bundling, `import.meta.url` and `process.argv[1]`
4370
+ // collapse to the same bundle path, so this check spuriously matches and
4371
+ // the runtime self-invokes a SECOND `startEliza()` alongside the CLI's
4372
+ // primary one. The second invocation lacks `{ serverOnly: true }` and
4373
+ // drops into the readline chat loop, which closes on stdin EOF and tears
4374
+ // the whole process down.
4375
+ if (globalThis
4376
+ .__ELIZA_MOBILE_BUNDLE__ === true ||
4377
+ globalThis
4378
+ .__ELIZA_DISABLE_DIRECT_RUN === true ||
4379
+ process.argv.includes("ios-bridge") ||
4380
+ process.env.ELIZA_DISABLE_DIRECT_RUN === "1") {
4381
+ return false;
4382
+ }
4383
+ const scriptArg = process.argv[1];
4384
+ if (!scriptArg)
4385
+ return false;
4386
+ const normalised = path.resolve(scriptArg);
4387
+ return import.meta.url === pathToFileURL(normalised).href;
4388
+ })();
4389
+ if (isDirectRun) {
4390
+ startEliza().catch((err) => {
4391
+ console.error("[eliza] Fatal error:", err instanceof Error ? (err.stack ?? err.message) : err);
4392
+ process.exit(1);
4393
+ });
4394
+ }