@agentuity/server 3.0.0-alpha.7 → 3.0.0-beta.1
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/AGENTS.md +2 -10
- package/README.md +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/schema.d.ts +12 -7
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +6 -13
- package/dist/schema.js.map +1 -1
- package/package.json +5 -6
- package/src/index.ts +0 -1
- package/src/schema.ts +13 -17
- package/dist/runtime-bootstrap.d.ts +0 -40
- package/dist/runtime-bootstrap.d.ts.map +0 -1
- package/dist/runtime-bootstrap.js +0 -69
- package/dist/runtime-bootstrap.js.map +0 -1
- package/src/runtime-bootstrap.ts +0 -89
package/AGENTS.md
CHANGED
|
@@ -21,23 +21,15 @@ Server-side utilities for Node.js and Bun applications. Provides API clients for
|
|
|
21
21
|
```text
|
|
22
22
|
src/
|
|
23
23
|
├── index.ts # Main exports
|
|
24
|
-
├── config.ts # getServiceUrls, resolveRegion
|
|
25
|
-
├── server.ts # createServerFetchAdapter
|
|
24
|
+
├── config.ts # getServiceUrls, resolveRegion, getAPIBaseURL/etc.
|
|
26
25
|
├── logger.ts # ConsoleLogger, createLogger
|
|
27
26
|
├── schema.ts # toJSONSchema
|
|
28
|
-
├── runtime-bootstrap.ts # bootstrapRuntimeEnv
|
|
29
27
|
├── util/resources.ts # validateResources, validateCPUSpec, validateMemorySpec
|
|
30
28
|
└── api/ # API clients for Agentuity cloud services
|
|
31
|
-
├── apikey/ # API key management
|
|
32
|
-
├── db/ # Database operations
|
|
33
|
-
├── eval/ # Eval management
|
|
34
29
|
├── org/ # Organization management
|
|
35
30
|
├── project/ # Project management (deploy, env, etc.)
|
|
36
|
-
├── queue/ # Queue management
|
|
37
31
|
├── region/ # Region management
|
|
38
32
|
├── sandbox/ # Sandbox management (create, execute, files, snapshot)
|
|
39
|
-
├── session/ # Session logs
|
|
40
|
-
├── thread/ # Thread management
|
|
41
33
|
└── user/ # User operations (whoami)
|
|
42
34
|
```
|
|
43
35
|
|
|
@@ -45,7 +37,7 @@ src/
|
|
|
45
37
|
|
|
46
38
|
- **TypeScript-first** - All code is TypeScript
|
|
47
39
|
- **Zod schemas** - Use zod for runtime validation
|
|
48
|
-
- **
|
|
40
|
+
- **CLI-facing** - These utilities are consumed primarily by `@agentuity/cli`. They are not intended for use in deployed user code.
|
|
49
41
|
- **Re-exports** - `@agentuity/core` types and `z` from zod
|
|
50
42
|
- **Import extensions** - Always use `.ts` extensions in relative imports (e.g., `from '../api.ts'`, not `from '../api'`). This is required for Node.js ESM compatibility — `tsc` rewrites `.ts` → `.js` in compiled output, but leaves extensionless imports untouched, which breaks Node.js module resolution. This is enforced by the `useImportExtensions` Biome lint rule.
|
|
51
43
|
|
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ Server-side utilities for Node.js and Bun applications. This package is runtime-
|
|
|
6
6
|
|
|
7
7
|
- **Runtime Agnostic**: Works with both Node.js and Bun
|
|
8
8
|
- **Server-side focused**: Not browser compatible
|
|
9
|
-
- **Shared utilities**:
|
|
9
|
+
- **Shared utilities**: API clients, config, logging, and validation helpers used by `@agentuity/cli` and other server-side tooling
|
|
10
10
|
|
|
11
11
|
## Installation
|
|
12
12
|
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,5 @@ export { type ColorScheme, ConsoleLogger, createLogger } from './logger.ts';
|
|
|
4
4
|
export { toJSONSchema } from './schema.ts';
|
|
5
5
|
export { getContentType, mimeTypes } from './util/mime.ts';
|
|
6
6
|
export { validateCPUSpec, validateMemorySpec, validateResources, type ResourceValidationResult, type ResourcesConfig, type ValidatedResources, } from './util/resources.ts';
|
|
7
|
-
export { bootstrapRuntimeEnv, type RuntimeBootstrapOptions } from './runtime-bootstrap.ts';
|
|
8
7
|
export { z } from 'zod';
|
|
9
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACN,wBAAwB,EACxB,kBAAkB,EAClB,KAAK,yBAAyB,EAC9B,KAAK,oBAAoB,EACzB,MAAM,GACN,MAAM,oBAAoB,CAAC;AAK5B,cAAc,iBAAiB,CAAC;AAGhC,OAAO,EAAE,KAAK,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EACN,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,KAAK,wBAAwB,EAC7B,KAAK,eAAe,EACpB,KAAK,kBAAkB,GACvB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACN,wBAAwB,EACxB,kBAAkB,EAClB,KAAK,yBAAyB,EAC9B,KAAK,oBAAoB,EACzB,MAAM,GACN,MAAM,oBAAoB,CAAC;AAK5B,cAAc,iBAAiB,CAAC;AAGhC,OAAO,EAAE,KAAK,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EACN,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,KAAK,wBAAwB,EAC7B,KAAK,eAAe,EACpB,KAAK,kBAAkB,GACvB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -9,6 +9,5 @@ export { ConsoleLogger, createLogger } from "./logger.js";
|
|
|
9
9
|
export { toJSONSchema } from "./schema.js";
|
|
10
10
|
export { getContentType, mimeTypes } from "./util/mime.js";
|
|
11
11
|
export { validateCPUSpec, validateMemorySpec, validateResources, } from "./util/resources.js";
|
|
12
|
-
export { bootstrapRuntimeEnv } from "./runtime-bootstrap.js";
|
|
13
12
|
export { z } from 'zod';
|
|
14
13
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,OAAO,EACN,wBAAwB,EACxB,kBAAkB,EAGlB,MAAM,GACN,MAAM,oBAAoB,CAAC;AAE5B,0CAA0C;AAC1C,yFAAyF;AACzF,8FAA8F;AAC9F,cAAc,iBAAiB,CAAC;AAEhC,mEAAmE;AACnE,OAAO,EAAoB,aAAa,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EACN,eAAe,EACf,kBAAkB,EAClB,iBAAiB,GAIjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,OAAO,EACN,wBAAwB,EACxB,kBAAkB,EAGlB,MAAM,GACN,MAAM,oBAAoB,CAAC;AAE5B,0CAA0C;AAC1C,yFAAyF;AACzF,8FAA8F;AAC9F,cAAc,iBAAiB,CAAC;AAEhC,mEAAmE;AACnE,OAAO,EAAoB,aAAa,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EACN,eAAe,EACf,kBAAkB,EAClB,iBAAiB,GAIjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC"}
|
package/dist/schema.d.ts
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
import { type JSONSchema, type ToJSONSchemaOptions } from '@agentuity/schema';
|
|
2
1
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* JSON Schema object. Loosely typed because we don't validate the
|
|
3
|
+
* shape ourselves — callers feed it to consumers (LLM tooling, OpenAPI
|
|
4
|
+
* generators, etc.) that have their own validation.
|
|
5
|
+
*/
|
|
6
|
+
export type JSONSchema = Record<string, unknown>;
|
|
7
|
+
/**
|
|
8
|
+
* Converts a Zod schema to JSON Schema format.
|
|
9
|
+
*
|
|
10
|
+
* Returns an empty object for non-Zod inputs so callers can pass
|
|
11
|
+
* whatever they have without crashing.
|
|
6
12
|
*
|
|
7
|
-
* @param schema - The schema to convert
|
|
8
|
-
* @param options - Conversion options (only applies to Agentuity schemas)
|
|
13
|
+
* @param schema - The Zod schema to convert
|
|
9
14
|
*/
|
|
10
|
-
export declare const toJSONSchema: (schema: any
|
|
15
|
+
export declare const toJSONSchema: (schema: any) => JSONSchema;
|
|
11
16
|
//# sourceMappingURL=schema.d.ts.map
|
package/dist/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEjD;;;;;;;GAOG;AAEH,eAAO,MAAM,YAAY,GAAI,QAAQ,GAAG,KAAG,UAW1C,CAAC"}
|
package/dist/schema.js
CHANGED
|
@@ -1,20 +1,14 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { toJSONSchema as agentuityToJSONSchema, } from '@agentuity/schema';
|
|
3
2
|
/**
|
|
4
|
-
* Converts a schema to JSON Schema format.
|
|
5
|
-
* Supports Agentuity schemas (StandardSchemaV1) and Zod schemas.
|
|
6
|
-
* Returns empty object for unknown schema types.
|
|
3
|
+
* Converts a Zod schema to JSON Schema format.
|
|
7
4
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
5
|
+
* Returns an empty object for non-Zod inputs so callers can pass
|
|
6
|
+
* whatever they have without crashing.
|
|
7
|
+
*
|
|
8
|
+
* @param schema - The Zod schema to convert
|
|
10
9
|
*/
|
|
11
10
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12
|
-
export const toJSONSchema = (schema
|
|
13
|
-
// Check if it's an Agentuity schema via StandardSchemaV1 vendor
|
|
14
|
-
if (schema?.['~standard']?.vendor === 'agentuity') {
|
|
15
|
-
return agentuityToJSONSchema(schema, options);
|
|
16
|
-
}
|
|
17
|
-
// Check if it's a Zod schema
|
|
11
|
+
export const toJSONSchema = (schema) => {
|
|
18
12
|
// Zod 3 uses _def.typeName (e.g., "ZodObject")
|
|
19
13
|
// Zod 4 uses _def.type (e.g., "object")
|
|
20
14
|
if (schema?._def?.typeName || schema?._def?.type) {
|
|
@@ -25,7 +19,6 @@ export const toJSONSchema = (schema, options) => {
|
|
|
25
19
|
return {};
|
|
26
20
|
}
|
|
27
21
|
}
|
|
28
|
-
// Unknown schema type
|
|
29
22
|
return {};
|
|
30
23
|
};
|
|
31
24
|
//# sourceMappingURL=schema.js.map
|
package/dist/schema.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB;;;;;;;GAOG;AACH,8DAA8D;AAC9D,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,MAAW,EAAc,EAAE;IACvD,+CAA+C;IAC/C,wCAAwC;IACxC,IAAI,MAAM,EAAE,IAAI,EAAE,QAAQ,IAAI,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;QAClD,IAAI,CAAC;YACJ,OAAO,CAAC,CAAC,YAAY,CAAC,MAAM,CAAe,CAAC;QAC7C,CAAC;QAAC,MAAM,CAAC;YACR,OAAO,EAAE,CAAC;QACX,CAAC;IACF,CAAC;IACD,OAAO,EAAE,CAAC;AACX,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentuity/server",
|
|
3
|
-
"version": "3.0.0-
|
|
3
|
+
"version": "3.0.0-beta.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"author": "Agentuity employees and contributors",
|
|
6
6
|
"type": "module",
|
|
@@ -25,13 +25,12 @@
|
|
|
25
25
|
"prepublishOnly": "bun run clean && bun run build"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@agentuity/adapter": "3.0.0-
|
|
29
|
-
"@agentuity/core": "3.0.0-
|
|
30
|
-
"@agentuity/schema": "3.0.0-alpha.7",
|
|
28
|
+
"@agentuity/adapter": "3.0.0-beta.1",
|
|
29
|
+
"@agentuity/core": "3.0.0-beta.1",
|
|
31
30
|
"zod": "^4.3.5"
|
|
32
31
|
},
|
|
33
32
|
"devDependencies": {
|
|
34
|
-
"@agentuity/test-utils": "3.0.0-
|
|
33
|
+
"@agentuity/test-utils": "3.0.0-beta.1",
|
|
35
34
|
"@types/bun": "latest",
|
|
36
35
|
"@types/node": "^22.0.0",
|
|
37
36
|
"bun-types": "latest",
|
|
@@ -43,7 +42,7 @@
|
|
|
43
42
|
"sideEffects": false,
|
|
44
43
|
"repository": {
|
|
45
44
|
"type": "git",
|
|
46
|
-
"url": "https://github.com/agentuity/sdk.git",
|
|
45
|
+
"url": "git+https://github.com/agentuity/sdk.git",
|
|
47
46
|
"directory": "packages/server"
|
|
48
47
|
}
|
|
49
48
|
}
|
package/src/index.ts
CHANGED
package/src/schema.ts
CHANGED
|
@@ -1,25 +1,22 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
3
|
-
toJSONSchema as agentuityToJSONSchema,
|
|
4
|
-
type JSONSchema,
|
|
5
|
-
type ToJSONSchemaOptions,
|
|
6
|
-
} from '@agentuity/schema';
|
|
7
2
|
|
|
8
3
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
4
|
+
* JSON Schema object. Loosely typed because we don't validate the
|
|
5
|
+
* shape ourselves — callers feed it to consumers (LLM tooling, OpenAPI
|
|
6
|
+
* generators, etc.) that have their own validation.
|
|
7
|
+
*/
|
|
8
|
+
export type JSONSchema = Record<string, unknown>;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Converts a Zod schema to JSON Schema format.
|
|
12
12
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
13
|
+
* Returns an empty object for non-Zod inputs so callers can pass
|
|
14
|
+
* whatever they have without crashing.
|
|
15
|
+
*
|
|
16
|
+
* @param schema - The Zod schema to convert
|
|
15
17
|
*/
|
|
16
18
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17
|
-
export const toJSONSchema = (schema: any
|
|
18
|
-
// Check if it's an Agentuity schema via StandardSchemaV1 vendor
|
|
19
|
-
if (schema?.['~standard']?.vendor === 'agentuity') {
|
|
20
|
-
return agentuityToJSONSchema(schema, options);
|
|
21
|
-
}
|
|
22
|
-
// Check if it's a Zod schema
|
|
19
|
+
export const toJSONSchema = (schema: any): JSONSchema => {
|
|
23
20
|
// Zod 3 uses _def.typeName (e.g., "ZodObject")
|
|
24
21
|
// Zod 4 uses _def.type (e.g., "object")
|
|
25
22
|
if (schema?._def?.typeName || schema?._def?.type) {
|
|
@@ -29,6 +26,5 @@ export const toJSONSchema = (schema: any, options?: ToJSONSchemaOptions): JSONSc
|
|
|
29
26
|
return {};
|
|
30
27
|
}
|
|
31
28
|
}
|
|
32
|
-
// Unknown schema type
|
|
33
29
|
return {};
|
|
34
30
|
};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Runtime environment bootstrapping utility
|
|
3
|
-
*
|
|
4
|
-
* Simplified bootstrap that sets up service URLs based on environment.
|
|
5
|
-
* Does not depend on CLI config files or .env file parsing.
|
|
6
|
-
*/
|
|
7
|
-
export interface RuntimeBootstrapOptions {
|
|
8
|
-
/**
|
|
9
|
-
* Project directory (reserved for future use)
|
|
10
|
-
* @default process.cwd()
|
|
11
|
-
*/
|
|
12
|
-
projectDir?: string;
|
|
13
|
-
/**
|
|
14
|
-
* Override the active profile
|
|
15
|
-
*/
|
|
16
|
-
profile?: string;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Bootstrap runtime environment by setting service URLs.
|
|
20
|
-
*
|
|
21
|
-
* This function:
|
|
22
|
-
* 1. Sets AGENTUITY_REGION=local for local/development environments
|
|
23
|
-
* 2. Sets service URLs based on AGENTUITY_REGION
|
|
24
|
-
* 3. Propagates profile name to environment
|
|
25
|
-
*
|
|
26
|
-
* Note: This does NOT load .env files. Use a proper .env loader
|
|
27
|
-
* (like dotenv) in your app.ts before calling this function.
|
|
28
|
-
*
|
|
29
|
-
* Call this early in your app entry point:
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* ```ts
|
|
33
|
-
* import { bootstrapRuntimeEnv } from '@agentuity/server';
|
|
34
|
-
*
|
|
35
|
-
* // Set up service URLs before initializing your app
|
|
36
|
-
* bootstrapRuntimeEnv();
|
|
37
|
-
* ```
|
|
38
|
-
*/
|
|
39
|
-
export declare function bootstrapRuntimeEnv(options?: RuntimeBootstrapOptions): void;
|
|
40
|
-
//# sourceMappingURL=runtime-bootstrap.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-bootstrap.d.ts","sourceRoot":"","sources":["../src/runtime-bootstrap.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,MAAM,WAAW,uBAAuB;IACvC;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,uBAA4B,GAAG,IAAI,CA6C/E"}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Runtime environment bootstrapping utility
|
|
3
|
-
*
|
|
4
|
-
* Simplified bootstrap that sets up service URLs based on environment.
|
|
5
|
-
* Does not depend on CLI config files or .env file parsing.
|
|
6
|
-
*/
|
|
7
|
-
import { getServiceUrls } from "./config.js";
|
|
8
|
-
/**
|
|
9
|
-
* Bootstrap runtime environment by setting service URLs.
|
|
10
|
-
*
|
|
11
|
-
* This function:
|
|
12
|
-
* 1. Sets AGENTUITY_REGION=local for local/development environments
|
|
13
|
-
* 2. Sets service URLs based on AGENTUITY_REGION
|
|
14
|
-
* 3. Propagates profile name to environment
|
|
15
|
-
*
|
|
16
|
-
* Note: This does NOT load .env files. Use a proper .env loader
|
|
17
|
-
* (like dotenv) in your app.ts before calling this function.
|
|
18
|
-
*
|
|
19
|
-
* Call this early in your app entry point:
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* ```ts
|
|
23
|
-
* import { bootstrapRuntimeEnv } from '@agentuity/server';
|
|
24
|
-
*
|
|
25
|
-
* // Set up service URLs before initializing your app
|
|
26
|
-
* bootstrapRuntimeEnv();
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
29
|
-
export function bootstrapRuntimeEnv(options = {}) {
|
|
30
|
-
const profile = options.profile || process.env.AGENTUITY_PROFILE || 'local';
|
|
31
|
-
// For local/development, default AGENTUITY_REGION to 'local'
|
|
32
|
-
if ((profile === 'local' || process.env.NODE_ENV === 'development') &&
|
|
33
|
-
!process.env.AGENTUITY_REGION) {
|
|
34
|
-
process.env.AGENTUITY_REGION = 'local';
|
|
35
|
-
}
|
|
36
|
-
// Propagate profile name into env for consistency
|
|
37
|
-
if (!process.env.AGENTUITY_PROFILE) {
|
|
38
|
-
process.env.AGENTUITY_PROFILE = profile;
|
|
39
|
-
}
|
|
40
|
-
// Set service URLs based on region
|
|
41
|
-
const region = process.env.AGENTUITY_REGION;
|
|
42
|
-
const serviceUrls = getServiceUrls(region);
|
|
43
|
-
// Only set if not already defined (env vars from shell/CI take precedence)
|
|
44
|
-
if (!process.env.AGENTUITY_TRANSPORT_URL) {
|
|
45
|
-
process.env.AGENTUITY_TRANSPORT_URL = serviceUrls.catalyst;
|
|
46
|
-
}
|
|
47
|
-
if (!process.env.AGENTUITY_KEYVALUE_URL) {
|
|
48
|
-
process.env.AGENTUITY_KEYVALUE_URL = serviceUrls.keyvalue;
|
|
49
|
-
}
|
|
50
|
-
if (!process.env.AGENTUITY_SANDBOX_URL) {
|
|
51
|
-
process.env.AGENTUITY_SANDBOX_URL = serviceUrls.sandbox;
|
|
52
|
-
}
|
|
53
|
-
if (!process.env.AGENTUITY_STREAM_URL) {
|
|
54
|
-
process.env.AGENTUITY_STREAM_URL = serviceUrls.stream;
|
|
55
|
-
}
|
|
56
|
-
if (!process.env.AGENTUITY_VECTOR_URL) {
|
|
57
|
-
process.env.AGENTUITY_VECTOR_URL = serviceUrls.vector;
|
|
58
|
-
}
|
|
59
|
-
if (!process.env.AGENTUITY_CATALYST_URL) {
|
|
60
|
-
process.env.AGENTUITY_CATALYST_URL = serviceUrls.catalyst;
|
|
61
|
-
}
|
|
62
|
-
if (!process.env.AGENTUITY_OTLP_URL) {
|
|
63
|
-
process.env.AGENTUITY_OTLP_URL = serviceUrls.otel;
|
|
64
|
-
}
|
|
65
|
-
if (!process.env.AGENTUITY_EMAIL_URL) {
|
|
66
|
-
process.env.AGENTUITY_EMAIL_URL = serviceUrls.email;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
//# sourceMappingURL=runtime-bootstrap.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-bootstrap.js","sourceRoot":"","sources":["../src/runtime-bootstrap.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAe7C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,mBAAmB,CAAC,UAAmC,EAAE;IACxE,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,OAAO,CAAC;IAE5E,6DAA6D;IAC7D,IACC,CAAC,OAAO,KAAK,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,CAAC;QAC/D,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAC5B,CAAC;QACF,OAAO,CAAC,GAAG,CAAC,gBAAgB,GAAG,OAAO,CAAC;IACxC,CAAC;IAED,kDAAkD;IAClD,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,CAAC;QACpC,OAAO,CAAC,GAAG,CAAC,iBAAiB,GAAG,OAAO,CAAC;IACzC,CAAC;IAED,mCAAmC;IACnC,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC;IAC5C,MAAM,WAAW,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;IAE3C,2EAA2E;IAC3E,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,uBAAuB,EAAE,CAAC;QAC1C,OAAO,CAAC,GAAG,CAAC,uBAAuB,GAAG,WAAW,CAAC,QAAQ,CAAC;IAC5D,CAAC;IACD,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,sBAAsB,EAAE,CAAC;QACzC,OAAO,CAAC,GAAG,CAAC,sBAAsB,GAAG,WAAW,CAAC,QAAQ,CAAC;IAC3D,CAAC;IACD,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,CAAC;QACxC,OAAO,CAAC,GAAG,CAAC,qBAAqB,GAAG,WAAW,CAAC,OAAO,CAAC;IACzD,CAAC;IACD,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE,CAAC;QACvC,OAAO,CAAC,GAAG,CAAC,oBAAoB,GAAG,WAAW,CAAC,MAAM,CAAC;IACvD,CAAC;IACD,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE,CAAC;QACvC,OAAO,CAAC,GAAG,CAAC,oBAAoB,GAAG,WAAW,CAAC,MAAM,CAAC;IACvD,CAAC;IACD,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,sBAAsB,EAAE,CAAC;QACzC,OAAO,CAAC,GAAG,CAAC,sBAAsB,GAAG,WAAW,CAAC,QAAQ,CAAC;IAC3D,CAAC;IACD,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,CAAC;QACrC,OAAO,CAAC,GAAG,CAAC,kBAAkB,GAAG,WAAW,CAAC,IAAI,CAAC;IACnD,CAAC;IACD,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,CAAC;QACtC,OAAO,CAAC,GAAG,CAAC,mBAAmB,GAAG,WAAW,CAAC,KAAK,CAAC;IACrD,CAAC;AACF,CAAC"}
|
package/src/runtime-bootstrap.ts
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Runtime environment bootstrapping utility
|
|
3
|
-
*
|
|
4
|
-
* Simplified bootstrap that sets up service URLs based on environment.
|
|
5
|
-
* Does not depend on CLI config files or .env file parsing.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { getServiceUrls } from './config.ts';
|
|
9
|
-
|
|
10
|
-
export interface RuntimeBootstrapOptions {
|
|
11
|
-
/**
|
|
12
|
-
* Project directory (reserved for future use)
|
|
13
|
-
* @default process.cwd()
|
|
14
|
-
*/
|
|
15
|
-
projectDir?: string;
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Override the active profile
|
|
19
|
-
*/
|
|
20
|
-
profile?: string;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Bootstrap runtime environment by setting service URLs.
|
|
25
|
-
*
|
|
26
|
-
* This function:
|
|
27
|
-
* 1. Sets AGENTUITY_REGION=local for local/development environments
|
|
28
|
-
* 2. Sets service URLs based on AGENTUITY_REGION
|
|
29
|
-
* 3. Propagates profile name to environment
|
|
30
|
-
*
|
|
31
|
-
* Note: This does NOT load .env files. Use a proper .env loader
|
|
32
|
-
* (like dotenv) in your app.ts before calling this function.
|
|
33
|
-
*
|
|
34
|
-
* Call this early in your app entry point:
|
|
35
|
-
*
|
|
36
|
-
* @example
|
|
37
|
-
* ```ts
|
|
38
|
-
* import { bootstrapRuntimeEnv } from '@agentuity/server';
|
|
39
|
-
*
|
|
40
|
-
* // Set up service URLs before initializing your app
|
|
41
|
-
* bootstrapRuntimeEnv();
|
|
42
|
-
* ```
|
|
43
|
-
*/
|
|
44
|
-
export function bootstrapRuntimeEnv(options: RuntimeBootstrapOptions = {}): void {
|
|
45
|
-
const profile = options.profile || process.env.AGENTUITY_PROFILE || 'local';
|
|
46
|
-
|
|
47
|
-
// For local/development, default AGENTUITY_REGION to 'local'
|
|
48
|
-
if (
|
|
49
|
-
(profile === 'local' || process.env.NODE_ENV === 'development') &&
|
|
50
|
-
!process.env.AGENTUITY_REGION
|
|
51
|
-
) {
|
|
52
|
-
process.env.AGENTUITY_REGION = 'local';
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// Propagate profile name into env for consistency
|
|
56
|
-
if (!process.env.AGENTUITY_PROFILE) {
|
|
57
|
-
process.env.AGENTUITY_PROFILE = profile;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// Set service URLs based on region
|
|
61
|
-
const region = process.env.AGENTUITY_REGION;
|
|
62
|
-
const serviceUrls = getServiceUrls(region);
|
|
63
|
-
|
|
64
|
-
// Only set if not already defined (env vars from shell/CI take precedence)
|
|
65
|
-
if (!process.env.AGENTUITY_TRANSPORT_URL) {
|
|
66
|
-
process.env.AGENTUITY_TRANSPORT_URL = serviceUrls.catalyst;
|
|
67
|
-
}
|
|
68
|
-
if (!process.env.AGENTUITY_KEYVALUE_URL) {
|
|
69
|
-
process.env.AGENTUITY_KEYVALUE_URL = serviceUrls.keyvalue;
|
|
70
|
-
}
|
|
71
|
-
if (!process.env.AGENTUITY_SANDBOX_URL) {
|
|
72
|
-
process.env.AGENTUITY_SANDBOX_URL = serviceUrls.sandbox;
|
|
73
|
-
}
|
|
74
|
-
if (!process.env.AGENTUITY_STREAM_URL) {
|
|
75
|
-
process.env.AGENTUITY_STREAM_URL = serviceUrls.stream;
|
|
76
|
-
}
|
|
77
|
-
if (!process.env.AGENTUITY_VECTOR_URL) {
|
|
78
|
-
process.env.AGENTUITY_VECTOR_URL = serviceUrls.vector;
|
|
79
|
-
}
|
|
80
|
-
if (!process.env.AGENTUITY_CATALYST_URL) {
|
|
81
|
-
process.env.AGENTUITY_CATALYST_URL = serviceUrls.catalyst;
|
|
82
|
-
}
|
|
83
|
-
if (!process.env.AGENTUITY_OTLP_URL) {
|
|
84
|
-
process.env.AGENTUITY_OTLP_URL = serviceUrls.otel;
|
|
85
|
-
}
|
|
86
|
-
if (!process.env.AGENTUITY_EMAIL_URL) {
|
|
87
|
-
process.env.AGENTUITY_EMAIL_URL = serviceUrls.email;
|
|
88
|
-
}
|
|
89
|
-
}
|