@elizaos/autonomous 2.0.0-alpha.71 → 2.0.0-alpha.72

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 (1918) hide show
  1. package/package.json +910 -201
  2. package/packages/autonomous/src/actions/emote.d.ts +14 -0
  3. package/packages/autonomous/src/actions/emote.d.ts.map +1 -0
  4. package/packages/autonomous/src/actions/emote.js +91 -0
  5. package/packages/autonomous/src/actions/restart.d.ts +19 -0
  6. package/packages/autonomous/src/actions/restart.d.ts.map +1 -0
  7. package/packages/autonomous/src/actions/restart.js +86 -0
  8. package/packages/autonomous/src/actions/send-message.d.ts +3 -0
  9. package/packages/autonomous/src/actions/send-message.d.ts.map +1 -0
  10. package/packages/autonomous/src/actions/send-message.js +144 -0
  11. package/packages/autonomous/src/actions/stream-control.d.ts +15 -0
  12. package/packages/autonomous/src/actions/stream-control.d.ts.map +1 -0
  13. package/packages/autonomous/src/actions/stream-control.js +357 -0
  14. package/packages/autonomous/src/actions/switch-stream-source.d.ts +16 -0
  15. package/packages/autonomous/src/actions/switch-stream-source.d.ts.map +1 -0
  16. package/packages/autonomous/src/actions/switch-stream-source.js +94 -0
  17. package/packages/autonomous/src/actions/terminal.d.ts +14 -0
  18. package/packages/autonomous/src/actions/terminal.d.ts.map +1 -0
  19. package/packages/autonomous/src/actions/terminal.js +154 -0
  20. package/packages/autonomous/src/api/agent-admin-routes.d.ts +38 -0
  21. package/packages/autonomous/src/api/agent-admin-routes.d.ts.map +1 -0
  22. package/packages/autonomous/src/api/agent-admin-routes.js +93 -0
  23. package/packages/autonomous/src/api/agent-lifecycle-routes.d.ts +16 -0
  24. package/packages/autonomous/src/api/agent-lifecycle-routes.d.ts.map +1 -0
  25. package/packages/autonomous/src/api/agent-lifecycle-routes.js +80 -0
  26. package/packages/autonomous/src/api/agent-model.d.ts +12 -0
  27. package/packages/autonomous/src/api/agent-model.d.ts.map +1 -0
  28. package/packages/autonomous/src/api/agent-model.js +123 -0
  29. package/packages/autonomous/src/api/agent-transfer-routes.d.ts +16 -0
  30. package/packages/autonomous/src/api/agent-transfer-routes.d.ts.map +1 -0
  31. package/packages/autonomous/src/api/agent-transfer-routes.js +124 -0
  32. package/packages/autonomous/src/api/apps-routes.d.ts +19 -0
  33. package/packages/autonomous/src/api/apps-routes.d.ts.map +1 -0
  34. package/packages/autonomous/src/api/apps-routes.js +128 -0
  35. package/packages/autonomous/src/api/auth-routes.d.ts +11 -0
  36. package/packages/autonomous/src/api/auth-routes.d.ts.map +1 -0
  37. package/packages/autonomous/src/api/auth-routes.js +54 -0
  38. package/packages/autonomous/src/api/bsc-trade.d.ts +34 -0
  39. package/packages/autonomous/src/api/bsc-trade.d.ts.map +1 -0
  40. package/packages/autonomous/src/api/bsc-trade.js +567 -0
  41. package/packages/autonomous/src/api/bug-report-routes.d.ts +7 -0
  42. package/packages/autonomous/src/api/bug-report-routes.d.ts.map +1 -0
  43. package/packages/autonomous/src/api/bug-report-routes.js +124 -0
  44. package/packages/autonomous/src/api/character-routes.d.ts +50 -0
  45. package/packages/autonomous/src/api/character-routes.d.ts.map +1 -0
  46. package/packages/autonomous/src/api/character-routes.js +302 -0
  47. package/packages/autonomous/src/api/cloud-billing-routes.d.ts +14 -0
  48. package/packages/autonomous/src/api/cloud-billing-routes.d.ts.map +1 -0
  49. package/packages/autonomous/src/api/cloud-billing-routes.js +400 -0
  50. package/packages/autonomous/src/api/cloud-compat-routes.d.ts +15 -0
  51. package/packages/autonomous/src/api/cloud-compat-routes.d.ts.map +1 -0
  52. package/packages/autonomous/src/api/cloud-compat-routes.js +131 -0
  53. package/packages/autonomous/src/api/cloud-routes.d.ts +62 -0
  54. package/packages/autonomous/src/api/cloud-routes.d.ts.map +1 -0
  55. package/packages/autonomous/src/api/cloud-routes.js +339 -0
  56. package/packages/autonomous/src/api/cloud-status-routes.d.ts +15 -0
  57. package/packages/autonomous/src/api/cloud-status-routes.d.ts.map +1 -0
  58. package/packages/autonomous/src/api/cloud-status-routes.js +165 -0
  59. package/packages/autonomous/src/api/compat-utils.d.ts +49 -0
  60. package/packages/autonomous/src/api/compat-utils.d.ts.map +1 -0
  61. package/packages/autonomous/src/api/compat-utils.js +126 -0
  62. package/packages/autonomous/src/api/connector-health.d.ts +34 -0
  63. package/packages/autonomous/src/api/connector-health.d.ts.map +1 -0
  64. package/packages/autonomous/src/api/connector-health.js +109 -0
  65. package/packages/autonomous/src/api/coordinator-wiring.d.ts +46 -0
  66. package/packages/autonomous/src/api/coordinator-wiring.d.ts.map +1 -0
  67. package/packages/autonomous/src/api/coordinator-wiring.js +101 -0
  68. package/packages/autonomous/src/api/credit-detection.d.ts +9 -0
  69. package/packages/autonomous/src/api/credit-detection.d.ts.map +1 -0
  70. package/packages/autonomous/src/api/credit-detection.js +41 -0
  71. package/packages/autonomous/src/api/database.d.ts +33 -0
  72. package/packages/autonomous/src/api/database.d.ts.map +1 -0
  73. package/packages/autonomous/src/api/database.js +1019 -0
  74. package/packages/autonomous/src/api/diagnostics-routes.d.ts +46 -0
  75. package/packages/autonomous/src/api/diagnostics-routes.d.ts.map +1 -0
  76. package/packages/autonomous/src/api/diagnostics-routes.js +241 -0
  77. package/packages/autonomous/src/api/drop-service.d.ts +26 -0
  78. package/packages/autonomous/src/api/drop-service.d.ts.map +1 -0
  79. package/packages/autonomous/src/api/drop-service.js +134 -0
  80. package/packages/autonomous/src/api/early-logs.d.ts +29 -0
  81. package/packages/autonomous/src/api/early-logs.d.ts.map +1 -0
  82. package/packages/autonomous/src/api/early-logs.js +96 -0
  83. package/packages/autonomous/src/api/http-helpers.d.ts +50 -0
  84. package/packages/autonomous/src/api/http-helpers.d.ts.map +1 -0
  85. package/packages/autonomous/src/api/http-helpers.js +145 -0
  86. package/packages/autonomous/src/api/index.d.ts +62 -0
  87. package/packages/autonomous/src/api/index.d.ts.map +1 -0
  88. package/packages/autonomous/src/api/index.js +60 -0
  89. package/packages/autonomous/src/api/knowledge-routes.d.ts +23 -0
  90. package/packages/autonomous/src/api/knowledge-routes.d.ts.map +1 -0
  91. package/packages/autonomous/src/api/knowledge-routes.js +887 -0
  92. package/packages/autonomous/src/api/knowledge-service-loader.d.ts +51 -0
  93. package/packages/autonomous/src/api/knowledge-service-loader.d.ts.map +1 -0
  94. package/packages/autonomous/src/api/knowledge-service-loader.js +34 -0
  95. package/packages/autonomous/src/api/memory-bounds.d.ts +51 -0
  96. package/packages/autonomous/src/api/memory-bounds.d.ts.map +1 -0
  97. package/packages/autonomous/src/api/memory-bounds.js +81 -0
  98. package/packages/autonomous/src/api/memory-routes.d.ts +9 -0
  99. package/packages/autonomous/src/api/memory-routes.d.ts.map +1 -0
  100. package/packages/autonomous/src/api/memory-routes.js +241 -0
  101. package/packages/autonomous/src/api/merkle-tree.d.ts +90 -0
  102. package/packages/autonomous/src/api/merkle-tree.d.ts.map +1 -0
  103. package/packages/autonomous/src/api/merkle-tree.js +174 -0
  104. package/packages/autonomous/src/api/models-routes.d.ts +14 -0
  105. package/packages/autonomous/src/api/models-routes.d.ts.map +1 -0
  106. package/packages/autonomous/src/api/models-routes.js +37 -0
  107. package/packages/autonomous/src/api/nfa-routes.d.ts +5 -0
  108. package/packages/autonomous/src/api/nfa-routes.d.ts.map +1 -0
  109. package/packages/autonomous/src/api/nfa-routes.js +125 -0
  110. package/packages/autonomous/src/api/nft-verify.d.ts +35 -0
  111. package/packages/autonomous/src/api/nft-verify.d.ts.map +1 -0
  112. package/packages/autonomous/src/api/nft-verify.js +130 -0
  113. package/packages/autonomous/src/api/og-tracker.d.ts +28 -0
  114. package/packages/autonomous/src/api/og-tracker.d.ts.map +1 -0
  115. package/packages/autonomous/src/api/og-tracker.js +60 -0
  116. package/packages/autonomous/src/api/parse-action-block.d.ts +36 -0
  117. package/packages/autonomous/src/api/parse-action-block.d.ts.map +1 -0
  118. package/packages/autonomous/src/api/parse-action-block.js +110 -0
  119. package/packages/autonomous/src/api/permissions-routes.d.ts +32 -0
  120. package/packages/autonomous/src/api/permissions-routes.d.ts.map +1 -0
  121. package/packages/autonomous/src/api/permissions-routes.js +149 -0
  122. package/packages/autonomous/src/api/plugin-validation.d.ts +86 -0
  123. package/packages/autonomous/src/api/plugin-validation.d.ts.map +1 -0
  124. package/packages/autonomous/src/api/plugin-validation.js +259 -0
  125. package/packages/autonomous/src/api/provider-switch-config.d.ts +37 -0
  126. package/packages/autonomous/src/api/provider-switch-config.d.ts.map +1 -0
  127. package/packages/autonomous/src/api/provider-switch-config.js +317 -0
  128. package/packages/autonomous/src/api/registry-routes.d.ts +26 -0
  129. package/packages/autonomous/src/api/registry-routes.d.ts.map +1 -0
  130. package/packages/autonomous/src/api/registry-routes.js +90 -0
  131. package/packages/autonomous/src/api/registry-service.d.ts +77 -0
  132. package/packages/autonomous/src/api/registry-service.d.ts.map +1 -0
  133. package/packages/autonomous/src/api/registry-service.js +190 -0
  134. package/packages/autonomous/src/api/route-helpers.d.ts +16 -0
  135. package/packages/autonomous/src/api/route-helpers.d.ts.map +1 -0
  136. package/packages/autonomous/src/api/route-helpers.js +1 -0
  137. package/packages/autonomous/src/api/sandbox-routes.d.ts +12 -0
  138. package/packages/autonomous/src/api/sandbox-routes.d.ts.map +1 -0
  139. package/packages/autonomous/src/api/sandbox-routes.js +1334 -0
  140. package/packages/autonomous/src/api/server.d.ts +418 -0
  141. package/packages/autonomous/src/api/server.d.ts.map +1 -0
  142. package/packages/autonomous/src/api/server.js +13564 -0
  143. package/packages/autonomous/src/api/signal-routes.d.ts +39 -0
  144. package/packages/autonomous/src/api/signal-routes.d.ts.map +1 -0
  145. package/packages/autonomous/src/api/signal-routes.js +168 -0
  146. package/packages/autonomous/src/api/stream-persistence.d.ts +64 -0
  147. package/packages/autonomous/src/api/stream-persistence.d.ts.map +1 -0
  148. package/packages/autonomous/src/api/stream-persistence.js +231 -0
  149. package/packages/autonomous/src/api/stream-route-state.d.ts +50 -0
  150. package/packages/autonomous/src/api/stream-route-state.d.ts.map +1 -0
  151. package/packages/autonomous/src/api/stream-route-state.js +1 -0
  152. package/packages/autonomous/src/api/stream-routes.d.ts +45 -0
  153. package/packages/autonomous/src/api/stream-routes.d.ts.map +1 -0
  154. package/packages/autonomous/src/api/stream-routes.js +809 -0
  155. package/packages/autonomous/src/api/stream-voice-routes.d.ts +36 -0
  156. package/packages/autonomous/src/api/stream-voice-routes.d.ts.map +1 -0
  157. package/packages/autonomous/src/api/stream-voice-routes.js +133 -0
  158. package/packages/autonomous/src/api/streaming-text.d.ts +9 -0
  159. package/packages/autonomous/src/api/streaming-text.d.ts.map +1 -0
  160. package/packages/autonomous/src/api/streaming-text.js +85 -0
  161. package/packages/autonomous/src/api/streaming-types.d.ts +30 -0
  162. package/packages/autonomous/src/api/streaming-types.d.ts.map +1 -0
  163. package/packages/autonomous/src/api/streaming-types.js +1 -0
  164. package/packages/autonomous/src/api/subscription-routes.d.ts +20 -0
  165. package/packages/autonomous/src/api/subscription-routes.d.ts.map +1 -0
  166. package/packages/autonomous/src/api/subscription-routes.js +191 -0
  167. package/packages/autonomous/src/api/terminal-run-limits.d.ts +5 -0
  168. package/packages/autonomous/src/api/terminal-run-limits.d.ts.map +1 -0
  169. package/packages/autonomous/src/api/terminal-run-limits.js +22 -0
  170. package/packages/autonomous/src/api/training-backend-check.d.ts +8 -0
  171. package/packages/autonomous/src/api/training-backend-check.d.ts.map +1 -0
  172. package/packages/autonomous/src/api/training-backend-check.js +28 -0
  173. package/packages/autonomous/src/api/training-routes.d.ts +44 -0
  174. package/packages/autonomous/src/api/training-routes.d.ts.map +1 -0
  175. package/packages/autonomous/src/api/training-routes.js +195 -0
  176. package/packages/autonomous/src/api/training-service-like.d.ts +38 -0
  177. package/packages/autonomous/src/api/training-service-like.d.ts.map +1 -0
  178. package/packages/autonomous/src/api/training-service-like.js +1 -0
  179. package/packages/autonomous/src/api/trajectory-routes.d.ts +17 -0
  180. package/packages/autonomous/src/api/trajectory-routes.d.ts.map +1 -0
  181. package/packages/autonomous/src/api/trajectory-routes.js +377 -0
  182. package/packages/autonomous/src/api/trigger-routes.d.ts +72 -0
  183. package/packages/autonomous/src/api/trigger-routes.d.ts.map +1 -0
  184. package/packages/autonomous/src/api/trigger-routes.js +268 -0
  185. package/packages/autonomous/src/api/twitter-verify.d.ts +25 -0
  186. package/packages/autonomous/src/api/twitter-verify.d.ts.map +1 -0
  187. package/packages/autonomous/src/api/twitter-verify.js +168 -0
  188. package/packages/autonomous/src/api/tx-service.d.ts +47 -0
  189. package/packages/autonomous/src/api/tx-service.d.ts.map +1 -0
  190. package/packages/autonomous/src/api/tx-service.js +156 -0
  191. package/packages/autonomous/src/api/wallet-dex-prices.d.ts +43 -0
  192. package/packages/autonomous/src/api/wallet-dex-prices.d.ts.map +1 -0
  193. package/packages/autonomous/src/api/wallet-dex-prices.js +149 -0
  194. package/packages/autonomous/src/api/wallet-evm-balance.d.ts +65 -0
  195. package/packages/autonomous/src/api/wallet-evm-balance.d.ts.map +1 -0
  196. package/packages/autonomous/src/api/wallet-evm-balance.js +663 -0
  197. package/packages/autonomous/src/api/wallet-routes.d.ts +35 -0
  198. package/packages/autonomous/src/api/wallet-routes.d.ts.map +1 -0
  199. package/packages/autonomous/src/api/wallet-routes.js +349 -0
  200. package/packages/autonomous/src/api/wallet-rpc.d.ts +61 -0
  201. package/packages/autonomous/src/api/wallet-rpc.d.ts.map +1 -0
  202. package/packages/autonomous/src/api/wallet-rpc.js +367 -0
  203. package/packages/autonomous/src/api/wallet-trading-profile.d.ts +51 -0
  204. package/packages/autonomous/src/api/wallet-trading-profile.d.ts.map +1 -0
  205. package/packages/autonomous/src/api/wallet-trading-profile.js +547 -0
  206. package/packages/autonomous/src/api/wallet.d.ts +32 -0
  207. package/packages/autonomous/src/api/wallet.d.ts.map +1 -0
  208. package/packages/autonomous/src/api/wallet.js +553 -0
  209. package/packages/autonomous/src/api/whatsapp-routes.d.ts +39 -0
  210. package/packages/autonomous/src/api/whatsapp-routes.d.ts.map +1 -0
  211. package/packages/autonomous/src/api/whatsapp-routes.js +182 -0
  212. package/packages/autonomous/src/api/zip-utils.d.ts +8 -0
  213. package/packages/autonomous/src/api/zip-utils.d.ts.map +1 -0
  214. package/packages/autonomous/src/api/zip-utils.js +115 -0
  215. package/packages/autonomous/src/auth/anthropic.d.ts +25 -0
  216. package/packages/autonomous/src/auth/anthropic.d.ts.map +1 -0
  217. package/packages/autonomous/src/auth/anthropic.js +40 -0
  218. package/packages/autonomous/src/auth/apply-stealth.d.ts +8 -0
  219. package/packages/autonomous/src/auth/apply-stealth.d.ts.map +1 -0
  220. package/packages/autonomous/src/auth/apply-stealth.js +35 -0
  221. package/packages/autonomous/src/auth/claude-code-stealth.d.ts +2 -0
  222. package/packages/autonomous/src/auth/claude-code-stealth.d.ts.map +1 -0
  223. package/packages/autonomous/src/auth/claude-code-stealth.js +104 -0
  224. package/packages/autonomous/src/auth/credentials.d.ts +55 -0
  225. package/packages/autonomous/src/auth/credentials.d.ts.map +1 -0
  226. package/packages/autonomous/src/auth/credentials.js +182 -0
  227. package/packages/autonomous/src/auth/index.d.ts +7 -0
  228. package/packages/autonomous/src/auth/index.d.ts.map +1 -0
  229. package/packages/autonomous/src/auth/index.js +3 -0
  230. package/packages/autonomous/src/auth/openai-codex.d.ts +27 -0
  231. package/packages/autonomous/src/auth/openai-codex.d.ts.map +1 -0
  232. package/packages/autonomous/src/auth/openai-codex.js +72 -0
  233. package/packages/autonomous/src/auth/types.d.ts +18 -0
  234. package/packages/autonomous/src/auth/types.d.ts.map +1 -0
  235. package/packages/autonomous/src/auth/types.js +8 -0
  236. package/packages/autonomous/src/awareness/registry.d.ts +27 -0
  237. package/packages/autonomous/src/awareness/registry.d.ts.map +1 -0
  238. package/packages/autonomous/src/awareness/registry.js +161 -0
  239. package/packages/autonomous/src/benchmark-server.d.ts +2 -0
  240. package/packages/autonomous/src/benchmark-server.d.ts.map +1 -0
  241. package/packages/autonomous/src/benchmark-server.js +773 -0
  242. package/packages/autonomous/src/bin.d.ts +3 -0
  243. package/packages/autonomous/src/bin.d.ts.map +1 -0
  244. package/packages/autonomous/src/bin.js +6 -0
  245. package/packages/autonomous/src/cli/index.d.ts +2 -0
  246. package/packages/autonomous/src/cli/index.d.ts.map +1 -0
  247. package/packages/autonomous/src/cli/index.js +40 -0
  248. package/packages/autonomous/src/cli/parse-duration.d.ts +5 -0
  249. package/packages/autonomous/src/cli/parse-duration.d.ts.map +1 -0
  250. package/packages/autonomous/src/cli/parse-duration.js +27 -0
  251. package/packages/autonomous/src/cloud/auth.d.ts +19 -0
  252. package/packages/autonomous/src/cloud/auth.d.ts.map +1 -0
  253. package/packages/autonomous/src/cloud/auth.js +107 -0
  254. package/packages/autonomous/src/cloud/backup.d.ts +18 -0
  255. package/packages/autonomous/src/cloud/backup.d.ts.map +1 -0
  256. package/packages/autonomous/src/cloud/backup.js +42 -0
  257. package/packages/autonomous/src/cloud/base-url.d.ts +3 -0
  258. package/packages/autonomous/src/cloud/base-url.d.ts.map +1 -0
  259. package/packages/autonomous/src/cloud/base-url.js +40 -0
  260. package/packages/autonomous/src/cloud/bridge-client.d.ts +56 -0
  261. package/packages/autonomous/src/cloud/bridge-client.d.ts.map +1 -0
  262. package/packages/autonomous/src/cloud/bridge-client.js +190 -0
  263. package/packages/autonomous/src/cloud/cloud-manager.d.ts +32 -0
  264. package/packages/autonomous/src/cloud/cloud-manager.d.ts.map +1 -0
  265. package/packages/autonomous/src/cloud/cloud-manager.js +119 -0
  266. package/packages/autonomous/src/cloud/cloud-proxy.d.ts +20 -0
  267. package/packages/autonomous/src/cloud/cloud-proxy.d.ts.map +1 -0
  268. package/packages/autonomous/src/cloud/cloud-proxy.js +34 -0
  269. package/packages/autonomous/src/cloud/index.d.ts +7 -0
  270. package/packages/autonomous/src/cloud/index.d.ts.map +1 -0
  271. package/packages/autonomous/src/cloud/index.js +6 -0
  272. package/packages/autonomous/src/cloud/reconnect.d.ts +26 -0
  273. package/packages/autonomous/src/cloud/reconnect.d.ts.map +1 -0
  274. package/packages/autonomous/src/cloud/reconnect.js +86 -0
  275. package/packages/autonomous/src/cloud/validate-url.d.ts +2 -0
  276. package/packages/autonomous/src/cloud/validate-url.d.ts.map +1 -0
  277. package/packages/autonomous/src/cloud/validate-url.js +162 -0
  278. package/packages/autonomous/src/config/character-schema.d.ts +25 -0
  279. package/packages/autonomous/src/config/character-schema.d.ts.map +1 -0
  280. package/packages/autonomous/src/config/character-schema.js +39 -0
  281. package/packages/autonomous/src/config/config.d.ts +6 -0
  282. package/packages/autonomous/src/config/config.d.ts.map +1 -0
  283. package/packages/autonomous/src/config/config.js +118 -0
  284. package/packages/autonomous/src/config/env-vars.d.ts +3 -0
  285. package/packages/autonomous/src/config/env-vars.d.ts.map +1 -0
  286. package/packages/autonomous/src/config/env-vars.js +76 -0
  287. package/packages/autonomous/src/config/includes.d.ts +26 -0
  288. package/packages/autonomous/src/config/includes.d.ts.map +1 -0
  289. package/packages/autonomous/src/config/includes.js +148 -0
  290. package/packages/autonomous/src/config/index.d.ts +16 -0
  291. package/packages/autonomous/src/config/index.d.ts.map +1 -0
  292. package/packages/autonomous/src/config/object-utils.d.ts +2 -0
  293. package/packages/autonomous/src/config/object-utils.d.ts.map +1 -0
  294. package/packages/autonomous/src/config/object-utils.js +6 -0
  295. package/packages/autonomous/src/config/paths.d.ts +13 -0
  296. package/packages/autonomous/src/config/paths.d.ts.map +1 -0
  297. package/packages/autonomous/src/config/paths.js +67 -0
  298. package/packages/autonomous/src/config/plugin-auto-enable.d.ts +16 -0
  299. package/packages/autonomous/src/config/plugin-auto-enable.d.ts.map +1 -0
  300. package/packages/autonomous/src/config/plugin-auto-enable.js +384 -0
  301. package/packages/autonomous/src/config/schema.d.ts +87 -0
  302. package/packages/autonomous/src/config/schema.d.ts.map +1 -0
  303. package/packages/autonomous/src/config/schema.js +928 -0
  304. package/packages/autonomous/src/config/telegram-custom-commands.d.ts +25 -0
  305. package/packages/autonomous/src/config/telegram-custom-commands.d.ts.map +1 -0
  306. package/packages/autonomous/src/config/telegram-custom-commands.js +71 -0
  307. package/packages/autonomous/src/config/types.agent-defaults.d.ts +331 -0
  308. package/packages/autonomous/src/config/types.agent-defaults.d.ts.map +1 -0
  309. package/packages/autonomous/src/config/types.agent-defaults.js +1 -0
  310. package/packages/autonomous/src/config/types.agents.d.ts +110 -0
  311. package/packages/autonomous/src/config/types.agents.d.ts.map +1 -0
  312. package/packages/autonomous/src/config/types.agents.js +1 -0
  313. package/packages/autonomous/src/config/types.d.ts +8 -0
  314. package/packages/autonomous/src/config/types.d.ts.map +1 -0
  315. package/packages/autonomous/src/config/types.eliza.d.ts +636 -0
  316. package/packages/autonomous/src/config/types.eliza.d.ts.map +1 -0
  317. package/packages/autonomous/src/config/types.eliza.js +1 -0
  318. package/packages/autonomous/src/config/types.gateway.d.ts +216 -0
  319. package/packages/autonomous/src/config/types.gateway.d.ts.map +1 -0
  320. package/packages/autonomous/src/config/types.gateway.js +1 -0
  321. package/packages/autonomous/src/config/types.hooks.d.ts +107 -0
  322. package/packages/autonomous/src/config/types.hooks.d.ts.map +1 -0
  323. package/packages/autonomous/src/config/types.hooks.js +1 -0
  324. package/packages/autonomous/src/config/types.messages.d.ts +176 -0
  325. package/packages/autonomous/src/config/types.messages.d.ts.map +1 -0
  326. package/packages/autonomous/src/config/types.messages.js +1 -0
  327. package/packages/autonomous/src/config/types.tools.d.ts +400 -0
  328. package/packages/autonomous/src/config/types.tools.d.ts.map +1 -0
  329. package/packages/autonomous/src/config/types.tools.js +1 -0
  330. package/packages/autonomous/src/config/zod-schema.agent-runtime.d.ts +1062 -0
  331. package/packages/autonomous/src/config/zod-schema.agent-runtime.d.ts.map +1 -0
  332. package/packages/autonomous/src/config/zod-schema.agent-runtime.js +721 -0
  333. package/packages/autonomous/src/config/zod-schema.core.d.ts +1021 -0
  334. package/packages/autonomous/src/config/zod-schema.core.d.ts.map +1 -0
  335. package/packages/autonomous/src/config/zod-schema.core.js +694 -0
  336. package/packages/autonomous/src/config/zod-schema.d.ts +4817 -0
  337. package/packages/autonomous/src/config/zod-schema.d.ts.map +1 -0
  338. package/packages/autonomous/src/config/zod-schema.hooks.d.ts +88 -0
  339. package/packages/autonomous/src/config/zod-schema.hooks.d.ts.map +1 -0
  340. package/packages/autonomous/src/config/zod-schema.hooks.js +133 -0
  341. package/packages/autonomous/src/config/zod-schema.js +778 -0
  342. package/packages/autonomous/src/config/zod-schema.providers-core.d.ts +2976 -0
  343. package/packages/autonomous/src/config/zod-schema.providers-core.d.ts.map +1 -0
  344. package/packages/autonomous/src/config/zod-schema.providers-core.js +1006 -0
  345. package/packages/autonomous/src/config/zod-schema.session.d.ts +183 -0
  346. package/packages/autonomous/src/config/zod-schema.session.d.ts.map +1 -0
  347. package/packages/autonomous/src/config/zod-schema.session.js +86 -0
  348. package/packages/autonomous/src/contracts/apps.d.ts +42 -0
  349. package/packages/autonomous/src/contracts/apps.d.ts.map +1 -0
  350. package/packages/autonomous/src/contracts/apps.js +4 -0
  351. package/packages/autonomous/src/contracts/awareness.d.ts +38 -0
  352. package/packages/autonomous/src/contracts/awareness.d.ts.map +1 -0
  353. package/packages/autonomous/src/contracts/awareness.js +7 -0
  354. package/packages/autonomous/src/contracts/config.d.ts +146 -0
  355. package/packages/autonomous/src/contracts/config.d.ts.map +1 -0
  356. package/packages/autonomous/src/contracts/config.js +4 -0
  357. package/packages/autonomous/src/contracts/drop.d.ts +20 -0
  358. package/packages/autonomous/src/contracts/drop.d.ts.map +1 -0
  359. package/packages/autonomous/src/contracts/drop.js +4 -0
  360. package/packages/autonomous/src/contracts/index.d.ts +9 -0
  361. package/packages/autonomous/src/contracts/index.d.ts.map +1 -0
  362. package/packages/autonomous/src/contracts/onboarding.d.ts +379 -0
  363. package/packages/autonomous/src/contracts/onboarding.d.ts.map +1 -0
  364. package/packages/autonomous/src/contracts/onboarding.js +290 -0
  365. package/packages/autonomous/src/contracts/permissions.d.ts +35 -0
  366. package/packages/autonomous/src/contracts/permissions.d.ts.map +1 -0
  367. package/packages/autonomous/src/contracts/permissions.js +4 -0
  368. package/packages/autonomous/src/contracts/verification.d.ts +9 -0
  369. package/packages/autonomous/src/contracts/verification.d.ts.map +1 -0
  370. package/packages/autonomous/src/contracts/verification.js +4 -0
  371. package/packages/autonomous/src/contracts/wallet.d.ts +409 -0
  372. package/packages/autonomous/src/contracts/wallet.d.ts.map +1 -0
  373. package/packages/autonomous/src/contracts/wallet.js +60 -0
  374. package/packages/autonomous/src/diagnostics/integration-observability.d.ts +40 -0
  375. package/packages/autonomous/src/diagnostics/integration-observability.d.ts.map +1 -0
  376. package/packages/autonomous/src/diagnostics/integration-observability.js +68 -0
  377. package/packages/autonomous/src/emotes/catalog.d.ts +31 -0
  378. package/packages/autonomous/src/emotes/catalog.d.ts.map +1 -0
  379. package/packages/autonomous/src/emotes/catalog.js +618 -0
  380. package/packages/autonomous/src/hooks/discovery.d.ts +13 -0
  381. package/packages/autonomous/src/hooks/discovery.d.ts.map +1 -0
  382. package/packages/autonomous/src/hooks/discovery.js +184 -0
  383. package/packages/autonomous/src/hooks/eligibility.d.ts +12 -0
  384. package/packages/autonomous/src/hooks/eligibility.d.ts.map +1 -0
  385. package/packages/autonomous/src/hooks/eligibility.js +100 -0
  386. package/packages/autonomous/src/hooks/index.d.ts +3 -0
  387. package/packages/autonomous/src/hooks/index.d.ts.map +1 -0
  388. package/packages/autonomous/src/hooks/index.js +2 -0
  389. package/packages/autonomous/src/hooks/loader.d.ts +34 -0
  390. package/packages/autonomous/src/hooks/loader.d.ts.map +1 -0
  391. package/packages/autonomous/src/hooks/loader.js +176 -0
  392. package/packages/autonomous/src/hooks/registry.d.ts +11 -0
  393. package/packages/autonomous/src/hooks/registry.d.ts.map +1 -0
  394. package/packages/autonomous/src/hooks/registry.js +58 -0
  395. package/packages/autonomous/src/hooks/types.d.ts +104 -0
  396. package/packages/autonomous/src/hooks/types.d.ts.map +1 -0
  397. package/packages/autonomous/src/hooks/types.js +8 -0
  398. package/packages/autonomous/src/index.d.ts +20 -0
  399. package/packages/autonomous/src/index.d.ts.map +1 -0
  400. package/packages/autonomous/src/onboarding-presets.d.ts +74 -0
  401. package/packages/autonomous/src/onboarding-presets.d.ts.map +1 -0
  402. package/packages/autonomous/src/onboarding-presets.js +1305 -0
  403. package/packages/autonomous/src/plugins/custom-rtmp/index.d.ts +12 -0
  404. package/packages/autonomous/src/plugins/custom-rtmp/index.d.ts.map +1 -0
  405. package/packages/autonomous/src/plugins/custom-rtmp/index.js +26 -0
  406. package/packages/autonomous/src/providers/admin-trust.d.ts +4 -0
  407. package/packages/autonomous/src/providers/admin-trust.d.ts.map +1 -0
  408. package/packages/autonomous/src/providers/admin-trust.js +53 -0
  409. package/packages/autonomous/src/providers/session-bridge.d.ts +24 -0
  410. package/packages/autonomous/src/providers/session-bridge.d.ts.map +1 -0
  411. package/packages/autonomous/src/providers/session-bridge.js +85 -0
  412. package/packages/autonomous/src/providers/session-utils.d.ts +20 -0
  413. package/packages/autonomous/src/providers/session-utils.d.ts.map +1 -0
  414. package/packages/autonomous/src/providers/session-utils.js +33 -0
  415. package/packages/autonomous/src/providers/simple-mode.d.ts +4 -0
  416. package/packages/autonomous/src/providers/simple-mode.d.ts.map +1 -0
  417. package/packages/autonomous/src/providers/simple-mode.js +85 -0
  418. package/packages/autonomous/src/providers/ui-catalog.d.ts +3 -0
  419. package/packages/autonomous/src/providers/ui-catalog.d.ts.map +1 -0
  420. package/packages/autonomous/src/providers/ui-catalog.js +123 -0
  421. package/packages/autonomous/src/providers/workspace-provider.d.ts +22 -0
  422. package/packages/autonomous/src/providers/workspace-provider.d.ts.map +1 -0
  423. package/packages/autonomous/src/providers/workspace-provider.js +167 -0
  424. package/packages/autonomous/src/providers/workspace.d.ts +54 -0
  425. package/packages/autonomous/src/providers/workspace.d.ts.map +1 -0
  426. package/packages/autonomous/src/providers/workspace.js +405 -0
  427. package/packages/autonomous/src/runtime/agent-event-service.d.ts +35 -0
  428. package/packages/autonomous/src/runtime/agent-event-service.d.ts.map +1 -0
  429. package/packages/autonomous/src/runtime/agent-event-service.js +16 -0
  430. package/packages/autonomous/src/runtime/cloud-onboarding.d.ts +55 -0
  431. package/packages/autonomous/src/runtime/cloud-onboarding.d.ts.map +1 -0
  432. package/packages/autonomous/src/runtime/cloud-onboarding.js +279 -0
  433. package/packages/autonomous/src/runtime/core-plugins.d.ts +14 -0
  434. package/packages/autonomous/src/runtime/core-plugins.d.ts.map +1 -0
  435. package/packages/autonomous/src/runtime/core-plugins.js +51 -0
  436. package/packages/autonomous/src/runtime/custom-actions.d.ts +40 -0
  437. package/packages/autonomous/src/runtime/custom-actions.d.ts.map +1 -0
  438. package/packages/autonomous/src/runtime/custom-actions.js +454 -0
  439. package/packages/autonomous/src/runtime/eliza-plugin.d.ts +16 -0
  440. package/packages/autonomous/src/runtime/eliza-plugin.d.ts.map +1 -0
  441. package/packages/autonomous/src/runtime/eliza-plugin.js +108 -0
  442. package/packages/autonomous/src/runtime/eliza.d.ts +205 -0
  443. package/packages/autonomous/src/runtime/eliza.d.ts.map +1 -0
  444. package/packages/autonomous/src/runtime/eliza.js +4006 -0
  445. package/packages/autonomous/src/runtime/embedding-presets.d.ts +19 -0
  446. package/packages/autonomous/src/runtime/embedding-presets.d.ts.map +1 -0
  447. package/packages/autonomous/src/runtime/embedding-presets.js +53 -0
  448. package/packages/autonomous/src/runtime/index.d.ts +9 -0
  449. package/packages/autonomous/src/runtime/index.d.ts.map +1 -0
  450. package/packages/autonomous/src/runtime/onboarding-names.d.ts +11 -0
  451. package/packages/autonomous/src/runtime/onboarding-names.d.ts.map +1 -0
  452. package/packages/autonomous/src/runtime/onboarding-names.js +74 -0
  453. package/packages/autonomous/src/runtime/release-plugin-policy.d.ts +20 -0
  454. package/packages/autonomous/src/runtime/release-plugin-policy.d.ts.map +1 -0
  455. package/packages/autonomous/src/runtime/release-plugin-policy.js +87 -0
  456. package/packages/autonomous/src/runtime/restart.d.ts +45 -0
  457. package/packages/autonomous/src/runtime/restart.d.ts.map +1 -0
  458. package/packages/autonomous/src/runtime/restart.js +45 -0
  459. package/packages/autonomous/src/runtime/trajectory-persistence.d.ts +214 -0
  460. package/packages/autonomous/src/runtime/trajectory-persistence.d.ts.map +1 -0
  461. package/packages/autonomous/src/runtime/trajectory-persistence.js +1849 -0
  462. package/packages/autonomous/src/runtime/version.d.ts +2 -0
  463. package/packages/autonomous/src/runtime/version.d.ts.map +1 -0
  464. package/packages/autonomous/src/runtime/version.js +5 -0
  465. package/packages/autonomous/src/security/audit-log.d.ts +49 -0
  466. package/packages/autonomous/src/security/audit-log.d.ts.map +1 -0
  467. package/packages/autonomous/src/security/audit-log.js +161 -0
  468. package/packages/autonomous/src/security/network-policy.d.ts +6 -0
  469. package/packages/autonomous/src/security/network-policy.d.ts.map +1 -0
  470. package/packages/autonomous/src/security/network-policy.js +85 -0
  471. package/packages/autonomous/src/server/index.d.ts +3 -0
  472. package/packages/autonomous/src/server/index.d.ts.map +1 -0
  473. package/packages/autonomous/src/server/index.js +1 -0
  474. package/packages/autonomous/src/services/agent-export.d.ts +100 -0
  475. package/packages/autonomous/src/services/agent-export.d.ts.map +1 -0
  476. package/packages/autonomous/src/services/agent-export.js +729 -0
  477. package/packages/autonomous/src/services/app-manager.d.ts +34 -0
  478. package/packages/autonomous/src/services/app-manager.d.ts.map +1 -0
  479. package/packages/autonomous/src/services/app-manager.js +425 -0
  480. package/packages/autonomous/src/services/browser-capture.d.ts +39 -0
  481. package/packages/autonomous/src/services/browser-capture.d.ts.map +1 -0
  482. package/packages/autonomous/src/services/browser-capture.js +162 -0
  483. package/packages/autonomous/src/services/coding-agent-context.d.ts +310 -0
  484. package/packages/autonomous/src/services/coding-agent-context.d.ts.map +1 -0
  485. package/packages/autonomous/src/services/coding-agent-context.js +281 -0
  486. package/packages/autonomous/src/services/fallback-training-service.d.ts +78 -0
  487. package/packages/autonomous/src/services/fallback-training-service.d.ts.map +1 -0
  488. package/packages/autonomous/src/services/fallback-training-service.js +126 -0
  489. package/packages/autonomous/src/services/index.d.ts +18 -0
  490. package/packages/autonomous/src/services/index.d.ts.map +1 -0
  491. package/packages/autonomous/src/services/mcp-marketplace.d.ts +89 -0
  492. package/packages/autonomous/src/services/mcp-marketplace.d.ts.map +1 -0
  493. package/packages/autonomous/src/services/mcp-marketplace.js +200 -0
  494. package/packages/autonomous/src/services/plugin-manager-types.d.ts +139 -0
  495. package/packages/autonomous/src/services/plugin-manager-types.d.ts.map +1 -0
  496. package/packages/autonomous/src/services/plugin-manager-types.js +18 -0
  497. package/packages/autonomous/src/services/privy-wallets.d.ts +18 -0
  498. package/packages/autonomous/src/services/privy-wallets.d.ts.map +1 -0
  499. package/packages/autonomous/src/services/privy-wallets.js +225 -0
  500. package/packages/autonomous/src/services/registry-client-app-meta.d.ts +6 -0
  501. package/packages/autonomous/src/services/registry-client-app-meta.d.ts.map +1 -0
  502. package/packages/autonomous/src/services/registry-client-app-meta.js +147 -0
  503. package/packages/autonomous/src/services/registry-client-endpoints.d.ts +7 -0
  504. package/packages/autonomous/src/services/registry-client-endpoints.d.ts.map +1 -0
  505. package/packages/autonomous/src/services/registry-client-endpoints.js +183 -0
  506. package/packages/autonomous/src/services/registry-client-local.d.ts +4 -0
  507. package/packages/autonomous/src/services/registry-client-local.d.ts.map +1 -0
  508. package/packages/autonomous/src/services/registry-client-local.js +377 -0
  509. package/packages/autonomous/src/services/registry-client-network.d.ts +9 -0
  510. package/packages/autonomous/src/services/registry-client-network.d.ts.map +1 -0
  511. package/packages/autonomous/src/services/registry-client-network.js +109 -0
  512. package/packages/autonomous/src/services/registry-client-queries.d.ts +15 -0
  513. package/packages/autonomous/src/services/registry-client-queries.d.ts.map +1 -0
  514. package/packages/autonomous/src/services/registry-client-queries.js +150 -0
  515. package/packages/autonomous/src/services/registry-client-types.d.ts +115 -0
  516. package/packages/autonomous/src/services/registry-client-types.d.ts.map +1 -0
  517. package/packages/autonomous/src/services/registry-client-types.js +1 -0
  518. package/packages/autonomous/src/services/registry-client.d.ts +39 -0
  519. package/packages/autonomous/src/services/registry-client.d.ts.map +1 -0
  520. package/packages/autonomous/src/services/registry-client.js +249 -0
  521. package/packages/autonomous/src/services/remote-signing-service.d.ts +58 -0
  522. package/packages/autonomous/src/services/remote-signing-service.d.ts.map +1 -0
  523. package/packages/autonomous/src/services/remote-signing-service.js +185 -0
  524. package/packages/autonomous/src/services/sandbox-engine.d.ts +96 -0
  525. package/packages/autonomous/src/services/sandbox-engine.d.ts.map +1 -0
  526. package/packages/autonomous/src/services/sandbox-engine.js +604 -0
  527. package/packages/autonomous/src/services/sandbox-manager.d.ts +104 -0
  528. package/packages/autonomous/src/services/sandbox-manager.d.ts.map +1 -0
  529. package/packages/autonomous/src/services/sandbox-manager.js +353 -0
  530. package/packages/autonomous/src/services/self-updater.d.ts +21 -0
  531. package/packages/autonomous/src/services/self-updater.d.ts.map +1 -0
  532. package/packages/autonomous/src/services/self-updater.js +162 -0
  533. package/packages/autonomous/src/services/signal-pairing.d.ts +37 -0
  534. package/packages/autonomous/src/services/signal-pairing.d.ts.map +1 -0
  535. package/packages/autonomous/src/services/signal-pairing.js +124 -0
  536. package/packages/autonomous/src/services/signing-policy.d.ts +44 -0
  537. package/packages/autonomous/src/services/signing-policy.d.ts.map +1 -0
  538. package/packages/autonomous/src/services/signing-policy.js +165 -0
  539. package/packages/autonomous/src/services/skill-catalog-client.d.ts +47 -0
  540. package/packages/autonomous/src/services/skill-catalog-client.d.ts.map +1 -0
  541. package/packages/autonomous/src/services/skill-catalog-client.js +130 -0
  542. package/packages/autonomous/src/services/skill-marketplace.d.ts +42 -0
  543. package/packages/autonomous/src/services/skill-marketplace.d.ts.map +1 -0
  544. package/packages/autonomous/src/services/skill-marketplace.js +680 -0
  545. package/packages/autonomous/src/services/stream-manager.d.ts +121 -0
  546. package/packages/autonomous/src/services/stream-manager.d.ts.map +1 -0
  547. package/packages/autonomous/src/services/stream-manager.js +604 -0
  548. package/packages/autonomous/src/services/tts-stream-bridge.d.ts +83 -0
  549. package/packages/autonomous/src/services/tts-stream-bridge.d.ts.map +1 -0
  550. package/packages/autonomous/src/services/tts-stream-bridge.js +349 -0
  551. package/packages/autonomous/src/services/update-checker.d.ts +29 -0
  552. package/packages/autonomous/src/services/update-checker.d.ts.map +1 -0
  553. package/packages/autonomous/src/services/update-checker.js +134 -0
  554. package/packages/autonomous/src/services/version-compat.d.ts +99 -0
  555. package/packages/autonomous/src/services/version-compat.d.ts.map +1 -0
  556. package/packages/autonomous/src/services/version-compat.js +195 -0
  557. package/packages/autonomous/src/services/whatsapp-pairing.d.ts +41 -0
  558. package/packages/autonomous/src/services/whatsapp-pairing.d.ts.map +1 -0
  559. package/packages/autonomous/src/services/whatsapp-pairing.js +209 -0
  560. package/packages/autonomous/src/shared/ui-catalog-prompt.d.ts +52 -0
  561. package/packages/autonomous/src/shared/ui-catalog-prompt.d.ts.map +1 -0
  562. package/packages/autonomous/src/shared/ui-catalog-prompt.js +1028 -0
  563. package/packages/autonomous/src/test-support/process-helpers.d.ts +13 -0
  564. package/packages/autonomous/src/test-support/process-helpers.d.ts.map +1 -0
  565. package/packages/autonomous/src/test-support/process-helpers.js +23 -0
  566. package/packages/autonomous/src/test-support/route-test-helpers.d.ts +37 -0
  567. package/packages/autonomous/src/test-support/route-test-helpers.d.ts.map +1 -0
  568. package/packages/autonomous/src/test-support/route-test-helpers.js +54 -0
  569. package/packages/autonomous/src/test-support/test-helpers.d.ts +77 -0
  570. package/packages/autonomous/src/test-support/test-helpers.d.ts.map +1 -0
  571. package/packages/autonomous/src/test-support/test-helpers.js +210 -0
  572. package/packages/autonomous/src/testing/index.d.ts +4 -0
  573. package/packages/autonomous/src/testing/index.d.ts.map +1 -0
  574. package/packages/autonomous/src/triggers/action.d.ts +3 -0
  575. package/packages/autonomous/src/triggers/action.d.ts.map +1 -0
  576. package/packages/autonomous/src/triggers/action.js +267 -0
  577. package/packages/autonomous/src/triggers/runtime.d.ts +24 -0
  578. package/packages/autonomous/src/triggers/runtime.d.ts.map +1 -0
  579. package/packages/autonomous/src/triggers/runtime.js +322 -0
  580. package/packages/autonomous/src/triggers/scheduling.d.ts +70 -0
  581. package/packages/autonomous/src/triggers/scheduling.d.ts.map +1 -0
  582. package/packages/autonomous/src/triggers/scheduling.js +355 -0
  583. package/packages/autonomous/src/triggers/types.d.ts +115 -0
  584. package/packages/autonomous/src/triggers/types.d.ts.map +1 -0
  585. package/packages/autonomous/src/triggers/types.js +1 -0
  586. package/packages/autonomous/src/utils/exec-safety.d.ts +2 -0
  587. package/packages/autonomous/src/utils/exec-safety.d.ts.map +1 -0
  588. package/packages/autonomous/src/utils/exec-safety.js +21 -0
  589. package/packages/autonomous/src/utils/number-parsing.d.ts +26 -0
  590. package/packages/autonomous/src/utils/number-parsing.d.ts.map +1 -0
  591. package/packages/autonomous/src/utils/number-parsing.js +52 -0
  592. package/packages/autonomous/src/utils/spoken-text.d.ts +2 -0
  593. package/packages/autonomous/src/utils/spoken-text.d.ts.map +1 -0
  594. package/packages/autonomous/src/utils/spoken-text.js +56 -0
  595. package/packages/autonomous/src/version-resolver.d.ts +3 -0
  596. package/packages/autonomous/src/version-resolver.d.ts.map +1 -0
  597. package/packages/autonomous/src/version-resolver.js +51 -0
  598. package/.turbo/turbo-build.log +0 -4
  599. package/LICENSE +0 -21
  600. package/src/actions/emote.test.ts +0 -41
  601. package/src/actions/emote.ts +0 -110
  602. package/src/actions/restart.ts +0 -101
  603. package/src/actions/send-message.ts +0 -176
  604. package/src/actions/stream-control.ts +0 -439
  605. package/src/actions/switch-stream-source.ts +0 -132
  606. package/src/actions/terminal.ts +0 -186
  607. package/src/api/agent-admin-routes.ts +0 -178
  608. package/src/api/agent-lifecycle-routes.ts +0 -120
  609. package/src/api/agent-model.ts +0 -143
  610. package/src/api/agent-transfer-routes.ts +0 -211
  611. package/src/api/apps-routes.ts +0 -207
  612. package/src/api/auth-routes.ts +0 -90
  613. package/src/api/bsc-trade.ts +0 -736
  614. package/src/api/bug-report-routes.ts +0 -161
  615. package/src/api/character-routes.ts +0 -421
  616. package/src/api/cloud-billing-routes.ts +0 -600
  617. package/src/api/cloud-compat-routes.ts +0 -194
  618. package/src/api/cloud-routes.ts +0 -529
  619. package/src/api/cloud-status-routes.ts +0 -235
  620. package/src/api/compat-utils.ts +0 -154
  621. package/src/api/connector-health.ts +0 -137
  622. package/src/api/coordinator-wiring.ts +0 -182
  623. package/src/api/credit-detection.ts +0 -47
  624. package/src/api/database.ts +0 -1357
  625. package/src/api/diagnostics-routes.ts +0 -389
  626. package/src/api/drop-service.ts +0 -205
  627. package/src/api/early-logs.ts +0 -114
  628. package/src/api/http-helpers.ts +0 -252
  629. package/src/api/index.ts +0 -81
  630. package/src/api/knowledge-routes.ts +0 -1189
  631. package/src/api/knowledge-service-loader.ts +0 -92
  632. package/src/api/memory-bounds.ts +0 -121
  633. package/src/api/memory-routes.ts +0 -349
  634. package/src/api/merkle-tree.ts +0 -239
  635. package/src/api/models-routes.ts +0 -72
  636. package/src/api/nfa-routes.ts +0 -169
  637. package/src/api/nft-verify.ts +0 -188
  638. package/src/api/og-tracker.ts +0 -72
  639. package/src/api/parse-action-block.ts +0 -143
  640. package/src/api/permissions-routes.ts +0 -222
  641. package/src/api/plugin-validation.ts +0 -353
  642. package/src/api/provider-switch-config.ts +0 -456
  643. package/src/api/registry-routes.ts +0 -165
  644. package/src/api/registry-service.ts +0 -292
  645. package/src/api/route-helpers.ts +0 -21
  646. package/src/api/sandbox-routes.ts +0 -1480
  647. package/src/api/server.ts +0 -17706
  648. package/src/api/signal-routes.ts +0 -263
  649. package/src/api/stream-persistence.ts +0 -297
  650. package/src/api/stream-route-state.ts +0 -48
  651. package/src/api/stream-routes.ts +0 -1048
  652. package/src/api/stream-voice-routes.ts +0 -222
  653. package/src/api/streaming-text.ts +0 -129
  654. package/src/api/streaming-types.ts +0 -23
  655. package/src/api/subscription-routes.ts +0 -263
  656. package/src/api/terminal-run-limits.ts +0 -31
  657. package/src/api/training-backend-check.ts +0 -40
  658. package/src/api/training-routes.ts +0 -314
  659. package/src/api/training-service-like.ts +0 -46
  660. package/src/api/trajectory-routes.ts +0 -714
  661. package/src/api/trigger-routes.ts +0 -441
  662. package/src/api/twitter-verify.ts +0 -226
  663. package/src/api/tx-service.ts +0 -193
  664. package/src/api/wallet-dex-prices.ts +0 -206
  665. package/src/api/wallet-evm-balance.ts +0 -990
  666. package/src/api/wallet-routes.ts +0 -505
  667. package/src/api/wallet-rpc.ts +0 -523
  668. package/src/api/wallet-trading-profile.ts +0 -694
  669. package/src/api/wallet.ts +0 -745
  670. package/src/api/whatsapp-routes.ts +0 -280
  671. package/src/api/zip-utils.ts +0 -130
  672. package/src/auth/anthropic.ts +0 -63
  673. package/src/auth/apply-stealth.ts +0 -39
  674. package/src/auth/claude-code-stealth.ts +0 -141
  675. package/src/auth/credentials.ts +0 -226
  676. package/src/auth/index.ts +0 -18
  677. package/src/auth/openai-codex.ts +0 -94
  678. package/src/auth/types.ts +0 -24
  679. package/src/awareness/registry.ts +0 -220
  680. package/src/benchmark-server.ts +0 -1017
  681. package/src/bin.ts +0 -10
  682. package/src/cli/index.ts +0 -50
  683. package/src/cli/parse-duration.ts +0 -43
  684. package/src/cloud/auth.test.ts +0 -370
  685. package/src/cloud/auth.ts +0 -176
  686. package/src/cloud/backup.test.ts +0 -150
  687. package/src/cloud/backup.ts +0 -50
  688. package/src/cloud/base-url.ts +0 -45
  689. package/src/cloud/bridge-client.test.ts +0 -481
  690. package/src/cloud/bridge-client.ts +0 -304
  691. package/src/cloud/cloud-manager.test.ts +0 -223
  692. package/src/cloud/cloud-manager.ts +0 -151
  693. package/src/cloud/cloud-proxy.test.ts +0 -122
  694. package/src/cloud/cloud-proxy.ts +0 -52
  695. package/src/cloud/index.ts +0 -23
  696. package/src/cloud/reconnect.test.ts +0 -178
  697. package/src/cloud/reconnect.ts +0 -108
  698. package/src/cloud/validate-url.test.ts +0 -147
  699. package/src/cloud/validate-url.ts +0 -181
  700. package/src/config/character-schema.ts +0 -44
  701. package/src/config/config.ts +0 -151
  702. package/src/config/env-vars.ts +0 -85
  703. package/src/config/includes.ts +0 -196
  704. package/src/config/object-utils.ts +0 -10
  705. package/src/config/paths.ts +0 -103
  706. package/src/config/plugin-auto-enable.ts +0 -520
  707. package/src/config/schema.ts +0 -1342
  708. package/src/config/telegram-custom-commands.ts +0 -99
  709. package/src/config/types.agent-defaults.ts +0 -342
  710. package/src/config/types.agents.ts +0 -112
  711. package/src/config/types.eliza.ts +0 -793
  712. package/src/config/types.gateway.ts +0 -243
  713. package/src/config/types.hooks.ts +0 -124
  714. package/src/config/types.messages.ts +0 -201
  715. package/src/config/types.tools.ts +0 -416
  716. package/src/config/zod-schema.agent-runtime.ts +0 -777
  717. package/src/config/zod-schema.core.ts +0 -778
  718. package/src/config/zod-schema.hooks.ts +0 -139
  719. package/src/config/zod-schema.providers-core.ts +0 -1126
  720. package/src/config/zod-schema.session.ts +0 -98
  721. package/src/config/zod-schema.ts +0 -865
  722. package/src/contracts/apps.ts +0 -46
  723. package/src/contracts/awareness.ts +0 -56
  724. package/src/contracts/config.ts +0 -172
  725. package/src/contracts/drop.ts +0 -21
  726. package/src/contracts/onboarding.ts +0 -591
  727. package/src/contracts/permissions.ts +0 -52
  728. package/src/contracts/verification.ts +0 -9
  729. package/src/contracts/wallet.ts +0 -503
  730. package/src/diagnostics/integration-observability.ts +0 -132
  731. package/src/emotes/catalog.ts +0 -655
  732. package/src/external-modules.d.ts +0 -7
  733. package/src/hooks/discovery.test.ts +0 -357
  734. package/src/hooks/discovery.ts +0 -231
  735. package/src/hooks/eligibility.ts +0 -146
  736. package/src/hooks/hooks.test.ts +0 -320
  737. package/src/hooks/index.ts +0 -8
  738. package/src/hooks/loader.test.ts +0 -418
  739. package/src/hooks/loader.ts +0 -256
  740. package/src/hooks/registry.test.ts +0 -168
  741. package/src/hooks/registry.ts +0 -74
  742. package/src/hooks/types.ts +0 -121
  743. package/src/onboarding-presets.ts +0 -828
  744. package/src/plugins/custom-rtmp/index.ts +0 -40
  745. package/src/providers/admin-trust.ts +0 -76
  746. package/src/providers/session-bridge.ts +0 -143
  747. package/src/providers/session-utils.ts +0 -42
  748. package/src/providers/simple-mode.ts +0 -112
  749. package/src/providers/ui-catalog.ts +0 -135
  750. package/src/providers/workspace-provider.test.ts +0 -111
  751. package/src/providers/workspace-provider.ts +0 -217
  752. package/src/providers/workspace.test.ts +0 -94
  753. package/src/providers/workspace.ts +0 -510
  754. package/src/runtime/agent-event-service.ts +0 -60
  755. package/src/runtime/cloud-onboarding.test.ts +0 -489
  756. package/src/runtime/cloud-onboarding.ts +0 -410
  757. package/src/runtime/core-plugins.ts +0 -53
  758. package/src/runtime/custom-actions.ts +0 -605
  759. package/src/runtime/eliza-plugin.ts +0 -151
  760. package/src/runtime/eliza.ts +0 -4965
  761. package/src/runtime/embedding-presets.ts +0 -73
  762. package/src/runtime/onboarding-names.ts +0 -76
  763. package/src/runtime/release-plugin-policy.ts +0 -118
  764. package/src/runtime/restart.ts +0 -59
  765. package/src/runtime/trajectory-persistence.ts +0 -2605
  766. package/src/runtime/version.ts +0 -6
  767. package/src/security/audit-log.ts +0 -222
  768. package/src/security/network-policy.ts +0 -91
  769. package/src/server/index.ts +0 -2
  770. package/src/services/agent-export.ts +0 -993
  771. package/src/services/app-manager.ts +0 -578
  772. package/src/services/browser-capture.ts +0 -215
  773. package/src/services/coding-agent-context.ts +0 -355
  774. package/src/services/fallback-training-service.ts +0 -196
  775. package/src/services/mcp-marketplace.ts +0 -327
  776. package/src/services/plugin-manager-types.ts +0 -185
  777. package/src/services/privy-wallets.ts +0 -352
  778. package/src/services/registry-client-app-meta.ts +0 -184
  779. package/src/services/registry-client-endpoints.ts +0 -253
  780. package/src/services/registry-client-local.ts +0 -485
  781. package/src/services/registry-client-network.ts +0 -173
  782. package/src/services/registry-client-queries.ts +0 -176
  783. package/src/services/registry-client-types.ts +0 -104
  784. package/src/services/registry-client.ts +0 -366
  785. package/src/services/remote-signing-service.ts +0 -261
  786. package/src/services/sandbox-engine.ts +0 -753
  787. package/src/services/sandbox-manager.ts +0 -503
  788. package/src/services/self-updater.ts +0 -213
  789. package/src/services/signal-pairing.ts +0 -189
  790. package/src/services/signing-policy.ts +0 -230
  791. package/src/services/skill-catalog-client.ts +0 -195
  792. package/src/services/skill-marketplace.ts +0 -909
  793. package/src/services/stream-manager.ts +0 -707
  794. package/src/services/tts-stream-bridge.ts +0 -465
  795. package/src/services/update-checker.ts +0 -163
  796. package/src/services/version-compat.ts +0 -274
  797. package/src/services/whatsapp-pairing.ts +0 -282
  798. package/src/shared/ui-catalog-prompt.ts +0 -1158
  799. package/src/test-support/process-helpers.ts +0 -35
  800. package/src/test-support/route-test-helpers.ts +0 -113
  801. package/src/test-support/test-helpers.ts +0 -304
  802. package/src/triggers/action.ts +0 -342
  803. package/src/triggers/runtime.ts +0 -451
  804. package/src/triggers/scheduling.ts +0 -472
  805. package/src/triggers/types.ts +0 -133
  806. package/src/types/external-modules.d.ts +0 -7
  807. package/src/utils/exec-safety.ts +0 -23
  808. package/src/utils/number-parsing.ts +0 -112
  809. package/src/utils/spoken-text.ts +0 -65
  810. package/src/version-resolver.ts +0 -62
  811. package/test/agent-export.e2e.test.ts +0 -376
  812. package/test/agent-orchestration.e2e.test.ts +0 -1568
  813. package/test/agent-restart-recovery.e2e.test.ts +0 -149
  814. package/test/agent-runtime.e2e.test.ts +0 -1515
  815. package/test/anvil-contracts.e2e.test.ts +0 -533
  816. package/test/anvil-helper.ts +0 -285
  817. package/test/api/agent-admin-routes.test.ts +0 -166
  818. package/test/api/agent-lifecycle-routes.test.ts +0 -173
  819. package/test/api/agent-transfer-routes.test.ts +0 -145
  820. package/test/api/apps-routes.test.ts +0 -138
  821. package/test/api/auth-routes.test.ts +0 -160
  822. package/test/api/bug-report-routes.test.ts +0 -88
  823. package/test/api/knowledge-routes.test.ts +0 -73
  824. package/test/api/lifecycle.test.ts +0 -342
  825. package/test/api/memory-routes.test.ts +0 -74
  826. package/test/api/models-routes.test.ts +0 -114
  827. package/test/api/nfa-routes.test.ts +0 -78
  828. package/test/api/permissions-routes.test.ts +0 -185
  829. package/test/api/registry-routes.test.ts +0 -157
  830. package/test/api/signal-routes.test.ts +0 -113
  831. package/test/api/subscription-routes.test.ts +0 -90
  832. package/test/api/trigger-routes.test.ts +0 -87
  833. package/test/api/wallet-routes.observability.test.ts +0 -193
  834. package/test/api/wallet-routes.test.ts +0 -504
  835. package/test/api-auth-live.e2e.test.ts +0 -519
  836. package/test/api-auth.e2e.test.ts +0 -1039
  837. package/test/api-server.e2e.test.ts +0 -4582
  838. package/test/apps-e2e.e2e.test.ts +0 -1108
  839. package/test/auth-modules.e2e.test.ts +0 -71
  840. package/test/cloud-auth-state.e2e.test.ts +0 -145
  841. package/test/cloud-persistence.e2e.test.ts +0 -260
  842. package/test/cloud-providers.e2e.test.ts +0 -781
  843. package/test/config-hot-reload.e2e.test.ts +0 -131
  844. package/test/contract-deployer.ts +0 -151
  845. package/test/contracts/MockMiladyAgentRegistry.sol +0 -216
  846. package/test/contracts/MockMiladyCollection.sol +0 -195
  847. package/test/contracts/cache/solidity-files-cache.json +0 -1
  848. package/test/contracts/foundry.toml +0 -14
  849. package/test/contracts/lib/openzeppelin-contracts/.changeset/config.json +0 -12
  850. package/test/contracts/lib/openzeppelin-contracts/.codecov.yml +0 -12
  851. package/test/contracts/lib/openzeppelin-contracts/.editorconfig +0 -21
  852. package/test/contracts/lib/openzeppelin-contracts/.eslintrc +0 -20
  853. package/test/contracts/lib/openzeppelin-contracts/.github/ISSUE_TEMPLATE/bug_report.md +0 -21
  854. package/test/contracts/lib/openzeppelin-contracts/.github/ISSUE_TEMPLATE/config.yml +0 -4
  855. package/test/contracts/lib/openzeppelin-contracts/.github/ISSUE_TEMPLATE/feature_request.md +0 -14
  856. package/test/contracts/lib/openzeppelin-contracts/.github/PULL_REQUEST_TEMPLATE.md +0 -20
  857. package/test/contracts/lib/openzeppelin-contracts/.github/actions/gas-compare/action.yml +0 -49
  858. package/test/contracts/lib/openzeppelin-contracts/.github/actions/setup/action.yml +0 -19
  859. package/test/contracts/lib/openzeppelin-contracts/.github/actions/storage-layout/action.yml +0 -55
  860. package/test/contracts/lib/openzeppelin-contracts/.github/workflows/actionlint.yml +0 -18
  861. package/test/contracts/lib/openzeppelin-contracts/.github/workflows/changeset.yml +0 -28
  862. package/test/contracts/lib/openzeppelin-contracts/.github/workflows/checks.yml +0 -111
  863. package/test/contracts/lib/openzeppelin-contracts/.github/workflows/docs.yml +0 -19
  864. package/test/contracts/lib/openzeppelin-contracts/.github/workflows/formal-verification.yml +0 -68
  865. package/test/contracts/lib/openzeppelin-contracts/.github/workflows/release-cycle.yml +0 -218
  866. package/test/contracts/lib/openzeppelin-contracts/.github/workflows/upgradeable.yml +0 -30
  867. package/test/contracts/lib/openzeppelin-contracts/.gitmodules +0 -7
  868. package/test/contracts/lib/openzeppelin-contracts/.mocharc.js +0 -4
  869. package/test/contracts/lib/openzeppelin-contracts/.prettierrc +0 -14
  870. package/test/contracts/lib/openzeppelin-contracts/.solcover.js +0 -13
  871. package/test/contracts/lib/openzeppelin-contracts/.solhint.json +0 -14
  872. package/test/contracts/lib/openzeppelin-contracts/CHANGELOG.md +0 -743
  873. package/test/contracts/lib/openzeppelin-contracts/CODE_OF_CONDUCT.md +0 -73
  874. package/test/contracts/lib/openzeppelin-contracts/CONTRIBUTING.md +0 -36
  875. package/test/contracts/lib/openzeppelin-contracts/GUIDELINES.md +0 -117
  876. package/test/contracts/lib/openzeppelin-contracts/LICENSE +0 -22
  877. package/test/contracts/lib/openzeppelin-contracts/README.md +0 -90
  878. package/test/contracts/lib/openzeppelin-contracts/RELEASING.md +0 -47
  879. package/test/contracts/lib/openzeppelin-contracts/SECURITY.md +0 -42
  880. package/test/contracts/lib/openzeppelin-contracts/audits/2017-03.md +0 -292
  881. package/test/contracts/lib/openzeppelin-contracts/audits/2018-10.pdf +0 -0
  882. package/test/contracts/lib/openzeppelin-contracts/audits/2022-10-Checkpoints.pdf +0 -0
  883. package/test/contracts/lib/openzeppelin-contracts/audits/2022-10-ERC4626.pdf +0 -0
  884. package/test/contracts/lib/openzeppelin-contracts/audits/2023-05-v4.9.pdf +0 -0
  885. package/test/contracts/lib/openzeppelin-contracts/audits/README.md +0 -16
  886. package/test/contracts/lib/openzeppelin-contracts/certora/Makefile +0 -54
  887. package/test/contracts/lib/openzeppelin-contracts/certora/README.md +0 -60
  888. package/test/contracts/lib/openzeppelin-contracts/certora/diff/token_ERC721_ERC721.sol.patch +0 -14
  889. package/test/contracts/lib/openzeppelin-contracts/certora/harnesses/AccessControlDefaultAdminRulesHarness.sol +0 -47
  890. package/test/contracts/lib/openzeppelin-contracts/certora/harnesses/AccessControlHarness.sol +0 -7
  891. package/test/contracts/lib/openzeppelin-contracts/certora/harnesses/DoubleEndedQueueHarness.sol +0 -59
  892. package/test/contracts/lib/openzeppelin-contracts/certora/harnesses/ERC20FlashMintHarness.sol +0 -36
  893. package/test/contracts/lib/openzeppelin-contracts/certora/harnesses/ERC20PermitHarness.sol +0 -17
  894. package/test/contracts/lib/openzeppelin-contracts/certora/harnesses/ERC20WrapperHarness.sol +0 -25
  895. package/test/contracts/lib/openzeppelin-contracts/certora/harnesses/ERC3156FlashBorrowerHarness.sol +0 -13
  896. package/test/contracts/lib/openzeppelin-contracts/certora/harnesses/ERC721Harness.sol +0 -37
  897. package/test/contracts/lib/openzeppelin-contracts/certora/harnesses/ERC721ReceiverHarness.sol +0 -11
  898. package/test/contracts/lib/openzeppelin-contracts/certora/harnesses/EnumerableMapHarness.sol +0 -55
  899. package/test/contracts/lib/openzeppelin-contracts/certora/harnesses/EnumerableSetHarness.sol +0 -35
  900. package/test/contracts/lib/openzeppelin-contracts/certora/harnesses/InitializableHarness.sol +0 -23
  901. package/test/contracts/lib/openzeppelin-contracts/certora/harnesses/Ownable2StepHarness.sol +0 -9
  902. package/test/contracts/lib/openzeppelin-contracts/certora/harnesses/OwnableHarness.sol +0 -9
  903. package/test/contracts/lib/openzeppelin-contracts/certora/harnesses/PausableHarness.sol +0 -19
  904. package/test/contracts/lib/openzeppelin-contracts/certora/harnesses/TimelockControllerHarness.sol +0 -12
  905. package/test/contracts/lib/openzeppelin-contracts/certora/reports/2021-10.pdf +0 -0
  906. package/test/contracts/lib/openzeppelin-contracts/certora/reports/2022-03.pdf +0 -0
  907. package/test/contracts/lib/openzeppelin-contracts/certora/reports/2022-05.pdf +0 -0
  908. package/test/contracts/lib/openzeppelin-contracts/certora/run.js +0 -146
  909. package/test/contracts/lib/openzeppelin-contracts/certora/specs/AccessControl.spec +0 -126
  910. package/test/contracts/lib/openzeppelin-contracts/certora/specs/AccessControlDefaultAdminRules.spec +0 -500
  911. package/test/contracts/lib/openzeppelin-contracts/certora/specs/DoubleEndedQueue.spec +0 -366
  912. package/test/contracts/lib/openzeppelin-contracts/certora/specs/ERC20.spec +0 -414
  913. package/test/contracts/lib/openzeppelin-contracts/certora/specs/ERC20FlashMint.spec +0 -48
  914. package/test/contracts/lib/openzeppelin-contracts/certora/specs/ERC20Wrapper.spec +0 -198
  915. package/test/contracts/lib/openzeppelin-contracts/certora/specs/ERC721.spec +0 -589
  916. package/test/contracts/lib/openzeppelin-contracts/certora/specs/EnumerableMap.spec +0 -334
  917. package/test/contracts/lib/openzeppelin-contracts/certora/specs/EnumerableSet.spec +0 -247
  918. package/test/contracts/lib/openzeppelin-contracts/certora/specs/Initializable.spec +0 -165
  919. package/test/contracts/lib/openzeppelin-contracts/certora/specs/Ownable.spec +0 -78
  920. package/test/contracts/lib/openzeppelin-contracts/certora/specs/Ownable2Step.spec +0 -108
  921. package/test/contracts/lib/openzeppelin-contracts/certora/specs/Pausable.spec +0 -96
  922. package/test/contracts/lib/openzeppelin-contracts/certora/specs/TimelockController.spec +0 -275
  923. package/test/contracts/lib/openzeppelin-contracts/certora/specs/helpers/helpers.spec +0 -1
  924. package/test/contracts/lib/openzeppelin-contracts/certora/specs/methods/IAccessControl.spec +0 -7
  925. package/test/contracts/lib/openzeppelin-contracts/certora/specs/methods/IAccessControlDefaultAdminRules.spec +0 -36
  926. package/test/contracts/lib/openzeppelin-contracts/certora/specs/methods/IERC20.spec +0 -11
  927. package/test/contracts/lib/openzeppelin-contracts/certora/specs/methods/IERC2612.spec +0 -5
  928. package/test/contracts/lib/openzeppelin-contracts/certora/specs/methods/IERC3156.spec +0 -5
  929. package/test/contracts/lib/openzeppelin-contracts/certora/specs/methods/IERC5313.spec +0 -3
  930. package/test/contracts/lib/openzeppelin-contracts/certora/specs/methods/IERC721.spec +0 -20
  931. package/test/contracts/lib/openzeppelin-contracts/certora/specs/methods/IOwnable.spec +0 -5
  932. package/test/contracts/lib/openzeppelin-contracts/certora/specs/methods/IOwnable2Step.spec +0 -7
  933. package/test/contracts/lib/openzeppelin-contracts/certora/specs.json +0 -86
  934. package/test/contracts/lib/openzeppelin-contracts/contracts/access/AccessControl.sol +0 -248
  935. package/test/contracts/lib/openzeppelin-contracts/contracts/access/AccessControlCrossChain.sol +0 -45
  936. package/test/contracts/lib/openzeppelin-contracts/contracts/access/AccessControlDefaultAdminRules.sol +0 -383
  937. package/test/contracts/lib/openzeppelin-contracts/contracts/access/AccessControlEnumerable.sol +0 -64
  938. package/test/contracts/lib/openzeppelin-contracts/contracts/access/IAccessControl.sol +0 -88
  939. package/test/contracts/lib/openzeppelin-contracts/contracts/access/IAccessControlDefaultAdminRules.sol +0 -172
  940. package/test/contracts/lib/openzeppelin-contracts/contracts/access/IAccessControlEnumerable.sol +0 -31
  941. package/test/contracts/lib/openzeppelin-contracts/contracts/access/Ownable.sol +0 -83
  942. package/test/contracts/lib/openzeppelin-contracts/contracts/access/Ownable2Step.sol +0 -57
  943. package/test/contracts/lib/openzeppelin-contracts/contracts/access/README.adoc +0 -27
  944. package/test/contracts/lib/openzeppelin-contracts/contracts/crosschain/CrossChainEnabled.sol +0 -54
  945. package/test/contracts/lib/openzeppelin-contracts/contracts/crosschain/README.adoc +0 -34
  946. package/test/contracts/lib/openzeppelin-contracts/contracts/crosschain/amb/CrossChainEnabledAMB.sol +0 -49
  947. package/test/contracts/lib/openzeppelin-contracts/contracts/crosschain/amb/LibAMB.sol +0 -35
  948. package/test/contracts/lib/openzeppelin-contracts/contracts/crosschain/arbitrum/CrossChainEnabledArbitrumL1.sol +0 -44
  949. package/test/contracts/lib/openzeppelin-contracts/contracts/crosschain/arbitrum/CrossChainEnabledArbitrumL2.sol +0 -40
  950. package/test/contracts/lib/openzeppelin-contracts/contracts/crosschain/arbitrum/LibArbitrumL1.sol +0 -42
  951. package/test/contracts/lib/openzeppelin-contracts/contracts/crosschain/arbitrum/LibArbitrumL2.sol +0 -45
  952. package/test/contracts/lib/openzeppelin-contracts/contracts/crosschain/errors.sol +0 -7
  953. package/test/contracts/lib/openzeppelin-contracts/contracts/crosschain/optimism/CrossChainEnabledOptimism.sol +0 -41
  954. package/test/contracts/lib/openzeppelin-contracts/contracts/crosschain/optimism/LibOptimism.sol +0 -36
  955. package/test/contracts/lib/openzeppelin-contracts/contracts/crosschain/polygon/CrossChainEnabledPolygonChild.sol +0 -72
  956. package/test/contracts/lib/openzeppelin-contracts/contracts/finance/PaymentSplitter.sol +0 -214
  957. package/test/contracts/lib/openzeppelin-contracts/contracts/finance/README.adoc +0 -20
  958. package/test/contracts/lib/openzeppelin-contracts/contracts/finance/VestingWallet.sol +0 -145
  959. package/test/contracts/lib/openzeppelin-contracts/contracts/governance/Governor.sol +0 -723
  960. package/test/contracts/lib/openzeppelin-contracts/contracts/governance/IGovernor.sol +0 -313
  961. package/test/contracts/lib/openzeppelin-contracts/contracts/governance/README.adoc +0 -176
  962. package/test/contracts/lib/openzeppelin-contracts/contracts/governance/TimelockController.sol +0 -422
  963. package/test/contracts/lib/openzeppelin-contracts/contracts/governance/compatibility/GovernorCompatibilityBravo.sol +0 -333
  964. package/test/contracts/lib/openzeppelin-contracts/contracts/governance/compatibility/IGovernorCompatibilityBravo.sol +0 -118
  965. package/test/contracts/lib/openzeppelin-contracts/contracts/governance/extensions/GovernorCountingSimple.sol +0 -100
  966. package/test/contracts/lib/openzeppelin-contracts/contracts/governance/extensions/GovernorPreventLateQuorum.sol +0 -105
  967. package/test/contracts/lib/openzeppelin-contracts/contracts/governance/extensions/GovernorProposalThreshold.sol +0 -23
  968. package/test/contracts/lib/openzeppelin-contracts/contracts/governance/extensions/GovernorSettings.sol +0 -110
  969. package/test/contracts/lib/openzeppelin-contracts/contracts/governance/extensions/GovernorTimelockCompound.sol +0 -190
  970. package/test/contracts/lib/openzeppelin-contracts/contracts/governance/extensions/GovernorTimelockControl.sol +0 -166
  971. package/test/contracts/lib/openzeppelin-contracts/contracts/governance/extensions/GovernorVotes.sol +0 -55
  972. package/test/contracts/lib/openzeppelin-contracts/contracts/governance/extensions/GovernorVotesComp.sol +0 -55
  973. package/test/contracts/lib/openzeppelin-contracts/contracts/governance/extensions/GovernorVotesQuorumFraction.sol +0 -121
  974. package/test/contracts/lib/openzeppelin-contracts/contracts/governance/extensions/IGovernorTimelock.sol +0 -26
  975. package/test/contracts/lib/openzeppelin-contracts/contracts/governance/utils/IVotes.sol +0 -56
  976. package/test/contracts/lib/openzeppelin-contracts/contracts/governance/utils/Votes.sol +0 -244
  977. package/test/contracts/lib/openzeppelin-contracts/contracts/interfaces/IERC1155.sol +0 -6
  978. package/test/contracts/lib/openzeppelin-contracts/contracts/interfaces/IERC1155MetadataURI.sol +0 -6
  979. package/test/contracts/lib/openzeppelin-contracts/contracts/interfaces/IERC1155Receiver.sol +0 -6
  980. package/test/contracts/lib/openzeppelin-contracts/contracts/interfaces/IERC1271.sol +0 -19
  981. package/test/contracts/lib/openzeppelin-contracts/contracts/interfaces/IERC1363.sol +0 -80
  982. package/test/contracts/lib/openzeppelin-contracts/contracts/interfaces/IERC1363Receiver.sol +0 -35
  983. package/test/contracts/lib/openzeppelin-contracts/contracts/interfaces/IERC1363Spender.sol +0 -29
  984. package/test/contracts/lib/openzeppelin-contracts/contracts/interfaces/IERC165.sol +0 -6
  985. package/test/contracts/lib/openzeppelin-contracts/contracts/interfaces/IERC1820Implementer.sol +0 -6
  986. package/test/contracts/lib/openzeppelin-contracts/contracts/interfaces/IERC1820Registry.sol +0 -6
  987. package/test/contracts/lib/openzeppelin-contracts/contracts/interfaces/IERC1967.sol +0 -26
  988. package/test/contracts/lib/openzeppelin-contracts/contracts/interfaces/IERC20.sol +0 -6
  989. package/test/contracts/lib/openzeppelin-contracts/contracts/interfaces/IERC20Metadata.sol +0 -6
  990. package/test/contracts/lib/openzeppelin-contracts/contracts/interfaces/IERC2309.sol +0 -21
  991. package/test/contracts/lib/openzeppelin-contracts/contracts/interfaces/IERC2612.sol +0 -8
  992. package/test/contracts/lib/openzeppelin-contracts/contracts/interfaces/IERC2981.sol +0 -25
  993. package/test/contracts/lib/openzeppelin-contracts/contracts/interfaces/IERC3156.sol +0 -7
  994. package/test/contracts/lib/openzeppelin-contracts/contracts/interfaces/IERC3156FlashBorrower.sol +0 -29
  995. package/test/contracts/lib/openzeppelin-contracts/contracts/interfaces/IERC3156FlashLender.sol +0 -43
  996. package/test/contracts/lib/openzeppelin-contracts/contracts/interfaces/IERC4626.sol +0 -232
  997. package/test/contracts/lib/openzeppelin-contracts/contracts/interfaces/IERC4906.sol +0 -20
  998. package/test/contracts/lib/openzeppelin-contracts/contracts/interfaces/IERC5267.sol +0 -28
  999. package/test/contracts/lib/openzeppelin-contracts/contracts/interfaces/IERC5313.sol +0 -18
  1000. package/test/contracts/lib/openzeppelin-contracts/contracts/interfaces/IERC5805.sol +0 -9
  1001. package/test/contracts/lib/openzeppelin-contracts/contracts/interfaces/IERC6372.sol +0 -17
  1002. package/test/contracts/lib/openzeppelin-contracts/contracts/interfaces/IERC721.sol +0 -6
  1003. package/test/contracts/lib/openzeppelin-contracts/contracts/interfaces/IERC721Enumerable.sol +0 -6
  1004. package/test/contracts/lib/openzeppelin-contracts/contracts/interfaces/IERC721Metadata.sol +0 -6
  1005. package/test/contracts/lib/openzeppelin-contracts/contracts/interfaces/IERC721Receiver.sol +0 -6
  1006. package/test/contracts/lib/openzeppelin-contracts/contracts/interfaces/IERC777.sol +0 -6
  1007. package/test/contracts/lib/openzeppelin-contracts/contracts/interfaces/IERC777Recipient.sol +0 -6
  1008. package/test/contracts/lib/openzeppelin-contracts/contracts/interfaces/IERC777Sender.sol +0 -6
  1009. package/test/contracts/lib/openzeppelin-contracts/contracts/interfaces/README.adoc +0 -73
  1010. package/test/contracts/lib/openzeppelin-contracts/contracts/interfaces/draft-IERC1822.sol +0 -20
  1011. package/test/contracts/lib/openzeppelin-contracts/contracts/interfaces/draft-IERC2612.sol +0 -8
  1012. package/test/contracts/lib/openzeppelin-contracts/contracts/metatx/ERC2771Context.sol +0 -54
  1013. package/test/contracts/lib/openzeppelin-contracts/contracts/metatx/MinimalForwarder.sol +0 -72
  1014. package/test/contracts/lib/openzeppelin-contracts/contracts/metatx/README.adoc +0 -12
  1015. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/AccessControlCrossChainMock.sol +0 -8
  1016. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/ArraysMock.sol +0 -51
  1017. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/Base64Dirty.sol +0 -19
  1018. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/CallReceiverMock.sol +0 -61
  1019. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/ConditionalEscrowMock.sol +0 -18
  1020. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/ContextMock.sol +0 -35
  1021. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/DummyImplementation.sol +0 -57
  1022. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/EIP712Verifier.sol +0 -16
  1023. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/ERC1271WalletMock.sol +0 -26
  1024. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/ERC165/ERC165MaliciousData.sol +0 -12
  1025. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/ERC165/ERC165MissingData.sol +0 -7
  1026. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/ERC165/ERC165NotSupported.sol +0 -5
  1027. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/ERC165/ERC165ReturnBomb.sol +0 -18
  1028. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/ERC20Mock.sol +0 -16
  1029. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/ERC20Reentrant.sol +0 -43
  1030. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/ERC2771ContextMock.sol +0 -27
  1031. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/ERC3156FlashBorrowerMock.sol +0 -53
  1032. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/ERC4626Mock.sol +0 -16
  1033. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/EtherReceiverMock.sol +0 -17
  1034. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/InitializableMock.sol +0 -130
  1035. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/MulticallTest.sol +0 -23
  1036. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/MultipleInheritanceInitializableMocks.sol +0 -131
  1037. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/PausableMock.sol +0 -31
  1038. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/PullPaymentMock.sol +0 -15
  1039. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/ReentrancyAttack.sol +0 -12
  1040. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/ReentrancyMock.sol +0 -51
  1041. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/RegressionImplementation.sol +0 -61
  1042. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/SafeMathMemoryCheck.sol +0 -72
  1043. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/SingleInheritanceInitializableMocks.sol +0 -49
  1044. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/StorageSlotMock.sol +0 -77
  1045. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/TimelockReentrant.sol +0 -26
  1046. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/TimersBlockNumberImpl.sol +0 -39
  1047. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/TimersTimestampImpl.sol +0 -39
  1048. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/VotesMock.sol +0 -45
  1049. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/compound/CompTimelock.sol +0 -174
  1050. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/crosschain/bridges.sol +0 -94
  1051. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/crosschain/receivers.sol +0 -54
  1052. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/docs/ERC4626Fees.sol +0 -100
  1053. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/docs/governance/MyGovernor.sol +0 -88
  1054. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/docs/governance/MyToken.sol +0 -24
  1055. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/docs/governance/MyTokenTimestampBased.sol +0 -35
  1056. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/docs/governance/MyTokenWrapped.sol +0 -31
  1057. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/governance/GovernorCompMock.sol +0 -20
  1058. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/governance/GovernorCompatibilityBravoMock.sol +0 -100
  1059. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/governance/GovernorMock.sol +0 -28
  1060. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/governance/GovernorPreventLateQuorumMock.sol +0 -45
  1061. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/governance/GovernorTimelockCompoundMock.sol +0 -60
  1062. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/governance/GovernorTimelockControlMock.sol +0 -60
  1063. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/governance/GovernorVoteMock.sol +0 -20
  1064. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/governance/GovernorWithParamsMock.sol +0 -50
  1065. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/proxy/BadBeacon.sol +0 -11
  1066. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/proxy/ClashingImplementation.sol +0 -17
  1067. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/proxy/UUPSLegacy.sol +0 -54
  1068. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/proxy/UUPSUpgradeableMock.sol +0 -33
  1069. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/token/ERC1155ReceiverMock.sol +0 -47
  1070. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/token/ERC20DecimalsMock.sol +0 -17
  1071. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/token/ERC20ExcessDecimalsMock.sol +0 -9
  1072. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/token/ERC20FlashMintMock.sol +0 -26
  1073. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/token/ERC20ForceApproveMock.sol +0 -13
  1074. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/token/ERC20MulticallMock.sol +0 -8
  1075. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/token/ERC20NoReturnMock.sol +0 -28
  1076. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/token/ERC20PermitNoRevertMock.sol +0 -36
  1077. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/token/ERC20ReturnFalseMock.sol +0 -19
  1078. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/token/ERC20VotesLegacyMock.sol +0 -262
  1079. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/token/ERC4626OffsetMock.sol +0 -17
  1080. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/token/ERC4646FeesMock.sol +0 -40
  1081. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/token/ERC721ConsecutiveEnumerableMock.sol +0 -51
  1082. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/token/ERC721ConsecutiveMock.sol +0 -61
  1083. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/token/ERC721ReceiverMock.sol +0 -42
  1084. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/token/ERC721URIStorageMock.sol +0 -17
  1085. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/token/ERC777Mock.sol +0 -13
  1086. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/token/ERC777SenderRecipientMock.sol +0 -152
  1087. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/token/VotesTimestamp.sol +0 -40
  1088. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/wizard/MyGovernor1.sol +0 -79
  1089. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/wizard/MyGovernor2.sol +0 -85
  1090. package/test/contracts/lib/openzeppelin-contracts/contracts/mocks/wizard/MyGovernor3.sol +0 -94
  1091. package/test/contracts/lib/openzeppelin-contracts/contracts/package.json +0 -32
  1092. package/test/contracts/lib/openzeppelin-contracts/contracts/proxy/Clones.sol +0 -88
  1093. package/test/contracts/lib/openzeppelin-contracts/contracts/proxy/ERC1967/ERC1967Proxy.sol +0 -32
  1094. package/test/contracts/lib/openzeppelin-contracts/contracts/proxy/ERC1967/ERC1967Upgrade.sol +0 -157
  1095. package/test/contracts/lib/openzeppelin-contracts/contracts/proxy/Proxy.sol +0 -86
  1096. package/test/contracts/lib/openzeppelin-contracts/contracts/proxy/README.adoc +0 -87
  1097. package/test/contracts/lib/openzeppelin-contracts/contracts/proxy/beacon/BeaconProxy.sol +0 -61
  1098. package/test/contracts/lib/openzeppelin-contracts/contracts/proxy/beacon/IBeacon.sol +0 -16
  1099. package/test/contracts/lib/openzeppelin-contracts/contracts/proxy/beacon/UpgradeableBeacon.sol +0 -65
  1100. package/test/contracts/lib/openzeppelin-contracts/contracts/proxy/transparent/ProxyAdmin.sol +0 -81
  1101. package/test/contracts/lib/openzeppelin-contracts/contracts/proxy/transparent/TransparentUpgradeableProxy.sol +0 -191
  1102. package/test/contracts/lib/openzeppelin-contracts/contracts/proxy/utils/Initializable.sol +0 -166
  1103. package/test/contracts/lib/openzeppelin-contracts/contracts/proxy/utils/UUPSUpgradeable.sol +0 -99
  1104. package/test/contracts/lib/openzeppelin-contracts/contracts/security/Pausable.sol +0 -105
  1105. package/test/contracts/lib/openzeppelin-contracts/contracts/security/PullPayment.sol +0 -74
  1106. package/test/contracts/lib/openzeppelin-contracts/contracts/security/README.adoc +0 -20
  1107. package/test/contracts/lib/openzeppelin-contracts/contracts/security/ReentrancyGuard.sol +0 -77
  1108. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC1155/ERC1155.sol +0 -497
  1109. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC1155/IERC1155.sol +0 -119
  1110. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC1155/IERC1155Receiver.sol +0 -58
  1111. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC1155/README.adoc +0 -49
  1112. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC1155/extensions/ERC1155Burnable.sol +0 -32
  1113. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC1155/extensions/ERC1155Pausable.sol +0 -44
  1114. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC1155/extensions/ERC1155Supply.sol +0 -64
  1115. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC1155/extensions/ERC1155URIStorage.sol +0 -63
  1116. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol +0 -22
  1117. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC1155/presets/ERC1155PresetMinterPauser.sol +0 -114
  1118. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC1155/presets/README.md +0 -1
  1119. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC1155/utils/ERC1155Holder.sol +0 -36
  1120. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC1155/utils/ERC1155Receiver.sol +0 -19
  1121. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol +0 -365
  1122. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol +0 -78
  1123. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC20/README.adoc +0 -80
  1124. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC20/extensions/ERC20Burnable.sol +0 -39
  1125. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC20/extensions/ERC20Capped.sol +0 -37
  1126. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC20/extensions/ERC20FlashMint.sol +0 -109
  1127. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC20/extensions/ERC20Pausable.sol +0 -35
  1128. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC20/extensions/ERC20Permit.sol +0 -95
  1129. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC20/extensions/ERC20Snapshot.sol +0 -191
  1130. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC20/extensions/ERC20Votes.sol +0 -290
  1131. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC20/extensions/ERC20VotesComp.sol +0 -46
  1132. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC20/extensions/ERC20Wrapper.sol +0 -73
  1133. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC20/extensions/ERC4626.sol +0 -256
  1134. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol +0 -28
  1135. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Permit.sol +0 -90
  1136. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC20/extensions/draft-ERC20Permit.sol +0 -8
  1137. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC20/extensions/draft-IERC20Permit.sol +0 -8
  1138. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC20/presets/ERC20PresetFixedSupply.sol +0 -30
  1139. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC20/presets/ERC20PresetMinterPauser.sol +0 -94
  1140. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC20/presets/README.md +0 -1
  1141. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol +0 -143
  1142. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC20/utils/TokenTimelock.sol +0 -72
  1143. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC721/ERC721.sol +0 -466
  1144. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC721/IERC721.sol +0 -132
  1145. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC721/IERC721Receiver.sol +0 -27
  1146. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC721/README.adoc +0 -73
  1147. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC721/extensions/ERC721Burnable.sol +0 -26
  1148. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC721/extensions/ERC721Consecutive.sol +0 -148
  1149. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC721/extensions/ERC721Enumerable.sol +0 -159
  1150. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC721/extensions/ERC721Pausable.sol +0 -40
  1151. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC721/extensions/ERC721Royalty.sol +0 -38
  1152. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC721/extensions/ERC721URIStorage.sol +0 -74
  1153. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC721/extensions/ERC721Votes.sol +0 -43
  1154. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC721/extensions/ERC721Wrapper.sol +0 -97
  1155. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC721/extensions/IERC721Enumerable.sol +0 -29
  1156. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC721/extensions/IERC721Metadata.sol +0 -27
  1157. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC721/extensions/draft-ERC721Votes.sol +0 -9
  1158. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC721/presets/ERC721PresetMinterPauserAutoId.sol +0 -132
  1159. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC721/presets/README.md +0 -1
  1160. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC721/utils/ERC721Holder.sol +0 -23
  1161. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC777/ERC777.sol +0 -514
  1162. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC777/IERC777.sol +0 -200
  1163. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC777/IERC777Recipient.sol +0 -35
  1164. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC777/IERC777Sender.sol +0 -35
  1165. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC777/README.adoc +0 -32
  1166. package/test/contracts/lib/openzeppelin-contracts/contracts/token/ERC777/presets/ERC777PresetFixedSupply.sol +0 -30
  1167. package/test/contracts/lib/openzeppelin-contracts/contracts/token/common/ERC2981.sol +0 -107
  1168. package/test/contracts/lib/openzeppelin-contracts/contracts/token/common/README.adoc +0 -10
  1169. package/test/contracts/lib/openzeppelin-contracts/contracts/utils/Address.sol +0 -244
  1170. package/test/contracts/lib/openzeppelin-contracts/contracts/utils/Arrays.sol +0 -105
  1171. package/test/contracts/lib/openzeppelin-contracts/contracts/utils/Base64.sol +0 -101
  1172. package/test/contracts/lib/openzeppelin-contracts/contracts/utils/Checkpoints.sol +0 -560
  1173. package/test/contracts/lib/openzeppelin-contracts/contracts/utils/Context.sol +0 -28
  1174. package/test/contracts/lib/openzeppelin-contracts/contracts/utils/Counters.sol +0 -43
  1175. package/test/contracts/lib/openzeppelin-contracts/contracts/utils/Create2.sol +0 -75
  1176. package/test/contracts/lib/openzeppelin-contracts/contracts/utils/Multicall.sol +0 -39
  1177. package/test/contracts/lib/openzeppelin-contracts/contracts/utils/README.adoc +0 -113
  1178. package/test/contracts/lib/openzeppelin-contracts/contracts/utils/ShortStrings.sol +0 -122
  1179. package/test/contracts/lib/openzeppelin-contracts/contracts/utils/StorageSlot.sol +0 -138
  1180. package/test/contracts/lib/openzeppelin-contracts/contracts/utils/Strings.sol +0 -85
  1181. package/test/contracts/lib/openzeppelin-contracts/contracts/utils/Timers.sol +0 -75
  1182. package/test/contracts/lib/openzeppelin-contracts/contracts/utils/cryptography/ECDSA.sol +0 -217
  1183. package/test/contracts/lib/openzeppelin-contracts/contracts/utils/cryptography/EIP712.sol +0 -142
  1184. package/test/contracts/lib/openzeppelin-contracts/contracts/utils/cryptography/MerkleProof.sol +0 -227
  1185. package/test/contracts/lib/openzeppelin-contracts/contracts/utils/cryptography/SignatureChecker.sol +0 -50
  1186. package/test/contracts/lib/openzeppelin-contracts/contracts/utils/cryptography/draft-EIP712.sol +0 -8
  1187. package/test/contracts/lib/openzeppelin-contracts/contracts/utils/escrow/ConditionalEscrow.sol +0 -25
  1188. package/test/contracts/lib/openzeppelin-contracts/contracts/utils/escrow/Escrow.sol +0 -67
  1189. package/test/contracts/lib/openzeppelin-contracts/contracts/utils/escrow/RefundEscrow.sol +0 -100
  1190. package/test/contracts/lib/openzeppelin-contracts/contracts/utils/introspection/ERC165.sol +0 -29
  1191. package/test/contracts/lib/openzeppelin-contracts/contracts/utils/introspection/ERC165Checker.sol +0 -126
  1192. package/test/contracts/lib/openzeppelin-contracts/contracts/utils/introspection/ERC165Storage.sol +0 -42
  1193. package/test/contracts/lib/openzeppelin-contracts/contracts/utils/introspection/ERC1820Implementer.sol +0 -43
  1194. package/test/contracts/lib/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol +0 -25
  1195. package/test/contracts/lib/openzeppelin-contracts/contracts/utils/introspection/IERC1820Implementer.sol +0 -20
  1196. package/test/contracts/lib/openzeppelin-contracts/contracts/utils/introspection/IERC1820Registry.sol +0 -112
  1197. package/test/contracts/lib/openzeppelin-contracts/contracts/utils/math/Math.sol +0 -339
  1198. package/test/contracts/lib/openzeppelin-contracts/contracts/utils/math/SafeCast.sol +0 -1136
  1199. package/test/contracts/lib/openzeppelin-contracts/contracts/utils/math/SafeMath.sol +0 -215
  1200. package/test/contracts/lib/openzeppelin-contracts/contracts/utils/math/SignedMath.sol +0 -43
  1201. package/test/contracts/lib/openzeppelin-contracts/contracts/utils/math/SignedSafeMath.sol +0 -68
  1202. package/test/contracts/lib/openzeppelin-contracts/contracts/utils/structs/BitMaps.sol +0 -51
  1203. package/test/contracts/lib/openzeppelin-contracts/contracts/utils/structs/DoubleEndedQueue.sol +0 -170
  1204. package/test/contracts/lib/openzeppelin-contracts/contracts/utils/structs/EnumerableMap.sol +0 -598
  1205. package/test/contracts/lib/openzeppelin-contracts/contracts/utils/structs/EnumerableSet.sol +0 -378
  1206. package/test/contracts/lib/openzeppelin-contracts/contracts/vendor/amb/IAMB.sol +0 -41
  1207. package/test/contracts/lib/openzeppelin-contracts/contracts/vendor/arbitrum/IArbSys.sol +0 -134
  1208. package/test/contracts/lib/openzeppelin-contracts/contracts/vendor/arbitrum/IBridge.sol +0 -102
  1209. package/test/contracts/lib/openzeppelin-contracts/contracts/vendor/arbitrum/IDelayedMessageProvider.sol +0 -16
  1210. package/test/contracts/lib/openzeppelin-contracts/contracts/vendor/arbitrum/IInbox.sol +0 -152
  1211. package/test/contracts/lib/openzeppelin-contracts/contracts/vendor/arbitrum/IOutbox.sol +0 -117
  1212. package/test/contracts/lib/openzeppelin-contracts/contracts/vendor/compound/ICompoundTimelock.sol +0 -86
  1213. package/test/contracts/lib/openzeppelin-contracts/contracts/vendor/compound/LICENSE +0 -11
  1214. package/test/contracts/lib/openzeppelin-contracts/contracts/vendor/optimism/ICrossDomainMessenger.sol +0 -34
  1215. package/test/contracts/lib/openzeppelin-contracts/contracts/vendor/optimism/LICENSE +0 -22
  1216. package/test/contracts/lib/openzeppelin-contracts/contracts/vendor/polygon/IFxMessageProcessor.sol +0 -7
  1217. package/test/contracts/lib/openzeppelin-contracts/docs/README.md +0 -16
  1218. package/test/contracts/lib/openzeppelin-contracts/docs/antora.yml +0 -6
  1219. package/test/contracts/lib/openzeppelin-contracts/docs/config.js +0 -21
  1220. package/test/contracts/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-attack-3a.png +0 -0
  1221. package/test/contracts/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-attack-3b.png +0 -0
  1222. package/test/contracts/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-attack-6.png +0 -0
  1223. package/test/contracts/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-attack.png +0 -0
  1224. package/test/contracts/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-deposit.png +0 -0
  1225. package/test/contracts/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-mint.png +0 -0
  1226. package/test/contracts/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-rate-linear.png +0 -0
  1227. package/test/contracts/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-rate-loglog.png +0 -0
  1228. package/test/contracts/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-rate-loglogext.png +0 -0
  1229. package/test/contracts/lib/openzeppelin-contracts/docs/modules/ROOT/images/tally-exec.png +0 -0
  1230. package/test/contracts/lib/openzeppelin-contracts/docs/modules/ROOT/images/tally-vote.png +0 -0
  1231. package/test/contracts/lib/openzeppelin-contracts/docs/modules/ROOT/nav.adoc +0 -23
  1232. package/test/contracts/lib/openzeppelin-contracts/docs/modules/ROOT/pages/access-control.adoc +0 -219
  1233. package/test/contracts/lib/openzeppelin-contracts/docs/modules/ROOT/pages/crosschain.adoc +0 -210
  1234. package/test/contracts/lib/openzeppelin-contracts/docs/modules/ROOT/pages/crowdsales.adoc +0 -11
  1235. package/test/contracts/lib/openzeppelin-contracts/docs/modules/ROOT/pages/drafts.adoc +0 -19
  1236. package/test/contracts/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc1155.adoc +0 -153
  1237. package/test/contracts/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc20-supply.adoc +0 -113
  1238. package/test/contracts/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc20.adoc +0 -85
  1239. package/test/contracts/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc4626.adoc +0 -214
  1240. package/test/contracts/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc721.adoc +0 -90
  1241. package/test/contracts/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc777.adoc +0 -75
  1242. package/test/contracts/lib/openzeppelin-contracts/docs/modules/ROOT/pages/extending-contracts.adoc +0 -131
  1243. package/test/contracts/lib/openzeppelin-contracts/docs/modules/ROOT/pages/governance.adoc +0 -237
  1244. package/test/contracts/lib/openzeppelin-contracts/docs/modules/ROOT/pages/index.adoc +0 -65
  1245. package/test/contracts/lib/openzeppelin-contracts/docs/modules/ROOT/pages/releases-stability.adoc +0 -85
  1246. package/test/contracts/lib/openzeppelin-contracts/docs/modules/ROOT/pages/tokens.adoc +0 -32
  1247. package/test/contracts/lib/openzeppelin-contracts/docs/modules/ROOT/pages/upgradeable.adoc +0 -73
  1248. package/test/contracts/lib/openzeppelin-contracts/docs/modules/ROOT/pages/utilities.adoc +0 -190
  1249. package/test/contracts/lib/openzeppelin-contracts/docs/templates/contract.hbs +0 -85
  1250. package/test/contracts/lib/openzeppelin-contracts/docs/templates/helpers.js +0 -46
  1251. package/test/contracts/lib/openzeppelin-contracts/docs/templates/page.hbs +0 -4
  1252. package/test/contracts/lib/openzeppelin-contracts/docs/templates/properties.js +0 -45
  1253. package/test/contracts/lib/openzeppelin-contracts/foundry.toml +0 -3
  1254. package/test/contracts/lib/openzeppelin-contracts/hardhat/env-artifacts.js +0 -24
  1255. package/test/contracts/lib/openzeppelin-contracts/hardhat/env-contract.js +0 -10
  1256. package/test/contracts/lib/openzeppelin-contracts/hardhat/ignore-unreachable-warnings.js +0 -45
  1257. package/test/contracts/lib/openzeppelin-contracts/hardhat/skip-foundry-tests.js +0 -6
  1258. package/test/contracts/lib/openzeppelin-contracts/hardhat/task-test-get-files.js +0 -25
  1259. package/test/contracts/lib/openzeppelin-contracts/hardhat.config.js +0 -118
  1260. package/test/contracts/lib/openzeppelin-contracts/lib/erc4626-tests/ERC4626.prop.sol +0 -404
  1261. package/test/contracts/lib/openzeppelin-contracts/lib/erc4626-tests/ERC4626.test.sol +0 -349
  1262. package/test/contracts/lib/openzeppelin-contracts/lib/erc4626-tests/LICENSE +0 -661
  1263. package/test/contracts/lib/openzeppelin-contracts/lib/erc4626-tests/README.md +0 -116
  1264. package/test/contracts/lib/openzeppelin-contracts/lib/forge-std/.github/workflows/ci.yml +0 -92
  1265. package/test/contracts/lib/openzeppelin-contracts/lib/forge-std/.gitmodules +0 -3
  1266. package/test/contracts/lib/openzeppelin-contracts/lib/forge-std/LICENSE-APACHE +0 -203
  1267. package/test/contracts/lib/openzeppelin-contracts/lib/forge-std/LICENSE-MIT +0 -25
  1268. package/test/contracts/lib/openzeppelin-contracts/lib/forge-std/README.md +0 -250
  1269. package/test/contracts/lib/openzeppelin-contracts/lib/forge-std/foundry.toml +0 -21
  1270. package/test/contracts/lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/.github/workflows/build.yml +0 -41
  1271. package/test/contracts/lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/LICENSE +0 -674
  1272. package/test/contracts/lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/Makefile +0 -14
  1273. package/test/contracts/lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/default.nix +0 -4
  1274. package/test/contracts/lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/demo/demo.sol +0 -222
  1275. package/test/contracts/lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/package.json +0 -15
  1276. package/test/contracts/lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/test.sol +0 -469
  1277. package/test/contracts/lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/test.t.sol +0 -313
  1278. package/test/contracts/lib/openzeppelin-contracts/lib/forge-std/package.json +0 -16
  1279. package/test/contracts/lib/openzeppelin-contracts/lib/forge-std/src/Base.sol +0 -33
  1280. package/test/contracts/lib/openzeppelin-contracts/lib/forge-std/src/Script.sol +0 -26
  1281. package/test/contracts/lib/openzeppelin-contracts/lib/forge-std/src/StdAssertions.sol +0 -376
  1282. package/test/contracts/lib/openzeppelin-contracts/lib/forge-std/src/StdChains.sol +0 -233
  1283. package/test/contracts/lib/openzeppelin-contracts/lib/forge-std/src/StdCheats.sol +0 -624
  1284. package/test/contracts/lib/openzeppelin-contracts/lib/forge-std/src/StdError.sol +0 -15
  1285. package/test/contracts/lib/openzeppelin-contracts/lib/forge-std/src/StdInvariant.sol +0 -92
  1286. package/test/contracts/lib/openzeppelin-contracts/lib/forge-std/src/StdJson.sol +0 -179
  1287. package/test/contracts/lib/openzeppelin-contracts/lib/forge-std/src/StdMath.sol +0 -43
  1288. package/test/contracts/lib/openzeppelin-contracts/lib/forge-std/src/StdStorage.sol +0 -327
  1289. package/test/contracts/lib/openzeppelin-contracts/lib/forge-std/src/StdStyle.sol +0 -333
  1290. package/test/contracts/lib/openzeppelin-contracts/lib/forge-std/src/StdUtils.sol +0 -189
  1291. package/test/contracts/lib/openzeppelin-contracts/lib/forge-std/src/Test.sol +0 -32
  1292. package/test/contracts/lib/openzeppelin-contracts/lib/forge-std/src/Vm.sol +0 -409
  1293. package/test/contracts/lib/openzeppelin-contracts/lib/forge-std/src/console.sol +0 -1533
  1294. package/test/contracts/lib/openzeppelin-contracts/lib/forge-std/src/console2.sol +0 -1546
  1295. package/test/contracts/lib/openzeppelin-contracts/lib/forge-std/src/interfaces/IERC1155.sol +0 -105
  1296. package/test/contracts/lib/openzeppelin-contracts/lib/forge-std/src/interfaces/IERC165.sol +0 -12
  1297. package/test/contracts/lib/openzeppelin-contracts/lib/forge-std/src/interfaces/IERC20.sol +0 -43
  1298. package/test/contracts/lib/openzeppelin-contracts/lib/forge-std/src/interfaces/IERC4626.sol +0 -190
  1299. package/test/contracts/lib/openzeppelin-contracts/lib/forge-std/src/interfaces/IERC721.sol +0 -164
  1300. package/test/contracts/lib/openzeppelin-contracts/lib/forge-std/src/interfaces/IMulticall3.sol +0 -73
  1301. package/test/contracts/lib/openzeppelin-contracts/lib/forge-std/test/StdAssertions.t.sol +0 -954
  1302. package/test/contracts/lib/openzeppelin-contracts/lib/forge-std/test/StdChains.t.sol +0 -160
  1303. package/test/contracts/lib/openzeppelin-contracts/lib/forge-std/test/StdCheats.t.sol +0 -401
  1304. package/test/contracts/lib/openzeppelin-contracts/lib/forge-std/test/StdError.t.sol +0 -118
  1305. package/test/contracts/lib/openzeppelin-contracts/lib/forge-std/test/StdMath.t.sol +0 -197
  1306. package/test/contracts/lib/openzeppelin-contracts/lib/forge-std/test/StdStorage.t.sol +0 -283
  1307. package/test/contracts/lib/openzeppelin-contracts/lib/forge-std/test/StdStyle.t.sol +0 -110
  1308. package/test/contracts/lib/openzeppelin-contracts/lib/forge-std/test/StdUtils.t.sol +0 -297
  1309. package/test/contracts/lib/openzeppelin-contracts/lib/forge-std/test/compilation/CompilationScript.sol +0 -10
  1310. package/test/contracts/lib/openzeppelin-contracts/lib/forge-std/test/compilation/CompilationScriptBase.sol +0 -10
  1311. package/test/contracts/lib/openzeppelin-contracts/lib/forge-std/test/compilation/CompilationTest.sol +0 -10
  1312. package/test/contracts/lib/openzeppelin-contracts/lib/forge-std/test/compilation/CompilationTestBase.sol +0 -10
  1313. package/test/contracts/lib/openzeppelin-contracts/lib/forge-std/test/fixtures/broadcast.log.json +0 -187
  1314. package/test/contracts/lib/openzeppelin-contracts/logo.svg +0 -15
  1315. package/test/contracts/lib/openzeppelin-contracts/netlify.toml +0 -3
  1316. package/test/contracts/lib/openzeppelin-contracts/package-lock.json +0 -28795
  1317. package/test/contracts/lib/openzeppelin-contracts/package.json +0 -96
  1318. package/test/contracts/lib/openzeppelin-contracts/remappings.txt +0 -1
  1319. package/test/contracts/lib/openzeppelin-contracts/renovate.json +0 -4
  1320. package/test/contracts/lib/openzeppelin-contracts/requirements.txt +0 -1
  1321. package/test/contracts/lib/openzeppelin-contracts/scripts/checks/compare-layout.js +0 -19
  1322. package/test/contracts/lib/openzeppelin-contracts/scripts/checks/compareGasReports.js +0 -243
  1323. package/test/contracts/lib/openzeppelin-contracts/scripts/checks/extract-layout.js +0 -40
  1324. package/test/contracts/lib/openzeppelin-contracts/scripts/checks/generation.sh +0 -6
  1325. package/test/contracts/lib/openzeppelin-contracts/scripts/checks/inheritance-ordering.js +0 -54
  1326. package/test/contracts/lib/openzeppelin-contracts/scripts/gen-nav.js +0 -41
  1327. package/test/contracts/lib/openzeppelin-contracts/scripts/generate/format-lines.js +0 -16
  1328. package/test/contracts/lib/openzeppelin-contracts/scripts/generate/run.js +0 -49
  1329. package/test/contracts/lib/openzeppelin-contracts/scripts/generate/templates/Checkpoints.js +0 -304
  1330. package/test/contracts/lib/openzeppelin-contracts/scripts/generate/templates/Checkpoints.opts.js +0 -22
  1331. package/test/contracts/lib/openzeppelin-contracts/scripts/generate/templates/Checkpoints.t.js +0 -256
  1332. package/test/contracts/lib/openzeppelin-contracts/scripts/generate/templates/EnumerableMap.js +0 -310
  1333. package/test/contracts/lib/openzeppelin-contracts/scripts/generate/templates/EnumerableSet.js +0 -250
  1334. package/test/contracts/lib/openzeppelin-contracts/scripts/generate/templates/SafeCast.js +0 -163
  1335. package/test/contracts/lib/openzeppelin-contracts/scripts/generate/templates/StorageSlot.js +0 -87
  1336. package/test/contracts/lib/openzeppelin-contracts/scripts/generate/templates/conversion.js +0 -30
  1337. package/test/contracts/lib/openzeppelin-contracts/scripts/git-user-config.sh +0 -6
  1338. package/test/contracts/lib/openzeppelin-contracts/scripts/helpers.js +0 -37
  1339. package/test/contracts/lib/openzeppelin-contracts/scripts/migrate-imports.js +0 -180
  1340. package/test/contracts/lib/openzeppelin-contracts/scripts/prepack.sh +0 -12
  1341. package/test/contracts/lib/openzeppelin-contracts/scripts/prepare-contracts-package.sh +0 -15
  1342. package/test/contracts/lib/openzeppelin-contracts/scripts/prepare-docs.sh +0 -26
  1343. package/test/contracts/lib/openzeppelin-contracts/scripts/prepare.sh +0 -10
  1344. package/test/contracts/lib/openzeppelin-contracts/scripts/release/format-changelog.js +0 -33
  1345. package/test/contracts/lib/openzeppelin-contracts/scripts/release/synchronize-versions.js +0 -15
  1346. package/test/contracts/lib/openzeppelin-contracts/scripts/release/update-comment.js +0 -34
  1347. package/test/contracts/lib/openzeppelin-contracts/scripts/release/version.sh +0 -11
  1348. package/test/contracts/lib/openzeppelin-contracts/scripts/release/workflow/exit-prerelease.sh +0 -8
  1349. package/test/contracts/lib/openzeppelin-contracts/scripts/release/workflow/github-release.js +0 -47
  1350. package/test/contracts/lib/openzeppelin-contracts/scripts/release/workflow/integrity-check.sh +0 -20
  1351. package/test/contracts/lib/openzeppelin-contracts/scripts/release/workflow/pack.sh +0 -26
  1352. package/test/contracts/lib/openzeppelin-contracts/scripts/release/workflow/publish.sh +0 -26
  1353. package/test/contracts/lib/openzeppelin-contracts/scripts/release/workflow/rerun.js +0 -7
  1354. package/test/contracts/lib/openzeppelin-contracts/scripts/release/workflow/set-changesets-pr-title.js +0 -17
  1355. package/test/contracts/lib/openzeppelin-contracts/scripts/release/workflow/start.sh +0 -35
  1356. package/test/contracts/lib/openzeppelin-contracts/scripts/release/workflow/state.js +0 -112
  1357. package/test/contracts/lib/openzeppelin-contracts/scripts/remove-ignored-artifacts.js +0 -45
  1358. package/test/contracts/lib/openzeppelin-contracts/scripts/update-docs-branch.js +0 -63
  1359. package/test/contracts/lib/openzeppelin-contracts/scripts/upgradeable/README.md +0 -21
  1360. package/test/contracts/lib/openzeppelin-contracts/scripts/upgradeable/patch-apply.sh +0 -19
  1361. package/test/contracts/lib/openzeppelin-contracts/scripts/upgradeable/patch-save.sh +0 -18
  1362. package/test/contracts/lib/openzeppelin-contracts/scripts/upgradeable/transpile-onto.sh +0 -44
  1363. package/test/contracts/lib/openzeppelin-contracts/scripts/upgradeable/transpile.sh +0 -35
  1364. package/test/contracts/lib/openzeppelin-contracts/scripts/upgradeable/upgradeable.patch +0 -481
  1365. package/test/contracts/lib/openzeppelin-contracts/slither.config.json +0 -5
  1366. package/test/contracts/lib/openzeppelin-contracts/test/TESTING.md +0 -3
  1367. package/test/contracts/lib/openzeppelin-contracts/test/access/AccessControl.behavior.js +0 -867
  1368. package/test/contracts/lib/openzeppelin-contracts/test/access/AccessControl.test.js +0 -12
  1369. package/test/contracts/lib/openzeppelin-contracts/test/access/AccessControlCrossChain.test.js +0 -49
  1370. package/test/contracts/lib/openzeppelin-contracts/test/access/AccessControlDefaultAdminRules.test.js +0 -25
  1371. package/test/contracts/lib/openzeppelin-contracts/test/access/AccessControlEnumerable.test.js +0 -17
  1372. package/test/contracts/lib/openzeppelin-contracts/test/access/Ownable.test.js +0 -59
  1373. package/test/contracts/lib/openzeppelin-contracts/test/access/Ownable2Step.test.js +0 -67
  1374. package/test/contracts/lib/openzeppelin-contracts/test/crosschain/CrossChainEnabled.test.js +0 -78
  1375. package/test/contracts/lib/openzeppelin-contracts/test/finance/PaymentSplitter.test.js +0 -217
  1376. package/test/contracts/lib/openzeppelin-contracts/test/finance/VestingWallet.behavior.js +0 -59
  1377. package/test/contracts/lib/openzeppelin-contracts/test/finance/VestingWallet.test.js +0 -67
  1378. package/test/contracts/lib/openzeppelin-contracts/test/governance/Governor.t.sol +0 -55
  1379. package/test/contracts/lib/openzeppelin-contracts/test/governance/Governor.test.js +0 -782
  1380. package/test/contracts/lib/openzeppelin-contracts/test/governance/TimelockController.test.js +0 -1254
  1381. package/test/contracts/lib/openzeppelin-contracts/test/governance/compatibility/GovernorCompatibilityBravo.test.js +0 -283
  1382. package/test/contracts/lib/openzeppelin-contracts/test/governance/extensions/GovernorComp.test.js +0 -88
  1383. package/test/contracts/lib/openzeppelin-contracts/test/governance/extensions/GovernorERC721.test.js +0 -115
  1384. package/test/contracts/lib/openzeppelin-contracts/test/governance/extensions/GovernorPreventLateQuorum.test.js +0 -189
  1385. package/test/contracts/lib/openzeppelin-contracts/test/governance/extensions/GovernorTimelockCompound.test.js +0 -352
  1386. package/test/contracts/lib/openzeppelin-contracts/test/governance/extensions/GovernorTimelockControl.test.js +0 -445
  1387. package/test/contracts/lib/openzeppelin-contracts/test/governance/extensions/GovernorVotesQuorumFraction.test.js +0 -154
  1388. package/test/contracts/lib/openzeppelin-contracts/test/governance/extensions/GovernorWithParams.test.js +0 -173
  1389. package/test/contracts/lib/openzeppelin-contracts/test/governance/utils/EIP6372.behavior.js +0 -23
  1390. package/test/contracts/lib/openzeppelin-contracts/test/governance/utils/Votes.behavior.js +0 -361
  1391. package/test/contracts/lib/openzeppelin-contracts/test/governance/utils/Votes.test.js +0 -71
  1392. package/test/contracts/lib/openzeppelin-contracts/test/helpers/chainid.js +0 -10
  1393. package/test/contracts/lib/openzeppelin-contracts/test/helpers/create2.js +0 -11
  1394. package/test/contracts/lib/openzeppelin-contracts/test/helpers/crosschain.js +0 -61
  1395. package/test/contracts/lib/openzeppelin-contracts/test/helpers/customError.js +0 -24
  1396. package/test/contracts/lib/openzeppelin-contracts/test/helpers/eip712.js +0 -67
  1397. package/test/contracts/lib/openzeppelin-contracts/test/helpers/enums.js +0 -12
  1398. package/test/contracts/lib/openzeppelin-contracts/test/helpers/erc1967.js +0 -24
  1399. package/test/contracts/lib/openzeppelin-contracts/test/helpers/governance.js +0 -201
  1400. package/test/contracts/lib/openzeppelin-contracts/test/helpers/map-values.js +0 -7
  1401. package/test/contracts/lib/openzeppelin-contracts/test/helpers/sign.js +0 -63
  1402. package/test/contracts/lib/openzeppelin-contracts/test/helpers/time.js +0 -17
  1403. package/test/contracts/lib/openzeppelin-contracts/test/helpers/txpool.js +0 -38
  1404. package/test/contracts/lib/openzeppelin-contracts/test/metatx/ERC2771Context.test.js +0 -175
  1405. package/test/contracts/lib/openzeppelin-contracts/test/metatx/MinimalForwarder.test.js +0 -169
  1406. package/test/contracts/lib/openzeppelin-contracts/test/migrate-imports.test.js +0 -33
  1407. package/test/contracts/lib/openzeppelin-contracts/test/proxy/Clones.behaviour.js +0 -136
  1408. package/test/contracts/lib/openzeppelin-contracts/test/proxy/Clones.test.js +0 -61
  1409. package/test/contracts/lib/openzeppelin-contracts/test/proxy/ERC1967/ERC1967Proxy.test.js +0 -13
  1410. package/test/contracts/lib/openzeppelin-contracts/test/proxy/Proxy.behaviour.js +0 -225
  1411. package/test/contracts/lib/openzeppelin-contracts/test/proxy/beacon/BeaconProxy.test.js +0 -139
  1412. package/test/contracts/lib/openzeppelin-contracts/test/proxy/beacon/UpgradeableBeacon.test.js +0 -44
  1413. package/test/contracts/lib/openzeppelin-contracts/test/proxy/transparent/ProxyAdmin.test.js +0 -127
  1414. package/test/contracts/lib/openzeppelin-contracts/test/proxy/transparent/TransparentUpgradeableProxy.behaviour.js +0 -433
  1415. package/test/contracts/lib/openzeppelin-contracts/test/proxy/transparent/TransparentUpgradeableProxy.test.js +0 -17
  1416. package/test/contracts/lib/openzeppelin-contracts/test/proxy/utils/Initializable.test.js +0 -218
  1417. package/test/contracts/lib/openzeppelin-contracts/test/proxy/utils/UUPSUpgradeable.test.js +0 -85
  1418. package/test/contracts/lib/openzeppelin-contracts/test/security/Pausable.test.js +0 -85
  1419. package/test/contracts/lib/openzeppelin-contracts/test/security/PullPayment.test.js +0 -51
  1420. package/test/contracts/lib/openzeppelin-contracts/test/security/ReentrancyGuard.test.js +0 -43
  1421. package/test/contracts/lib/openzeppelin-contracts/test/token/ERC1155/ERC1155.behavior.js +0 -767
  1422. package/test/contracts/lib/openzeppelin-contracts/test/token/ERC1155/ERC1155.test.js +0 -235
  1423. package/test/contracts/lib/openzeppelin-contracts/test/token/ERC1155/extensions/ERC1155Burnable.test.js +0 -67
  1424. package/test/contracts/lib/openzeppelin-contracts/test/token/ERC1155/extensions/ERC1155Pausable.test.js +0 -108
  1425. package/test/contracts/lib/openzeppelin-contracts/test/token/ERC1155/extensions/ERC1155Supply.test.js +0 -107
  1426. package/test/contracts/lib/openzeppelin-contracts/test/token/ERC1155/extensions/ERC1155URIStorage.test.js +0 -66
  1427. package/test/contracts/lib/openzeppelin-contracts/test/token/ERC1155/presets/ERC1155PresetMinterPauser.test.js +0 -156
  1428. package/test/contracts/lib/openzeppelin-contracts/test/token/ERC1155/utils/ERC1155Holder.test.js +0 -64
  1429. package/test/contracts/lib/openzeppelin-contracts/test/token/ERC20/ERC20.behavior.js +0 -322
  1430. package/test/contracts/lib/openzeppelin-contracts/test/token/ERC20/ERC20.test.js +0 -305
  1431. package/test/contracts/lib/openzeppelin-contracts/test/token/ERC20/extensions/ERC20Burnable.behavior.js +0 -106
  1432. package/test/contracts/lib/openzeppelin-contracts/test/token/ERC20/extensions/ERC20Burnable.test.js +0 -20
  1433. package/test/contracts/lib/openzeppelin-contracts/test/token/ERC20/extensions/ERC20Capped.behavior.js +0 -32
  1434. package/test/contracts/lib/openzeppelin-contracts/test/token/ERC20/extensions/ERC20Capped.test.js +0 -23
  1435. package/test/contracts/lib/openzeppelin-contracts/test/token/ERC20/extensions/ERC20FlashMint.test.js +0 -204
  1436. package/test/contracts/lib/openzeppelin-contracts/test/token/ERC20/extensions/ERC20Pausable.test.js +0 -133
  1437. package/test/contracts/lib/openzeppelin-contracts/test/token/ERC20/extensions/ERC20Snapshot.test.js +0 -207
  1438. package/test/contracts/lib/openzeppelin-contracts/test/token/ERC20/extensions/ERC20Votes.test.js +0 -578
  1439. package/test/contracts/lib/openzeppelin-contracts/test/token/ERC20/extensions/ERC20VotesComp.test.js +0 -543
  1440. package/test/contracts/lib/openzeppelin-contracts/test/token/ERC20/extensions/ERC20Wrapper.test.js +0 -190
  1441. package/test/contracts/lib/openzeppelin-contracts/test/token/ERC20/extensions/ERC4626.t.sol +0 -42
  1442. package/test/contracts/lib/openzeppelin-contracts/test/token/ERC20/extensions/ERC4626.test.js +0 -1031
  1443. package/test/contracts/lib/openzeppelin-contracts/test/token/ERC20/extensions/draft-ERC20Permit.test.js +0 -103
  1444. package/test/contracts/lib/openzeppelin-contracts/test/token/ERC20/presets/ERC20PresetFixedSupply.test.js +0 -42
  1445. package/test/contracts/lib/openzeppelin-contracts/test/token/ERC20/presets/ERC20PresetMinterPauser.test.js +0 -110
  1446. package/test/contracts/lib/openzeppelin-contracts/test/token/ERC20/utils/SafeERC20.test.js +0 -350
  1447. package/test/contracts/lib/openzeppelin-contracts/test/token/ERC20/utils/TokenTimelock.test.js +0 -71
  1448. package/test/contracts/lib/openzeppelin-contracts/test/token/ERC721/ERC721.behavior.js +0 -893
  1449. package/test/contracts/lib/openzeppelin-contracts/test/token/ERC721/ERC721.test.js +0 -15
  1450. package/test/contracts/lib/openzeppelin-contracts/test/token/ERC721/ERC721Enumerable.test.js +0 -20
  1451. package/test/contracts/lib/openzeppelin-contracts/test/token/ERC721/extensions/ERC721Burnable.test.js +0 -70
  1452. package/test/contracts/lib/openzeppelin-contracts/test/token/ERC721/extensions/ERC721Consecutive.t.sol +0 -122
  1453. package/test/contracts/lib/openzeppelin-contracts/test/token/ERC721/extensions/ERC721Consecutive.test.js +0 -206
  1454. package/test/contracts/lib/openzeppelin-contracts/test/token/ERC721/extensions/ERC721Pausable.test.js +0 -92
  1455. package/test/contracts/lib/openzeppelin-contracts/test/token/ERC721/extensions/ERC721Royalty.test.js +0 -41
  1456. package/test/contracts/lib/openzeppelin-contracts/test/token/ERC721/extensions/ERC721URIStorage.test.js +0 -100
  1457. package/test/contracts/lib/openzeppelin-contracts/test/token/ERC721/extensions/ERC721Votes.test.js +0 -184
  1458. package/test/contracts/lib/openzeppelin-contracts/test/token/ERC721/extensions/ERC721Wrapper.test.js +0 -283
  1459. package/test/contracts/lib/openzeppelin-contracts/test/token/ERC721/presets/ERC721PresetMinterPauserAutoId.test.js +0 -122
  1460. package/test/contracts/lib/openzeppelin-contracts/test/token/ERC721/utils/ERC721Holder.test.js +0 -22
  1461. package/test/contracts/lib/openzeppelin-contracts/test/token/ERC777/ERC777.behavior.js +0 -597
  1462. package/test/contracts/lib/openzeppelin-contracts/test/token/ERC777/ERC777.test.js +0 -556
  1463. package/test/contracts/lib/openzeppelin-contracts/test/token/ERC777/presets/ERC777PresetFixedSupply.test.js +0 -49
  1464. package/test/contracts/lib/openzeppelin-contracts/test/token/common/ERC2981.behavior.js +0 -157
  1465. package/test/contracts/lib/openzeppelin-contracts/test/utils/Address.test.js +0 -361
  1466. package/test/contracts/lib/openzeppelin-contracts/test/utils/Arrays.test.js +0 -123
  1467. package/test/contracts/lib/openzeppelin-contracts/test/utils/Base64.test.js +0 -43
  1468. package/test/contracts/lib/openzeppelin-contracts/test/utils/Checkpoints.t.sol +0 -347
  1469. package/test/contracts/lib/openzeppelin-contracts/test/utils/Checkpoints.test.js +0 -255
  1470. package/test/contracts/lib/openzeppelin-contracts/test/utils/Context.behavior.js +0 -42
  1471. package/test/contracts/lib/openzeppelin-contracts/test/utils/Context.test.js +0 -17
  1472. package/test/contracts/lib/openzeppelin-contracts/test/utils/Counters.test.js +0 -84
  1473. package/test/contracts/lib/openzeppelin-contracts/test/utils/Create2.test.js +0 -89
  1474. package/test/contracts/lib/openzeppelin-contracts/test/utils/Multicall.test.js +0 -68
  1475. package/test/contracts/lib/openzeppelin-contracts/test/utils/ShortStrings.t.sol +0 -55
  1476. package/test/contracts/lib/openzeppelin-contracts/test/utils/ShortStrings.test.js +0 -55
  1477. package/test/contracts/lib/openzeppelin-contracts/test/utils/StorageSlot.test.js +0 -210
  1478. package/test/contracts/lib/openzeppelin-contracts/test/utils/Strings.test.js +0 -150
  1479. package/test/contracts/lib/openzeppelin-contracts/test/utils/TimersBlockNumberImpl.test.js +0 -55
  1480. package/test/contracts/lib/openzeppelin-contracts/test/utils/TimersTimestamp.test.js +0 -55
  1481. package/test/contracts/lib/openzeppelin-contracts/test/utils/cryptography/ECDSA.test.js +0 -260
  1482. package/test/contracts/lib/openzeppelin-contracts/test/utils/cryptography/EIP712.test.js +0 -103
  1483. package/test/contracts/lib/openzeppelin-contracts/test/utils/cryptography/MerkleProof.test.js +0 -200
  1484. package/test/contracts/lib/openzeppelin-contracts/test/utils/cryptography/SignatureChecker.test.js +0 -87
  1485. package/test/contracts/lib/openzeppelin-contracts/test/utils/escrow/ConditionalEscrow.test.js +0 -37
  1486. package/test/contracts/lib/openzeppelin-contracts/test/utils/escrow/Escrow.behavior.js +0 -90
  1487. package/test/contracts/lib/openzeppelin-contracts/test/utils/escrow/Escrow.test.js +0 -14
  1488. package/test/contracts/lib/openzeppelin-contracts/test/utils/escrow/RefundEscrow.test.js +0 -143
  1489. package/test/contracts/lib/openzeppelin-contracts/test/utils/introspection/ERC165.test.js +0 -11
  1490. package/test/contracts/lib/openzeppelin-contracts/test/utils/introspection/ERC165Checker.test.js +0 -302
  1491. package/test/contracts/lib/openzeppelin-contracts/test/utils/introspection/ERC165Storage.test.js +0 -23
  1492. package/test/contracts/lib/openzeppelin-contracts/test/utils/introspection/ERC1820Implementer.test.js +0 -71
  1493. package/test/contracts/lib/openzeppelin-contracts/test/utils/introspection/SupportsInterface.behavior.js +0 -146
  1494. package/test/contracts/lib/openzeppelin-contracts/test/utils/math/Math.t.sol +0 -217
  1495. package/test/contracts/lib/openzeppelin-contracts/test/utils/math/Math.test.js +0 -289
  1496. package/test/contracts/lib/openzeppelin-contracts/test/utils/math/SafeCast.test.js +0 -152
  1497. package/test/contracts/lib/openzeppelin-contracts/test/utils/math/SafeMath.test.js +0 -433
  1498. package/test/contracts/lib/openzeppelin-contracts/test/utils/math/SignedMath.test.js +0 -95
  1499. package/test/contracts/lib/openzeppelin-contracts/test/utils/math/SignedSafeMath.test.js +0 -152
  1500. package/test/contracts/lib/openzeppelin-contracts/test/utils/structs/BitMap.test.js +0 -145
  1501. package/test/contracts/lib/openzeppelin-contracts/test/utils/structs/DoubleEndedQueue.test.js +0 -99
  1502. package/test/contracts/lib/openzeppelin-contracts/test/utils/structs/EnumerableMap.behavior.js +0 -185
  1503. package/test/contracts/lib/openzeppelin-contracts/test/utils/structs/EnumerableMap.test.js +0 -154
  1504. package/test/contracts/lib/openzeppelin-contracts/test/utils/structs/EnumerableSet.behavior.js +0 -129
  1505. package/test/contracts/lib/openzeppelin-contracts/test/utils/structs/EnumerableSet.test.js +0 -79
  1506. package/test/contracts/out/AccessControl.sol/AccessControl.json +0 -1
  1507. package/test/contracts/out/AccessControlCrossChain.sol/AccessControlCrossChain.json +0 -1
  1508. package/test/contracts/out/AccessControlCrossChainMock.sol/AccessControlCrossChainMock.json +0 -1
  1509. package/test/contracts/out/AccessControlDefaultAdminRules.sol/AccessControlDefaultAdminRules.json +0 -1
  1510. package/test/contracts/out/AccessControlEnumerable.sol/AccessControlEnumerable.json +0 -1
  1511. package/test/contracts/out/Address.sol/Address.json +0 -1
  1512. package/test/contracts/out/Arrays.sol/Arrays.json +0 -1
  1513. package/test/contracts/out/ArraysMock.sol/AddressArraysMock.json +0 -1
  1514. package/test/contracts/out/ArraysMock.sol/Bytes32ArraysMock.json +0 -1
  1515. package/test/contracts/out/ArraysMock.sol/Uint256ArraysMock.json +0 -1
  1516. package/test/contracts/out/BadBeacon.sol/BadBeaconNoImpl.json +0 -1
  1517. package/test/contracts/out/BadBeacon.sol/BadBeaconNotContract.json +0 -1
  1518. package/test/contracts/out/Base.sol/CommonBase.json +0 -1
  1519. package/test/contracts/out/Base.sol/ScriptBase.json +0 -1
  1520. package/test/contracts/out/Base.sol/TestBase.json +0 -1
  1521. package/test/contracts/out/Base64.sol/Base64.json +0 -1
  1522. package/test/contracts/out/Base64Dirty.sol/Base64Dirty.json +0 -1
  1523. package/test/contracts/out/BeaconProxy.sol/BeaconProxy.json +0 -1
  1524. package/test/contracts/out/BitMaps.sol/BitMaps.json +0 -1
  1525. package/test/contracts/out/CallReceiverMock.sol/CallReceiverMock.json +0 -1
  1526. package/test/contracts/out/Checkpoints.sol/Checkpoints.json +0 -1
  1527. package/test/contracts/out/Checkpoints.t.sol/CheckpointsHistoryTest.json +0 -1
  1528. package/test/contracts/out/Checkpoints.t.sol/CheckpointsTrace160Test.json +0 -1
  1529. package/test/contracts/out/Checkpoints.t.sol/CheckpointsTrace224Test.json +0 -1
  1530. package/test/contracts/out/ClashingImplementation.sol/ClashingImplementation.json +0 -1
  1531. package/test/contracts/out/Clones.sol/Clones.json +0 -1
  1532. package/test/contracts/out/CompTimelock.sol/CompTimelock.json +0 -1
  1533. package/test/contracts/out/CompilationScript.sol/CompilationScript.json +0 -1
  1534. package/test/contracts/out/CompilationScriptBase.sol/CompilationScriptBase.json +0 -1
  1535. package/test/contracts/out/CompilationTest.sol/CompilationTest.json +0 -1
  1536. package/test/contracts/out/CompilationTestBase.sol/CompilationTestBase.json +0 -1
  1537. package/test/contracts/out/ConditionalEscrow.sol/ConditionalEscrow.json +0 -1
  1538. package/test/contracts/out/ConditionalEscrowMock.sol/ConditionalEscrowMock.json +0 -1
  1539. package/test/contracts/out/Context.sol/Context.json +0 -1
  1540. package/test/contracts/out/ContextMock.sol/ContextMock.json +0 -1
  1541. package/test/contracts/out/ContextMock.sol/ContextMockCaller.json +0 -1
  1542. package/test/contracts/out/Counters.sol/Counters.json +0 -1
  1543. package/test/contracts/out/Create2.sol/Create2.json +0 -1
  1544. package/test/contracts/out/CrossChainEnabled.sol/CrossChainEnabled.json +0 -1
  1545. package/test/contracts/out/CrossChainEnabledAMB.sol/CrossChainEnabledAMB.json +0 -1
  1546. package/test/contracts/out/CrossChainEnabledArbitrumL1.sol/CrossChainEnabledArbitrumL1.json +0 -1
  1547. package/test/contracts/out/CrossChainEnabledArbitrumL2.sol/CrossChainEnabledArbitrumL2.json +0 -1
  1548. package/test/contracts/out/CrossChainEnabledOptimism.sol/CrossChainEnabledOptimism.json +0 -1
  1549. package/test/contracts/out/CrossChainEnabledPolygonChild.sol/CrossChainEnabledPolygonChild.json +0 -1
  1550. package/test/contracts/out/DoubleEndedQueue.sol/DoubleEndedQueue.json +0 -1
  1551. package/test/contracts/out/DummyImplementation.sol/DummyImplementation.json +0 -1
  1552. package/test/contracts/out/DummyImplementation.sol/DummyImplementationV2.json +0 -1
  1553. package/test/contracts/out/DummyImplementation.sol/Impl.json +0 -1
  1554. package/test/contracts/out/ECDSA.sol/ECDSA.json +0 -1
  1555. package/test/contracts/out/EIP712.sol/EIP712.json +0 -1
  1556. package/test/contracts/out/EIP712Verifier.sol/EIP712Verifier.json +0 -1
  1557. package/test/contracts/out/ERC1155.sol/ERC1155.json +0 -1
  1558. package/test/contracts/out/ERC1155Burnable.sol/ERC1155Burnable.json +0 -1
  1559. package/test/contracts/out/ERC1155Holder.sol/ERC1155Holder.json +0 -1
  1560. package/test/contracts/out/ERC1155Pausable.sol/ERC1155Pausable.json +0 -1
  1561. package/test/contracts/out/ERC1155PresetMinterPauser.sol/ERC1155PresetMinterPauser.json +0 -1
  1562. package/test/contracts/out/ERC1155Receiver.sol/ERC1155Receiver.json +0 -1
  1563. package/test/contracts/out/ERC1155ReceiverMock.sol/ERC1155ReceiverMock.json +0 -1
  1564. package/test/contracts/out/ERC1155Supply.sol/ERC1155Supply.json +0 -1
  1565. package/test/contracts/out/ERC1155URIStorage.sol/ERC1155URIStorage.json +0 -1
  1566. package/test/contracts/out/ERC1271WalletMock.sol/ERC1271MaliciousMock.json +0 -1
  1567. package/test/contracts/out/ERC1271WalletMock.sol/ERC1271WalletMock.json +0 -1
  1568. package/test/contracts/out/ERC165.sol/ERC165.json +0 -1
  1569. package/test/contracts/out/ERC165Checker.sol/ERC165Checker.json +0 -1
  1570. package/test/contracts/out/ERC165MaliciousData.sol/ERC165MaliciousData.json +0 -1
  1571. package/test/contracts/out/ERC165MissingData.sol/ERC165MissingData.json +0 -1
  1572. package/test/contracts/out/ERC165NotSupported.sol/ERC165NotSupported.json +0 -1
  1573. package/test/contracts/out/ERC165ReturnBomb.sol/ERC165ReturnBombMock.json +0 -1
  1574. package/test/contracts/out/ERC165Storage.sol/ERC165Storage.json +0 -1
  1575. package/test/contracts/out/ERC1820Implementer.sol/ERC1820Implementer.json +0 -1
  1576. package/test/contracts/out/ERC1967Proxy.sol/ERC1967Proxy.json +0 -1
  1577. package/test/contracts/out/ERC1967Upgrade.sol/ERC1967Upgrade.json +0 -1
  1578. package/test/contracts/out/ERC20.sol/ERC20.json +0 -1
  1579. package/test/contracts/out/ERC20Burnable.sol/ERC20Burnable.json +0 -1
  1580. package/test/contracts/out/ERC20Capped.sol/ERC20Capped.json +0 -1
  1581. package/test/contracts/out/ERC20DecimalsMock.sol/ERC20DecimalsMock.json +0 -1
  1582. package/test/contracts/out/ERC20ExcessDecimalsMock.sol/ERC20ExcessDecimalsMock.json +0 -1
  1583. package/test/contracts/out/ERC20FlashMint.sol/ERC20FlashMint.json +0 -1
  1584. package/test/contracts/out/ERC20FlashMintMock.sol/ERC20FlashMintMock.json +0 -1
  1585. package/test/contracts/out/ERC20ForceApproveMock.sol/ERC20ForceApproveMock.json +0 -1
  1586. package/test/contracts/out/ERC20Mock.sol/ERC20Mock.json +0 -1
  1587. package/test/contracts/out/ERC20MulticallMock.sol/ERC20MulticallMock.json +0 -1
  1588. package/test/contracts/out/ERC20NoReturnMock.sol/ERC20NoReturnMock.json +0 -1
  1589. package/test/contracts/out/ERC20Pausable.sol/ERC20Pausable.json +0 -1
  1590. package/test/contracts/out/ERC20Permit.sol/ERC20Permit.json +0 -1
  1591. package/test/contracts/out/ERC20PermitNoRevertMock.sol/ERC20PermitNoRevertMock.json +0 -1
  1592. package/test/contracts/out/ERC20PresetFixedSupply.sol/ERC20PresetFixedSupply.json +0 -1
  1593. package/test/contracts/out/ERC20PresetMinterPauser.sol/ERC20PresetMinterPauser.json +0 -1
  1594. package/test/contracts/out/ERC20Reentrant.sol/ERC20Reentrant.json +0 -1
  1595. package/test/contracts/out/ERC20ReturnFalseMock.sol/ERC20ReturnFalseMock.json +0 -1
  1596. package/test/contracts/out/ERC20Snapshot.sol/ERC20Snapshot.json +0 -1
  1597. package/test/contracts/out/ERC20Votes.sol/ERC20Votes.json +0 -1
  1598. package/test/contracts/out/ERC20VotesComp.sol/ERC20VotesComp.json +0 -1
  1599. package/test/contracts/out/ERC20VotesLegacyMock.sol/ERC20VotesLegacyMock.json +0 -1
  1600. package/test/contracts/out/ERC20Wrapper.sol/ERC20Wrapper.json +0 -1
  1601. package/test/contracts/out/ERC2771Context.sol/ERC2771Context.json +0 -1
  1602. package/test/contracts/out/ERC2771ContextMock.sol/ERC2771ContextMock.json +0 -1
  1603. package/test/contracts/out/ERC2981.sol/ERC2981.json +0 -1
  1604. package/test/contracts/out/ERC3156FlashBorrowerMock.sol/ERC3156FlashBorrowerMock.json +0 -1
  1605. package/test/contracts/out/ERC4626.prop.sol/ERC4626Prop.json +0 -1
  1606. package/test/contracts/out/ERC4626.prop.sol/IERC20.json +0 -1
  1607. package/test/contracts/out/ERC4626.prop.sol/IERC4626.json +0 -1
  1608. package/test/contracts/out/ERC4626.sol/ERC4626.json +0 -1
  1609. package/test/contracts/out/ERC4626.t.sol/ERC4626StdTest.json +0 -1
  1610. package/test/contracts/out/ERC4626.t.sol/ERC4626VaultOffsetMock.json +0 -1
  1611. package/test/contracts/out/ERC4626.test.sol/ERC4626Test.json +0 -1
  1612. package/test/contracts/out/ERC4626.test.sol/IMockERC20.json +0 -1
  1613. package/test/contracts/out/ERC4626Fees.sol/ERC4626Fees.json +0 -1
  1614. package/test/contracts/out/ERC4626Mock.sol/ERC4626Mock.json +0 -1
  1615. package/test/contracts/out/ERC4626OffsetMock.sol/ERC4626OffsetMock.json +0 -1
  1616. package/test/contracts/out/ERC4646FeesMock.sol/ERC4626FeesMock.json +0 -1
  1617. package/test/contracts/out/ERC721.sol/ERC721.json +0 -1
  1618. package/test/contracts/out/ERC721Burnable.sol/ERC721Burnable.json +0 -1
  1619. package/test/contracts/out/ERC721Consecutive.sol/ERC721Consecutive.json +0 -1
  1620. package/test/contracts/out/ERC721Consecutive.t.sol/ERC721ConsecutiveTarget.json +0 -1
  1621. package/test/contracts/out/ERC721Consecutive.t.sol/ERC721ConsecutiveTest.json +0 -1
  1622. package/test/contracts/out/ERC721ConsecutiveEnumerableMock.sol/ERC721ConsecutiveEnumerableMock.json +0 -1
  1623. package/test/contracts/out/ERC721ConsecutiveMock.sol/ERC721ConsecutiveMock.json +0 -1
  1624. package/test/contracts/out/ERC721ConsecutiveMock.sol/ERC721ConsecutiveNoConstructorMintMock.json +0 -1
  1625. package/test/contracts/out/ERC721Enumerable.sol/ERC721Enumerable.json +0 -1
  1626. package/test/contracts/out/ERC721Holder.sol/ERC721Holder.json +0 -1
  1627. package/test/contracts/out/ERC721Pausable.sol/ERC721Pausable.json +0 -1
  1628. package/test/contracts/out/ERC721PresetMinterPauserAutoId.sol/ERC721PresetMinterPauserAutoId.json +0 -1
  1629. package/test/contracts/out/ERC721ReceiverMock.sol/ERC721ReceiverMock.json +0 -1
  1630. package/test/contracts/out/ERC721Royalty.sol/ERC721Royalty.json +0 -1
  1631. package/test/contracts/out/ERC721URIStorage.sol/ERC721URIStorage.json +0 -1
  1632. package/test/contracts/out/ERC721URIStorageMock.sol/ERC721URIStorageMock.json +0 -1
  1633. package/test/contracts/out/ERC721Votes.sol/ERC721Votes.json +0 -1
  1634. package/test/contracts/out/ERC721Wrapper.sol/ERC721Wrapper.json +0 -1
  1635. package/test/contracts/out/ERC777.sol/ERC777.json +0 -1
  1636. package/test/contracts/out/ERC777Mock.sol/ERC777Mock.json +0 -1
  1637. package/test/contracts/out/ERC777PresetFixedSupply.sol/ERC777PresetFixedSupply.json +0 -1
  1638. package/test/contracts/out/ERC777SenderRecipientMock.sol/ERC777SenderRecipientMock.json +0 -1
  1639. package/test/contracts/out/EnumerableMap.sol/EnumerableMap.json +0 -1
  1640. package/test/contracts/out/EnumerableSet.sol/EnumerableSet.json +0 -1
  1641. package/test/contracts/out/Escrow.sol/Escrow.json +0 -1
  1642. package/test/contracts/out/EtherReceiverMock.sol/EtherReceiverMock.json +0 -1
  1643. package/test/contracts/out/Governor.sol/Governor.json +0 -1
  1644. package/test/contracts/out/Governor.t.sol/GovernorInternalTest.json +0 -1
  1645. package/test/contracts/out/GovernorCompMock.sol/GovernorCompMock.json +0 -1
  1646. package/test/contracts/out/GovernorCompatibilityBravo.sol/GovernorCompatibilityBravo.json +0 -1
  1647. package/test/contracts/out/GovernorCompatibilityBravoMock.sol/GovernorCompatibilityBravoMock.json +0 -1
  1648. package/test/contracts/out/GovernorCountingSimple.sol/GovernorCountingSimple.json +0 -1
  1649. package/test/contracts/out/GovernorMock.sol/GovernorMock.json +0 -1
  1650. package/test/contracts/out/GovernorPreventLateQuorum.sol/GovernorPreventLateQuorum.json +0 -1
  1651. package/test/contracts/out/GovernorPreventLateQuorumMock.sol/GovernorPreventLateQuorumMock.json +0 -1
  1652. package/test/contracts/out/GovernorProposalThreshold.sol/GovernorProposalThreshold.json +0 -1
  1653. package/test/contracts/out/GovernorSettings.sol/GovernorSettings.json +0 -1
  1654. package/test/contracts/out/GovernorTimelockCompound.sol/GovernorTimelockCompound.json +0 -1
  1655. package/test/contracts/out/GovernorTimelockCompoundMock.sol/GovernorTimelockCompoundMock.json +0 -1
  1656. package/test/contracts/out/GovernorTimelockControl.sol/GovernorTimelockControl.json +0 -1
  1657. package/test/contracts/out/GovernorTimelockControlMock.sol/GovernorTimelockControlMock.json +0 -1
  1658. package/test/contracts/out/GovernorVoteMock.sol/GovernorVoteMocks.json +0 -1
  1659. package/test/contracts/out/GovernorVotes.sol/GovernorVotes.json +0 -1
  1660. package/test/contracts/out/GovernorVotesComp.sol/GovernorVotesComp.json +0 -1
  1661. package/test/contracts/out/GovernorVotesQuorumFraction.sol/GovernorVotesQuorumFraction.json +0 -1
  1662. package/test/contracts/out/GovernorWithParamsMock.sol/GovernorWithParamsMock.json +0 -1
  1663. package/test/contracts/out/IAMB.sol/IAMB.json +0 -1
  1664. package/test/contracts/out/IAccessControl.sol/IAccessControl.json +0 -1
  1665. package/test/contracts/out/IAccessControlDefaultAdminRules.sol/IAccessControlDefaultAdminRules.json +0 -1
  1666. package/test/contracts/out/IAccessControlEnumerable.sol/IAccessControlEnumerable.json +0 -1
  1667. package/test/contracts/out/IArbSys.sol/IArbSys.json +0 -1
  1668. package/test/contracts/out/IBeacon.sol/IBeacon.json +0 -1
  1669. package/test/contracts/out/IBridge.sol/IBridge.json +0 -1
  1670. package/test/contracts/out/ICompoundTimelock.sol/ICompoundTimelock.json +0 -1
  1671. package/test/contracts/out/ICrossDomainMessenger.sol/ICrossDomainMessenger.json +0 -1
  1672. package/test/contracts/out/IDelayedMessageProvider.sol/IDelayedMessageProvider.json +0 -1
  1673. package/test/contracts/out/IERC1155.sol/IERC1155.json +0 -1
  1674. package/test/contracts/out/IERC1155MetadataURI.sol/IERC1155MetadataURI.json +0 -1
  1675. package/test/contracts/out/IERC1155Receiver.sol/IERC1155Receiver.json +0 -1
  1676. package/test/contracts/out/IERC1271.sol/IERC1271.json +0 -1
  1677. package/test/contracts/out/IERC1363.sol/IERC1363.json +0 -1
  1678. package/test/contracts/out/IERC1363Receiver.sol/IERC1363Receiver.json +0 -1
  1679. package/test/contracts/out/IERC1363Spender.sol/IERC1363Spender.json +0 -1
  1680. package/test/contracts/out/IERC165.sol/IERC165.json +0 -1
  1681. package/test/contracts/out/IERC1820Implementer.sol/IERC1820Implementer.json +0 -1
  1682. package/test/contracts/out/IERC1820Registry.sol/IERC1820Registry.json +0 -1
  1683. package/test/contracts/out/IERC1967.sol/IERC1967.json +0 -1
  1684. package/test/contracts/out/IERC20.sol/IERC20.json +0 -1
  1685. package/test/contracts/out/IERC20Metadata.sol/IERC20Metadata.json +0 -1
  1686. package/test/contracts/out/IERC20Permit.sol/IERC20Permit.json +0 -1
  1687. package/test/contracts/out/IERC2309.sol/IERC2309.json +0 -1
  1688. package/test/contracts/out/IERC2612.sol/IERC2612.json +0 -1
  1689. package/test/contracts/out/IERC2981.sol/IERC2981.json +0 -1
  1690. package/test/contracts/out/IERC3156FlashBorrower.sol/IERC3156FlashBorrower.json +0 -1
  1691. package/test/contracts/out/IERC3156FlashLender.sol/IERC3156FlashLender.json +0 -1
  1692. package/test/contracts/out/IERC4626.sol/IERC4626.json +0 -1
  1693. package/test/contracts/out/IERC4906.sol/IERC4906.json +0 -1
  1694. package/test/contracts/out/IERC5267.sol/IERC5267.json +0 -1
  1695. package/test/contracts/out/IERC5313.sol/IERC5313.json +0 -1
  1696. package/test/contracts/out/IERC5805.sol/IERC5805.json +0 -1
  1697. package/test/contracts/out/IERC6372.sol/IERC6372.json +0 -1
  1698. package/test/contracts/out/IERC721.sol/IERC721.json +0 -1
  1699. package/test/contracts/out/IERC721.sol/IERC721Enumerable.json +0 -1
  1700. package/test/contracts/out/IERC721.sol/IERC721Metadata.json +0 -1
  1701. package/test/contracts/out/IERC721.sol/IERC721TokenReceiver.json +0 -1
  1702. package/test/contracts/out/IERC721Enumerable.sol/IERC721Enumerable.json +0 -1
  1703. package/test/contracts/out/IERC721Metadata.sol/IERC721Metadata.json +0 -1
  1704. package/test/contracts/out/IERC721Receiver.sol/IERC721Receiver.json +0 -1
  1705. package/test/contracts/out/IERC777.sol/IERC777.json +0 -1
  1706. package/test/contracts/out/IERC777Recipient.sol/IERC777Recipient.json +0 -1
  1707. package/test/contracts/out/IERC777Sender.sol/IERC777Sender.json +0 -1
  1708. package/test/contracts/out/IFxMessageProcessor.sol/IFxMessageProcessor.json +0 -1
  1709. package/test/contracts/out/IGovernor.sol/IGovernor.json +0 -1
  1710. package/test/contracts/out/IGovernorCompatibilityBravo.sol/IGovernorCompatibilityBravo.json +0 -1
  1711. package/test/contracts/out/IGovernorTimelock.sol/IGovernorTimelock.json +0 -1
  1712. package/test/contracts/out/IInbox.sol/IInbox.json +0 -1
  1713. package/test/contracts/out/IMulticall3.sol/IMulticall3.json +0 -1
  1714. package/test/contracts/out/IOutbox.sol/IOutbox.json +0 -1
  1715. package/test/contracts/out/IVotes.sol/IVotes.json +0 -1
  1716. package/test/contracts/out/Initializable.sol/Initializable.json +0 -1
  1717. package/test/contracts/out/InitializableMock.sol/ChildConstructorInitializableMock.json +0 -1
  1718. package/test/contracts/out/InitializableMock.sol/ConstructorInitializableMock.json +0 -1
  1719. package/test/contracts/out/InitializableMock.sol/DisableBad1.json +0 -1
  1720. package/test/contracts/out/InitializableMock.sol/DisableBad2.json +0 -1
  1721. package/test/contracts/out/InitializableMock.sol/DisableNew.json +0 -1
  1722. package/test/contracts/out/InitializableMock.sol/DisableOk.json +0 -1
  1723. package/test/contracts/out/InitializableMock.sol/DisableOld.json +0 -1
  1724. package/test/contracts/out/InitializableMock.sol/InitializableMock.json +0 -1
  1725. package/test/contracts/out/InitializableMock.sol/ReinitializerMock.json +0 -1
  1726. package/test/contracts/out/LibAMB.sol/LibAMB.json +0 -1
  1727. package/test/contracts/out/LibArbitrumL1.sol/LibArbitrumL1.json +0 -1
  1728. package/test/contracts/out/LibArbitrumL2.sol/LibArbitrumL2.json +0 -1
  1729. package/test/contracts/out/LibOptimism.sol/LibOptimism.json +0 -1
  1730. package/test/contracts/out/Math.sol/Math.json +0 -1
  1731. package/test/contracts/out/Math.t.sol/MathTest.json +0 -1
  1732. package/test/contracts/out/MerkleProof.sol/MerkleProof.json +0 -1
  1733. package/test/contracts/out/MinimalForwarder.sol/MinimalForwarder.json +0 -1
  1734. package/test/contracts/out/MockMiladyAgentRegistry.sol/MockMiladyAgentRegistry.json +0 -1
  1735. package/test/contracts/out/MockMiladyCollection.sol/MockMiladyCollection.json +0 -1
  1736. package/test/contracts/out/Multicall.sol/Multicall.json +0 -1
  1737. package/test/contracts/out/MulticallTest.sol/MulticallTest.json +0 -1
  1738. package/test/contracts/out/MultipleInheritanceInitializableMocks.sol/SampleChild.json +0 -1
  1739. package/test/contracts/out/MultipleInheritanceInitializableMocks.sol/SampleFather.json +0 -1
  1740. package/test/contracts/out/MultipleInheritanceInitializableMocks.sol/SampleGramps.json +0 -1
  1741. package/test/contracts/out/MultipleInheritanceInitializableMocks.sol/SampleHuman.json +0 -1
  1742. package/test/contracts/out/MultipleInheritanceInitializableMocks.sol/SampleMother.json +0 -1
  1743. package/test/contracts/out/MyGovernor.sol/MyGovernor.json +0 -1
  1744. package/test/contracts/out/MyGovernor1.sol/MyGovernor1.json +0 -1
  1745. package/test/contracts/out/MyGovernor2.sol/MyGovernor2.json +0 -1
  1746. package/test/contracts/out/MyGovernor3.sol/MyGovernor3.json +0 -1
  1747. package/test/contracts/out/MyToken.sol/MyToken.json +0 -1
  1748. package/test/contracts/out/MyTokenTimestampBased.sol/MyTokenTimestampBased.json +0 -1
  1749. package/test/contracts/out/MyTokenWrapped.sol/MyTokenWrapped.json +0 -1
  1750. package/test/contracts/out/Ownable.sol/Ownable.json +0 -1
  1751. package/test/contracts/out/Ownable2Step.sol/Ownable2Step.json +0 -1
  1752. package/test/contracts/out/Pausable.sol/Pausable.json +0 -1
  1753. package/test/contracts/out/PausableMock.sol/PausableMock.json +0 -1
  1754. package/test/contracts/out/PaymentSplitter.sol/PaymentSplitter.json +0 -1
  1755. package/test/contracts/out/Proxy.sol/Proxy.json +0 -1
  1756. package/test/contracts/out/ProxyAdmin.sol/ProxyAdmin.json +0 -1
  1757. package/test/contracts/out/PullPayment.sol/PullPayment.json +0 -1
  1758. package/test/contracts/out/PullPaymentMock.sol/PullPaymentMock.json +0 -1
  1759. package/test/contracts/out/ReentrancyAttack.sol/ReentrancyAttack.json +0 -1
  1760. package/test/contracts/out/ReentrancyGuard.sol/ReentrancyGuard.json +0 -1
  1761. package/test/contracts/out/ReentrancyMock.sol/ReentrancyMock.json +0 -1
  1762. package/test/contracts/out/RefundEscrow.sol/RefundEscrow.json +0 -1
  1763. package/test/contracts/out/RegressionImplementation.sol/Implementation1.json +0 -1
  1764. package/test/contracts/out/RegressionImplementation.sol/Implementation2.json +0 -1
  1765. package/test/contracts/out/RegressionImplementation.sol/Implementation3.json +0 -1
  1766. package/test/contracts/out/RegressionImplementation.sol/Implementation4.json +0 -1
  1767. package/test/contracts/out/SafeCast.sol/SafeCast.json +0 -1
  1768. package/test/contracts/out/SafeERC20.sol/SafeERC20.json +0 -1
  1769. package/test/contracts/out/SafeMath.sol/SafeMath.json +0 -1
  1770. package/test/contracts/out/SafeMathMemoryCheck.sol/SafeMathMemoryCheck.json +0 -1
  1771. package/test/contracts/out/Script.sol/Script.json +0 -1
  1772. package/test/contracts/out/ShortStrings.sol/ShortStrings.json +0 -1
  1773. package/test/contracts/out/ShortStrings.t.sol/ShortStringsTest.json +0 -1
  1774. package/test/contracts/out/SignatureChecker.sol/SignatureChecker.json +0 -1
  1775. package/test/contracts/out/SignedMath.sol/SignedMath.json +0 -1
  1776. package/test/contracts/out/SignedSafeMath.sol/SignedSafeMath.json +0 -1
  1777. package/test/contracts/out/SingleInheritanceInitializableMocks.sol/MigratableMockV1.json +0 -1
  1778. package/test/contracts/out/SingleInheritanceInitializableMocks.sol/MigratableMockV2.json +0 -1
  1779. package/test/contracts/out/SingleInheritanceInitializableMocks.sol/MigratableMockV3.json +0 -1
  1780. package/test/contracts/out/StdAssertions.sol/StdAssertions.json +0 -1
  1781. package/test/contracts/out/StdAssertions.t.sol/StdAssertionsTest.json +0 -1
  1782. package/test/contracts/out/StdAssertions.t.sol/TestMockCall.json +0 -1
  1783. package/test/contracts/out/StdAssertions.t.sol/TestTest.json +0 -1
  1784. package/test/contracts/out/StdChains.sol/StdChains.json +0 -1
  1785. package/test/contracts/out/StdChains.t.sol/StdChainsTest.json +0 -1
  1786. package/test/contracts/out/StdCheats.sol/StdCheats.json +0 -1
  1787. package/test/contracts/out/StdCheats.sol/StdCheatsSafe.json +0 -1
  1788. package/test/contracts/out/StdCheats.t.sol/Bar.json +0 -1
  1789. package/test/contracts/out/StdCheats.t.sol/BarERC1155.json +0 -1
  1790. package/test/contracts/out/StdCheats.t.sol/BarERC721.json +0 -1
  1791. package/test/contracts/out/StdCheats.t.sol/RevertingContract.json +0 -1
  1792. package/test/contracts/out/StdCheats.t.sol/StdCheatsTest.json +0 -1
  1793. package/test/contracts/out/StdError.sol/stdError.json +0 -1
  1794. package/test/contracts/out/StdError.t.sol/ErrorsTest.json +0 -1
  1795. package/test/contracts/out/StdError.t.sol/StdErrorsTest.json +0 -1
  1796. package/test/contracts/out/StdInvariant.sol/StdInvariant.json +0 -1
  1797. package/test/contracts/out/StdJson.sol/stdJson.json +0 -1
  1798. package/test/contracts/out/StdMath.sol/stdMath.json +0 -1
  1799. package/test/contracts/out/StdMath.t.sol/StdMathTest.json +0 -1
  1800. package/test/contracts/out/StdStorage.sol/stdStorage.json +0 -1
  1801. package/test/contracts/out/StdStorage.sol/stdStorageSafe.json +0 -1
  1802. package/test/contracts/out/StdStorage.t.sol/StdStorageTest.json +0 -1
  1803. package/test/contracts/out/StdStorage.t.sol/StorageTest.json +0 -1
  1804. package/test/contracts/out/StdStyle.sol/StdStyle.json +0 -1
  1805. package/test/contracts/out/StdStyle.t.sol/StdStyleTest.json +0 -1
  1806. package/test/contracts/out/StdUtils.sol/StdUtils.json +0 -1
  1807. package/test/contracts/out/StdUtils.t.sol/StdUtilsForkTest.json +0 -1
  1808. package/test/contracts/out/StdUtils.t.sol/StdUtilsMock.json +0 -1
  1809. package/test/contracts/out/StdUtils.t.sol/StdUtilsTest.json +0 -1
  1810. package/test/contracts/out/StorageSlot.sol/StorageSlot.json +0 -1
  1811. package/test/contracts/out/StorageSlotMock.sol/StorageSlotMock.json +0 -1
  1812. package/test/contracts/out/Strings.sol/Strings.json +0 -1
  1813. package/test/contracts/out/TimelockController.sol/TimelockController.json +0 -1
  1814. package/test/contracts/out/TimelockReentrant.sol/TimelockReentrant.json +0 -1
  1815. package/test/contracts/out/Timers.sol/Timers.json +0 -1
  1816. package/test/contracts/out/TimersBlockNumberImpl.sol/TimersBlockNumberImpl.json +0 -1
  1817. package/test/contracts/out/TimersTimestampImpl.sol/TimersTimestampImpl.json +0 -1
  1818. package/test/contracts/out/TokenTimelock.sol/TokenTimelock.json +0 -1
  1819. package/test/contracts/out/TransparentUpgradeableProxy.sol/ITransparentUpgradeableProxy.json +0 -1
  1820. package/test/contracts/out/TransparentUpgradeableProxy.sol/TransparentUpgradeableProxy.json +0 -1
  1821. package/test/contracts/out/UUPSLegacy.sol/UUPSUpgradeableLegacyMock.json +0 -1
  1822. package/test/contracts/out/UUPSUpgradeable.sol/UUPSUpgradeable.json +0 -1
  1823. package/test/contracts/out/UUPSUpgradeableMock.sol/NonUpgradeableMock.json +0 -1
  1824. package/test/contracts/out/UUPSUpgradeableMock.sol/UUPSUpgradeableMock.json +0 -1
  1825. package/test/contracts/out/UUPSUpgradeableMock.sol/UUPSUpgradeableUnsafeMock.json +0 -1
  1826. package/test/contracts/out/UpgradeableBeacon.sol/UpgradeableBeacon.json +0 -1
  1827. package/test/contracts/out/VestingWallet.sol/VestingWallet.json +0 -1
  1828. package/test/contracts/out/Vm.sol/Vm.json +0 -1
  1829. package/test/contracts/out/Vm.sol/VmSafe.json +0 -1
  1830. package/test/contracts/out/Votes.sol/Votes.json +0 -1
  1831. package/test/contracts/out/VotesMock.sol/VotesMock.json +0 -1
  1832. package/test/contracts/out/VotesMock.sol/VotesTimestampMock.json +0 -1
  1833. package/test/contracts/out/VotesTimestamp.sol/ERC20VotesCompTimestampMock.json +0 -1
  1834. package/test/contracts/out/VotesTimestamp.sol/ERC20VotesTimestampMock.json +0 -1
  1835. package/test/contracts/out/VotesTimestamp.sol/ERC721VotesTimestampMock.json +0 -1
  1836. package/test/contracts/out/bridges.sol/BaseRelayMock.json +0 -1
  1837. package/test/contracts/out/bridges.sol/BridgeAMBMock.json +0 -1
  1838. package/test/contracts/out/bridges.sol/BridgeArbitrumL1Inbox.json +0 -1
  1839. package/test/contracts/out/bridges.sol/BridgeArbitrumL1Mock.json +0 -1
  1840. package/test/contracts/out/bridges.sol/BridgeArbitrumL1Outbox.json +0 -1
  1841. package/test/contracts/out/bridges.sol/BridgeArbitrumL2Mock.json +0 -1
  1842. package/test/contracts/out/bridges.sol/BridgeOptimismMock.json +0 -1
  1843. package/test/contracts/out/bridges.sol/BridgePolygonChildMock.json +0 -1
  1844. package/test/contracts/out/build-info/2be03bb8eb1ccda1.json +0 -1
  1845. package/test/contracts/out/console.sol/console.json +0 -1
  1846. package/test/contracts/out/console2.sol/console2.json +0 -1
  1847. package/test/contracts/out/demo.sol/DemoTest.json +0 -1
  1848. package/test/contracts/out/demo.sol/DemoTestWithSetUp.json +0 -1
  1849. package/test/contracts/out/draft-IERC1822.sol/IERC1822Proxiable.json +0 -1
  1850. package/test/contracts/out/interfaces/IERC1155.sol/IERC1155.json +0 -1
  1851. package/test/contracts/out/interfaces/IERC165.sol/IERC165.json +0 -1
  1852. package/test/contracts/out/interfaces/IERC20.sol/IERC20.json +0 -1
  1853. package/test/contracts/out/interfaces/IERC4626.sol/IERC4626.json +0 -1
  1854. package/test/contracts/out/interfaces/IERC721.sol/IERC721.json +0 -1
  1855. package/test/contracts/out/receivers.sol/CrossChainEnabledAMBMock.json +0 -1
  1856. package/test/contracts/out/receivers.sol/CrossChainEnabledArbitrumL1Mock.json +0 -1
  1857. package/test/contracts/out/receivers.sol/CrossChainEnabledArbitrumL2Mock.json +0 -1
  1858. package/test/contracts/out/receivers.sol/CrossChainEnabledOptimismMock.json +0 -1
  1859. package/test/contracts/out/receivers.sol/CrossChainEnabledPolygonChildMock.json +0 -1
  1860. package/test/contracts/out/receivers.sol/Receiver.json +0 -1
  1861. package/test/contracts/out/test.sol/DSTest.json +0 -1
  1862. package/test/contracts/out/test.sol/Test.json +0 -1
  1863. package/test/contracts/out/test.t.sol/DemoTest.json +0 -1
  1864. package/test/database-api.e2e.test.ts +0 -666
  1865. package/test/debug-anvil.ts +0 -44
  1866. package/test/deferred-restart.e2e.test.ts +0 -368
  1867. package/test/diagnostics/integration-observability.test.ts +0 -135
  1868. package/test/discord-connector.e2e.test.ts +0 -463
  1869. package/test/e2e-global-setup.ts +0 -29
  1870. package/test/e2e-validation.e2e.test.ts +0 -1567
  1871. package/test/health-endpoint.e2e.test.ts +0 -95
  1872. package/test/knowledge-e2e-flow.e2e.test.ts +0 -134
  1873. package/test/knowledge-live.e2e.test.ts +0 -405
  1874. package/test/mcp-config.e2e.test.ts +0 -630
  1875. package/test/native-modules.e2e.test.ts +0 -470
  1876. package/test/permissions-api.e2e.test.ts +0 -637
  1877. package/test/plugin-install.e2e.test.ts +0 -645
  1878. package/test/plugin-lifecycle.e2e.test.ts +0 -617
  1879. package/test/plugin-management.e2e.test.ts +0 -311
  1880. package/test/provider-switch.e2e.test.ts +0 -322
  1881. package/test/runtime-debug.e2e.test.ts +0 -90
  1882. package/test/scripts/test-force.ts +0 -139
  1883. package/test/scripts/test-parallel.mjs +0 -192
  1884. package/test/scripts/validate-all-features.sh +0 -557
  1885. package/test/security/audit-log.test.ts +0 -227
  1886. package/test/security/network-policy.test.ts +0 -143
  1887. package/test/services/version-compat.test.ts +0 -117
  1888. package/test/setup.ts +0 -122
  1889. package/test/signal-connector.e2e.test.ts +0 -229
  1890. package/test/skills-marketplace-api.e2e.test.ts +0 -585
  1891. package/test/skills-marketplace-services.e2e.test.ts +0 -518
  1892. package/test/skills-marketplace.e2e.test.ts +0 -268
  1893. package/test/stubs/coding-agent-module.ts +0 -18
  1894. package/test/stubs/electron-module.ts +0 -17
  1895. package/test/stubs/empty-module.mjs +0 -4
  1896. package/test/stubs/pi-ai-module.ts +0 -12
  1897. package/test/subscription-auth.e2e.test.ts +0 -747
  1898. package/test/terminal-execution.e2e.test.ts +0 -134
  1899. package/test/terminal-run-limits.e2e.test.ts +0 -132
  1900. package/test/test-env.ts +0 -156
  1901. package/test/trajectory-collection.e2e.test.ts +0 -800
  1902. package/test/trajectory-database.e2e.test.ts +0 -218
  1903. package/test/trajectory-embedding-filter.e2e.test.ts +0 -317
  1904. package/test/trajectory-restart-carryover.e2e.test.ts +0 -306
  1905. package/test/trigger-execution-flow.e2e.test.ts +0 -132
  1906. package/test/trigger-runtime.e2e.test.ts +0 -247
  1907. package/test/wallet-api.e2e.test.ts +0 -1295
  1908. package/test/wallet-live.e2e.test.ts +0 -428
  1909. package/tsconfig.build.json +0 -18
  1910. package/tsconfig.json +0 -19
  1911. package/vitest.e2e.config.ts +0 -93
  1912. /package/{src/config/index.ts → packages/autonomous/src/config/index.js} +0 -0
  1913. /package/{src/config/types.ts → packages/autonomous/src/config/types.js} +0 -0
  1914. /package/{src/contracts/index.ts → packages/autonomous/src/contracts/index.js} +0 -0
  1915. /package/{src/index.ts → packages/autonomous/src/index.js} +0 -0
  1916. /package/{src/runtime/index.ts → packages/autonomous/src/runtime/index.js} +0 -0
  1917. /package/{src/services/index.ts → packages/autonomous/src/services/index.js} +0 -0
  1918. /package/{src/testing/index.ts → packages/autonomous/src/testing/index.js} +0 -0
@@ -1,4965 +0,0 @@
1
- /**
2
- * elizaOS runtime entry point for Milady.
3
- *
4
- * Starts the elizaOS agent runtime with Milady's plugin configuration.
5
- * Can be run directly via: node --import tsx src/runtime/eliza.ts
6
- * Or via the CLI: milady start
7
- *
8
- * @module eliza
9
- */
10
- import crypto from "node:crypto";
11
- import type { Dirent } from "node:fs";
12
- import {
13
- existsSync,
14
- mkdirSync,
15
- readFileSync,
16
- symlinkSync,
17
- unlinkSync,
18
- } from "node:fs";
19
- import fs from "node:fs/promises";
20
- import { createRequire } from "node:module";
21
- import os from "node:os";
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
- // @clack/prompts is loaded lazily inside runFirstTimeSetup() so the
28
- // packaged desktop app (which never runs interactive onboarding) does
29
- // not crash when the package is unavailable.
30
- type ClackModule = typeof import("@clack/prompts");
31
- let _clack: ClackModule | null = null;
32
- async function loadClack(): Promise<ClackModule> {
33
- if (!_clack) _clack = await import("@clack/prompts");
34
- return _clack;
35
- }
36
-
37
- import {
38
- AgentRuntime,
39
- AutonomyService,
40
- addLogListener,
41
- ChannelType,
42
- type Character,
43
- type Component,
44
- createMessageMemory,
45
- type Entity,
46
- type LogEntry,
47
- logger,
48
- // loggerScope, // removed
49
- mergeCharacterDefaults,
50
- type Plugin,
51
- type Provider,
52
- stringToUuid,
53
- type TargetInfo,
54
- type UUID,
55
- } from "@elizaos/core";
56
- import * as pluginAgentOrchestrator from "@elizaos/plugin-agent-orchestrator";
57
- import * as pluginAgentSkills from "@elizaos/plugin-agent-skills";
58
- import * as pluginAnthropic from "@elizaos/plugin-anthropic";
59
- import * as pluginCron from "@elizaos/plugin-cron";
60
- import * as pluginElizacloud from "@elizaos/plugin-elizacloud";
61
- import * as pluginExperience from "@elizaos/plugin-experience";
62
- import * as pluginForm from "@elizaos/plugin-form";
63
- import * as pluginKnowledge from "@elizaos/plugin-knowledge";
64
- import * as pluginLocalEmbedding from "@elizaos/plugin-local-embedding";
65
- import * as pluginOllama from "@elizaos/plugin-ollama";
66
- import * as pluginOpenai from "@elizaos/plugin-openai";
67
- import * as pluginPdf from "@elizaos/plugin-pdf";
68
- import * as pluginPersonality from "@elizaos/plugin-personality";
69
- import * as pluginPluginManager from "@elizaos/plugin-plugin-manager";
70
- import * as pluginRolodex from "@elizaos/plugin-rolodex";
71
- import * as pluginSecretsManager from "@elizaos/plugin-secrets-manager";
72
- import * as pluginShell from "@elizaos/plugin-shell";
73
- import * as pluginSql from "@elizaos/plugin-sql";
74
- import * as pluginTodo from "@elizaos/plugin-todo";
75
- import * as pluginTrajectoryLogger from "@elizaos/plugin-trajectory-logger";
76
- import * as pluginTrust from "@elizaos/plugin-trust";
77
- import {
78
- debugLogResolvedContext,
79
- validateRuntimeContext,
80
- } from "../api/plugin-validation";
81
- import {
82
- configFileExists,
83
- loadElizaConfig,
84
- type ElizaConfig,
85
- saveElizaConfig,
86
- } from "../config/config";
87
- import { collectConfigEnvVars } from "../config/env-vars";
88
- import { resolveStateDir, resolveUserPath } from "../config/paths";
89
- import {
90
- type ApplyPluginAutoEnableParams,
91
- applyPluginAutoEnable,
92
- } from "../config/plugin-auto-enable";
93
- import type { AgentConfig } from "../config/types.agents";
94
- import type { PluginInstallRecord } from "../config/types.eliza";
95
- import {
96
- createHookEvent,
97
- type LoadHooksOptions,
98
- loadHooks,
99
- triggerHook,
100
- } from "../hooks/index";
101
- import {
102
- ensureAgentWorkspace,
103
- resolveDefaultAgentWorkspaceDir,
104
- } from "../providers/workspace";
105
- import { SandboxAuditLog } from "../security/audit-log";
106
- import { SandboxManager, type SandboxMode } from "../services/sandbox-manager";
107
- import { diagnoseNoAIProvider } from "../services/version-compat";
108
- import { CORE_PLUGINS, OPTIONAL_CORE_PLUGINS } from "./core-plugins";
109
- import { detectEmbeddingPreset } from "./embedding-presets";
110
- import { createElizaPlugin } from "./eliza-plugin";
111
- import {
112
- installDatabaseTrajectoryLogger,
113
- shouldEnableTrajectoryLoggingByDefault,
114
- } from "./trajectory-persistence";
115
-
116
- /**
117
- * Map of baseline bundled @elizaos plugin names to their statically imported
118
- * modules.
119
- *
120
- * Post-release plugins are intentionally excluded so the packaged runtime can
121
- * ship a smaller baseline bundle. Those plugins fall through to dynamic
122
- * import() and can be installed later via the plugin installer.
123
- */
124
- const STATIC_ELIZA_PLUGINS: Record<string, unknown> = {
125
- "@elizaos/plugin-sql": pluginSql,
126
- "@elizaos/plugin-local-embedding": pluginLocalEmbedding,
127
- "@elizaos/plugin-secrets-manager": pluginSecretsManager,
128
- "@elizaos/plugin-form": pluginForm,
129
- "@elizaos/plugin-knowledge": pluginKnowledge,
130
- "@elizaos/plugin-rolodex": pluginRolodex,
131
- "@elizaos/plugin-trajectory-logger": pluginTrajectoryLogger,
132
- "@elizaos/plugin-agent-orchestrator": pluginAgentOrchestrator,
133
- "@elizaos/plugin-cron": pluginCron,
134
- "@elizaos/plugin-shell": pluginShell,
135
- "@elizaos/plugin-plugin-manager": pluginPluginManager,
136
- "@elizaos/plugin-agent-skills": pluginAgentSkills,
137
- "@elizaos/plugin-pdf": pluginPdf,
138
- "@elizaos/plugin-openai": pluginOpenai,
139
- "@elizaos/plugin-anthropic": pluginAnthropic,
140
- "@elizaos/plugin-ollama": pluginOllama,
141
- "@elizaos/plugin-elizacloud": pluginElizacloud,
142
- "@elizaos/plugin-trust": pluginTrust,
143
- "@elizaos/plugin-todo": pluginTodo,
144
- "@elizaos/plugin-personality": pluginPersonality,
145
- "@elizaos/plugin-experience": pluginExperience,
146
- };
147
-
148
- // NODE_PATH so dynamic plugin imports (e.g. @elizaos/plugin-agent-orchestrator) resolve.
149
- // WHY: When eliza is loaded from dist/ or by a test runner, Node's resolution does not
150
- // search repo root node_modules; import("@elizaos/plugin-*") then fails. We prepend
151
- // repo root node_modules only if not already in NODE_PATH (run-node.mjs may have set it)
152
- // to avoid duplicate entries; _initPaths() makes Node re-read NODE_PATH. See docs/plugin-resolution-and-node-path.md.
153
- // We walk up from this file to find node_modules — we do not assume a fixed depth
154
- // (e.g. two levels for src/runtime/ or dist/runtime/) so we still work if build
155
- // output structure changes (e.g. flat dist). First directory with node_modules wins.
156
- const _elizaDir = path.dirname(fileURLToPath(import.meta.url));
157
- let _dir = _elizaDir;
158
- let _rootModules: string | null = null;
159
- while (_dir !== path.dirname(_dir)) {
160
- const candidate = path.join(_dir, "node_modules");
161
- if (existsSync(candidate)) {
162
- _rootModules = candidate;
163
- break;
164
- }
165
- _dir = path.dirname(_dir);
166
- }
167
- if (_rootModules) {
168
- const prev = process.env.NODE_PATH ?? "";
169
- const entries = prev ? prev.split(path.delimiter) : [];
170
- const normalizedRoot = path.resolve(_rootModules);
171
- if (!entries.some((e) => path.resolve(e) === normalizedRoot)) {
172
- process.env.NODE_PATH = prev
173
- ? `${_rootModules}${path.delimiter}${prev}`
174
- : _rootModules;
175
- createRequire(import.meta.url)("node:module").Module._initPaths();
176
- }
177
- }
178
-
179
- // ---------------------------------------------------------------------------
180
- // Types
181
- // ---------------------------------------------------------------------------
182
-
183
- /** A successfully resolved plugin ready for AgentRuntime registration. */
184
- interface ResolvedPlugin {
185
- /** npm package name (e.g. "@elizaos/plugin-anthropic"). */
186
- name: string;
187
- /** The Plugin instance extracted from the module. */
188
- plugin: Plugin;
189
- }
190
-
191
- /**
192
- * Temporary local compatibility shim for `@elizaos/core` not exporting
193
- * `SandboxFetchAuditEvent` on the current dependency line in this repo.
194
- * It preserves the runtime shape used by `sandboxAuditHandler`:
195
- * - `direction` and `url` are required
196
- * - `tokenIds` tracks tokens associated with the audit payload
197
- * TODO(elizaos): replace/remove when upstream re-exports this type.
198
- */
199
- type SandboxFetchAuditEvent = {
200
- direction: "inbound" | "outbound";
201
- url: string;
202
- tokenIds: string[];
203
- };
204
-
205
- /** Shape we expect from a dynamically-imported plugin package. */
206
- interface PluginModuleShape {
207
- default?: Plugin;
208
- plugin?: Plugin;
209
- [key: string]: Plugin | undefined;
210
- }
211
-
212
- export function configureLocalEmbeddingPlugin(
213
- _plugin: Plugin,
214
- config?: ElizaConfig,
215
- ): void {
216
- const detectedPreset = detectEmbeddingPreset();
217
-
218
- const embeddingConfig = config?.embedding;
219
- const configuredModel = embeddingConfig?.model?.trim();
220
- const configuredRepo = embeddingConfig?.modelRepo?.trim();
221
- const configuredDimensions =
222
- typeof embeddingConfig?.dimensions === "number" &&
223
- Number.isInteger(embeddingConfig.dimensions) &&
224
- embeddingConfig.dimensions > 0
225
- ? String(embeddingConfig.dimensions)
226
- : undefined;
227
- const configuredContextSize =
228
- typeof embeddingConfig?.contextSize === "number" &&
229
- Number.isInteger(embeddingConfig.contextSize) &&
230
- embeddingConfig.contextSize > 0
231
- ? String(embeddingConfig.contextSize)
232
- : undefined;
233
-
234
- const configuredGpuLayers = (() => {
235
- const value = embeddingConfig?.gpuLayers;
236
- if (typeof value === "number" && Number.isInteger(value) && value >= 0) {
237
- return String(value);
238
- }
239
- if (value === "auto" || value === "max") {
240
- // plugin-local-embedding understands "auto" and treats it as runtime max
241
- return "auto";
242
- }
243
- return undefined;
244
- })();
245
-
246
- const setEnvIfMissing = (key: string, value: string | undefined): void => {
247
- if (!value || process.env[key]) return;
248
- process.env[key] = value;
249
- };
250
- const setEnvFromConfig = (key: string, value: string | undefined): void => {
251
- if (!value) return;
252
- process.env[key] = value;
253
- };
254
-
255
- // Keep plugin-local-embedding aligned with Milady's hardware-adaptive preset
256
- // selection. Hard-coding the standard preset here forces slower first-run
257
- // downloads on Windows and low-spec machines.
258
- setEnvIfMissing(
259
- "LOCAL_EMBEDDING_MODEL",
260
- configuredModel || detectedPreset.model,
261
- );
262
- if (configuredRepo) {
263
- setEnvFromConfig("LOCAL_EMBEDDING_MODEL_REPO", configuredRepo);
264
- } else if (!configuredModel) {
265
- setEnvIfMissing("LOCAL_EMBEDDING_MODEL_REPO", detectedPreset.modelRepo);
266
- }
267
- if (configuredDimensions) {
268
- setEnvFromConfig("LOCAL_EMBEDDING_DIMENSIONS", configuredDimensions);
269
- } else if (!configuredModel) {
270
- setEnvIfMissing(
271
- "LOCAL_EMBEDDING_DIMENSIONS",
272
- String(detectedPreset.dimensions),
273
- );
274
- }
275
- if (configuredContextSize) {
276
- setEnvFromConfig("LOCAL_EMBEDDING_CONTEXT_SIZE", configuredContextSize);
277
- } else if (!configuredModel) {
278
- setEnvIfMissing(
279
- "LOCAL_EMBEDDING_CONTEXT_SIZE",
280
- String(detectedPreset.contextSize),
281
- );
282
- }
283
-
284
- if (configuredGpuLayers) {
285
- process.env.LOCAL_EMBEDDING_GPU_LAYERS = configuredGpuLayers;
286
- } else if (!process.env.LOCAL_EMBEDDING_GPU_LAYERS) {
287
- process.env.LOCAL_EMBEDDING_GPU_LAYERS = String(detectedPreset.gpuLayers);
288
- }
289
-
290
- // Performance tuning
291
- // Disable mmap on Metal to prevent "different text" errors with some models
292
- setEnvIfMissing(
293
- "LOCAL_EMBEDDING_USE_MMAP",
294
- detectedPreset.gpuLayers === "auto" ? "false" : "true",
295
- );
296
-
297
- // Set default models directory if not present
298
- setEnvIfMissing("MODELS_DIR", path.join(os.homedir(), ".eliza", "models"));
299
-
300
- // Normalize Google AI API key aliases — the elizaOS plugin and @google/genai
301
- // SDK expect different env var names. Canonicalize to the long form that
302
- // @elizaos/plugin-google-genai reads via runtime.getSetting(). Users can set
303
- // any of: GEMINI_API_KEY, GOOGLE_API_KEY, GOOGLE_GENERATIVE_AI_API_KEY.
304
- setEnvIfMissing(
305
- "GOOGLE_GENERATIVE_AI_API_KEY",
306
- process.env.GEMINI_API_KEY || process.env.GOOGLE_API_KEY,
307
- );
308
-
309
- // Default Google model names — the Google GenAI plugin's getSetting() returns
310
- // null (not undefined) for missing keys, but the plugin checks !== undefined
311
- // causing String(null) = "null" to be sent as the model name. Set sensible
312
- // defaults so the plugin always has valid model names.
313
- setEnvIfMissing("GOOGLE_SMALL_MODEL", "gemini-3-flash-preview");
314
- setEnvIfMissing("GOOGLE_LARGE_MODEL", "gemini-3.1-pro-preview");
315
-
316
- logger.info(
317
- `[milady] 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})`,
318
- );
319
- }
320
-
321
- // ---------------------------------------------------------------------------
322
- // Helpers
323
- // ---------------------------------------------------------------------------
324
-
325
- /** Extract a human-readable error message from an unknown thrown value. */
326
- function formatError(err: unknown): string {
327
- return err instanceof Error ? err.message : String(err);
328
- }
329
-
330
- type RuntimeAdapterWithClose = {
331
- close?: () => Promise<void> | void;
332
- };
333
-
334
- /**
335
- * Best-effort runtime shutdown that also closes the database adapter.
336
- *
337
- * AgentRuntime.stop() only stops services. plugin-sql keeps a process-global
338
- * PGlite manager, so restarts must close the adapter or the next runtime can
339
- * silently reuse the same broken manager instance.
340
- */
341
- export async function shutdownRuntime(
342
- runtime: AgentRuntime | null | undefined,
343
- context: string,
344
- ): Promise<void> {
345
- if (!runtime) return;
346
-
347
- const adapter = runtime.adapter as RuntimeAdapterWithClose | undefined;
348
- let firstError: unknown = null;
349
-
350
- try {
351
- await runtime.stop();
352
- } catch (err) {
353
- firstError = err;
354
- logger.warn(
355
- `[milady] ${context}: runtime stop failed: ${formatError(err)}`,
356
- );
357
- }
358
-
359
- if (adapter && typeof adapter.close === "function") {
360
- try {
361
- await adapter.close();
362
- } catch (err) {
363
- if (!firstError) {
364
- firstError = err;
365
- }
366
- logger.warn(
367
- `[milady] ${context}: database adapter close failed: ${formatError(err)}`,
368
- );
369
- }
370
- }
371
-
372
- if (firstError) {
373
- throw firstError;
374
- }
375
- }
376
-
377
- /**
378
- * Remove duplicate actions across an ordered list of plugins.
379
- *
380
- * When multiple plugins define an action with the same `name`, only the first
381
- * occurrence is kept. This prevents "Action already registered" warnings from
382
- * elizaOS core. The function mutates each plugin's `actions` array in-place.
383
- */
384
- export function deduplicatePluginActions(plugins: Plugin[]): void {
385
- const seen = new Set<string>();
386
- for (const plugin of plugins) {
387
- if (plugin.actions) {
388
- plugin.actions = plugin.actions.filter((action) => {
389
- if (seen.has(action.name)) {
390
- logger.debug(
391
- `[milady] Skipping duplicate action "${action.name}" from plugin "${plugin.name}"`,
392
- );
393
- return false;
394
- }
395
- seen.add(action.name);
396
- return true;
397
- });
398
- }
399
- }
400
- }
401
-
402
- interface TrajectoryLoggerControl {
403
- isEnabled?: () => boolean;
404
- setEnabled?: (enabled: boolean) => void;
405
- }
406
-
407
- interface TrajectoryLoggerOps {
408
- startTrajectory?: (
409
- stepIdOrAgentId: string,
410
- options?: {
411
- agentId?: string;
412
- roomId?: string;
413
- entityId?: string;
414
- source?: string;
415
- metadata?: Record<string, unknown>;
416
- },
417
- ) => Promise<string>;
418
- startStep?: (trajectoryId: string) => string;
419
- endTrajectory?: (
420
- stepIdOrTrajectoryId: string,
421
- status?: string,
422
- ) => Promise<void>;
423
- }
424
-
425
- type TrajectoryLoggerRegistrationStatus =
426
- | "pending"
427
- | "registering"
428
- | "registered"
429
- | "failed"
430
- | "unknown";
431
-
432
- type TrajectoryLoggerRuntimeLike = {
433
- getServicesByType?: (serviceType: string) => unknown;
434
- getService?: (serviceType: string) => unknown;
435
- getServiceLoadPromise?: (serviceType: string) => Promise<unknown>;
436
- getServiceRegistrationStatus?: (
437
- serviceType: string,
438
- ) => TrajectoryLoggerRegistrationStatus;
439
- };
440
-
441
- function collectTrajectoryLoggerCandidates(
442
- runtimeLike: TrajectoryLoggerRuntimeLike,
443
- ): TrajectoryLoggerControl[] {
444
- const candidates: TrajectoryLoggerControl[] = [];
445
- if (typeof runtimeLike.getServicesByType === "function") {
446
- const byType = runtimeLike.getServicesByType("trajectory_logger");
447
- if (Array.isArray(byType) && byType.length > 0) {
448
- for (const service of byType) {
449
- if (service) candidates.push(service as TrajectoryLoggerControl);
450
- }
451
- } else if (byType && !Array.isArray(byType)) {
452
- candidates.push(byType as TrajectoryLoggerControl);
453
- }
454
- }
455
- if (typeof runtimeLike.getService === "function") {
456
- const single = runtimeLike.getService("trajectory_logger");
457
- if (single) candidates.push(single as TrajectoryLoggerControl);
458
- }
459
- return candidates;
460
- }
461
-
462
- async function waitForTrajectoryLoggerService(
463
- runtime: AgentRuntime,
464
- context: string,
465
- timeoutMs = 3000,
466
- ): Promise<void> {
467
- const runtimeLike = runtime as unknown as TrajectoryLoggerRuntimeLike;
468
- if (collectTrajectoryLoggerCandidates(runtimeLike).length > 0) return;
469
-
470
- const registrationStatus =
471
- typeof runtimeLike.getServiceRegistrationStatus === "function"
472
- ? runtimeLike.getServiceRegistrationStatus("trajectory_logger")
473
- : "unknown";
474
-
475
- if (
476
- registrationStatus !== "pending" &&
477
- registrationStatus !== "registering"
478
- ) {
479
- return;
480
- }
481
-
482
- if (typeof runtimeLike.getServiceLoadPromise !== "function") return;
483
-
484
- let timedOut = false;
485
- let timeoutHandle: ReturnType<typeof setTimeout> | undefined;
486
- const timeoutPromise = new Promise<void>((resolve) => {
487
- timeoutHandle = setTimeout(() => {
488
- timedOut = true;
489
- resolve();
490
- }, timeoutMs);
491
- });
492
-
493
- try {
494
- await Promise.race([
495
- runtimeLike.getServiceLoadPromise("trajectory_logger").then(() => {}),
496
- timeoutPromise,
497
- ]);
498
- if (timedOut) {
499
- logger.debug(
500
- `[milady] trajectory_logger still ${registrationStatus} after ${timeoutMs}ms (${context})`,
501
- );
502
- }
503
- } catch (err) {
504
- logger.debug(
505
- `[milady] trajectory_logger registration failed while waiting (${context}): ${formatError(err)}`,
506
- );
507
- } finally {
508
- if (timeoutHandle) clearTimeout(timeoutHandle);
509
- }
510
- }
511
-
512
- function ensureTrajectoryLoggerEnabled(
513
- runtime: AgentRuntime,
514
- context: string,
515
- ): void {
516
- const runtimeLike = runtime as unknown as TrajectoryLoggerRuntimeLike;
517
- const candidates = collectTrajectoryLoggerCandidates(runtimeLike);
518
-
519
- let trajectoryLogger: TrajectoryLoggerControl | null = null;
520
- let bestScore = -1;
521
- for (const candidate of candidates) {
522
- const candidateWithRuntime = candidate as TrajectoryLoggerControl & {
523
- runtime?: { adapter?: unknown };
524
- initialized?: boolean;
525
- setEnabled?: unknown;
526
- };
527
- let score = 0;
528
- if (typeof candidate.isEnabled === "function") score += 2;
529
- if (typeof candidateWithRuntime.setEnabled === "function") score += 2;
530
- if (candidateWithRuntime.initialized === true) score += 3;
531
- if (candidateWithRuntime.runtime?.adapter) score += 3;
532
- const enabled =
533
- typeof candidate.isEnabled === "function" ? candidate.isEnabled() : true;
534
- if (enabled) score += 1;
535
- if (score > bestScore) {
536
- trajectoryLogger = candidate;
537
- bestScore = score;
538
- }
539
- }
540
- if (!trajectoryLogger) {
541
- logger.warn(
542
- `[milady] trajectory_logger service unavailable (${context}); trajectory capture disabled`,
543
- );
544
- return;
545
- }
546
-
547
- const isEnabled =
548
- typeof trajectoryLogger.isEnabled === "function"
549
- ? trajectoryLogger.isEnabled()
550
- : shouldEnableTrajectoryLoggingByDefault();
551
- const shouldEnable = shouldEnableTrajectoryLoggingByDefault();
552
- if (
553
- isEnabled !== shouldEnable &&
554
- typeof trajectoryLogger.setEnabled === "function"
555
- ) {
556
- trajectoryLogger.setEnabled(shouldEnable);
557
- logger.info(
558
- `[milady] trajectory_logger defaulted ${shouldEnable ? "on" : "off"} (${context})`,
559
- );
560
- }
561
- }
562
-
563
- function patchTrajectoryLoggerAliasCompatibility(runtime: AgentRuntime): void {
564
- const runtimeLike = runtime as unknown as TrajectoryLoggerRuntimeLike;
565
- const primary = collectTrajectoryLoggerCandidates(runtimeLike)[0] as
566
- | (TrajectoryLoggerControl & TrajectoryLoggerOps)
567
- | undefined;
568
- if (!primary) return;
569
-
570
- if (typeof runtimeLike.getService !== "function") return;
571
- const aliases: unknown[] = [
572
- runtimeLike.getService("logger5"),
573
- runtimeLike.getService("logger"),
574
- ];
575
-
576
- for (const alias of aliases) {
577
- if (!alias || typeof alias !== "object" || alias === primary) continue;
578
- const aliasOps = alias as TrajectoryLoggerOps;
579
- if (typeof aliasOps.startTrajectory !== "function") {
580
- aliasOps.startTrajectory = async (...args) => {
581
- if (typeof primary.startTrajectory === "function") {
582
- return primary.startTrajectory(...args);
583
- }
584
- return `step-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
585
- };
586
- }
587
- if (typeof aliasOps.startStep !== "function") {
588
- aliasOps.startStep = (trajectoryId: string) => {
589
- if (typeof primary.startStep === "function") {
590
- return primary.startStep(trajectoryId);
591
- }
592
- return `step-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
593
- };
594
- }
595
- if (typeof aliasOps.endTrajectory !== "function") {
596
- aliasOps.endTrajectory = async (...args) => {
597
- if (typeof primary.endTrajectory === "function") {
598
- await primary.endTrajectory(...args);
599
- }
600
- };
601
- }
602
- }
603
- }
604
-
605
- /**
606
- * Cancel the onboarding flow and exit cleanly.
607
- * Extracted to avoid duplicating the cancel+exit pattern 7 times.
608
- */
609
- function cancelOnboarding(): never {
610
- // _clack is guaranteed to be loaded by the time onboarding calls this.
611
- _clack?.cancel("Maybe next time!");
612
- process.exit(0);
613
- }
614
-
615
- // ---------------------------------------------------------------------------
616
- // Channel secret mapping
617
- // ---------------------------------------------------------------------------
618
-
619
- /**
620
- * Maps Milady channel config fields to the environment variable names
621
- * that elizaOS plugins expect.
622
- *
623
- * Milady stores channel credentials under `config.channels.<name>.<field>`,
624
- * while elizaOS plugins read them from process.env.
625
- */
626
- const RETAKE_CHANNEL_ACCESS_TOKEN_ENV = "RETAKE_AGENT_TOKEN";
627
-
628
- const CHANNEL_ENV_MAP: Readonly<
629
- Record<string, Readonly<Record<string, string>>>
630
- > = {
631
- discord: {
632
- token: "DISCORD_API_TOKEN",
633
- botToken: "DISCORD_API_TOKEN",
634
- applicationId: "DISCORD_APPLICATION_ID",
635
- },
636
- telegram: {
637
- botToken: "TELEGRAM_BOT_TOKEN",
638
- },
639
- slack: {
640
- botToken: "SLACK_BOT_TOKEN",
641
- appToken: "SLACK_APP_TOKEN",
642
- userToken: "SLACK_USER_TOKEN",
643
- },
644
- signal: {
645
- authDir: "SIGNAL_AUTH_DIR",
646
- account: "SIGNAL_ACCOUNT_NUMBER",
647
- httpUrl: "SIGNAL_HTTP_URL",
648
- cliPath: "SIGNAL_CLI_PATH",
649
- },
650
- msteams: {
651
- appId: "MSTEAMS_APP_ID",
652
- appPassword: "MSTEAMS_APP_PASSWORD",
653
- },
654
- mattermost: {
655
- botToken: "MATTERMOST_BOT_TOKEN",
656
- baseUrl: "MATTERMOST_BASE_URL",
657
- },
658
- googlechat: {
659
- serviceAccountKey: "GOOGLE_CHAT_SERVICE_ACCOUNT_KEY",
660
- },
661
- blooio: {
662
- apiKey: "BLOOIO_API_KEY",
663
- fromNumber: "BLOOIO_PHONE_NUMBER",
664
- webhookSecret: "BLOOIO_WEBHOOK_SECRET",
665
- webhookUrl: "BLOOIO_WEBHOOK_URL",
666
- webhookPort: "BLOOIO_WEBHOOK_PORT",
667
- },
668
- retake: {
669
- accessToken: RETAKE_CHANNEL_ACCESS_TOKEN_ENV,
670
- apiUrl: "RETAKE_API_URL",
671
- },
672
- };
673
-
674
- // ---------------------------------------------------------------------------
675
- // Plugin resolution
676
- // ---------------------------------------------------------------------------
677
-
678
- export { CORE_PLUGINS, OPTIONAL_CORE_PLUGINS };
679
-
680
- /**
681
- * Optional plugins that require native binaries or specific config.
682
- * These are only loaded when explicitly enabled via features config,
683
- * NOT by default — they crash if their prerequisites are missing.
684
- */
685
- const _OPTIONAL_NATIVE_PLUGINS: readonly string[] = [
686
- "@elizaos/plugin-browser", // requires browser server binary
687
- "@elizaos/plugin-vision", // requires @tensorflow/tfjs-node native addon
688
- "@elizaos/plugin-computeruse", // requires platform-specific binaries
689
- ];
690
-
691
- /** Maps Milady channel names to plugin package names. */
692
- export const CHANNEL_PLUGIN_MAP: Readonly<Record<string, string>> = {
693
- discord: "@elizaos/plugin-discord",
694
- telegram: "@elizaos/plugin-telegram",
695
- slack: "@elizaos/plugin-slack",
696
- twitter: "@elizaos/plugin-twitter",
697
- // Internal connector built from src/plugins/whatsapp (not an npm package).
698
- whatsapp: "@miladyai/plugin-whatsapp",
699
- // Internal connector built from src/plugins/signal (not an npm package).
700
- signal: "@miladyai/plugin-signal",
701
- imessage: "@elizaos/plugin-imessage",
702
- bluebubbles: "@elizaos/plugin-bluebubbles",
703
- farcaster: "@elizaos/plugin-farcaster",
704
- lens: "@elizaos/plugin-lens",
705
- msteams: "@elizaos/plugin-msteams",
706
- mattermost: "@elizaos/plugin-mattermost",
707
- googlechat: "@elizaos/plugin-google-chat",
708
- feishu: "@elizaos/plugin-feishu",
709
- matrix: "@elizaos/plugin-matrix",
710
- nostr: "@elizaos/plugin-nostr",
711
- retake: "@elizaos/plugin-retake",
712
- blooio: "@elizaos/plugin-blooio",
713
- twitch: "@elizaos/plugin-twitch",
714
- };
715
-
716
- const PI_AI_PLUGIN_PACKAGE = "@elizaos/plugin-pi-ai";
717
-
718
- function isPiAiEnabledFromEnv(env: NodeJS.ProcessEnv = process.env): boolean {
719
- const raw = env.MILADY_USE_PI_AI;
720
- if (!raw) return false;
721
- const value = String(raw).trim().toLowerCase();
722
- return value === "1" || value === "true" || value === "yes";
723
- }
724
-
725
- /** Maps environment variable names to model-provider plugin packages. */
726
- const PROVIDER_PLUGIN_MAP: Readonly<Record<string, string>> = {
727
- ANTHROPIC_API_KEY: "@elizaos/plugin-anthropic",
728
- OPENAI_API_KEY: "@elizaos/plugin-openai",
729
- GEMINI_API_KEY: "@elizaos/plugin-google-genai",
730
- GOOGLE_API_KEY: "@elizaos/plugin-google-genai",
731
- GOOGLE_GENERATIVE_AI_API_KEY: "@elizaos/plugin-google-genai",
732
- GROQ_API_KEY: "@elizaos/plugin-groq",
733
- XAI_API_KEY: "@elizaos/plugin-xai",
734
- OPENROUTER_API_KEY: "@elizaos/plugin-openrouter",
735
- AI_GATEWAY_API_KEY: "@elizaos/plugin-vercel-ai-gateway",
736
- AIGATEWAY_API_KEY: "@elizaos/plugin-vercel-ai-gateway",
737
- OLLAMA_BASE_URL: "@elizaos/plugin-ollama",
738
- ZAI_API_KEY: "@homunculuslabs/plugin-zai",
739
- MILADY_USE_PI_AI: PI_AI_PLUGIN_PACKAGE,
740
- // ElizaCloud — loaded when API key is present OR cloud is explicitly enabled
741
- ELIZAOS_CLOUD_API_KEY: "@elizaos/plugin-elizacloud",
742
- ELIZAOS_CLOUD_ENABLED: "@elizaos/plugin-elizacloud",
743
- };
744
-
745
- /**
746
- * Optional feature plugins keyed by feature name.
747
- *
748
- * Mappings here support short IDs in allow-lists and feature toggles.
749
- * Keep this map in sync with optional plugin registration and tests.
750
- */
751
- const OPTIONAL_PLUGIN_MAP: Readonly<Record<string, string>> = {
752
- browser: "@elizaos/plugin-browser",
753
- vision: "@elizaos/plugin-vision",
754
- cron: "@elizaos/plugin-cron",
755
- cua: "@elizaos/plugin-cua",
756
- computeruse: "@elizaos/plugin-computeruse",
757
- obsidian: "@elizaos/plugin-obsidian",
758
- repoprompt: "@elizaos/plugin-repoprompt",
759
- repoPrompt: "@elizaos/plugin-repoprompt",
760
- "pi-ai": PI_AI_PLUGIN_PACKAGE,
761
- piAi: PI_AI_PLUGIN_PACKAGE,
762
- x402: "@elizaos/plugin-x402",
763
- "coding-agent": "@elizaos/plugin-agent-orchestrator",
764
- "streaming-base": "@elizaos/plugin-streaming-base",
765
- "twitch-streaming": "@elizaos/plugin-twitch-streaming",
766
- "youtube-streaming": "@elizaos/plugin-youtube-streaming",
767
- "custom-rtmp": "@miladyai/plugin-custom-rtmp",
768
- "pumpfun-streaming": "@elizaos/plugin-pumpfun-streaming",
769
- "x-streaming": "@elizaos/plugin-x-streaming",
770
- };
771
-
772
- function looksLikePlugin(value: unknown): value is Plugin {
773
- if (!value || typeof value !== "object") return false;
774
- const obj = value as Record<string, unknown>;
775
- if (typeof obj.name !== "string" || typeof obj.description !== "string") {
776
- return false;
777
- }
778
-
779
- // Providers also expose { name, description } so we require at least one
780
- // plugin-like capability field before accepting named exports as plugins.
781
- return (
782
- Array.isArray(obj.services) ||
783
- Array.isArray(obj.providers) ||
784
- Array.isArray(obj.actions) ||
785
- Array.isArray(obj.routes) ||
786
- Array.isArray(obj.events) ||
787
- typeof obj.init === "function"
788
- );
789
- }
790
-
791
- function looksLikePluginBasic(
792
- value: unknown,
793
- ): value is Pick<Plugin, "name" | "description"> {
794
- if (!value || typeof value !== "object") return false;
795
- const obj = value as Record<string, unknown>;
796
- return typeof obj.name === "string" && typeof obj.description === "string";
797
- }
798
-
799
- export function findRuntimePluginExport(mod: PluginModuleShape): Plugin | null {
800
- // 1. Prefer explicit default export
801
- if (looksLikePlugin(mod.default)) return mod.default;
802
- // 2. Check for a named `plugin` export
803
- if (looksLikePlugin(mod.plugin)) return mod.plugin;
804
- // 3. Check if the module itself looks like a Plugin (CJS default pattern).
805
- if (looksLikePlugin(mod)) return mod as Plugin;
806
-
807
- // 4. Scan named exports in a deterministic order.
808
- // Prefer keys ending with "Plugin" before generic exports like providers.
809
- const namedKeys = Object.keys(mod).filter(
810
- (key) => key !== "default" && key !== "plugin",
811
- );
812
- const preferredKeys = namedKeys.filter(
813
- (key) => /plugin$/i.test(key) || /^plugin/i.test(key),
814
- );
815
- const fallbackKeys = namedKeys.filter((key) => !preferredKeys.includes(key));
816
-
817
- for (const key of [...preferredKeys, ...fallbackKeys]) {
818
- const value = mod[key];
819
- if (looksLikePlugin(value)) return value;
820
- }
821
-
822
- // 5. Final compatibility fallback: accept minimal plugin-like exports only
823
- // when the export name itself indicates it's a plugin.
824
- for (const key of preferredKeys) {
825
- const value = mod[key];
826
- if (looksLikePluginBasic(value)) return value as Plugin;
827
- }
828
-
829
- // 6. Legacy CJS compatibility for modules that export only { name, description }.
830
- if (looksLikePluginBasic(mod)) return mod as unknown as Plugin;
831
- if (looksLikePluginBasic(mod.default)) return mod.default as Plugin;
832
- if (looksLikePluginBasic(mod.plugin)) return mod.plugin as Plugin;
833
-
834
- return null;
835
- }
836
-
837
- /**
838
- * Collect the set of plugin package names that should be loaded
839
- * based on config, environment variables, and feature flags.
840
- */
841
- /** @internal Exported for testing. */
842
- export function collectPluginNames(config: ElizaConfig): Set<string> {
843
- const shellPluginDisabled = config.features?.shellEnabled === false;
844
- const localEmbeddingsExplicitlyDisabled = (() => {
845
- const raw = process.env.MILADY_DISABLE_LOCAL_EMBEDDINGS;
846
- if (!raw) return false;
847
- const normalized = raw.trim().toLowerCase();
848
- return normalized === "1" || normalized === "true" || normalized === "yes";
849
- })();
850
- const cloudMode = config.cloud?.enabled;
851
- const cloudHasApiKey = Boolean(config.cloud?.apiKey);
852
- const cloudExplicitlyDisabled = cloudMode === false;
853
- // Note: this is intentionally broader than the inference-path check in
854
- // applyCloudConfigToEnv (which requires explicit `enabled: true`). Here
855
- // hasApiKey acts as an implicit enable signal so the cloud *plugin* gets
856
- // loaded for RPC/services (auth, credits, billing) even when inference
857
- // itself is handled by the user's own keys (BYOK). The inference and
858
- // persistence paths gate on `cloud.enabled === true` separately.
859
- const cloudEffectivelyEnabled =
860
- cloudMode === true || (!cloudExplicitlyDisabled && cloudHasApiKey);
861
- // When inferenceMode is "byok" or "local", OR services.inference is false,
862
- // the user wants their own AI provider keys — cloud stays enabled for
863
- // RPC/services but does NOT hijack model inference.
864
- //
865
- // If the user chose a subscription provider (e.g. anthropic-subscription)
866
- // during onboarding and never explicitly set inferenceMode, treat that as
867
- // "byok" — the subscription IS the user's inference choice.
868
- const hasSubscriptionProvider = Boolean(
869
- config.agents?.defaults?.subscriptionProvider,
870
- );
871
- const explicitInferenceMode = config.cloud?.inferenceMode;
872
- const cloudInferenceMode =
873
- explicitInferenceMode ?? (hasSubscriptionProvider ? "byok" : "cloud");
874
- const cloudInferenceToggle = config.cloud?.services?.inference ?? true;
875
- const cloudHandlesInference =
876
- cloudEffectivelyEnabled &&
877
- cloudInferenceMode === "cloud" &&
878
- cloudInferenceToggle !== false;
879
- const configEnv = config.env as
880
- | (Record<string, unknown> & { vars?: Record<string, unknown> })
881
- | undefined;
882
- const configPiAiFlag =
883
- (configEnv?.vars &&
884
- typeof configEnv.vars === "object" &&
885
- !Array.isArray(configEnv.vars)
886
- ? (configEnv.vars as Record<string, unknown>).MILADY_USE_PI_AI
887
- : undefined) ?? configEnv?.MILADY_USE_PI_AI;
888
- const piAiEnabled =
889
- isPiAiEnabledFromEnv(process.env) ||
890
- (typeof configPiAiFlag === "string" &&
891
- isPiAiEnabledFromEnv({
892
- MILADY_USE_PI_AI: configPiAiFlag,
893
- } as NodeJS.ProcessEnv));
894
-
895
- const pluginEntries = (config.plugins as Record<string, unknown> | undefined)
896
- ?.entries as Record<string, { enabled?: boolean }> | undefined;
897
-
898
- const isPluginExplicitlyDisabled = (pluginPackageName: string): boolean => {
899
- const marker = "/plugin-";
900
- const markerIndex = pluginPackageName.lastIndexOf(marker);
901
- const pluginId =
902
- markerIndex >= 0
903
- ? pluginPackageName.slice(markerIndex + marker.length)
904
- : pluginPackageName;
905
- return pluginEntries?.[pluginId]?.enabled === false;
906
- };
907
-
908
- const providerPluginIdSet = new Set(
909
- Object.values(PROVIDER_PLUGIN_MAP).map((pluginPackageName) => {
910
- const marker = "/plugin-";
911
- const markerIndex = pluginPackageName.lastIndexOf(marker);
912
- return markerIndex >= 0
913
- ? pluginPackageName.slice(markerIndex + marker.length)
914
- : pluginPackageName;
915
- }),
916
- );
917
- const explicitProviderEntries = Object.entries(pluginEntries ?? {}).filter(
918
- ([pluginId]) => providerPluginIdSet.has(pluginId),
919
- );
920
- const hasExplicitEnabledProvider = explicitProviderEntries.some(
921
- ([, entry]) => entry?.enabled === true,
922
- );
923
-
924
- // Allow-list entries are additive (extra plugins), not exclusive.
925
- const allowList = config.plugins?.allow;
926
- const pluginsToLoad = new Set<string>(CORE_PLUGINS);
927
- if (localEmbeddingsExplicitlyDisabled) {
928
- pluginsToLoad.delete("@elizaos/plugin-local-embedding");
929
- }
930
-
931
- // Allow list is additive — extra plugins on top of auto-detection,
932
- // not an exclusive whitelist that blocks everything else.
933
- if (allowList && allowList.length > 0) {
934
- for (const item of allowList) {
935
- const pluginName =
936
- CHANNEL_PLUGIN_MAP[item] ?? OPTIONAL_PLUGIN_MAP[item] ?? item;
937
- pluginsToLoad.add(pluginName);
938
- }
939
- }
940
-
941
- // Connector plugins — load when connector has config entries
942
- // Prefer config.connectors, fall back to config.channels for backward compatibility
943
- const connectors = config.connectors ?? config.channels ?? {};
944
- for (const [channelName, channelConfig] of Object.entries(connectors)) {
945
- if (channelConfig && typeof channelConfig === "object") {
946
- const pluginName = CHANNEL_PLUGIN_MAP[channelName];
947
- if (pluginName) {
948
- pluginsToLoad.add(pluginName);
949
- }
950
- }
951
- }
952
-
953
- // Model-provider plugins — load when env key is present
954
- for (const [envKey, pluginName] of Object.entries(PROVIDER_PLUGIN_MAP)) {
955
- if (envKey === "MILADY_USE_PI_AI") {
956
- // pi-ai enablement uses dedicated boolean parsing + precedence logic below.
957
- continue;
958
- }
959
- if (
960
- cloudExplicitlyDisabled &&
961
- (envKey === "ELIZAOS_CLOUD_API_KEY" || envKey === "ELIZAOS_CLOUD_ENABLED")
962
- ) {
963
- continue;
964
- }
965
- if (isPluginExplicitlyDisabled(pluginName)) {
966
- continue;
967
- }
968
- if (hasExplicitEnabledProvider) {
969
- const marker = "/plugin-";
970
- const markerIndex = pluginName.lastIndexOf(marker);
971
- const pluginId =
972
- markerIndex >= 0
973
- ? pluginName.slice(markerIndex + marker.length)
974
- : pluginName;
975
- if (pluginEntries?.[pluginId]?.enabled !== true) {
976
- continue;
977
- }
978
- }
979
- if (process.env[envKey]?.trim()) {
980
- pluginsToLoad.add(pluginName);
981
- }
982
- }
983
-
984
- const shouldEnablePiAi =
985
- piAiEnabled && pluginEntries?.["pi-ai"]?.enabled !== false;
986
-
987
- const applyProviderPrecedence = (): void => {
988
- // Provider precedence:
989
- // 1) ElizaCloud for inference (when enabled AND inferenceMode is "cloud")
990
- // 2) pi-ai (when enabled and cloud inference is not active)
991
- // 3) direct provider plugins (api-key/env based)
992
- //
993
- // When inferenceMode is "byok" or "local", cloud stays loaded for
994
- // RPC/services but direct AI provider plugins are preserved so the
995
- // user's own API keys (e.g. Anthropic) handle model inference.
996
- if (cloudEffectivelyEnabled) {
997
- pluginsToLoad.add("@elizaos/plugin-elizacloud");
998
-
999
- if (cloudHandlesInference) {
1000
- // Cloud handles ALL model calls — remove direct AI provider plugins.
1001
- const directProviders = new Set(Object.values(PROVIDER_PLUGIN_MAP));
1002
- directProviders.delete("@elizaos/plugin-elizacloud");
1003
- for (const p of directProviders) {
1004
- pluginsToLoad.delete(p);
1005
- }
1006
- return;
1007
- }
1008
- // inferenceMode is "byok" or "local" — keep direct provider plugins.
1009
- // Cloud plugin stays loaded for non-inference cloud services (RPC, media, etc.)
1010
- // Pi-ai takes priority over direct providers when cloud inference is disabled.
1011
- if (shouldEnablePiAi) {
1012
- pluginsToLoad.add(PI_AI_PLUGIN_PACKAGE);
1013
- // Remove direct provider plugins — pi-ai handles inference selection.
1014
- const directProviders = new Set(Object.values(PROVIDER_PLUGIN_MAP));
1015
- directProviders.delete(PI_AI_PLUGIN_PACKAGE);
1016
- directProviders.delete("@elizaos/plugin-elizacloud");
1017
- for (const p of directProviders) {
1018
- pluginsToLoad.delete(p);
1019
- }
1020
- }
1021
- return;
1022
- }
1023
-
1024
- if (shouldEnablePiAi) {
1025
- pluginsToLoad.add(PI_AI_PLUGIN_PACKAGE);
1026
-
1027
- // When pi-ai is active, remove direct provider plugins + cloud plugin.
1028
- // pi-ai performs the upstream provider selection itself.
1029
- const directProviders = new Set(Object.values(PROVIDER_PLUGIN_MAP));
1030
- directProviders.delete(PI_AI_PLUGIN_PACKAGE);
1031
- for (const p of directProviders) {
1032
- pluginsToLoad.delete(p);
1033
- }
1034
- pluginsToLoad.delete("@elizaos/plugin-elizacloud");
1035
- return;
1036
- }
1037
-
1038
- if (cloudExplicitlyDisabled) {
1039
- // Cloud was explicitly disabled — remove elizacloud even though it's
1040
- // in CORE_PLUGINS, so it cannot intercept model calls.
1041
- pluginsToLoad.delete("@elizaos/plugin-elizacloud");
1042
- }
1043
- };
1044
-
1045
- // Apply once before additive plugin-entry/feature paths.
1046
- applyProviderPrecedence();
1047
-
1048
- // Optional feature plugins from config.plugins.entries
1049
- const pluginsConfig = config.plugins as
1050
- | Record<string, Record<string, unknown>>
1051
- | undefined;
1052
- if (pluginsConfig?.entries) {
1053
- for (const [key, entry] of Object.entries(pluginsConfig.entries)) {
1054
- if (
1055
- entry &&
1056
- typeof entry === "object" &&
1057
- (entry as Record<string, unknown>).enabled !== false
1058
- ) {
1059
- // Connector keys (telegram, discord, etc.) must use CHANNEL_PLUGIN_MAP
1060
- // so the correct variant loads.
1061
- const pluginName =
1062
- CHANNEL_PLUGIN_MAP[key] ??
1063
- OPTIONAL_PLUGIN_MAP[key] ??
1064
- (key.includes("/") ? key : `@elizaos/plugin-${key}`);
1065
- pluginsToLoad.add(pluginName);
1066
- }
1067
- }
1068
- }
1069
-
1070
- // Feature flags (config.features)
1071
- const features = config.features;
1072
- if (features && typeof features === "object") {
1073
- for (const [featureName, featureValue] of Object.entries(features)) {
1074
- const isEnabled =
1075
- featureValue === true ||
1076
- (typeof featureValue === "object" &&
1077
- featureValue !== null &&
1078
- (featureValue as Record<string, unknown>).enabled !== false);
1079
- if (isEnabled) {
1080
- const pluginName = OPTIONAL_PLUGIN_MAP[featureName];
1081
- if (pluginName) {
1082
- pluginsToLoad.add(pluginName);
1083
- }
1084
- }
1085
- }
1086
- }
1087
-
1088
- // x402 plugin — auto-load when config section enabled
1089
- if (config.x402?.enabled) {
1090
- pluginsToLoad.add("@elizaos/plugin-x402");
1091
- }
1092
-
1093
- // Opinion plugin — auto-load when API key is present.
1094
- // NOT in PROVIDER_PLUGIN_MAP because it is a feature plugin, not a model
1095
- // provider, and would be incorrectly removed during provider precedence.
1096
- if (process.env.OPINION_API_KEY?.trim()) {
1097
- pluginsToLoad.add("@miladyai/plugin-opinion");
1098
- }
1099
-
1100
- // User-installed plugins from config.plugins.installs
1101
- // These are plugins that were installed via the plugin-manager at runtime
1102
- // and tracked in milady.json so they persist across restarts.
1103
- const installs = config.plugins?.installs;
1104
- if (installs && typeof installs === "object") {
1105
- for (const [packageName, record] of Object.entries(installs)) {
1106
- if (record && typeof record === "object") {
1107
- pluginsToLoad.add(packageName);
1108
- }
1109
- }
1110
- }
1111
-
1112
- // Re-apply provider precedence so later additive paths (entries, features,
1113
- // installs) cannot accidentally re-introduce suppressed providers.
1114
- applyProviderPrecedence();
1115
-
1116
- // Enforce feature gating last so allow-list entries cannot bypass it.
1117
- if (shellPluginDisabled) {
1118
- pluginsToLoad.delete("@elizaos/plugin-shell");
1119
- }
1120
- if (isPluginExplicitlyDisabled("@elizaos/plugin-agent-orchestrator")) {
1121
- pluginsToLoad.delete("@elizaos/plugin-agent-orchestrator");
1122
- }
1123
-
1124
- return pluginsToLoad;
1125
- }
1126
-
1127
- // ---------------------------------------------------------------------------
1128
- // Custom / drop-in plugin discovery
1129
- // ---------------------------------------------------------------------------
1130
-
1131
- /** Subdirectory under the Milady state dir for drop-in custom plugins. */
1132
- export const CUSTOM_PLUGINS_DIRNAME = "plugins/custom";
1133
- /** Subdirectory under the Milady state dir for ejected plugins. */
1134
- export const EJECTED_PLUGINS_DIRNAME = "plugins/ejected";
1135
-
1136
- /**
1137
- * Scan a directory for drop-in plugin packages. Each immediate subdirectory
1138
- * is treated as a plugin; name comes from package.json or the directory name.
1139
- */
1140
- export async function scanDropInPlugins(
1141
- dir: string,
1142
- ): Promise<Record<string, PluginInstallRecord>> {
1143
- const records: Record<string, PluginInstallRecord> = {};
1144
-
1145
- let entries: Dirent[];
1146
- try {
1147
- entries = await fs.readdir(dir, { withFileTypes: true });
1148
- } catch (err) {
1149
- if ((err as NodeJS.ErrnoException).code === "ENOENT") {
1150
- return records;
1151
- }
1152
- throw err;
1153
- }
1154
-
1155
- for (const entry of entries) {
1156
- if (!entry.isDirectory()) continue;
1157
-
1158
- const pluginDir = path.join(dir, entry.name);
1159
- let pluginName = entry.name;
1160
- let version = "0.0.0";
1161
-
1162
- try {
1163
- const raw = await fs.readFile(
1164
- path.join(pluginDir, "package.json"),
1165
- "utf-8",
1166
- );
1167
- const pkg = JSON.parse(raw) as { name?: string; version?: string };
1168
- if (typeof pkg.name === "string" && pkg.name.trim())
1169
- pluginName = pkg.name.trim();
1170
- if (typeof pkg.version === "string" && pkg.version.trim())
1171
- version = pkg.version.trim();
1172
- } catch (err) {
1173
- if (
1174
- (err as NodeJS.ErrnoException).code !== "ENOENT" &&
1175
- !(err instanceof SyntaxError)
1176
- ) {
1177
- throw err;
1178
- }
1179
- }
1180
-
1181
- records[pluginName] = { source: "path", installPath: pluginDir, version };
1182
- }
1183
-
1184
- return records;
1185
- }
1186
-
1187
- /**
1188
- * Merge drop-in plugins into the load set. Filters out denied, core-colliding,
1189
- * and already-installed names. Mutates `pluginsToLoad` and `installRecords`.
1190
- */
1191
- export function mergeDropInPlugins(params: {
1192
- dropInRecords: Record<string, PluginInstallRecord>;
1193
- installRecords: Record<string, PluginInstallRecord>;
1194
- corePluginNames: ReadonlySet<string>;
1195
- denyList: ReadonlySet<string>;
1196
- pluginsToLoad: Set<string>;
1197
- }): { accepted: string[]; skipped: string[] } {
1198
- const {
1199
- dropInRecords,
1200
- installRecords,
1201
- corePluginNames,
1202
- denyList,
1203
- pluginsToLoad,
1204
- } = params;
1205
- const accepted: string[] = [];
1206
- const skipped: string[] = [];
1207
-
1208
- for (const [name, record] of Object.entries(dropInRecords)) {
1209
- if (denyList.has(name) || installRecords[name]) continue;
1210
- if (corePluginNames.has(name)) {
1211
- skipped.push(
1212
- `[milady] Custom plugin "${name}" collides with core plugin — skipping`,
1213
- );
1214
- continue;
1215
- }
1216
- pluginsToLoad.add(name);
1217
- installRecords[name] = record;
1218
- accepted.push(name);
1219
- }
1220
-
1221
- return { accepted, skipped };
1222
- }
1223
-
1224
- const WORKSPACE_PLUGIN_OVERRIDES = new Set<string>([
1225
- // "@elizaos/plugin-trajectory-logger",
1226
- // "@elizaos/plugin-plugin-manager",
1227
- // "@elizaos/plugin-media-generation",
1228
- "@elizaos/plugin-twitch-streaming",
1229
- "@elizaos/plugin-youtube-streaming",
1230
- "@elizaos/plugin-retake",
1231
- ]);
1232
-
1233
- function getWorkspacePluginOverridePath(pluginName: string): string | null {
1234
- if (process.env.MILADY_DISABLE_WORKSPACE_PLUGIN_OVERRIDES === "1") {
1235
- return null;
1236
- }
1237
- if (!WORKSPACE_PLUGIN_OVERRIDES.has(pluginName)) {
1238
- return null;
1239
- }
1240
-
1241
- const pluginSegmentMatch = pluginName.match(/^@[^/]+\/(plugin-[^/]+)$/);
1242
- const pluginSegment = pluginSegmentMatch?.[1];
1243
- if (!pluginSegment) return null;
1244
-
1245
- const thisDir = path.dirname(fileURLToPath(import.meta.url));
1246
- const miladyRoot = path.resolve(thisDir, "..", "..");
1247
- const workspaceRoot = path.resolve(miladyRoot, "..");
1248
- const candidates = [
1249
- path.join(miladyRoot, "plugins", pluginSegment, "typescript"),
1250
- path.join(workspaceRoot, "plugins", pluginSegment, "typescript"),
1251
- path.join(miladyRoot, "plugins", pluginSegment),
1252
- path.join(workspaceRoot, "plugins", pluginSegment),
1253
- path.join(miladyRoot, "packages", pluginSegment),
1254
- path.join(workspaceRoot, "packages", pluginSegment),
1255
- ];
1256
-
1257
- for (const candidate of candidates) {
1258
- if (existsSync(path.join(candidate, "package.json"))) {
1259
- return candidate;
1260
- }
1261
- }
1262
-
1263
- return null;
1264
- }
1265
-
1266
- export function resolveMiladyPluginImportSpecifier(
1267
- pluginName: string,
1268
- runtimeModuleUrl = import.meta.url,
1269
- ): string {
1270
- if (!pluginName.startsWith("@miladyai/plugin-")) {
1271
- return pluginName;
1272
- }
1273
-
1274
- const shortName = pluginName.replace("@miladyai/plugin-", "");
1275
- const thisDir = path.dirname(fileURLToPath(runtimeModuleUrl));
1276
- const distRoot = thisDir.endsWith("runtime")
1277
- ? path.resolve(thisDir, "..")
1278
- : thisDir;
1279
- const indexPath = path.resolve(distRoot, "plugins", shortName, "index.js");
1280
-
1281
- return existsSync(indexPath) ? pathToFileURL(indexPath).href : pluginName;
1282
- }
1283
-
1284
- export function shouldIgnoreMissingPluginExport(pluginName: string): boolean {
1285
- return pluginName === "@elizaos/plugin-streaming-base";
1286
- }
1287
-
1288
- // ---------------------------------------------------------------------------
1289
- // Plugin resolution
1290
- // ---------------------------------------------------------------------------
1291
-
1292
- // ---------------------------------------------------------------------------
1293
- // Browser server pre-flight
1294
- // ---------------------------------------------------------------------------
1295
-
1296
- /**
1297
- * The `@elizaos/plugin-browser` npm package expects a `dist/server/` directory
1298
- * containing the compiled stagehand-server, but the npm publish doesn't include
1299
- * it. The actual source/build lives in the workspace at
1300
- * `plugins/plugin-browser/stagehand-server/`.
1301
- *
1302
- * This function checks whether the server is reachable from the installed
1303
- * package and, if not, creates a symlink so the plugin's process-manager can
1304
- * find it. Returns `true` when the server index.js is available (or was made
1305
- * available via symlink), `false` otherwise.
1306
- */
1307
- /**
1308
- * Returns true if the given env var key is safe to forward to runtime.settings.
1309
- * Blocks blockchain private keys, secrets, passwords, tokens, credentials,
1310
- * mnemonics, and seed phrases while allowing API keys that plugins need.
1311
- */
1312
- export function isEnvKeyAllowedForForwarding(key: string): boolean {
1313
- const upper = key.toUpperCase();
1314
- // Block blockchain private keys
1315
- if (upper.includes("PRIVATE_KEY")) return false;
1316
- if (upper.startsWith("EVM_") || upper.startsWith("SOLANA_")) return false;
1317
- // Block secrets, passwords, tokens, and seed phrases (but not API_KEY which plugins need)
1318
- if (/(SECRET|PASSWORD|CREDENTIAL|MNEMONIC|SEED_PHRASE)/i.test(key))
1319
- return false;
1320
- if (/(ACCESS_TOKEN|REFRESH_TOKEN|SESSION_TOKEN|AUTH_TOKEN)$/i.test(key))
1321
- return false;
1322
- return true;
1323
- }
1324
-
1325
- export function ensureBrowserServerLink(): boolean {
1326
- try {
1327
- // Resolve the plugin-browser package root via its package.json.
1328
- const req = createRequire(import.meta.url);
1329
- const pkgJsonPath = req.resolve("@elizaos/plugin-browser/package.json");
1330
- const pluginRoot = path.dirname(pkgJsonPath);
1331
- const serverDir = path.join(pluginRoot, "dist", "server");
1332
- const serverIndex = path.join(serverDir, "dist", "index");
1333
-
1334
- // Already linked / available — nothing to do.
1335
- if (existsSync(serverIndex)) return true;
1336
-
1337
- // Walk upward from this file to find the eliza-workspace root.
1338
- // Layout: <workspace>/milady/src/runtime/eliza.ts
1339
- const thisDir = path.dirname(fileURLToPath(import.meta.url));
1340
- const miladyRoot = path.resolve(thisDir, "..", "..");
1341
- const workspaceRoot = path.resolve(miladyRoot, "..");
1342
- const stagehandDir = path.join(
1343
- workspaceRoot,
1344
- "plugins",
1345
- "plugin-browser",
1346
- "stagehand-server",
1347
- );
1348
- const stagehandIndex = path.join(stagehandDir, "dist", "index");
1349
-
1350
- if (!existsSync(stagehandIndex)) {
1351
- logger.info(
1352
- `[milady] Browser server not found at ${stagehandDir} — ` +
1353
- `@elizaos/plugin-browser will not be loaded`,
1354
- );
1355
- return false;
1356
- }
1357
-
1358
- // Create symlink: dist/server -> stagehand-server
1359
- symlinkSync(stagehandDir, serverDir, "dir");
1360
- logger.info(
1361
- `[milady] Linked browser server: ${serverDir} -> ${stagehandDir}`,
1362
- );
1363
- return true;
1364
- } catch (err) {
1365
- logger.debug(`[milady] Could not link browser server: ${formatError(err)}`);
1366
- return false;
1367
- }
1368
- }
1369
-
1370
- // ---------------------------------------------------------------------------
1371
- // Plugin resolution
1372
- // ---------------------------------------------------------------------------
1373
-
1374
- /**
1375
- * Resolve Milady plugins from config and auto-enable logic.
1376
- * Returns an array of elizaOS Plugin instances ready for AgentRuntime.
1377
- *
1378
- * Handles three categories of plugins:
1379
- * 1. Built-in/npm plugins — imported by package name
1380
- * 2. User-installed plugins — from ~/.milady/plugins/installed/
1381
- * 3. Custom/drop-in plugins — from ~/.milady/plugins/custom/ and plugins.load.paths
1382
- *
1383
- * Each plugin is loaded inside an error boundary so a single failing plugin
1384
- * cannot crash the entire agent startup.
1385
- */
1386
- /**
1387
- * Resolve a statically-imported @elizaos plugin by name.
1388
- * Returns the module if found in STATIC_ELIZA_PLUGINS, otherwise null.
1389
- */
1390
- function resolveStaticElizaPlugin(pluginName: string): unknown | null {
1391
- return STATIC_ELIZA_PLUGINS[pluginName] ?? null;
1392
- }
1393
-
1394
- async function resolvePlugins(
1395
- config: ElizaConfig,
1396
- opts?: { quiet?: boolean },
1397
- ): Promise<ResolvedPlugin[]> {
1398
- const plugins: ResolvedPlugin[] = [];
1399
- const failedPlugins: Array<{ name: string; error: string }> = [];
1400
- const repairedInstallRecords = new Set<string>();
1401
-
1402
- applyPluginAutoEnable({
1403
- config,
1404
- env: process.env,
1405
- } satisfies ApplyPluginAutoEnableParams);
1406
-
1407
- const pluginsToLoad = collectPluginNames(config);
1408
- const corePluginSet = new Set<string>(CORE_PLUGINS);
1409
-
1410
- // Build a mutable map of install records so we can merge drop-in discoveries
1411
- const installRecords: Record<string, PluginInstallRecord> = {
1412
- ...(config.plugins?.installs ?? {}),
1413
- };
1414
-
1415
- const denyList = new Set<string>((config.plugins?.deny || []) as string[]);
1416
-
1417
- // ── Auto-discover ejected plugins ───────────────────────────────────────
1418
- // Ejected plugins override npm/core versions, so they are tracked
1419
- // separately and consulted first at import time.
1420
- const ejectedRecords = await scanDropInPlugins(
1421
- path.join(resolveStateDir(), EJECTED_PLUGINS_DIRNAME),
1422
- );
1423
- const ejectedPluginNames: string[] = [];
1424
- for (const [name, _record] of Object.entries(ejectedRecords)) {
1425
- if (denyList.has(name)) continue;
1426
- pluginsToLoad.add(name);
1427
- ejectedPluginNames.push(name);
1428
- }
1429
- if (ejectedPluginNames.length > 0) {
1430
- logger.info(
1431
- `[milady] Discovered ${ejectedPluginNames.length} ejected plugin(s): ${ejectedPluginNames.join(", ")}`,
1432
- );
1433
- }
1434
-
1435
- // ── Auto-discover drop-in custom plugins ────────────────────────────────
1436
- // Scan well-known dir + any extra dirs from plugins.load.paths (first wins).
1437
- const scanDirs = [
1438
- path.join(resolveStateDir(), CUSTOM_PLUGINS_DIRNAME),
1439
- ...(config.plugins?.load?.paths ?? []).map(resolveUserPath),
1440
- ];
1441
- const dropInRecords: Record<string, PluginInstallRecord> = {};
1442
- for (const dir of scanDirs) {
1443
- for (const [name, record] of Object.entries(await scanDropInPlugins(dir))) {
1444
- if (!dropInRecords[name]) dropInRecords[name] = record;
1445
- }
1446
- }
1447
-
1448
- // Merge into load set — deny list and core collisions are filtered out.
1449
- const { accepted: customPluginNames, skipped } = mergeDropInPlugins({
1450
- dropInRecords,
1451
- installRecords,
1452
- corePluginNames: corePluginSet,
1453
- denyList,
1454
- pluginsToLoad,
1455
- });
1456
-
1457
- for (const msg of skipped) logger.warn(msg);
1458
- if (customPluginNames.length > 0) {
1459
- logger.info(
1460
- `[milady] Discovered ${customPluginNames.length} custom plugin(s): ${customPluginNames.join(", ")}`,
1461
- );
1462
- }
1463
-
1464
- logger.info(`[milady] Resolving ${pluginsToLoad.size} plugins...`);
1465
- const loadStartTime = Date.now();
1466
-
1467
- // Built once so we don't rebuild on every optional plugin failure.
1468
- const optionalPluginNames = new Set([
1469
- ...Object.values(OPTIONAL_PLUGIN_MAP),
1470
- ...Object.values(CHANNEL_PLUGIN_MAP),
1471
- ...OPTIONAL_CORE_PLUGINS,
1472
- ]);
1473
-
1474
- // Load a single plugin - returns result or null on skip/failure
1475
- async function loadSinglePlugin(pluginName: string): Promise<{
1476
- name: string;
1477
- plugin: Plugin;
1478
- } | null> {
1479
- const isCore = corePluginSet.has(pluginName);
1480
- const ejectedRecord = ejectedRecords[pluginName];
1481
- const installRecord = installRecords[pluginName];
1482
- const workspaceOverridePath = getWorkspacePluginOverridePath(pluginName);
1483
-
1484
- // Pre-flight: ensure native dependencies are available for special plugins.
1485
- if (pluginName === "@elizaos/plugin-browser") {
1486
- if (!ensureBrowserServerLink()) {
1487
- failedPlugins.push({
1488
- name: pluginName,
1489
- error: "browser server binary not found",
1490
- });
1491
- logger.warn(
1492
- `[milady] Skipping ${pluginName}: browser server not available. ` +
1493
- `Build the stagehand-server or remove the plugin from plugins.allow.`,
1494
- );
1495
- return null;
1496
- }
1497
- }
1498
-
1499
- try {
1500
- let mod: PluginModuleShape;
1501
-
1502
- if (ejectedRecord?.installPath) {
1503
- // Ejected plugin — always prefer local source over npm/core.
1504
- logger.debug(
1505
- `[milady] Loading ejected plugin: ${pluginName} from ${ejectedRecord.installPath}`,
1506
- );
1507
- mod = await importFromPath(ejectedRecord.installPath, pluginName);
1508
- } else if (workspaceOverridePath) {
1509
- logger.debug(
1510
- `[milady] Loading workspace plugin override: ${pluginName} from ${workspaceOverridePath}`,
1511
- );
1512
- mod = await importFromPath(workspaceOverridePath, pluginName);
1513
- } else if (installRecord?.installPath) {
1514
- // Prefer bundled/node_modules copies for official Eliza plugins.
1515
- const isOfficialElizaPlugin = pluginName.startsWith("@elizaos/plugin-");
1516
-
1517
- if (isOfficialElizaPlugin) {
1518
- try {
1519
- const staticMod = await resolveStaticElizaPlugin(pluginName);
1520
- mod = staticMod
1521
- ? (staticMod as PluginModuleShape)
1522
- : ((await import(pluginName)) as PluginModuleShape);
1523
- if (repairBrokenInstallRecord(config, pluginName)) {
1524
- repairedInstallRecords.add(pluginName);
1525
- }
1526
- } catch (npmErr) {
1527
- logger.warn(
1528
- `[milady] Node_modules resolution failed for ${pluginName} (${formatError(npmErr)}). Trying installed path at ${installRecord.installPath}.`,
1529
- );
1530
- mod = await importFromPath(installRecord.installPath, pluginName);
1531
- }
1532
- } else {
1533
- // User-installed plugin — load from its install directory on disk.
1534
- try {
1535
- mod = await importFromPath(installRecord.installPath, pluginName);
1536
- } catch (installErr) {
1537
- logger.warn(
1538
- `[milady] Installed plugin ${pluginName} failed at ${installRecord.installPath} (${formatError(installErr)}). Falling back to node_modules resolution.`,
1539
- );
1540
- const staticMod = await resolveStaticElizaPlugin(pluginName);
1541
- mod = staticMod
1542
- ? (staticMod as PluginModuleShape)
1543
- : ((await import(pluginName)) as PluginModuleShape);
1544
- if (repairBrokenInstallRecord(config, pluginName)) {
1545
- repairedInstallRecords.add(pluginName);
1546
- }
1547
- }
1548
- }
1549
- } else if (pluginName.startsWith("@miladyai/plugin-")) {
1550
- // Milady plugins can resolve either from bundled local wrappers
1551
- // under milady-dist/plugins/* or from packaged node_modules.
1552
- mod = (await import(
1553
- resolveMiladyPluginImportSpecifier(pluginName)
1554
- )) as PluginModuleShape;
1555
- } else {
1556
- // Built-in/npm plugin — try bundled static import first, then
1557
- // fall back to bare node_modules resolution.
1558
- const staticMod = pluginName.startsWith("@elizaos/plugin-")
1559
- ? await resolveStaticElizaPlugin(pluginName)
1560
- : null;
1561
- mod = staticMod
1562
- ? (staticMod as PluginModuleShape)
1563
- : ((await import(pluginName)) as PluginModuleShape);
1564
- }
1565
-
1566
- const pluginInstance = findRuntimePluginExport(mod);
1567
-
1568
- if (pluginInstance) {
1569
- // Wrap the plugin's init function with an error boundary
1570
- const wrappedPlugin = wrapPluginWithErrorBoundary(
1571
- pluginName,
1572
- pluginInstance,
1573
- );
1574
- logger.debug(`[milady] ✓ Loaded plugin: ${pluginName}`);
1575
- return { name: pluginName, plugin: wrappedPlugin };
1576
- } else {
1577
- if (shouldIgnoreMissingPluginExport(pluginName)) {
1578
- logger.info(
1579
- `[milady] Skipping helper package ${pluginName}: no Plugin export is expected`,
1580
- );
1581
- return null;
1582
- }
1583
-
1584
- const msg = `[milady] Plugin ${pluginName} did not export a valid Plugin object`;
1585
- failedPlugins.push({
1586
- name: pluginName,
1587
- error: "no valid Plugin export",
1588
- });
1589
- if (isCore) {
1590
- logger.error(msg);
1591
- } else {
1592
- logger.warn(msg);
1593
- }
1594
- return null;
1595
- }
1596
- } catch (err) {
1597
- const msg = formatError(err);
1598
-
1599
- failedPlugins.push({ name: pluginName, error: msg });
1600
- if (isCore) {
1601
- logger.error(
1602
- `[milady] Failed to load core plugin ${pluginName}: ${msg}`,
1603
- );
1604
- } else {
1605
- if (optionalPluginNames.has(pluginName)) {
1606
- logger.debug(
1607
- `[milady] Optional plugin ${pluginName} not available: ${msg}`,
1608
- );
1609
- } else {
1610
- logger.info(`[milady] Could not load plugin ${pluginName}: ${msg}`);
1611
- }
1612
- }
1613
- return null;
1614
- }
1615
- }
1616
-
1617
- // Load all plugins in parallel for faster startup
1618
- const pluginResults = await Promise.all(
1619
- Array.from(pluginsToLoad).map(loadSinglePlugin),
1620
- );
1621
-
1622
- // Collect successful loads
1623
- for (const result of pluginResults) {
1624
- if (result) {
1625
- plugins.push(result);
1626
- }
1627
- }
1628
-
1629
- const loadDuration = Date.now() - loadStartTime;
1630
- logger.info(`[milady] Plugin loading took ${loadDuration}ms`);
1631
-
1632
- // Summary logging
1633
- logger.info(
1634
- `[milady] Plugin resolution complete: ${plugins.length}/${pluginsToLoad.size} loaded` +
1635
- (failedPlugins.length > 0 ? `, ${failedPlugins.length} failed` : ""),
1636
- );
1637
- if (failedPlugins.length > 0) {
1638
- logger.info(
1639
- `[milady] Failed plugins: ${failedPlugins.map((f) => `${f.name} (${f.error})`).join(", ")}`,
1640
- );
1641
- }
1642
-
1643
- // Diagnose version-skew issues when AI providers failed to load (#10)
1644
- const loadedNames = plugins.map((p) => p.name);
1645
- const diagnostic = diagnoseNoAIProvider(loadedNames, failedPlugins);
1646
- if (diagnostic) {
1647
- if (opts?.quiet) {
1648
- // In headless/GUI mode before onboarding, this is expected — the user
1649
- // will configure a provider through the onboarding wizard and restart.
1650
- logger.info(`[milady] ${diagnostic}`);
1651
- } else {
1652
- logger.error(`[milady] ${diagnostic}`);
1653
- }
1654
- }
1655
-
1656
- // Persist repaired install records so future startups do not keep trying
1657
- // to import from stale install directories.
1658
- if (repairedInstallRecords.size > 0) {
1659
- try {
1660
- saveElizaConfig(config);
1661
- logger.info(
1662
- `[milady] Repaired ${repairedInstallRecords.size} plugin install record(s): ${Array.from(repairedInstallRecords).join(", ")}`,
1663
- );
1664
- } catch (err) {
1665
- logger.warn(
1666
- `[milady] Failed to persist plugin install repairs: ${formatError(err)}`,
1667
- );
1668
- }
1669
- }
1670
-
1671
- return plugins;
1672
- }
1673
-
1674
- /** @internal Exported for testing. */
1675
- export function repairBrokenInstallRecord(
1676
- config: ElizaConfig,
1677
- pluginName: string,
1678
- ): boolean {
1679
- const record = config.plugins?.installs?.[pluginName];
1680
- if (!record || typeof record.installPath !== "string") return false;
1681
- if (!record.installPath.trim()) return false;
1682
-
1683
- // Keep the plugin listed as installed but force node_modules resolution.
1684
- record.installPath = "";
1685
- record.source = "npm";
1686
- return true;
1687
- }
1688
-
1689
- /**
1690
- * Wrap a plugin's `init` and `providers` with error boundaries so that a
1691
- * crash in any single plugin does not take down the entire agent or GUI.
1692
- *
1693
- * NOTE: Actions are NOT wrapped here because elizaOS's action dispatch
1694
- * already has its own error boundary. Only `init` (startup) and
1695
- * `providers` (called every turn) need protection at this layer.
1696
- *
1697
- * The wrapper catches errors, logs them with the plugin name for easy
1698
- * debugging, and continues execution.
1699
- */
1700
- function wrapPluginWithErrorBoundary(
1701
- pluginName: string,
1702
- plugin: Plugin,
1703
- ): Plugin {
1704
- const wrapped: Plugin = { ...plugin };
1705
-
1706
- // Wrap init if present
1707
- if (plugin.init) {
1708
- const originalInit = plugin.init;
1709
- wrapped.init = async (...args: Parameters<typeof originalInit>) => {
1710
- try {
1711
- return await originalInit(...args);
1712
- } catch (err) {
1713
- logger.error(
1714
- `[milady] Plugin "${pluginName}" crashed during init: ${formatError(err)}`,
1715
- );
1716
- // Surface the error but don't rethrow — the agent continues
1717
- // without this plugin's init having completed.
1718
- logger.warn(
1719
- `[milady] Plugin "${pluginName}" will run in degraded mode (init failed)`,
1720
- );
1721
- }
1722
- };
1723
- }
1724
-
1725
- // Wrap providers with error boundaries
1726
- if (plugin.providers && plugin.providers.length > 0) {
1727
- wrapped.providers = plugin.providers.map((provider) => ({
1728
- ...provider,
1729
- get: async (...args: Parameters<typeof provider.get>) => {
1730
- try {
1731
- return await provider.get(...args);
1732
- } catch (err) {
1733
- const msg = formatError(err);
1734
- logger.error(
1735
- `[milady] Provider "${provider.name}" (plugin: ${pluginName}) crashed: ${msg}`,
1736
- );
1737
- // Return an error marker so downstream consumers can detect
1738
- // the failure rather than silently using empty data.
1739
- return {
1740
- text: `[Provider ${provider.name} error: ${msg}]`,
1741
- data: { _providerError: true },
1742
- };
1743
- }
1744
- },
1745
- }));
1746
- }
1747
-
1748
- return wrapped;
1749
- }
1750
-
1751
- /**
1752
- * Import a plugin module from its install directory on disk.
1753
- *
1754
- * Handles two install layouts:
1755
- * 1. npm layout: <installPath>/node_modules/@scope/package/ (from `bun add`)
1756
- * 2. git layout: <installPath>/ is the package root directly (from `git clone`)
1757
- *
1758
- * @param installPath Root directory of the installation (e.g. ~/.milady/plugins/installed/foo/).
1759
- * @param packageName The npm package name (e.g. "@elizaos/plugin-discord") — used
1760
- * to navigate directly into node_modules when present.
1761
- */
1762
- async function importFromPath(
1763
- installPath: string,
1764
- packageName: string,
1765
- ): Promise<PluginModuleShape> {
1766
- const absPath = path.resolve(installPath);
1767
-
1768
- // npm/bun layout: installPath/node_modules/@scope/name/
1769
- // git layout: installPath/ is the package itself
1770
- const nmCandidate = path.join(
1771
- absPath,
1772
- "node_modules",
1773
- ...packageName.split("/"),
1774
- );
1775
- let pkgRoot = absPath;
1776
- try {
1777
- if ((await fs.stat(nmCandidate)).isDirectory()) pkgRoot = nmCandidate;
1778
- } catch (err) {
1779
- if ((err as NodeJS.ErrnoException).code !== "ENOENT") {
1780
- throw err;
1781
- }
1782
- /* git layout — pkgRoot stays as absPath */
1783
- }
1784
-
1785
- // Resolve entry point from package.json
1786
- const entryPoint = await resolvePackageEntry(pkgRoot);
1787
- return (await import(pathToFileURL(entryPoint).href)) as PluginModuleShape;
1788
- }
1789
-
1790
- /** Read package.json exports/main to find the importable entry file. */
1791
- /** @internal Exported for testing. */
1792
- export async function resolvePackageEntry(pkgRoot: string): Promise<string> {
1793
- const fallback = path.join(pkgRoot, "dist", "index");
1794
- const fallbackCandidates = [
1795
- fallback,
1796
- path.join(pkgRoot, "index"),
1797
- path.join(pkgRoot, "index.mjs"),
1798
- path.join(pkgRoot, "index.ts"),
1799
- path.join(pkgRoot, "src", "index"),
1800
- path.join(pkgRoot, "src", "index.mjs"),
1801
- path.join(pkgRoot, "src", "index.ts"),
1802
- ];
1803
-
1804
- const chooseExisting = (...paths: string[]): string => {
1805
- const seen = new Set<string>();
1806
- for (const p of paths) {
1807
- const resolved = path.resolve(p);
1808
- if (seen.has(resolved)) continue;
1809
- seen.add(resolved);
1810
- if (existsSync(resolved)) return resolved;
1811
- }
1812
- // Return first candidate even when missing so callers still get a useful path in errors.
1813
- return path.resolve(paths[0] ?? fallback);
1814
- };
1815
-
1816
- try {
1817
- const raw = await fs.readFile(path.join(pkgRoot, "package.json"), "utf-8");
1818
- const pkg = JSON.parse(raw) as {
1819
- name?: string;
1820
- main?: string;
1821
- exports?: Record<string, string | Record<string, string>> | string;
1822
- };
1823
-
1824
- if (typeof pkg.exports === "object" && pkg.exports["."] !== undefined) {
1825
- const dot = pkg.exports["."];
1826
- const resolved =
1827
- typeof dot === "string" ? dot : dot.import || dot.default;
1828
- if (typeof resolved === "string") {
1829
- return chooseExisting(
1830
- path.resolve(pkgRoot, resolved),
1831
- ...fallbackCandidates,
1832
- );
1833
- }
1834
- }
1835
- if (typeof pkg.exports === "string") {
1836
- return chooseExisting(
1837
- path.resolve(pkgRoot, pkg.exports),
1838
- ...fallbackCandidates,
1839
- );
1840
- }
1841
- if (pkg.main) {
1842
- return chooseExisting(
1843
- path.resolve(pkgRoot, pkg.main),
1844
- ...fallbackCandidates,
1845
- );
1846
- }
1847
- return chooseExisting(...fallbackCandidates);
1848
- } catch (err) {
1849
- if ((err as NodeJS.ErrnoException).code === "ENOENT") {
1850
- return chooseExisting(...fallbackCandidates);
1851
- }
1852
- throw err;
1853
- }
1854
- }
1855
-
1856
- // ---------------------------------------------------------------------------
1857
- // Config → Character mapping
1858
- // ---------------------------------------------------------------------------
1859
-
1860
- /**
1861
- * Propagate channel credentials from Milady config into process.env so
1862
- * that elizaOS plugins can find them.
1863
- */
1864
- /** @internal Exported for testing. */
1865
- export function applyConnectorSecretsToEnv(config: ElizaConfig): void {
1866
- // Prefer config.connectors, fall back to config.channels for backward compatibility
1867
- const connectors = config.connectors ?? config.channels ?? {};
1868
-
1869
- for (const [channelName, channelConfig] of Object.entries(connectors)) {
1870
- if (!channelConfig || typeof channelConfig !== "object") continue;
1871
- const configObj = channelConfig as Record<string, unknown>;
1872
-
1873
- // Discord plugins in the ecosystem use both DISCORD_API_TOKEN and
1874
- // DISCORD_BOT_TOKEN across versions. Mirror to both when available.
1875
- if (channelName === "discord") {
1876
- const tokenValue =
1877
- (typeof configObj.token === "string" && configObj.token.trim()) ||
1878
- (typeof configObj.botToken === "string" && configObj.botToken.trim()) ||
1879
- "";
1880
- if (tokenValue) {
1881
- if (!process.env.DISCORD_API_TOKEN) {
1882
- process.env.DISCORD_API_TOKEN = tokenValue;
1883
- }
1884
- if (!process.env.DISCORD_BOT_TOKEN) {
1885
- process.env.DISCORD_BOT_TOKEN = tokenValue;
1886
- }
1887
- }
1888
- }
1889
-
1890
- const envMap = CHANNEL_ENV_MAP[channelName];
1891
- if (!envMap) continue;
1892
-
1893
- for (const [configField, envKey] of Object.entries(envMap)) {
1894
- const value = configObj[configField];
1895
- if (typeof value === "string" && value.trim()) {
1896
- // Set if unset, or overwrite stale [REDACTED] placeholders
1897
- const existing = process.env[envKey];
1898
- if (!existing || existing.startsWith("[REDACT")) {
1899
- process.env[envKey] = value;
1900
- }
1901
- }
1902
- }
1903
- }
1904
- }
1905
-
1906
- /**
1907
- * Auto-resolve Discord Application ID from the bot token via Discord API.
1908
- * Called during async runtime init so that users only need a bot token.
1909
- */
1910
- /** @internal Exported for testing. */
1911
- export async function autoResolveDiscordAppId(): Promise<void> {
1912
- if (process.env.DISCORD_APPLICATION_ID) return;
1913
-
1914
- const discordToken =
1915
- process.env.DISCORD_API_TOKEN || process.env.DISCORD_BOT_TOKEN;
1916
- if (!discordToken) return;
1917
-
1918
- try {
1919
- const res = await fetch(
1920
- "https://discord.com/api/v10/oauth2/applications/@me",
1921
- { headers: { Authorization: `Bot ${discordToken}` } },
1922
- );
1923
-
1924
- if (!res.ok) {
1925
- logger.warn(
1926
- `[milady] Failed to auto-resolve Discord Application ID: ${res.status}`,
1927
- );
1928
- return;
1929
- }
1930
-
1931
- const app = (await res.json()) as { id?: string };
1932
- if (!app.id) return;
1933
-
1934
- process.env.DISCORD_APPLICATION_ID = app.id;
1935
- logger.info(`[milady] Auto-resolved Discord Application ID: ${app.id}`);
1936
- } catch (err) {
1937
- logger.warn(
1938
- `[milady] Could not auto-resolve Discord Application ID: ${err}`,
1939
- );
1940
- }
1941
- }
1942
-
1943
- /**
1944
- * Propagate cloud config from Milady config into process.env so the
1945
- * ElizaCloud plugin can discover settings at startup.
1946
- */
1947
- /** @internal Exported for testing. */
1948
- export function applyCloudConfigToEnv(config: ElizaConfig): void {
1949
- const cloud = config.cloud;
1950
- if (!cloud) return;
1951
-
1952
- const cloudMode = cloud.enabled;
1953
- // Require explicit cloud.enabled = true. Previously, undefined + apiKey
1954
- // would count as enabled, causing the model to revert to cloud on restart.
1955
- const effectivelyEnabled = cloudMode === true;
1956
-
1957
- if (effectivelyEnabled) {
1958
- process.env.ELIZAOS_CLOUD_ENABLED = "true";
1959
- logger.info(
1960
- `[milady] Cloud config: enabled=${cloud.enabled}, hasApiKey=${Boolean(cloud.apiKey)}, baseUrl=${cloud.baseUrl ?? "(default)"}`,
1961
- );
1962
- } else {
1963
- delete process.env.ELIZAOS_CLOUD_ENABLED;
1964
- delete process.env.ELIZAOS_CLOUD_SMALL_MODEL;
1965
- delete process.env.ELIZAOS_CLOUD_LARGE_MODEL;
1966
- }
1967
- if (cloud.apiKey) {
1968
- process.env.ELIZAOS_CLOUD_API_KEY = cloud.apiKey;
1969
- } else {
1970
- delete process.env.ELIZAOS_CLOUD_API_KEY;
1971
- }
1972
- if (cloud.baseUrl) {
1973
- process.env.ELIZAOS_CLOUD_BASE_URL = cloud.baseUrl;
1974
- } else {
1975
- delete process.env.ELIZAOS_CLOUD_BASE_URL;
1976
- }
1977
-
1978
- // Propagate model names so the cloud plugin picks them up. Falls back to
1979
- // sensible defaults when cloud is enabled but no explicit selection exists.
1980
- // Skip when inferenceMode is "byok"/"local" or services.inference is off —
1981
- // user's own keys handle models.
1982
- // If the user chose a subscription provider, treat that as "byok" unless
1983
- // they explicitly set inferenceMode to "cloud".
1984
- const hasSubProvider = Boolean(config.agents?.defaults?.subscriptionProvider);
1985
- const explicitMode = cloud.inferenceMode;
1986
- const inferenceMode = explicitMode ?? (hasSubProvider ? "byok" : "cloud");
1987
- const inferenceToggle = cloud.services?.inference ?? true;
1988
- const cloudDoesInference =
1989
- inferenceMode === "cloud" && inferenceToggle !== false;
1990
- const models = (config as Record<string, unknown>).models as
1991
- | { small?: string; large?: string }
1992
- | undefined;
1993
- if (effectivelyEnabled && cloudDoesInference) {
1994
- const small = models?.small || "openai/gpt-5-mini";
1995
- const large = models?.large || "anthropic/claude-sonnet-4.5";
1996
- process.env.SMALL_MODEL = small;
1997
- process.env.LARGE_MODEL = large;
1998
- process.env.ELIZAOS_CLOUD_SMALL_MODEL = small;
1999
- process.env.ELIZAOS_CLOUD_LARGE_MODEL = large;
2000
- } else if (effectivelyEnabled) {
2001
- // Cloud enabled but inference handled by user's own keys — clean cloud
2002
- // model env vars so the cloud plugin doesn't intercept model calls.
2003
- delete process.env.ELIZAOS_CLOUD_SMALL_MODEL;
2004
- delete process.env.ELIZAOS_CLOUD_LARGE_MODEL;
2005
- }
2006
-
2007
- // Propagate per-service disable flags so downstream code can check them
2008
- // without needing direct access to the ElizaConfig object.
2009
- const services = cloud.services;
2010
- if (services) {
2011
- if (services.tts === false) {
2012
- process.env.MILADY_CLOUD_TTS_DISABLED = "true";
2013
- process.env.ELIZA_CLOUD_TTS_DISABLED = "true";
2014
- } else {
2015
- delete process.env.MILADY_CLOUD_TTS_DISABLED;
2016
- delete process.env.ELIZA_CLOUD_TTS_DISABLED;
2017
- }
2018
- if (services.media === false) {
2019
- process.env.MILADY_CLOUD_MEDIA_DISABLED = "true";
2020
- process.env.ELIZA_CLOUD_MEDIA_DISABLED = "true";
2021
- } else {
2022
- delete process.env.MILADY_CLOUD_MEDIA_DISABLED;
2023
- delete process.env.ELIZA_CLOUD_MEDIA_DISABLED;
2024
- }
2025
- if (services.embeddings === false) {
2026
- process.env.MILADY_CLOUD_EMBEDDINGS_DISABLED = "true";
2027
- process.env.ELIZA_CLOUD_EMBEDDINGS_DISABLED = "true";
2028
- } else {
2029
- delete process.env.MILADY_CLOUD_EMBEDDINGS_DISABLED;
2030
- delete process.env.ELIZA_CLOUD_EMBEDDINGS_DISABLED;
2031
- }
2032
- if (services.rpc === false) {
2033
- process.env.MILADY_CLOUD_RPC_DISABLED = "true";
2034
- process.env.ELIZA_CLOUD_RPC_DISABLED = "true";
2035
- } else {
2036
- delete process.env.MILADY_CLOUD_RPC_DISABLED;
2037
- delete process.env.ELIZA_CLOUD_RPC_DISABLED;
2038
- }
2039
- }
2040
- }
2041
-
2042
- /**
2043
- * Translate `config.database` into the environment variables that
2044
- * `@elizaos/plugin-sql` reads at init time (`POSTGRES_URL`, `PGLITE_DATA_DIR`).
2045
- *
2046
- * When the provider is "postgres", we build a connection string from the
2047
- * credentials (or use the explicit `connectionString` field) and set
2048
- * `POSTGRES_URL`. When the provider is "pglite" (the default), we set
2049
- * `PGLITE_DATA_DIR` to either the configured value or a stable workspace
2050
- * default (`~/.milady/workspace/.eliza/.elizadb`) and remove any stale
2051
- * `POSTGRES_URL`.
2052
- */
2053
- /** @internal Exported for testing. */
2054
- export function applyX402ConfigToEnv(config: ElizaConfig): void {
2055
- const x402 = (config as Record<string, unknown>).x402 as
2056
- | { enabled?: boolean; apiKey?: string; baseUrl?: string }
2057
- | undefined;
2058
- if (!x402?.enabled) return;
2059
- if (!process.env.X402_ENABLED) process.env.X402_ENABLED = "true";
2060
- if (x402.apiKey && !process.env.X402_API_KEY)
2061
- process.env.X402_API_KEY = x402.apiKey;
2062
- if (x402.baseUrl && !process.env.X402_BASE_URL)
2063
- process.env.X402_BASE_URL = x402.baseUrl;
2064
- }
2065
-
2066
- function resolveDefaultPgliteDataDir(config: ElizaConfig): string {
2067
- const workspaceDir =
2068
- config.agents?.defaults?.workspace ?? resolveDefaultAgentWorkspaceDir();
2069
- return path.join(resolveUserPath(workspaceDir), ".eliza", ".elizadb");
2070
- }
2071
-
2072
- /** @internal Exported for testing. */
2073
- export function applyDatabaseConfigToEnv(config: ElizaConfig): void {
2074
- const db = config.database;
2075
- const provider = db?.provider ?? "pglite";
2076
-
2077
- if (provider === "postgres" && db?.postgres) {
2078
- const pg = db.postgres;
2079
- let url = pg.connectionString;
2080
- if (!url) {
2081
- const host = pg.host ?? "localhost";
2082
- const port = pg.port ?? 5432;
2083
- const user = encodeURIComponent(pg.user ?? "postgres");
2084
- const password = pg.password ? encodeURIComponent(pg.password) : "";
2085
- const database = pg.database ?? "postgres";
2086
- const auth = password ? `${user}:${password}` : user;
2087
- const sslParam = pg.ssl ? "?sslmode=require" : "";
2088
- url = `postgresql://${auth}@${host}:${port}/${database}${sslParam}`;
2089
- }
2090
- process.env.POSTGRES_URL = url;
2091
- // Clear PGLite dir so plugin-sql does not fall back to PGLite
2092
- delete process.env.PGLITE_DATA_DIR;
2093
- } else {
2094
- // PGLite mode (default): ensure no leftover POSTGRES_URL and pin
2095
- // PGLite to the workspace path unless overridden by config/env.
2096
- delete process.env.POSTGRES_URL;
2097
-
2098
- const configuredDataDir = db?.pglite?.dataDir?.trim();
2099
- if (configuredDataDir) {
2100
- process.env.PGLITE_DATA_DIR = resolveUserPath(configuredDataDir);
2101
- // Fall through to directory creation below instead of returning early
2102
- }
2103
-
2104
- const envDataDir = process.env.PGLITE_DATA_DIR?.trim();
2105
- if (!envDataDir) {
2106
- process.env.PGLITE_DATA_DIR = resolveDefaultPgliteDataDir(config);
2107
- }
2108
-
2109
- // Ensure the PGlite data directory exists before init so PGlite does
2110
- // not silently fall back to in-memory mode on first run.
2111
- const dataDir = process.env.PGLITE_DATA_DIR;
2112
- if (dataDir) {
2113
- const alreadyExisted = existsSync(dataDir);
2114
- mkdirSync(dataDir, { recursive: true });
2115
- logger.info(
2116
- `[milady] PGlite data dir: ${dataDir} (${alreadyExisted ? "existed" : "created"})`,
2117
- );
2118
-
2119
- // Remove stale postmaster.pid left by a crashed process. Without this,
2120
- // PGlite sees the lock and either fails or triggers the destructive
2121
- // resetPgliteDataDir path, wiping all conversation history.
2122
- cleanStalePglitePid(dataDir);
2123
- }
2124
- }
2125
- }
2126
-
2127
- type PglitePidFileStatus =
2128
- | "missing"
2129
- | "active"
2130
- | "active-unconfirmed"
2131
- | "cleared-stale"
2132
- | "cleared-malformed"
2133
- | "check-failed";
2134
-
2135
- type PgliteRecoveryAction =
2136
- | "none"
2137
- | "retry-without-reset"
2138
- | "reset-data-dir"
2139
- | "fail-active-lock";
2140
-
2141
- function reconcilePglitePidFile(dataDir: string): PglitePidFileStatus {
2142
- const pidPath = path.join(dataDir, "postmaster.pid");
2143
- if (!existsSync(pidPath)) return "missing";
2144
-
2145
- try {
2146
- const content = readFileSync(pidPath, "utf-8");
2147
- const firstLine = content.split("\n")[0]?.trim();
2148
- const pid = parseInt(firstLine, 10);
2149
-
2150
- if (Number.isNaN(pid) || pid <= 0) {
2151
- // Malformed pid file — remove it
2152
- unlinkSync(pidPath);
2153
- logger.warn(`[milady] Removed malformed PGlite postmaster.pid`);
2154
- return "cleared-malformed";
2155
- }
2156
-
2157
- // Check if the process is still alive
2158
- try {
2159
- process.kill(pid, 0); // signal 0 = existence check, doesn't kill
2160
- // Process exists — pid file is NOT stale, leave it alone
2161
- logger.info(
2162
- `[milady] PGlite postmaster.pid references running process ${pid} — leaving intact`,
2163
- );
2164
- return "active";
2165
- } catch (killErr: unknown) {
2166
- const code = (killErr as NodeJS.ErrnoException).code;
2167
- if (code === "ESRCH") {
2168
- // Process doesn't exist — stale pid file, safe to remove
2169
- unlinkSync(pidPath);
2170
- logger.warn(
2171
- `[milady] Removed stale PGlite postmaster.pid (process ${pid} not running)`,
2172
- );
2173
- return "cleared-stale";
2174
- } else {
2175
- // EPERM or other — process may be alive under a different user,
2176
- // leave the file alone to avoid data directory corruption
2177
- logger.warn(
2178
- `[milady] Cannot confirm postmaster.pid staleness (${code}) — leaving intact`,
2179
- );
2180
- return "active-unconfirmed";
2181
- }
2182
- }
2183
- } catch (err) {
2184
- logger.warn(
2185
- `[milady] Failed to check PGlite postmaster.pid: ${formatError(err)}`,
2186
- );
2187
- return "check-failed";
2188
- }
2189
- }
2190
-
2191
- /**
2192
- * Check for and remove a stale postmaster.pid in the PGlite data directory.
2193
- * The pid file is stale if the recorded process is no longer running.
2194
- */
2195
- export function cleanStalePglitePid(dataDir: string): void {
2196
- void reconcilePglitePidFile(dataDir);
2197
- }
2198
-
2199
- function collectErrorMessages(err: unknown): string[] {
2200
- const messages: string[] = [];
2201
- const seen = new Set<unknown>();
2202
- let current: unknown = err;
2203
-
2204
- while (current && !seen.has(current)) {
2205
- seen.add(current);
2206
-
2207
- if (typeof current === "string") {
2208
- messages.push(current);
2209
- break;
2210
- }
2211
-
2212
- if (current instanceof Error) {
2213
- if (current.message) messages.push(current.message);
2214
- if (current.stack) messages.push(current.stack);
2215
- current = (current as Error & { cause?: unknown }).cause;
2216
- continue;
2217
- }
2218
-
2219
- if (typeof current === "object") {
2220
- const maybeErr = current as { message?: unknown; cause?: unknown };
2221
- if (typeof maybeErr.message === "string" && maybeErr.message) {
2222
- messages.push(maybeErr.message);
2223
- }
2224
- if (maybeErr.cause !== undefined) {
2225
- current = maybeErr.cause;
2226
- continue;
2227
- }
2228
- }
2229
-
2230
- break;
2231
- }
2232
-
2233
- return messages;
2234
- }
2235
-
2236
- function isPgliteLockError(err: unknown): boolean {
2237
- const haystack = collectErrorMessages(err).join("\n").toLowerCase();
2238
- if (!haystack) return false;
2239
-
2240
- const hasPglite = haystack.includes("pglite");
2241
- const hasSqlite = haystack.includes("sqlite");
2242
- const hasLockSignal =
2243
- haystack.includes("database is locked") ||
2244
- haystack.includes("lock file already exists");
2245
-
2246
- return hasLockSignal && (hasPglite || hasSqlite);
2247
- }
2248
-
2249
- /** @internal Exported for testing. */
2250
- export function isRecoverablePgliteInitError(err: unknown): boolean {
2251
- const haystack = collectErrorMessages(err).join("\n").toLowerCase();
2252
- if (!haystack) return false;
2253
-
2254
- const hasAbort = haystack.includes("aborted(). build with -sassertions");
2255
- const hasPglite = haystack.includes("pglite");
2256
- const hasSqlite = haystack.includes("sqlite");
2257
- const hasMigrationsSchema =
2258
- haystack.includes("create schema if not exists migrations") ||
2259
- haystack.includes("failed query: create schema if not exists migrations");
2260
- const hasRecoverableStorageSignal = [
2261
- "database disk image is malformed",
2262
- "file is not a database",
2263
- "malformed database schema",
2264
- "database is locked",
2265
- "lock file already exists",
2266
- "wal file",
2267
- "checkpoint failed",
2268
- "checksum mismatch",
2269
- "corrupt",
2270
- ].some((needle) => haystack.includes(needle));
2271
-
2272
- if (hasMigrationsSchema) return true;
2273
- if (hasAbort && hasPglite) return true;
2274
- if (hasRecoverableStorageSignal && (hasPglite || hasSqlite)) return true;
2275
- return false;
2276
- }
2277
-
2278
- /** @internal Exported for testing. */
2279
- export function getPgliteRecoveryAction(
2280
- err: unknown,
2281
- dataDir: string,
2282
- ): PgliteRecoveryAction {
2283
- if (!isRecoverablePgliteInitError(err)) return "none";
2284
- if (!isPgliteLockError(err)) return "reset-data-dir";
2285
-
2286
- const pidStatus = reconcilePglitePidFile(dataDir);
2287
- if (
2288
- pidStatus === "active" ||
2289
- pidStatus === "active-unconfirmed" ||
2290
- pidStatus === "check-failed"
2291
- ) {
2292
- return "fail-active-lock";
2293
- }
2294
- if (pidStatus === "cleared-stale" || pidStatus === "cleared-malformed") {
2295
- return "retry-without-reset";
2296
- }
2297
- return "reset-data-dir";
2298
- }
2299
-
2300
- function createActivePgliteLockError(dataDir: string, err: unknown): Error {
2301
- return new Error(
2302
- `PGLite data dir is already in use at ${dataDir}. Close the other Milady process or set a different PGLITE_DATA_DIR before retrying.`,
2303
- { cause: err },
2304
- );
2305
- }
2306
-
2307
- function resolveActivePgliteDataDir(config: ElizaConfig): string | null {
2308
- const provider = config.database?.provider ?? "pglite";
2309
- if (provider === "postgres") return null;
2310
-
2311
- const configured = process.env.PGLITE_DATA_DIR?.trim();
2312
- const dataDir = configured || resolveDefaultPgliteDataDir(config);
2313
- return resolveUserPath(dataDir);
2314
- }
2315
-
2316
- async function resetPgliteDataDir(dataDir: string): Promise<void> {
2317
- const normalized = path.resolve(dataDir);
2318
- const root = path.parse(normalized).root;
2319
- if (normalized === root) {
2320
- throw new Error(`Refusing to reset unsafe PGLite path: ${normalized}`);
2321
- }
2322
-
2323
- const stamp = new Date()
2324
- .toISOString()
2325
- .replace(/[-:]/g, "")
2326
- .replace(/\..*$/, "")
2327
- .replace("T", "-");
2328
- const backupDir = `${normalized}.corrupt-${stamp}`;
2329
-
2330
- if (existsSync(normalized)) {
2331
- try {
2332
- await fs.rename(normalized, backupDir);
2333
- logger.warn(
2334
- `[milady] Backed up existing PGLite data dir to ${backupDir}`,
2335
- );
2336
- } catch (err) {
2337
- logger.warn(
2338
- `[milady] Failed to back up PGLite data dir (${formatError(err)}); deleting ${normalized} instead`,
2339
- );
2340
- await fs.rm(normalized, { recursive: true, force: true });
2341
- }
2342
- }
2343
-
2344
- await fs.mkdir(normalized, { recursive: true });
2345
- }
2346
-
2347
- async function initializeDatabaseAdapter(
2348
- runtime: AgentRuntime,
2349
- config: ElizaConfig,
2350
- ): Promise<void> {
2351
- if (!runtime.adapter || (await runtime.adapter.isReady())) return;
2352
-
2353
- try {
2354
- const adapterInit = (runtime.adapter as unknown as Record<string, unknown>).init ?? runtime.adapter.initialize;
2355
- if (typeof adapterInit === "function") await adapterInit.call(runtime.adapter);
2356
- logger.info(
2357
- "[milady] Database adapter initialized early (before plugin inits)",
2358
- );
2359
- } catch (err) {
2360
- const pgliteDataDir = resolveActivePgliteDataDir(config);
2361
- if (!pgliteDataDir) {
2362
- throw err;
2363
- }
2364
-
2365
- const recoveryAction = getPgliteRecoveryAction(err, pgliteDataDir);
2366
- if (recoveryAction === "none") {
2367
- throw err;
2368
- }
2369
- if (recoveryAction === "fail-active-lock") {
2370
- throw createActivePgliteLockError(pgliteDataDir, err);
2371
- }
2372
-
2373
- if (recoveryAction === "retry-without-reset") {
2374
- logger.warn(
2375
- `[milady] PGLite init failed (${formatError(err)}). Cleared a stale PGLite lock in ${pgliteDataDir} and retrying without resetting data.`,
2376
- );
2377
- } else {
2378
- logger.warn(
2379
- `[milady] PGLite init failed (${formatError(err)}). Resetting local DB at ${pgliteDataDir} and retrying once.`,
2380
- );
2381
- await resetPgliteDataDir(pgliteDataDir);
2382
- process.env.PGLITE_DATA_DIR = pgliteDataDir;
2383
- }
2384
-
2385
- const adapterInit2 = (runtime.adapter as unknown as Record<string, unknown>).init ?? runtime.adapter.initialize;
2386
- if (typeof adapterInit2 === "function") await adapterInit2.call(runtime.adapter);
2387
- logger.info(
2388
- recoveryAction === "retry-without-reset"
2389
- ? "[milady] Database adapter recovered after clearing a stale PGLite lock"
2390
- : "[milady] Database adapter recovered after resetting PGLite data",
2391
- );
2392
- }
2393
-
2394
- // Health check: verify PGlite data directory has files after init.
2395
- // Runs on BOTH the happy path and the recovery path.
2396
- await verifyPgliteDataDir(config);
2397
- }
2398
-
2399
- /**
2400
- * Verify PGlite data directory contains files after init.
2401
- * Warns if the directory is empty (suggests ephemeral/in-memory fallback).
2402
- */
2403
- async function verifyPgliteDataDir(config: ElizaConfig): Promise<void> {
2404
- const pgliteDataDir = resolveActivePgliteDataDir(config);
2405
- if (!pgliteDataDir || !existsSync(pgliteDataDir)) return;
2406
-
2407
- try {
2408
- const files = await fs.readdir(pgliteDataDir);
2409
- logger.info(
2410
- `[milady] PGlite health check: ${files.length} file(s) in ${pgliteDataDir}`,
2411
- );
2412
- if (files.length === 0) {
2413
- logger.warn(
2414
- `[milady] PGlite data directory is empty after init — data may not persist across restarts`,
2415
- );
2416
- }
2417
- } catch (err) {
2418
- logger.warn(`[milady] PGlite health check failed: ${formatError(err)}`);
2419
- }
2420
- }
2421
-
2422
- function isPluginAlreadyRegisteredError(err: unknown): boolean {
2423
- return formatError(err).toLowerCase().includes("already registered");
2424
- }
2425
-
2426
- interface RuntimeWithMethodBindings extends AgentRuntime {
2427
- __miladyMethodBindingsInstalled?: boolean;
2428
- __miladyComponentWriteDiagnosticsInstalled?: boolean;
2429
- __miladyEntityWriteDiagnosticsInstalled?: boolean;
2430
- __miladyEntityCreateMutex?: Promise<void>;
2431
- }
2432
-
2433
- interface RuntimeWithActionAliases extends Omit<AgentRuntime, "actions"> {
2434
- __miladyActionAliasesInstalled?: boolean;
2435
- actions?: Array<{ name?: string; similes?: string[] }>;
2436
- }
2437
-
2438
- type DbErrorLike = {
2439
- name?: unknown;
2440
- message?: unknown;
2441
- code?: unknown;
2442
- detail?: unknown;
2443
- hint?: unknown;
2444
- constraint?: unknown;
2445
- schema?: unknown;
2446
- table?: unknown;
2447
- column?: unknown;
2448
- where?: unknown;
2449
- cause?: unknown;
2450
- };
2451
-
2452
- function getConstraintName(error: unknown): string | null {
2453
- if (!error || typeof error !== "object") return null;
2454
- const err = error as DbErrorLike;
2455
- if (typeof err.constraint === "string" && err.constraint.length > 0) {
2456
- return err.constraint;
2457
- }
2458
- if (err.cause) return getConstraintName(err.cause);
2459
- return null;
2460
- }
2461
-
2462
- function isComponentsWorldFkViolation(error: unknown): boolean {
2463
- return getConstraintName(error) === "components_world_id_worlds_id_fk";
2464
- }
2465
-
2466
- function toErrorDetails(error: unknown, depth = 0): Record<string, unknown> {
2467
- if (!error || typeof error !== "object") {
2468
- return { value: String(error) };
2469
- }
2470
- const err = error as DbErrorLike;
2471
- const details: Record<string, unknown> = {};
2472
- for (const key of [
2473
- "name",
2474
- "message",
2475
- "code",
2476
- "detail",
2477
- "hint",
2478
- "constraint",
2479
- "schema",
2480
- "table",
2481
- "column",
2482
- "where",
2483
- ] as const) {
2484
- const value = err[key];
2485
- if (typeof value === "string" || typeof value === "number") {
2486
- details[key] = value;
2487
- }
2488
- }
2489
- if (depth < 2 && err.cause) {
2490
- details.cause = toErrorDetails(err.cause, depth + 1);
2491
- }
2492
- return details;
2493
- }
2494
-
2495
- async function withEntityCreateMutex<T>(
2496
- runtimeWithBindings: RuntimeWithMethodBindings,
2497
- fn: () => Promise<T>,
2498
- ): Promise<T> {
2499
- const previous = runtimeWithBindings.__miladyEntityCreateMutex;
2500
- let release: () => void = () => {};
2501
- runtimeWithBindings.__miladyEntityCreateMutex = new Promise<void>(
2502
- (resolve) => {
2503
- release = resolve;
2504
- },
2505
- );
2506
- if (previous) {
2507
- await previous;
2508
- }
2509
- try {
2510
- return await fn();
2511
- } finally {
2512
- release();
2513
- }
2514
- }
2515
-
2516
- function summarizeComponentWrite(input: unknown): Record<string, unknown> {
2517
- if (!input || typeof input !== "object" || Array.isArray(input)) {
2518
- return { inputType: typeof input };
2519
- }
2520
- const record = input as Record<string, unknown>;
2521
- const data = record.data;
2522
- const dataKeys =
2523
- data && typeof data === "object" && !Array.isArray(data)
2524
- ? Object.keys(data as Record<string, unknown>).slice(0, 20)
2525
- : [];
2526
-
2527
- return {
2528
- id: record.id,
2529
- type: record.type,
2530
- entityId: record.entityId ?? record.entity_id,
2531
- sourceEntityId: record.sourceEntityId ?? record.source_entity_id,
2532
- roomId: record.roomId ?? record.room_id,
2533
- worldId: record.worldId ?? record.world_id,
2534
- agentId: record.agentId ?? record.agent_id,
2535
- dataKeys,
2536
- };
2537
- }
2538
-
2539
- export function installRuntimeMethodBindings(runtime: AgentRuntime): void {
2540
- const runtimeWithBindings = runtime as RuntimeWithMethodBindings;
2541
- if (runtimeWithBindings.__miladyMethodBindingsInstalled) {
2542
- return;
2543
- }
2544
-
2545
- // Some plugin builds store this method and invoke it later without the
2546
- // runtime receiver, which breaks private-field access in AgentRuntime.
2547
- runtime.getConversationLength = runtime.getConversationLength.bind(runtime);
2548
-
2549
- // Wrap getSetting() to fall back to process.env for known keys when the
2550
- // core returns null. elizaOS core returns null for missing keys, but some
2551
- // plugins (e.g. @elizaos/plugin-google-genai) check `!== undefined` and
2552
- // convert null to the string "null", causing API calls like `models/null`.
2553
- // Scoped to an allowlist to avoid leaking arbitrary env vars to plugins.
2554
- const GETSETTING_ENV_ALLOWLIST = new Set([
2555
- // Model provider API keys
2556
- "ANTHROPIC_API_KEY",
2557
- "OPENAI_API_KEY",
2558
- "GOOGLE_GENERATIVE_AI_API_KEY",
2559
- "GOOGLE_API_KEY",
2560
- "GEMINI_API_KEY",
2561
- "GROQ_API_KEY",
2562
- "XAI_API_KEY",
2563
- "DEEPSEEK_API_KEY",
2564
- "OPENROUTER_API_KEY",
2565
- // Google model defaults
2566
- "GOOGLE_SMALL_MODEL",
2567
- "GOOGLE_LARGE_MODEL",
2568
- // GitHub
2569
- "GITHUB_TOKEN",
2570
- "GITHUB_OAUTH_CLIENT_ID",
2571
- // Coding agent model preferences
2572
- "PARALLAX_CLAUDE_MODEL_POWERFUL",
2573
- "PARALLAX_CLAUDE_MODEL_FAST",
2574
- "PARALLAX_GEMINI_MODEL_POWERFUL",
2575
- "PARALLAX_GEMINI_MODEL_FAST",
2576
- "PARALLAX_CODEX_MODEL_POWERFUL",
2577
- "PARALLAX_CODEX_MODEL_FAST",
2578
- "PARALLAX_AIDER_PROVIDER",
2579
- "PARALLAX_AIDER_MODEL_POWERFUL",
2580
- "PARALLAX_AIDER_MODEL_FAST",
2581
- // Custom credential forwarding — intentionally broad: users configure which env vars
2582
- // to forward to coding agents via this comma-separated key list (e.g. MCP server tokens).
2583
- "CUSTOM_CREDENTIAL_KEYS",
2584
- ]);
2585
- const originalGetSetting = runtime.getSetting.bind(runtime);
2586
- runtime.getSetting = (key: string) => {
2587
- const result = originalGetSetting(key);
2588
- if (result !== null && result !== undefined) return result;
2589
- if (GETSETTING_ENV_ALLOWLIST.has(key)) {
2590
- const envVal = process.env[key];
2591
- if (envVal !== undefined && envVal.trim() !== "") return envVal;
2592
- }
2593
- return result;
2594
- };
2595
-
2596
- // Add targeted diagnostics around component writes. Rolodex reflection and
2597
- // relationship extraction rely heavily on components; when inserts fail,
2598
- // upstream logs often hide the concrete DB cause/constraint.
2599
- if (!runtimeWithBindings.__miladyComponentWriteDiagnosticsInstalled) {
2600
- type CreateComponentFn = (component: Component) => Promise<boolean>;
2601
- type UpdateComponentFn = (component: Component) => Promise<void>;
2602
- const runtimeWithComponentWrites = runtime as AgentRuntime & {
2603
- createComponent?: CreateComponentFn;
2604
- updateComponent?: UpdateComponentFn;
2605
- };
2606
-
2607
- if (typeof runtimeWithComponentWrites.createComponent === "function") {
2608
- const originalCreate =
2609
- runtimeWithComponentWrites.createComponent.bind(runtime);
2610
- runtimeWithComponentWrites.createComponent = async (input: Component) => {
2611
- try {
2612
- return await originalCreate(input);
2613
- } catch (error) {
2614
- // Recovery path: some evaluators (e.g. relationship extraction)
2615
- // compute a synthetic worldId that may not exist yet. If we hit the
2616
- // components->worlds FK, retry once with the room's canonical worldId.
2617
- if (
2618
- isComponentsWorldFkViolation(error) &&
2619
- input.roomId &&
2620
- typeof runtime.getRoom === "function"
2621
- ) {
2622
- try {
2623
- const room = await runtime.getRoom(input.roomId);
2624
- if (room?.worldId && room.worldId !== input.worldId) {
2625
- logger.warn(
2626
- `[milady] createComponent retry with room worldId (${room.worldId}) after FK violation`,
2627
- );
2628
- const recovered: Component = {
2629
- ...input,
2630
- worldId: room.worldId,
2631
- };
2632
- return await originalCreate(recovered);
2633
- }
2634
- } catch (retryLookupError) {
2635
- logger.warn(
2636
- `[milady] createComponent recovery lookup failed: ${formatError(retryLookupError)}`,
2637
- );
2638
- }
2639
- }
2640
-
2641
- const component = summarizeComponentWrite(input);
2642
- logger.error(
2643
- `[milady] createComponent failed: ${formatError(error)} | component=${JSON.stringify(component)}`,
2644
- );
2645
- logger.error(
2646
- `[milady] createComponent db details: ${JSON.stringify(toErrorDetails(error))}`,
2647
- );
2648
- throw error;
2649
- }
2650
- };
2651
- }
2652
-
2653
- if (typeof runtimeWithComponentWrites.updateComponent === "function") {
2654
- const originalUpdate =
2655
- runtimeWithComponentWrites.updateComponent.bind(runtime);
2656
- runtimeWithComponentWrites.updateComponent = async (input: Component) => {
2657
- try {
2658
- return await originalUpdate(input);
2659
- } catch (error) {
2660
- const component = summarizeComponentWrite(input);
2661
- logger.error(
2662
- `[milady] updateComponent failed: ${formatError(error)} | component=${JSON.stringify(component)}`,
2663
- );
2664
- logger.error(
2665
- `[milady] updateComponent db details: ${JSON.stringify(toErrorDetails(error))}`,
2666
- );
2667
- throw error;
2668
- }
2669
- };
2670
- }
2671
-
2672
- runtimeWithBindings.__miladyComponentWriteDiagnosticsInstalled = true;
2673
- }
2674
-
2675
- // Proactive guard for plugin-sql entity creation. Some evaluators may attempt
2676
- // to create the same entity in rapid succession; plugin-sql's batch insert is
2677
- // non-idempotent and can fail entire writes on duplicate/conflicting rows.
2678
- if (!runtimeWithBindings.__miladyEntityWriteDiagnosticsInstalled) {
2679
- type CreateEntitiesFn = (entities: Entity[]) => Promise<UUID[] | boolean>;
2680
- type GetEntitiesByIdsFn = (entityIds: UUID[]) => Promise<Entity[]>;
2681
- type EnsureEntityExistsFn = (entity: Entity) => Promise<boolean>;
2682
- const runtimeWithEntityWrites = runtime as AgentRuntime & {
2683
- createEntities?: CreateEntitiesFn;
2684
- getEntitiesByIds?: GetEntitiesByIdsFn;
2685
- ensureEntityExists?: EnsureEntityExistsFn;
2686
- };
2687
-
2688
- if (typeof runtimeWithEntityWrites.createEntities === "function") {
2689
- const originalCreateEntities =
2690
- runtimeWithEntityWrites.createEntities.bind(runtime);
2691
- runtimeWithEntityWrites.createEntities = async (
2692
- entities: Entity[],
2693
- ) => {
2694
- return withEntityCreateMutex(runtimeWithBindings, async () => {
2695
- const uniqueById = new Map<UUID, Entity>();
2696
- for (const entity of entities) {
2697
- if (entity?.id) uniqueById.set(entity.id as UUID, entity);
2698
- }
2699
- const deduped = Array.from(uniqueById.values());
2700
- if (deduped.length === 0) return deduped.map((e) => e.id as UUID);
2701
-
2702
- let missing = deduped;
2703
- if (typeof runtimeWithEntityWrites.getEntitiesByIds === "function") {
2704
- try {
2705
- const existing =
2706
- (await runtimeWithEntityWrites.getEntitiesByIds(
2707
- deduped.map((e) => e.id as UUID),
2708
- )) ?? [];
2709
- const existingIds = new Set<UUID>();
2710
- for (const entity of existing) {
2711
- if (entity?.id) existingIds.add(entity.id as UUID);
2712
- }
2713
- missing = deduped.filter(
2714
- (entity) => !existingIds.has(entity.id as UUID),
2715
- );
2716
- } catch (err) {
2717
- logger.warn(
2718
- `[milady] createEntities precheck failed; proceeding with guarded insert: ${formatError(err)}`,
2719
- );
2720
- }
2721
- }
2722
- if (missing.length === 0) return deduped.map((e) => e.id as UUID);
2723
-
2724
- const result = await originalCreateEntities(missing);
2725
- if (Array.isArray(result) ? result.length > 0 : result) return deduped.map((e) => e.id as UUID);
2726
-
2727
- if (
2728
- typeof runtimeWithEntityWrites.ensureEntityExists === "function"
2729
- ) {
2730
- let allRecovered = true;
2731
- for (const entity of missing) {
2732
- try {
2733
- const ensured =
2734
- await runtimeWithEntityWrites.ensureEntityExists(entity);
2735
- allRecovered = allRecovered && ensured;
2736
- } catch (err) {
2737
- allRecovered = false;
2738
- logger.warn(
2739
- `[milady] ensureEntityExists recovery failed for ${String(entity.id)}: ${formatError(err)}`,
2740
- );
2741
- }
2742
- }
2743
- if (allRecovered) return deduped.map((e) => e.id as UUID);
2744
- }
2745
-
2746
- logger.warn(
2747
- `[milady] createEntities unresolved after guarded retries (requested=${entities.length}, deduped=${deduped.length}, missing=${missing.length})`,
2748
- );
2749
- return [];
2750
- });
2751
- };
2752
- }
2753
-
2754
- runtimeWithBindings.__miladyEntityWriteDiagnosticsInstalled = true;
2755
- }
2756
-
2757
- runtimeWithBindings.__miladyMethodBindingsInstalled = true;
2758
- }
2759
-
2760
- function installActionAliases(runtime: AgentRuntime): void {
2761
- const runtimeWithAliases = runtime as RuntimeWithActionAliases;
2762
- if (runtimeWithAliases.__miladyActionAliasesInstalled) {
2763
- return;
2764
- }
2765
-
2766
- const actions = Array.isArray(runtimeWithAliases.actions)
2767
- ? runtimeWithAliases.actions
2768
- : [];
2769
-
2770
- // Keep compaction automatic-only; do not allow manual COMPACT_SESSION invokes.
2771
- const compactSessionIndex = actions.findIndex(
2772
- (action) => action?.name?.toUpperCase() === "COMPACT_SESSION",
2773
- );
2774
- if (compactSessionIndex !== -1) {
2775
- actions.splice(compactSessionIndex, 1);
2776
- logger.info(
2777
- "[milady] Disabled manual COMPACT_SESSION action; auto-compaction remains enabled",
2778
- );
2779
- }
2780
-
2781
- // Compatibility alias: older prompts/docs still reference CODE_TASK,
2782
- // while plugin-agent-orchestrator exposes CREATE_TASK.
2783
- const createTaskAction = actions.find(
2784
- (action) => action?.name?.toUpperCase() === "CREATE_TASK",
2785
- );
2786
- if (createTaskAction) {
2787
- const similes = Array.isArray(createTaskAction.similes)
2788
- ? createTaskAction.similes
2789
- : [];
2790
- const hasCodeTaskAlias = similes.some(
2791
- (simile) => simile.toUpperCase() === "CODE_TASK",
2792
- );
2793
- if (!hasCodeTaskAlias) {
2794
- createTaskAction.similes = [...similes, "CODE_TASK"];
2795
- logger.info(
2796
- "[milady] Added action alias CODE_TASK -> CREATE_TASK for agent-orchestrator",
2797
- );
2798
- }
2799
- }
2800
-
2801
- runtimeWithAliases.__miladyActionAliasesInstalled = true;
2802
- }
2803
-
2804
- async function registerSqlPluginWithRecovery(
2805
- runtime: AgentRuntime,
2806
- sqlPlugin: ResolvedPlugin,
2807
- config: ElizaConfig,
2808
- ): Promise<void> {
2809
- let registerError: unknown = null;
2810
-
2811
- try {
2812
- await runtime.registerPlugin(sqlPlugin.plugin);
2813
- } catch (err) {
2814
- registerError = err;
2815
- }
2816
-
2817
- if (registerError) {
2818
- const pgliteDataDir = resolveActivePgliteDataDir(config);
2819
- if (!pgliteDataDir) {
2820
- throw registerError;
2821
- }
2822
-
2823
- const recoveryAction = getPgliteRecoveryAction(
2824
- registerError,
2825
- pgliteDataDir,
2826
- );
2827
- if (recoveryAction === "none") {
2828
- throw registerError;
2829
- }
2830
- if (recoveryAction === "fail-active-lock") {
2831
- throw createActivePgliteLockError(pgliteDataDir, registerError);
2832
- }
2833
-
2834
- if (recoveryAction === "retry-without-reset") {
2835
- logger.warn(
2836
- `[milady] SQL plugin registration failed (${formatError(registerError)}). Cleared a stale PGLite lock in ${pgliteDataDir} and retrying without resetting data.`,
2837
- );
2838
- } else {
2839
- logger.warn(
2840
- `[milady] SQL plugin registration failed (${formatError(registerError)}). Resetting local PGLite DB at ${pgliteDataDir} and retrying once.`,
2841
- );
2842
- await resetPgliteDataDir(pgliteDataDir);
2843
- process.env.PGLITE_DATA_DIR = pgliteDataDir;
2844
- }
2845
-
2846
- try {
2847
- await runtime.registerPlugin(sqlPlugin.plugin);
2848
- } catch (retryErr) {
2849
- if (!isPluginAlreadyRegisteredError(retryErr)) {
2850
- throw retryErr;
2851
- }
2852
- }
2853
- }
2854
-
2855
- await initializeDatabaseAdapter(runtime, config);
2856
- }
2857
-
2858
- /**
2859
- * Build an elizaOS Character from the Milady config.
2860
- *
2861
- * Resolves the agent name from `config.agents.list` (first entry) or
2862
- * `config.ui.assistant.name`, falling back to "Milady". Character
2863
- * personality data (bio, system prompt, style, etc.) is stored in the
2864
- * database — not the config file — so we only provide sensible defaults
2865
- * here for the initial bootstrap.
2866
- */
2867
- /** @internal Exported for testing. */
2868
- export function buildCharacterFromConfig(config: ElizaConfig): Character {
2869
- // Resolve name: agents list → ui assistant → "Milady"
2870
- const agentEntry = config.agents?.list?.[0];
2871
- const name = agentEntry?.name ?? config.ui?.assistant?.name ?? "Milady";
2872
- const bundledPreset = (() => {
2873
- const presetByName: Record<string, string> = {
2874
- Reimu: "uwu~",
2875
- Marisa: "hell yeah",
2876
- Yukari: "lol k",
2877
- Sakuya: "Noted.",
2878
- Koishi: "hehe~",
2879
- Remilia: "...",
2880
- Reisen: "locked in",
2881
- };
2882
- const presetCatchphrase = presetByName[name.trim()];
2883
- if (!presetCatchphrase) return undefined;
2884
- return STYLE_PRESETS.find(
2885
- (preset) => preset.catchphrase === presetCatchphrase,
2886
- );
2887
- })();
2888
-
2889
- // Read personality fields from the agent config entry (set during
2890
- // onboarding from the chosen style preset). Fall back to generic
2891
- // defaults when the preset data is not present (e.g. pre-onboarding
2892
- // bootstrap or configs created before this change). For built-in default
2893
- // characters, fall back to the bundled preset so legacy name-only configs
2894
- // still retain their default posts/messages.
2895
- const bio = agentEntry?.bio ??
2896
- bundledPreset?.bio ?? [
2897
- "{{name}} is an AI assistant powered by Milady and elizaOS.",
2898
- ];
2899
- const systemPrompt =
2900
- agentEntry?.system ??
2901
- bundledPreset?.system ??
2902
- "You are {{name}}, an autonomous AI agent powered by elizaOS.";
2903
- const style = agentEntry?.style ?? bundledPreset?.style;
2904
- const adjectives = agentEntry?.adjectives ?? bundledPreset?.adjectives;
2905
- const postExamples = agentEntry?.postExamples ?? bundledPreset?.postExamples;
2906
- const messageExamples =
2907
- agentEntry?.messageExamples ?? bundledPreset?.messageExamples;
2908
-
2909
- // Collect secrets from process.env (API keys the plugins need)
2910
- const secretKeys = [
2911
- "ANTHROPIC_API_KEY",
2912
- "OPENAI_API_KEY",
2913
- "GEMINI_API_KEY",
2914
- "GOOGLE_API_KEY",
2915
- "GOOGLE_GENERATIVE_AI_API_KEY",
2916
- "GROQ_API_KEY",
2917
- "XAI_API_KEY",
2918
- "OPENROUTER_API_KEY",
2919
- "AI_GATEWAY_API_KEY",
2920
- "AIGATEWAY_API_KEY",
2921
- "AI_GATEWAY_BASE_URL",
2922
- "AI_GATEWAY_SMALL_MODEL",
2923
- "AI_GATEWAY_LARGE_MODEL",
2924
- "AI_GATEWAY_EMBEDDING_MODEL",
2925
- "AI_GATEWAY_EMBEDDING_DIMENSIONS",
2926
- "AI_GATEWAY_IMAGE_MODEL",
2927
- "AI_GATEWAY_TIMEOUT_MS",
2928
- "OLLAMA_BASE_URL",
2929
- "DISCORD_API_TOKEN",
2930
- "DISCORD_APPLICATION_ID",
2931
- "DISCORD_BOT_TOKEN",
2932
- "TELEGRAM_BOT_TOKEN",
2933
- "SLACK_BOT_TOKEN",
2934
- "SLACK_APP_TOKEN",
2935
- "SLACK_USER_TOKEN",
2936
- "SIGNAL_ACCOUNT_NUMBER",
2937
- "MSTEAMS_APP_ID",
2938
- "MSTEAMS_APP_PASSWORD",
2939
- "MATTERMOST_BOT_TOKEN",
2940
- "MATTERMOST_BASE_URL",
2941
- // ElizaCloud secrets
2942
- "ELIZAOS_CLOUD_API_KEY",
2943
- "ELIZAOS_CLOUD_BASE_URL",
2944
- "ELIZAOS_CLOUD_ENABLED",
2945
- // Wallet / blockchain secrets
2946
- "EVM_PRIVATE_KEY",
2947
- "SOLANA_PRIVATE_KEY",
2948
- "ALCHEMY_API_KEY",
2949
- "HELIUS_API_KEY",
2950
- "BIRDEYE_API_KEY",
2951
- "SOLANA_RPC_URL",
2952
- "X402_PRIVATE_KEY",
2953
- "X402_NETWORK",
2954
- "X402_PAY_TO",
2955
- "X402_FACILITATOR_URL",
2956
- "X402_MAX_PAYMENT_USD",
2957
- "X402_MAX_TOTAL_USD",
2958
- "X402_ENABLED",
2959
- "X402_DB_PATH",
2960
- // GitHub access for coding agent plugin
2961
- "GITHUB_TOKEN",
2962
- "GITHUB_OAUTH_CLIENT_ID",
2963
- ];
2964
-
2965
- const secrets: Record<string, string> = {};
2966
- for (const key of secretKeys) {
2967
- const value = process.env[key];
2968
- if (value?.trim()) {
2969
- secrets[key] = value;
2970
- }
2971
- }
2972
-
2973
- // Normalise messageExamples to the {examples: [{name,content}]} shape
2974
- // that @elizaos/core expects. Config may contain EITHER format:
2975
- // OLD (preset/onboarding): [[{user, content}, ...], ...]
2976
- // NEW (@elizaos/core): [{examples: [{name, content}, ...]}, ...]
2977
- const mappedExamples = messageExamples?.map((item: unknown) => {
2978
- // Already in new format — pass through
2979
- if (
2980
- item &&
2981
- typeof item === "object" &&
2982
- "examples" in (item as Record<string, unknown>)
2983
- ) {
2984
- return item as {
2985
- examples: { name: string; content: { text: string } }[];
2986
- };
2987
- }
2988
- // Old format — array of {user, content} entries
2989
- const arr = item as {
2990
- user?: string;
2991
- name?: string;
2992
- content: { text: string };
2993
- }[];
2994
- return {
2995
- examples: arr.map((msg) => ({
2996
- name: msg.name ?? msg.user ?? "",
2997
- content: msg.content,
2998
- })),
2999
- };
3000
- });
3001
-
3002
- return mergeCharacterDefaults({
3003
- name,
3004
- ...(agentEntry?.username ? { username: agentEntry.username } : {}),
3005
- bio,
3006
- system: systemPrompt,
3007
- ...(agentEntry?.topics ? { topics: agentEntry.topics } : {}),
3008
- ...(style ? { style } : {}),
3009
- ...(adjectives ? { adjectives } : {}),
3010
- ...(postExamples ? { postExamples } : {}),
3011
- ...(mappedExamples ? { messageExamples: mappedExamples } : {}),
3012
- secrets,
3013
- });
3014
- }
3015
-
3016
- /**
3017
- * Resolve the primary model identifier from Milady config.
3018
- *
3019
- * Milady stores the model under `agents.defaults.model.primary` as an
3020
- * AgentModelListConfig object. Returns undefined when no model is
3021
- * explicitly configured (elizaOS falls back to whichever model
3022
- * plugin is loaded).
3023
- */
3024
- /** @internal Exported for testing. */
3025
- export function resolvePrimaryModel(config: ElizaConfig): string | undefined {
3026
- const modelConfig = config.agents?.defaults?.model;
3027
- if (!modelConfig) return undefined;
3028
-
3029
- // AgentDefaultsConfig.model is AgentModelListConfig: { primary?, fallbacks? }
3030
- return modelConfig.primary;
3031
- }
3032
-
3033
- /**
3034
- * Vision is a heavy optional plugin. When Milady enables it, keep the service
3035
- * loaded but idle until the user explicitly selects CAMERA, SCREEN, or BOTH.
3036
- * This avoids background capture loops during normal app startup.
3037
- */
3038
- export function resolveVisionModeSetting(
3039
- config: ElizaConfig,
3040
- env: NodeJS.ProcessEnv = process.env,
3041
- ): string | undefined {
3042
- const explicitMode = env.VISION_MODE?.trim();
3043
- if (explicitMode) return explicitMode;
3044
- if (config.features?.vision === true) return "OFF";
3045
- return undefined;
3046
- }
3047
-
3048
- // ---------------------------------------------------------------------------
3049
- // First-run onboarding
3050
- // ---------------------------------------------------------------------------
3051
-
3052
- // Name pool + random picker shared with the web UI API server.
3053
- // See src/runtime/onboarding-names.ts for the canonical list.
3054
- import { pickRandomNames } from "./onboarding-names";
3055
-
3056
- // ---------------------------------------------------------------------------
3057
- // Style presets — shared between CLI and GUI onboarding
3058
- // ---------------------------------------------------------------------------
3059
-
3060
- import { STYLE_PRESETS } from "../onboarding-presets";
3061
-
3062
- /**
3063
- * Detect whether this is the first run (no agent name configured)
3064
- * and run the onboarding flow:
3065
- *
3066
- * 1. Welcome banner
3067
- * 2. Name selector (4 random + Custom)
3068
- * 3. Catchphrase / writing-style selector
3069
- * 4. Persist agent name to `agents.list[0]` in config
3070
- *
3071
- * Character personality (bio, system prompt, style) is stored in the
3072
- * database at runtime — only the agent name lives in config.
3073
- *
3074
- * Subsequent runs skip this entirely.
3075
- */
3076
- async function runFirstTimeSetup(config: ElizaConfig): Promise<ElizaConfig> {
3077
- const agentEntry = config.agents?.list?.[0];
3078
- const hasName = Boolean(agentEntry?.name || config.ui?.assistant?.name);
3079
- if (hasName) return config;
3080
-
3081
- // Only prompt when stdin is a TTY (interactive terminal)
3082
- if (!process.stdin.isTTY) return config;
3083
-
3084
- // Load @clack/prompts lazily — only needed for interactive CLI onboarding.
3085
- const clack = await loadClack();
3086
-
3087
- // ── Step 1: Welcome ────────────────────────────────────────────────────
3088
- clack.intro("WELCOME TO MILADY!");
3089
-
3090
- // ── Step 2: Name ───────────────────────────────────────────────────────
3091
- const randomNames = pickRandomNames(4);
3092
-
3093
- const nameChoice = await clack.select({
3094
- message: "♡♡milady♡♡: Hey there, I'm.... err, what was my name again?",
3095
- options: [
3096
- ...randomNames.map((n) => ({ value: n, label: n })),
3097
- { value: "_custom_", label: "Custom...", hint: "type your own" },
3098
- ],
3099
- });
3100
-
3101
- if (clack.isCancel(nameChoice)) cancelOnboarding();
3102
-
3103
- let name: string;
3104
-
3105
- if (nameChoice === "_custom_") {
3106
- const customName = await clack.text({
3107
- message: "OK, what should I be called?",
3108
- placeholder: "Milady",
3109
- });
3110
-
3111
- if (clack.isCancel(customName)) cancelOnboarding();
3112
-
3113
- name = customName.trim() || "Milady";
3114
- } else {
3115
- name = nameChoice;
3116
- }
3117
-
3118
- clack.log.message(`♡♡${name}♡♡: Oh that's right, I'm ${name}!`);
3119
-
3120
- // ── Step 3: Catchphrase / writing style ────────────────────────────────
3121
- const styleChoice = await clack.select({
3122
- message: `${name}: Now... how do I like to talk again?`,
3123
- options: STYLE_PRESETS.map((preset) => ({
3124
- value: preset.catchphrase,
3125
- label: preset.catchphrase,
3126
- hint: preset.hint,
3127
- })),
3128
- });
3129
-
3130
- if (clack.isCancel(styleChoice)) cancelOnboarding();
3131
-
3132
- const chosenTemplate = STYLE_PRESETS.find(
3133
- (p) => p.catchphrase === styleChoice,
3134
- );
3135
-
3136
- // ── Step 3.5: Runtime selection (Cloud vs Local) ───────────────────────
3137
- // Present the user with a choice of where to run their agent. Cloud mode
3138
- // skips the local AI provider, wallet, and GitHub steps.
3139
- let cloudOnboardingResult:
3140
- | import("./cloud-onboarding").CloudOnboardingResult
3141
- | null = null;
3142
- let isCloudMode = false;
3143
-
3144
- const runtimeChoice = await clack.select({
3145
- message: `${name}: Where should I live?`,
3146
- options: [
3147
- {
3148
- value: "cloud",
3149
- label: "☁️ Eliza Cloud (recommended)",
3150
- hint: "zero setup — hosted, always online",
3151
- },
3152
- {
3153
- value: "local",
3154
- label: "💻 Run locally",
3155
- hint: "full control — runs on this machine",
3156
- },
3157
- {
3158
- value: "later",
3159
- label: "⏭️ Decide later",
3160
- hint: "start local, switch to cloud anytime",
3161
- },
3162
- ],
3163
- });
3164
-
3165
- if (clack.isCancel(runtimeChoice)) cancelOnboarding();
3166
-
3167
- if (runtimeChoice === "later") {
3168
- // User deferred the decision — continue with local setup (steps 4–7).
3169
- clack.log.info(
3170
- "No problem! Starting with local setup. You can switch to cloud anytime with `milady cloud connect`.",
3171
- );
3172
- } else if (runtimeChoice === "cloud") {
3173
- const { runCloudOnboarding } = await import("./cloud-onboarding");
3174
- cloudOnboardingResult = await runCloudOnboarding(
3175
- clack,
3176
- name,
3177
- chosenTemplate,
3178
- );
3179
-
3180
- if (cloudOnboardingResult?.agentId) {
3181
- isCloudMode = true;
3182
- clack.log.success(`${name} is now running in the cloud! ☁️`);
3183
- } else if (cloudOnboardingResult) {
3184
- // Auth succeeded but no agent provisioned — save auth for later
3185
- clack.log.info(
3186
- "Cloud auth saved. You can provision later with `milady cloud connect`.",
3187
- );
3188
- } else {
3189
- // Cloud flow cancelled / failed — fall back to local
3190
- clack.log.info("No worries! Setting up locally instead.");
3191
- }
3192
- }
3193
-
3194
- // ── Steps 4–7: Local-only setup ─────────────────────────────────────────
3195
- // These steps are skipped when the user chose Eliza Cloud, since the cloud
3196
- // handles inference, wallets can be configured via the dashboard, and
3197
- // GitHub access is not needed for the initial cloud agent.
3198
- let providerEnvKey: string | undefined;
3199
- let providerApiKey: string | undefined;
3200
-
3201
- // Snapshot whether wallet keys already exist BEFORE onboarding touches
3202
- // process.env, so the persistence block later can guard against
3203
- // overwriting pre-existing values.
3204
- const hasEvmKey = Boolean(process.env.EVM_PRIVATE_KEY?.trim());
3205
- const hasSolKey = Boolean(process.env.SOLANA_PRIVATE_KEY?.trim());
3206
-
3207
- if (!isCloudMode) {
3208
- // ── Step 4: Model provider ───────────────────────────────────────────────
3209
- // Skip provider selection in cloud mode — Eliza Cloud handles inference.
3210
- // Check whether an API key is already set in the environment (from .env or
3211
- // shell). If none is found, ask the user to pick a provider and enter a key.
3212
- const PROVIDER_OPTIONS = [
3213
- {
3214
- id: "anthropic",
3215
- label: "Anthropic (Claude)",
3216
- envKey: "ANTHROPIC_API_KEY",
3217
- detectKeys: ["ANTHROPIC_API_KEY"],
3218
- hint: "sk-ant-...",
3219
- },
3220
- {
3221
- id: "openai",
3222
- label: "OpenAI (GPT)",
3223
- envKey: "OPENAI_API_KEY",
3224
- detectKeys: ["OPENAI_API_KEY"],
3225
- hint: "sk-...",
3226
- },
3227
- {
3228
- id: "openrouter",
3229
- label: "OpenRouter",
3230
- envKey: "OPENROUTER_API_KEY",
3231
- detectKeys: ["OPENROUTER_API_KEY"],
3232
- hint: "sk-or-...",
3233
- },
3234
- {
3235
- id: "vercel-ai-gateway",
3236
- label: "Vercel AI Gateway",
3237
- envKey: "AI_GATEWAY_API_KEY",
3238
- detectKeys: ["AI_GATEWAY_API_KEY", "AIGATEWAY_API_KEY"],
3239
- hint: "aigw_...",
3240
- },
3241
- {
3242
- id: "gemini",
3243
- label: "Google Gemini",
3244
- envKey: "GOOGLE_GENERATIVE_AI_API_KEY",
3245
- detectKeys: [
3246
- "GOOGLE_GENERATIVE_AI_API_KEY",
3247
- "GOOGLE_API_KEY",
3248
- "GEMINI_API_KEY",
3249
- ],
3250
- hint: "AI...",
3251
- },
3252
- {
3253
- id: "grok",
3254
- label: "xAI (Grok)",
3255
- envKey: "XAI_API_KEY",
3256
- detectKeys: ["XAI_API_KEY"],
3257
- hint: "xai-...",
3258
- },
3259
- {
3260
- id: "groq",
3261
- label: "Groq",
3262
- envKey: "GROQ_API_KEY",
3263
- detectKeys: ["GROQ_API_KEY"],
3264
- hint: "gsk_...",
3265
- },
3266
- {
3267
- id: "deepseek",
3268
- label: "DeepSeek",
3269
- envKey: "DEEPSEEK_API_KEY",
3270
- detectKeys: ["DEEPSEEK_API_KEY"],
3271
- hint: "sk-...",
3272
- },
3273
- {
3274
- id: "mistral",
3275
- label: "Mistral",
3276
- envKey: "MISTRAL_API_KEY",
3277
- detectKeys: ["MISTRAL_API_KEY"],
3278
- hint: "",
3279
- },
3280
- {
3281
- id: "together",
3282
- label: "Together AI",
3283
- envKey: "TOGETHER_API_KEY",
3284
- detectKeys: ["TOGETHER_API_KEY"],
3285
- hint: "",
3286
- },
3287
- {
3288
- id: "ollama",
3289
- label: "Ollama (local, free)",
3290
- envKey: "OLLAMA_BASE_URL",
3291
- detectKeys: ["OLLAMA_BASE_URL"],
3292
- hint: "http://localhost:11434",
3293
- },
3294
- ] as const;
3295
-
3296
- // Detect if any provider key is already configured
3297
- const detectedProvider = PROVIDER_OPTIONS.find((p) =>
3298
- p.detectKeys.some((key) => process.env[key]?.trim()),
3299
- );
3300
-
3301
- if (detectedProvider) {
3302
- clack.log.success(
3303
- `Found existing ${detectedProvider.label} key in environment (${detectedProvider.envKey})`,
3304
- );
3305
- } else {
3306
- const providerChoice = await clack.select({
3307
- message: `${name}: One more thing — which AI provider should I use?`,
3308
- options: [
3309
- ...PROVIDER_OPTIONS.map((p) => ({
3310
- value: p.id,
3311
- label: p.label,
3312
- hint: p.id === "ollama" ? "no API key needed" : undefined,
3313
- })),
3314
- {
3315
- value: "_skip_",
3316
- label: "Skip for now",
3317
- hint: "set an API key later via env or config",
3318
- },
3319
- ],
3320
- });
3321
-
3322
- if (clack.isCancel(providerChoice)) cancelOnboarding();
3323
-
3324
- if (providerChoice !== "_skip_") {
3325
- const chosen = PROVIDER_OPTIONS.find((p) => p.id === providerChoice);
3326
- if (chosen) {
3327
- providerEnvKey = chosen.envKey;
3328
-
3329
- if (chosen.id === "ollama") {
3330
- // Ollama just needs a base URL, default to localhost
3331
- const ollamaUrl = await clack.text({
3332
- message: "Ollama base URL:",
3333
- placeholder: "http://localhost:11434",
3334
- defaultValue: "http://localhost:11434",
3335
- });
3336
-
3337
- if (clack.isCancel(ollamaUrl)) cancelOnboarding();
3338
-
3339
- providerApiKey = ollamaUrl.trim() || "http://localhost:11434";
3340
- } else {
3341
- const apiKeyInput = await clack.password({
3342
- message: `Paste your ${chosen.label} API key:`,
3343
- });
3344
-
3345
- if (clack.isCancel(apiKeyInput)) cancelOnboarding();
3346
-
3347
- providerApiKey = apiKeyInput.trim();
3348
- }
3349
- }
3350
- }
3351
- }
3352
-
3353
- // ── Step 4b: Embedding model preset ────────────────────────────────────
3354
- // (Simplified: always use the standard/reliable model preset. No user choice.)
3355
-
3356
- // ── Step 5: Wallet setup ───────────────────────────────────────────────
3357
- // Offer to generate or import wallets for EVM and Solana. Keys are
3358
- // stored in config.env and process.env, making them available to
3359
- // plugins at runtime.
3360
- const { generateWalletKeys, importWallet } = await import("../api/wallet");
3361
-
3362
- // hasEvmKey and hasSolKey are hoisted above the if (!isCloudMode) block
3363
- // so they're also available in the persistence section.
3364
- if (!hasEvmKey || !hasSolKey) {
3365
- const walletAction = await clack.select({
3366
- message: `${name}: Do you want me to set up crypto wallets? (for trading, NFTs, DeFi)`,
3367
- options: [
3368
- {
3369
- value: "generate",
3370
- label: "Generate new wallets",
3371
- hint: "creates fresh EVM + Solana keypairs",
3372
- },
3373
- {
3374
- value: "import",
3375
- label: "Import existing wallets",
3376
- hint: "paste your private keys",
3377
- },
3378
- {
3379
- value: "skip",
3380
- label: "Skip for now",
3381
- hint: "wallets can be added later",
3382
- },
3383
- ],
3384
- });
3385
-
3386
- if (clack.isCancel(walletAction)) cancelOnboarding();
3387
-
3388
- if (walletAction === "generate") {
3389
- const keys = generateWalletKeys();
3390
-
3391
- if (!hasEvmKey) {
3392
- process.env.EVM_PRIVATE_KEY = keys.evmPrivateKey;
3393
- clack.log.success(`Generated EVM wallet: ${keys.evmAddress}`);
3394
- }
3395
- if (!hasSolKey) {
3396
- process.env.SOLANA_PRIVATE_KEY = keys.solanaPrivateKey;
3397
- clack.log.success(`Generated Solana wallet: ${keys.solanaAddress}`);
3398
- }
3399
- } else if (walletAction === "import") {
3400
- // EVM import
3401
- if (!hasEvmKey) {
3402
- const evmKeyInput = await clack.password({
3403
- message: "Paste your EVM private key (0x... hex, or skip):",
3404
- });
3405
-
3406
- if (!clack.isCancel(evmKeyInput) && evmKeyInput.trim()) {
3407
- const result = importWallet("evm", evmKeyInput.trim());
3408
- if (result.success) {
3409
- clack.log.success(`Imported EVM wallet: ${result.address}`);
3410
- } else {
3411
- clack.log.warn(`EVM import failed: ${result.error}`);
3412
- }
3413
- }
3414
- }
3415
-
3416
- // Solana import
3417
- if (!hasSolKey) {
3418
- const solKeyInput = await clack.password({
3419
- message: "Paste your Solana private key (base58, or skip):",
3420
- });
3421
-
3422
- if (!clack.isCancel(solKeyInput) && solKeyInput.trim()) {
3423
- const result = importWallet("solana", solKeyInput.trim());
3424
- if (result.success) {
3425
- clack.log.success(`Imported Solana wallet: ${result.address}`);
3426
- } else {
3427
- clack.log.warn(`Solana import failed: ${result.error}`);
3428
- }
3429
- }
3430
- }
3431
- }
3432
- // "skip" — do nothing
3433
- }
3434
-
3435
- // ── Step 6: Skills Registry (ClawHub default) ──────────────────────────
3436
- const hasSkillsRegistry = Boolean(
3437
- process.env.SKILLS_REGISTRY?.trim() ||
3438
- process.env.CLAWHUB_REGISTRY?.trim(),
3439
- );
3440
- const hasSkillsmpKey = Boolean(process.env.SKILLSMP_API_KEY?.trim());
3441
- if (!hasSkillsRegistry) {
3442
- process.env.SKILLS_REGISTRY = "https://clawhub.ai";
3443
- }
3444
-
3445
- // ── Step 7: GitHub access (for coding agents, issue management) ─────────
3446
- const hasGithubToken = Boolean(process.env.GITHUB_TOKEN?.trim());
3447
- const hasGithubOAuth = Boolean(process.env.GITHUB_OAUTH_CLIENT_ID?.trim());
3448
- if (!hasGithubToken) {
3449
- const options: Array<{ value: string; label: string; hint?: string }> = [
3450
- {
3451
- value: "skip",
3452
- label: "Skip for now",
3453
- hint: "you can add this later",
3454
- },
3455
- {
3456
- value: "pat",
3457
- label: "Paste a Personal Access Token",
3458
- hint: "github.com/settings/tokens",
3459
- },
3460
- ];
3461
- if (hasGithubOAuth) {
3462
- options.push({
3463
- value: "oauth",
3464
- label: "Use OAuth (authorize in browser)",
3465
- hint: "recommended",
3466
- });
3467
- }
3468
-
3469
- const githubChoice = await clack.select({
3470
- message:
3471
- "Configure GitHub access? (needed for coding agents, issue management, PRs)",
3472
- options,
3473
- });
3474
-
3475
- if (!clack.isCancel(githubChoice) && githubChoice === "pat") {
3476
- const tokenInput = await clack.password({
3477
- message: "Paste your GitHub token (or skip):",
3478
- });
3479
- if (!clack.isCancel(tokenInput) && tokenInput.trim()) {
3480
- process.env.GITHUB_TOKEN = tokenInput.trim();
3481
- clack.log.success("GitHub token configured.");
3482
- }
3483
- } else if (!clack.isCancel(githubChoice) && githubChoice === "oauth") {
3484
- clack.log.info(
3485
- "GitHub OAuth will activate when coding agents need access.",
3486
- );
3487
- }
3488
- }
3489
- } // end if (!isCloudMode)
3490
-
3491
- // ── Step 8: Persist agent + style + provider + embedding config ─────────
3492
- // Save the agent name and chosen personality template into config so that
3493
- // the same character data is used regardless of whether the user onboarded
3494
- // via CLI or GUI. This ensures full parity between onboarding surfaces.
3495
- const existingList: AgentConfig[] = config.agents?.list ?? [];
3496
- const mainEntry: AgentConfig = existingList[0] ?? {
3497
- id: "main",
3498
- default: true,
3499
- };
3500
- const agentConfigEntry: AgentConfig = { ...mainEntry, name };
3501
-
3502
- // Apply the chosen style template to the agent config entry so the
3503
- // personality is persisted — not just the name.
3504
- if (chosenTemplate) {
3505
- agentConfigEntry.bio = chosenTemplate.bio;
3506
- agentConfigEntry.system = chosenTemplate.system;
3507
- agentConfigEntry.style = chosenTemplate.style;
3508
- agentConfigEntry.adjectives = chosenTemplate.adjectives;
3509
- agentConfigEntry.postExamples = chosenTemplate.postExamples;
3510
- agentConfigEntry.messageExamples = chosenTemplate.messageExamples;
3511
- }
3512
-
3513
- const updatedList: AgentConfig[] = [
3514
- agentConfigEntry,
3515
- ...existingList.slice(1),
3516
- ];
3517
-
3518
- const updated: ElizaConfig = {
3519
- ...config,
3520
- agents: {
3521
- ...config.agents,
3522
- list: updatedList,
3523
- },
3524
- };
3525
-
3526
- // Persist the provider API key and wallet keys in config.env so they
3527
- // survive restarts. Initialise the env bucket once to avoid the
3528
- // repeated `if (!updated.env)` pattern.
3529
- if (!updated.env) updated.env = {};
3530
- const envBucket = updated.env as Record<string, string>;
3531
-
3532
- // Only persist local-mode env vars when not in cloud mode (those vars
3533
- // were never prompted for / set during cloud onboarding).
3534
- if (!isCloudMode) {
3535
- if (providerEnvKey && providerApiKey) {
3536
- envBucket[providerEnvKey] = providerApiKey;
3537
- // Also set immediately in process.env for the current run
3538
- process.env[providerEnvKey] = providerApiKey;
3539
- }
3540
- if (process.env.EVM_PRIVATE_KEY && !hasEvmKey) {
3541
- envBucket.EVM_PRIVATE_KEY = process.env.EVM_PRIVATE_KEY;
3542
- }
3543
- if (process.env.SOLANA_PRIVATE_KEY && !hasSolKey) {
3544
- envBucket.SOLANA_PRIVATE_KEY = process.env.SOLANA_PRIVATE_KEY;
3545
- }
3546
- if (process.env.SKILLS_REGISTRY) {
3547
- envBucket.SKILLS_REGISTRY = process.env.SKILLS_REGISTRY;
3548
- }
3549
- if (process.env.SKILLSMP_API_KEY) {
3550
- envBucket.SKILLSMP_API_KEY = process.env.SKILLSMP_API_KEY;
3551
- }
3552
- if (process.env.GITHUB_TOKEN) {
3553
- envBucket.GITHUB_TOKEN = process.env.GITHUB_TOKEN;
3554
- }
3555
- if (process.env.GITHUB_OAUTH_CLIENT_ID) {
3556
- envBucket.GITHUB_OAUTH_CLIENT_ID = process.env.GITHUB_OAUTH_CLIENT_ID;
3557
- }
3558
- }
3559
-
3560
- // ── Cloud config persistence ───────────────────────────────────────────
3561
- // If the user completed cloud onboarding, persist the cloud credentials
3562
- // and agent ID so subsequent `milady start` connects directly.
3563
- if (cloudOnboardingResult) {
3564
- updated.cloud = {
3565
- ...updated.cloud,
3566
- enabled: isCloudMode,
3567
- provider: "elizacloud",
3568
- apiKey: cloudOnboardingResult.apiKey,
3569
- baseUrl: cloudOnboardingResult.baseUrl,
3570
- inferenceMode: isCloudMode ? "cloud" : updated.cloud?.inferenceMode,
3571
- runtime: isCloudMode ? "cloud" : "local",
3572
- };
3573
- if (cloudOnboardingResult.agentId) {
3574
- updated.cloud.agentId = cloudOnboardingResult.agentId;
3575
- }
3576
- }
3577
-
3578
- try {
3579
- saveElizaConfig(updated);
3580
- } catch (err) {
3581
- // Non-fatal: the agent can still start, but choices won't persist.
3582
- clack.log.warn(`Could not save config: ${formatError(err)}`);
3583
- }
3584
- clack.log.message(`${name}: ${styleChoice} Alright, that's me.`);
3585
- clack.outro(
3586
- isCloudMode ? "Your agent is live in the cloud! ☁️" : "Let's get started!",
3587
- );
3588
-
3589
- return updated;
3590
- }
3591
-
3592
- // ---------------------------------------------------------------------------
3593
- // Entry point
3594
- // ---------------------------------------------------------------------------
3595
-
3596
- /** Options accepted by {@link startEliza}. */
3597
- export interface StartElizaOptions {
3598
- /**
3599
- * When true, skip the interactive CLI chat loop and return the
3600
- * initialised {@link AgentRuntime} so it can be wired into the API
3601
- * server (used by `dev-server.ts`).
3602
- */
3603
- headless?: boolean;
3604
- /**
3605
- * When true, start the API server and keep running without entering
3606
- * the interactive chat loop. Used by `bun run start` for production
3607
- * server mode (like dev but without watch).
3608
- */
3609
- serverOnly?: boolean;
3610
- /**
3611
- * Internal guard to prevent infinite retry loops when recovering from
3612
- * corrupt PGLite state.
3613
- */
3614
- pgliteRecoveryAttempted?: boolean;
3615
- }
3616
-
3617
- export interface BootElizaRuntimeOptions {
3618
- /**
3619
- * When true, require an existing ~/.milady/milady.json config file.
3620
- * This is used by non-CLI UIs (like the @elizaos/tui interface) where interactive
3621
- * onboarding prompts would break the alternate screen.
3622
- */
3623
- requireConfig?: boolean;
3624
- }
3625
-
3626
- /**
3627
- * Boot the elizaOS runtime without starting the readline chat loop.
3628
- *
3629
- * This is a convenience wrapper around {@link startEliza} in headless mode,
3630
- * with optional config guards.
3631
- */
3632
- export async function bootElizaRuntime(
3633
- opts: BootElizaRuntimeOptions = {},
3634
- ): Promise<AgentRuntime> {
3635
- if (opts.requireConfig && !configFileExists()) {
3636
- throw new Error(
3637
- "No config found. Run `milady start` once to complete setup.",
3638
- );
3639
- }
3640
-
3641
- const runtime = await startEliza({ headless: true });
3642
- if (!runtime) {
3643
- throw new Error("Failed to boot runtime");
3644
- }
3645
- return runtime;
3646
- }
3647
-
3648
- const LEVEL_TO_NAME: Record<number, string> = {
3649
- 10: "trace",
3650
- 20: "debug",
3651
- 27: "success",
3652
- 28: "progress",
3653
- 29: "log",
3654
- 30: "info",
3655
- 40: "warn",
3656
- 50: "error",
3657
- 60: "fatal",
3658
- };
3659
-
3660
- export const logToChatListener = (entry: LogEntry) => {
3661
- if (entry.roomId && entry.runtime) {
3662
- const runtime = entry.runtime as unknown as AgentRuntime & {
3663
- logLevelOverrides?: Map<string, string>;
3664
- };
3665
- // access dynamic property
3666
- const overrides = runtime.logLevelOverrides;
3667
- const overrideLevel = overrides?.get(String(entry.roomId));
3668
-
3669
- if (overrideLevel) {
3670
- const levelKey = entry.level as number;
3671
- const levelName = (
3672
- levelKey && LEVEL_TO_NAME[levelKey] ? LEVEL_TO_NAME[levelKey] : "log"
3673
- ).toUpperCase();
3674
-
3675
- const prefix = `[${levelName}]`;
3676
- const content = `${prefix} ${entry.msg}`;
3677
-
3678
- // Prevent infinite loops by suppressing logs from this action
3679
- runtime
3680
- .sendMessageToTarget(
3681
- { roomId: entry.roomId } as unknown as TargetInfo,
3682
- {
3683
- text: `\`\`\`\n${content}\n\`\`\``,
3684
- source: "system",
3685
-
3686
- isLog: "true",
3687
- },
3688
- )
3689
- .catch(() => {});
3690
- }
3691
- }
3692
- };
3693
-
3694
- /**
3695
- * Start the elizaOS runtime with Milady's configuration.
3696
- *
3697
- * In headless mode the runtime is returned instead of entering the
3698
- * interactive readline loop.
3699
- */
3700
- export async function startEliza(
3701
- opts?: StartElizaOptions,
3702
- ): Promise<AgentRuntime | undefined> {
3703
- // Start buffering logs early so startup messages appear in the UI log viewer
3704
- const { captureEarlyLogs } = await import("../api/early-logs");
3705
- captureEarlyLogs();
3706
-
3707
- // Register log listener for chat mirroring
3708
- addLogListener(logToChatListener);
3709
-
3710
- // 1. Load Milady config from ~/.milady/milady.json
3711
- let config: ElizaConfig;
3712
- try {
3713
- config = loadElizaConfig();
3714
- } catch (err) {
3715
- if ((err as NodeJS.ErrnoException).code === "ENOENT") {
3716
- logger.warn("[milady] No config found, using defaults");
3717
- // All ElizaConfig fields are optional, so an empty object is
3718
- // structurally valid. The `as` cast is safe here.
3719
- config = {} as ElizaConfig;
3720
- } else {
3721
- throw err;
3722
- }
3723
- }
3724
-
3725
- // 1b. First-run onboarding — ask for agent name if not configured.
3726
- // In headless mode (GUI) the onboarding is handled by the web UI,
3727
- // so we skip the interactive CLI prompt and let the runtime start
3728
- // with defaults. The GUI will restart the agent after onboarding.
3729
- if (!opts?.headless) {
3730
- config = await runFirstTimeSetup(config);
3731
- }
3732
-
3733
- // 1c. Apply logging level from config to process.env so the global
3734
- // @elizaos/core logger (used by plugins) respects it.
3735
- // config.logging.level is guaranteed to be set (defaults to "error").
3736
- // Users can still opt into noisy logs via config.logging.level or
3737
- // an explicit LOG_LEVEL environment variable.
3738
- if (!process.env.LOG_LEVEL) {
3739
- process.env.LOG_LEVEL = config.logging?.level ?? "error";
3740
- }
3741
-
3742
- // 2. Push channel secrets into process.env for plugin discovery
3743
- applyConnectorSecretsToEnv(config);
3744
- await autoResolveDiscordAppId();
3745
-
3746
- // 2b. Propagate cloud config into process.env for ElizaCloud plugin
3747
- applyCloudConfigToEnv(config);
3748
-
3749
- // 2c. Propagate x402 config into process.env
3750
- applyX402ConfigToEnv(config);
3751
-
3752
- // 2d. Propagate database config into process.env for plugin-sql
3753
- applyDatabaseConfigToEnv(config);
3754
-
3755
- // 2e. Propagate arbitrary env vars from config.env into process.env.
3756
- // Milady stores user-defined env vars (plugin settings, API URLs, etc.)
3757
- // in config.env; elizaOS plugins read them via process.env / getSetting.
3758
- if (
3759
- config.env &&
3760
- typeof config.env === "object" &&
3761
- !Array.isArray(config.env)
3762
- ) {
3763
- for (const [key, value] of Object.entries(config.env)) {
3764
- if (typeof value === "string" && !process.env[key]) {
3765
- process.env[key] = value;
3766
- }
3767
- }
3768
- }
3769
-
3770
- // Log active database configuration for debugging persistence issues
3771
- {
3772
- const dbProvider = config.database?.provider ?? "pglite";
3773
- const pgliteDir = process.env.PGLITE_DATA_DIR;
3774
- const postgresUrl = process.env.POSTGRES_URL;
3775
- logger.info(
3776
- `[milady] Database provider: ${dbProvider}` +
3777
- (dbProvider === "pglite" && pgliteDir
3778
- ? ` | data dir: ${pgliteDir}`
3779
- : "") +
3780
- (dbProvider === "postgres" && postgresUrl
3781
- ? ` | connection: ${postgresUrl.replace(/:\/\/([^:]+):([^@]+)@/, "://$1:***@")}`
3782
- : ""),
3783
- );
3784
- }
3785
-
3786
- // 2d-iii. OG tracking code initialization
3787
- try {
3788
- const { initializeOGCode } = await import("../api/og-tracker");
3789
- initializeOGCode();
3790
- } catch {
3791
- // Silent — OG tracking is non-critical
3792
- }
3793
-
3794
- // 2d-ii. Allow destructive migrations (e.g. dropping tables removed between
3795
- // plugin versions) so the runtime doesn't silently stall. Without this
3796
- // the migration system throws an error that gets swallowed, leaving the
3797
- // app hanging indefinitely with no output.
3798
- if (!process.env.ELIZA_ALLOW_DESTRUCTIVE_MIGRATIONS) {
3799
- process.env.ELIZA_ALLOW_DESTRUCTIVE_MIGRATIONS = "true";
3800
- }
3801
-
3802
- // 2e. Prevent @elizaos/core from auto-loading @elizaos/plugin-bootstrap.
3803
- // Milady uses @elizaos/plugin-trust which provides the settings/roles
3804
- // providers and actions. plugin-bootstrap (v1.x) is incompatible with
3805
- // the 2.0.0-alpha.x runtime used here.
3806
- if (!process.env.IGNORE_BOOTSTRAP) {
3807
- process.env.IGNORE_BOOTSTRAP = "true";
3808
- }
3809
-
3810
- // 2e-ii. Ensure SECRET_SALT is set to suppress the @elizaos/core default
3811
- // warning and avoid using a predictable value in production.
3812
- if (!process.env.SECRET_SALT) {
3813
- process.env.SECRET_SALT = crypto.randomBytes(32).toString("hex");
3814
- logger.info("[milady] Generated random SECRET_SALT for this session");
3815
- }
3816
-
3817
- // 2e-iii. Pre-flight validation for Google AI API keys. If the key looks
3818
- // obviously invalid (too short, placeholder, wrong prefix), clear it
3819
- // to prevent plugin-google-genai from making a failing API call.
3820
- for (const gkey of [
3821
- "GEMINI_API_KEY",
3822
- "GOOGLE_API_KEY",
3823
- "GOOGLE_GENERATIVE_AI_API_KEY",
3824
- ] as const) {
3825
- const val = process.env[gkey]?.trim();
3826
- if (
3827
- val &&
3828
- (val.length < 20 || val === "your-key-here" || val.startsWith("sk-"))
3829
- ) {
3830
- logger.warn(
3831
- `[milady] ${gkey} appears invalid (length/format), clearing to skip Google AI plugin`,
3832
- );
3833
- delete process.env[gkey];
3834
- }
3835
- }
3836
-
3837
- // 2f. Apply subscription-based credentials (Claude Max, Codex Max)
3838
- try {
3839
- const { applySubscriptionCredentials } = await import("../auth/index");
3840
- await applySubscriptionCredentials(config);
3841
- } catch (err) {
3842
- logger.warn(`[milady] Failed to apply subscription credentials: ${err}`);
3843
- }
3844
-
3845
- // 2g. Cloud mode — if the user chose cloud during onboarding (or on a
3846
- // subsequent start with cloud config), skip local runtime setup and
3847
- // connect via the thin client instead.
3848
- if (
3849
- config.cloud?.enabled &&
3850
- config.cloud?.apiKey &&
3851
- config.cloud?.agentId &&
3852
- config.cloud?.runtime === "cloud"
3853
- ) {
3854
- return startInCloudMode(config, config.cloud.agentId, opts);
3855
- }
3856
-
3857
- // 3. Build elizaOS Character from Milady config
3858
- const character = buildCharacterFromConfig(config);
3859
-
3860
- const primaryModel = resolvePrimaryModel(config);
3861
-
3862
- // 4. Ensure workspace exists with bootstrap files
3863
- const workspaceDir =
3864
- config.agents?.defaults?.workspace ?? resolveDefaultAgentWorkspaceDir();
3865
- await ensureAgentWorkspace({ dir: workspaceDir, ensureInitFiles: true });
3866
-
3867
- // 4b. Ensure custom plugins directory exists for drop-in plugins
3868
- await fs.mkdir(path.join(resolveStateDir(), CUSTOM_PLUGINS_DIRNAME), {
3869
- recursive: true,
3870
- });
3871
-
3872
- // 5. Create the Milady bridge plugin (workspace context + session keys + compaction)
3873
- const agentId = character.name?.toLowerCase().replace(/\s+/g, "-") ?? "main";
3874
- const miladyPlugin = createElizaPlugin({
3875
- workspaceDir,
3876
-
3877
-
3878
- agentId,
3879
- });
3880
-
3881
- // 6. Resolve and load plugins
3882
- // In headless (GUI) mode before onboarding, the user hasn't configured a
3883
- // provider yet. Downgrade diagnostics so the expected "no AI provider"
3884
- // state doesn't appear as a scary Error in the terminal.
3885
- const preOnboarding = opts?.headless && !config.agents;
3886
- const resolvedPlugins = await resolvePlugins(config, {
3887
- quiet: preOnboarding,
3888
- });
3889
-
3890
- if (resolvedPlugins.length === 0) {
3891
- if (preOnboarding) {
3892
- logger.info(
3893
- "[milady] No plugins loaded yet — the onboarding wizard will configure a model provider",
3894
- );
3895
- } else {
3896
- logger.error(
3897
- "[milady] No plugins loaded — at least one model provider plugin is required",
3898
- );
3899
- logger.error(
3900
- "[milady] Set an API key (e.g. ANTHROPIC_API_KEY, OPENAI_API_KEY) in your environment",
3901
- );
3902
- throw new Error("No plugins loaded");
3903
- }
3904
- }
3905
-
3906
- // 6b. Debug logging — print full context after provider + plugin resolution
3907
- {
3908
- const pluginNames = resolvedPlugins.map((p) => p.name);
3909
- const providerNames = resolvedPlugins
3910
- .flatMap((p) => p.plugin.providers ?? [])
3911
- .map((prov: Provider) => prov.name);
3912
- // Build a context summary for validation
3913
- const contextSummary: Record<string, unknown> = {
3914
- agentName: character.name,
3915
- pluginCount: resolvedPlugins.length,
3916
- providerCount: providerNames.length,
3917
- primaryModel: primaryModel ?? "(auto-detect)",
3918
- workspaceDir,
3919
- };
3920
- debugLogResolvedContext(pluginNames, providerNames, contextSummary, (msg) =>
3921
- logger.debug(msg),
3922
- );
3923
-
3924
- // Validate the context and surface issues early
3925
- const contextValidation = validateRuntimeContext(contextSummary);
3926
- if (!contextValidation.valid) {
3927
- const issues: string[] = [];
3928
- if (contextValidation.nullFields.length > 0) {
3929
- issues.push(`null: ${contextValidation.nullFields.join(", ")}`);
3930
- }
3931
- if (contextValidation.undefinedFields.length > 0) {
3932
- issues.push(
3933
- `undefined: ${contextValidation.undefinedFields.join(", ")}`,
3934
- );
3935
- }
3936
- if (contextValidation.emptyFields.length > 0) {
3937
- issues.push(`empty: ${contextValidation.emptyFields.join(", ")}`);
3938
- }
3939
- logger.warn(
3940
- `[milady] Context validation issues detected: ${issues.join("; ")}`,
3941
- );
3942
- }
3943
- }
3944
-
3945
- // 7. Create the AgentRuntime with Milady plugin + resolved plugins
3946
- // All CORE_PLUGINS are pre-registered sequentially (in CORE_PLUGINS
3947
- // order) before runtime.initialize() so that cross-plugin getService()
3948
- // calls always resolve. runtime.initialize() registers remaining
3949
- // characterPlugins (connectors, providers, custom) in parallel — those
3950
- // are NOT core and don't have ordering dependencies.
3951
- const PREREGISTER_PLUGINS = new Set(CORE_PLUGINS);
3952
- const sqlPlugin = resolvedPlugins.find(
3953
- (p) => p.name === "@elizaos/plugin-sql",
3954
- );
3955
- const localEmbeddingPlugin = resolvedPlugins.find(
3956
- (p) => p.name === "@elizaos/plugin-local-embedding",
3957
- );
3958
- const otherPlugins = resolvedPlugins.filter(
3959
- (p) => !PREREGISTER_PLUGINS.has(p.name),
3960
- );
3961
-
3962
- // Resolve the runtime log level from config (AgentRuntime doesn't support
3963
- // "silent", so we map it to "fatal" as the quietest supported level).
3964
- const runtimeLogLevel = (() => {
3965
- // process.env.LOG_LEVEL is already resolved (set explicitly or from
3966
- // config.logging.level above), so prefer it to honour the dev-mode
3967
- // LOG_LEVEL=error override set by scripts/dev-ui.mjs.
3968
- const lvl = process.env.LOG_LEVEL ?? config.logging?.level ?? "error";
3969
- if (lvl === "silent") return "fatal" as const;
3970
- return lvl as "trace" | "debug" | "info" | "warn" | "error" | "fatal";
3971
- })();
3972
-
3973
- // 7a. Resolve bundled skills directory from @elizaos/skills so
3974
- // plugin-agent-skills auto-loads them on startup.
3975
- let bundledSkillsDir: string | null = null;
3976
- try {
3977
- const { getSkillsDir } = (await import("@elizaos/skills")) as {
3978
- getSkillsDir: () => string;
3979
- };
3980
- bundledSkillsDir = getSkillsDir();
3981
- logger.info(`[milady] Bundled skills dir: ${bundledSkillsDir}`);
3982
- } catch {
3983
- logger.debug(
3984
- "[milady] @elizaos/skills not available — bundled skills will not be loaded",
3985
- );
3986
- }
3987
-
3988
- // Workspace skills directory (highest precedence for overrides)
3989
- const workspaceSkillsDir = workspaceDir ? `${workspaceDir}/skills` : null;
3990
- const managedSkillsDir = path.join(resolveStateDir(), "skills");
3991
-
3992
- // ── Sandbox mode setup ──────────────────────────────────────────────────
3993
- const sandboxConfig = config.agents?.defaults?.sandbox;
3994
- const sandboxModeStr = (sandboxConfig as Record<string, unknown> | undefined)
3995
- ?.mode as string | undefined;
3996
- const sandboxMode: SandboxMode =
3997
- sandboxModeStr === "light" ||
3998
- sandboxModeStr === "standard" ||
3999
- sandboxModeStr === "max"
4000
- ? sandboxModeStr
4001
- : "off";
4002
- const isSandboxActive = sandboxMode !== "off";
4003
-
4004
- let sandboxManager: SandboxManager | null = null;
4005
- let sandboxAuditLog: SandboxAuditLog | null = null;
4006
-
4007
- if (isSandboxActive) {
4008
- logger.info(`[milady] Sandbox mode: ${sandboxMode}`);
4009
- sandboxAuditLog = new SandboxAuditLog({ console: true });
4010
-
4011
- // Standard/max modes also start the container sandbox manager
4012
- if (sandboxMode === "standard" || sandboxMode === "max") {
4013
- const dockerSettings = (
4014
- sandboxConfig as Record<string, unknown> | undefined
4015
- )?.docker as Record<string, unknown> | undefined;
4016
- const browserSettings = (
4017
- sandboxConfig as Record<string, unknown> | undefined
4018
- )?.browser as Record<string, unknown> | undefined;
4019
-
4020
- sandboxManager = new SandboxManager({
4021
- mode: sandboxMode,
4022
- image: (dockerSettings?.image as string) ?? undefined,
4023
- containerPrefix:
4024
- (dockerSettings?.containerPrefix as string) ?? undefined,
4025
- network: (dockerSettings?.network as string) ?? undefined,
4026
- memory: (dockerSettings?.memory as string) ?? undefined,
4027
- cpus: (dockerSettings?.cpus as number) ?? undefined,
4028
- workspaceRoot: workspaceDir ?? undefined,
4029
- browser: browserSettings
4030
- ? {
4031
- enabled: (browserSettings.enabled as boolean) ?? false,
4032
- image: (browserSettings.image as string) ?? undefined,
4033
- cdpPort: (browserSettings.cdpPort as number) ?? undefined,
4034
- vncPort: (browserSettings.vncPort as number) ?? undefined,
4035
- noVncPort: (browserSettings.noVncPort as number) ?? undefined,
4036
- headless: (browserSettings.headless as boolean) ?? undefined,
4037
- enableNoVnc:
4038
- (browserSettings.enableNoVnc as boolean) ?? undefined,
4039
- autoStart: (browserSettings.autoStart as boolean) ?? true,
4040
- autoStartTimeoutMs:
4041
- (browserSettings.autoStartTimeoutMs as number) ?? undefined,
4042
- }
4043
- : undefined,
4044
- });
4045
-
4046
- try {
4047
- await sandboxManager.start();
4048
- logger.info("[milady] Sandbox manager started");
4049
- } catch (err) {
4050
- logger.error(
4051
- `[milady] Sandbox manager failed to start: ${err instanceof Error ? err.message : String(err)}`,
4052
- );
4053
- // Non-fatal: light mode fallback
4054
- }
4055
- }
4056
-
4057
- sandboxAuditLog.record({
4058
- type: "sandbox_lifecycle",
4059
- summary: `Sandbox initialized: mode=${sandboxMode}`,
4060
- severity: "info",
4061
- });
4062
- }
4063
- // ── End sandbox setup ───────────────────────────────────────────────────
4064
-
4065
- // ── Boost preferred model plugin priority ─────────────────────────────
4066
- // elizaOS selects the model handler with the highest `priority` for each
4067
- // ModelType. All provider plugins default to priority 0, so whichever
4068
- // registers first wins — essentially random when using Promise.all.
4069
- // When the user has explicitly chosen a primary model provider (via
4070
- // `model.primary` in config), we bump that plugin's priority so its
4071
- // handlers are always selected over other providers.
4072
- const pluginsForRuntime = otherPlugins.map((p) => p.plugin);
4073
- const visionModeSetting = resolveVisionModeSetting(config);
4074
- if (primaryModel) {
4075
- for (const plugin of pluginsForRuntime) {
4076
- if (plugin.name === primaryModel) {
4077
- plugin.priority = (plugin.priority ?? 0) + 10;
4078
- logger.info(
4079
- `[milady] Boosted plugin "${plugin.name}" priority to ${plugin.priority} (model.primary)`,
4080
- );
4081
- break;
4082
- }
4083
- }
4084
- }
4085
-
4086
- // Deduplicate actions across all plugins to avoid "Action already registered"
4087
- // warnings from elizaOS core. First plugin wins (miladyPlugin is first).
4088
- deduplicatePluginActions([miladyPlugin, ...pluginsForRuntime]);
4089
-
4090
- let runtime = new AgentRuntime({
4091
- character,
4092
- // advancedCapabilities: true,
4093
- actionPlanning: true,
4094
- // advancedMemory: true, // Not supported in this version of AgentRuntime
4095
- plugins: [miladyPlugin, ...pluginsForRuntime],
4096
- ...(runtimeLogLevel ? { logLevel: runtimeLogLevel } : {}),
4097
- // Sandbox options — only active when mode != "off"
4098
- ...(isSandboxActive
4099
- ? {
4100
- sandboxMode: true,
4101
- sandboxAuditHandler: sandboxAuditLog
4102
- ? (event: SandboxFetchAuditEvent) => {
4103
- sandboxAuditLog.recordTokenReplacement(
4104
- event.direction,
4105
- event.url,
4106
- event.tokenIds,
4107
- );
4108
- }
4109
- : undefined,
4110
- }
4111
- : {}),
4112
- settings: {
4113
- VALIDATION_LEVEL: "fast",
4114
- // Forward non-sensitive Milady config.env vars as runtime settings so
4115
- // plugins can access them via runtime.getSetting(). This fixes a bug where
4116
- // plugins (e.g. @elizaos/plugin-google-genai) call runtime.getSetting()
4117
- // which returns null for keys not in settings, but the plugin checks
4118
- // !== undefined causing it to use "null" as the model name.
4119
- //
4120
- // Security: Filter out blockchain private keys and secrets. API keys are
4121
- // allowed since plugins need them via runtime.getSetting(). Private keys
4122
- // should only be accessed via process.env by signing services.
4123
- ...Object.fromEntries(
4124
- Object.entries(collectConfigEnvVars(config)).filter(([key]) =>
4125
- isEnvKeyAllowedForForwarding(key),
4126
- ),
4127
- ),
4128
- // Forward Milady config env vars as runtime settings
4129
- ...(primaryModel ? { MODEL_PROVIDER: primaryModel } : {}),
4130
- ...(visionModeSetting ? { VISION_MODE: visionModeSetting } : {}),
4131
- // Forward skills config so plugin-agent-skills can apply allow/deny filtering
4132
- ...(config.skills?.allowBundled
4133
- ? { SKILLS_ALLOWLIST: config.skills.allowBundled.join(",") }
4134
- : {}),
4135
- ...(config.skills?.denyBundled
4136
- ? { SKILLS_DENYLIST: config.skills.denyBundled.join(",") }
4137
- : {}),
4138
- // Managed skills are stored in the Milady state dir (~/.milady/skills).
4139
- SKILLS_DIR: managedSkillsDir,
4140
- // Tell plugin-agent-skills where to find bundled + workspace skills
4141
- ...(bundledSkillsDir ? { BUNDLED_SKILLS_DIRS: bundledSkillsDir } : {}),
4142
- ...(workspaceSkillsDir
4143
- ? { WORKSPACE_SKILLS_DIR: workspaceSkillsDir }
4144
- : {}),
4145
- // Also forward extra dirs from config
4146
- ...(config.skills?.load?.extraDirs?.length
4147
- ? { EXTRA_SKILLS_DIRS: config.skills.load.extraDirs.join(",") }
4148
- : {}),
4149
- // Disable image description when vision is explicitly toggled off.
4150
- // The cloud plugin always registers IMAGE_DESCRIPTION, so we need a
4151
- // runtime setting to prevent the message service from calling it.
4152
- ...(config.features?.vision === false
4153
- ? { DISABLE_IMAGE_DESCRIPTION: "true" }
4154
- : {}),
4155
- },
4156
- });
4157
- installRuntimeMethodBindings(runtime);
4158
-
4159
- // 7b. Pre-register plugin-sql so the adapter is ready before other plugins init.
4160
- // This is OPTIONAL — without it, some features (memory, todos) won't work.
4161
- // runtime.db is a getter that returns this.adapter.db and throws when
4162
- // this.adapter is undefined, so plugins that use runtime.db will fail.
4163
- if (sqlPlugin) {
4164
- // 7c. Eagerly initialize the database adapter so it's fully ready
4165
- // BEFORE other plugins run their init(). When legacy/corrupt PGLite
4166
- // state causes startup aborts, reset the local DB dir and retry once.
4167
- await registerSqlPluginWithRecovery(runtime, sqlPlugin, config);
4168
- } else {
4169
- const loadedNames = resolvedPlugins.map((p) => p.name).join(", ");
4170
- logger.error(
4171
- `[milady] @elizaos/plugin-sql was NOT found among resolved plugins. ` +
4172
- `Loaded: [${loadedNames}]`,
4173
- );
4174
- throw new Error(
4175
- "@elizaos/plugin-sql is required but was not loaded. " +
4176
- "Ensure the package is installed and built (check for import errors above).",
4177
- );
4178
- }
4179
-
4180
- // 7d. Pre-register plugin-local-embedding so its TEXT_EMBEDDING handler
4181
- // (priority 10) is available before runtime.initialize() starts all
4182
- // plugins in parallel. Without this, the bootstrap plugin's services
4183
- // (ActionFilterService, EmbeddingGenerationService) race ahead and use
4184
- // the cloud plugin's TEXT_EMBEDDING handler — which hits a paid API —
4185
- // because local-embedding's heavier init hasn't completed yet.
4186
- if (localEmbeddingPlugin) {
4187
- configureLocalEmbeddingPlugin(localEmbeddingPlugin.plugin, config);
4188
- await runtime.registerPlugin(localEmbeddingPlugin.plugin);
4189
- logger.info(
4190
- "[milady] plugin-local-embedding pre-registered (TEXT_EMBEDDING ready)",
4191
- );
4192
- } else {
4193
- logger.warn(
4194
- "[milady] @elizaos/plugin-local-embedding not found — embeddings " +
4195
- "will fall back to whatever TEXT_EMBEDDING handler is registered by " +
4196
- "other plugins (may incur cloud API costs)",
4197
- );
4198
- }
4199
-
4200
- // 7e. Pre-register remaining core plugins sequentially in CORE_PLUGINS order.
4201
- // Each registerPlugin() call runs the plugin's init() before proceeding
4202
- // to the next, guaranteeing that cross-plugin getService() calls resolve.
4203
- {
4204
- const alreadyPreRegistered = new Set([
4205
- "@elizaos/plugin-sql",
4206
- "@elizaos/plugin-local-embedding",
4207
- ]);
4208
- for (const name of CORE_PLUGINS) {
4209
- if (alreadyPreRegistered.has(name)) continue;
4210
- const resolved = resolvedPlugins.find((p) => p.name === name);
4211
- if (!resolved) {
4212
- logger.debug(
4213
- `[milady] Core plugin ${name} not resolved — skipping pre-registration`,
4214
- );
4215
- continue;
4216
- }
4217
- try {
4218
- await runtime.registerPlugin(resolved.plugin);
4219
- } catch (err) {
4220
- logger.warn(
4221
- `[milady] Core plugin ${name} pre-registration failed: ${formatError(err)}`,
4222
- );
4223
- }
4224
- }
4225
- }
4226
-
4227
- const warmAgentSkillsService = async (): Promise<void> => {
4228
- // Let runtime startup complete first; this warm-up runs asynchronously
4229
- // so API + agent come online immediately.
4230
- try {
4231
- const skillServicePromise = runtime.getServiceLoadPromise(
4232
- "AGENT_SKILLS_SERVICE",
4233
- );
4234
- const timeout = new Promise<never>((_resolve, reject) => {
4235
- setTimeout(() => {
4236
- reject(
4237
- new Error(
4238
- "AgentSkillsService warm-up timed out (10s) — non-blocking, agent will function without skills",
4239
- ),
4240
- );
4241
- }, 10_000);
4242
- });
4243
- await Promise.race([skillServicePromise, timeout]);
4244
-
4245
- const svc = runtime.getService("AGENT_SKILLS_SERVICE") as
4246
- | {
4247
- getCatalogStats?: () => {
4248
- loaded: number;
4249
- total: number;
4250
- storageType: string;
4251
- };
4252
- }
4253
- | null
4254
- | undefined;
4255
- if (svc?.getCatalogStats) {
4256
- const stats = svc.getCatalogStats();
4257
- logger.info(
4258
- `[milady] AgentSkills ready — ${stats.loaded} skills loaded, ` +
4259
- `${stats.total} in catalog (storage: ${stats.storageType})`,
4260
- );
4261
- }
4262
-
4263
- // Guard against non-string skill.description values.
4264
- // The bundled YAML parser produces {} for multi-line descriptions, which
4265
- // crashes findBestLocalMatch / scoreSkillMatch (call .toLowerCase() on it).
4266
- // Instead of a one-shot sanitize (which misses skills loaded later by
4267
- // syncCatalog / autoRefresh), we monkey-patch getLoadedSkills to always
4268
- // return sanitized values.
4269
- const svcAny = svc as Record<string, unknown> | null | undefined;
4270
- const origGetLoaded = svcAny?.getLoadedSkills as
4271
- | ((...args: unknown[]) => Array<Record<string, unknown>>)
4272
- | undefined;
4273
- if (origGetLoaded && svcAny) {
4274
- (svcAny as Record<string, unknown>).getLoadedSkills = function (
4275
- ...args: unknown[]
4276
- ) {
4277
- const skills = origGetLoaded.apply(this, args);
4278
- for (const skill of skills) {
4279
- if (typeof skill.description !== "string") {
4280
- skill.description =
4281
- skill.description == null
4282
- ? ""
4283
- : JSON.stringify(skill.description);
4284
- }
4285
- }
4286
- return skills;
4287
- };
4288
- logger.debug("[milady] Patched getLoadedSkills to guard descriptions");
4289
- }
4290
- } catch (err) {
4291
- // Non-fatal — the agent can operate without skills. This warm-up runs
4292
- // async so it doesn't block startup.
4293
- logger.debug(`[milady] AgentSkillsService warm-up: ${formatError(err)}`);
4294
- }
4295
- };
4296
-
4297
- const initializeRuntimeServices = async (): Promise<void> => {
4298
- // 8. Initialize the runtime (registers remaining plugins, starts services)
4299
- await runtime.initialize();
4300
- await waitForTrajectoryLoggerService(runtime, "runtime.initialize()");
4301
- ensureTrajectoryLoggerEnabled(runtime, "runtime.initialize()");
4302
- installDatabaseTrajectoryLogger(runtime);
4303
- patchTrajectoryLoggerAliasCompatibility(runtime);
4304
-
4305
- // 8b. Ensure AutonomyService is available for trigger dispatch.
4306
- // IGNORE_BOOTSTRAP=true prevents the bootstrap plugin (which normally
4307
- // registers this service) from loading, so we start it explicitly.
4308
- if (!runtime.getService("AUTONOMY")) {
4309
- try {
4310
- await AutonomyService.start(runtime);
4311
- logger.info("[milady] AutonomyService started for trigger dispatch");
4312
- } catch (err) {
4313
- logger.warn(
4314
- `[milady] AutonomyService failed to start: ${formatError(err)}`,
4315
- );
4316
- }
4317
- }
4318
-
4319
- // Do not block runtime startup on skills warm-up.
4320
- void warmAgentSkillsService();
4321
- };
4322
-
4323
- try {
4324
- await initializeRuntimeServices();
4325
- } catch (err) {
4326
- const pgliteDataDir = resolveActivePgliteDataDir(config);
4327
- const recoveryAction =
4328
- !opts?.pgliteRecoveryAttempted && pgliteDataDir
4329
- ? getPgliteRecoveryAction(err, pgliteDataDir)
4330
- : "none";
4331
-
4332
- if (!pgliteDataDir || recoveryAction === "none") {
4333
- throw err;
4334
- }
4335
- if (recoveryAction === "fail-active-lock") {
4336
- throw createActivePgliteLockError(pgliteDataDir, err);
4337
- }
4338
-
4339
- logger.warn(
4340
- recoveryAction === "retry-without-reset"
4341
- ? `[milady] Runtime migrations failed (${formatError(err)}). Cleared a stale PGLite lock in ${pgliteDataDir} and retrying startup once without resetting data.`
4342
- : `[milady] Runtime migrations failed (${formatError(err)}). Resetting local PGLite DB at ${pgliteDataDir} and retrying startup once.`,
4343
- );
4344
- try {
4345
- await shutdownRuntime(runtime, "PGLite recovery");
4346
- } catch {
4347
- // Ignore cleanup errors — retry creates a fresh runtime anyway.
4348
- }
4349
-
4350
- if (recoveryAction === "reset-data-dir") {
4351
- await resetPgliteDataDir(pgliteDataDir);
4352
- process.env.PGLITE_DATA_DIR = pgliteDataDir;
4353
- }
4354
-
4355
- return await startEliza({
4356
- ...opts,
4357
- pgliteRecoveryAttempted: true,
4358
- });
4359
- }
4360
-
4361
- installActionAliases(runtime);
4362
-
4363
- // 9. Graceful shutdown handler
4364
- //
4365
- // In headless mode the caller (dev-server / desktop shell) owns the process
4366
- // lifecycle, so we must NOT register signal handlers here — they would
4367
- // stack on every hot-restart, close over stale runtime references, and
4368
- // race with bun --watch's own process teardown.
4369
- if (!opts?.headless) {
4370
- let isShuttingDown = false;
4371
-
4372
- const shutdown = async (): Promise<void> => {
4373
- if (isShuttingDown) return;
4374
- isShuttingDown = true;
4375
-
4376
- try {
4377
- // Stop sandbox manager before runtime
4378
- if (sandboxManager) {
4379
- try {
4380
- await sandboxManager.stop();
4381
- logger.info("[milady] Sandbox manager stopped");
4382
- } catch (err) {
4383
- logger.warn(
4384
- `[milady] Sandbox stop error: ${err instanceof Error ? err.message : String(err)}`,
4385
- );
4386
- }
4387
- }
4388
- } catch (err) {
4389
- logger.warn(`[milady] Sandbox shutdown error: ${formatError(err)}`);
4390
- }
4391
-
4392
- try {
4393
- await shutdownRuntime(runtime, "signal shutdown");
4394
- } catch (err) {
4395
- logger.warn(`[milady] Error during shutdown: ${formatError(err)}`);
4396
- }
4397
- process.exit(0);
4398
- };
4399
-
4400
- process.on("SIGINT", () => void shutdown());
4401
- process.on("SIGTERM", () => void shutdown());
4402
- }
4403
-
4404
- const loadHooksSystem = async (): Promise<void> => {
4405
- try {
4406
- const internalHooksConfig = config.hooks
4407
- ?.internal as LoadHooksOptions["internalConfig"];
4408
-
4409
- await loadHooks({
4410
- workspacePath: workspaceDir,
4411
- internalConfig: internalHooksConfig,
4412
- elizaConfig: config as Record<string, unknown>,
4413
- });
4414
-
4415
- const startupEvent = createHookEvent("gateway", "startup", "system", {
4416
- cfg: config,
4417
- });
4418
- await triggerHook(startupEvent);
4419
- } catch (err) {
4420
- logger.warn(`[milady] Hooks system could not load: ${formatError(err)}`);
4421
- }
4422
- };
4423
-
4424
- // ── Headless mode — return runtime for API server wiring ──────────────
4425
- if (opts?.headless) {
4426
- void loadHooksSystem();
4427
- logger.info(
4428
- "[milady] Runtime initialised in headless mode (autonomy enabled)",
4429
- );
4430
- return runtime;
4431
- }
4432
-
4433
- // 10. Load hooks system
4434
- await loadHooksSystem();
4435
-
4436
- // ── Start API server for GUI access ──────────────────────────────────────
4437
- // In CLI mode (non-headless), start the API server in the background so
4438
- // the GUI can connect to the running agent. This ensures full feature
4439
- // parity: whether started via `npx miladyai`, `bun run dev`, or the
4440
- // desktop app, the API server is always available for the GUI admin
4441
- // surface.
4442
- try {
4443
- const { startApiServer } = await import("../api/server");
4444
- const apiPort = Number(process.env.MILADY_PORT) || 2138;
4445
- const { port: actualApiPort } = await startApiServer({
4446
- port: apiPort,
4447
- runtime,
4448
- onRestart: async () => {
4449
- logger.info("[milady] Hot-reload: Restarting runtime...");
4450
- try {
4451
- // Stop the old runtime to release resources (DB connections, timers, etc.)
4452
-
4453
- try {
4454
- await shutdownRuntime(runtime, "hot-reload cleanup");
4455
- } catch (stopErr) {
4456
- logger.warn(
4457
- `[milady] Hot-reload: old runtime stop failed: ${formatError(stopErr)}`,
4458
- );
4459
- }
4460
-
4461
- // Reload config from disk (updated by API)
4462
- const freshConfig = loadElizaConfig();
4463
-
4464
- // Propagate secrets & cloud config into process.env so plugins
4465
- // (especially plugin-elizacloud) can discover them. The initial
4466
- // startup does this in startEliza(); the hot-reload must repeat it
4467
- // because the config may have changed (e.g. cloud enabled during
4468
- // onboarding).
4469
- applyConnectorSecretsToEnv(freshConfig);
4470
- await autoResolveDiscordAppId();
4471
- applyCloudConfigToEnv(freshConfig);
4472
- applyX402ConfigToEnv(freshConfig);
4473
- applyDatabaseConfigToEnv(freshConfig);
4474
-
4475
- // Apply subscription-based credentials (Claude Max, Codex Max)
4476
- // that may have been set up during onboarding.
4477
- try {
4478
- const { applySubscriptionCredentials } = await import(
4479
- "../auth/index"
4480
- );
4481
- await applySubscriptionCredentials(freshConfig);
4482
- } catch (subErr) {
4483
- logger.warn(
4484
- `[milady] Hot-reload: subscription credentials: ${formatError(subErr)}`,
4485
- );
4486
- }
4487
-
4488
- // Resolve plugins using same function as startup
4489
- const resolvedPlugins = await resolvePlugins(freshConfig);
4490
-
4491
- // Rebuild character from the fresh config so onboarding changes
4492
- // (name, bio, style, etc.) are picked up on restart.
4493
- const freshCharacter = buildCharacterFromConfig(freshConfig);
4494
-
4495
- // Recreate Milady plugin with fresh workspace
4496
- const freshMiladyPlugin = createElizaPlugin({
4497
- workspaceDir:
4498
- freshConfig.agents?.defaults?.workspace ?? workspaceDir,
4499
-
4500
-
4501
- agentId:
4502
- freshCharacter.name?.toLowerCase().replace(/\s+/g, "-") ?? "main",
4503
- });
4504
-
4505
- // Create new runtime with updated plugins.
4506
- // Filter out pre-registered plugins so they aren't double-loaded
4507
- // inside initialize()'s Promise.all — same pattern as the initial
4508
- // startup to avoid the TEXT_EMBEDDING race condition.
4509
- const freshPrimaryModel = resolvePrimaryModel(freshConfig);
4510
- const freshOtherPlugins = resolvedPlugins.filter(
4511
- (p) => !PREREGISTER_PLUGINS.has(p.name),
4512
- );
4513
- // Boost preferred model plugin priority (same as initial startup)
4514
- const freshPluginsForRuntime = freshOtherPlugins.map((p) => p.plugin);
4515
- const freshVisionModeSetting = resolveVisionModeSetting(freshConfig);
4516
- if (freshPrimaryModel) {
4517
- for (const plugin of freshPluginsForRuntime) {
4518
- if (plugin.name === freshPrimaryModel) {
4519
- plugin.priority = (plugin.priority ?? 0) + 10;
4520
- break;
4521
- }
4522
- }
4523
- }
4524
- const newRuntime = new AgentRuntime({
4525
- character: freshCharacter,
4526
- plugins: [freshMiladyPlugin, ...freshPluginsForRuntime],
4527
- ...(runtimeLogLevel ? { logLevel: runtimeLogLevel } : {}),
4528
- settings: {
4529
- ...(freshPrimaryModel
4530
- ? { MODEL_PROVIDER: freshPrimaryModel }
4531
- : {}),
4532
- ...(freshVisionModeSetting
4533
- ? { VISION_MODE: freshVisionModeSetting }
4534
- : {}),
4535
- // Disable image description when vision is explicitly toggled off.
4536
- ...(freshConfig.features?.vision === false
4537
- ? { DISABLE_IMAGE_DESCRIPTION: "true" }
4538
- : {}),
4539
- },
4540
- });
4541
- installRuntimeMethodBindings(newRuntime);
4542
-
4543
- // Pre-register plugin-sql + local-embedding before initialize()
4544
- // to avoid the same race condition as the initial startup.
4545
- // Re-derive from freshly resolved plugins (not outer closure) so
4546
- // hot-reload picks up any plugin updates.
4547
- const freshSqlPlugin = resolvedPlugins.find(
4548
- (p) => p.name === "@elizaos/plugin-sql",
4549
- );
4550
- const freshLocalEmbeddingPlugin = resolvedPlugins.find(
4551
- (p) => p.name === "@elizaos/plugin-local-embedding",
4552
- );
4553
- if (freshSqlPlugin) {
4554
- await registerSqlPluginWithRecovery(
4555
- newRuntime,
4556
- freshSqlPlugin,
4557
- freshConfig,
4558
- );
4559
- }
4560
- if (freshLocalEmbeddingPlugin) {
4561
- configureLocalEmbeddingPlugin(
4562
- freshLocalEmbeddingPlugin.plugin,
4563
- freshConfig,
4564
- );
4565
- await newRuntime.registerPlugin(freshLocalEmbeddingPlugin.plugin);
4566
- }
4567
-
4568
- // Pre-register remaining core plugins sequentially (same as startup)
4569
- {
4570
- const alreadyPreRegistered = new Set([
4571
- "@elizaos/plugin-sql",
4572
- "@elizaos/plugin-local-embedding",
4573
- ]);
4574
- for (const name of CORE_PLUGINS) {
4575
- if (alreadyPreRegistered.has(name)) continue;
4576
- const resolved = resolvedPlugins.find((p) => p.name === name);
4577
- if (!resolved) continue;
4578
- try {
4579
- await newRuntime.registerPlugin(resolved.plugin);
4580
- } catch (err) {
4581
- logger.warn(
4582
- `[milady] Hot-reload: core plugin ${name} pre-registration failed: ${formatError(err)}`,
4583
- );
4584
- }
4585
- }
4586
- }
4587
-
4588
- await newRuntime.initialize();
4589
- await waitForTrajectoryLoggerService(
4590
- newRuntime,
4591
- "hot-reload runtime.initialize()",
4592
- );
4593
- ensureTrajectoryLoggerEnabled(
4594
- newRuntime,
4595
- "hot-reload runtime.initialize()",
4596
- );
4597
-
4598
- // Ensure AutonomyService survives hot-reload
4599
- if (!newRuntime.getService("AUTONOMY")) {
4600
- try {
4601
- await AutonomyService.start(newRuntime);
4602
- } catch (err) {
4603
- logger.warn(
4604
- `[milady] AutonomyService failed to start after hot-reload: ${formatError(err)}`,
4605
- );
4606
- }
4607
- }
4608
-
4609
- installActionAliases(newRuntime);
4610
- runtime = newRuntime;
4611
- logger.info("[milady] Hot-reload: Runtime restarted successfully");
4612
- return newRuntime;
4613
- } catch (err) {
4614
- logger.error(`[milady] Hot-reload failed: ${formatError(err)}`);
4615
- return null;
4616
- }
4617
- },
4618
- });
4619
- const dashboardUrl = `http://localhost:${actualApiPort}`;
4620
- console.log(`[milady] Control UI: ${dashboardUrl}`);
4621
- logger.info(`[milady] API server listening on ${dashboardUrl}`);
4622
- } catch (apiErr) {
4623
- // Log to both stderr (visible to Electrobun agent.ts) and the in-memory
4624
- // logger so the error is never silently swallowed in packaged builds.
4625
- const apiErrMsg = `[milady] Could not start API server: ${formatError(apiErr)}`;
4626
- console.error(apiErrMsg);
4627
- logger.warn(apiErrMsg);
4628
-
4629
- // In server-only mode (Electrobun desktop), a missing API server is fatal
4630
- // — nothing else can serve requests. Exit so the parent process sees a
4631
- // non-zero exit code instead of the misleading "Server running" message.
4632
- if (opts?.serverOnly) {
4633
- console.error(
4634
- "[milady] Exiting: API server is required in server-only mode.",
4635
- );
4636
- process.exit(1);
4637
- }
4638
- // Non-fatal in CLI mode — the interactive chat loop still works.
4639
- }
4640
-
4641
- // ── Server-only mode — keep running without chat loop ────────────────────
4642
- if (opts?.serverOnly) {
4643
- logger.info("[milady] Running in server-only mode (no interactive chat)");
4644
- console.log("[milady] Server running. Press Ctrl+C to stop.");
4645
-
4646
- // Keep process alive — the API server handles all interaction
4647
- const keepAlive = setInterval(() => {}, 1 << 30); // ~12 days
4648
-
4649
- // Cleanup on exit
4650
- const cleanup = async () => {
4651
- clearInterval(keepAlive);
4652
- try {
4653
- await shutdownRuntime(runtime, "server-only shutdown");
4654
- } catch (err) {
4655
- logger.warn(`[milady] Error stopping runtime: ${formatError(err)}`);
4656
- }
4657
- process.exit(0);
4658
- };
4659
-
4660
- process.on("SIGINT", () => void cleanup());
4661
- process.on("SIGTERM", () => void cleanup());
4662
-
4663
- return runtime;
4664
- }
4665
-
4666
- // ── Interactive chat loop ────────────────────────────────────────────────
4667
- const agentName = character.name ?? "Milady";
4668
- const userId = crypto.randomUUID() as UUID;
4669
- // Use `let` so the fallback path can reassign to fresh IDs.
4670
- let roomId = stringToUuid(`${agentName}-chat-room`);
4671
-
4672
- try {
4673
- const worldId = stringToUuid(`${agentName}-chat-world`);
4674
- // Use a deterministic messageServerId so the settings provider
4675
- // can reference the world by serverId after it is found.
4676
- const messageServerId = stringToUuid(`${agentName}-cli-server`) as UUID;
4677
- await runtime.ensureConnection({
4678
- entityId: userId,
4679
- roomId,
4680
- worldId,
4681
- userName: "User",
4682
- source: "cli",
4683
- channelId: `${agentName}-chat`,
4684
- type: ChannelType.DM,
4685
- messageServerId,
4686
- metadata: { ownership: { ownerId: userId } },
4687
- });
4688
- // Ensure the world has ownership metadata so the settings
4689
- // provider can locate it via findWorldsForOwner during onboarding.
4690
- // This also handles worlds that already exist from a prior session
4691
- // but were created without ownership metadata.
4692
- const world = await runtime.getWorld(worldId);
4693
- if (world) {
4694
- let needsUpdate = false;
4695
- if (!world.metadata) {
4696
- world.metadata = {};
4697
- needsUpdate = true;
4698
- }
4699
- if (
4700
- !world.metadata.ownership ||
4701
- typeof world.metadata.ownership !== "object" ||
4702
- (world.metadata.ownership as { ownerId: string }).ownerId !== userId
4703
- ) {
4704
- world.metadata.ownership = { ownerId: userId };
4705
- needsUpdate = true;
4706
- }
4707
- if (needsUpdate) {
4708
- await runtime.updateWorld(world);
4709
- }
4710
- }
4711
- } catch (err) {
4712
- logger.warn(
4713
- `[milady] Could not establish chat room, retrying with fresh IDs: ${formatError(err)}`,
4714
- );
4715
-
4716
- // Fall back to unique IDs if deterministic ones conflict with stale data.
4717
- // IMPORTANT: reassign roomId so the message loop below uses the same room.
4718
- roomId = crypto.randomUUID() as UUID;
4719
- const freshWorldId = crypto.randomUUID() as UUID;
4720
- const freshServerId = crypto.randomUUID() as UUID;
4721
- try {
4722
- await runtime.ensureConnection({
4723
- entityId: userId,
4724
- roomId,
4725
- worldId: freshWorldId,
4726
- userName: "User",
4727
- source: "cli",
4728
- channelId: `${agentName}-chat`,
4729
- type: ChannelType.DM,
4730
- messageServerId: freshServerId,
4731
- metadata: { ownership: { ownerId: userId } },
4732
- });
4733
- // Same ownership metadata fix for the fallback world.
4734
- const fallbackWorld = await runtime.getWorld(freshWorldId);
4735
- if (fallbackWorld) {
4736
- let needsUpdate = false;
4737
- if (!fallbackWorld.metadata) {
4738
- fallbackWorld.metadata = {};
4739
- needsUpdate = true;
4740
- }
4741
- if (
4742
- !fallbackWorld.metadata.ownership ||
4743
- typeof fallbackWorld.metadata.ownership !== "object" ||
4744
- (fallbackWorld.metadata.ownership as { ownerId: string }).ownerId !==
4745
- userId
4746
- ) {
4747
- fallbackWorld.metadata.ownership = { ownerId: userId };
4748
- needsUpdate = true;
4749
- }
4750
- if (needsUpdate) {
4751
- await runtime.updateWorld(fallbackWorld);
4752
- }
4753
- }
4754
- } catch (retryErr) {
4755
- logger.error(
4756
- `[milady] Chat room setup failed after retry: ${formatError(retryErr)}`,
4757
- );
4758
- throw retryErr;
4759
- }
4760
- }
4761
-
4762
- const rl = readline.createInterface({
4763
- input: process.stdin,
4764
- output: process.stdout,
4765
- });
4766
-
4767
- console.log(`\n💬 Chat with ${agentName} (type 'exit' to quit)\n`);
4768
-
4769
- const prompt = () => {
4770
- rl.question("You: ", async (input) => {
4771
- const text = input.trim();
4772
-
4773
- if (text.toLowerCase() === "exit" || text.toLowerCase() === "quit") {
4774
- console.log("\nGoodbye!");
4775
- rl.close();
4776
- try {
4777
- await shutdownRuntime(runtime, "cli shutdown");
4778
- } catch (err) {
4779
- logger.warn(`[milady] Error stopping runtime: ${formatError(err)}`);
4780
- }
4781
- process.exit(0);
4782
- }
4783
-
4784
- if (!text) {
4785
- prompt();
4786
- return;
4787
- }
4788
-
4789
- try {
4790
- const message = createMessageMemory({
4791
- id: crypto.randomUUID() as UUID,
4792
- entityId: userId,
4793
- roomId,
4794
- content: {
4795
- text,
4796
- source: "client_chat",
4797
- channelType: ChannelType.DM,
4798
- },
4799
- });
4800
-
4801
- process.stdout.write(`${agentName}: `);
4802
-
4803
- if (!runtime.messageService) {
4804
- logger.error(
4805
- "[milady] runtime.messageService is not available — cannot process messages",
4806
- );
4807
- console.log("[Error: message service unavailable]\n");
4808
- prompt();
4809
- return;
4810
- }
4811
-
4812
- await runtime.messageService.handleMessage(
4813
- runtime,
4814
- message,
4815
- async (content) => {
4816
- if (content?.text) {
4817
- process.stdout.write(content.text);
4818
- }
4819
- return [];
4820
- },
4821
- );
4822
-
4823
- console.log("\n");
4824
- } catch (err) {
4825
- // Log the error and continue the prompt loop — don't let a single
4826
- // failed message kill the interactive session.
4827
- console.log(`\n[Error: ${formatError(err)}]\n`);
4828
- logger.error(
4829
- `[milady] Chat message handling failed: ${formatError(err)}`,
4830
- );
4831
- }
4832
- prompt();
4833
- });
4834
- };
4835
-
4836
- prompt();
4837
- }
4838
-
4839
- // When run directly (not imported), start immediately.
4840
- // Use path.resolve to normalise both sides before comparing so that
4841
- // symlinks, trailing slashes, and relative paths don't cause false negatives.
4842
- // ---------------------------------------------------------------------------
4843
- // Cloud thin-client mode
4844
- // ---------------------------------------------------------------------------
4845
-
4846
- /**
4847
- * Start in cloud mode — connect to a remote cloud agent via the thin client.
4848
- * Skips all local runtime construction (plugins, database, etc.).
4849
- */
4850
- export async function startInCloudMode(
4851
- config: ElizaConfig,
4852
- agentId: string,
4853
- opts?: StartElizaOptions,
4854
- ): Promise<AgentRuntime | undefined> {
4855
- const { CloudManager } = await import("../cloud/cloud-manager");
4856
- const { normalizeCloudSiteUrl } = await import("../cloud/base-url");
4857
-
4858
- const cloudConfig = config.cloud!;
4859
- logger.info(
4860
- `[milady] Starting in cloud mode (agentId=${agentId}, baseUrl=${cloudConfig.baseUrl ?? "(default)"})`,
4861
- );
4862
-
4863
- const manager = new CloudManager(cloudConfig, {
4864
- onStatusChange: (status) => {
4865
- logger.info(`[milady] Cloud connection: ${status}`);
4866
- },
4867
- });
4868
-
4869
- try {
4870
- await manager.init();
4871
- const proxy = await manager.connect(agentId);
4872
-
4873
- if (opts?.headless || opts?.serverOnly) {
4874
- // In headless/server mode, start the API server with the cloud proxy.
4875
- // The proxy exposes the same interface the API server needs.
4876
- logger.info(
4877
- `[milady] Cloud agent connected (headless). Agent: ${proxy.agentName}`,
4878
- );
4879
- // Return undefined — the cloud proxy handles everything.
4880
- // TODO: Wire proxy into the API server for GUI mode.
4881
- return undefined;
4882
- }
4883
-
4884
- // Interactive CLI mode — simple chat loop against the cloud agent
4885
- console.log(
4886
- `\n☁️ Connected to cloud agent "${proxy.agentName}" (${agentId})\n`,
4887
- );
4888
- console.log("Type a message to chat, or Ctrl+C to quit.\n");
4889
-
4890
- const rl = (await import("node:readline")).createInterface({
4891
- input: process.stdin,
4892
- output: process.stdout,
4893
- });
4894
-
4895
- const prompt = () => {
4896
- rl.question("You: ", async (input) => {
4897
- const text = input.trim();
4898
- if (!text) {
4899
- prompt();
4900
- return;
4901
- }
4902
-
4903
- try {
4904
- // Use streaming if available
4905
- let response = "";
4906
- process.stdout.write(`${proxy.agentName}: `);
4907
- for await (const chunk of proxy.handleChatMessageStream(text)) {
4908
- process.stdout.write(chunk);
4909
- response += chunk;
4910
- }
4911
- if (!response) {
4912
- // Fallback to non-streaming
4913
- response = await proxy.handleChatMessage(text);
4914
- process.stdout.write(response);
4915
- }
4916
- console.log("\n");
4917
- } catch (err) {
4918
- const msg = err instanceof Error ? err.message : String(err);
4919
- console.error(`\n[error] ${msg}\n`);
4920
- }
4921
-
4922
- prompt();
4923
- });
4924
- };
4925
-
4926
- rl.on("close", async () => {
4927
- console.log("\nDisconnecting from cloud agent...");
4928
- await manager.disconnect();
4929
- process.exit(0);
4930
- });
4931
-
4932
- prompt();
4933
-
4934
- // Keep the process alive
4935
- return undefined;
4936
- } catch (err) {
4937
- const msg = err instanceof Error ? err.message : String(err);
4938
- logger.error(`[milady] Failed to connect to cloud agent: ${msg}`);
4939
- throw new Error(
4940
- `Failed to connect to cloud agent: ${msg}\n` +
4941
- "You can retry with `milady start`, or switch to local mode with `milady config set cloud.runtime local`",
4942
- );
4943
- }
4944
- }
4945
-
4946
- const isDirectRun = (() => {
4947
- const scriptArg = process.argv[1];
4948
- if (!scriptArg) return false;
4949
- const normalised = path.resolve(scriptArg);
4950
- // Exact match against this module's file URL
4951
- if (import.meta.url === pathToFileURL(normalised).href) return true;
4952
- // Fallback: match the specific filename (handles tsx rewriting)
4953
- const base = path.basename(normalised);
4954
- return base === "eliza.ts" || base === "eliza";
4955
- })();
4956
-
4957
- if (isDirectRun) {
4958
- startEliza().catch((err) => {
4959
- console.error(
4960
- "[milady] Fatal error:",
4961
- err instanceof Error ? (err.stack ?? err.message) : err,
4962
- );
4963
- process.exit(1);
4964
- });
4965
- }