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

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