@elizaos/core 1.6.5-alpha.1 → 1.6.5-alpha.3
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 +96 -96
- package/dist/browser/index.browser.js.map +19 -19
- package/dist/elizaos.d.ts +2 -49
- package/dist/elizaos.d.ts.map +1 -1
- package/dist/node/index.node.js +241 -255
- package/dist/node/index.node.js.map +12 -12
- package/dist/runtime.d.ts +10 -1
- package/dist/runtime.d.ts.map +1 -1
- package/dist/secrets.d.ts.map +1 -1
- package/dist/types/elizaos.d.ts +131 -0
- package/dist/types/elizaos.d.ts.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/runtime.d.ts +7 -1
- package/dist/types/runtime.d.ts.map +1 -1
- package/dist/utils/environment.d.ts +27 -9
- package/dist/utils/environment.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/elizaos.d.ts
CHANGED
|
@@ -1,51 +1,4 @@
|
|
|
1
|
-
import type { Character, IAgentRuntime, UUID, Memory, State, Plugin, RuntimeSettings, Content } from './types';
|
|
2
|
-
import type { MessageProcessingResult } from './services/message-service';
|
|
3
|
-
/**
|
|
4
|
-
* Options for sending a message to an agent
|
|
5
|
-
*/
|
|
6
|
-
export interface SendMessageOptions {
|
|
7
|
-
/**
|
|
8
|
-
* Called when the agent generates a response (ASYNC MODE)
|
|
9
|
-
* If provided, method returns immediately (fire & forget)
|
|
10
|
-
* If not provided, method waits for response (SYNC MODE)
|
|
11
|
-
*/
|
|
12
|
-
onResponse?: (content: Content) => Promise<void>;
|
|
13
|
-
/**
|
|
14
|
-
* Called if an error occurs during processing
|
|
15
|
-
*/
|
|
16
|
-
onError?: (error: Error) => Promise<void>;
|
|
17
|
-
/**
|
|
18
|
-
* Called when processing is complete
|
|
19
|
-
*/
|
|
20
|
-
onComplete?: () => Promise<void>;
|
|
21
|
-
/**
|
|
22
|
-
* Maximum number of retries for failed messages
|
|
23
|
-
*/
|
|
24
|
-
maxRetries?: number;
|
|
25
|
-
/**
|
|
26
|
-
* Timeout duration in milliseconds
|
|
27
|
-
*/
|
|
28
|
-
timeoutDuration?: number;
|
|
29
|
-
/**
|
|
30
|
-
* Enable multi-step message processing
|
|
31
|
-
*/
|
|
32
|
-
useMultiStep?: boolean;
|
|
33
|
-
/**
|
|
34
|
-
* Maximum multi-step iterations
|
|
35
|
-
*/
|
|
36
|
-
maxMultiStepIterations?: number;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Result of sending a message to an agent
|
|
40
|
-
*/
|
|
41
|
-
export interface SendMessageResult {
|
|
42
|
-
/** ID of the user message */
|
|
43
|
-
messageId: UUID;
|
|
44
|
-
/** The user message that was created */
|
|
45
|
-
userMessage: Memory;
|
|
46
|
-
/** Processing result (only in SYNC mode) */
|
|
47
|
-
result?: MessageProcessingResult;
|
|
48
|
-
}
|
|
1
|
+
import type { Character, IAgentRuntime, IElizaOS, UUID, Memory, State, Plugin, RuntimeSettings, Content, SendMessageOptions, SendMessageResult } from './types';
|
|
49
2
|
/**
|
|
50
3
|
* Batch operation for sending messages
|
|
51
4
|
*/
|
|
@@ -91,7 +44,7 @@ export interface AgentUpdate {
|
|
|
91
44
|
* ElizaOS - Multi-agent orchestration framework
|
|
92
45
|
* Pure JavaScript implementation for browser and Node.js compatibility
|
|
93
46
|
*/
|
|
94
|
-
export declare class ElizaOS extends EventTarget {
|
|
47
|
+
export declare class ElizaOS extends EventTarget implements IElizaOS {
|
|
95
48
|
private runtimes;
|
|
96
49
|
private initFunctions;
|
|
97
50
|
private editableMode;
|
package/dist/elizaos.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"elizaos.d.ts","sourceRoot":"","sources":["../src/elizaos.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,SAAS,EACT,aAAa,EACb,IAAI,EACJ,MAAM,EACN,KAAK,EACL,MAAM,EACN,eAA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AAC,GAAG,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;IAuBpE;;OAEG;IACH,kBAAkB,IAAI,eAAe;IAqBrC;;OAEG;IACH,kBAAkB,IAAI,IAAI;CAQ3B"}
|
package/dist/node/index.node.js
CHANGED
|
@@ -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.
|
|
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/
|
|
39321
|
-
|
|
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
|
|
|
@@ -44608,6 +44598,7 @@ class AgentRuntime {
|
|
|
44608
44598
|
taskWorkers = new Map;
|
|
44609
44599
|
sendHandlers = new Map;
|
|
44610
44600
|
eventHandlers = new Map;
|
|
44601
|
+
elizaOS;
|
|
44611
44602
|
allAvailablePlugins = new Map;
|
|
44612
44603
|
characterPlugins = [];
|
|
44613
44604
|
logger;
|
|
@@ -44768,6 +44759,7 @@ class AgentRuntime {
|
|
|
44768
44759
|
await service.stop();
|
|
44769
44760
|
}
|
|
44770
44761
|
}
|
|
44762
|
+
this.elizaOS = undefined;
|
|
44771
44763
|
}
|
|
44772
44764
|
async initialize(options) {
|
|
44773
44765
|
try {
|
|
@@ -46564,40 +46556,36 @@ ${input}`;
|
|
|
46564
46556
|
}
|
|
46565
46557
|
return await this.adapter.isReady();
|
|
46566
46558
|
}
|
|
46559
|
+
hasElizaOS() {
|
|
46560
|
+
return this.elizaOS !== undefined;
|
|
46561
|
+
}
|
|
46567
46562
|
}
|
|
46568
46563
|
|
|
46569
46564
|
// src/secrets.ts
|
|
46570
|
-
init_environment();
|
|
46571
46565
|
function hasCharacterSecrets(character) {
|
|
46572
46566
|
return Boolean(character?.settings?.secrets && Object.keys(character.settings.secrets).length > 0);
|
|
46573
46567
|
}
|
|
46574
46568
|
async function loadSecretsNodeImpl(character) {
|
|
46575
|
-
const
|
|
46576
|
-
const
|
|
46577
|
-
|
|
46578
|
-
|
|
46579
|
-
|
|
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;
|
|
46569
|
+
const envVars = {};
|
|
46570
|
+
for (const [key, value] of Object.entries(process.env)) {
|
|
46571
|
+
if (value !== undefined) {
|
|
46572
|
+
envVars[key] = value;
|
|
46573
|
+
}
|
|
46600
46574
|
}
|
|
46575
|
+
if (!character.settings) {
|
|
46576
|
+
character.settings = {};
|
|
46577
|
+
}
|
|
46578
|
+
const existingSettings = { ...character.settings };
|
|
46579
|
+
const existingSecrets = character.settings.secrets && typeof character.settings.secrets === "object" ? { ...character.settings.secrets } : {};
|
|
46580
|
+
character.settings = {
|
|
46581
|
+
...envVars,
|
|
46582
|
+
...existingSettings
|
|
46583
|
+
};
|
|
46584
|
+
character.settings.secrets = {
|
|
46585
|
+
...envVars,
|
|
46586
|
+
...existingSecrets
|
|
46587
|
+
};
|
|
46588
|
+
return true;
|
|
46601
46589
|
}
|
|
46602
46590
|
async function setDefaultSecretsFromEnv(character) {
|
|
46603
46591
|
const env2 = detectEnvironment();
|
|
@@ -46607,9 +46595,6 @@ async function setDefaultSecretsFromEnv(character) {
|
|
|
46607
46595
|
return loadSecretsNodeImpl(character);
|
|
46608
46596
|
}
|
|
46609
46597
|
|
|
46610
|
-
// src/settings.ts
|
|
46611
|
-
init_environment();
|
|
46612
|
-
|
|
46613
46598
|
// src/utils/crypto-compat.ts
|
|
46614
46599
|
function hasNodeCrypto() {
|
|
46615
46600
|
try {
|
|
@@ -46930,7 +46915,6 @@ function defineService(definition) {
|
|
|
46930
46915
|
}
|
|
46931
46916
|
|
|
46932
46917
|
// src/plugin.ts
|
|
46933
|
-
init_environment();
|
|
46934
46918
|
var attemptedInstalls = new Set;
|
|
46935
46919
|
function isAutoInstallAllowed() {
|
|
46936
46920
|
if (process.env.ELIZA_NO_AUTO_INSTALL === "true")
|
|
@@ -47200,6 +47184,7 @@ class ElizaOS extends EventTarget {
|
|
|
47200
47184
|
plugins: resolvedPlugins,
|
|
47201
47185
|
settings: agent.settings || {}
|
|
47202
47186
|
});
|
|
47187
|
+
runtime.elizaOS = this;
|
|
47203
47188
|
this.runtimes.set(runtime.agentId, runtime);
|
|
47204
47189
|
if (typeof agent.init === "function") {
|
|
47205
47190
|
this.initFunctions.set(runtime.agentId, agent.init);
|
|
@@ -47227,6 +47212,7 @@ class ElizaOS extends EventTarget {
|
|
|
47227
47212
|
if (this.runtimes.has(runtime.agentId)) {
|
|
47228
47213
|
throw new Error(`Agent ${runtime.agentId} already registered`);
|
|
47229
47214
|
}
|
|
47215
|
+
runtime.elizaOS = this;
|
|
47230
47216
|
this.runtimes.set(runtime.agentId, runtime);
|
|
47231
47217
|
this.dispatchEvent(new CustomEvent("agent:registered", {
|
|
47232
47218
|
detail: { agentId: runtime.agentId, runtime }
|
|
@@ -47734,7 +47720,7 @@ export {
|
|
|
47734
47720
|
mediaSchema,
|
|
47735
47721
|
logger,
|
|
47736
47722
|
loadPlugin,
|
|
47737
|
-
|
|
47723
|
+
loadEnvFile,
|
|
47738
47724
|
loadAndPreparePlugin,
|
|
47739
47725
|
knowledgeItemSchema,
|
|
47740
47726
|
isValidPluginShape,
|
|
@@ -47846,5 +47832,5 @@ export {
|
|
|
47846
47832
|
AgentRuntime
|
|
47847
47833
|
};
|
|
47848
47834
|
|
|
47849
|
-
//# debugId=
|
|
47835
|
+
//# debugId=971BFCC123EE1FF964756E2164756E21
|
|
47850
47836
|
//# sourceMappingURL=index.node.js.map
|