@elizaos/autonomous 2.0.0-alpha.69 → 2.0.0-alpha.70

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.
@@ -2,3 +2,4 @@ $ bun run build:dist
2
2
  $ rimraf dist && tsc -p tsconfig.build.json && node ../../scripts/prepare-package-dist.mjs packages/autonomous --compiled-prefix=packages/autonomous/src
3
3
  /usr/bin/bash: line 1: rimraf: command not found
4
4
  error: script "build:dist" exited with code 127
5
+ error: script "build" exited with code 127
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elizaos/autonomous",
3
- "version": "2.0.0-alpha.69",
3
+ "version": "2.0.0-alpha.70",
4
4
  "description": "Standalone Milady agent runtime and backend server package.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -276,5 +276,5 @@
276
276
  "typescript": "^5.9.3",
277
277
  "vitest": "^4.0.18"
278
278
  },
279
- "gitHead": "774937c9cbefd3d95fc181ca40295bb4fd5a7d3b"
279
+ "gitHead": "db049debacc33857bcea596057f1284568a061ff"
280
280
  }
@@ -93,7 +93,7 @@ export async function handleCloudStatusRoutes(
93
93
  const hasApiKey = Boolean(config.cloud?.apiKey?.trim());
94
94
  const effectivelyEnabled = cloudEnabled;
95
95
  const cloudAuth = runtime
96
- ? runtime.getService<Service & CloudAuthIdentityService>("CLOUD_AUTH")
96
+ ? await runtime.getService<Service & CloudAuthIdentityService>("CLOUD_AUTH")
97
97
  : null;
98
98
  const authConnected = Boolean(cloudAuth?.isAuthenticated());
99
99
 
@@ -137,7 +137,7 @@ export async function handleCloudStatusRoutes(
137
137
 
138
138
  if (method === "GET" && pathname === "/api/cloud/credits") {
139
139
  const cloudAuth = runtime
140
- ? runtime.getService<Service & CloudAuthCreditsService>("CLOUD_AUTH")
140
+ ? await runtime.getService<Service & CloudAuthCreditsService>("CLOUD_AUTH")
141
141
  : null;
142
142
  const configApiKey = config.cloud?.apiKey?.trim();
143
143
 
@@ -70,7 +70,7 @@ export async function getKnowledgeService(
70
70
  return { service: null, reason: "runtime_unavailable" };
71
71
  }
72
72
 
73
- let service = runtime.getService<Service & KnowledgeServiceLike>("knowledge");
73
+ let service = await runtime.getService<Service & KnowledgeServiceLike>("knowledge");
74
74
  if (service) return { service };
75
75
 
76
76
  try {
@@ -83,7 +83,7 @@ export async function getKnowledgeService(
83
83
  );
84
84
  });
85
85
  await Promise.race([servicePromise, timeout]);
86
- service = runtime.getService<Service & KnowledgeServiceLike>("knowledge");
86
+ service = await runtime.getService<Service & KnowledgeServiceLike>("knowledge");
87
87
  if (service) return { service };
88
88
  return { service: null, reason: "not_registered" };
89
89
  } catch {
@@ -13,11 +13,11 @@ import {
13
13
  type OnboardingConnection,
14
14
  type OnboardingLocalProviderId,
15
15
  } from "../contracts/onboarding";
16
- import type { MiladyConfig } from "../config/types.milady";
16
+ import type { ElizaConfig } from "../config/types.eliza";
17
17
 
18
18
  const REDACTED_SECRET = "[REDACTED]";
19
19
 
20
- type MutableMiladyConfig = Partial<MiladyConfig> & {
20
+ type MutableElizaConfig = Partial<ElizaConfig> & {
21
21
  cloud?: Record<string, unknown>;
22
22
  models?: Record<string, unknown>;
23
23
  wallet?: { rpcProviders?: Record<string, string> };
@@ -48,21 +48,21 @@ function normalizeSecret(
48
48
  return trimmed;
49
49
  }
50
50
 
51
- function ensureEnv(config: MutableMiladyConfig): Record<string, string> {
51
+ function ensureEnv(config: MutableElizaConfig): Record<string, string> {
52
52
  config.env ??= {};
53
53
  return config.env as Record<string, string>;
54
54
  }
55
55
 
56
56
  function ensureDefaults(
57
- config: MutableMiladyConfig,
58
- ): NonNullable<NonNullable<MiladyConfig["agents"]>["defaults"]> {
57
+ config: MutableElizaConfig,
58
+ ): NonNullable<NonNullable<ElizaConfig["agents"]>["defaults"]> {
59
59
  config.agents ??= {};
60
60
  config.agents.defaults ??= {};
61
61
  return config.agents.defaults;
62
62
  }
63
63
 
64
64
  function setEnvValue(
65
- config: MutableMiladyConfig,
65
+ config: MutableElizaConfig,
66
66
  key: string,
67
67
  value: string | undefined,
68
68
  ): void {
@@ -77,7 +77,7 @@ function setEnvValue(
77
77
  }
78
78
 
79
79
  function setPrimaryModel(
80
- config: MutableMiladyConfig,
80
+ config: MutableElizaConfig,
81
81
  primaryModel: string | undefined,
82
82
  ): void {
83
83
  const defaults = ensureDefaults(config);
@@ -90,7 +90,7 @@ function setPrimaryModel(
90
90
  defaults.model = { ...defaults.model, primary: primaryModel };
91
91
  }
92
92
 
93
- function clearPiAiFlag(config: MutableMiladyConfig): void {
93
+ function clearPiAiFlag(config: MutableElizaConfig): void {
94
94
  const env = ensureEnv(config);
95
95
  delete env.MILADY_USE_PI_AI;
96
96
  delete process.env.MILADY_USE_PI_AI;
@@ -168,7 +168,7 @@ function resolveConfiguredLocalProvider(
168
168
  * Mutates `config` in place.
169
169
  */
170
170
  export function applySubscriptionProviderConfig(
171
- config: Partial<MiladyConfig>,
171
+ config: Partial<ElizaConfig>,
172
172
  provider: string,
173
173
  ): void {
174
174
  config.agents ??= {};
@@ -197,7 +197,7 @@ export function applySubscriptionProviderConfig(
197
197
  * Mutates `config` in place.
198
198
  */
199
199
  export function clearSubscriptionProviderConfig(
200
- config: Partial<MiladyConfig>,
200
+ config: Partial<ElizaConfig>,
201
201
  ): void {
202
202
  config.agents ??= {};
203
203
  config.agents.defaults ??= {};
@@ -346,7 +346,7 @@ export function mergeOnboardingConnectionWithExisting(
346
346
  }
347
347
 
348
348
  export async function applyOnboardingConnectionConfig(
349
- config: MutableMiladyConfig,
349
+ config: MutableElizaConfig,
350
350
  connection: OnboardingConnection,
351
351
  ): Promise<void> {
352
352
  if (connection.kind === "cloud-managed") {
@@ -560,7 +560,7 @@ function resolveSigningRequestPayload(
560
560
  };
561
561
  }
562
562
 
563
- const gasLimit = rawGasLimit?.trim();
563
+ const gasLimit = (rawGasLimit as string | undefined)?.trim();
564
564
  if (gasLimit === "") {
565
565
  return {
566
566
  error: "Signing payload 'gasLimit' cannot be empty when provided",
package/src/api/server.ts CHANGED
@@ -33,16 +33,16 @@ import { getGlobalAwarenessRegistry } from "../awareness/registry";
33
33
  import { CharacterSchema } from "../config/character-schema";
34
34
  import {
35
35
  configFileExists,
36
- loadMiladyConfig,
37
- type MiladyConfig,
38
- saveMiladyConfig,
36
+ loadElizaConfig,
37
+ type ElizaConfig,
38
+ saveElizaConfig,
39
39
  } from "../config/config";
40
40
  import { resolveModelsCacheDir, resolveStateDir } from "../config/paths";
41
41
  import {
42
42
  isConnectorConfigured,
43
43
  isStreamingDestinationConfigured,
44
44
  } from "../config/plugin-auto-enable";
45
- import type { ConnectorConfig, CustomActionDef } from "../config/types.milady";
45
+ import type { ConnectorConfig, CustomActionDef } from "../config/types.eliza";
46
46
  import { createIntegrationTelemetrySpan } from "../diagnostics/integration-observability";
47
47
  import { EMOTE_BY_ID, EMOTE_CATALOG } from "../emotes/catalog";
48
48
  import { resolveDefaultAgentWorkspaceDir } from "../providers/workspace";
@@ -392,7 +392,7 @@ export interface ConversationMeta {
392
392
  updatedAt: string;
393
393
  }
394
394
 
395
- function hasPersistedOnboardingState(config: MiladyConfig): boolean {
395
+ function hasPersistedOnboardingState(config: ElizaConfig): boolean {
396
396
  if (config.meta?.onboardingComplete === true) {
397
397
  return true;
398
398
  }
@@ -456,7 +456,7 @@ interface AgentStartupDiagnostics {
456
456
 
457
457
  interface ServerState {
458
458
  runtime: AgentRuntime | null;
459
- config: MiladyConfig;
459
+ config: ElizaConfig;
460
460
  agentState:
461
461
  | "not_started"
462
462
  | "starting"
@@ -1092,6 +1092,7 @@ const BLOCKED_ENV_KEYS = new Set([
1092
1092
  "HOME",
1093
1093
  "SHELL",
1094
1094
  // Auth / step-up tokens — writable via API would grant privilege escalation
1095
+ "ELIZA_API_TOKEN",
1095
1096
  "MILADY_API_TOKEN",
1096
1097
  "MILADY_WALLET_EXPORT_TOKEN",
1097
1098
  "MILADY_TERMINAL_RUN_TOKEN",
@@ -1111,7 +1112,7 @@ const BLOCKED_ENV_KEYS = new Set([
1111
1112
 
1112
1113
  /**
1113
1114
  * Top-level config keys accepted by `PUT /api/config`.
1114
- * Keep this in sync with MiladyConfig root fields and include both modern and
1115
+ * Keep this in sync with ElizaConfig root fields and include both modern and
1115
1116
  * legacy aliases (e.g. `connectors` + `channels`).
1116
1117
  */
1117
1118
  export const CONFIG_WRITE_ALLOWED_TOP_KEYS = new Set([
@@ -1304,7 +1305,7 @@ function aggregateSecrets(plugins: PluginEntry[]): SecretEntry[] {
1304
1305
  * Reads from config.plugins.installs and tries to enrich with package.json metadata.
1305
1306
  */
1306
1307
  export function discoverInstalledPlugins(
1307
- config: MiladyConfig,
1308
+ config: ElizaConfig,
1308
1309
  bundledIds: Set<string>,
1309
1310
  ): PluginEntry[] {
1310
1311
  const installs = config.plugins?.installs;
@@ -2107,7 +2108,7 @@ async function loadScanReportFromDisk(
2107
2108
  */
2108
2109
  function resolveSkillEnabled(
2109
2110
  id: string,
2110
- config: MiladyConfig,
2111
+ config: ElizaConfig,
2111
2112
  dbPrefs: SkillPreferencesMap,
2112
2113
  ): boolean {
2113
2114
  // Database preference takes priority (explicit user action)
@@ -2150,7 +2151,7 @@ function parseSkillDirsSetting(raw: unknown): string[] {
2150
2151
  */
2151
2152
  async function discoverSkills(
2152
2153
  workspaceDir: string,
2153
- config: MiladyConfig,
2154
+ config: ElizaConfig,
2154
2155
  runtime: AgentRuntime | null,
2155
2156
  ): Promise<SkillEntry[]> {
2156
2157
  // Load persisted preferences from the agent database
@@ -2305,7 +2306,7 @@ function scanSkillsDir(
2305
2306
  dir: string,
2306
2307
  skills: SkillEntry[],
2307
2308
  seen: Set<string>,
2308
- config: MiladyConfig,
2309
+ config: ElizaConfig,
2309
2310
  dbPrefs: SkillPreferencesMap,
2310
2311
  ): void {
2311
2312
  if (!fs.existsSync(dir)) return;
@@ -3821,7 +3822,7 @@ function isBlockedObjectKey(key: string): boolean {
3821
3822
  key === "constructor" ||
3822
3823
  key === "prototype" ||
3823
3824
  // Block config include directives — if an API caller embeds "$include"
3824
- // inside a config patch, the next loadMiladyConfig() → resolveConfigIncludes
3825
+ // inside a config patch, the next loadElizaConfig() → resolveConfigIncludes
3825
3826
  // pass would read arbitrary local files and merge them into the config.
3826
3827
  key === "$include"
3827
3828
  );
@@ -4303,7 +4304,7 @@ function getProviderOptions(): Array<{
4303
4304
  pluginName: "@elizaos/plugin-elizacloud",
4304
4305
  keyPrefix: null,
4305
4306
  description:
4306
- "Managed hosting for Milady agents and bundled infrastructure.",
4307
+ "Managed hosting for Eliza agents and bundled infrastructure.",
4307
4308
  },
4308
4309
  {
4309
4310
  id: "anthropic-subscription",
@@ -5109,7 +5110,7 @@ function getInventoryProviderOptions(): Array<{
5109
5110
  ];
5110
5111
  }
5111
5112
 
5112
- function ensureWalletKeysInEnvAndConfig(config: MiladyConfig): boolean {
5113
+ function ensureWalletKeysInEnvAndConfig(config: ElizaConfig): boolean {
5113
5114
  const missingEvm =
5114
5115
  typeof process.env.EVM_PRIVATE_KEY !== "string" ||
5115
5116
  !process.env.EVM_PRIVATE_KEY.trim();
@@ -5171,7 +5172,7 @@ export type TradePermissionMode =
5171
5172
  * Falls back to "user-sign-only" when not configured.
5172
5173
  */
5173
5174
  export function resolveTradePermissionMode(
5174
- config: MiladyConfig,
5175
+ config: ElizaConfig,
5175
5176
  ): TradePermissionMode {
5176
5177
  const raw = (config.features as Record<string, unknown> | undefined)
5177
5178
  ?.tradePermissionMode;
@@ -5221,7 +5222,7 @@ function parseAgentAutomationMode(value: unknown): AgentAutomationMode | null {
5221
5222
  }
5222
5223
 
5223
5224
  function resolveAgentAutomationModeFromConfig(
5224
- config: MiladyConfig,
5225
+ config: ElizaConfig,
5225
5226
  ): AgentAutomationMode {
5226
5227
  const features =
5227
5228
  config.features && typeof config.features === "object"
@@ -5281,8 +5282,8 @@ type TrainingServiceLike = TrainingServiceWithRuntime;
5281
5282
 
5282
5283
  type TrainingServiceCtor = new (options: {
5283
5284
  getRuntime: () => AgentRuntime | null;
5284
- getConfig: () => MiladyConfig;
5285
- setConfig: (nextConfig: MiladyConfig) => void;
5285
+ getConfig: () => ElizaConfig;
5286
+ setConfig: (nextConfig: ElizaConfig) => void;
5286
5287
  }) => TrainingServiceLike;
5287
5288
 
5288
5289
  async function resolveTrainingServiceCtor(): Promise<TrainingServiceCtor | null> {
@@ -5376,7 +5377,7 @@ export function isAllowedHost(req: http.IncomingMessage): boolean {
5376
5377
 
5377
5378
  if (!hostname) return true;
5378
5379
 
5379
- const bindHost = (process.env.MILADY_API_BIND ?? "").trim().toLowerCase();
5380
+ const bindHost = (process.env.ELIZA_API_BIND ?? process.env.MILADY_API_BIND ?? "").trim().toLowerCase();
5380
5381
 
5381
5382
  // When binding on all interfaces (0.0.0.0 / ::), any Host is acceptable —
5382
5383
  // ensureApiTokenForBindHost already enforces a token for non-loopback binds.
@@ -5389,9 +5390,9 @@ export function isAllowedHost(req: http.IncomingMessage): boolean {
5389
5390
  return true;
5390
5391
  }
5391
5392
 
5392
- // Allow explicitly listed extra hostnames via MILADY_ALLOWED_HOSTS
5393
+ // Allow explicitly listed extra hostnames via ELIZA_ALLOWED_HOSTS / MILADY_ALLOWED_HOSTS
5393
5394
  // (comma-separated, e.g. "myserver.local,192.168.1.10").
5394
- const extra = process.env.MILADY_ALLOWED_HOSTS;
5395
+ const extra = process.env.ELIZA_ALLOWED_HOSTS ?? process.env.MILADY_ALLOWED_HOSTS;
5395
5396
  if (extra) {
5396
5397
  const allowed = extra
5397
5398
  .split(",")
@@ -5410,7 +5411,7 @@ export function resolveCorsOrigin(origin?: string): string | null {
5410
5411
 
5411
5412
  // When bound to a wildcard address, allow any origin. Non-loopback binds still
5412
5413
  // require an explicit token, so this only relaxes the browser origin check.
5413
- const bindHost = (process.env.MILADY_API_BIND ?? "").trim().toLowerCase();
5414
+ const bindHost = (process.env.ELIZA_API_BIND ?? process.env.MILADY_API_BIND ?? "").trim().toLowerCase();
5414
5415
  if (WILDCARD_BIND_RE.test(stripPort(bindHost))) return trimmed;
5415
5416
 
5416
5417
  // Explicit allowlist via env (comma-separated)
@@ -5478,7 +5479,7 @@ const pairingAttempts = new Map<string, { count: number; resetAt: number }>();
5478
5479
 
5479
5480
  function pairingEnabled(): boolean {
5480
5481
  return (
5481
- Boolean(process.env.MILADY_API_TOKEN?.trim()) &&
5482
+ Boolean((process.env.ELIZA_API_TOKEN ?? process.env.MILADY_API_TOKEN)?.trim()) &&
5482
5483
  process.env.MILADY_PAIRING_DISABLED !== "1"
5483
5484
  );
5484
5485
  }
@@ -5537,6 +5538,8 @@ export function extractAuthToken(req: http.IncomingMessage): string | null {
5537
5538
  }
5538
5539
 
5539
5540
  const header =
5541
+ (typeof req.headers["x-eliza-token"] === "string" &&
5542
+ req.headers["x-eliza-token"]) ||
5540
5543
  (typeof req.headers["x-milady-token"] === "string" &&
5541
5544
  req.headers["x-milady-token"]) ||
5542
5545
  (typeof req.headers["x-api-key"] === "string" && req.headers["x-api-key"]);
@@ -5646,24 +5649,25 @@ function isLoopbackBindHost(host: string): boolean {
5646
5649
  }
5647
5650
 
5648
5651
  export function ensureApiTokenForBindHost(host: string): void {
5649
- const token = process.env.MILADY_API_TOKEN?.trim();
5652
+ const token = (process.env.ELIZA_API_TOKEN ?? process.env.MILADY_API_TOKEN)?.trim();
5650
5653
  if (token) return;
5651
5654
  if (isLoopbackBindHost(host)) return;
5652
5655
 
5653
5656
  const generated = crypto.randomBytes(32).toString("hex");
5657
+ process.env.ELIZA_API_TOKEN = generated;
5654
5658
  process.env.MILADY_API_TOKEN = generated;
5655
5659
 
5656
5660
  logger.warn(
5657
- `[milady-api] MILADY_API_BIND=${host} is non-loopback and MILADY_API_TOKEN is unset.`,
5661
+ `[milady-api] ELIZA_API_BIND/MILADY_API_BIND=${host} is non-loopback and ELIZA_API_TOKEN/MILADY_API_TOKEN is unset.`,
5658
5662
  );
5659
5663
  const tokenFingerprint = `${generated.slice(0, 4)}...${generated.slice(-4)}`;
5660
5664
  logger.warn(
5661
- `[milady-api] Generated temporary MILADY_API_TOKEN (${tokenFingerprint}) for this process. Set MILADY_API_TOKEN explicitly to override.`,
5665
+ `[milady-api] Generated temporary API token (${tokenFingerprint}) for this process. Set ELIZA_API_TOKEN explicitly to override.`,
5662
5666
  );
5663
5667
  }
5664
5668
 
5665
5669
  export function isAuthorized(req: http.IncomingMessage): boolean {
5666
- const expected = process.env.MILADY_API_TOKEN?.trim();
5670
+ const expected = (process.env.ELIZA_API_TOKEN ?? process.env.MILADY_API_TOKEN)?.trim();
5667
5671
  if (!expected) return true;
5668
5672
  const provided = extractAuthToken(req);
5669
5673
  if (!provided) return false;
@@ -5774,7 +5778,7 @@ export function resolveTerminalRunRejection(
5774
5778
  body: TerminalRunRequestBody,
5775
5779
  ): TerminalRunRejection | null {
5776
5780
  const expected = process.env.MILADY_TERMINAL_RUN_TOKEN?.trim();
5777
- const apiTokenEnabled = Boolean(process.env.MILADY_API_TOKEN?.trim());
5781
+ const apiTokenEnabled = Boolean((process.env.ELIZA_API_TOKEN ?? process.env.MILADY_API_TOKEN)?.trim());
5778
5782
 
5779
5783
  // Compatibility mode: local loopback sessions without API token keep
5780
5784
  // existing behavior unless an explicit terminal token is configured.
@@ -5831,7 +5835,7 @@ function isWebSocketAuthorized(
5831
5835
  request: http.IncomingMessage,
5832
5836
  url: URL,
5833
5837
  ): boolean {
5834
- const expected = process.env.MILADY_API_TOKEN?.trim();
5838
+ const expected = (process.env.ELIZA_API_TOKEN ?? process.env.MILADY_API_TOKEN)?.trim();
5835
5839
  if (!expected) return true;
5836
5840
 
5837
5841
  const headerToken = extractAuthToken(request);
@@ -7444,7 +7448,7 @@ async function handleRequest(
7444
7448
  res,
7445
7449
  {
7446
7450
  error: "Forbidden — invalid Host header",
7447
- hint: `To allow this host, set MILADY_ALLOWED_HOSTS=${incomingHost} in your environment, or access via http://localhost`,
7451
+ hint: `To allow this host, set ELIZA_ALLOWED_HOSTS=${incomingHost} (or MILADY_ALLOWED_HOSTS) in your environment, or access via http://localhost`,
7448
7452
  docs: "https://docs.milady.ai/configuration#allowed-hosts",
7449
7453
  },
7450
7454
  403,
@@ -7751,7 +7755,7 @@ async function handleRequest(
7751
7755
  envCfg[envKey] = apiKey;
7752
7756
  }
7753
7757
 
7754
- saveMiladyConfig(config);
7758
+ saveElizaConfig(config);
7755
7759
 
7756
7760
  // Schedule runtime restart so the new provider takes effect.
7757
7761
  scheduleRuntimeRestart(`provider switch to ${normalizedProvider}`);
@@ -7814,7 +7818,7 @@ async function handleRequest(
7814
7818
  readJsonBody,
7815
7819
  json,
7816
7820
  error,
7817
- saveConfig: saveMiladyConfig,
7821
+ saveConfig: saveElizaConfig,
7818
7822
  loadSubscriptionAuth: async () =>
7819
7823
  (await import("../auth/index")) as never,
7820
7824
  } as never)
@@ -8050,7 +8054,7 @@ async function handleRequest(
8050
8054
  // before telling the client to fall back into onboarding.
8051
8055
  if (!complete && configFileExists()) {
8052
8056
  try {
8053
- config = loadMiladyConfig();
8057
+ config = loadElizaConfig();
8054
8058
  complete = hasPersistedOnboardingState(config);
8055
8059
  if (complete) {
8056
8060
  state.config = config;
@@ -8183,7 +8187,7 @@ async function handleRequest(
8183
8187
  if (body.theme) {
8184
8188
  if (!config.ui) config.ui = {};
8185
8189
  config.ui.theme = body.theme as
8186
- | "milady"
8190
+ | "eliza"
8187
8191
  | "qt314"
8188
8192
  | "web2000"
8189
8193
  | "programmer"
@@ -8452,7 +8456,7 @@ async function handleRequest(
8452
8456
  state.config = config;
8453
8457
  state.agentName = (body.name as string) ?? state.agentName;
8454
8458
  try {
8455
- saveMiladyConfig(config);
8459
+ saveElizaConfig(config);
8456
8460
  } catch (err) {
8457
8461
  logger.error(
8458
8462
  `[milady-api] Failed to save config after onboarding: ${err}`,
@@ -8629,7 +8633,7 @@ async function handleRequest(
8629
8633
  json,
8630
8634
  error,
8631
8635
  pickRandomNames,
8632
- saveConfig: saveMiladyConfig as never,
8636
+ saveConfig: saveElizaConfig as never,
8633
8637
  validateCharacter: (body) => CharacterSchema.safeParse(body) as never,
8634
8638
  })
8635
8639
  ) {
@@ -8692,9 +8696,9 @@ async function handleRequest(
8692
8696
  // ── GET /api/plugins ────────────────────────────────────────────────────
8693
8697
  if (method === "GET" && pathname === "/api/plugins") {
8694
8698
  // Re-read config from disk so we pick up plugins installed since server start.
8695
- let freshConfig: MiladyConfig;
8699
+ let freshConfig: ElizaConfig;
8696
8700
  try {
8697
- freshConfig = loadMiladyConfig();
8701
+ freshConfig = loadElizaConfig();
8698
8702
  } catch {
8699
8703
  freshConfig = state.config;
8700
8704
  }
@@ -8835,9 +8839,9 @@ async function handleRequest(
8835
8839
  let plugin = state.plugins.find((p) => p.id === pluginId);
8836
8840
  if (!plugin) {
8837
8841
  // Check store-installed plugins from config
8838
- let freshCfg: MiladyConfig;
8842
+ let freshCfg: ElizaConfig;
8839
8843
  try {
8840
- freshCfg = loadMiladyConfig();
8844
+ freshCfg = loadElizaConfig();
8841
8845
  } catch {
8842
8846
  freshCfg = state.config;
8843
8847
  }
@@ -8927,7 +8931,7 @@ async function handleRequest(
8927
8931
  // Save config even when only config values changed (no enable toggle)
8928
8932
  if (body.enabled === undefined) {
8929
8933
  try {
8930
- saveMiladyConfig(state.config);
8934
+ saveElizaConfig(state.config);
8931
8935
  } catch (err) {
8932
8936
  logger.warn(
8933
8937
  `[milady-api] Failed to save config: ${err instanceof Error ? err.message : err}`,
@@ -8992,7 +8996,7 @@ async function handleRequest(
8992
8996
 
8993
8997
  // Save updated config
8994
8998
  try {
8995
- saveMiladyConfig(state.config);
8999
+ saveElizaConfig(state.config);
8996
9000
  } catch (err) {
8997
9001
  logger.warn(
8998
9002
  `[milady-api] Failed to save config: ${err instanceof Error ? err.message : err}`,
@@ -9220,7 +9224,7 @@ async function handleRequest(
9220
9224
  .entries as Record<string, Record<string, unknown>>;
9221
9225
  pluginEntries[installedId] = { enabled: true };
9222
9226
  try {
9223
- saveMiladyConfig(state.config);
9227
+ saveElizaConfig(state.config);
9224
9228
  } catch (err) {
9225
9229
  logger.warn(
9226
9230
  `[milady-api] Failed to save config after install: ${err instanceof Error ? err.message : err}`,
@@ -9559,7 +9563,7 @@ async function handleRequest(
9559
9563
  }
9560
9564
 
9561
9565
  try {
9562
- saveMiladyConfig(state.config);
9566
+ saveElizaConfig(state.config);
9563
9567
  } catch (err) {
9564
9568
  logger.warn(
9565
9569
  `[api] Config save failed: ${err instanceof Error ? err.message : err}`,
@@ -10628,7 +10632,7 @@ async function handleRequest(
10628
10632
  process.env.SKILLSMP_API_KEY = apiKey;
10629
10633
  if (!state.config.env) state.config.env = {};
10630
10634
  (state.config.env as Record<string, string>).SKILLSMP_API_KEY = apiKey;
10631
- saveMiladyConfig(state.config);
10635
+ saveElizaConfig(state.config);
10632
10636
  json(res, { ok: true, keySet: true });
10633
10637
  return;
10634
10638
  }
@@ -10744,7 +10748,7 @@ async function handleRequest(
10744
10748
  method,
10745
10749
  pathname,
10746
10750
  config: state.config,
10747
- saveConfig: saveMiladyConfig,
10751
+ saveConfig: saveElizaConfig,
10748
10752
  ensureWalletKeysInEnvAndConfig,
10749
10753
  resolveWalletExportRejection,
10750
10754
  scheduleRuntimeRestart,
@@ -11158,7 +11162,7 @@ async function handleRequest(
11158
11162
  lastCheckAt: undefined,
11159
11163
  lastCheckVersion: undefined,
11160
11164
  };
11161
- saveMiladyConfig(state.config);
11165
+ saveElizaConfig(state.config);
11162
11166
  json(res, { channel: ch });
11163
11167
  return;
11164
11168
  }
@@ -11201,7 +11205,7 @@ async function handleRequest(
11201
11205
  config,
11202
11206
  ) as ConnectorConfig;
11203
11207
  try {
11204
- saveMiladyConfig(state.config);
11208
+ saveElizaConfig(state.config);
11205
11209
  } catch {
11206
11210
  /* test envs */
11207
11211
  }
@@ -11231,7 +11235,7 @@ async function handleRequest(
11231
11235
  delete state.config.channels[name];
11232
11236
  }
11233
11237
  try {
11234
- saveMiladyConfig(state.config);
11238
+ saveElizaConfig(state.config);
11235
11239
  } catch {
11236
11240
  /* test envs */
11237
11241
  }
@@ -11271,7 +11275,7 @@ async function handleRequest(
11271
11275
  broadcastWs: state.broadcastWs ?? undefined,
11272
11276
  config: state.config,
11273
11277
  runtime: state.runtime ?? undefined,
11274
- saveConfig: () => saveMiladyConfig(state.config),
11278
+ saveConfig: () => saveElizaConfig(state.config),
11275
11279
  workspaceDir: resolveDefaultAgentWorkspaceDir(),
11276
11280
  },
11277
11281
  {
@@ -11311,7 +11315,7 @@ async function handleRequest(
11311
11315
  broadcastWs: state.broadcastWs ?? undefined,
11312
11316
  config: state.config,
11313
11317
  runtime: state.runtime ?? undefined,
11314
- saveConfig: () => saveMiladyConfig(state.config),
11318
+ saveConfig: () => saveElizaConfig(state.config),
11315
11319
  workspaceDir: resolveDefaultAgentWorkspaceDir(),
11316
11320
  },
11317
11321
  {
@@ -11764,6 +11768,7 @@ async function handleRequest(
11764
11768
  // merge, even though BLOCKED_ENV_KEYS also blocks them during process.env
11765
11769
  // sync below. Keeping both guards prevents accidental persistence if one
11766
11770
  // path changes in future refactors.
11771
+ delete envPatch.ELIZA_API_TOKEN;
11767
11772
  delete envPatch.MILADY_API_TOKEN;
11768
11773
  delete envPatch.MILADY_WALLET_EXPORT_TOKEN;
11769
11774
  delete envPatch.MILADY_TERMINAL_RUN_TOKEN;
@@ -11777,6 +11782,7 @@ async function handleRequest(
11777
11782
  !Array.isArray(envPatch.vars)
11778
11783
  ) {
11779
11784
  const vars = envPatch.vars as Record<string, unknown>;
11785
+ delete vars.ELIZA_API_TOKEN;
11780
11786
  delete vars.MILADY_API_TOKEN;
11781
11787
  delete vars.MILADY_WALLET_EXPORT_TOKEN;
11782
11788
  delete vars.MILADY_TERMINAL_RUN_TOKEN;
@@ -11790,7 +11796,7 @@ async function handleRequest(
11790
11796
  // before safeMerge. The explicit deletes above cover known step-up
11791
11797
  // secrets; this loop catches process-level injection keys
11792
11798
  // (NODE_OPTIONS, LD_PRELOAD, etc.) so they never reach
11793
- // saveMiladyConfig() and the persistence→restart RCE chain is closed.
11799
+ // saveElizaConfig() and the persistence→restart RCE chain is closed.
11794
11800
  for (const key of Object.keys(envPatch)) {
11795
11801
  if (key === "vars" || key === "shellEnv") continue;
11796
11802
  if (BLOCKED_ENV_KEYS.has(key.toUpperCase())) {
@@ -11852,7 +11858,7 @@ async function handleRequest(
11852
11858
  safeMerge(state.config as Record<string, unknown>, filtered);
11853
11859
 
11854
11860
  // If the client updated env vars, synchronise them into process.env so
11855
- // subsequent hot-restarts see the latest values (loadMiladyConfig()
11861
+ // subsequent hot-restarts see the latest values (loadElizaConfig()
11856
11862
  // only fills missing env vars and does not override existing ones).
11857
11863
  if (
11858
11864
  filtered.env &&
@@ -11902,7 +11908,7 @@ async function handleRequest(
11902
11908
  }
11903
11909
 
11904
11910
  try {
11905
- saveMiladyConfig(state.config);
11911
+ saveElizaConfig(state.config);
11906
11912
  } catch (err) {
11907
11913
  logger.warn(
11908
11914
  `[api] Config save failed: ${err instanceof Error ? err.message : err}`,
@@ -11935,7 +11941,7 @@ async function handleRequest(
11935
11941
  }
11936
11942
 
11937
11943
  persistAgentAutomationMode(state, parsed);
11938
- saveMiladyConfig(state.config);
11944
+ saveElizaConfig(state.config);
11939
11945
 
11940
11946
  json(res, {
11941
11947
  mode: parsed,
@@ -11983,7 +11989,7 @@ async function handleRequest(
11983
11989
  newMode;
11984
11990
 
11985
11991
  try {
11986
- saveMiladyConfig(state.config);
11992
+ saveElizaConfig(state.config);
11987
11993
  } catch (err) {
11988
11994
  logger.warn(
11989
11995
  `[api] Trade-mode config save failed: ${err instanceof Error ? err.message : err}`,
@@ -12009,7 +12015,7 @@ async function handleRequest(
12009
12015
  readJsonBody,
12010
12016
  json,
12011
12017
  error,
12012
- saveConfig: saveMiladyConfig,
12018
+ saveConfig: saveElizaConfig,
12013
12019
  scheduleRuntimeRestart,
12014
12020
  })
12015
12021
  ) {
@@ -12806,7 +12812,7 @@ async function handleRequest(
12806
12812
 
12807
12813
  if (changed.length > 0) {
12808
12814
  try {
12809
- saveMiladyConfig(state.config);
12815
+ saveElizaConfig(state.config);
12810
12816
  } catch (err) {
12811
12817
  logger.warn(
12812
12818
  `[api] production-defaults config save failed: ${err instanceof Error ? err.message : err}`,
@@ -12847,7 +12853,7 @@ async function handleRequest(
12847
12853
  config: state.config,
12848
12854
  cloudManager: state.cloudManager,
12849
12855
  runtime: state.runtime,
12850
- saveConfig: saveMiladyConfig,
12856
+ saveConfig: saveElizaConfig,
12851
12857
  createTelemetrySpan: createIntegrationTelemetrySpan,
12852
12858
  };
12853
12859
  const handled = await handleCloudRoute(
@@ -14764,9 +14770,8 @@ async function handleRequest(
14764
14770
 
14765
14771
  // ── Hyperscape control proxy routes (optional — package may not be installed) ──
14766
14772
  try {
14767
- const { handleAppsHyperscapeRoutes } = await import(
14768
- "@elizaos/app-hyperscape/routes"
14769
- );
14773
+ // @ts-ignore: Optional package may not be installed
14774
+ const { handleAppsHyperscapeRoutes } = await import("@elizaos/app-hyperscape/routes");
14770
14775
  if (
14771
14776
  await handleAppsHyperscapeRoutes({
14772
14777
  req,
@@ -15564,7 +15569,7 @@ async function handleRequest(
15564
15569
  >[string];
15565
15570
 
15566
15571
  try {
15567
- saveMiladyConfig(state.config);
15572
+ saveElizaConfig(state.config);
15568
15573
  } catch (err) {
15569
15574
  logger.warn(
15570
15575
  `[api] Config save failed: ${err instanceof Error ? err.message : err}`,
@@ -15595,7 +15600,7 @@ async function handleRequest(
15595
15600
  if (state.config.mcp?.servers?.[serverName]) {
15596
15601
  delete state.config.mcp.servers[serverName];
15597
15602
  try {
15598
- saveMiladyConfig(state.config);
15603
+ saveElizaConfig(state.config);
15599
15604
  } catch (err) {
15600
15605
  logger.warn(
15601
15606
  `[api] Config save failed: ${err instanceof Error ? err.message : err}`,
@@ -15652,7 +15657,7 @@ async function handleRequest(
15652
15657
  }
15653
15658
 
15654
15659
  try {
15655
- saveMiladyConfig(state.config);
15660
+ saveElizaConfig(state.config);
15656
15661
  } catch (err) {
15657
15662
  logger.warn(
15658
15663
  `[api] Config save failed: ${err instanceof Error ? err.message : err}`,
@@ -15948,7 +15953,7 @@ async function handleRequest(
15948
15953
  // ── Custom Actions CRUD ──────────────────────────────────────────────
15949
15954
 
15950
15955
  if (method === "GET" && pathname === "/api/custom-actions") {
15951
- const config = loadMiladyConfig();
15956
+ const config = loadElizaConfig();
15952
15957
  json(res, { actions: config.customActions ?? [] });
15953
15958
  return;
15954
15959
  }
@@ -16040,10 +16045,10 @@ async function handleRequest(
16040
16045
  updatedAt: now,
16041
16046
  };
16042
16047
 
16043
- const config = loadMiladyConfig();
16048
+ const config = loadElizaConfig();
16044
16049
  if (!config.customActions) config.customActions = [];
16045
16050
  config.customActions.push(actionDef);
16046
- saveMiladyConfig(config);
16051
+ saveElizaConfig(config);
16047
16052
 
16048
16053
  // Hot-register into the running agent so it's available immediately
16049
16054
  if (actionDef.enabled) {
@@ -16130,7 +16135,7 @@ async function handleRequest(
16130
16135
  );
16131
16136
  if (!body) return;
16132
16137
 
16133
- const config = loadMiladyConfig();
16138
+ const config = loadElizaConfig();
16134
16139
  const def = (config.customActions ?? []).find((a) => a.id === actionId);
16135
16140
  if (!def) {
16136
16141
  error(res, "Action not found", 404);
@@ -16179,7 +16184,7 @@ async function handleRequest(
16179
16184
  const body = await readJsonBody<Record<string, unknown>>(req, res);
16180
16185
  if (!body) return;
16181
16186
 
16182
- const config = loadMiladyConfig();
16187
+ const config = loadElizaConfig();
16183
16188
  const actions = config.customActions ?? [];
16184
16189
  const idx = actions.findIndex((a) => a.id === actionId);
16185
16190
  if (idx === -1) {
@@ -16242,7 +16247,7 @@ async function handleRequest(
16242
16247
 
16243
16248
  actions[idx] = updated;
16244
16249
  config.customActions = actions;
16245
- saveMiladyConfig(config);
16250
+ saveElizaConfig(config);
16246
16251
 
16247
16252
  json(res, { ok: true, action: updated });
16248
16253
  return;
@@ -16251,7 +16256,7 @@ async function handleRequest(
16251
16256
  if (method === "DELETE" && customActionMatch) {
16252
16257
  const actionId = decodeURIComponent(customActionMatch[1]);
16253
16258
 
16254
- const config = loadMiladyConfig();
16259
+ const config = loadElizaConfig();
16255
16260
  const actions = config.customActions ?? [];
16256
16261
  const idx = actions.findIndex((a) => a.id === actionId);
16257
16262
  if (idx === -1) {
@@ -16261,7 +16266,7 @@ async function handleRequest(
16261
16266
 
16262
16267
  actions.splice(idx, 1);
16263
16268
  config.customActions = actions;
16264
- saveMiladyConfig(config);
16269
+ saveElizaConfig(config);
16265
16270
 
16266
16271
  json(res, { ok: true });
16267
16272
  return;
@@ -16375,18 +16380,18 @@ export async function startApiServer(opts?: {
16375
16380
 
16376
16381
  const port = opts?.port ?? 2138;
16377
16382
  const host =
16378
- (process.env.MILADY_API_BIND ?? "127.0.0.1").trim() || "127.0.0.1";
16383
+ (process.env.ELIZA_API_BIND ?? process.env.MILADY_API_BIND ?? "127.0.0.1").trim() || "127.0.0.1";
16379
16384
  ensureApiTokenForBindHost(host);
16380
16385
  console.log(`[milady-api] Token check done (${Date.now() - apiStartTime}ms)`);
16381
16386
 
16382
- let config: MiladyConfig;
16387
+ let config: ElizaConfig;
16383
16388
  try {
16384
- config = loadMiladyConfig();
16389
+ config = loadElizaConfig();
16385
16390
  } catch (err) {
16386
16391
  logger.warn(
16387
16392
  `[milady-api] Failed to load config, starting with defaults: ${err instanceof Error ? err.message : err}`,
16388
16393
  );
16389
- config = {} as MiladyConfig;
16394
+ config = {} as ElizaConfig;
16390
16395
  }
16391
16396
  console.log(`[milady-api] Config loaded (${Date.now() - apiStartTime}ms)`);
16392
16397
 
@@ -16414,7 +16419,7 @@ export async function startApiServer(opts?: {
16414
16419
  // (e.g. RPC/cloud configured outside onboarding).
16415
16420
  if (ensureWalletKeysInEnvAndConfig(config)) {
16416
16421
  try {
16417
- saveMiladyConfig(config);
16422
+ saveElizaConfig(config);
16418
16423
  } catch (err) {
16419
16424
  logger.warn(
16420
16425
  `[milady-api] Failed to persist generated wallet keys: ${err instanceof Error ? err.message : err}`,
@@ -16508,9 +16513,9 @@ export async function startApiServer(opts?: {
16508
16513
  const trainingServiceOptions = {
16509
16514
  getRuntime: () => state.runtime,
16510
16515
  getConfig: () => state.config,
16511
- setConfig: (nextConfig: MiladyConfig) => {
16516
+ setConfig: (nextConfig: ElizaConfig) => {
16512
16517
  state.config = nextConfig;
16513
- saveMiladyConfig(nextConfig);
16518
+ saveElizaConfig(nextConfig);
16514
16519
  },
16515
16520
  };
16516
16521
  if (trainingServiceCtor) {
@@ -116,7 +116,7 @@ function error(res: ServerResponse, message: string, status: number): void {
116
116
  function resolveRouteTtsConfig(
117
117
  config: unknown,
118
118
  ): Record<string, unknown> | null {
119
- return resolveTtsConfig(config as never) as Record<string, unknown> | null;
119
+ return resolveTtsConfig(config as never) as unknown as Record<string, unknown> | null;
120
120
  }
121
121
 
122
122
  function getRouteTtsProviderStatus(config: unknown): {
@@ -1,4 +1,4 @@
1
- import type { MiladyConfig } from "./types";
1
+ import type { ElizaConfig } from "./types";
2
2
 
3
3
  /**
4
4
  * Environment variable keys that must NEVER be synced from config → process.env.
@@ -47,7 +47,7 @@ const BLOCKED_STARTUP_ENV_KEYS = new Set([
47
47
  ]);
48
48
 
49
49
  export function collectConfigEnvVars(
50
- cfg?: MiladyConfig,
50
+ cfg?: ElizaConfig,
51
51
  ): Record<string, string> {
52
52
  const envConfig = cfg?.env;
53
53
  if (!envConfig) {
@@ -64,7 +64,7 @@ export function collectConfigEnvVars(
64
64
  if (BLOCKED_STARTUP_ENV_KEYS.has(key.toUpperCase())) {
65
65
  continue;
66
66
  }
67
- entries[key] = value;
67
+ entries[key] = value as string;
68
68
  }
69
69
  }
70
70
 
@@ -375,7 +375,7 @@ describe("provisionCloudAgent (via runCloudOnboarding)", () => {
375
375
  globalThis.fetch = originalFetch;
376
376
  });
377
377
 
378
- it("polls until agent reaches running status", async () => {
378
+ it("polls until agent reaches running status", { timeout: 15_000 }, async () => {
379
379
  const clack = makeClack();
380
380
 
381
381
  mockCreateAgent.mockResolvedValue({
@@ -80,9 +80,9 @@ import {
80
80
  } from "../api/plugin-validation";
81
81
  import {
82
82
  configFileExists,
83
- loadMiladyConfig,
84
- type MiladyConfig,
85
- saveMiladyConfig,
83
+ loadElizaConfig,
84
+ type ElizaConfig,
85
+ saveElizaConfig,
86
86
  } from "../config/config";
87
87
  import { collectConfigEnvVars } from "../config/env-vars";
88
88
  import { resolveStateDir, resolveUserPath } from "../config/paths";
@@ -91,7 +91,7 @@ import {
91
91
  applyPluginAutoEnable,
92
92
  } from "../config/plugin-auto-enable";
93
93
  import type { AgentConfig } from "../config/types.agents";
94
- import type { PluginInstallRecord } from "../config/types.milady";
94
+ import type { PluginInstallRecord } from "../config/types.eliza";
95
95
  import {
96
96
  createHookEvent,
97
97
  type LoadHooksOptions,
@@ -107,7 +107,7 @@ import { SandboxManager, type SandboxMode } from "../services/sandbox-manager";
107
107
  import { diagnoseNoAIProvider } from "../services/version-compat";
108
108
  import { CORE_PLUGINS, OPTIONAL_CORE_PLUGINS } from "./core-plugins";
109
109
  import { detectEmbeddingPreset } from "./embedding-presets";
110
- import { createMiladyPlugin } from "./milady-plugin";
110
+ import { createElizaPlugin } from "./eliza-plugin";
111
111
  import {
112
112
  installDatabaseTrajectoryLogger,
113
113
  shouldEnableTrajectoryLoggingByDefault,
@@ -211,7 +211,7 @@ interface PluginModuleShape {
211
211
 
212
212
  export function configureLocalEmbeddingPlugin(
213
213
  _plugin: Plugin,
214
- config?: MiladyConfig,
214
+ config?: ElizaConfig,
215
215
  ): void {
216
216
  const detectedPreset = detectEmbeddingPreset();
217
217
 
@@ -839,7 +839,7 @@ export function findRuntimePluginExport(mod: PluginModuleShape): Plugin | null {
839
839
  * based on config, environment variables, and feature flags.
840
840
  */
841
841
  /** @internal Exported for testing. */
842
- export function collectPluginNames(config: MiladyConfig): Set<string> {
842
+ export function collectPluginNames(config: ElizaConfig): Set<string> {
843
843
  const shellPluginDisabled = config.features?.shellEnabled === false;
844
844
  const localEmbeddingsExplicitlyDisabled = (() => {
845
845
  const raw = process.env.MILADY_DISABLE_LOCAL_EMBEDDINGS;
@@ -1392,7 +1392,7 @@ function resolveStaticElizaPlugin(pluginName: string): unknown | null {
1392
1392
  }
1393
1393
 
1394
1394
  async function resolvePlugins(
1395
- config: MiladyConfig,
1395
+ config: ElizaConfig,
1396
1396
  opts?: { quiet?: boolean },
1397
1397
  ): Promise<ResolvedPlugin[]> {
1398
1398
  const plugins: ResolvedPlugin[] = [];
@@ -1412,7 +1412,7 @@ async function resolvePlugins(
1412
1412
  ...(config.plugins?.installs ?? {}),
1413
1413
  };
1414
1414
 
1415
- const denyList = new Set(config.plugins?.deny ?? []);
1415
+ const denyList = new Set<string>((config.plugins?.deny || []) as string[]);
1416
1416
 
1417
1417
  // ── Auto-discover ejected plugins ───────────────────────────────────────
1418
1418
  // Ejected plugins override npm/core versions, so they are tracked
@@ -1657,7 +1657,7 @@ async function resolvePlugins(
1657
1657
  // to import from stale install directories.
1658
1658
  if (repairedInstallRecords.size > 0) {
1659
1659
  try {
1660
- saveMiladyConfig(config);
1660
+ saveElizaConfig(config);
1661
1661
  logger.info(
1662
1662
  `[milady] Repaired ${repairedInstallRecords.size} plugin install record(s): ${Array.from(repairedInstallRecords).join(", ")}`,
1663
1663
  );
@@ -1673,7 +1673,7 @@ async function resolvePlugins(
1673
1673
 
1674
1674
  /** @internal Exported for testing. */
1675
1675
  export function repairBrokenInstallRecord(
1676
- config: MiladyConfig,
1676
+ config: ElizaConfig,
1677
1677
  pluginName: string,
1678
1678
  ): boolean {
1679
1679
  const record = config.plugins?.installs?.[pluginName];
@@ -1862,7 +1862,7 @@ export async function resolvePackageEntry(pkgRoot: string): Promise<string> {
1862
1862
  * that elizaOS plugins can find them.
1863
1863
  */
1864
1864
  /** @internal Exported for testing. */
1865
- export function applyConnectorSecretsToEnv(config: MiladyConfig): void {
1865
+ export function applyConnectorSecretsToEnv(config: ElizaConfig): void {
1866
1866
  // Prefer config.connectors, fall back to config.channels for backward compatibility
1867
1867
  const connectors = config.connectors ?? config.channels ?? {};
1868
1868
 
@@ -1945,7 +1945,7 @@ export async function autoResolveDiscordAppId(): Promise<void> {
1945
1945
  * ElizaCloud plugin can discover settings at startup.
1946
1946
  */
1947
1947
  /** @internal Exported for testing. */
1948
- export function applyCloudConfigToEnv(config: MiladyConfig): void {
1948
+ export function applyCloudConfigToEnv(config: ElizaConfig): void {
1949
1949
  const cloud = config.cloud;
1950
1950
  if (!cloud) return;
1951
1951
 
@@ -2005,28 +2005,36 @@ export function applyCloudConfigToEnv(config: MiladyConfig): void {
2005
2005
  }
2006
2006
 
2007
2007
  // Propagate per-service disable flags so downstream code can check them
2008
- // without needing direct access to the MiladyConfig object.
2008
+ // without needing direct access to the ElizaConfig object.
2009
2009
  const services = cloud.services;
2010
2010
  if (services) {
2011
2011
  if (services.tts === false) {
2012
2012
  process.env.MILADY_CLOUD_TTS_DISABLED = "true";
2013
+ process.env.ELIZA_CLOUD_TTS_DISABLED = "true";
2013
2014
  } else {
2014
2015
  delete process.env.MILADY_CLOUD_TTS_DISABLED;
2016
+ delete process.env.ELIZA_CLOUD_TTS_DISABLED;
2015
2017
  }
2016
2018
  if (services.media === false) {
2017
2019
  process.env.MILADY_CLOUD_MEDIA_DISABLED = "true";
2020
+ process.env.ELIZA_CLOUD_MEDIA_DISABLED = "true";
2018
2021
  } else {
2019
2022
  delete process.env.MILADY_CLOUD_MEDIA_DISABLED;
2023
+ delete process.env.ELIZA_CLOUD_MEDIA_DISABLED;
2020
2024
  }
2021
2025
  if (services.embeddings === false) {
2022
2026
  process.env.MILADY_CLOUD_EMBEDDINGS_DISABLED = "true";
2027
+ process.env.ELIZA_CLOUD_EMBEDDINGS_DISABLED = "true";
2023
2028
  } else {
2024
2029
  delete process.env.MILADY_CLOUD_EMBEDDINGS_DISABLED;
2030
+ delete process.env.ELIZA_CLOUD_EMBEDDINGS_DISABLED;
2025
2031
  }
2026
2032
  if (services.rpc === false) {
2027
2033
  process.env.MILADY_CLOUD_RPC_DISABLED = "true";
2034
+ process.env.ELIZA_CLOUD_RPC_DISABLED = "true";
2028
2035
  } else {
2029
2036
  delete process.env.MILADY_CLOUD_RPC_DISABLED;
2037
+ delete process.env.ELIZA_CLOUD_RPC_DISABLED;
2030
2038
  }
2031
2039
  }
2032
2040
  }
@@ -2043,7 +2051,7 @@ export function applyCloudConfigToEnv(config: MiladyConfig): void {
2043
2051
  * `POSTGRES_URL`.
2044
2052
  */
2045
2053
  /** @internal Exported for testing. */
2046
- export function applyX402ConfigToEnv(config: MiladyConfig): void {
2054
+ export function applyX402ConfigToEnv(config: ElizaConfig): void {
2047
2055
  const x402 = (config as Record<string, unknown>).x402 as
2048
2056
  | { enabled?: boolean; apiKey?: string; baseUrl?: string }
2049
2057
  | undefined;
@@ -2055,14 +2063,14 @@ export function applyX402ConfigToEnv(config: MiladyConfig): void {
2055
2063
  process.env.X402_BASE_URL = x402.baseUrl;
2056
2064
  }
2057
2065
 
2058
- function resolveDefaultPgliteDataDir(config: MiladyConfig): string {
2066
+ function resolveDefaultPgliteDataDir(config: ElizaConfig): string {
2059
2067
  const workspaceDir =
2060
2068
  config.agents?.defaults?.workspace ?? resolveDefaultAgentWorkspaceDir();
2061
2069
  return path.join(resolveUserPath(workspaceDir), ".eliza", ".elizadb");
2062
2070
  }
2063
2071
 
2064
2072
  /** @internal Exported for testing. */
2065
- export function applyDatabaseConfigToEnv(config: MiladyConfig): void {
2073
+ export function applyDatabaseConfigToEnv(config: ElizaConfig): void {
2066
2074
  const db = config.database;
2067
2075
  const provider = db?.provider ?? "pglite";
2068
2076
 
@@ -2296,7 +2304,7 @@ function createActivePgliteLockError(dataDir: string, err: unknown): Error {
2296
2304
  );
2297
2305
  }
2298
2306
 
2299
- function resolveActivePgliteDataDir(config: MiladyConfig): string | null {
2307
+ function resolveActivePgliteDataDir(config: ElizaConfig): string | null {
2300
2308
  const provider = config.database?.provider ?? "pglite";
2301
2309
  if (provider === "postgres") return null;
2302
2310
 
@@ -2338,7 +2346,7 @@ async function resetPgliteDataDir(dataDir: string): Promise<void> {
2338
2346
 
2339
2347
  async function initializeDatabaseAdapter(
2340
2348
  runtime: AgentRuntime,
2341
- config: MiladyConfig,
2349
+ config: ElizaConfig,
2342
2350
  ): Promise<void> {
2343
2351
  if (!runtime.adapter || (await runtime.adapter.isReady())) return;
2344
2352
 
@@ -2392,7 +2400,7 @@ async function initializeDatabaseAdapter(
2392
2400
  * Verify PGlite data directory contains files after init.
2393
2401
  * Warns if the directory is empty (suggests ephemeral/in-memory fallback).
2394
2402
  */
2395
- async function verifyPgliteDataDir(config: MiladyConfig): Promise<void> {
2403
+ async function verifyPgliteDataDir(config: ElizaConfig): Promise<void> {
2396
2404
  const pgliteDataDir = resolveActivePgliteDataDir(config);
2397
2405
  if (!pgliteDataDir || !existsSync(pgliteDataDir)) return;
2398
2406
 
@@ -2668,7 +2676,7 @@ export function installRuntimeMethodBindings(runtime: AgentRuntime): void {
2668
2676
  // to create the same entity in rapid succession; plugin-sql's batch insert is
2669
2677
  // non-idempotent and can fail entire writes on duplicate/conflicting rows.
2670
2678
  if (!runtimeWithBindings.__miladyEntityWriteDiagnosticsInstalled) {
2671
- type CreateEntitiesFn = (entities: Entity[]) => Promise<boolean>;
2679
+ type CreateEntitiesFn = (entities: Entity[]) => Promise<UUID[] | boolean>;
2672
2680
  type GetEntitiesByIdsFn = (entityIds: UUID[]) => Promise<Entity[]>;
2673
2681
  type EnsureEntityExistsFn = (entity: Entity) => Promise<boolean>;
2674
2682
  const runtimeWithEntityWrites = runtime as AgentRuntime & {
@@ -2796,7 +2804,7 @@ function installActionAliases(runtime: AgentRuntime): void {
2796
2804
  async function registerSqlPluginWithRecovery(
2797
2805
  runtime: AgentRuntime,
2798
2806
  sqlPlugin: ResolvedPlugin,
2799
- config: MiladyConfig,
2807
+ config: ElizaConfig,
2800
2808
  ): Promise<void> {
2801
2809
  let registerError: unknown = null;
2802
2810
 
@@ -2857,7 +2865,7 @@ async function registerSqlPluginWithRecovery(
2857
2865
  * here for the initial bootstrap.
2858
2866
  */
2859
2867
  /** @internal Exported for testing. */
2860
- export function buildCharacterFromConfig(config: MiladyConfig): Character {
2868
+ export function buildCharacterFromConfig(config: ElizaConfig): Character {
2861
2869
  // Resolve name: agents list → ui assistant → "Milady"
2862
2870
  const agentEntry = config.agents?.list?.[0];
2863
2871
  const name = agentEntry?.name ?? config.ui?.assistant?.name ?? "Milady";
@@ -3014,7 +3022,7 @@ export function buildCharacterFromConfig(config: MiladyConfig): Character {
3014
3022
  * plugin is loaded).
3015
3023
  */
3016
3024
  /** @internal Exported for testing. */
3017
- export function resolvePrimaryModel(config: MiladyConfig): string | undefined {
3025
+ export function resolvePrimaryModel(config: ElizaConfig): string | undefined {
3018
3026
  const modelConfig = config.agents?.defaults?.model;
3019
3027
  if (!modelConfig) return undefined;
3020
3028
 
@@ -3028,7 +3036,7 @@ export function resolvePrimaryModel(config: MiladyConfig): string | undefined {
3028
3036
  * This avoids background capture loops during normal app startup.
3029
3037
  */
3030
3038
  export function resolveVisionModeSetting(
3031
- config: MiladyConfig,
3039
+ config: ElizaConfig,
3032
3040
  env: NodeJS.ProcessEnv = process.env,
3033
3041
  ): string | undefined {
3034
3042
  const explicitMode = env.VISION_MODE?.trim();
@@ -3065,7 +3073,7 @@ import { STYLE_PRESETS } from "../onboarding-presets";
3065
3073
  *
3066
3074
  * Subsequent runs skip this entirely.
3067
3075
  */
3068
- async function runFirstTimeSetup(config: MiladyConfig): Promise<MiladyConfig> {
3076
+ async function runFirstTimeSetup(config: ElizaConfig): Promise<ElizaConfig> {
3069
3077
  const agentEntry = config.agents?.list?.[0];
3070
3078
  const hasName = Boolean(agentEntry?.name || config.ui?.assistant?.name);
3071
3079
  if (hasName) return config;
@@ -3507,7 +3515,7 @@ async function runFirstTimeSetup(config: MiladyConfig): Promise<MiladyConfig> {
3507
3515
  ...existingList.slice(1),
3508
3516
  ];
3509
3517
 
3510
- const updated: MiladyConfig = {
3518
+ const updated: ElizaConfig = {
3511
3519
  ...config,
3512
3520
  agents: {
3513
3521
  ...config.agents,
@@ -3568,7 +3576,7 @@ async function runFirstTimeSetup(config: MiladyConfig): Promise<MiladyConfig> {
3568
3576
  }
3569
3577
 
3570
3578
  try {
3571
- saveMiladyConfig(updated);
3579
+ saveElizaConfig(updated);
3572
3580
  } catch (err) {
3573
3581
  // Non-fatal: the agent can still start, but choices won't persist.
3574
3582
  clack.log.warn(`Could not save config: ${formatError(err)}`);
@@ -3700,15 +3708,15 @@ export async function startEliza(
3700
3708
  addLogListener(logToChatListener);
3701
3709
 
3702
3710
  // 1. Load Milady config from ~/.milady/milady.json
3703
- let config: MiladyConfig;
3711
+ let config: ElizaConfig;
3704
3712
  try {
3705
- config = loadMiladyConfig();
3713
+ config = loadElizaConfig();
3706
3714
  } catch (err) {
3707
3715
  if ((err as NodeJS.ErrnoException).code === "ENOENT") {
3708
3716
  logger.warn("[milady] No config found, using defaults");
3709
- // All MiladyConfig fields are optional, so an empty object is
3717
+ // All ElizaConfig fields are optional, so an empty object is
3710
3718
  // structurally valid. The `as` cast is safe here.
3711
- config = {} as MiladyConfig;
3719
+ config = {} as ElizaConfig;
3712
3720
  } else {
3713
3721
  throw err;
3714
3722
  }
@@ -3863,9 +3871,9 @@ export async function startEliza(
3863
3871
 
3864
3872
  // 5. Create the Milady bridge plugin (workspace context + session keys + compaction)
3865
3873
  const agentId = character.name?.toLowerCase().replace(/\s+/g, "-") ?? "main";
3866
- const miladyPlugin = createMiladyPlugin({
3874
+ const miladyPlugin = createElizaPlugin({
3867
3875
  workspaceDir,
3868
- bootstrapMaxChars: config.agents?.defaults?.bootstrapMaxChars,
3876
+
3869
3877
 
3870
3878
  agentId,
3871
3879
  });
@@ -4451,7 +4459,7 @@ export async function startEliza(
4451
4459
  }
4452
4460
 
4453
4461
  // Reload config from disk (updated by API)
4454
- const freshConfig = loadMiladyConfig();
4462
+ const freshConfig = loadElizaConfig();
4455
4463
 
4456
4464
  // Propagate secrets & cloud config into process.env so plugins
4457
4465
  // (especially plugin-elizacloud) can discover them. The initial
@@ -4485,10 +4493,10 @@ export async function startEliza(
4485
4493
  const freshCharacter = buildCharacterFromConfig(freshConfig);
4486
4494
 
4487
4495
  // Recreate Milady plugin with fresh workspace
4488
- const freshMiladyPlugin = createMiladyPlugin({
4496
+ const freshMiladyPlugin = createElizaPlugin({
4489
4497
  workspaceDir:
4490
4498
  freshConfig.agents?.defaults?.workspace ?? workspaceDir,
4491
- bootstrapMaxChars: freshConfig.agents?.defaults?.bootstrapMaxChars,
4499
+
4492
4500
 
4493
4501
  agentId:
4494
4502
  freshCharacter.name?.toLowerCase().replace(/\s+/g, "-") ?? "main",
@@ -4840,7 +4848,7 @@ export async function startEliza(
4840
4848
  * Skips all local runtime construction (plugins, database, etc.).
4841
4849
  */
4842
4850
  export async function startInCloudMode(
4843
- config: MiladyConfig,
4851
+ config: ElizaConfig,
4844
4852
  agentId: string,
4845
4853
  opts?: StartElizaOptions,
4846
4854
  ): Promise<AgentRuntime | undefined> {
@@ -144,8 +144,8 @@ async function isAutonomyServiceAvailable(
144
144
  runtime: IAgentRuntime,
145
145
  ): Promise<boolean> {
146
146
  const svc =
147
- runtime.getService<Service & AutonomyServiceLike>("autonomy") ??
148
- runtime.getService<Service & AutonomyServiceLike>("AUTONOMY");
147
+ (await runtime.getService<Service & AutonomyServiceLike>("autonomy")) ??
148
+ (await runtime.getService<Service & AutonomyServiceLike>("AUTONOMY"));
149
149
  return typeof svc?.injectAutonomousInstruction === "function";
150
150
  }
151
151