@elizaos/core 1.6.3-alpha.1 → 1.6.3-alpha.10

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.
@@ -42290,15 +42290,10 @@ function byteLength(buffer) {
42290
42290
  return buffer.length;
42291
42291
  }
42292
42292
  function randomBytes(size) {
42293
- if (hasNativeBuffer()) {
42294
- try {
42295
- const crypto = __require("crypto");
42296
- return crypto.randomBytes(size);
42297
- } catch {}
42298
- }
42299
42293
  const bytes = new Uint8Array(size);
42300
- if (typeof globalThis !== "undefined" && globalThis.crypto && globalThis.crypto.getRandomValues) {
42301
- globalThis.crypto.getRandomValues(bytes);
42294
+ const cryptoGlobal = typeof globalThis !== "undefined" ? globalThis.crypto || globalThis.webcrypto : undefined;
42295
+ if (cryptoGlobal && typeof cryptoGlobal.getRandomValues === "function") {
42296
+ cryptoGlobal.getRandomValues(bytes);
42302
42297
  } else {
42303
42298
  for (let i = 0;i < size; i++) {
42304
42299
  bytes[i] = Math.floor(Math.random() * 256);
@@ -44980,8 +44975,8 @@ class AgentRuntime {
44980
44975
  const parentRunId = this.getCurrentRunId();
44981
44976
  const runId = this.createRunId();
44982
44977
  let actionPlan = null;
44978
+ const thought = responses[0]?.content?.thought || `Executing ${allActions.length} actions: ${allActions.join(", ")}`;
44983
44979
  if (hasMultipleActions) {
44984
- const thought = responses[0]?.content?.thought || `Executing ${allActions.length} actions: ${allActions.join(", ")}`;
44985
44980
  actionPlan = {
44986
44981
  runId,
44987
44982
  totalSteps: allActions.length,
@@ -45120,7 +45115,7 @@ class AgentRuntime {
45120
45115
  actionId,
45121
45116
  runId,
45122
45117
  type: "agent_action",
45123
- thought: actionPlan?.thought,
45118
+ thought,
45124
45119
  source: message.content?.source
45125
45120
  }
45126
45121
  });
@@ -45204,6 +45199,7 @@ class AgentRuntime {
45204
45199
  actionStatus: statusText,
45205
45200
  actionId,
45206
45201
  type: "agent_action",
45202
+ thought,
45207
45203
  actionResult,
45208
45204
  source: message.content?.source
45209
45205
  }
@@ -46562,8 +46558,51 @@ async function setDefaultSecretsFromEnv(character) {
46562
46558
  }
46563
46559
 
46564
46560
  // src/settings.ts
46565
- var import_crypto_browserify = __toESM(require_crypto_browserify(), 1);
46566
46561
  init_environment();
46562
+
46563
+ // src/utils/crypto-compat.ts
46564
+ function hasNodeCrypto() {
46565
+ try {
46566
+ return typeof process !== "undefined" && (process.versions?.node !== undefined || process.versions?.bun !== undefined);
46567
+ } catch {
46568
+ return false;
46569
+ }
46570
+ }
46571
+ function getCryptoModule() {
46572
+ if (hasNodeCrypto()) {
46573
+ return __require("crypto");
46574
+ }
46575
+ return require_crypto_browserify();
46576
+ }
46577
+ function createHash(algorithm) {
46578
+ const crypto = getCryptoModule();
46579
+ const hash = crypto.createHash(algorithm);
46580
+ return {
46581
+ update(data2) {
46582
+ hash.update(data2);
46583
+ return this;
46584
+ },
46585
+ digest() {
46586
+ return new Uint8Array(hash.digest());
46587
+ }
46588
+ };
46589
+ }
46590
+ function createCipheriv(algorithm, key, iv) {
46591
+ if (algorithm !== "aes-256-cbc") {
46592
+ throw new Error(`Unsupported algorithm: ${algorithm}. Only 'aes-256-cbc' is currently supported.`);
46593
+ }
46594
+ const crypto = getCryptoModule();
46595
+ return crypto.createCipheriv(algorithm, key, iv);
46596
+ }
46597
+ function createDecipheriv(algorithm, key, iv) {
46598
+ if (algorithm !== "aes-256-cbc") {
46599
+ throw new Error(`Unsupported algorithm: ${algorithm}. Only 'aes-256-cbc' is currently supported.`);
46600
+ }
46601
+ const crypto = getCryptoModule();
46602
+ return crypto.createDecipheriv(algorithm, key, iv);
46603
+ }
46604
+
46605
+ // src/settings.ts
46567
46606
  function createSettingFromConfig(configSetting) {
46568
46607
  return {
46569
46608
  name: configSetting.name,
@@ -46628,9 +46667,9 @@ function encryptStringValue(value, salt) {
46628
46667
  }
46629
46668
  } catch (e) {}
46630
46669
  }
46631
- const key = import_crypto_browserify.default.createHash("sha256").update(salt).digest().slice(0, 32);
46670
+ const key = createHash("sha256").update(salt).digest().slice(0, 32);
46632
46671
  const iv = BufferUtils.randomBytes(16);
46633
- const cipher = import_crypto_browserify.default.createCipheriv("aes-256-cbc", key, iv);
46672
+ const cipher = createCipheriv("aes-256-cbc", key, iv);
46634
46673
  let encrypted = cipher.update(value, "utf8", "hex");
46635
46674
  encrypted += cipher.final("hex");
46636
46675
  return `${BufferUtils.toHex(iv)}:${encrypted}`;
@@ -46659,8 +46698,8 @@ function decryptStringValue(value, salt) {
46659
46698
  }
46660
46699
  return value;
46661
46700
  }
46662
- const key = import_crypto_browserify.default.createHash("sha256").update(salt).digest().slice(0, 32);
46663
- const decipher = import_crypto_browserify.default.createDecipheriv("aes-256-cbc", key, iv);
46701
+ const key = createHash("sha256").update(salt).digest().slice(0, 32);
46702
+ const decipher = createDecipheriv("aes-256-cbc", key, iv);
46664
46703
  let decrypted = decipher.update(encrypted, "hex", "utf8");
46665
46704
  decrypted += decipher.final("utf8");
46666
46705
  return decrypted;
@@ -47711,5 +47750,5 @@ export {
47711
47750
  AgentRuntime
47712
47751
  };
47713
47752
 
47714
- //# debugId=738C38AE1C103AEB64756E2164756E21
47753
+ //# debugId=5B2BFEA477B6A8E064756E2164756E21
47715
47754
  //# sourceMappingURL=index.node.js.map