@elizaos/core 1.6.3-alpha.6 → 1.6.3-alpha.8
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.
- package/dist/browser/index.browser.js +80 -80
- package/dist/browser/index.browser.js.map +7 -6
- package/dist/node/index.node.js +53 -14
- package/dist/node/index.node.js.map +7 -6
- package/dist/runtime.d.ts.map +1 -1
- package/dist/settings.d.ts.map +1 -1
- package/dist/utils/buffer.d.ts.map +1 -1
- package/dist/utils/crypto-compat.d.ts +184 -0
- package/dist/utils/crypto-compat.d.ts.map +1 -0
- package/package.json +2 -2
package/dist/node/index.node.js
CHANGED
|
@@ -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
|
-
|
|
42301
|
-
|
|
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);
|
|
@@ -45204,6 +45199,7 @@ class AgentRuntime {
|
|
|
45204
45199
|
actionStatus: statusText,
|
|
45205
45200
|
actionId,
|
|
45206
45201
|
type: "agent_action",
|
|
45202
|
+
thought: actionPlan?.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 =
|
|
46670
|
+
const key = createHash("sha256").update(salt).digest().slice(0, 32);
|
|
46632
46671
|
const iv = BufferUtils.randomBytes(16);
|
|
46633
|
-
const cipher =
|
|
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 =
|
|
46663
|
-
const decipher =
|
|
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=
|
|
47753
|
+
//# debugId=577C4F575E2530C564756E2164756E21
|
|
47715
47754
|
//# sourceMappingURL=index.node.js.map
|