@elizaos/api-client 1.7.2-alpha.2 → 1.7.2-alpha.4
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.
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
import { type Character } from './types';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*/
|
|
2
|
+
export declare function setAllowedEnvVars(vars: Set<string> | null): void;
|
|
3
|
+
export declare function getAllowedEnvVars(): Set<string> | null;
|
|
5
4
|
export declare function hasCharacterSecrets(character: Character): boolean;
|
|
6
5
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* Note: This is a Node.js-only feature. In browser environments, it returns false.
|
|
11
|
-
*
|
|
12
|
-
* @param character - The character to load secrets into
|
|
13
|
-
* @param options - Optional configuration
|
|
14
|
-
* @param options.skipEnvMerge - If true, skips merging process.env variables (useful in tests)
|
|
6
|
+
* Merges process.env into character.settings.secrets with character values taking precedence.
|
|
7
|
+
* Node.js-only - returns false in browser environments.
|
|
15
8
|
*/
|
|
16
9
|
export declare function setDefaultSecretsFromEnv(character: Character, options?: {
|
|
17
10
|
skipEnvMerge?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secrets.d.ts","sourceRoot":"","sources":["../../../../core/src/secrets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"secrets.d.ts","sourceRoot":"","sources":["../../../../core/src/secrets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,SAAS,CAAC;AAKzC,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,GAAG,IAAI,CAEhE;AAED,wBAAgB,iBAAiB,IAAI,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,CAEtD;AAED,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CASjE;AAED;;;GAGG;AACH,wBAAsB,wBAAwB,CAC5C,SAAS,EAAE,SAAS,EACpB,OAAO,CAAC,EAAE;IAAE,YAAY,CAAC,EAAE,OAAO,CAAA;CAAE,GACnC,OAAO,CAAC,OAAO,CAAC,CAoClB"}
|
|
@@ -1,134 +1,51 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Browser and Node.js compatible environment variable abstraction
|
|
3
|
-
* This module provides a unified interface for accessing environment variables
|
|
4
|
-
* that works in both browser and Node.js environments.
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Type representing the runtime environment
|
|
8
|
-
*/
|
|
9
1
|
export type RuntimeEnvironment = 'node' | 'browser' | 'unknown';
|
|
10
|
-
/**
|
|
11
|
-
* Interface for environment configuration
|
|
12
|
-
*/
|
|
13
2
|
export interface EnvironmentConfig {
|
|
14
3
|
[key: string]: string | boolean | number | undefined;
|
|
15
4
|
}
|
|
16
|
-
/**
|
|
17
|
-
* Detect the current runtime environment
|
|
18
|
-
*/
|
|
19
5
|
export declare function detectEnvironment(): RuntimeEnvironment;
|
|
20
6
|
/**
|
|
21
|
-
*
|
|
7
|
+
* Resets the cached environment detection result.
|
|
8
|
+
* This is primarily for testing purposes when mocking different environments.
|
|
22
9
|
*/
|
|
10
|
+
export declare function resetEnvironmentCache(): void;
|
|
23
11
|
declare class Environment {
|
|
24
12
|
private runtime;
|
|
25
13
|
private browserStore?;
|
|
26
14
|
private cache;
|
|
27
15
|
constructor();
|
|
28
|
-
/**
|
|
29
|
-
* Get the current runtime environment
|
|
30
|
-
*/
|
|
31
16
|
getRuntime(): RuntimeEnvironment;
|
|
32
|
-
/**
|
|
33
|
-
* Check if running in Node.js
|
|
34
|
-
*/
|
|
35
17
|
isNode(): boolean;
|
|
36
|
-
/**
|
|
37
|
-
* Check if running in browser
|
|
38
|
-
*/
|
|
39
18
|
isBrowser(): boolean;
|
|
40
|
-
/**
|
|
41
|
-
* Get an environment variable
|
|
42
|
-
*/
|
|
43
19
|
get(key: string, defaultValue?: string): string | undefined;
|
|
44
|
-
/**
|
|
45
|
-
* Set an environment variable (mainly for browser/testing)
|
|
46
|
-
*/
|
|
47
20
|
set(key: string, value: string | boolean | number): void;
|
|
48
|
-
/**
|
|
49
|
-
* Check if an environment variable exists
|
|
50
|
-
*/
|
|
51
21
|
has(key: string): boolean;
|
|
52
|
-
/**
|
|
53
|
-
* Get all environment variables (filtered for safety)
|
|
54
|
-
*/
|
|
55
22
|
getAll(): EnvironmentConfig;
|
|
56
|
-
|
|
57
|
-
* Get a boolean environment variable
|
|
58
|
-
*/
|
|
23
|
+
private static readonly TRUTHY_VALUES;
|
|
59
24
|
getBoolean(key: string, defaultValue?: boolean): boolean;
|
|
60
|
-
/**
|
|
61
|
-
* Get a number environment variable
|
|
62
|
-
*/
|
|
63
25
|
getNumber(key: string, defaultValue?: number): number | undefined;
|
|
64
|
-
/**
|
|
65
|
-
* Clear the cache (useful for testing)
|
|
66
|
-
*/
|
|
67
26
|
clearCache(): void;
|
|
68
27
|
}
|
|
69
|
-
/**
|
|
70
|
-
* Get the singleton Environment instance
|
|
71
|
-
*/
|
|
72
28
|
export declare function getEnvironment(): Environment;
|
|
73
|
-
/**
|
|
74
|
-
* Convenience function to get an environment variable
|
|
75
|
-
*/
|
|
76
29
|
export declare function getEnv(key: string, defaultValue?: string): string | undefined;
|
|
77
|
-
/**
|
|
78
|
-
* Convenience function to set an environment variable
|
|
79
|
-
*/
|
|
80
30
|
export declare function setEnv(key: string, value: string | boolean | number): void;
|
|
81
|
-
/**
|
|
82
|
-
* Convenience function to check if an environment variable exists
|
|
83
|
-
*/
|
|
84
31
|
export declare function hasEnv(key: string): boolean;
|
|
85
|
-
/**
|
|
86
|
-
* Convenience function to get a boolean environment variable
|
|
87
|
-
*/
|
|
88
32
|
export declare function getBooleanEnv(key: string, defaultValue?: boolean): boolean;
|
|
89
|
-
/**
|
|
90
|
-
* Convenience function to get a number environment variable
|
|
91
|
-
*/
|
|
92
33
|
export declare function getNumberEnv(key: string, defaultValue?: number): number | undefined;
|
|
93
|
-
/**
|
|
94
|
-
* Initialize browser environment with config
|
|
95
|
-
* This should be called early in browser apps to set up environment
|
|
96
|
-
*/
|
|
97
34
|
export declare function initBrowserEnvironment(config: EnvironmentConfig): void;
|
|
98
|
-
/**
|
|
99
|
-
* Export the current runtime for convenience
|
|
100
|
-
*/
|
|
101
35
|
export declare const currentRuntime: RuntimeEnvironment;
|
|
102
|
-
/**
|
|
103
|
-
* Re-export the Environment class for advanced usage
|
|
104
|
-
*/
|
|
105
36
|
export { Environment };
|
|
106
|
-
/**
|
|
107
|
-
* Find the .env file by traversing up the directory tree
|
|
108
|
-
* Searches from startDir upwards until it finds a .env file or reaches the root
|
|
109
|
-
*
|
|
110
|
-
* @param startDir - Directory to start searching from (defaults to process.cwd())
|
|
111
|
-
* @param filenames - Array of filenames to search for (defaults to ['.env', '.env.local'])
|
|
112
|
-
* @returns Path to the .env file if found, null otherwise
|
|
113
|
-
*/
|
|
114
37
|
export declare function findEnvFile(startDir?: string, filenames?: string[]): string | null;
|
|
38
|
+
export interface LoadEnvOptions {
|
|
39
|
+
override?: boolean;
|
|
40
|
+
}
|
|
41
|
+
export declare function loadEnvFile(envPath?: string, options?: LoadEnvOptions): boolean;
|
|
42
|
+
export declare function findAllEnvFiles(startDir: string, boundaryDir?: string): string[];
|
|
115
43
|
/**
|
|
116
|
-
*
|
|
117
|
-
* This function is idempotent - safe to call multiple times
|
|
118
|
-
*
|
|
119
|
-
* Node.js only - does nothing in browser environments
|
|
120
|
-
*
|
|
121
|
-
* @param envPath - Optional explicit path to .env file. If not provided, will search upwards from cwd
|
|
122
|
-
* @returns true if .env was found and loaded, false otherwise
|
|
123
|
-
*
|
|
124
|
-
* @example
|
|
125
|
-
* ```typescript
|
|
126
|
-
* // Load from auto-discovered .env file
|
|
127
|
-
* loadEnvFile();
|
|
128
|
-
*
|
|
129
|
-
* // Load from specific path
|
|
130
|
-
* loadEnvFile('/path/to/.env');
|
|
131
|
-
* ```
|
|
44
|
+
* Loads .env files with proper precedence (closest file wins).
|
|
132
45
|
*/
|
|
133
|
-
export declare function
|
|
46
|
+
export declare function loadEnvFilesWithPrecedence(startDir: string, options?: {
|
|
47
|
+
boundaryDir?: string;
|
|
48
|
+
clearBeforeLoad?: boolean;
|
|
49
|
+
varsToClear?: string[];
|
|
50
|
+
}): string[];
|
|
134
51
|
//# sourceMappingURL=environment.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../../../../core/src/utils/environment.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../../../../core/src/utils/environment.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC;AAEhE,MAAM,WAAW,iBAAiB;IAChC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC;CACtD;AAKD,wBAAgB,iBAAiB,IAAI,kBAAkB,CAoBtD;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,IAAI,IAAI,CAE5C;AAsCD,cAAM,WAAW;IACf,OAAO,CAAC,OAAO,CAAqB;IACpC,OAAO,CAAC,YAAY,CAAC,CAA0B;IAC/C,OAAO,CAAC,KAAK,CAAyC;;IAStD,UAAU,IAAI,kBAAkB;IAIhC,MAAM,IAAI,OAAO;IAIjB,SAAS,IAAI,OAAO;IAIpB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAiB3D,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,IAAI;IAWxD,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;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Q,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAuBhF;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE;IAAE,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,eAAe,CAAC,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,GACpF,MAAM,EAAE,CAgBV"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elizaos/api-client",
|
|
3
|
-
"version": "1.7.2-alpha.
|
|
3
|
+
"version": "1.7.2-alpha.4",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
"typecheck": "tsc --noEmit"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@elizaos/core": "1.7.2-alpha.
|
|
19
|
+
"@elizaos/core": "1.7.2-alpha.4"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@elizaos/config": "1.7.2-alpha.
|
|
22
|
+
"@elizaos/config": "1.7.2-alpha.4",
|
|
23
23
|
"@types/bun": "^1.3.3",
|
|
24
24
|
"@types/node": "^24.10.1",
|
|
25
25
|
"eslint": "^9.36.0",
|
|
@@ -31,5 +31,5 @@
|
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"access": "public"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "f9df76f18bfcc1549b7c1b7fa00429894f15fffd"
|
|
35
35
|
}
|