@elizaos/core 1.6.4 → 1.6.5-alpha.2

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.
@@ -25,7 +25,6 @@ var __export = (target, all) => {
25
25
  set: (newValue) => all[name] = () => newValue
26
26
  });
27
27
  };
28
- var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
29
28
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
30
29
 
31
30
  // ../../node_modules/retry/lib/retry_operation.js
@@ -9834,217 +9833,6 @@ Length provided: ${this.length}. Number of dictionaries provided: ${this.diction
9834
9833
  };
9835
9834
  });
9836
9835
 
9837
- // src/utils/environment.ts
9838
- var exports_environment = {};
9839
- __export(exports_environment, {
9840
- setEnv: () => setEnv,
9841
- loadEnvConfig: () => loadEnvConfig,
9842
- initBrowserEnvironment: () => initBrowserEnvironment,
9843
- hasEnv: () => hasEnv,
9844
- getNumberEnv: () => getNumberEnv,
9845
- getEnvironment: () => getEnvironment,
9846
- getEnv: () => getEnv3,
9847
- getBooleanEnv: () => getBooleanEnv,
9848
- findEnvFile: () => findEnvFile,
9849
- detectEnvironment: () => detectEnvironment,
9850
- currentRuntime: () => currentRuntime,
9851
- Environment: () => Environment
9852
- });
9853
- function detectEnvironment() {
9854
- if (typeof process !== "undefined" && process.versions && process.versions.node) {
9855
- return "node";
9856
- }
9857
- if (typeof globalThis !== "undefined" && typeof globalThis.window !== "undefined" && typeof globalThis.window.document !== "undefined") {
9858
- return "browser";
9859
- }
9860
- return "unknown";
9861
- }
9862
-
9863
- class BrowserEnvironmentStore {
9864
- store = {};
9865
- constructor() {
9866
- if (typeof globalThis !== "undefined" && globalThis.window && globalThis.window.ENV) {
9867
- this.store = { ...globalThis.window.ENV };
9868
- }
9869
- if (typeof globalThis !== "undefined" && globalThis.__ENV__) {
9870
- this.store = { ...this.store, ...globalThis.__ENV__ };
9871
- }
9872
- }
9873
- get(key) {
9874
- const value = this.store[key];
9875
- return value !== undefined ? String(value) : undefined;
9876
- }
9877
- set(key, value) {
9878
- this.store[key] = value;
9879
- }
9880
- has(key) {
9881
- return key in this.store;
9882
- }
9883
- getAll() {
9884
- return { ...this.store };
9885
- }
9886
- }
9887
-
9888
- class Environment {
9889
- runtime;
9890
- browserStore;
9891
- cache = new Map;
9892
- constructor() {
9893
- this.runtime = detectEnvironment();
9894
- if (this.runtime === "browser") {
9895
- this.browserStore = new BrowserEnvironmentStore;
9896
- }
9897
- }
9898
- getRuntime() {
9899
- return this.runtime;
9900
- }
9901
- isNode() {
9902
- return this.runtime === "node";
9903
- }
9904
- isBrowser() {
9905
- return this.runtime === "browser";
9906
- }
9907
- get(key, defaultValue) {
9908
- if (this.cache.has(key)) {
9909
- const cached = this.cache.get(key);
9910
- return cached === undefined && defaultValue !== undefined ? defaultValue : cached;
9911
- }
9912
- let value;
9913
- switch (this.runtime) {
9914
- case "node":
9915
- if (typeof process !== "undefined" && process.env) {
9916
- value = process.env[key];
9917
- }
9918
- break;
9919
- case "browser":
9920
- if (this.browserStore) {
9921
- value = this.browserStore.get(key);
9922
- }
9923
- break;
9924
- default:
9925
- value = undefined;
9926
- }
9927
- this.cache.set(key, value);
9928
- return value === undefined && defaultValue !== undefined ? defaultValue : value;
9929
- }
9930
- set(key, value) {
9931
- const stringValue = String(value);
9932
- this.cache.delete(key);
9933
- switch (this.runtime) {
9934
- case "node":
9935
- if (typeof process !== "undefined" && process.env) {
9936
- process.env[key] = stringValue;
9937
- }
9938
- break;
9939
- case "browser":
9940
- if (this.browserStore) {
9941
- this.browserStore.set(key, value);
9942
- }
9943
- break;
9944
- }
9945
- }
9946
- has(key) {
9947
- const value = this.get(key);
9948
- return value !== undefined;
9949
- }
9950
- getAll() {
9951
- switch (this.runtime) {
9952
- case "node":
9953
- if (typeof process !== "undefined" && process.env) {
9954
- return { ...process.env };
9955
- }
9956
- break;
9957
- case "browser":
9958
- if (this.browserStore) {
9959
- return this.browserStore.getAll();
9960
- }
9961
- break;
9962
- }
9963
- return {};
9964
- }
9965
- getBoolean(key, defaultValue = false) {
9966
- const value = this.get(key);
9967
- if (value === undefined) {
9968
- return defaultValue;
9969
- }
9970
- return ["true", "1", "yes", "on"].includes(value.toLowerCase());
9971
- }
9972
- getNumber(key, defaultValue) {
9973
- const value = this.get(key);
9974
- if (value === undefined) {
9975
- return defaultValue;
9976
- }
9977
- const parsed = Number(value);
9978
- return isNaN(parsed) ? defaultValue : parsed;
9979
- }
9980
- clearCache() {
9981
- this.cache.clear();
9982
- }
9983
- }
9984
- function getEnvironment() {
9985
- if (!environmentInstance) {
9986
- environmentInstance = new Environment;
9987
- }
9988
- return environmentInstance;
9989
- }
9990
- function getEnv3(key, defaultValue) {
9991
- return getEnvironment().get(key, defaultValue);
9992
- }
9993
- function setEnv(key, value) {
9994
- getEnvironment().set(key, value);
9995
- }
9996
- function hasEnv(key) {
9997
- return getEnvironment().has(key);
9998
- }
9999
- function getBooleanEnv(key, defaultValue = false) {
10000
- return getEnvironment().getBoolean(key, defaultValue);
10001
- }
10002
- function getNumberEnv(key, defaultValue) {
10003
- return getEnvironment().getNumber(key, defaultValue);
10004
- }
10005
- function initBrowserEnvironment(config) {
10006
- const env = getEnvironment();
10007
- if (env.isBrowser()) {
10008
- Object.entries(config).forEach(([key, value]) => {
10009
- if (value !== undefined) {
10010
- env.set(key, value);
10011
- }
10012
- });
10013
- }
10014
- }
10015
- function findEnvFile() {
10016
- if (typeof process === "undefined" || !process.cwd) {
10017
- return null;
10018
- }
10019
- const fs = __require("node:fs");
10020
- const path = __require("node:path");
10021
- const possiblePaths = [path.join(process.cwd(), ".env"), path.join(process.cwd(), ".env.local")];
10022
- for (const envPath of possiblePaths) {
10023
- if (fs.existsSync(envPath)) {
10024
- return envPath;
10025
- }
10026
- }
10027
- return null;
10028
- }
10029
- async function loadEnvConfig(envPath) {
10030
- if (typeof process === "undefined" || !process.cwd) {
10031
- return {};
10032
- }
10033
- const dotenv = __require("dotenv");
10034
- const resolvedPath = envPath || findEnvFile();
10035
- if (resolvedPath) {
10036
- const result = dotenv.config({ path: resolvedPath });
10037
- if (result.error) {
10038
- throw result.error;
10039
- }
10040
- }
10041
- return process.env;
10042
- }
10043
- var environmentInstance = null, currentRuntime;
10044
- var init_environment = __esm(() => {
10045
- currentRuntime = detectEnvironment();
10046
- });
10047
-
10048
9836
  // ../../node_modules/picocolors/picocolors.js
10049
9837
  var require_picocolors = __commonJS((exports, module) => {
10050
9838
  var p = process || {};
@@ -25990,7 +25778,7 @@ var getDefaultProjectName = () => {
25990
25778
  };
25991
25779
 
25992
25780
  // ../../node_modules/langsmith/dist/index.js
25993
- var __version__ = "0.3.78";
25781
+ var __version__ = "0.3.79";
25994
25782
 
25995
25783
  // ../../node_modules/langsmith/dist/utils/env.js
25996
25784
  var globalEnv;
@@ -39317,8 +39105,218 @@ var import_handlebars = __toESM(require_lib(), 1);
39317
39105
  var import_unique_names_generator = __toESM(require_dist4(), 1);
39318
39106
  import { z as z2 } from "zod";
39319
39107
 
39320
- // src/logger.ts
39321
- init_environment();
39108
+ // src/utils/environment.ts
39109
+ function detectEnvironment() {
39110
+ if (typeof process !== "undefined" && process.versions && process.versions.node) {
39111
+ return "node";
39112
+ }
39113
+ if (typeof globalThis !== "undefined" && typeof globalThis.window !== "undefined" && typeof globalThis.window.document !== "undefined") {
39114
+ return "browser";
39115
+ }
39116
+ return "unknown";
39117
+ }
39118
+
39119
+ class BrowserEnvironmentStore {
39120
+ store = {};
39121
+ constructor() {
39122
+ if (typeof globalThis !== "undefined" && globalThis.window && globalThis.window.ENV) {
39123
+ this.store = { ...globalThis.window.ENV };
39124
+ }
39125
+ if (typeof globalThis !== "undefined" && globalThis.__ENV__) {
39126
+ this.store = { ...this.store, ...globalThis.__ENV__ };
39127
+ }
39128
+ }
39129
+ get(key) {
39130
+ const value = this.store[key];
39131
+ return value !== undefined ? String(value) : undefined;
39132
+ }
39133
+ set(key, value) {
39134
+ this.store[key] = value;
39135
+ }
39136
+ has(key) {
39137
+ return key in this.store;
39138
+ }
39139
+ getAll() {
39140
+ return { ...this.store };
39141
+ }
39142
+ }
39143
+
39144
+ class Environment {
39145
+ runtime;
39146
+ browserStore;
39147
+ cache = new Map;
39148
+ constructor() {
39149
+ this.runtime = detectEnvironment();
39150
+ if (this.runtime === "browser") {
39151
+ this.browserStore = new BrowserEnvironmentStore;
39152
+ }
39153
+ }
39154
+ getRuntime() {
39155
+ return this.runtime;
39156
+ }
39157
+ isNode() {
39158
+ return this.runtime === "node";
39159
+ }
39160
+ isBrowser() {
39161
+ return this.runtime === "browser";
39162
+ }
39163
+ get(key, defaultValue) {
39164
+ if (this.cache.has(key)) {
39165
+ const cached = this.cache.get(key);
39166
+ return cached === undefined && defaultValue !== undefined ? defaultValue : cached;
39167
+ }
39168
+ let value;
39169
+ switch (this.runtime) {
39170
+ case "node":
39171
+ if (typeof process !== "undefined" && process.env) {
39172
+ value = process.env[key];
39173
+ }
39174
+ break;
39175
+ case "browser":
39176
+ if (this.browserStore) {
39177
+ value = this.browserStore.get(key);
39178
+ }
39179
+ break;
39180
+ default:
39181
+ value = undefined;
39182
+ }
39183
+ this.cache.set(key, value);
39184
+ return value === undefined && defaultValue !== undefined ? defaultValue : value;
39185
+ }
39186
+ set(key, value) {
39187
+ const stringValue = String(value);
39188
+ this.cache.delete(key);
39189
+ switch (this.runtime) {
39190
+ case "node":
39191
+ if (typeof process !== "undefined" && process.env) {
39192
+ process.env[key] = stringValue;
39193
+ }
39194
+ break;
39195
+ case "browser":
39196
+ if (this.browserStore) {
39197
+ this.browserStore.set(key, value);
39198
+ }
39199
+ break;
39200
+ }
39201
+ }
39202
+ has(key) {
39203
+ const value = this.get(key);
39204
+ return value !== undefined;
39205
+ }
39206
+ getAll() {
39207
+ switch (this.runtime) {
39208
+ case "node":
39209
+ if (typeof process !== "undefined" && process.env) {
39210
+ return { ...process.env };
39211
+ }
39212
+ break;
39213
+ case "browser":
39214
+ if (this.browserStore) {
39215
+ return this.browserStore.getAll();
39216
+ }
39217
+ break;
39218
+ }
39219
+ return {};
39220
+ }
39221
+ getBoolean(key, defaultValue = false) {
39222
+ const value = this.get(key);
39223
+ if (value === undefined) {
39224
+ return defaultValue;
39225
+ }
39226
+ return ["true", "1", "yes", "on"].includes(value.toLowerCase());
39227
+ }
39228
+ getNumber(key, defaultValue) {
39229
+ const value = this.get(key);
39230
+ if (value === undefined) {
39231
+ return defaultValue;
39232
+ }
39233
+ const parsed = Number(value);
39234
+ return isNaN(parsed) ? defaultValue : parsed;
39235
+ }
39236
+ clearCache() {
39237
+ this.cache.clear();
39238
+ }
39239
+ }
39240
+ var environmentInstance = null;
39241
+ function getEnvironment() {
39242
+ if (!environmentInstance) {
39243
+ environmentInstance = new Environment;
39244
+ }
39245
+ return environmentInstance;
39246
+ }
39247
+ function getEnv3(key, defaultValue) {
39248
+ return getEnvironment().get(key, defaultValue);
39249
+ }
39250
+ function setEnv(key, value) {
39251
+ getEnvironment().set(key, value);
39252
+ }
39253
+ function hasEnv(key) {
39254
+ return getEnvironment().has(key);
39255
+ }
39256
+ function getBooleanEnv(key, defaultValue = false) {
39257
+ return getEnvironment().getBoolean(key, defaultValue);
39258
+ }
39259
+ function getNumberEnv(key, defaultValue) {
39260
+ return getEnvironment().getNumber(key, defaultValue);
39261
+ }
39262
+ function initBrowserEnvironment(config) {
39263
+ const env = getEnvironment();
39264
+ if (env.isBrowser()) {
39265
+ Object.entries(config).forEach(([key, value]) => {
39266
+ if (value !== undefined) {
39267
+ env.set(key, value);
39268
+ }
39269
+ });
39270
+ }
39271
+ }
39272
+ var currentRuntime = detectEnvironment();
39273
+ function findEnvFile(startDir, filenames = [".env", ".env.local"]) {
39274
+ if (typeof process === "undefined" || !process.cwd) {
39275
+ return null;
39276
+ }
39277
+ const fs = __require("node:fs");
39278
+ const path = __require("node:path");
39279
+ let currentDir = startDir || process.cwd();
39280
+ while (true) {
39281
+ for (const filename of filenames) {
39282
+ const candidate = path.join(currentDir, filename);
39283
+ if (fs.existsSync(candidate)) {
39284
+ return candidate;
39285
+ }
39286
+ }
39287
+ const parentDir = path.dirname(currentDir);
39288
+ if (parentDir === currentDir) {
39289
+ break;
39290
+ }
39291
+ currentDir = parentDir;
39292
+ }
39293
+ return null;
39294
+ }
39295
+ function loadEnvFile(envPath) {
39296
+ if (typeof process === "undefined" || !process.cwd) {
39297
+ return false;
39298
+ }
39299
+ try {
39300
+ const dotenv = __require("dotenv");
39301
+ const resolvedPath = envPath || findEnvFile();
39302
+ if (!resolvedPath) {
39303
+ return false;
39304
+ }
39305
+ const result = dotenv.config({ path: resolvedPath });
39306
+ if (result.error) {
39307
+ if (typeof console !== "undefined" && console.warn) {
39308
+ console.warn(`Failed to parse .env file at ${resolvedPath}:`, result.error);
39309
+ }
39310
+ return false;
39311
+ }
39312
+ return true;
39313
+ } catch (error) {
39314
+ if (typeof console !== "undefined" && console.warn) {
39315
+ console.warn("Failed to load .env file:", error);
39316
+ }
39317
+ return false;
39318
+ }
39319
+ }
39322
39320
  // ../../node_modules/adze/dist/tools.js
39323
39321
  class Tools {
39324
39322
  globalStore;
@@ -41454,7 +41452,6 @@ var recentLogs = () => globalInMemoryDestination.recentLogs();
41454
41452
  var logger_default = logger;
41455
41453
 
41456
41454
  // src/utils.ts
41457
- init_environment();
41458
41455
  function upgradeDoubleToTriple(tpl) {
41459
41456
  return tpl.replace(/(?<!{){{(?![{#\/!>])([\s\S]*?)}}/g, (_match, inner) => {
41460
41457
  if (inner.trim() === "else")
@@ -42166,10 +42163,6 @@ function parseAndValidateCharacter(jsonString) {
42166
42163
  function isValidCharacter(data2) {
42167
42164
  return validateCharacter(data2).success;
42168
42165
  }
42169
-
42170
- // src/index.node.ts
42171
- init_environment();
42172
-
42173
42166
  // src/utils/buffer.ts
42174
42167
  function hasNativeBuffer() {
42175
42168
  return typeof Buffer !== "undefined" && typeof Buffer.from === "function";
@@ -42998,9 +42991,6 @@ function v43(options, buf, offset) {
42998
42991
  return _v4(options, buf, offset);
42999
42992
  }
43000
42993
  var v4_default = v43;
43001
- // src/runtime.ts
43002
- init_environment();
43003
-
43004
42994
  // src/services/default-message-service.ts
43005
42995
  var latestResponseIds = new Map;
43006
42996
 
@@ -46567,37 +46557,30 @@ ${input}`;
46567
46557
  }
46568
46558
 
46569
46559
  // src/secrets.ts
46570
- init_environment();
46571
46560
  function hasCharacterSecrets(character) {
46572
46561
  return Boolean(character?.settings?.secrets && Object.keys(character.settings.secrets).length > 0);
46573
46562
  }
46574
46563
  async function loadSecretsNodeImpl(character) {
46575
- const fs = await import("node:fs");
46576
- const dotenv = await import("dotenv");
46577
- const { findEnvFile: findEnvFile2 } = await Promise.resolve().then(() => (init_environment(), exports_environment));
46578
- const envPath = findEnvFile2();
46579
- if (!envPath)
46580
- return false;
46581
- try {
46582
- const buf = fs.readFileSync(envPath);
46583
- const envVars = dotenv.parse(buf);
46584
- if (!character.settings) {
46585
- character.settings = {};
46586
- }
46587
- const existingSettings = { ...character.settings };
46588
- const existingSecrets = character.settings.secrets && typeof character.settings.secrets === "object" ? { ...character.settings.secrets } : {};
46589
- character.settings = {
46590
- ...envVars,
46591
- ...existingSettings
46592
- };
46593
- character.settings.secrets = {
46594
- ...envVars,
46595
- ...existingSecrets
46596
- };
46597
- return true;
46598
- } catch {
46599
- return false;
46564
+ const envVars = {};
46565
+ for (const [key, value] of Object.entries(process.env)) {
46566
+ if (value !== undefined) {
46567
+ envVars[key] = value;
46568
+ }
46600
46569
  }
46570
+ if (!character.settings) {
46571
+ character.settings = {};
46572
+ }
46573
+ const existingSettings = { ...character.settings };
46574
+ const existingSecrets = character.settings.secrets && typeof character.settings.secrets === "object" ? { ...character.settings.secrets } : {};
46575
+ character.settings = {
46576
+ ...envVars,
46577
+ ...existingSettings
46578
+ };
46579
+ character.settings.secrets = {
46580
+ ...envVars,
46581
+ ...existingSecrets
46582
+ };
46583
+ return true;
46601
46584
  }
46602
46585
  async function setDefaultSecretsFromEnv(character) {
46603
46586
  const env2 = detectEnvironment();
@@ -46607,9 +46590,6 @@ async function setDefaultSecretsFromEnv(character) {
46607
46590
  return loadSecretsNodeImpl(character);
46608
46591
  }
46609
46592
 
46610
- // src/settings.ts
46611
- init_environment();
46612
-
46613
46593
  // src/utils/crypto-compat.ts
46614
46594
  function hasNodeCrypto() {
46615
46595
  try {
@@ -46930,7 +46910,6 @@ function defineService(definition) {
46930
46910
  }
46931
46911
 
46932
46912
  // src/plugin.ts
46933
- init_environment();
46934
46913
  var attemptedInstalls = new Set;
46935
46914
  function isAutoInstallAllowed() {
46936
46915
  if (process.env.ELIZA_NO_AUTO_INSTALL === "true")
@@ -47734,7 +47713,7 @@ export {
47734
47713
  mediaSchema,
47735
47714
  logger,
47736
47715
  loadPlugin,
47737
- loadEnvConfig,
47716
+ loadEnvFile,
47738
47717
  loadAndPreparePlugin,
47739
47718
  knowledgeItemSchema,
47740
47719
  isValidPluginShape,
@@ -47846,5 +47825,5 @@ export {
47846
47825
  AgentRuntime
47847
47826
  };
47848
47827
 
47849
- //# debugId=13ABC5DE829D763B64756E2164756E21
47828
+ //# debugId=ACD09762158B47C164756E2164756E21
47850
47829
  //# sourceMappingURL=index.node.js.map