@elizaos/core 1.6.2-alpha.13 → 1.6.2-alpha.15
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 +60 -53
- package/dist/browser/index.browser.js.map +9 -9
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/node/index.node.js +109 -53
- package/dist/node/index.node.js.map +9 -9
- package/dist/runtime.d.ts +5 -1
- package/dist/runtime.d.ts.map +1 -1
- package/dist/types/model.d.ts +26 -0
- package/dist/types/model.d.ts.map +1 -1
- package/dist/types/runtime.d.ts +2 -1
- package/dist/types/runtime.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,cAAc,SAAS,CAAC;AAGxB,cAAc,SAAS,CAAC;AAGxB,cAAc,qBAAqB,CAAC;AAGpC,cAAc,qBAAqB,CAAC;AAGpC,cAAc,gBAAgB,CAAC;AAI/B,cAAc,eAAe,CAAC;AAG9B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AAGzB,cAAc,WAAW,CAAC;AAG1B,eAAO,MAAM,SAAS,SAG+B,CAAC;AACtD,eAAO,MAAM,MAAM,SAG2B,CAAC;AAG/C,cAAc,uBAAuB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,cAAc,SAAS,CAAC;AAGxB,cAAc,SAAS,CAAC;AAGxB,cAAc,qBAAqB,CAAC;AAGpC,cAAc,qBAAqB,CAAC;AAGpC,cAAc,gBAAgB,CAAC;AAI/B,cAAc,eAAe,CAAC;AAG9B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AAGzB,cAAc,WAAW,CAAC;AAG1B,eAAO,MAAM,SAAS,SAG+B,CAAC;AACtD,eAAO,MAAM,MAAM,SAG2B,CAAC;AAG/C,cAAc,uBAAuB,CAAC"}
|
package/dist/node/index.node.js
CHANGED
|
@@ -25992,7 +25992,7 @@ var getDefaultProjectName = () => {
|
|
|
25992
25992
|
};
|
|
25993
25993
|
|
|
25994
25994
|
// ../../node_modules/langsmith/dist/index.js
|
|
25995
|
-
var __version__ = "0.3.
|
|
25995
|
+
var __version__ = "0.3.73";
|
|
25996
25996
|
|
|
25997
25997
|
// ../../node_modules/langsmith/dist/utils/env.js
|
|
25998
25998
|
var globalEnv;
|
|
@@ -26037,8 +26037,8 @@ function getRuntimeEnvironment() {
|
|
|
26037
26037
|
}
|
|
26038
26038
|
return runtimeEnvironment;
|
|
26039
26039
|
}
|
|
26040
|
-
function
|
|
26041
|
-
const allEnvVars =
|
|
26040
|
+
function getLangSmithEnvVarsMetadata() {
|
|
26041
|
+
const allEnvVars = getLangSmithEnvironmentVariables();
|
|
26042
26042
|
const envVars = {};
|
|
26043
26043
|
const excluded = [
|
|
26044
26044
|
"LANGCHAIN_API_KEY",
|
|
@@ -26053,7 +26053,7 @@ function getLangChainEnvVarsMetadata() {
|
|
|
26053
26053
|
"LANGSMITH_SESSION"
|
|
26054
26054
|
];
|
|
26055
26055
|
for (const [key, value] of Object.entries(allEnvVars)) {
|
|
26056
|
-
if (
|
|
26056
|
+
if (typeof value === "string" && !excluded.includes(key) && !key.toLowerCase().includes("key") && !key.toLowerCase().includes("secret") && !key.toLowerCase().includes("token")) {
|
|
26057
26057
|
if (key === "LANGCHAIN_REVISION_ID") {
|
|
26058
26058
|
envVars["revision_id"] = value;
|
|
26059
26059
|
} else {
|
|
@@ -26063,18 +26063,22 @@ function getLangChainEnvVarsMetadata() {
|
|
|
26063
26063
|
}
|
|
26064
26064
|
return envVars;
|
|
26065
26065
|
}
|
|
26066
|
-
function
|
|
26066
|
+
function getLangSmithEnvironmentVariables() {
|
|
26067
|
+
const envVars = {};
|
|
26067
26068
|
try {
|
|
26068
26069
|
if (typeof process !== "undefined" && process.env) {
|
|
26069
|
-
|
|
26070
|
-
|
|
26071
|
-
|
|
26072
|
-
|
|
26070
|
+
for (const [key, value] of Object.entries(process.env)) {
|
|
26071
|
+
if ((key.startsWith("LANGCHAIN_") || key.startsWith("LANGSMITH_")) && value != null) {
|
|
26072
|
+
if ((key.toLowerCase().includes("key") || key.toLowerCase().includes("secret") || key.toLowerCase().includes("token")) && typeof value === "string") {
|
|
26073
|
+
envVars[key] = value.slice(0, 2) + "*".repeat(value.length - 4) + value.slice(-2);
|
|
26074
|
+
} else {
|
|
26075
|
+
envVars[key] = value;
|
|
26076
|
+
}
|
|
26077
|
+
}
|
|
26078
|
+
}
|
|
26073
26079
|
}
|
|
26074
|
-
|
|
26075
|
-
|
|
26076
|
-
return;
|
|
26077
|
-
}
|
|
26080
|
+
} catch (e) {}
|
|
26081
|
+
return envVars;
|
|
26078
26082
|
}
|
|
26079
26083
|
function getEnvironmentVariable(name) {
|
|
26080
26084
|
try {
|
|
@@ -26949,9 +26953,9 @@ function replaceGetterValues(replacer) {
|
|
|
26949
26953
|
}
|
|
26950
26954
|
|
|
26951
26955
|
// ../../node_modules/langsmith/dist/client.js
|
|
26952
|
-
function mergeRuntimeEnvIntoRun(run) {
|
|
26956
|
+
function mergeRuntimeEnvIntoRun(run, cachedEnvVars) {
|
|
26953
26957
|
const runtimeEnv = getRuntimeEnvironment();
|
|
26954
|
-
const envVars =
|
|
26958
|
+
const envVars = cachedEnvVars ?? getLangSmithEnvVarsMetadata();
|
|
26955
26959
|
const extra = run.extra ?? {};
|
|
26956
26960
|
const metadata = extra.metadata;
|
|
26957
26961
|
run.extra = {
|
|
@@ -27257,6 +27261,12 @@ class Client {
|
|
|
27257
27261
|
writable: true,
|
|
27258
27262
|
value: undefined
|
|
27259
27263
|
});
|
|
27264
|
+
Object.defineProperty(this, "cachedLSEnvVarsForMetadata", {
|
|
27265
|
+
enumerable: true,
|
|
27266
|
+
configurable: true,
|
|
27267
|
+
writable: true,
|
|
27268
|
+
value: undefined
|
|
27269
|
+
});
|
|
27260
27270
|
Object.defineProperty(this, "multipartStreamingDisabled", {
|
|
27261
27271
|
enumerable: true,
|
|
27262
27272
|
configurable: true,
|
|
@@ -27311,6 +27321,7 @@ class Client {
|
|
|
27311
27321
|
if (getOtelEnabled()) {
|
|
27312
27322
|
this.langSmithToOTELTranslator = new LangSmithToOTELTranslator;
|
|
27313
27323
|
}
|
|
27324
|
+
this.cachedLSEnvVarsForMetadata = getLangSmithEnvVarsMetadata();
|
|
27314
27325
|
}
|
|
27315
27326
|
static getDefaultClientConfig() {
|
|
27316
27327
|
const apiKey = getLangSmithEnvironmentVariable("API_KEY");
|
|
@@ -27622,7 +27633,7 @@ class Client {
|
|
|
27622
27633
|
async processRunOperation(item) {
|
|
27623
27634
|
clearTimeout(this.autoBatchTimeout);
|
|
27624
27635
|
this.autoBatchTimeout = undefined;
|
|
27625
|
-
item.item = mergeRuntimeEnvIntoRun(item.item);
|
|
27636
|
+
item.item = mergeRuntimeEnvIntoRun(item.item, this.cachedLSEnvVarsForMetadata);
|
|
27626
27637
|
const itemPromise = this.autoBatchQueue.push(item);
|
|
27627
27638
|
if (this.manualFlushMode) {
|
|
27628
27639
|
return itemPromise;
|
|
@@ -27737,7 +27748,7 @@ class Client {
|
|
|
27737
27748
|
}).catch(console.error);
|
|
27738
27749
|
return;
|
|
27739
27750
|
}
|
|
27740
|
-
const mergedRunCreateParam = mergeRuntimeEnvIntoRun(runCreate);
|
|
27751
|
+
const mergedRunCreateParam = mergeRuntimeEnvIntoRun(runCreate, this.cachedLSEnvVarsForMetadata);
|
|
27741
27752
|
if (options?.apiKey !== undefined) {
|
|
27742
27753
|
headers["x-api-key"] = options.apiKey;
|
|
27743
27754
|
}
|
|
@@ -45162,6 +45173,51 @@ class AgentRuntime {
|
|
|
45162
45173
|
throw error;
|
|
45163
45174
|
}
|
|
45164
45175
|
}
|
|
45176
|
+
async generateText(input, options) {
|
|
45177
|
+
if (!input?.trim()) {
|
|
45178
|
+
throw new Error("Input cannot be empty");
|
|
45179
|
+
}
|
|
45180
|
+
const includeCharacter = options?.includeCharacter ?? true;
|
|
45181
|
+
const modelType = options?.modelType ?? ModelType.TEXT_LARGE;
|
|
45182
|
+
let prompt = input;
|
|
45183
|
+
if (includeCharacter && this.character) {
|
|
45184
|
+
const c = this.character;
|
|
45185
|
+
const parts = [];
|
|
45186
|
+
const bioText = Array.isArray(c.bio) ? c.bio.join(" ") : c.bio;
|
|
45187
|
+
if (bioText) {
|
|
45188
|
+
parts.push(`# About ${c.name}
|
|
45189
|
+
${bioText}`);
|
|
45190
|
+
}
|
|
45191
|
+
if (c.system) {
|
|
45192
|
+
parts.push(c.system);
|
|
45193
|
+
}
|
|
45194
|
+
const styles2 = [...c.style?.all || [], ...c.style?.chat || []];
|
|
45195
|
+
if (styles2.length > 0) {
|
|
45196
|
+
parts.push(`Style:
|
|
45197
|
+
${styles2.map((s) => `- ${s}`).join(`
|
|
45198
|
+
`)}`);
|
|
45199
|
+
}
|
|
45200
|
+
if (parts.length > 0) {
|
|
45201
|
+
prompt = `${parts.join(`
|
|
45202
|
+
|
|
45203
|
+
`)}
|
|
45204
|
+
|
|
45205
|
+
${input}`;
|
|
45206
|
+
}
|
|
45207
|
+
}
|
|
45208
|
+
const params = {
|
|
45209
|
+
prompt,
|
|
45210
|
+
maxTokens: options?.maxTokens,
|
|
45211
|
+
temperature: options?.temperature,
|
|
45212
|
+
frequencyPenalty: options?.frequencyPenalty,
|
|
45213
|
+
presencePenalty: options?.presencePenalty,
|
|
45214
|
+
stopSequences: options?.stopSequences
|
|
45215
|
+
};
|
|
45216
|
+
const response = await this.useModel(modelType, params);
|
|
45217
|
+
return {
|
|
45218
|
+
text: response
|
|
45219
|
+
};
|
|
45220
|
+
}
|
|
45165
45221
|
registerEvent(event, handler) {
|
|
45166
45222
|
if (!this.events[event]) {
|
|
45167
45223
|
this.events[event] = [];
|
|
@@ -45645,6 +45701,41 @@ class AgentRuntime {
|
|
|
45645
45701
|
}
|
|
45646
45702
|
}
|
|
45647
45703
|
|
|
45704
|
+
// src/secrets.ts
|
|
45705
|
+
init_environment();
|
|
45706
|
+
function hasCharacterSecrets(character) {
|
|
45707
|
+
return Boolean(character?.settings?.secrets && Object.keys(character.settings.secrets).length > 0);
|
|
45708
|
+
}
|
|
45709
|
+
async function loadSecretsNodeImpl(character) {
|
|
45710
|
+
const fs = await import("node:fs");
|
|
45711
|
+
const dotenv = await import("dotenv");
|
|
45712
|
+
const { findEnvFile: findEnvFile2 } = await Promise.resolve().then(() => (init_environment(), exports_environment));
|
|
45713
|
+
if (hasCharacterSecrets(character)) {
|
|
45714
|
+
return false;
|
|
45715
|
+
}
|
|
45716
|
+
const envPath = findEnvFile2();
|
|
45717
|
+
if (!envPath)
|
|
45718
|
+
return false;
|
|
45719
|
+
try {
|
|
45720
|
+
const buf = fs.readFileSync(envPath);
|
|
45721
|
+
const envSecrets = dotenv.parse(buf);
|
|
45722
|
+
if (!character.settings) {
|
|
45723
|
+
character.settings = {};
|
|
45724
|
+
}
|
|
45725
|
+
character.settings.secrets = envSecrets;
|
|
45726
|
+
return true;
|
|
45727
|
+
} catch {
|
|
45728
|
+
return false;
|
|
45729
|
+
}
|
|
45730
|
+
}
|
|
45731
|
+
async function setDefaultSecretsFromEnv(character) {
|
|
45732
|
+
const env2 = detectEnvironment();
|
|
45733
|
+
if (env2 !== "node") {
|
|
45734
|
+
return false;
|
|
45735
|
+
}
|
|
45736
|
+
return loadSecretsNodeImpl(character);
|
|
45737
|
+
}
|
|
45738
|
+
|
|
45648
45739
|
// src/settings.ts
|
|
45649
45740
|
var import_crypto_browserify = __toESM(require_crypto_browserify(), 1);
|
|
45650
45741
|
init_environment();
|
|
@@ -45924,41 +46015,6 @@ function defineService(definition) {
|
|
|
45924
46015
|
return createService(definition.serviceType).withDescription(definition.description).withStart(definition.start).withStop(definition.stop || (() => Promise.resolve())).build();
|
|
45925
46016
|
}
|
|
45926
46017
|
|
|
45927
|
-
// src/secrets.ts
|
|
45928
|
-
init_environment();
|
|
45929
|
-
function hasCharacterSecrets(character) {
|
|
45930
|
-
return Boolean(character?.settings?.secrets && Object.keys(character.settings.secrets).length > 0);
|
|
45931
|
-
}
|
|
45932
|
-
async function loadSecretsNodeImpl(character) {
|
|
45933
|
-
const fs = await import("node:fs");
|
|
45934
|
-
const dotenv = await import("dotenv");
|
|
45935
|
-
const { findEnvFile: findEnvFile2 } = await Promise.resolve().then(() => (init_environment(), exports_environment));
|
|
45936
|
-
if (hasCharacterSecrets(character)) {
|
|
45937
|
-
return false;
|
|
45938
|
-
}
|
|
45939
|
-
const envPath = findEnvFile2();
|
|
45940
|
-
if (!envPath)
|
|
45941
|
-
return false;
|
|
45942
|
-
try {
|
|
45943
|
-
const buf = fs.readFileSync(envPath);
|
|
45944
|
-
const envSecrets = dotenv.parse(buf);
|
|
45945
|
-
if (!character.settings) {
|
|
45946
|
-
character.settings = {};
|
|
45947
|
-
}
|
|
45948
|
-
character.settings.secrets = envSecrets;
|
|
45949
|
-
return true;
|
|
45950
|
-
} catch {
|
|
45951
|
-
return false;
|
|
45952
|
-
}
|
|
45953
|
-
}
|
|
45954
|
-
async function setDefaultSecretsFromEnv(character) {
|
|
45955
|
-
const env2 = detectEnvironment();
|
|
45956
|
-
if (env2 !== "node") {
|
|
45957
|
-
return false;
|
|
45958
|
-
}
|
|
45959
|
-
return loadSecretsNodeImpl(character);
|
|
45960
|
-
}
|
|
45961
|
-
|
|
45962
46018
|
// src/plugin.ts
|
|
45963
46019
|
init_environment();
|
|
45964
46020
|
var attemptedInstalls = new Set;
|
|
@@ -46854,5 +46910,5 @@ export {
|
|
|
46854
46910
|
AgentRuntime
|
|
46855
46911
|
};
|
|
46856
46912
|
|
|
46857
|
-
//# debugId=
|
|
46913
|
+
//# debugId=89451468EB946ADB64756E2164756E21
|
|
46858
46914
|
//# sourceMappingURL=index.node.js.map
|