veryfront 0.1.492 → 0.1.494
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/esm/deno.js +1 -1
- package/esm/src/agent/agent-service.d.ts +6 -9
- package/esm/src/agent/agent-service.d.ts.map +1 -1
- package/esm/src/agent/agent-service.js +1 -1
- package/esm/src/agent/hosted-agent-project-steering.d.ts +33 -0
- package/esm/src/agent/hosted-agent-project-steering.d.ts.map +1 -0
- package/esm/src/agent/hosted-agent-project-steering.js +73 -0
- package/esm/src/agent/hosted-agent-service-config.d.ts +42 -0
- package/esm/src/agent/hosted-agent-service-config.d.ts.map +1 -1
- package/esm/src/agent/hosted-agent-service-config.js +4 -0
- package/esm/src/agent/hosted-agent-service-env-files.d.ts +3 -0
- package/esm/src/agent/hosted-agent-service-env-files.d.ts.map +1 -1
- package/esm/src/agent/hosted-agent-service-env-files.js +3 -0
- package/esm/src/agent/hosted-agent-service-runtime.d.ts +9 -0
- package/esm/src/agent/hosted-agent-service-runtime.d.ts.map +1 -1
- package/esm/src/agent/hosted-agent-service-runtime.js +6 -0
- package/esm/src/agent/index.d.ts +6 -5
- package/esm/src/agent/index.d.ts.map +1 -1
- package/esm/src/agent/index.js +6 -5
- package/esm/src/agent/node-hosted-agent-service-runtime-infrastructure.d.ts +3 -0
- package/esm/src/agent/node-hosted-agent-service-runtime-infrastructure.d.ts.map +1 -1
- package/esm/src/agent/node-hosted-agent-service-runtime-infrastructure.js +3 -0
- package/esm/src/agent/node-hosted-agent-service-telemetry.d.ts +9 -0
- package/esm/src/agent/node-hosted-agent-service-telemetry.d.ts.map +1 -1
- package/esm/src/agent/node-hosted-agent-service-telemetry.js +6 -0
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/package.json +1 -1
- package/src/deno.js +1 -1
- package/src/src/agent/agent-service.ts +6 -9
- package/src/src/agent/hosted-agent-project-steering.ts +129 -0
- package/src/src/agent/hosted-agent-service-config.ts +11 -0
- package/src/src/agent/hosted-agent-service-env-files.ts +9 -0
- package/src/src/agent/hosted-agent-service-runtime.ts +44 -0
- package/src/src/agent/index.ts +36 -0
- package/src/src/agent/node-hosted-agent-service-runtime-infrastructure.ts +11 -0
- package/src/src/agent/node-hosted-agent-service-telemetry.ts +28 -0
- package/src/src/utils/version-constant.ts +1 -1
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export type NodeHostedAgentServiceTelemetryEnv = Record<string, string | undefined>;
|
|
2
|
+
export type NodeAgentServiceTelemetryEnv = NodeHostedAgentServiceTelemetryEnv;
|
|
2
3
|
export type NodeHostedAgentServiceInstrumentationConfig = {
|
|
3
4
|
http: boolean;
|
|
4
5
|
express: boolean;
|
|
5
6
|
fs: boolean;
|
|
6
7
|
};
|
|
8
|
+
export type NodeAgentServiceInstrumentationConfig = NodeHostedAgentServiceInstrumentationConfig;
|
|
7
9
|
export type NodeHostedAgentServiceTelemetryConfig = {
|
|
8
10
|
enabled: boolean;
|
|
9
11
|
serviceName: string;
|
|
@@ -13,23 +15,30 @@ export type NodeHostedAgentServiceTelemetryConfig = {
|
|
|
13
15
|
exporterHeaders?: Record<string, string>;
|
|
14
16
|
instrumentation: NodeHostedAgentServiceInstrumentationConfig;
|
|
15
17
|
};
|
|
18
|
+
export type NodeAgentServiceTelemetryConfig = NodeHostedAgentServiceTelemetryConfig;
|
|
16
19
|
export type ResolveNodeHostedAgentServiceTelemetryConfigOptions = {
|
|
17
20
|
env: NodeHostedAgentServiceTelemetryEnv;
|
|
18
21
|
defaultServiceName: string;
|
|
19
22
|
defaultServiceVersion?: string;
|
|
20
23
|
defaultEnabled?: boolean;
|
|
21
24
|
};
|
|
25
|
+
export type ResolveNodeAgentServiceTelemetryConfigOptions = ResolveNodeHostedAgentServiceTelemetryConfigOptions;
|
|
22
26
|
export type NodeHostedAgentServiceTelemetryLogger = {
|
|
23
27
|
info(message: string, metadata?: Record<string, unknown>): void;
|
|
24
28
|
error(message: string, metadata?: Record<string, unknown>): void;
|
|
25
29
|
};
|
|
30
|
+
export type NodeAgentServiceTelemetryLogger = NodeHostedAgentServiceTelemetryLogger;
|
|
26
31
|
export type NodeHostedAgentServiceTelemetryProcessTarget = {
|
|
27
32
|
on(event: "SIGTERM", listener: () => void | Promise<void>): unknown;
|
|
28
33
|
};
|
|
34
|
+
export type NodeAgentServiceTelemetryProcessTarget = NodeHostedAgentServiceTelemetryProcessTarget;
|
|
29
35
|
export type InitializeNodeHostedAgentServiceTelemetryOptions = NodeHostedAgentServiceTelemetryConfig & {
|
|
30
36
|
logger?: NodeHostedAgentServiceTelemetryLogger;
|
|
31
37
|
processTarget?: NodeHostedAgentServiceTelemetryProcessTarget;
|
|
32
38
|
};
|
|
39
|
+
export type InitializeNodeAgentServiceTelemetryOptions = InitializeNodeHostedAgentServiceTelemetryOptions;
|
|
33
40
|
export declare function resolveNodeHostedAgentServiceTelemetryConfig(options: ResolveNodeHostedAgentServiceTelemetryConfigOptions): NodeHostedAgentServiceTelemetryConfig;
|
|
41
|
+
export declare function resolveNodeAgentServiceTelemetryConfig(options: ResolveNodeAgentServiceTelemetryConfigOptions): NodeAgentServiceTelemetryConfig;
|
|
34
42
|
export declare function initializeNodeHostedAgentServiceOpenTelemetry(options: InitializeNodeHostedAgentServiceTelemetryOptions): Promise<boolean>;
|
|
43
|
+
export declare function initializeNodeAgentServiceOpenTelemetry(options: InitializeNodeAgentServiceTelemetryOptions): Promise<boolean>;
|
|
35
44
|
//# sourceMappingURL=node-hosted-agent-service-telemetry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-hosted-agent-service-telemetry.d.ts","sourceRoot":"","sources":["../../../src/src/agent/node-hosted-agent-service-telemetry.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kCAAkC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;AAEpF,MAAM,MAAM,2CAA2C,GAAG;IACxD,IAAI,EAAE,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CAAqC,CAAC;AAEpF,MAAM,MAAM,4CAA4C,GAAG;IACzD,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC;CACrE,CAAC;AAEF,MAAM,MAAM,sCAAsC,GAAG,4CAA4C,CAAC;AAElG,MAAM,MAAM,gDAAgD,GACxD,qCAAqC,GACrC;IACA,MAAM,CAAC,EAAE,qCAAqC,CAAC;IAC/C,aAAa,CAAC,EAAE,4CAA4C,CAAC;CAC9D,CAAC;AAEJ,MAAM,MAAM,0CAA0C,GACpD,gDAAgD,CAAC;AA6CnD,wBAAgB,4CAA4C,CAC1D,OAAO,EAAE,mDAAmD,GAC3D,qCAAqC,CAYvC;AAED,wBAAgB,sCAAsC,CACpD,OAAO,EAAE,6CAA6C,GACrD,+BAA+B,CAEjC;AAgCD,wBAAsB,6CAA6C,CACjE,OAAO,EAAE,gDAAgD,GACxD,OAAO,CAAC,OAAO,CAAC,CA2DlB;AAED,wBAAsB,uCAAuC,CAC3D,OAAO,EAAE,0CAA0C,GAClD,OAAO,CAAC,OAAO,CAAC,CAElB"}
|
|
@@ -47,6 +47,9 @@ export function resolveNodeHostedAgentServiceTelemetryConfig(options) {
|
|
|
47
47
|
instrumentation: resolveInstrumentationConfig(options.env),
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
|
+
export function resolveNodeAgentServiceTelemetryConfig(options) {
|
|
51
|
+
return resolveNodeHostedAgentServiceTelemetryConfig(options);
|
|
52
|
+
}
|
|
50
53
|
function logInfo(logger, message, metadata) {
|
|
51
54
|
if (logger) {
|
|
52
55
|
logger.info(message, metadata);
|
|
@@ -115,3 +118,6 @@ export async function initializeNodeHostedAgentServiceOpenTelemetry(options) {
|
|
|
115
118
|
return false;
|
|
116
119
|
}
|
|
117
120
|
}
|
|
121
|
+
export async function initializeNodeAgentServiceOpenTelemetry(options) {
|
|
122
|
+
return initializeNodeHostedAgentServiceOpenTelemetry(options);
|
|
123
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.1.
|
|
1
|
+
export declare const VERSION = "0.1.494";
|
|
2
2
|
//# sourceMappingURL=version-constant.d.ts.map
|
package/package.json
CHANGED
package/src/deno.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { Agent } from "./types.js";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Transport-neutral durable run lifecycle sink
|
|
5
|
-
* adoption work.
|
|
4
|
+
* Transport-neutral durable run lifecycle sink for agent-service adoption work.
|
|
6
5
|
*/
|
|
7
6
|
export interface DurableRunSink<
|
|
8
7
|
TStartInput = void,
|
|
@@ -17,8 +16,7 @@ export interface DurableRunSink<
|
|
|
17
16
|
}
|
|
18
17
|
|
|
19
18
|
/**
|
|
20
|
-
*
|
|
21
|
-
* implementation.
|
|
19
|
+
* Host-facing server config for the agent service runtime shell.
|
|
22
20
|
*/
|
|
23
21
|
export type AgentServiceRouteMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS";
|
|
24
22
|
|
|
@@ -68,7 +66,7 @@ export interface AgentServiceContractBase<
|
|
|
68
66
|
}
|
|
69
67
|
|
|
70
68
|
/**
|
|
71
|
-
* Multi-agent
|
|
69
|
+
* Multi-agent service contract. Framework services route to
|
|
72
70
|
* `defaultAgentId` unless the host chooses another registered agent.
|
|
73
71
|
*/
|
|
74
72
|
export interface AgentServiceRegistryContract<
|
|
@@ -97,7 +95,7 @@ export interface AgentServiceSingleAgentContract<
|
|
|
97
95
|
}
|
|
98
96
|
|
|
99
97
|
/**
|
|
100
|
-
*
|
|
98
|
+
* Framework-owned agent service contract.
|
|
101
99
|
*/
|
|
102
100
|
export type AgentContract<
|
|
103
101
|
TStartInput = void,
|
|
@@ -119,8 +117,7 @@ export interface NormalizedAgentServiceContract<
|
|
|
119
117
|
}
|
|
120
118
|
|
|
121
119
|
/**
|
|
122
|
-
* Type-preserving service definition
|
|
123
|
-
* implementation landing in a later migration phase.
|
|
120
|
+
* Type-preserving service definition for request-native agent service runtimes.
|
|
124
121
|
*/
|
|
125
122
|
export interface AgentServiceDefinition<
|
|
126
123
|
TStartInput = void,
|
|
@@ -364,7 +361,7 @@ function createAgentServiceRuntime<
|
|
|
364
361
|
}
|
|
365
362
|
|
|
366
363
|
/**
|
|
367
|
-
* Define
|
|
364
|
+
* Define an agent service and expose a policy-neutral runtime shell.
|
|
368
365
|
*
|
|
369
366
|
* The first implementation slice owns contract normalization plus standard
|
|
370
367
|
* health/readiness behavior. Hosts pass product-specific routes explicitly so
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import {
|
|
3
|
+
createHostedProjectSteeringAdapter,
|
|
4
|
+
type HostedProjectSkillIdsContext,
|
|
5
|
+
type HostedProjectSteeringAdapter,
|
|
6
|
+
type HostedProjectSteeringLogger,
|
|
7
|
+
} from "./hosted-project-steering-adapter.js";
|
|
8
|
+
import {
|
|
9
|
+
loadRuntimeAgentMarkdownDefinitionFromFile,
|
|
10
|
+
resolveRuntimeAgentDefinitionsDir,
|
|
11
|
+
resolveRuntimeAgentMarkdownDefinitionFilePath,
|
|
12
|
+
} from "./runtime-agent-definition-files.js";
|
|
13
|
+
import type { RuntimeAgentMarkdownDefinition } from "./runtime-agent-definition.js";
|
|
14
|
+
import { resolveRuntimeBuiltinSkillsDir } from "./runtime-builtin-skill-files.js";
|
|
15
|
+
import type {
|
|
16
|
+
RuntimeProjectFilesFetch,
|
|
17
|
+
RuntimeProjectFilesTrace,
|
|
18
|
+
} from "./runtime-project-files-client.js";
|
|
19
|
+
import type { RuntimeProjectSteeringLookup } from "./runtime-project-skill-catalog.js";
|
|
20
|
+
import type { RuntimeLoadSkillToolContext } from "./runtime-load-skill-tool.js";
|
|
21
|
+
import type { RuntimeSkillDefinition } from "./runtime-skill-metadata.js";
|
|
22
|
+
|
|
23
|
+
const runtimeAgentFileIdSchema = z.string().min(1).regex(/^[A-Za-z0-9._-]+$/);
|
|
24
|
+
const runtimeAgentDefinitionFileNameSchema = z.string().min(1).regex(/^[A-Za-z0-9._-]+\.md$/);
|
|
25
|
+
|
|
26
|
+
export const hostedAgentProjectSteeringOptionsSchema = z.object({
|
|
27
|
+
baseDir: z.string().min(1),
|
|
28
|
+
agentId: runtimeAgentFileIdSchema,
|
|
29
|
+
fileName: runtimeAgentDefinitionFileNameSchema.optional(),
|
|
30
|
+
skillsDir: z.string().min(1).optional(),
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export type HostedAgentProjectSteeringOptionsData = z.infer<
|
|
34
|
+
typeof hostedAgentProjectSteeringOptionsSchema
|
|
35
|
+
>;
|
|
36
|
+
|
|
37
|
+
export type HostedAgentProjectSteeringLogger = HostedProjectSteeringLogger & {
|
|
38
|
+
error?: (message: string, metadata?: Record<string, unknown>) => void;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export type HostedAgentProjectSteeringOptions = HostedAgentProjectSteeringOptionsData & {
|
|
42
|
+
getApiUrl: () => string | URL;
|
|
43
|
+
logger?: HostedAgentProjectSteeringLogger;
|
|
44
|
+
trace?: RuntimeProjectFilesTrace;
|
|
45
|
+
fetch?: RuntimeProjectFilesFetch;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export type HostedAgentProjectSteering = {
|
|
49
|
+
getAgentConfig: () => RuntimeAgentMarkdownDefinition;
|
|
50
|
+
getProjectInstructions: (lookup: RuntimeProjectSteeringLookup) => Promise<string>;
|
|
51
|
+
getSkillsConfig: (lookup: RuntimeProjectSteeringLookup) => Promise<RuntimeSkillDefinition[]>;
|
|
52
|
+
createLoadSkillTool: (
|
|
53
|
+
context: RuntimeLoadSkillToolContext,
|
|
54
|
+
) => ReturnType<HostedProjectSteeringAdapter["createLoadSkillTool"]>;
|
|
55
|
+
refreshProjectSkillIds: (context: HostedProjectSkillIdsContext) => Promise<void>;
|
|
56
|
+
getProjectSteeringAdapter: () => HostedProjectSteeringAdapter;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
function stringifyError(error: unknown): string {
|
|
60
|
+
return error instanceof Error ? error.message : String(error);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function createHostedAgentProjectSteering(
|
|
64
|
+
options: HostedAgentProjectSteeringOptions,
|
|
65
|
+
): HostedAgentProjectSteering {
|
|
66
|
+
const parsedOptions = hostedAgentProjectSteeringOptionsSchema.parse(options);
|
|
67
|
+
const agentsDir = resolveRuntimeAgentDefinitionsDir({
|
|
68
|
+
baseDir: parsedOptions.baseDir,
|
|
69
|
+
id: parsedOptions.agentId,
|
|
70
|
+
fileName: parsedOptions.fileName,
|
|
71
|
+
});
|
|
72
|
+
const agentFilePath = resolveRuntimeAgentMarkdownDefinitionFilePath({
|
|
73
|
+
agentsDir,
|
|
74
|
+
id: parsedOptions.agentId,
|
|
75
|
+
fileName: parsedOptions.fileName,
|
|
76
|
+
});
|
|
77
|
+
const skillsDir = parsedOptions.skillsDir ??
|
|
78
|
+
resolveRuntimeBuiltinSkillsDir(parsedOptions.baseDir);
|
|
79
|
+
|
|
80
|
+
let cachedAgentConfig: RuntimeAgentMarkdownDefinition | null = null;
|
|
81
|
+
let cachedProjectSteeringAdapter: HostedProjectSteeringAdapter | null = null;
|
|
82
|
+
|
|
83
|
+
function getAgentConfig(): RuntimeAgentMarkdownDefinition {
|
|
84
|
+
if (cachedAgentConfig) {
|
|
85
|
+
return cachedAgentConfig;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
try {
|
|
89
|
+
cachedAgentConfig = loadRuntimeAgentMarkdownDefinitionFromFile({
|
|
90
|
+
agentsDir,
|
|
91
|
+
id: parsedOptions.agentId,
|
|
92
|
+
fileName: parsedOptions.fileName,
|
|
93
|
+
});
|
|
94
|
+
return cachedAgentConfig;
|
|
95
|
+
} catch (error) {
|
|
96
|
+
options.logger?.error?.("Failed to load agent config", {
|
|
97
|
+
error: stringifyError(error),
|
|
98
|
+
filePath: agentFilePath,
|
|
99
|
+
});
|
|
100
|
+
throw error;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function getProjectSteeringAdapter(): HostedProjectSteeringAdapter {
|
|
105
|
+
if (cachedProjectSteeringAdapter) {
|
|
106
|
+
return cachedProjectSteeringAdapter;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
cachedProjectSteeringAdapter = createHostedProjectSteeringAdapter({
|
|
110
|
+
apiUrl: options.getApiUrl(),
|
|
111
|
+
skillsDir,
|
|
112
|
+
logger: options.logger,
|
|
113
|
+
trace: options.trace,
|
|
114
|
+
fetch: options.fetch,
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
return cachedProjectSteeringAdapter;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return {
|
|
121
|
+
getAgentConfig,
|
|
122
|
+
getProjectSteeringAdapter,
|
|
123
|
+
getProjectInstructions: (lookup) => getProjectSteeringAdapter().getProjectInstructions(lookup),
|
|
124
|
+
getSkillsConfig: (lookup) => getProjectSteeringAdapter().getSkillsConfig(lookup),
|
|
125
|
+
createLoadSkillTool: (context) => getProjectSteeringAdapter().createLoadSkillTool(context),
|
|
126
|
+
refreshProjectSkillIds: (context) =>
|
|
127
|
+
getProjectSteeringAdapter().refreshProjectSkillIds(context),
|
|
128
|
+
};
|
|
129
|
+
}
|
|
@@ -38,8 +38,19 @@ export const hostedAgentServiceConfigSchema = z.object({
|
|
|
38
38
|
export type HostedAgentServiceConfig = z.infer<typeof hostedAgentServiceConfigSchema>;
|
|
39
39
|
export type HostedAgentServiceConfigInput = z.input<typeof hostedAgentServiceConfigSchema>;
|
|
40
40
|
|
|
41
|
+
export const agentServiceConfigSchema = hostedAgentServiceConfigSchema;
|
|
42
|
+
|
|
43
|
+
export type AgentServiceConfig = HostedAgentServiceConfig;
|
|
44
|
+
export type AgentServiceConfigInput = HostedAgentServiceConfigInput;
|
|
45
|
+
|
|
41
46
|
export function parseHostedAgentServiceConfig(
|
|
42
47
|
input: HostedAgentServiceConfigInput,
|
|
43
48
|
): HostedAgentServiceConfig {
|
|
44
49
|
return hostedAgentServiceConfigSchema.parse(input);
|
|
45
50
|
}
|
|
51
|
+
|
|
52
|
+
export function parseAgentServiceConfig(
|
|
53
|
+
input: AgentServiceConfigInput,
|
|
54
|
+
): AgentServiceConfig {
|
|
55
|
+
return parseHostedAgentServiceConfig(input);
|
|
56
|
+
}
|
|
@@ -13,6 +13,9 @@ export type HostedAgentServiceEnvFileLoadOptions = {
|
|
|
13
13
|
files?: readonly string[];
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
+
export type AgentServiceEnvFileLoadResult = HostedAgentServiceEnvFileLoadResult;
|
|
17
|
+
export type AgentServiceEnvFileLoadOptions = HostedAgentServiceEnvFileLoadOptions;
|
|
18
|
+
|
|
16
19
|
function joinEnvPath(cwd: string, file: string): string {
|
|
17
20
|
if (file.startsWith("/") || file.startsWith("./") || file.startsWith("../")) {
|
|
18
21
|
return file;
|
|
@@ -53,3 +56,9 @@ export async function loadHostedAgentServiceEnvFiles(
|
|
|
53
56
|
|
|
54
57
|
return { loadedFiles, loadedVariables };
|
|
55
58
|
}
|
|
59
|
+
|
|
60
|
+
export async function loadAgentServiceEnvFiles(
|
|
61
|
+
options: AgentServiceEnvFileLoadOptions = {},
|
|
62
|
+
): Promise<AgentServiceEnvFileLoadResult> {
|
|
63
|
+
return loadHostedAgentServiceEnvFiles(options);
|
|
64
|
+
}
|
|
@@ -37,16 +37,22 @@ export type HostedAgentServiceRuntimeConfig = HostedServiceAuthConfig & {
|
|
|
37
37
|
ALLOWED_ORIGINS: string[];
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
+
export type AgentServiceRuntimeConfig = HostedAgentServiceRuntimeConfig;
|
|
41
|
+
|
|
40
42
|
export type HostedAgentServiceRuntimeLogger = VeryfrontServiceServerLogger & {
|
|
41
43
|
info(message: string, metadata?: Record<string, unknown>): void;
|
|
42
44
|
error(message: string, metadata?: Record<string, unknown>): void;
|
|
43
45
|
};
|
|
44
46
|
|
|
47
|
+
export type AgentServiceRuntimeLogger = HostedAgentServiceRuntimeLogger;
|
|
48
|
+
|
|
45
49
|
export type HostedAgentServiceRuntimeTrace = <TResult>(
|
|
46
50
|
operationName: string,
|
|
47
51
|
operation: () => Promise<TResult>,
|
|
48
52
|
) => Promise<TResult>;
|
|
49
53
|
|
|
54
|
+
export type AgentServiceRuntimeTrace = HostedAgentServiceRuntimeTrace;
|
|
55
|
+
|
|
50
56
|
export type CreateHostedAgentServiceRuntimeOptions<
|
|
51
57
|
TExecution extends object,
|
|
52
58
|
TConfig extends HostedAgentServiceRuntimeConfig = HostedAgentServiceRuntimeConfig,
|
|
@@ -72,6 +78,11 @@ export type CreateHostedAgentServiceRuntimeOptions<
|
|
|
72
78
|
drainTimeoutMs?: number;
|
|
73
79
|
};
|
|
74
80
|
|
|
81
|
+
export type CreateAgentServiceRuntimeOptions<
|
|
82
|
+
TExecution extends object,
|
|
83
|
+
TConfig extends AgentServiceRuntimeConfig = AgentServiceRuntimeConfig,
|
|
84
|
+
> = CreateHostedAgentServiceRuntimeOptions<TExecution, TConfig>;
|
|
85
|
+
|
|
75
86
|
export type HostedAgentServiceRuntimeBundle<
|
|
76
87
|
TExecution extends object,
|
|
77
88
|
TConfig extends HostedAgentServiceRuntimeConfig = HostedAgentServiceRuntimeConfig,
|
|
@@ -85,6 +96,11 @@ export type HostedAgentServiceRuntimeBundle<
|
|
|
85
96
|
runtime: AgentServiceRuntime;
|
|
86
97
|
};
|
|
87
98
|
|
|
99
|
+
export type AgentServiceRuntimeBundle<
|
|
100
|
+
TExecution extends object,
|
|
101
|
+
TConfig extends AgentServiceRuntimeConfig = AgentServiceRuntimeConfig,
|
|
102
|
+
> = HostedAgentServiceRuntimeBundle<TExecution, TConfig>;
|
|
103
|
+
|
|
88
104
|
export type StartNodeHostedAgentServiceOptions<
|
|
89
105
|
TExecution extends object,
|
|
90
106
|
TConfig extends HostedAgentServiceRuntimeConfig = HostedAgentServiceRuntimeConfig,
|
|
@@ -94,6 +110,11 @@ export type StartNodeHostedAgentServiceOptions<
|
|
|
94
110
|
signals?: readonly NodeJS.Signals[];
|
|
95
111
|
};
|
|
96
112
|
|
|
113
|
+
export type StartNodeAgentServiceOptions<
|
|
114
|
+
TExecution extends object,
|
|
115
|
+
TConfig extends AgentServiceRuntimeConfig = AgentServiceRuntimeConfig,
|
|
116
|
+
> = StartNodeHostedAgentServiceOptions<TExecution, TConfig>;
|
|
117
|
+
|
|
97
118
|
export type StartNodeHostedAgentServiceResult<
|
|
98
119
|
TExecution extends object,
|
|
99
120
|
TConfig extends HostedAgentServiceRuntimeConfig = HostedAgentServiceRuntimeConfig,
|
|
@@ -101,6 +122,11 @@ export type StartNodeHostedAgentServiceResult<
|
|
|
101
122
|
nodeServer: NodeAgentServiceServer;
|
|
102
123
|
};
|
|
103
124
|
|
|
125
|
+
export type StartNodeAgentServiceResult<
|
|
126
|
+
TExecution extends object,
|
|
127
|
+
TConfig extends AgentServiceRuntimeConfig = AgentServiceRuntimeConfig,
|
|
128
|
+
> = StartNodeHostedAgentServiceResult<TExecution, TConfig>;
|
|
129
|
+
|
|
104
130
|
function defaultTrace<TResult>(
|
|
105
131
|
_operationName: string,
|
|
106
132
|
operation: () => Promise<TResult>,
|
|
@@ -169,6 +195,15 @@ export function createHostedAgentServiceRuntime<
|
|
|
169
195
|
};
|
|
170
196
|
}
|
|
171
197
|
|
|
198
|
+
export function createAgentServiceRuntime<
|
|
199
|
+
TExecution extends object,
|
|
200
|
+
TConfig extends AgentServiceRuntimeConfig = AgentServiceRuntimeConfig,
|
|
201
|
+
>(
|
|
202
|
+
options: CreateAgentServiceRuntimeOptions<TExecution, TConfig>,
|
|
203
|
+
): AgentServiceRuntimeBundle<TExecution, TConfig> {
|
|
204
|
+
return createHostedAgentServiceRuntime(options);
|
|
205
|
+
}
|
|
206
|
+
|
|
172
207
|
export async function startNodeHostedAgentService<
|
|
173
208
|
TExecution extends object,
|
|
174
209
|
TConfig extends HostedAgentServiceRuntimeConfig = HostedAgentServiceRuntimeConfig,
|
|
@@ -192,3 +227,12 @@ export async function startNodeHostedAgentService<
|
|
|
192
227
|
nodeServer,
|
|
193
228
|
};
|
|
194
229
|
}
|
|
230
|
+
|
|
231
|
+
export async function startNodeAgentService<
|
|
232
|
+
TExecution extends object,
|
|
233
|
+
TConfig extends AgentServiceRuntimeConfig = AgentServiceRuntimeConfig,
|
|
234
|
+
>(
|
|
235
|
+
options: StartNodeAgentServiceOptions<TExecution, TConfig>,
|
|
236
|
+
): Promise<StartNodeAgentServiceResult<TExecution, TConfig>> {
|
|
237
|
+
return startNodeHostedAgentService(options);
|
|
238
|
+
}
|
package/src/src/agent/index.ts
CHANGED
|
@@ -281,41 +281,69 @@ export {
|
|
|
281
281
|
} from "./default-hosted-project-steering-refresh.js";
|
|
282
282
|
|
|
283
283
|
export {
|
|
284
|
+
type AgentServiceRuntimeBundle,
|
|
285
|
+
type AgentServiceRuntimeConfig,
|
|
286
|
+
type AgentServiceRuntimeLogger,
|
|
287
|
+
type AgentServiceRuntimeTrace,
|
|
288
|
+
createAgentServiceRuntime,
|
|
289
|
+
type CreateAgentServiceRuntimeOptions,
|
|
284
290
|
createHostedAgentServiceRuntime,
|
|
285
291
|
type CreateHostedAgentServiceRuntimeOptions,
|
|
286
292
|
type HostedAgentServiceRuntimeBundle,
|
|
287
293
|
type HostedAgentServiceRuntimeConfig,
|
|
288
294
|
type HostedAgentServiceRuntimeLogger,
|
|
289
295
|
type HostedAgentServiceRuntimeTrace,
|
|
296
|
+
startNodeAgentService,
|
|
297
|
+
type StartNodeAgentServiceOptions,
|
|
298
|
+
type StartNodeAgentServiceResult,
|
|
290
299
|
startNodeHostedAgentService,
|
|
291
300
|
type StartNodeHostedAgentServiceOptions,
|
|
292
301
|
type StartNodeHostedAgentServiceResult,
|
|
293
302
|
} from "./hosted-agent-service-runtime.js";
|
|
294
303
|
export {
|
|
304
|
+
type AgentServiceConfig,
|
|
305
|
+
type AgentServiceConfigInput,
|
|
306
|
+
agentServiceConfigSchema,
|
|
295
307
|
type HostedAgentServiceConfig,
|
|
296
308
|
type HostedAgentServiceConfigInput,
|
|
297
309
|
hostedAgentServiceConfigSchema,
|
|
310
|
+
parseAgentServiceConfig,
|
|
298
311
|
parseHostedAgentServiceConfig,
|
|
299
312
|
} from "./hosted-agent-service-config.js";
|
|
300
313
|
export {
|
|
314
|
+
type AgentServiceEnvFileLoadOptions,
|
|
315
|
+
type AgentServiceEnvFileLoadResult,
|
|
301
316
|
type HostedAgentServiceEnvFileLoadOptions,
|
|
302
317
|
type HostedAgentServiceEnvFileLoadResult,
|
|
318
|
+
loadAgentServiceEnvFiles,
|
|
303
319
|
loadHostedAgentServiceEnvFiles,
|
|
304
320
|
} from "./hosted-agent-service-env-files.js";
|
|
305
321
|
export {
|
|
322
|
+
initializeNodeAgentServiceOpenTelemetry,
|
|
323
|
+
type InitializeNodeAgentServiceTelemetryOptions,
|
|
306
324
|
initializeNodeHostedAgentServiceOpenTelemetry,
|
|
307
325
|
type InitializeNodeHostedAgentServiceTelemetryOptions,
|
|
326
|
+
type NodeAgentServiceInstrumentationConfig,
|
|
327
|
+
type NodeAgentServiceTelemetryConfig,
|
|
328
|
+
type NodeAgentServiceTelemetryEnv,
|
|
329
|
+
type NodeAgentServiceTelemetryLogger,
|
|
330
|
+
type NodeAgentServiceTelemetryProcessTarget,
|
|
308
331
|
type NodeHostedAgentServiceInstrumentationConfig,
|
|
309
332
|
type NodeHostedAgentServiceTelemetryConfig,
|
|
310
333
|
type NodeHostedAgentServiceTelemetryEnv,
|
|
311
334
|
type NodeHostedAgentServiceTelemetryLogger,
|
|
312
335
|
type NodeHostedAgentServiceTelemetryProcessTarget,
|
|
336
|
+
resolveNodeAgentServiceTelemetryConfig,
|
|
337
|
+
type ResolveNodeAgentServiceTelemetryConfigOptions,
|
|
313
338
|
resolveNodeHostedAgentServiceTelemetryConfig,
|
|
314
339
|
type ResolveNodeHostedAgentServiceTelemetryConfigOptions,
|
|
315
340
|
} from "./node-hosted-agent-service-telemetry.js";
|
|
316
341
|
export {
|
|
342
|
+
createNodeAgentServiceRuntimeInfrastructure,
|
|
343
|
+
type CreateNodeAgentServiceRuntimeInfrastructureOptions,
|
|
317
344
|
createNodeHostedAgentServiceRuntimeInfrastructure,
|
|
318
345
|
type CreateNodeHostedAgentServiceRuntimeInfrastructureOptions,
|
|
346
|
+
type NodeAgentServiceRuntimeInfrastructure,
|
|
319
347
|
type NodeHostedAgentServiceRuntimeInfrastructure,
|
|
320
348
|
} from "./node-hosted-agent-service-runtime-infrastructure.js";
|
|
321
349
|
export {
|
|
@@ -1021,6 +1049,14 @@ export {
|
|
|
1021
1049
|
type RuntimeProjectFilesFetch,
|
|
1022
1050
|
type RuntimeProjectFilesTrace,
|
|
1023
1051
|
} from "./runtime-project-files-client.js";
|
|
1052
|
+
export {
|
|
1053
|
+
createHostedAgentProjectSteering,
|
|
1054
|
+
type HostedAgentProjectSteering,
|
|
1055
|
+
type HostedAgentProjectSteeringLogger,
|
|
1056
|
+
type HostedAgentProjectSteeringOptions,
|
|
1057
|
+
type HostedAgentProjectSteeringOptionsData,
|
|
1058
|
+
hostedAgentProjectSteeringOptionsSchema,
|
|
1059
|
+
} from "./hosted-agent-project-steering.js";
|
|
1024
1060
|
export {
|
|
1025
1061
|
createHostedProjectSteeringAdapter,
|
|
1026
1062
|
type HostedProjectSkillIdsContext,
|
|
@@ -24,6 +24,9 @@ export type CreateNodeHostedAgentServiceRuntimeInfrastructureOptions = {
|
|
|
24
24
|
processTarget?: NodeHostedAgentServiceTelemetryProcessTarget;
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
+
export type CreateNodeAgentServiceRuntimeInfrastructureOptions =
|
|
28
|
+
CreateNodeHostedAgentServiceRuntimeInfrastructureOptions;
|
|
29
|
+
|
|
27
30
|
export type NodeHostedAgentServiceRuntimeInfrastructure = {
|
|
28
31
|
getConfig(): HostedAgentServiceConfig;
|
|
29
32
|
logger: Logger;
|
|
@@ -33,6 +36,8 @@ export type NodeHostedAgentServiceRuntimeInfrastructure = {
|
|
|
33
36
|
initializeOpenTelemetry(): Promise<boolean>;
|
|
34
37
|
};
|
|
35
38
|
|
|
39
|
+
export type NodeAgentServiceRuntimeInfrastructure = NodeHostedAgentServiceRuntimeInfrastructure;
|
|
40
|
+
|
|
36
41
|
export function createNodeHostedAgentServiceRuntimeInfrastructure(
|
|
37
42
|
options: CreateNodeHostedAgentServiceRuntimeInfrastructureOptions,
|
|
38
43
|
): NodeHostedAgentServiceRuntimeInfrastructure {
|
|
@@ -61,3 +66,9 @@ export function createNodeHostedAgentServiceRuntimeInfrastructure(
|
|
|
61
66
|
}),
|
|
62
67
|
};
|
|
63
68
|
}
|
|
69
|
+
|
|
70
|
+
export function createNodeAgentServiceRuntimeInfrastructure(
|
|
71
|
+
options: CreateNodeAgentServiceRuntimeInfrastructureOptions,
|
|
72
|
+
): NodeAgentServiceRuntimeInfrastructure {
|
|
73
|
+
return createNodeHostedAgentServiceRuntimeInfrastructure(options);
|
|
74
|
+
}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
export type NodeHostedAgentServiceTelemetryEnv = Record<string, string | undefined>;
|
|
2
2
|
|
|
3
|
+
export type NodeAgentServiceTelemetryEnv = NodeHostedAgentServiceTelemetryEnv;
|
|
4
|
+
|
|
3
5
|
export type NodeHostedAgentServiceInstrumentationConfig = {
|
|
4
6
|
http: boolean;
|
|
5
7
|
express: boolean;
|
|
6
8
|
fs: boolean;
|
|
7
9
|
};
|
|
8
10
|
|
|
11
|
+
export type NodeAgentServiceInstrumentationConfig = NodeHostedAgentServiceInstrumentationConfig;
|
|
12
|
+
|
|
9
13
|
export type NodeHostedAgentServiceTelemetryConfig = {
|
|
10
14
|
enabled: boolean;
|
|
11
15
|
serviceName: string;
|
|
@@ -16,6 +20,8 @@ export type NodeHostedAgentServiceTelemetryConfig = {
|
|
|
16
20
|
instrumentation: NodeHostedAgentServiceInstrumentationConfig;
|
|
17
21
|
};
|
|
18
22
|
|
|
23
|
+
export type NodeAgentServiceTelemetryConfig = NodeHostedAgentServiceTelemetryConfig;
|
|
24
|
+
|
|
19
25
|
export type ResolveNodeHostedAgentServiceTelemetryConfigOptions = {
|
|
20
26
|
env: NodeHostedAgentServiceTelemetryEnv;
|
|
21
27
|
defaultServiceName: string;
|
|
@@ -23,15 +29,22 @@ export type ResolveNodeHostedAgentServiceTelemetryConfigOptions = {
|
|
|
23
29
|
defaultEnabled?: boolean;
|
|
24
30
|
};
|
|
25
31
|
|
|
32
|
+
export type ResolveNodeAgentServiceTelemetryConfigOptions =
|
|
33
|
+
ResolveNodeHostedAgentServiceTelemetryConfigOptions;
|
|
34
|
+
|
|
26
35
|
export type NodeHostedAgentServiceTelemetryLogger = {
|
|
27
36
|
info(message: string, metadata?: Record<string, unknown>): void;
|
|
28
37
|
error(message: string, metadata?: Record<string, unknown>): void;
|
|
29
38
|
};
|
|
30
39
|
|
|
40
|
+
export type NodeAgentServiceTelemetryLogger = NodeHostedAgentServiceTelemetryLogger;
|
|
41
|
+
|
|
31
42
|
export type NodeHostedAgentServiceTelemetryProcessTarget = {
|
|
32
43
|
on(event: "SIGTERM", listener: () => void | Promise<void>): unknown;
|
|
33
44
|
};
|
|
34
45
|
|
|
46
|
+
export type NodeAgentServiceTelemetryProcessTarget = NodeHostedAgentServiceTelemetryProcessTarget;
|
|
47
|
+
|
|
35
48
|
export type InitializeNodeHostedAgentServiceTelemetryOptions =
|
|
36
49
|
& NodeHostedAgentServiceTelemetryConfig
|
|
37
50
|
& {
|
|
@@ -39,6 +52,9 @@ export type InitializeNodeHostedAgentServiceTelemetryOptions =
|
|
|
39
52
|
processTarget?: NodeHostedAgentServiceTelemetryProcessTarget;
|
|
40
53
|
};
|
|
41
54
|
|
|
55
|
+
export type InitializeNodeAgentServiceTelemetryOptions =
|
|
56
|
+
InitializeNodeHostedAgentServiceTelemetryOptions;
|
|
57
|
+
|
|
42
58
|
function resolveEnabled(env: NodeHostedAgentServiceTelemetryEnv, defaultEnabled: boolean): boolean {
|
|
43
59
|
const envValue = env.OTEL_ENABLED;
|
|
44
60
|
if (envValue !== undefined) {
|
|
@@ -98,6 +114,12 @@ export function resolveNodeHostedAgentServiceTelemetryConfig(
|
|
|
98
114
|
};
|
|
99
115
|
}
|
|
100
116
|
|
|
117
|
+
export function resolveNodeAgentServiceTelemetryConfig(
|
|
118
|
+
options: ResolveNodeAgentServiceTelemetryConfigOptions,
|
|
119
|
+
): NodeAgentServiceTelemetryConfig {
|
|
120
|
+
return resolveNodeHostedAgentServiceTelemetryConfig(options);
|
|
121
|
+
}
|
|
122
|
+
|
|
101
123
|
function logInfo(
|
|
102
124
|
logger: NodeHostedAgentServiceTelemetryLogger | undefined,
|
|
103
125
|
message: string,
|
|
@@ -190,3 +212,9 @@ export async function initializeNodeHostedAgentServiceOpenTelemetry(
|
|
|
190
212
|
return false;
|
|
191
213
|
}
|
|
192
214
|
}
|
|
215
|
+
|
|
216
|
+
export async function initializeNodeAgentServiceOpenTelemetry(
|
|
217
|
+
options: InitializeNodeAgentServiceTelemetryOptions,
|
|
218
|
+
): Promise<boolean> {
|
|
219
|
+
return initializeNodeHostedAgentServiceOpenTelemetry(options);
|
|
220
|
+
}
|