@elizaos/ui 2.0.0-alpha.526 → 2.0.0-alpha.528

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 (237) hide show
  1. package/apps/app-elizamaker/src/index.d.ts +2 -0
  2. package/apps/app-elizamaker/src/index.d.ts.map +1 -1
  3. package/apps/app-elizamaker/src/index.js +2 -0
  4. package/apps/app-elizamaker/src/init-registry-services.d.ts +18 -0
  5. package/apps/app-elizamaker/src/init-registry-services.d.ts.map +1 -0
  6. package/apps/app-elizamaker/src/init-registry-services.js +63 -0
  7. package/apps/app-elizamaker/src/plugin.d.ts.map +1 -1
  8. package/apps/app-elizamaker/src/plugin.js +7 -0
  9. package/apps/app-elizamaker/src/registry-service-registry.d.ts +4 -0
  10. package/apps/app-elizamaker/src/registry-service-registry.d.ts.map +1 -0
  11. package/apps/app-elizamaker/src/registry-service-registry.js +7 -0
  12. package/apps/app-lifeops/src/automation-node-contributor.d.ts +2 -0
  13. package/apps/app-lifeops/src/automation-node-contributor.d.ts.map +1 -0
  14. package/apps/app-lifeops/src/automation-node-contributor.js +93 -0
  15. package/apps/app-lifeops/src/public.d.ts.map +1 -1
  16. package/apps/app-lifeops/src/public.js +2 -0
  17. package/apps/app-training/src/services/training-service-registry.d.ts +4 -0
  18. package/apps/app-training/src/services/training-service-registry.d.ts.map +1 -0
  19. package/apps/app-training/src/services/training-service-registry.js +7 -0
  20. package/package.json +1 -1
  21. package/packages/agent/src/api/agent-status-routes.d.ts +3 -23
  22. package/packages/agent/src/api/agent-status-routes.d.ts.map +1 -1
  23. package/packages/agent/src/api/agent-status-routes.js +7 -40
  24. package/packages/agent/src/api/coordinator-wiring.d.ts.map +1 -0
  25. package/packages/agent/src/api/misc-routes.d.ts.map +1 -1
  26. package/packages/agent/src/api/misc-routes.js +3 -37
  27. package/packages/agent/src/api/nfa-routes.d.ts.map +1 -1
  28. package/packages/agent/src/api/nfa-routes.js +1 -9
  29. package/packages/agent/src/api/provider-switch-routes.d.ts +8 -7
  30. package/packages/agent/src/api/provider-switch-routes.d.ts.map +1 -1
  31. package/packages/agent/src/api/provider-switch-routes.js +41 -26
  32. package/packages/agent/src/api/server-types.d.ts +0 -6
  33. package/packages/agent/src/api/server-types.d.ts.map +1 -1
  34. package/packages/agent/src/api/server.d.ts.map +1 -1
  35. package/packages/agent/src/api/server.js +31 -138
  36. package/packages/agent/src/api/stream-routes.d.ts.map +1 -1
  37. package/packages/agent/src/api/stream-routes.js +6 -8
  38. package/packages/agent/src/api/wallet-trading-profile.d.ts.map +1 -1
  39. package/packages/agent/src/api/wallet-trading-profile.js +2 -23
  40. package/packages/agent/src/auth/account-storage.d.ts.map +1 -1
  41. package/packages/agent/src/auth/account-storage.js +4 -15
  42. package/packages/agent/src/runtime/eliza.d.ts.map +1 -1
  43. package/packages/agent/src/runtime/eliza.js +2 -6
  44. package/packages/agent/src/runtime/first-time-setup.d.ts.map +1 -1
  45. package/packages/agent/src/runtime/first-time-setup.js +1 -7
  46. package/packages/agent/src/runtime/operations/cold-strategy.d.ts +4 -4
  47. package/packages/agent/src/runtime/operations/cold-strategy.d.ts.map +1 -1
  48. package/packages/agent/src/runtime/operations/cold-strategy.js +13 -46
  49. package/packages/agent/src/runtime/operations/health-checks.d.ts +1 -0
  50. package/packages/agent/src/runtime/operations/health-checks.d.ts.map +1 -1
  51. package/packages/agent/src/runtime/operations/health-checks.js +1 -1
  52. package/packages/agent/src/runtime/operations/health.d.ts.map +1 -1
  53. package/packages/agent/src/runtime/operations/health.js +1 -13
  54. package/packages/agent/src/runtime/operations/index.d.ts +1 -0
  55. package/packages/agent/src/runtime/operations/index.d.ts.map +1 -1
  56. package/packages/agent/src/runtime/operations/index.js +1 -0
  57. package/packages/agent/src/runtime/operations/manager.d.ts +2 -0
  58. package/packages/agent/src/runtime/operations/manager.d.ts.map +1 -1
  59. package/packages/agent/src/runtime/operations/manager.js +27 -7
  60. package/packages/agent/src/runtime/operations/reload-hot.d.ts +4 -1
  61. package/packages/agent/src/runtime/operations/reload-hot.d.ts.map +1 -1
  62. package/packages/agent/src/runtime/operations/reload-hot.js +46 -41
  63. package/packages/agent/src/runtime/operations/repository.d.ts +30 -8
  64. package/packages/agent/src/runtime/operations/repository.d.ts.map +1 -1
  65. package/packages/agent/src/runtime/operations/repository.js +140 -54
  66. package/packages/agent/src/runtime/operations/types.d.ts +26 -24
  67. package/packages/agent/src/runtime/operations/types.d.ts.map +1 -1
  68. package/packages/agent/src/runtime/operations/types.js +8 -20
  69. package/packages/agent/src/runtime/operations/vault-bridge.d.ts +60 -0
  70. package/packages/agent/src/runtime/operations/vault-bridge.d.ts.map +1 -0
  71. package/packages/agent/src/runtime/operations/vault-bridge.js +80 -0
  72. package/packages/agent/src/runtime/plugin-resolver.d.ts.map +1 -1
  73. package/packages/agent/src/runtime/plugin-resolver.js +1 -3
  74. package/packages/agent/src/runtime/plugin-types.d.ts.map +1 -1
  75. package/packages/agent/src/runtime/plugin-types.js +1 -3
  76. package/packages/agent/src/services/app-package-modules.d.ts.map +1 -1
  77. package/packages/agent/src/services/app-package-modules.js +1 -8
  78. package/packages/agent/src/services/app-run-store.d.ts.map +1 -1
  79. package/packages/agent/src/services/app-run-store.js +2 -23
  80. package/packages/agent/src/services/registry-client-local.d.ts.map +1 -1
  81. package/packages/agent/src/services/registry-client-local.js +1 -9
  82. package/packages/agent/src/utils/atomic-json.d.ts +37 -0
  83. package/packages/agent/src/utils/atomic-json.d.ts.map +1 -0
  84. package/packages/agent/src/utils/atomic-json.js +98 -0
  85. package/packages/app-core/src/api/automation-node-contributors.d.ts +14 -0
  86. package/packages/app-core/src/api/automation-node-contributors.d.ts.map +1 -0
  87. package/packages/app-core/src/api/automation-node-contributors.js +14 -0
  88. package/packages/app-core/src/api/client-agent.d.ts +627 -0
  89. package/packages/app-core/src/api/client-agent.d.ts.map +1 -0
  90. package/packages/app-core/src/api/client-agent.js +1442 -0
  91. package/packages/app-core/src/api/client-automations.d.ts +8 -0
  92. package/packages/app-core/src/api/client-automations.d.ts.map +1 -0
  93. package/packages/app-core/src/api/client-automations.js +7 -0
  94. package/packages/app-core/src/api/client-base.d.ts +82 -0
  95. package/packages/app-core/src/api/client-base.d.ts.map +1 -0
  96. package/packages/app-core/src/api/client-base.js +729 -0
  97. package/packages/app-core/src/api/client-browser-workspace.d.ts +25 -0
  98. package/packages/app-core/src/api/client-browser-workspace.d.ts.map +1 -0
  99. package/packages/app-core/src/api/client-browser-workspace.js +98 -0
  100. package/packages/app-core/src/api/client-chat.d.ts +355 -0
  101. package/packages/app-core/src/api/client-chat.d.ts.map +1 -0
  102. package/packages/app-core/src/api/client-chat.js +582 -0
  103. package/packages/app-core/src/api/client-cloud.d.ts +286 -0
  104. package/packages/app-core/src/api/client-cloud.d.ts.map +1 -0
  105. package/packages/app-core/src/api/client-cloud.js +410 -0
  106. package/packages/app-core/src/api/client-computeruse.d.ts +32 -0
  107. package/packages/app-core/src/api/client-computeruse.d.ts.map +1 -0
  108. package/packages/app-core/src/api/client-computeruse.js +16 -0
  109. package/packages/app-core/src/api/client-imessage.d.ts +68 -0
  110. package/packages/app-core/src/api/client-imessage.d.ts.map +1 -0
  111. package/packages/app-core/src/api/client-imessage.js +74 -0
  112. package/packages/app-core/src/api/client-local-inference.d.ts +62 -0
  113. package/packages/app-core/src/api/client-local-inference.d.ts.map +1 -0
  114. package/packages/app-core/src/api/client-local-inference.js +87 -0
  115. package/packages/app-core/src/api/client-n8n.d.ts +27 -0
  116. package/packages/app-core/src/api/client-n8n.d.ts.map +1 -0
  117. package/packages/app-core/src/api/client-n8n.js +61 -0
  118. package/packages/app-core/src/api/client-skills.d.ts +475 -0
  119. package/packages/app-core/src/api/client-skills.d.ts.map +1 -0
  120. package/packages/app-core/src/api/client-skills.js +608 -0
  121. package/packages/app-core/src/api/client-types-babylon.d.ts +254 -0
  122. package/packages/app-core/src/api/client-types-babylon.d.ts.map +1 -0
  123. package/packages/app-core/src/api/client-types-babylon.js +2 -0
  124. package/packages/app-core/src/api/client-types-character.d.ts +39 -0
  125. package/packages/app-core/src/api/client-types-character.d.ts.map +1 -0
  126. package/packages/app-core/src/api/client-types-character.js +1 -0
  127. package/packages/app-core/src/api/client-types-chat.d.ts +428 -0
  128. package/packages/app-core/src/api/client-types-chat.d.ts.map +1 -0
  129. package/packages/app-core/src/api/client-types-chat.js +9 -0
  130. package/packages/app-core/src/api/client-types-config.d.ts +587 -0
  131. package/packages/app-core/src/api/client-types-config.d.ts.map +1 -0
  132. package/packages/app-core/src/api/client-types-config.js +5 -0
  133. package/packages/app-core/src/api/client-types-experience.d.ts +97 -0
  134. package/packages/app-core/src/api/client-types-experience.d.ts.map +1 -0
  135. package/packages/app-core/src/api/client-types-experience.js +1 -0
  136. package/packages/app-core/src/api/client-types-relationships.d.ts +181 -0
  137. package/packages/app-core/src/api/client-types-relationships.d.ts.map +1 -0
  138. package/packages/app-core/src/api/client-types-relationships.js +1 -0
  139. package/packages/app-core/src/api/client-types-steward.d.ts +85 -0
  140. package/packages/app-core/src/api/client-types-steward.d.ts.map +1 -0
  141. package/packages/app-core/src/api/client-types-steward.js +9 -0
  142. package/packages/app-core/src/api/client-types.d.ts +9 -0
  143. package/packages/app-core/src/api/client-types.d.ts.map +1 -0
  144. package/packages/app-core/src/api/client-types.js +12 -0
  145. package/packages/app-core/src/api/client-wallet.d.ts +130 -0
  146. package/packages/app-core/src/api/client-wallet.d.ts.map +1 -0
  147. package/packages/app-core/src/api/client-wallet.js +228 -0
  148. package/packages/app-core/src/api/client.d.ts +36 -0
  149. package/packages/app-core/src/api/client.d.ts.map +1 -0
  150. package/packages/app-core/src/api/client.js +36 -0
  151. package/packages/app-core/src/api/index.d.ts +2 -0
  152. package/packages/app-core/src/api/index.d.ts.map +1 -0
  153. package/packages/app-core/src/api/index.js +1 -0
  154. package/packages/app-core/src/bridge/electrobun-rpc.d.ts +57 -0
  155. package/packages/app-core/src/bridge/electrobun-rpc.d.ts.map +1 -0
  156. package/packages/app-core/src/bridge/electrobun-rpc.js +87 -0
  157. package/packages/app-core/src/bridge/electrobun-runtime.d.ts +3 -0
  158. package/packages/app-core/src/bridge/electrobun-runtime.d.ts.map +1 -0
  159. package/packages/app-core/src/bridge/electrobun-runtime.js +34 -0
  160. package/packages/app-core/src/bridge/native-plugins.d.ts +504 -0
  161. package/packages/app-core/src/bridge/native-plugins.d.ts.map +1 -0
  162. package/packages/app-core/src/bridge/native-plugins.js +67 -0
  163. package/packages/app-core/src/chat/coding-agent-session-state.d.ts +16 -0
  164. package/packages/app-core/src/chat/coding-agent-session-state.d.ts.map +1 -0
  165. package/packages/app-core/src/chat/coding-agent-session-state.js +27 -0
  166. package/packages/app-core/src/components/pages/browser-workspace-wallet.d.ts +80 -0
  167. package/packages/app-core/src/components/pages/browser-workspace-wallet.d.ts.map +1 -0
  168. package/packages/app-core/src/components/pages/browser-workspace-wallet.js +135 -0
  169. package/packages/app-core/src/services/account-pool.d.ts +98 -0
  170. package/packages/app-core/src/services/account-pool.d.ts.map +1 -0
  171. package/packages/app-core/src/services/account-pool.js +506 -0
  172. package/packages/app-core/src/services/account-usage.d.ts +75 -0
  173. package/packages/app-core/src/services/account-usage.d.ts.map +1 -0
  174. package/packages/app-core/src/services/account-usage.js +179 -0
  175. package/packages/app-core/src/services/local-inference/active-model.d.ts +59 -0
  176. package/packages/app-core/src/services/local-inference/active-model.d.ts.map +1 -0
  177. package/packages/app-core/src/services/local-inference/active-model.js +120 -0
  178. package/packages/app-core/src/services/local-inference/device-bridge.d.ts +131 -0
  179. package/packages/app-core/src/services/local-inference/device-bridge.d.ts.map +1 -0
  180. package/packages/app-core/src/services/local-inference/device-bridge.js +748 -0
  181. package/packages/app-core/src/services/local-inference/engine.d.ts +52 -0
  182. package/packages/app-core/src/services/local-inference/engine.d.ts.map +1 -0
  183. package/packages/app-core/src/services/local-inference/engine.js +138 -0
  184. package/packages/app-core/src/services/local-inference/external-scanner.d.ts +17 -0
  185. package/packages/app-core/src/services/local-inference/external-scanner.d.ts.map +1 -0
  186. package/packages/app-core/src/services/local-inference/external-scanner.js +261 -0
  187. package/packages/app-core/src/services/local-inference/handler-registry.d.ts +72 -0
  188. package/packages/app-core/src/services/local-inference/handler-registry.d.ts.map +1 -0
  189. package/packages/app-core/src/services/local-inference/handler-registry.js +160 -0
  190. package/packages/app-core/src/services/local-inference/paths.d.ts +24 -0
  191. package/packages/app-core/src/services/local-inference/paths.d.ts.map +1 -0
  192. package/packages/app-core/src/services/local-inference/paths.js +41 -0
  193. package/packages/app-core/src/services/local-inference/providers.d.ts +61 -0
  194. package/packages/app-core/src/services/local-inference/providers.d.ts.map +1 -0
  195. package/packages/app-core/src/services/local-inference/providers.js +277 -0
  196. package/packages/app-core/src/services/local-inference/registry.d.ts +35 -0
  197. package/packages/app-core/src/services/local-inference/registry.d.ts.map +1 -0
  198. package/packages/app-core/src/services/local-inference/registry.js +108 -0
  199. package/packages/app-core/src/services/local-inference/routing-preferences.d.ts +31 -0
  200. package/packages/app-core/src/services/local-inference/routing-preferences.d.ts.map +1 -0
  201. package/packages/app-core/src/services/local-inference/routing-preferences.js +72 -0
  202. package/packages/app-core/src/services/local-inference/types.d.ts +121 -0
  203. package/packages/app-core/src/services/local-inference/types.d.ts.map +1 -0
  204. package/packages/app-core/src/services/local-inference/types.js +14 -0
  205. package/packages/app-core/src/services/local-inference/verify.d.ts +39 -0
  206. package/packages/app-core/src/services/local-inference/verify.d.ts.map +1 -0
  207. package/packages/app-core/src/services/local-inference/verify.js +104 -0
  208. package/packages/app-core/src/types/index.d.ts +658 -0
  209. package/packages/app-core/src/types/index.d.ts.map +1 -0
  210. package/packages/app-core/src/types/index.js +4 -0
  211. package/packages/app-core/src/utils/assistant-text.d.ts +2 -0
  212. package/packages/app-core/src/utils/assistant-text.d.ts.map +1 -0
  213. package/packages/app-core/src/utils/assistant-text.js +167 -0
  214. package/packages/app-core/src/utils/eliza-globals.d.ts +15 -0
  215. package/packages/app-core/src/utils/eliza-globals.d.ts.map +1 -0
  216. package/packages/app-core/src/utils/eliza-globals.js +50 -0
  217. package/packages/app-core/src/utils/streaming-text.d.ts +9 -0
  218. package/packages/app-core/src/utils/streaming-text.d.ts.map +1 -0
  219. package/packages/app-core/src/utils/streaming-text.js +112 -0
  220. package/packages/shared/src/format-error.d.ts +14 -0
  221. package/packages/shared/src/format-error.d.ts.map +1 -0
  222. package/packages/shared/src/format-error.js +17 -0
  223. package/packages/shared/src/index.d.ts +1 -0
  224. package/packages/shared/src/index.d.ts.map +1 -1
  225. package/packages/shared/src/index.js +1 -0
  226. package/packages/typescript/src/runtime.d.ts +14 -0
  227. package/packages/typescript/src/runtime.d.ts.map +1 -1
  228. package/packages/typescript/src/runtime.js +42 -0
  229. package/packages/typescript/src/services/message.d.ts +8 -0
  230. package/packages/typescript/src/services/message.d.ts.map +1 -1
  231. package/packages/typescript/src/services/message.js +51 -0
  232. package/packages/typescript/src/services/task.d.ts +1 -0
  233. package/packages/typescript/src/services/task.d.ts.map +1 -1
  234. package/packages/typescript/src/services/task.js +26 -3
  235. package/apps/app-task-coordinator/src/api/coordinator-wiring.d.ts.map +0 -1
  236. /package/{apps/app-task-coordinator → packages/agent}/src/api/coordinator-wiring.d.ts +0 -0
  237. /package/{apps/app-task-coordinator → packages/agent}/src/api/coordinator-wiring.js +0 -0
@@ -13,6 +13,7 @@ import fs from "node:fs";
13
13
  import os from "node:os";
14
14
  import path from "node:path";
15
15
  import { logger } from "@elizaos/core";
16
+ import { writeJsonAtomicSync } from "../utils/atomic-json.js";
16
17
  function authRoot() {
17
18
  return path.join(process.env.ELIZA_HOME || path.join(os.homedir(), ".eliza"), "auth");
18
19
  }
@@ -31,18 +32,6 @@ function ensureProviderDir(provider) {
31
32
  fs.mkdirSync(dir, { recursive: true, mode: 0o700 });
32
33
  }
33
34
  }
34
- function atomicWriteJsonSync(filePath, value) {
35
- const dir = path.dirname(filePath);
36
- if (!fs.existsSync(dir)) {
37
- fs.mkdirSync(dir, { recursive: true, mode: 0o700 });
38
- }
39
- const tmp = `${filePath}.tmp`;
40
- fs.writeFileSync(tmp, JSON.stringify(value, null, 2), {
41
- encoding: "utf-8",
42
- mode: 0o600,
43
- });
44
- fs.renameSync(tmp, filePath);
45
- }
46
35
  function isAccountCredentialRecord(value) {
47
36
  if (!value || typeof value !== "object")
48
37
  return false;
@@ -99,7 +88,7 @@ function migrateProvider(provider) {
99
88
  updatedAt: typeof parsed.updatedAt === "number" ? parsed.updatedAt : now,
100
89
  };
101
90
  ensureProviderDir(provider);
102
- atomicWriteJsonSync(accountFile(provider, "default"), record);
91
+ writeJsonAtomicSync(accountFile(provider, "default"), record);
103
92
  // Atomic-ish delete: rename to a side path first so a concurrent
104
93
  // reader sees either the legacy file or nothing — then unlink.
105
94
  const removed = `${legacy}.migrated-${now}`;
@@ -211,7 +200,7 @@ export function saveAccount(record) {
211
200
  ...record,
212
201
  updatedAt: Date.now(),
213
202
  };
214
- atomicWriteJsonSync(accountFile(record.providerId, record.id), next);
203
+ writeJsonAtomicSync(accountFile(record.providerId, record.id), next);
215
204
  logger.info(`[auth] Saved ${record.providerId} account "${record.id}" (label="${record.label}")`);
216
205
  }
217
206
  export function deleteAccount(provider, accountId) {
@@ -234,5 +223,5 @@ export function touchAccount(provider, accountId) {
234
223
  ...existing,
235
224
  lastUsedAt: Date.now(),
236
225
  };
237
- atomicWriteJsonSync(accountFile(provider, accountId), next);
226
+ writeJsonAtomicSync(accountFile(provider, accountId), next);
238
227
  }
@@ -1 +1 @@
1
- {"version":3,"file":"eliza.d.ts","sourceRoot":"","sources":["../../../../../../agent/src/runtime/eliza.ts"],"names":[],"mappings":"AA8BA,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,uBAAuB,CAAC;AAO/B,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,EACvB,6BAA6B,EAC7B,uBAAuB,EACvB,kBAAkB,EAClB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,yBAA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IACnB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC;AAED,MAAM,WAAW,uBAAuB;IACtC;;;;OAIG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,GAAE,uBAA4B,GACjC,OAAO,CAAC,YAAY,CAAC,CAYvB;AAcD,eAAO,MAAM,iBAAiB,GAAI,OAAO,QAAQ,SAiChD,CAAC;AAEF;;;;;GAKG;AACH,wBAAsB,UAAU,CAC9B,IAAI,CAAC,EAAE,iBAAiB,GACvB,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC,CAq8CnC;AASD;;;GAGG;AACH,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE,iBAAiB,GACvB,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC,CA8FnC"}
1
+ {"version":3,"file":"eliza.d.ts","sourceRoot":"","sources":["../../../../../../agent/src/runtime/eliza.ts"],"names":[],"mappings":"AA8BA,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,uBAAuB,CAAC;AAO/B,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,EACvB,6BAA6B,EAC7B,uBAAuB,EACvB,kBAAkB,EAClB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,yBAAyB,EACzB,iCAAiC,EACjC,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,+BAA+B,GAChC,MAAM,mBAAmB,CAAC;AAiB3B,OAAO,EACL,YAAY,EASZ,KAAK,QAAQ,EAIb,KAAK,MAAM,EAKZ,MAAM,eAAe,CAAC;AA2BvB,OAAO,EAEL,KAAK,WAAW,EAEjB,MAAM,qBAAqB,CAAC;AAuB7B,OAAO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O,CAAC,YAAY,CAAC,CAYvB;AAcD,eAAO,MAAM,iBAAiB,GAAI,OAAO,QAAQ,SAiChD,CAAC;AAEF;;;;;GAKG;AACH,wBAAsB,UAAU,CAC9B,IAAI,CAAC,EAAE,iBAAiB,GACvB,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC,CAq8CnC;AASD;;;GAGG;AACH,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE,iBAAiB,GACvB,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC,CA8FnC"}
@@ -46,7 +46,7 @@ import * as pluginAgentSkills from "@elizaos/plugin-agent-skills";
46
46
  import * as pluginBrowserBridge from "@elizaos/plugin-browser-bridge";
47
47
  import * as pluginPdf from "@elizaos/plugin-pdf";
48
48
  import * as pluginSql from "@elizaos/plugin-sql";
49
- import { getDefaultStylePreset, getOnboardingProviderOption, isElizaSettingsDebugEnabled, migrateLegacyRuntimeConfig, normalizeCharacterLanguage, normalizeOnboardingProviderId, resolveDeploymentTargetInConfig, resolveElizaCloudTopology, resolveServerOnlyPort, resolveServiceRoutingInConfig, resolveStylePresetByAvatarIndex, resolveStylePresetById, resolveStylePresetByName, settingsDebugCloudSummary, } from "@elizaos/shared";
49
+ import { formatError, getDefaultStylePreset, getOnboardingProviderOption, isElizaSettingsDebugEnabled, migrateLegacyRuntimeConfig, normalizeCharacterLanguage, normalizeOnboardingProviderId, resolveDeploymentTargetInConfig, resolveElizaCloudTopology, resolveServerOnlyPort, resolveServiceRoutingInConfig, resolveStylePresetByAvatarIndex, resolveStylePresetById, resolveStylePresetByName, settingsDebugCloudSummary, } from "@elizaos/shared";
50
50
  import { debugLogResolvedContext, validateRuntimeContext, } from "../api/plugin-validation.js";
51
51
  import { getWalletAddresses, syncSolanaPublicKeyEnv } from "../api/wallet.js";
52
52
  import { configFileExists, loadElizaConfig, } from "../config/config.js";
@@ -391,10 +391,6 @@ export function configureLocalEmbeddingPlugin(_plugin, config) {
391
391
  // ---------------------------------------------------------------------------
392
392
  // Helpers
393
393
  // ---------------------------------------------------------------------------
394
- /** Extract a human-readable error message from an unknown thrown value. */
395
- function formatError(err) {
396
- return err instanceof Error ? err.message : String(err);
397
- }
398
394
  function trimEnvString(value) {
399
395
  if (typeof value !== "string")
400
396
  return undefined;
@@ -2975,7 +2971,7 @@ export async function startEliza(opts) {
2975
2971
  // per-session timeout (up to ~5s). runtime.stop() awaits every
2976
2972
  // service.stop() sequentially, so a single idle PTY session
2977
2973
  // turns a provider switch into a multi-second block. During
2978
- // that window server.ts's providerSwitchInProgress flag +
2974
+ // that window the runtime-operations active-op slot +
2979
2975
  // agentState === "restarting" guard reject further clicks,
2980
2976
  // which is why flipping through providers rapidly feels stuck.
2981
2977
  //
@@ -1 +1 @@
1
- {"version":3,"file":"first-time-setup.d.ts","sourceRoot":"","sources":["../../../../../../agent/src/runtime/first-time-setup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAUH,OAAO,EAAE,KAAK,WAAW,EAAmB,MAAM,qBAAqB,CAAC;AAmBxE,KAAK,yBAAyB,GAC5B,OAAO,uBAAuB,EAAE,qBAAqB,CAAC;AAGxD,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,WAAW,EACnB,IAAI,EAAE;IACJ,cAAc,EAAE,OAAO,CAAC;IACxB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,qBAAqB,CAAC,EAAE,yBAAyB,GAAG,IAAI,CAAC;IACzD,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B,GACA,WAAW,CA4Db;AAyFD;;;;;;;;;;;;;GAaG;AACH,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAqC1E;AAMD,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,WAAW,CAAC,CAmiBtB"}
1
+ {"version":3,"file":"first-time-setup.d.ts","sourceRoot":"","sources":["../../../../../../agent/src/runtime/first-time-setup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAUH,OAAO,EAAE,KAAK,WAAW,EAAmB,MAAM,qBAAqB,CAAC;AAexE,KAAK,yBAAyB,GAC5B,OAAO,uBAAuB,EAAE,qBAAqB,CAAC;AAGxD,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,WAAW,EACnB,IAAI,EAAE;IACJ,cAAc,EAAE,OAAO,CAAC;IACxB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,qBAAqB,CAAC,EAAE,yBAAyB,GAAG,IAAI,CAAC;IACzD,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B,GACA,WAAW,CA4Db;AAyFD;;;;;;;;;;;;;GAaG;AACH,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAqC1E;AAMD,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,WAAW,CAAC,CAmiBtB"}
@@ -18,7 +18,7 @@
18
18
  *
19
19
  * @module first-time-setup
20
20
  */
21
- import { getStylePresets } from "@elizaos/shared";
21
+ import { formatError, getStylePresets } from "@elizaos/shared";
22
22
  import { persistConfigEnv } from "../api/config-env.js";
23
23
  import { CLOUD_EVM_ADDRESS_ENV_KEY, CLOUD_SOLANA_ADDRESS_ENV_KEY, WALLET_SOURCE_EVM_ENV_KEY, WALLET_SOURCE_SOLANA_ENV_KEY, } from "../api/wallet.js";
24
24
  import { saveElizaConfig } from "../config/config.js";
@@ -26,12 +26,6 @@ import { isCloudWalletEnabled } from "../config/feature-flags.js";
26
26
  import { migrateLegacyRuntimeConfig } from "../contracts/onboarding.js";
27
27
  import { buildDefaultElizaCloudServiceRouting, buildElizaCloudServiceRoute, } from "../contracts/service-routing.js";
28
28
  import { pickRandomNames } from "./onboarding-names.js";
29
- // ---------------------------------------------------------------------------
30
- // Helpers (private)
31
- // ---------------------------------------------------------------------------
32
- function formatError(err) {
33
- return err instanceof Error ? err.message : String(err);
34
- }
35
29
  const DEFAULT_ONBOARDING_AGENT_NAME = getStylePresets()[0]?.name ?? "Eliza";
36
30
  export function applyFirstTimeSetupTopology(config, args) {
37
31
  const linkedAccounts = {
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * Cold reload strategy — full runtime swap.
3
3
  *
4
- * Phase 1: delegates to the existing `restartRuntime` closure injected by
5
- * the API server. Reports phase boundaries (`shutdown-old`, `start-new`,
6
- * `swap`) from the manager's perspective; `restartRuntime` itself is
7
- * opaque, so the inner phases are recorded as a single bracketed step.
4
+ * Delegates to the `restartRuntime` closure injected by the API server.
5
+ * The closure is opaque (it owns shutdown + boot + state swap), so the
6
+ * strategy reports a single terminal `cold-restart` phase rather than
7
+ * synthetic timestamp-only sub-phases.
8
8
  */
9
9
  import type { AgentRuntime } from "@elizaos/core";
10
10
  import type { ReloadStrategy } from "./types.js";
@@ -1 +1 @@
1
- {"version":3,"file":"cold-strategy.d.ts","sourceRoot":"","sources":["../../../../../../../agent/src/runtime/operations/cold-strategy.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,KAAK,EAAiB,cAAc,EAAE,MAAM,YAAY,CAAC;AAEhE,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,cAAc,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;CAClE;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,mBAAmB,GAAG,cAAc,CAqE5E"}
1
+ {"version":3,"file":"cold-strategy.d.ts","sourceRoot":"","sources":["../../../../../../../agent/src/runtime/operations/cold-strategy.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,KAAK,EAGV,cAAc,EACf,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,cAAc,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;CAClE;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,mBAAmB,GAAG,cAAc,CA+B5E"}
@@ -1,67 +1,34 @@
1
1
  /**
2
2
  * Cold reload strategy — full runtime swap.
3
3
  *
4
- * Phase 1: delegates to the existing `restartRuntime` closure injected by
5
- * the API server. Reports phase boundaries (`shutdown-old`, `start-new`,
6
- * `swap`) from the manager's perspective; `restartRuntime` itself is
7
- * opaque, so the inner phases are recorded as a single bracketed step.
4
+ * Delegates to the `restartRuntime` closure injected by the API server.
5
+ * The closure is opaque (it owns shutdown + boot + state swap), so the
6
+ * strategy reports a single terminal `cold-restart` phase rather than
7
+ * synthetic timestamp-only sub-phases.
8
8
  */
9
9
  export function createColdStrategy(opts) {
10
10
  const { restartRuntime } = opts;
11
11
  return {
12
12
  tier: "cold",
13
13
  async apply(ctx) {
14
- const reason = describeIntent(ctx.intent);
15
- const shutdownStart = Date.now();
16
- await ctx.reportPhase({
17
- name: "shutdown-old",
18
- status: "running",
19
- startedAt: shutdownStart,
20
- });
21
- const startNewStart = Date.now();
22
- await ctx.reportPhase({
23
- name: "shutdown-old",
24
- status: "succeeded",
25
- startedAt: shutdownStart,
26
- finishedAt: startNewStart,
27
- });
28
- await ctx.reportPhase({
29
- name: "start-new",
30
- status: "running",
31
- startedAt: startNewStart,
32
- });
33
- const newRuntime = await restartRuntime(reason);
34
- const startNewEnd = Date.now();
14
+ const startedAt = Date.now();
15
+ const newRuntime = await restartRuntime(describeIntent(ctx.intent));
16
+ const finishedAt = Date.now();
35
17
  if (!newRuntime) {
36
18
  await ctx.reportPhase({
37
- name: "start-new",
19
+ name: "cold-restart",
38
20
  status: "failed",
39
- startedAt: startNewStart,
40
- finishedAt: startNewEnd,
21
+ startedAt,
22
+ finishedAt,
41
23
  error: { message: "Cold restart returned null runtime" },
42
24
  });
43
25
  throw new Error("Cold restart returned null runtime");
44
26
  }
45
27
  await ctx.reportPhase({
46
- name: "start-new",
47
- status: "succeeded",
48
- startedAt: startNewStart,
49
- finishedAt: startNewEnd,
50
- });
51
- const swapStart = startNewEnd;
52
- await ctx.reportPhase({
53
- name: "swap",
54
- status: "running",
55
- startedAt: swapStart,
56
- });
57
- // The actual swap into server.ts state is owned by `restartRuntime`'s
58
- // closure; from the strategy's perspective, the moment we've received
59
- // a non-null runtime back the swap has happened.
60
- await ctx.reportPhase({
61
- name: "swap",
28
+ name: "cold-restart",
62
29
  status: "succeeded",
63
- startedAt: swapStart,
64
- finishedAt: Date.now(),
30
+ startedAt,
31
+ finishedAt,
65
32
  });
66
33
  return newRuntime;
67
34
  },
@@ -12,6 +12,7 @@
12
12
  * - Treat real failures (DB ping false, provider unreachable) as failures.
13
13
  */
14
14
  import type { HealthCheck } from "./types.js";
15
+ export declare function describeError(err: unknown): string;
15
16
  export declare const runtimeReadyCheck: HealthCheck;
16
17
  export declare const essentialServicesCheck: HealthCheck;
17
18
  export declare const dbConnectionCheck: HealthCheck;
@@ -1 +1 @@
1
- {"version":3,"file":"health-checks.d.ts","sourceRoot":"","sources":["../../../../../../../agent/src/runtime/operations/health-checks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAqB,MAAM,YAAY,CAAC;AA2CjE,eAAO,MAAM,iBAAiB,EAAE,WAuB/B,CAAC;AAMF,eAAO,MAAM,sBAAsB,EAAE,WAmCpC,CAAC;AAMF,eAAO,MAAM,iBAAiB,EAAE,WA2B/B,CAAC;AAOF,eAAO,MAAM,kBAAkB,EAAE,WAwChC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,EAAE,SAAS,WAAW,EAKrD,CAAC"}
1
+ {"version":3,"file":"health-checks.d.ts","sourceRoot":"","sources":["../../../../../../../agent/src/runtime/operations/health-checks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAqB,MAAM,YAAY,CAAC;AA6BjE,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAQlD;AAMD,eAAO,MAAM,iBAAiB,EAAE,WAuB/B,CAAC;AAMF,eAAO,MAAM,sBAAsB,EAAE,WAmCpC,CAAC;AAMF,eAAO,MAAM,iBAAiB,EAAE,WA2B/B,CAAC;AAOF,eAAO,MAAM,kBAAkB,EAAE,WAwChC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,EAAE,SAAS,WAAW,EAKrD,CAAC"}
@@ -23,7 +23,7 @@ function getDbAdapter(runtime) {
23
23
  function asServiceRegistry(runtime) {
24
24
  return runtime;
25
25
  }
26
- function describeError(err) {
26
+ export function describeError(err) {
27
27
  if (err instanceof Error)
28
28
  return err.message;
29
29
  if (typeof err === "string")
@@ -1 +1 @@
1
- {"version":3,"file":"health.d.ts","sourceRoot":"","sources":["../../../../../../../agent/src/runtime/operations/health.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,KAAK,YAAY,EAAU,MAAM,eAAe,CAAC;AAE1D,OAAO,KAAK,EACV,WAAW,EACX,iBAAiB,EAElB,MAAM,YAAY,CAAC;AAWpB,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkC;IAEzD,QAAQ,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI;IAiBlC,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAI9B,2EAA2E;IAC3E,IAAI,IAAI,SAAS,WAAW,EAAE;IAIxB,aAAa,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,iBAAiB,CAAC;CA8DvE;AA2DD;;;GAGG;AACH,wBAAgB,uBAAuB,IAAI,aAAa,CASvD"}
1
+ {"version":3,"file":"health.d.ts","sourceRoot":"","sources":["../../../../../../../agent/src/runtime/operations/health.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,KAAK,YAAY,EAAU,MAAM,eAAe,CAAC;AAE1D,OAAO,KAAK,EACV,WAAW,EACX,iBAAiB,EAElB,MAAM,YAAY,CAAC;AAWpB,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkC;IAEzD,QAAQ,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI;IAiBlC,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAI9B,2EAA2E;IAC3E,IAAI,IAAI,SAAS,WAAW,EAAE;IAIxB,aAAa,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,iBAAiB,CAAC;CA8DvE;AAiDD;;;GAGG;AACH,wBAAgB,uBAAuB,IAAI,aAAa,CASvD"}
@@ -15,7 +15,7 @@
15
15
  * Logging prefix: `[runtime-ops:health]`.
16
16
  */
17
17
  import { logger } from "@elizaos/core";
18
- import { builtInHealthChecks } from "./health-checks.js";
18
+ import { builtInHealthChecks, describeError } from "./health-checks.js";
19
19
  const LOG_PREFIX = "[runtime-ops:health]";
20
20
  export class HealthChecker {
21
21
  checks = new Map();
@@ -119,18 +119,6 @@ async function runOne(check, runtime) {
119
119
  clearTimeout(timeoutHandle);
120
120
  }
121
121
  }
122
- function describeError(err) {
123
- if (err instanceof Error)
124
- return err.message;
125
- if (typeof err === "string")
126
- return err;
127
- try {
128
- return JSON.stringify(err);
129
- }
130
- catch {
131
- return String(err);
132
- }
133
- }
134
122
  // ---------------------------------------------------------------------------
135
123
  // Default singleton. Lazy, swappable in tests.
136
124
  // ---------------------------------------------------------------------------
@@ -13,4 +13,5 @@ export { DefaultRuntimeOperationManager, type DefaultRuntimeOperationManagerOpti
13
13
  export { createHotStrategy, type HotStrategyDeps } from "./reload-hot.js";
14
14
  export { FilesystemRuntimeOperationRepository, getDefaultRepository, } from "./repository.js";
15
15
  export * from "./types.js";
16
+ export { _resetDefaultSecretsManagerForTesting, defaultSecretsManager, persistProviderApiKey, resolveProviderApiKey, vaultKeyForProviderApiKey, } from "./vault-bridge.js";
16
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../agent/src/runtime/operations/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,KAAK,eAAe,EACpB,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,sBAAsB,EACtB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,8BAA8B,EAC9B,KAAK,qCAAqC,EAC1C,KAAK,gBAAgB,GACtB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,iBAAiB,EAAE,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAC1E,OAAO,EACL,oCAAoC,EACpC,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AACzB,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../agent/src/runtime/operations/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,KAAK,eAAe,EACpB,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,sBAAsB,EACtB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,8BAA8B,EAC9B,KAAK,qCAAqC,EAC1C,KAAK,gBAAgB,GACtB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,iBAAiB,EAAE,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAC1E,OAAO,EACL,oCAAoC,EACpC,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,OAAO,EACL,qCAAqC,EACrC,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,yBAAyB,GAC1B,MAAM,mBAAmB,CAAC"}
@@ -12,3 +12,4 @@ export { DefaultRuntimeOperationManager, } from "./manager.js";
12
12
  export { createHotStrategy } from "./reload-hot.js";
13
13
  export { FilesystemRuntimeOperationRepository, getDefaultRepository, } from "./repository.js";
14
14
  export * from "./types.js";
15
+ export { _resetDefaultSecretsManagerForTesting, defaultSecretsManager, persistProviderApiKey, resolveProviderApiKey, vaultKeyForProviderApiKey, } from "./vault-bridge.js";
@@ -56,8 +56,10 @@ export declare class DefaultRuntimeOperationManager implements RuntimeOperationM
56
56
  * The repo's active-op slot is the cross-process gate.
57
57
  */
58
58
  private executionChain;
59
+ private startChain;
59
60
  constructor(opts: DefaultRuntimeOperationManagerOptions);
60
61
  start(req: StartOperationRequest): Promise<StartOperationOutcome>;
62
+ private startLocked;
61
63
  get(id: string): Promise<RuntimeOperation | null>;
62
64
  list(opts?: RuntimeOperationListOptions): Promise<RuntimeOperation[]>;
63
65
  findActive(): Promise<RuntimeOperation | null>;
@@ -1 +1 @@
1
- {"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../../../../../../agent/src/runtime/operations/manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;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AAuB;IAC5E,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA6B;IACxD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA4B;IACpD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAwB;IACxD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAmB;IAC9C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAgB;IAC9C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA8C;IACzE;;;OAGG;IACH,OAAO,CAAC,cAAc,CAAoC;IAC1D,OAAO,CAAC,UAAU,CAAoC;gBAE1C,IAAI,EAAE,qCAAqC;IASjD,KAAK,CAAC,GAAG,EAAE,qBAAqB,GAAG,OAAO,CAAC,qBAAqB,CAAC;YAgBzD,WAAW;IAmDnB,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAIjD,IAAI,CAAC,IAAI,CAAC,EAAE,2BAA2B,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAIrE,UAAU,IAAI,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAIpD,OAAO,CAAC,iBAAiB;YAUX,gBAAgB;YAqGhB,aAAa;CAa5B"}
@@ -17,6 +17,10 @@
17
17
  import crypto from "node:crypto";
18
18
  import { logger } from "@elizaos/core";
19
19
  const DEFAULT_CLASSIFIER = () => "cold";
20
+ function strategyErrorCode(err) {
21
+ const code = err?.code;
22
+ return code === "vault-resolve-failed" ? code : "strategy-failed";
23
+ }
20
24
  export class DefaultRuntimeOperationManager {
21
25
  repository;
22
26
  runtime;
@@ -29,6 +33,7 @@ export class DefaultRuntimeOperationManager {
29
33
  * The repo's active-op slot is the cross-process gate.
30
34
  */
31
35
  executionChain = Promise.resolve();
36
+ startChain = Promise.resolve();
32
37
  constructor(opts) {
33
38
  this.repository = opts.repository;
34
39
  this.runtime = opts.runtime;
@@ -38,6 +43,18 @@ export class DefaultRuntimeOperationManager {
38
43
  this.strategies = opts.strategies;
39
44
  }
40
45
  async start(req) {
46
+ let outcome;
47
+ const run = this.startChain.then(async () => {
48
+ outcome = await this.startLocked(req);
49
+ });
50
+ this.startChain = run.then(() => undefined, () => undefined);
51
+ await run;
52
+ if (!outcome) {
53
+ throw new Error("[runtime-ops] start did not produce an outcome");
54
+ }
55
+ return outcome;
56
+ }
57
+ async startLocked(req) {
41
58
  if (req.idempotencyKey) {
42
59
  const existing = await this.repository.findByIdempotencyKey(req.idempotencyKey);
43
60
  if (existing) {
@@ -50,12 +67,14 @@ export class DefaultRuntimeOperationManager {
50
67
  logger.info(`[runtime-ops] Rejected new op: active operation in flight ${active.id}`);
51
68
  return { kind: "rejected-busy", activeOperationId: active.id };
52
69
  }
53
- const tier = this.classifier(req.intent, this.classifyContext());
70
+ const prepareResult = req.prepare ? await req.prepare() : undefined;
71
+ const preparedIntent = prepareResult === undefined ? req.intent : prepareResult;
72
+ const tier = this.classifier(preparedIntent, this.classifyContext());
54
73
  const now = Date.now();
55
74
  const op = {
56
75
  id: crypto.randomUUID(),
57
- kind: req.intent.kind,
58
- intent: req.intent,
76
+ kind: preparedIntent.kind,
77
+ intent: preparedIntent,
59
78
  tier,
60
79
  idempotencyKey: req.idempotencyKey,
61
80
  status: "pending",
@@ -127,7 +146,7 @@ export class DefaultRuntimeOperationManager {
127
146
  catch (err) {
128
147
  const message = err instanceof Error ? err.message : String(err);
129
148
  logger.warn(`[runtime-ops] Strategy failed for op ${id}: ${message}`);
130
- await this.failOperation(id, { message, code: "strategy-failed" });
149
+ await this.failOperation(id, { message, code: strategyErrorCode(err) });
131
150
  return;
132
151
  }
133
152
  // Phase: health-check.
@@ -148,9 +167,10 @@ export class DefaultRuntimeOperationManager {
148
167
  failed: report.failed,
149
168
  },
150
169
  });
151
- // Phase 2: real rollback. For Phase 1 the swap has already happened
152
- // via the cold strategy; we record the failure and surface it.
153
- logger.warn(`[runtime-ops] Health check failed for op ${id}; rollback deferred to Phase 2`);
170
+ // The cold strategy has already swapped the runtime by the time we
171
+ // observe a failed health check. Surface the failure; rollback to the
172
+ // previous runtime is not implemented yet.
173
+ logger.warn(`[runtime-ops] Health check failed for op ${id}`);
154
174
  await this.failOperation(id, {
155
175
  message: "Required health checks failed",
156
176
  code: "health-check-failed",
@@ -15,6 +15,7 @@
15
15
  * is the one defined on the elizaOS Plugin contract for config-only updates.
16
16
  */
17
17
  import type { AgentRuntime } from "@elizaos/core";
18
+ import type { SecretsManager } from "@elizaos/vault";
18
19
  import type { ProviderSwitchIntent, ReloadStrategy } from "./types.js";
19
20
  export interface HotStrategyDeps {
20
21
  /**
@@ -36,5 +37,7 @@ export interface HotStrategyDeps {
36
37
  detail?: Record<string, unknown>;
37
38
  }) => Promise<void>;
38
39
  }
39
- export declare function createHotStrategy(opts?: Partial<HotStrategyDeps>): ReloadStrategy;
40
+ export declare function createHotStrategy(opts?: Partial<HotStrategyDeps> & {
41
+ secrets?: SecretsManager;
42
+ }): ReloadStrategy;
40
43
  //# sourceMappingURL=reload-hot.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"reload-hot.d.ts","sourceRoot":"","sources":["../../../../../../../agent/src/runtime/operations/reload-hot.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAU,MAAM,eAAe,CAAC;AAE1D,OAAO,KAAK,EAGV,oBAAoB,EAEpB,cAAc,EACf,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,gBAAgB,EAAE,CAAC,MAAM,EAAE,oBAAoB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAClE;;;;;;;OAOG;IACH,mBAAmB,EAAE,CACnB,OAAO,EAAE,YAAY,EACrB,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,KACvD,OAAO,CAAC,IAAI,CAAC,CAAC;CACpB;AA6ID,wBAAgB,iBAAiB,CAC/B,IAAI,GAAE,OAAO,CAAC,eAAe,CAAM,GAClC,cAAc,CAiEhB"}
1
+ {"version":3,"file":"reload-hot.d.ts","sourceRoot":"","sources":["../../../../../../../agent/src/runtime/operations/reload-hot.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAU,MAAM,eAAe,CAAC;AAG1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAGV,oBAAoB,EAEpB,cAAc,EACf,MAAM,YAAY,CAAC;AAMpB,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,gBAAgB,EAAE,CAAC,MAAM,EAAE,oBAAoB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAClE;;;;;;;OAOG;IACH,mBAAmB,EAAE,CACnB,OAAO,EAAE,YAAY,EACrB,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,KACvD,OAAO,CAAC,IAAI,CAAC,CAAC;CACpB;AAiJD,wBAAgB,iBAAiB,CAC/B,IAAI,GAAE,OAAO,CAAC,eAAe,CAAC,GAAG;IAAE,OAAO,CAAC,EAAE,cAAc,CAAA;CAAO,GACjE,cAAc,CAgEhB"}
@@ -15,9 +15,8 @@
15
15
  * is the one defined on the elizaOS Plugin contract for config-only updates.
16
16
  */
17
17
  import { logger } from "@elizaos/core";
18
- function nowMs() {
19
- return Date.now();
20
- }
18
+ import { formatErrorWithStack } from "@elizaos/shared";
19
+ import { defaultSecretsManager, resolveProviderApiKey, } from "./vault-bridge.js";
21
20
  function buildPhase(name, status, startedAt, finishedAt, extra = {}) {
22
21
  return {
23
22
  name,
@@ -36,7 +35,7 @@ function describeIntent(intent) {
36
35
  detail: {
37
36
  provider: intent.provider,
38
37
  ...(intent.primaryModel ? { primaryModel: intent.primaryModel } : {}),
39
- ...(intent.apiKey ? { apiKeyChanged: true } : {}),
38
+ ...(intent.apiKeyRef ? { apiKeyChanged: true } : {}),
40
39
  },
41
40
  };
42
41
  case "config-reload":
@@ -58,28 +57,36 @@ function describeIntent(intent) {
58
57
  return { kind: "restart", detail: { reason: intent.reason } };
59
58
  }
60
59
  }
61
- function formatError(err) {
62
- return err instanceof Error ? (err.stack ?? err.message) : String(err);
63
- }
64
60
  /**
65
61
  * Default env-pump wrapper. Lazy-imports the onboarding env-pump to keep the
66
62
  * dependency graph clean (the operations module sits below the api module
67
63
  * in the layering, but the env-pump genuinely owns the canonical mutation).
64
+ *
65
+ * The intent carries `apiKeyRef` (a vault key), not the secret itself. The
66
+ * vault is consulted here on every hot reload and only the resolved
67
+ * plaintext is passed downstream to `createProviderSwitchConnection`.
68
68
  */
69
- async function defaultApplyProviderEnv(intent) {
70
- const { applyOnboardingConnectionConfig, createProviderSwitchConnection } = await import("../../api/provider-switch-config.js");
71
- const { loadElizaConfig, saveElizaConfig } = await import("../../config/config.js");
72
- const connection = createProviderSwitchConnection({
73
- provider: intent.provider,
74
- ...(intent.apiKey ? { apiKey: intent.apiKey } : {}),
75
- ...(intent.primaryModel ? { primaryModel: intent.primaryModel } : {}),
76
- });
77
- if (!connection) {
78
- throw new Error(`[runtime-ops] hot reload: invalid provider "${intent.provider}"`);
79
- }
80
- const config = loadElizaConfig();
81
- await applyOnboardingConnectionConfig(config, connection);
82
- saveElizaConfig(config);
69
+ function makeDefaultApplyProviderEnv(secrets) {
70
+ return async (intent) => {
71
+ const { applyOnboardingConnectionConfig, createProviderSwitchConnection } = await import("../../api/provider-switch-config.js");
72
+ const { loadElizaConfig, saveElizaConfig } = await import("../../config/config.js");
73
+ const apiKey = await resolveProviderApiKey({
74
+ secrets,
75
+ apiKeyRef: intent.apiKeyRef,
76
+ caller: "runtime-ops:reload-hot",
77
+ });
78
+ const connection = createProviderSwitchConnection({
79
+ provider: intent.provider,
80
+ ...(apiKey ? { apiKey } : {}),
81
+ ...(intent.primaryModel ? { primaryModel: intent.primaryModel } : {}),
82
+ });
83
+ if (!connection) {
84
+ throw new Error(`[runtime-ops] hot reload: invalid provider "${intent.provider}"`);
85
+ }
86
+ const config = loadElizaConfig();
87
+ await applyOnboardingConnectionConfig(config, connection);
88
+ saveElizaConfig(config);
89
+ };
83
90
  }
84
91
  /**
85
92
  * Default plugin notify. Iterates the runtime's plugins and calls
@@ -112,7 +119,7 @@ async function defaultNotifyConfigChanged(runtime, change) {
112
119
  }
113
120
  catch (err) {
114
121
  failures += 1;
115
- logger.warn(`[runtime-ops] hot reload: plugin "${plugin.name}" applyConfig failed: ${formatError(err)}`);
122
+ logger.warn(`[runtime-ops] hot reload: plugin "${plugin.name}" applyConfig failed: ${formatErrorWithStack(err)}`);
116
123
  }
117
124
  }
118
125
  if (notified === 0 && failures === 0) {
@@ -122,52 +129,50 @@ async function defaultNotifyConfigChanged(runtime, change) {
122
129
  logger.info(`[runtime-ops] hot reload: notified ${notified} plugin(s), ${failures} failure(s) (change=${change.kind})`);
123
130
  }
124
131
  export function createHotStrategy(opts = {}) {
125
- const applyProviderEnv = opts.applyProviderEnv ?? defaultApplyProviderEnv;
132
+ const secrets = opts.secrets ?? defaultSecretsManager();
133
+ const applyProviderEnv = opts.applyProviderEnv ?? makeDefaultApplyProviderEnv(secrets);
126
134
  const notifyConfigChanged = opts.notifyConfigChanged ?? defaultNotifyConfigChanged;
127
135
  return {
128
136
  tier: "hot",
129
137
  async apply(ctx) {
130
- // ── Phase 1: apply-env ──────────────────────────────────────────────
131
- const envStarted = nowMs();
138
+ const envStarted = Date.now();
132
139
  if (ctx.intent.kind !== "provider-switch") {
133
- // The hot strategy currently only handles provider-switch env mutations
134
- // directly. Other hot-eligible intents (config-reload over env./vars./
135
- // models.) flow through the plugin notify step only — env was already
136
- // mutated by whoever scheduled the operation (e.g. the config writer).
137
- await ctx.reportPhase(buildPhase("apply-env", "skipped", envStarted, nowMs(), {
140
+ // Other hot-eligible intents (config-reload over env./vars./models.)
141
+ // flow through the plugin notify step only — env was already mutated
142
+ // by whoever scheduled the operation (e.g. the config writer).
143
+ await ctx.reportPhase(buildPhase("apply-env", "skipped", envStarted, Date.now(), {
138
144
  detail: { reason: `intent=${ctx.intent.kind}` },
139
145
  }));
140
146
  }
141
147
  else {
142
148
  try {
143
149
  await applyProviderEnv(ctx.intent);
144
- await ctx.reportPhase(buildPhase("apply-env", "succeeded", envStarted, nowMs(), {
150
+ await ctx.reportPhase(buildPhase("apply-env", "succeeded", envStarted, Date.now(), {
145
151
  detail: { provider: ctx.intent.provider },
146
152
  }));
147
153
  }
148
154
  catch (err) {
149
- await ctx.reportPhase(buildPhase("apply-env", "failed", envStarted, nowMs(), {
150
- error: { message: formatError(err) },
155
+ await ctx.reportPhase(buildPhase("apply-env", "failed", envStarted, Date.now(), {
156
+ error: { message: formatErrorWithStack(err) },
151
157
  }));
152
158
  throw err;
153
159
  }
154
160
  }
155
- // ── Phase 2: notify-plugins ─────────────────────────────────────────
156
- const notifyStarted = nowMs();
161
+ const notifyStarted = Date.now();
157
162
  const change = describeIntent(ctx.intent);
158
163
  try {
159
164
  await notifyConfigChanged(ctx.runtime, change);
160
- await ctx.reportPhase(buildPhase("notify-plugins", "succeeded", notifyStarted, nowMs(), {
165
+ await ctx.reportPhase(buildPhase("notify-plugins", "succeeded", notifyStarted, Date.now(), {
161
166
  detail: change.detail,
162
167
  }));
163
168
  }
164
169
  catch (err) {
165
170
  // Best-effort: env is already applied, so we surface this as a failed
166
- // phase with a warning but do NOT throw — the operation should still
167
- // succeed at the manager level.
168
- logger.warn(`[runtime-ops] hot reload: notify-plugins failed (env already applied): ${formatError(err)}`);
169
- await ctx.reportPhase(buildPhase("notify-plugins", "failed", notifyStarted, nowMs(), {
170
- error: { message: formatError(err) },
171
+ // phase with a warning but do NOT throw — the operation still
172
+ // succeeds at the manager level.
173
+ logger.warn(`[runtime-ops] hot reload: notify-plugins failed (env already applied): ${formatErrorWithStack(err)}`);
174
+ await ctx.reportPhase(buildPhase("notify-plugins", "failed", notifyStarted, Date.now(), {
175
+ error: { message: formatErrorWithStack(err) },
171
176
  }));
172
177
  }
173
178
  return ctx.runtime;