@elizaos/agent 2.0.0-beta.1 → 2.0.11-beta.5

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