@elizaos/core 1.6.4-alpha.17 → 1.6.4-alpha.19

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.
@@ -44796,6 +44796,24 @@ class AgentRuntime {
44796
44796
  const errorMsg = `Agent ${this.agentId} does not exist in database after ensureAgentExists call`;
44797
44797
  throw new Error(errorMsg);
44798
44798
  }
44799
+ if (existingAgent.settings) {
44800
+ this.character.settings = {
44801
+ ...existingAgent.settings,
44802
+ ...this.character.settings
44803
+ };
44804
+ const dbSecrets = existingAgent.settings.secrets && typeof existingAgent.settings.secrets === "object" ? existingAgent.settings.secrets : {};
44805
+ const settingsSecrets = this.character.settings.secrets && typeof this.character.settings.secrets === "object" ? this.character.settings.secrets : {};
44806
+ const characterSecrets = this.character.secrets && typeof this.character.secrets === "object" ? this.character.secrets : {};
44807
+ const mergedSecrets = {
44808
+ ...dbSecrets,
44809
+ ...characterSecrets,
44810
+ ...settingsSecrets
44811
+ };
44812
+ if (Object.keys(mergedSecrets).length > 0) {
44813
+ this.character.secrets = mergedSecrets;
44814
+ this.character.settings.secrets = mergedSecrets;
44815
+ }
44816
+ }
44799
44817
  let agentEntity = await this.getEntityById(this.agentId);
44800
44818
  if (!agentEntity) {
44801
44819
  const created = await this.createEntity({
@@ -46136,8 +46154,21 @@ ${input}`;
46136
46154
  }
46137
46155
  const existingAgent = await this.adapter.getAgent(agent.id);
46138
46156
  if (existingAgent) {
46157
+ const mergedSettings = {
46158
+ ...existingAgent.settings,
46159
+ ...agent.settings
46160
+ };
46161
+ const mergedSecrets = typeof existingAgent.settings?.secrets === "object" || typeof agent.settings?.secrets === "object" ? {
46162
+ ...typeof existingAgent.settings?.secrets === "object" ? existingAgent.settings.secrets : {},
46163
+ ...typeof agent.settings?.secrets === "object" ? agent.settings.secrets : {}
46164
+ } : undefined;
46165
+ if (mergedSecrets) {
46166
+ mergedSettings.secrets = mergedSecrets;
46167
+ }
46139
46168
  const updatedAgent = {
46169
+ ...existingAgent,
46140
46170
  ...agent,
46171
+ settings: mergedSettings,
46141
46172
  id: agent.id,
46142
46173
  updatedAt: Date.now()
46143
46174
  };
@@ -46146,7 +46177,7 @@ ${input}`;
46146
46177
  if (!refreshedAgent) {
46147
46178
  throw new Error(`Failed to retrieve agent after update: ${agent.id}`);
46148
46179
  }
46149
- this.logger.debug(`Updated existing agent ${agent.id} on restart`);
46180
+ this.logger.debug(`Updated existing agent ${agent.id} on restart (merged ${Object.keys(existingAgent.settings || {}).length} DB settings with ${Object.keys(agent.settings || {}).length} character settings)`);
46150
46181
  return refreshedAgent;
46151
46182
  }
46152
46183
  const newAgent = {
@@ -47807,5 +47838,5 @@ export {
47807
47838
  AgentRuntime
47808
47839
  };
47809
47840
 
47810
- //# debugId=4E565CEFA615D99864756E2164756E21
47841
+ //# debugId=FE7D7B8D69AC4A2264756E2164756E21
47811
47842
  //# sourceMappingURL=index.node.js.map