veryfront 0.1.508 → 0.1.510
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/{hosted-service-auth.d.ts → agent-service-auth.d.ts} +18 -1
- package/esm/src/agent/agent-service-auth.d.ts.map +1 -0
- package/esm/src/agent/{hosted-service-auth.js → agent-service-auth.js} +4 -0
- package/esm/src/agent/{hosted-agent-service-config.d.ts → agent-service-config.d.ts} +8 -8
- package/esm/src/agent/agent-service-config.d.ts.map +1 -0
- package/esm/src/agent/{hosted-agent-service-config.js → agent-service-config.js} +6 -6
- package/esm/src/agent/agent-service-env-files.d.ts +13 -0
- package/esm/src/agent/agent-service-env-files.d.ts.map +1 -0
- package/esm/src/agent/{hosted-agent-service-env-files.js → agent-service-env-files.js} +4 -6
- package/esm/src/agent/{hosted-agent-service-routes.d.ts → agent-service-routes.d.ts} +11 -2
- package/esm/src/agent/agent-service-routes.d.ts.map +1 -0
- package/esm/src/agent/{hosted-agent-service-routes.js → agent-service-routes.js} +2 -1
- package/esm/src/agent/{hosted-agent-service-runtime.d.ts → agent-service-runtime.d.ts} +12 -12
- package/esm/src/agent/agent-service-runtime.d.ts.map +1 -0
- package/esm/src/agent/{hosted-agent-service-runtime.js → agent-service-runtime.js} +11 -11
- package/esm/src/agent/default-hosted-chat-runtime.d.ts +2 -1
- package/esm/src/agent/default-hosted-chat-runtime.d.ts.map +1 -1
- package/esm/src/agent/default-hosted-chat-runtime.js +1 -1
- package/esm/src/agent/default-hosted-invoke-agent-tool.d.ts +2 -0
- package/esm/src/agent/default-hosted-invoke-agent-tool.d.ts.map +1 -1
- package/esm/src/agent/default-hosted-invoke-agent-tool.js +1 -0
- package/esm/src/agent/hosted-chat-runtime-tool-assembly.d.ts +2 -2
- package/esm/src/agent/hosted-chat-runtime-tool-assembly.d.ts.map +1 -1
- package/esm/src/agent/hosted-chat-runtime-tool-assembly.js +1 -1
- package/esm/src/agent/hosted-child-fork-tool-sources.d.ts +2 -1
- package/esm/src/agent/hosted-child-fork-tool-sources.d.ts.map +1 -1
- package/esm/src/agent/hosted-child-fork-tool-sources.js +44 -25
- package/esm/src/agent/hosted-project-remote-tool-source.d.ts +23 -3
- package/esm/src/agent/hosted-project-remote-tool-source.d.ts.map +1 -1
- package/esm/src/agent/hosted-project-remote-tool-source.js +55 -16
- package/esm/src/agent/hosted-project-steering-adapter.js +1 -1
- package/esm/src/agent/index.d.ts +8 -8
- package/esm/src/agent/index.d.ts.map +1 -1
- package/esm/src/agent/index.js +8 -8
- package/esm/src/agent/node-agent-service-runtime-infrastructure.d.ts +26 -0
- package/esm/src/agent/node-agent-service-runtime-infrastructure.d.ts.map +1 -0
- package/esm/src/agent/{node-hosted-agent-service-runtime-infrastructure.js → node-agent-service-runtime-infrastructure.js} +7 -9
- package/esm/src/agent/{node-hosted-agent-service-telemetry.d.ts → node-agent-service-telemetry.d.ts} +1 -1
- package/esm/src/agent/node-agent-service-telemetry.d.ts.map +1 -0
- package/esm/src/agent/veryfront-cloud-agent-service.d.ts +11 -10
- package/esm/src/agent/veryfront-cloud-agent-service.d.ts.map +1 -1
- package/esm/src/agent/veryfront-cloud-agent-service.js +16 -7
- 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/deps/esm.sh/@types/react-dom@19.2.3/client.d.ts +1 -1
- package/src/deps/esm.sh/@types/{react@19.2.14 → react@19.2.3}/global.d.ts +0 -1
- package/src/deps/esm.sh/@types/{react@19.2.14 → react@19.2.3}/index.d.ts +24 -93
- package/src/deps/esm.sh/react-dom@19.2.4/client.d.ts +1 -1
- package/src/src/agent/{hosted-service-auth.ts → agent-service-auth.ts} +21 -0
- package/src/src/agent/{hosted-agent-service-config.ts → agent-service-config.ts} +12 -13
- package/src/src/agent/{hosted-agent-service-env-files.ts → agent-service-env-files.ts} +10 -14
- package/src/src/agent/{hosted-agent-service-routes.ts → agent-service-routes.ts} +25 -1
- package/src/src/agent/{hosted-agent-service-runtime.ts → agent-service-runtime.ts} +39 -39
- package/src/src/agent/default-hosted-chat-runtime.ts +3 -2
- package/src/src/agent/default-hosted-invoke-agent-tool.ts +3 -0
- package/src/src/agent/hosted-chat-runtime-tool-assembly.ts +3 -2
- package/src/src/agent/hosted-child-fork-tool-sources.ts +52 -27
- package/src/src/agent/hosted-project-remote-tool-source.ts +115 -37
- package/src/src/agent/hosted-project-steering-adapter.ts +1 -1
- package/src/src/agent/index.ts +10 -8
- package/src/src/agent/{node-hosted-agent-service-runtime-infrastructure.ts → node-agent-service-runtime-infrastructure.ts} +27 -30
- package/src/src/agent/veryfront-cloud-agent-service.ts +32 -15
- package/src/src/utils/version-constant.ts +1 -1
- package/esm/src/agent/hosted-agent-service-config.d.ts.map +0 -1
- package/esm/src/agent/hosted-agent-service-env-files.d.ts +0 -13
- package/esm/src/agent/hosted-agent-service-env-files.d.ts.map +0 -1
- package/esm/src/agent/hosted-agent-service-routes.d.ts.map +0 -1
- package/esm/src/agent/hosted-agent-service-runtime.d.ts.map +0 -1
- package/esm/src/agent/hosted-service-auth.d.ts.map +0 -1
- package/esm/src/agent/node-hosted-agent-service-runtime-infrastructure.d.ts +0 -26
- package/esm/src/agent/node-hosted-agent-service-runtime-infrastructure.d.ts.map +0 -1
- package/esm/src/agent/node-hosted-agent-service-telemetry.d.ts.map +0 -1
- /package/esm/src/agent/{node-hosted-agent-service-telemetry.js → node-agent-service-telemetry.js} +0 -0
- /package/src/src/agent/{node-hosted-agent-service-telemetry.ts → node-agent-service-telemetry.ts} +0 -0
|
@@ -11,18 +11,18 @@ import {
|
|
|
11
11
|
type DetachedRunTracker,
|
|
12
12
|
} from "./detached-run-tracker.js";
|
|
13
13
|
import {
|
|
14
|
-
|
|
15
|
-
type
|
|
16
|
-
type
|
|
17
|
-
type
|
|
18
|
-
type
|
|
19
|
-
|
|
20
|
-
} from "./
|
|
14
|
+
type AgentServiceActiveSpanAttributes,
|
|
15
|
+
type AgentServiceDetachedCleanupInput,
|
|
16
|
+
type AgentServiceDetachedExecutionInput,
|
|
17
|
+
type AgentServiceRouteSet,
|
|
18
|
+
type AgentServiceStreamExecutionInput,
|
|
19
|
+
createAgentServiceRouteSet,
|
|
20
|
+
} from "./agent-service-routes.js";
|
|
21
21
|
import {
|
|
22
|
-
|
|
23
|
-
type
|
|
24
|
-
|
|
25
|
-
} from "./
|
|
22
|
+
type AgentServiceAuth,
|
|
23
|
+
type AgentServiceAuthConfig,
|
|
24
|
+
createAgentServiceAuth,
|
|
25
|
+
} from "./agent-service-auth.js";
|
|
26
26
|
import type { ParsedHostedChatRequest } from "./hosted-chat-request-parser.js";
|
|
27
27
|
import type { AgUiResumeValue } from "./ag-ui-tool-shared.js";
|
|
28
28
|
import type { RuntimeAgentMarkdownDefinition } from "./runtime-agent-definition.js";
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
} from "./agent-service-server.js";
|
|
35
35
|
import type { VeryfrontServiceServerLogger } from "../server/service-server.js";
|
|
36
36
|
|
|
37
|
-
export type HostedAgentServiceRuntimeConfig =
|
|
37
|
+
export type HostedAgentServiceRuntimeConfig = AgentServiceAuthConfig & {
|
|
38
38
|
PORT: number;
|
|
39
39
|
ALLOWED_ORIGINS: string[];
|
|
40
40
|
};
|
|
@@ -65,16 +65,16 @@ export type CreateHostedAgentServiceRuntimeOptions<
|
|
|
65
65
|
forwardedConfigNamespace?: string;
|
|
66
66
|
logger: HostedAgentServiceRuntimeLogger;
|
|
67
67
|
trace?: HostedAgentServiceRuntimeTrace;
|
|
68
|
-
setActiveSpanAttributes?: (attributes:
|
|
68
|
+
setActiveSpanAttributes?: (attributes: AgentServiceActiveSpanAttributes) => void;
|
|
69
69
|
prepareExecution: (req: ParsedHostedChatRequest) => Promise<TExecution>;
|
|
70
70
|
streamExecutionToAgUiResponse: (
|
|
71
|
-
input:
|
|
71
|
+
input: AgentServiceStreamExecutionInput<TExecution>,
|
|
72
72
|
) => Promise<Response> | Response;
|
|
73
73
|
startDetachedExecution: (
|
|
74
|
-
input:
|
|
74
|
+
input: AgentServiceDetachedExecutionInput<TExecution>,
|
|
75
75
|
) => Promise<void>;
|
|
76
76
|
cleanupExecution?: (
|
|
77
|
-
input:
|
|
77
|
+
input: AgentServiceDetachedCleanupInput<TExecution>,
|
|
78
78
|
) => Promise<void>;
|
|
79
79
|
tracker?: DetachedRunTracker<AgUiResumeValue>;
|
|
80
80
|
drainTimeoutMs?: number;
|
|
@@ -91,8 +91,8 @@ export type HostedAgentServiceRuntimeBundle<
|
|
|
91
91
|
> = {
|
|
92
92
|
config: TConfig;
|
|
93
93
|
tracker: DetachedRunTracker<AgUiResumeValue>;
|
|
94
|
-
auth:
|
|
95
|
-
routeSet:
|
|
94
|
+
auth: AgentServiceAuth;
|
|
95
|
+
routeSet: AgentServiceRouteSet<TExecution>;
|
|
96
96
|
routes: AgentServiceRoute[];
|
|
97
97
|
lifecycle: DetachedRunShutdownLifecycle;
|
|
98
98
|
runtime: AgentServiceRuntime;
|
|
@@ -152,21 +152,21 @@ function defaultTrace<TResult>(
|
|
|
152
152
|
return operation();
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
-
export function
|
|
155
|
+
export function createAgentServiceRuntime<
|
|
156
156
|
TExecution extends object,
|
|
157
|
-
TConfig extends
|
|
157
|
+
TConfig extends AgentServiceRuntimeConfig = AgentServiceRuntimeConfig,
|
|
158
158
|
>(
|
|
159
|
-
options:
|
|
160
|
-
):
|
|
159
|
+
options: CreateAgentServiceRuntimeOptions<TExecution, TConfig>,
|
|
160
|
+
): AgentServiceRuntimeBundle<TExecution, TConfig> {
|
|
161
161
|
const config = options.getConfig();
|
|
162
162
|
const tracker = options.tracker ?? createDetachedRunTracker<AgUiResumeValue>();
|
|
163
163
|
const trace = options.trace ?? defaultTrace;
|
|
164
|
-
const auth =
|
|
164
|
+
const auth = createAgentServiceAuth({
|
|
165
165
|
getConfig: options.getConfig,
|
|
166
166
|
logger: options.logger,
|
|
167
167
|
trace,
|
|
168
168
|
});
|
|
169
|
-
const routeSet =
|
|
169
|
+
const routeSet = createAgentServiceRouteSet({
|
|
170
170
|
forwardedConfigNamespace: options.forwardedConfigNamespace,
|
|
171
171
|
authenticateRequest: auth.authenticateRequest,
|
|
172
172
|
verifyProjectAccess: (projectId, authToken) => auth.verifyProjectAccess(projectId, authToken),
|
|
@@ -213,22 +213,22 @@ export function createHostedAgentServiceRuntime<
|
|
|
213
213
|
};
|
|
214
214
|
}
|
|
215
215
|
|
|
216
|
-
export function
|
|
216
|
+
export function createHostedAgentServiceRuntime<
|
|
217
217
|
TExecution extends object,
|
|
218
|
-
TConfig extends
|
|
218
|
+
TConfig extends HostedAgentServiceRuntimeConfig = HostedAgentServiceRuntimeConfig,
|
|
219
219
|
>(
|
|
220
|
-
options:
|
|
221
|
-
):
|
|
222
|
-
return
|
|
220
|
+
options: CreateHostedAgentServiceRuntimeOptions<TExecution, TConfig>,
|
|
221
|
+
): HostedAgentServiceRuntimeBundle<TExecution, TConfig> {
|
|
222
|
+
return createAgentServiceRuntime(options);
|
|
223
223
|
}
|
|
224
224
|
|
|
225
|
-
export async function
|
|
225
|
+
export async function startNodeAgentService<
|
|
226
226
|
TExecution extends object,
|
|
227
|
-
TConfig extends
|
|
227
|
+
TConfig extends AgentServiceRuntimeConfig = AgentServiceRuntimeConfig,
|
|
228
228
|
>(
|
|
229
|
-
options:
|
|
230
|
-
): Promise<
|
|
231
|
-
const bundle =
|
|
229
|
+
options: StartNodeAgentServiceOptions<TExecution, TConfig>,
|
|
230
|
+
): Promise<StartNodeAgentServiceResult<TExecution, TConfig>> {
|
|
231
|
+
const bundle = createAgentServiceRuntime(options);
|
|
232
232
|
const nodeServer = await startNodeAgentServiceServer({
|
|
233
233
|
runtime: bundle.runtime,
|
|
234
234
|
serviceName: options.serviceName,
|
|
@@ -246,13 +246,13 @@ export async function startNodeHostedAgentService<
|
|
|
246
246
|
};
|
|
247
247
|
}
|
|
248
248
|
|
|
249
|
-
export async function
|
|
249
|
+
export async function startNodeHostedAgentService<
|
|
250
250
|
TExecution extends object,
|
|
251
|
-
TConfig extends
|
|
251
|
+
TConfig extends HostedAgentServiceRuntimeConfig = HostedAgentServiceRuntimeConfig,
|
|
252
252
|
>(
|
|
253
|
-
options:
|
|
254
|
-
): Promise<
|
|
255
|
-
return
|
|
253
|
+
options: StartNodeHostedAgentServiceOptions<TExecution, TConfig>,
|
|
254
|
+
): Promise<StartNodeHostedAgentServiceResult<TExecution, TConfig>> {
|
|
255
|
+
return startNodeAgentService(options);
|
|
256
256
|
}
|
|
257
257
|
|
|
258
258
|
export async function startAgentServiceRuntime<
|
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
prepareHostedChatRuntimeToolAssembly,
|
|
31
31
|
type PrepareHostedChatRuntimeToolAssemblyInput,
|
|
32
32
|
} from "./hosted-chat-runtime-tool-assembly.js";
|
|
33
|
+
import type { HostedProjectMcpServerConfig } from "./hosted-project-remote-tool-source.js";
|
|
33
34
|
import {
|
|
34
35
|
createHostedRuntimeStateResolver,
|
|
35
36
|
type HostedRuntimeStateResolverContext,
|
|
@@ -45,7 +46,7 @@ export type DefaultHostedChatRuntimeConfig = {
|
|
|
45
46
|
apiUrl: string;
|
|
46
47
|
apiMcpUrl: string;
|
|
47
48
|
studioMcpUrl?: string | null;
|
|
48
|
-
|
|
49
|
+
mcpServers?: readonly HostedProjectMcpServerConfig[];
|
|
49
50
|
};
|
|
50
51
|
|
|
51
52
|
export type DefaultHostedChatRuntimeLogger = {
|
|
@@ -155,7 +156,7 @@ async function buildToolAssembly(
|
|
|
155
156
|
apiUrl: input.config.apiUrl,
|
|
156
157
|
apiMcpUrl: input.config.apiMcpUrl,
|
|
157
158
|
studioMcpUrl: input.config.studioMcpUrl,
|
|
158
|
-
|
|
159
|
+
mcpServers: input.config.mcpServers,
|
|
159
160
|
conversationId: input.options.conversationId,
|
|
160
161
|
allowedToolNames: input.options.allowedTools ?? null,
|
|
161
162
|
projectScopedRemoteToolOptions: input.projectScopedRemoteToolOptions,
|
|
@@ -29,6 +29,7 @@ import { startHostedChildForkRuntimeWithHostTools } from "./hosted-child-fork-ru
|
|
|
29
29
|
import {
|
|
30
30
|
prepareDefaultHostedChildForkSandboxToolSources,
|
|
31
31
|
} from "./hosted-child-fork-tool-sources.js";
|
|
32
|
+
import type { HostedProjectMcpServerConfig } from "./hosted-project-remote-tool-source.js";
|
|
32
33
|
import { executeHostedChildForkToolInput } from "./hosted-child-fork-execution-runner.js";
|
|
33
34
|
import { createHostedChildInvokeTool } from "./hosted-child-invoke-tool.js";
|
|
34
35
|
import {
|
|
@@ -79,6 +80,7 @@ export type DefaultHostedInvokeAgentConfig = {
|
|
|
79
80
|
apiUrl: string;
|
|
80
81
|
apiMcpUrl: string;
|
|
81
82
|
studioMcpUrl?: string | null;
|
|
83
|
+
mcpServers?: readonly HostedProjectMcpServerConfig[];
|
|
82
84
|
enableDurableInvokeAgent?: boolean;
|
|
83
85
|
};
|
|
84
86
|
|
|
@@ -220,6 +222,7 @@ async function prepareForkToolSources<TContext extends DefaultHostedInvokeAgentC
|
|
|
220
222
|
apiUrl: config.apiUrl,
|
|
221
223
|
apiMcpUrl: config.apiMcpUrl,
|
|
222
224
|
studioMcpUrl: config.studioMcpUrl,
|
|
225
|
+
mcpServers: config.mcpServers,
|
|
223
226
|
clientProfile: options.context.clientProfile,
|
|
224
227
|
getProjectId: () => options.context.projectId || null,
|
|
225
228
|
conversationId: options.context.conversationId,
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
} from "./default-research-artifact-support.js";
|
|
20
20
|
import {
|
|
21
21
|
createHostedProjectRemoteToolSources,
|
|
22
|
+
type HostedProjectMcpServerConfig,
|
|
22
23
|
type HostedProjectRemoteToolSourceMutationHandler,
|
|
23
24
|
type HostedProjectRemoteToolSourcePrepareToolInput,
|
|
24
25
|
type HostedProjectRemoteToolSourceProjectSwitchHandler,
|
|
@@ -58,7 +59,7 @@ export type PrepareHostedChatRuntimeToolAssemblyInput<
|
|
|
58
59
|
apiUrl: string;
|
|
59
60
|
apiMcpUrl: string;
|
|
60
61
|
studioMcpUrl?: string | null;
|
|
61
|
-
|
|
62
|
+
mcpServers?: readonly HostedProjectMcpServerConfig[];
|
|
62
63
|
conversationId?: string;
|
|
63
64
|
allowedToolNames?: HostedChatRuntimeAllowedToolNames;
|
|
64
65
|
projectScopedRemoteToolOptions?: ProjectScopedRemoteToolOptions;
|
|
@@ -121,7 +122,7 @@ export async function prepareHostedChatRuntimeToolAssembly<
|
|
|
121
122
|
authToken: input.taskContext.authToken,
|
|
122
123
|
apiMcpUrl: input.apiMcpUrl,
|
|
123
124
|
studioMcpUrl: input.studioMcpUrl,
|
|
124
|
-
|
|
125
|
+
mcpServers: input.mcpServers,
|
|
125
126
|
clientProfile: input.taskContext.clientProfile,
|
|
126
127
|
createRemoteToolSource: input.createRemoteToolSource ?? createRemoteMCPToolSource,
|
|
127
128
|
defaultProjectId: () => activeProjectId(input.taskContext),
|
|
@@ -14,6 +14,11 @@ import {
|
|
|
14
14
|
createLiveStudioMcpTools,
|
|
15
15
|
type LiveStudioMcpToolsOptions,
|
|
16
16
|
} from "./live-studio-mcp-tools.js";
|
|
17
|
+
import type { HostedProjectMcpServerConfig } from "./hosted-project-remote-tool-source.js";
|
|
18
|
+
import {
|
|
19
|
+
createHostedProjectGenericRemoteMcpConfig,
|
|
20
|
+
createHostedProjectVeryfrontApiRemoteMcpConfig,
|
|
21
|
+
} from "./hosted-project-remote-tool-source.js";
|
|
17
22
|
import type { RuntimeClientProfile } from "./runtime-client-profile.js";
|
|
18
23
|
import {
|
|
19
24
|
type HostedChildProjectSwitchHandler,
|
|
@@ -31,13 +36,13 @@ export type HostedChildForkToolSourcesLogger = {
|
|
|
31
36
|
export type PrepareDefaultHostedChildForkToolSourcesInput = {
|
|
32
37
|
authToken: string;
|
|
33
38
|
apiMcpUrl: string;
|
|
39
|
+
mcpServers?: readonly HostedProjectMcpServerConfig[];
|
|
34
40
|
getProjectId: () => string | null | undefined;
|
|
35
41
|
studioMcpUrl?: string | null;
|
|
36
42
|
clientProfile?: RuntimeClientProfile | null;
|
|
37
43
|
conversationId?: string;
|
|
38
44
|
globalTools?: HostToolSet;
|
|
39
45
|
abortSignal?: AbortSignal;
|
|
40
|
-
apiSourceId?: string;
|
|
41
46
|
onConfirmedStudioProjectSwitch?: HostedChildProjectSwitchHandler;
|
|
42
47
|
createRemoteToolSource?: (config: RemoteMCPToolSourceConfig) => RemoteToolSource;
|
|
43
48
|
createToolsFromRemoteDefinitions?: typeof createToolsFromRemoteDefinitions;
|
|
@@ -70,26 +75,59 @@ export type PrepareDefaultHostedChildForkSandboxToolSourcesInput =
|
|
|
70
75
|
) => Promise<AgentServiceSandboxToolsResult>;
|
|
71
76
|
};
|
|
72
77
|
|
|
78
|
+
function defaultChildForkMcpServers(): HostedProjectMcpServerConfig[] {
|
|
79
|
+
return [{ kind: "veryfront-api" }];
|
|
80
|
+
}
|
|
81
|
+
|
|
73
82
|
export async function prepareDefaultHostedChildForkToolSources(
|
|
74
83
|
input: PrepareDefaultHostedChildForkToolSourcesInput,
|
|
75
84
|
): Promise<DefaultHostedChildForkToolSourcesResult> {
|
|
85
|
+
throwIfAborted(input.abortSignal);
|
|
86
|
+
|
|
76
87
|
let closeStudioMcpTools: (() => Promise<void>) | undefined;
|
|
77
88
|
let studioMcpTools: HostToolSet = {};
|
|
89
|
+
let remoteMcpTools: HostToolSet = {};
|
|
78
90
|
const createLiveStudioTools = input.createLiveStudioTools ?? createLiveStudioMcpTools;
|
|
91
|
+
const createRemoteToolSource = input.createRemoteToolSource ?? createRemoteMCPToolSource;
|
|
92
|
+
const materializeRemoteTools = input.createToolsFromRemoteDefinitions ??
|
|
93
|
+
createToolsFromRemoteDefinitions;
|
|
79
94
|
|
|
80
95
|
try {
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
96
|
+
const mcpServers = input.mcpServers ?? defaultChildForkMcpServers();
|
|
97
|
+
for (const server of mcpServers) {
|
|
98
|
+
if (server.kind === "veryfront-studio") {
|
|
99
|
+
const studioTools = await createLiveStudioTools({
|
|
100
|
+
authToken: input.authToken,
|
|
101
|
+
clientProfile: input.clientProfile,
|
|
102
|
+
getProjectId: input.getProjectId,
|
|
103
|
+
studioMcpUrl: input.studioMcpUrl,
|
|
104
|
+
...(input.conversationId ? { conversationId: input.conversationId } : {}),
|
|
105
|
+
...(input.createRemoteToolSource
|
|
106
|
+
? { createRemoteToolSource: input.createRemoteToolSource }
|
|
107
|
+
: {}),
|
|
108
|
+
});
|
|
109
|
+
studioMcpTools = {
|
|
110
|
+
...studioMcpTools,
|
|
111
|
+
...studioTools.tools,
|
|
112
|
+
};
|
|
113
|
+
closeStudioMcpTools = studioTools.close;
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const remoteConfig = server.kind === "veryfront-api"
|
|
118
|
+
? createHostedProjectVeryfrontApiRemoteMcpConfig({
|
|
119
|
+
authToken: input.authToken,
|
|
120
|
+
apiMcpUrl: input.apiMcpUrl,
|
|
121
|
+
defaultSourceId: "veryfront-mcp-fork",
|
|
122
|
+
}, server)
|
|
123
|
+
: createHostedProjectGenericRemoteMcpConfig(server);
|
|
124
|
+
const remoteSource = createRemoteToolSource(remoteConfig);
|
|
125
|
+
const definitions = await remoteSource.listTools();
|
|
126
|
+
remoteMcpTools = {
|
|
127
|
+
...remoteMcpTools,
|
|
128
|
+
...materializeRemoteTools(remoteSource, definitions),
|
|
129
|
+
};
|
|
130
|
+
}
|
|
93
131
|
} catch (error) {
|
|
94
132
|
if (input.abortSignal?.aborted || input.isAbortError?.(error)) {
|
|
95
133
|
throw error;
|
|
@@ -108,19 +146,6 @@ export async function prepareDefaultHostedChildForkToolSources(
|
|
|
108
146
|
|
|
109
147
|
throwIfAborted(input.abortSignal);
|
|
110
148
|
|
|
111
|
-
const createRemoteToolSource = input.createRemoteToolSource ?? createRemoteMCPToolSource;
|
|
112
|
-
const materializeRemoteTools = input.createToolsFromRemoteDefinitions ??
|
|
113
|
-
createToolsFromRemoteDefinitions;
|
|
114
|
-
const apiMcpSource = createRemoteToolSource({
|
|
115
|
-
id: input.apiSourceId ?? "veryfront-mcp-fork",
|
|
116
|
-
endpoint: input.apiMcpUrl,
|
|
117
|
-
headers: {
|
|
118
|
-
Authorization: `Bearer ${input.authToken}`,
|
|
119
|
-
},
|
|
120
|
-
});
|
|
121
|
-
const apiMcpDefinitions = await apiMcpSource.listTools();
|
|
122
|
-
const apiMcpTools = materializeRemoteTools(apiMcpSource, apiMcpDefinitions);
|
|
123
|
-
|
|
124
149
|
if (input.onConfirmedStudioProjectSwitch) {
|
|
125
150
|
wrapHostedChildProjectSwitchTool({
|
|
126
151
|
tools: studioMcpTools,
|
|
@@ -133,7 +158,7 @@ export async function prepareDefaultHostedChildForkToolSources(
|
|
|
133
158
|
return {
|
|
134
159
|
ok: true,
|
|
135
160
|
forkTools: buildDefaultHostedChildForkToolSet(
|
|
136
|
-
|
|
161
|
+
remoteMcpTools,
|
|
137
162
|
studioMcpTools,
|
|
138
163
|
input.globalTools ?? {},
|
|
139
164
|
),
|
|
@@ -27,6 +27,31 @@ export type HostedProjectRemoteToolSourceProjectSwitchHandler = (
|
|
|
27
27
|
projectId: string,
|
|
28
28
|
) => Promise<void> | void;
|
|
29
29
|
|
|
30
|
+
export type HostedProjectVeryfrontApiMcpServerConfig = {
|
|
31
|
+
kind: "veryfront-api";
|
|
32
|
+
id?: string;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export type HostedProjectVeryfrontStudioMcpServerConfig = {
|
|
36
|
+
kind: "veryfront-studio";
|
|
37
|
+
id?: string;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export type HostedProjectGenericMcpServerConfig = {
|
|
41
|
+
kind?: "generic";
|
|
42
|
+
id?: string;
|
|
43
|
+
endpoint: RemoteMCPToolSourceConfig["endpoint"];
|
|
44
|
+
headers?: RemoteMCPToolSourceConfig["headers"];
|
|
45
|
+
fetch?: RemoteMCPToolSourceConfig["fetch"];
|
|
46
|
+
listMethod?: RemoteMCPToolSourceConfig["listMethod"];
|
|
47
|
+
callMethod?: RemoteMCPToolSourceConfig["callMethod"];
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export type HostedProjectMcpServerConfig =
|
|
51
|
+
| HostedProjectVeryfrontApiMcpServerConfig
|
|
52
|
+
| HostedProjectVeryfrontStudioMcpServerConfig
|
|
53
|
+
| HostedProjectGenericMcpServerConfig;
|
|
54
|
+
|
|
30
55
|
export type HostedProjectRemoteToolSourcePrepareToolInput = (input: {
|
|
31
56
|
toolName: string;
|
|
32
57
|
toolInput: Record<string, unknown>;
|
|
@@ -188,16 +213,87 @@ export type CreateHostedProjectRemoteToolSourcesInput =
|
|
|
188
213
|
authToken: string;
|
|
189
214
|
apiMcpUrl: string;
|
|
190
215
|
studioMcpUrl?: string | null;
|
|
191
|
-
|
|
216
|
+
mcpServers?: readonly HostedProjectMcpServerConfig[];
|
|
192
217
|
clientProfile?: RuntimeClientProfile | null;
|
|
193
218
|
getProjectId: () => string | null | undefined;
|
|
194
219
|
conversationId?: string;
|
|
195
|
-
apiSourceId?: string;
|
|
196
|
-
studioSourceId?: string;
|
|
197
220
|
createRemoteToolSource?: (config: RemoteMCPToolSourceConfig) => RemoteToolSource;
|
|
198
221
|
onStudioProjectSwitch?: HostedProjectRemoteToolSourceProjectSwitchHandler;
|
|
199
222
|
};
|
|
200
223
|
|
|
224
|
+
function defaultHostedProjectMcpServers(): HostedProjectMcpServerConfig[] {
|
|
225
|
+
return [{ kind: "veryfront-api" }];
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export function createHostedProjectGenericRemoteMcpConfig(
|
|
229
|
+
server: HostedProjectGenericMcpServerConfig,
|
|
230
|
+
): RemoteMCPToolSourceConfig {
|
|
231
|
+
const config: RemoteMCPToolSourceConfig = {
|
|
232
|
+
endpoint: server.endpoint,
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
if (server.id !== undefined) config.id = server.id;
|
|
236
|
+
if (server.headers !== undefined) config.headers = server.headers;
|
|
237
|
+
if (server.fetch !== undefined) config.fetch = server.fetch;
|
|
238
|
+
if (server.listMethod !== undefined) config.listMethod = server.listMethod;
|
|
239
|
+
if (server.callMethod !== undefined) config.callMethod = server.callMethod;
|
|
240
|
+
|
|
241
|
+
return config;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export function createHostedProjectVeryfrontApiRemoteMcpConfig(
|
|
245
|
+
input: Pick<CreateHostedProjectRemoteToolSourcesInput, "apiMcpUrl" | "authToken"> & {
|
|
246
|
+
defaultSourceId?: string;
|
|
247
|
+
},
|
|
248
|
+
server: HostedProjectVeryfrontApiMcpServerConfig,
|
|
249
|
+
): RemoteMCPToolSourceConfig {
|
|
250
|
+
return {
|
|
251
|
+
id: server.id ?? input.defaultSourceId ?? "veryfront-mcp",
|
|
252
|
+
endpoint: input.apiMcpUrl,
|
|
253
|
+
headers: {
|
|
254
|
+
Authorization: `Bearer ${input.authToken}`,
|
|
255
|
+
},
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
function createVeryfrontStudioRemoteMcpConfig(
|
|
260
|
+
input: Pick<
|
|
261
|
+
CreateHostedProjectRemoteToolSourcesInput,
|
|
262
|
+
"authToken" | "clientProfile" | "conversationId" | "getProjectId" | "studioMcpUrl"
|
|
263
|
+
>,
|
|
264
|
+
server: HostedProjectVeryfrontStudioMcpServerConfig,
|
|
265
|
+
): RemoteMCPToolSourceConfig | null {
|
|
266
|
+
if (!input.studioMcpUrl || !clientAllowsStudioMcp(input.clientProfile)) {
|
|
267
|
+
return null;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
return {
|
|
271
|
+
id: server.id ?? "studio-mcp",
|
|
272
|
+
endpoint: input.studioMcpUrl,
|
|
273
|
+
headers: () =>
|
|
274
|
+
buildStudioMcpHeaders(
|
|
275
|
+
input.authToken,
|
|
276
|
+
input.getProjectId() ?? null,
|
|
277
|
+
input.conversationId,
|
|
278
|
+
),
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
function createRemoteMcpConfig(
|
|
283
|
+
input: CreateHostedProjectRemoteToolSourcesInput,
|
|
284
|
+
server: HostedProjectMcpServerConfig,
|
|
285
|
+
): RemoteMCPToolSourceConfig | null {
|
|
286
|
+
if (server.kind === "veryfront-api") {
|
|
287
|
+
return createHostedProjectVeryfrontApiRemoteMcpConfig(input, server);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
if (server.kind === "veryfront-studio") {
|
|
291
|
+
return createVeryfrontStudioRemoteMcpConfig(input, server);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
return createHostedProjectGenericRemoteMcpConfig(server);
|
|
295
|
+
}
|
|
296
|
+
|
|
201
297
|
function createHostedProjectRemoteToolSourceFromConfig(
|
|
202
298
|
input: CreateHostedProjectRemoteToolSourcesInput,
|
|
203
299
|
source: RemoteToolSource,
|
|
@@ -230,41 +326,23 @@ export function createHostedProjectRemoteToolSources(
|
|
|
230
326
|
input: CreateHostedProjectRemoteToolSourcesInput,
|
|
231
327
|
): RemoteToolSource[] {
|
|
232
328
|
const createRemoteToolSource = input.createRemoteToolSource ?? createRemoteMCPToolSource;
|
|
233
|
-
const sources = [
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
},
|
|
242
|
-
}),
|
|
243
|
-
),
|
|
244
|
-
];
|
|
245
|
-
|
|
246
|
-
if (
|
|
247
|
-
!input.studioMcpEnabled || !input.studioMcpUrl || !clientAllowsStudioMcp(input.clientProfile)
|
|
248
|
-
) {
|
|
249
|
-
return sources;
|
|
250
|
-
}
|
|
329
|
+
const sources: RemoteToolSource[] = [];
|
|
330
|
+
const mcpServers = input.mcpServers ?? defaultHostedProjectMcpServers();
|
|
331
|
+
|
|
332
|
+
for (const server of mcpServers) {
|
|
333
|
+
const remoteConfig = createRemoteMcpConfig(input, server);
|
|
334
|
+
if (!remoteConfig) {
|
|
335
|
+
continue;
|
|
336
|
+
}
|
|
251
337
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
input.authToken,
|
|
261
|
-
input.getProjectId() ?? null,
|
|
262
|
-
input.conversationId,
|
|
263
|
-
),
|
|
264
|
-
}),
|
|
265
|
-
input.onStudioProjectSwitch,
|
|
266
|
-
),
|
|
267
|
-
);
|
|
338
|
+
sources.push(
|
|
339
|
+
createHostedProjectRemoteToolSourceFromConfig(
|
|
340
|
+
input,
|
|
341
|
+
createRemoteToolSource(remoteConfig),
|
|
342
|
+
server.kind === "veryfront-studio" ? input.onStudioProjectSwitch : undefined,
|
|
343
|
+
),
|
|
344
|
+
);
|
|
345
|
+
}
|
|
268
346
|
|
|
269
347
|
return sources;
|
|
270
348
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Tool } from "../tool/index.js";
|
|
2
|
-
import { HostedServiceAuthError, isHostedServiceAuthError } from "./
|
|
2
|
+
import { HostedServiceAuthError, isHostedServiceAuthError } from "./agent-service-auth.js";
|
|
3
3
|
import {
|
|
4
4
|
listRuntimeBuiltinSkillReferences,
|
|
5
5
|
readRuntimeBuiltinSkill,
|
package/src/src/agent/index.ts
CHANGED
|
@@ -334,16 +334,18 @@ export {
|
|
|
334
334
|
startNodeHostedAgentService,
|
|
335
335
|
type StartNodeHostedAgentServiceOptions,
|
|
336
336
|
type StartNodeHostedAgentServiceResult,
|
|
337
|
-
} from "./
|
|
337
|
+
} from "./agent-service-runtime.js";
|
|
338
338
|
export {
|
|
339
339
|
createNodeVeryfrontCloudAgentServiceRuntime,
|
|
340
|
-
type
|
|
340
|
+
type NodeVeryfrontCloudAgentServiceMcpServer,
|
|
341
341
|
type NodeVeryfrontCloudAgentServiceOptions,
|
|
342
342
|
type NodeVeryfrontCloudAgentServicePreparedExecution,
|
|
343
343
|
type NodeVeryfrontCloudAgentServiceProcessTarget,
|
|
344
344
|
startAgentService,
|
|
345
345
|
startNodeVeryfrontCloudAgentService,
|
|
346
346
|
type VeryfrontCloudAgentServiceOptions,
|
|
347
|
+
veryfrontMcpServer,
|
|
348
|
+
type VeryfrontMcpServerKind,
|
|
347
349
|
} from "./veryfront-cloud-agent-service.js";
|
|
348
350
|
export {
|
|
349
351
|
type AgentServiceConfig,
|
|
@@ -354,7 +356,7 @@ export {
|
|
|
354
356
|
hostedAgentServiceConfigSchema,
|
|
355
357
|
parseAgentServiceConfig,
|
|
356
358
|
parseHostedAgentServiceConfig,
|
|
357
|
-
} from "./
|
|
359
|
+
} from "./agent-service-config.js";
|
|
358
360
|
export {
|
|
359
361
|
type AgentServiceEnvFileLoadOptions,
|
|
360
362
|
type AgentServiceEnvFileLoadResult,
|
|
@@ -362,7 +364,7 @@ export {
|
|
|
362
364
|
type HostedAgentServiceEnvFileLoadResult,
|
|
363
365
|
loadAgentServiceEnvFiles,
|
|
364
366
|
loadHostedAgentServiceEnvFiles,
|
|
365
|
-
} from "./
|
|
367
|
+
} from "./agent-service-env-files.js";
|
|
366
368
|
export {
|
|
367
369
|
initializeNodeAgentServiceOpenTelemetry,
|
|
368
370
|
type InitializeNodeAgentServiceTelemetryOptions,
|
|
@@ -382,7 +384,7 @@ export {
|
|
|
382
384
|
type ResolveNodeAgentServiceTelemetryConfigOptions,
|
|
383
385
|
resolveNodeHostedAgentServiceTelemetryConfig,
|
|
384
386
|
type ResolveNodeHostedAgentServiceTelemetryConfigOptions,
|
|
385
|
-
} from "./node-
|
|
387
|
+
} from "./node-agent-service-telemetry.js";
|
|
386
388
|
export {
|
|
387
389
|
createNodeAgentServiceRuntimeInfrastructure,
|
|
388
390
|
type CreateNodeAgentServiceRuntimeInfrastructureOptions,
|
|
@@ -390,7 +392,7 @@ export {
|
|
|
390
392
|
type CreateNodeHostedAgentServiceRuntimeInfrastructureOptions,
|
|
391
393
|
type NodeAgentServiceRuntimeInfrastructure,
|
|
392
394
|
type NodeHostedAgentServiceRuntimeInfrastructure,
|
|
393
|
-
} from "./node-
|
|
395
|
+
} from "./node-agent-service-runtime-infrastructure.js";
|
|
394
396
|
export {
|
|
395
397
|
type AgentServiceBootstrapExit,
|
|
396
398
|
type AgentServiceTraceContext,
|
|
@@ -530,7 +532,7 @@ export {
|
|
|
530
532
|
type HostedAgentServiceRoutesTrace as AgentServiceRoutesTrace,
|
|
531
533
|
type HostedAgentServiceStreamExecutionInput,
|
|
532
534
|
type HostedAgentServiceStreamExecutionInput as AgentServiceStreamExecutionInput,
|
|
533
|
-
} from "./
|
|
535
|
+
} from "./agent-service-routes.js";
|
|
534
536
|
export {
|
|
535
537
|
createHostedRuntimeStateResolver,
|
|
536
538
|
type CreateHostedRuntimeStateResolverOptions,
|
|
@@ -1726,4 +1728,4 @@ export {
|
|
|
1726
1728
|
type HostedServiceProjectAccessResult as AgentServiceProjectAccessResult,
|
|
1727
1729
|
isHostedServiceAuthError,
|
|
1728
1730
|
isHostedServiceAuthError as isAgentServiceAuthError,
|
|
1729
|
-
} from "./
|
|
1731
|
+
} from "./agent-service-auth.js";
|