veryfront 0.1.509 → 0.1.511
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-mcp-server-config.d.ts +33 -0
- package/esm/src/agent/agent-service-mcp-server-config.d.ts.map +1 -0
- package/esm/src/agent/agent-service-mcp-server-config.js +49 -0
- 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 -1
- 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 +43 -25
- package/esm/src/agent/hosted-project-remote-tool-source.d.ts +3 -4
- package/esm/src/agent/hosted-project-remote-tool-source.d.ts.map +1 -1
- package/esm/src/agent/hosted-project-remote-tool-source.js +17 -18
- package/esm/src/agent/index.d.ts +1 -1
- package/esm/src/agent/index.d.ts.map +1 -1
- package/esm/src/agent/index.js +1 -1
- package/esm/src/agent/veryfront-cloud-agent-service.d.ts +9 -8
- package/esm/src/agent/veryfront-cloud-agent-service.d.ts.map +1 -1
- package/esm/src/agent/veryfront-cloud-agent-service.js +13 -4
- 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-mcp-server-config.ts +112 -0
- 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 +50 -27
- package/src/src/agent/hosted-project-remote-tool-source.ts +30 -38
- package/src/src/agent/index.ts +3 -1
- package/src/src/agent/veryfront-cloud-agent-service.ts +29 -12
- package/src/src/utils/version-constant.ts +1 -1
|
@@ -3,6 +3,7 @@ import { type RunAgentServiceMainOptions } from "./agent-service-bootstrap.js";
|
|
|
3
3
|
import { type HostedChatRuntimeCreationResult } from "./hosted-chat-runtime-contract.js";
|
|
4
4
|
import type { HostedConversationRootRunContext } from "./conversation-root-run-lifecycle.js";
|
|
5
5
|
import { type AgentRuntimeMessage } from "./agent-runtime-message-adapter.js";
|
|
6
|
+
import type { AgentServiceMcpServerConfig } from "./agent-service-mcp-server-config.js";
|
|
6
7
|
import { type CreateNodeAgentServiceRuntimeInfrastructureOptions } from "./node-agent-service-runtime-infrastructure.js";
|
|
7
8
|
import { type AgentServiceRuntimeBundle, type AgentServiceRuntimeConfig, type StartNodeAgentServiceResult } from "./agent-service-runtime.js";
|
|
8
9
|
import type { PreparedHostedChatExecution } from "./prepared-hosted-chat-execution.js";
|
|
@@ -11,13 +12,9 @@ export type NodeVeryfrontCloudAgentServiceProcessTarget = NonNullable<RunAgentSe
|
|
|
11
12
|
exit?: (code: number) => never | void;
|
|
12
13
|
};
|
|
13
14
|
export type NodeVeryfrontCloudAgentServiceAgentSource = "auto" | "code" | "markdown";
|
|
14
|
-
export type
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
* API MCP tools remain part of the Veryfront Cloud service preset.
|
|
18
|
-
*/
|
|
19
|
-
studio?: boolean;
|
|
20
|
-
};
|
|
15
|
+
export type VeryfrontMcpServerKind = "api" | "studio";
|
|
16
|
+
export type NodeVeryfrontCloudAgentServiceMcpServer = AgentServiceMcpServerConfig;
|
|
17
|
+
export declare function veryfrontMcpServer(kind?: VeryfrontMcpServerKind): AgentServiceMcpServerConfig;
|
|
21
18
|
type AgentServicePathOption = string | URL;
|
|
22
19
|
export type NodeVeryfrontCloudAgentServiceOptions = {
|
|
23
20
|
serviceName: string;
|
|
@@ -33,7 +30,11 @@ export type NodeVeryfrontCloudAgentServiceOptions = {
|
|
|
33
30
|
*/
|
|
34
31
|
entrypointUrl?: AgentServicePathOption;
|
|
35
32
|
agentSource?: NodeVeryfrontCloudAgentServiceAgentSource;
|
|
36
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Remote MCP servers available to the runtime. Defaults to the Veryfront API
|
|
35
|
+
* MCP server. Pass [] to run without remote MCP tools.
|
|
36
|
+
*/
|
|
37
|
+
mcpServers?: readonly NodeVeryfrontCloudAgentServiceMcpServer[];
|
|
37
38
|
forwardedConfigNamespace?: string;
|
|
38
39
|
createBashTool?: AgentServiceSandboxToolsOptions["createBashTool"];
|
|
39
40
|
env?: CreateNodeAgentServiceRuntimeInfrastructureOptions["env"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"veryfront-cloud-agent-service.d.ts","sourceRoot":"","sources":["../../../src/src/agent/veryfront-cloud-agent-service.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,qBAAqB,CAAC;AA+B3E,OAAO,EAGL,KAAK,0BAA0B,EAChC,MAAM,8BAA8B,CAAC;AAItC,OAAO,EAAE,KAAK,+BAA+B,EAAE,MAAM,mCAAmC,CAAC;AACzF,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,sCAAsC,CAAC;AAC7F,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"veryfront-cloud-agent-service.d.ts","sourceRoot":"","sources":["../../../src/src/agent/veryfront-cloud-agent-service.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,qBAAqB,CAAC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
|
29
29
|
import { prepareVeryfrontCloudHostedChatExecution, } from "./veryfront-cloud-hosted-chat-execution-preparation.js";
|
|
30
30
|
import { applyAgentProjectContextChange } from "./project-context.js";
|
|
31
31
|
import { agentRegistry, getAgent } from "./composition/index.js";
|
|
32
|
+
export function veryfrontMcpServer(kind = "api") {
|
|
33
|
+
if (kind === "studio") {
|
|
34
|
+
return { kind: "veryfront-studio" };
|
|
35
|
+
}
|
|
36
|
+
return { kind: "veryfront-api" };
|
|
37
|
+
}
|
|
32
38
|
const DEFAULT_FORWARDED_CONFIG_NAMESPACE = "veryfront";
|
|
33
39
|
const DEFAULT_DRAIN_TIMEOUT_MS = 15_000;
|
|
34
40
|
const DEFAULT_HARD_SHUTDOWN_TIMEOUT_MS = 20_000;
|
|
@@ -83,6 +89,9 @@ function resolveDefaultProcessTarget() {
|
|
|
83
89
|
}
|
|
84
90
|
return process;
|
|
85
91
|
}
|
|
92
|
+
function resolveMcpServers(options) {
|
|
93
|
+
return options.mcpServers ?? [veryfrontMcpServer()];
|
|
94
|
+
}
|
|
86
95
|
async function loadDefaultCreateBashTool() {
|
|
87
96
|
const { createBashTool } = await import("bash-tool");
|
|
88
97
|
return createBashTool;
|
|
@@ -232,11 +241,11 @@ function setFilteredTraceAttributes(context, attributes) {
|
|
|
232
241
|
}
|
|
233
242
|
function getInvokeAgentConfig(context) {
|
|
234
243
|
const config = context.infrastructure.getConfig();
|
|
235
|
-
const studioMcpUrl = context.options.mcp?.studio ? config.VERYFRONT_STUDIO_MCP_URL : "";
|
|
236
244
|
return {
|
|
237
245
|
apiUrl: config.VERYFRONT_API_URL,
|
|
238
246
|
apiMcpUrl: config.VERYFRONT_MCP_URL,
|
|
239
|
-
studioMcpUrl,
|
|
247
|
+
studioMcpUrl: config.VERYFRONT_STUDIO_MCP_URL,
|
|
248
|
+
mcpServers: resolveMcpServers(context.options),
|
|
240
249
|
enableDurableInvokeAgent: config.VERYFRONT_ENABLE_DURABLE_INVOKE_AGENT,
|
|
241
250
|
};
|
|
242
251
|
}
|
|
@@ -297,8 +306,8 @@ function createAgentRuntime(context, options) {
|
|
|
297
306
|
config: {
|
|
298
307
|
apiUrl: config.VERYFRONT_API_URL,
|
|
299
308
|
apiMcpUrl: config.VERYFRONT_MCP_URL,
|
|
300
|
-
studioMcpUrl:
|
|
301
|
-
|
|
309
|
+
studioMcpUrl: config.VERYFRONT_STUDIO_MCP_URL,
|
|
310
|
+
mcpServers: resolveMcpServers(context.options),
|
|
302
311
|
},
|
|
303
312
|
buildLocalTools: (taskContext) => buildLocalTools(context, options, taskContext),
|
|
304
313
|
refreshSystem,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.1.
|
|
1
|
+
export declare const VERSION = "0.1.511";
|
|
2
2
|
//# sourceMappingURL=version-constant.d.ts.map
|
package/package.json
CHANGED
package/src/deno.js
CHANGED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import type { RemoteMCPToolSourceConfig } from "../tool/index.js";
|
|
2
|
+
import { buildStudioMcpHeaders } from "./live-studio-mcp-tools.js";
|
|
3
|
+
import { clientAllowsStudioMcp, type RuntimeClientProfile } from "./runtime-client-profile.js";
|
|
4
|
+
|
|
5
|
+
export type AgentServiceVeryfrontApiMcpServerConfig = {
|
|
6
|
+
kind: "veryfront-api";
|
|
7
|
+
id?: string;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export type AgentServiceVeryfrontStudioMcpServerConfig = {
|
|
11
|
+
kind: "veryfront-studio";
|
|
12
|
+
id?: string;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type AgentServiceGenericMcpServerConfig = {
|
|
16
|
+
kind?: "generic";
|
|
17
|
+
id?: string;
|
|
18
|
+
endpoint: RemoteMCPToolSourceConfig["endpoint"];
|
|
19
|
+
headers?: RemoteMCPToolSourceConfig["headers"];
|
|
20
|
+
fetch?: RemoteMCPToolSourceConfig["fetch"];
|
|
21
|
+
listMethod?: RemoteMCPToolSourceConfig["listMethod"];
|
|
22
|
+
callMethod?: RemoteMCPToolSourceConfig["callMethod"];
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export type AgentServiceMcpServerConfig =
|
|
26
|
+
| AgentServiceVeryfrontApiMcpServerConfig
|
|
27
|
+
| AgentServiceVeryfrontStudioMcpServerConfig
|
|
28
|
+
| AgentServiceGenericMcpServerConfig;
|
|
29
|
+
|
|
30
|
+
export type CreateAgentServiceRemoteMcpConfigInput = {
|
|
31
|
+
server: AgentServiceMcpServerConfig;
|
|
32
|
+
authToken: string;
|
|
33
|
+
apiMcpUrl: string;
|
|
34
|
+
studioMcpUrl?: string | null;
|
|
35
|
+
clientProfile?: RuntimeClientProfile | null;
|
|
36
|
+
getProjectId?: () => string | null | undefined;
|
|
37
|
+
conversationId?: string;
|
|
38
|
+
defaultSourceId?: string;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export function defaultAgentServiceMcpServers(): AgentServiceMcpServerConfig[] {
|
|
42
|
+
return [{ kind: "veryfront-api" }];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function createGenericRemoteMcpConfig(
|
|
46
|
+
server: AgentServiceGenericMcpServerConfig,
|
|
47
|
+
): RemoteMCPToolSourceConfig {
|
|
48
|
+
const config: RemoteMCPToolSourceConfig = {
|
|
49
|
+
endpoint: server.endpoint,
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
if (server.id !== undefined) config.id = server.id;
|
|
53
|
+
if (server.headers !== undefined) config.headers = server.headers;
|
|
54
|
+
if (server.fetch !== undefined) config.fetch = server.fetch;
|
|
55
|
+
if (server.listMethod !== undefined) config.listMethod = server.listMethod;
|
|
56
|
+
if (server.callMethod !== undefined) config.callMethod = server.callMethod;
|
|
57
|
+
|
|
58
|
+
return config;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function createVeryfrontApiRemoteMcpConfig(
|
|
62
|
+
input: Pick<
|
|
63
|
+
CreateAgentServiceRemoteMcpConfigInput,
|
|
64
|
+
"apiMcpUrl" | "authToken" | "defaultSourceId"
|
|
65
|
+
>,
|
|
66
|
+
server: AgentServiceVeryfrontApiMcpServerConfig,
|
|
67
|
+
): RemoteMCPToolSourceConfig {
|
|
68
|
+
return {
|
|
69
|
+
id: server.id ?? input.defaultSourceId ?? "veryfront-mcp",
|
|
70
|
+
endpoint: input.apiMcpUrl,
|
|
71
|
+
headers: {
|
|
72
|
+
Authorization: `Bearer ${input.authToken}`,
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function createVeryfrontStudioRemoteMcpConfig(
|
|
78
|
+
input: Pick<
|
|
79
|
+
CreateAgentServiceRemoteMcpConfigInput,
|
|
80
|
+
"authToken" | "clientProfile" | "conversationId" | "getProjectId" | "studioMcpUrl"
|
|
81
|
+
>,
|
|
82
|
+
server: AgentServiceVeryfrontStudioMcpServerConfig,
|
|
83
|
+
): RemoteMCPToolSourceConfig | null {
|
|
84
|
+
if (!input.studioMcpUrl || !clientAllowsStudioMcp(input.clientProfile)) {
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return {
|
|
89
|
+
id: server.id ?? "studio-mcp",
|
|
90
|
+
endpoint: input.studioMcpUrl,
|
|
91
|
+
headers: () =>
|
|
92
|
+
buildStudioMcpHeaders(
|
|
93
|
+
input.authToken,
|
|
94
|
+
input.getProjectId?.() ?? null,
|
|
95
|
+
input.conversationId,
|
|
96
|
+
),
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export function createAgentServiceRemoteMcpConfig(
|
|
101
|
+
input: CreateAgentServiceRemoteMcpConfigInput,
|
|
102
|
+
): RemoteMCPToolSourceConfig | null {
|
|
103
|
+
if (input.server.kind === "veryfront-api") {
|
|
104
|
+
return createVeryfrontApiRemoteMcpConfig(input, input.server);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (input.server.kind === "veryfront-studio") {
|
|
108
|
+
return createVeryfrontStudioRemoteMcpConfig(input, input.server);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return createGenericRemoteMcpConfig(input.server);
|
|
112
|
+
}
|
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
prepareHostedChatRuntimeToolAssembly,
|
|
31
31
|
type PrepareHostedChatRuntimeToolAssemblyInput,
|
|
32
32
|
} from "./hosted-chat-runtime-tool-assembly.js";
|
|
33
|
+
import type { AgentServiceMcpServerConfig } from "./agent-service-mcp-server-config.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 AgentServiceMcpServerConfig[];
|
|
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 { AgentServiceMcpServerConfig } from "./agent-service-mcp-server-config.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 AgentServiceMcpServerConfig[];
|
|
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,
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
fetchLatestConversationUserText,
|
|
18
18
|
updateDefaultResearchArtifacts,
|
|
19
19
|
} from "./default-research-artifact-support.js";
|
|
20
|
+
import { type AgentServiceMcpServerConfig } from "./agent-service-mcp-server-config.js";
|
|
20
21
|
import {
|
|
21
22
|
createHostedProjectRemoteToolSources,
|
|
22
23
|
type HostedProjectRemoteToolSourceMutationHandler,
|
|
@@ -58,7 +59,7 @@ export type PrepareHostedChatRuntimeToolAssemblyInput<
|
|
|
58
59
|
apiUrl: string;
|
|
59
60
|
apiMcpUrl: string;
|
|
60
61
|
studioMcpUrl?: string | null;
|
|
61
|
-
|
|
62
|
+
mcpServers?: readonly AgentServiceMcpServerConfig[];
|
|
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),
|
|
@@ -5,6 +5,11 @@ import {
|
|
|
5
5
|
type RemoteMCPToolSourceConfig,
|
|
6
6
|
type RemoteToolSource,
|
|
7
7
|
} from "../tool/index.js";
|
|
8
|
+
import {
|
|
9
|
+
type AgentServiceMcpServerConfig,
|
|
10
|
+
createAgentServiceRemoteMcpConfig,
|
|
11
|
+
defaultAgentServiceMcpServers,
|
|
12
|
+
} from "./agent-service-mcp-server-config.js";
|
|
8
13
|
import {
|
|
9
14
|
type AgentServiceSandboxToolsOptions,
|
|
10
15
|
type AgentServiceSandboxToolsResult,
|
|
@@ -31,13 +36,13 @@ export type HostedChildForkToolSourcesLogger = {
|
|
|
31
36
|
export type PrepareDefaultHostedChildForkToolSourcesInput = {
|
|
32
37
|
authToken: string;
|
|
33
38
|
apiMcpUrl: string;
|
|
39
|
+
mcpServers?: readonly AgentServiceMcpServerConfig[];
|
|
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;
|
|
@@ -73,23 +78,54 @@ export type PrepareDefaultHostedChildForkSandboxToolSourcesInput =
|
|
|
73
78
|
export async function prepareDefaultHostedChildForkToolSources(
|
|
74
79
|
input: PrepareDefaultHostedChildForkToolSourcesInput,
|
|
75
80
|
): Promise<DefaultHostedChildForkToolSourcesResult> {
|
|
81
|
+
throwIfAborted(input.abortSignal);
|
|
82
|
+
|
|
76
83
|
let closeStudioMcpTools: (() => Promise<void>) | undefined;
|
|
77
84
|
let studioMcpTools: HostToolSet = {};
|
|
85
|
+
let remoteMcpTools: HostToolSet = {};
|
|
78
86
|
const createLiveStudioTools = input.createLiveStudioTools ?? createLiveStudioMcpTools;
|
|
87
|
+
const createRemoteToolSource = input.createRemoteToolSource ?? createRemoteMCPToolSource;
|
|
88
|
+
const materializeRemoteTools = input.createToolsFromRemoteDefinitions ??
|
|
89
|
+
createToolsFromRemoteDefinitions;
|
|
79
90
|
|
|
80
91
|
try {
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
92
|
+
const mcpServers = input.mcpServers ?? defaultAgentServiceMcpServers();
|
|
93
|
+
for (const server of mcpServers) {
|
|
94
|
+
if (server.kind === "veryfront-studio") {
|
|
95
|
+
const studioTools = await createLiveStudioTools({
|
|
96
|
+
authToken: input.authToken,
|
|
97
|
+
clientProfile: input.clientProfile,
|
|
98
|
+
getProjectId: input.getProjectId,
|
|
99
|
+
studioMcpUrl: input.studioMcpUrl,
|
|
100
|
+
...(input.conversationId ? { conversationId: input.conversationId } : {}),
|
|
101
|
+
...(input.createRemoteToolSource
|
|
102
|
+
? { createRemoteToolSource: input.createRemoteToolSource }
|
|
103
|
+
: {}),
|
|
104
|
+
});
|
|
105
|
+
studioMcpTools = {
|
|
106
|
+
...studioMcpTools,
|
|
107
|
+
...studioTools.tools,
|
|
108
|
+
};
|
|
109
|
+
closeStudioMcpTools = studioTools.close;
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const remoteConfig = createAgentServiceRemoteMcpConfig({
|
|
114
|
+
server,
|
|
115
|
+
authToken: input.authToken,
|
|
116
|
+
apiMcpUrl: input.apiMcpUrl,
|
|
117
|
+
defaultSourceId: "veryfront-mcp-fork",
|
|
118
|
+
});
|
|
119
|
+
if (!remoteConfig) {
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
const remoteSource = createRemoteToolSource(remoteConfig);
|
|
123
|
+
const definitions = await remoteSource.listTools();
|
|
124
|
+
remoteMcpTools = {
|
|
125
|
+
...remoteMcpTools,
|
|
126
|
+
...materializeRemoteTools(remoteSource, definitions),
|
|
127
|
+
};
|
|
128
|
+
}
|
|
93
129
|
} catch (error) {
|
|
94
130
|
if (input.abortSignal?.aborted || input.isAbortError?.(error)) {
|
|
95
131
|
throw error;
|
|
@@ -108,19 +144,6 @@ export async function prepareDefaultHostedChildForkToolSources(
|
|
|
108
144
|
|
|
109
145
|
throwIfAborted(input.abortSignal);
|
|
110
146
|
|
|
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
147
|
if (input.onConfirmedStudioProjectSwitch) {
|
|
125
148
|
wrapHostedChildProjectSwitchTool({
|
|
126
149
|
tools: studioMcpTools,
|
|
@@ -133,7 +156,7 @@ export async function prepareDefaultHostedChildForkToolSources(
|
|
|
133
156
|
return {
|
|
134
157
|
ok: true,
|
|
135
158
|
forkTools: buildDefaultHostedChildForkToolSet(
|
|
136
|
-
|
|
159
|
+
remoteMcpTools,
|
|
137
160
|
studioMcpTools,
|
|
138
161
|
input.globalTools ?? {},
|
|
139
162
|
),
|
|
@@ -8,9 +8,13 @@ import {
|
|
|
8
8
|
type RemoteToolSource,
|
|
9
9
|
type ToolExecutionContext,
|
|
10
10
|
} from "../tool/index.js";
|
|
11
|
+
import {
|
|
12
|
+
type AgentServiceMcpServerConfig,
|
|
13
|
+
createAgentServiceRemoteMcpConfig,
|
|
14
|
+
defaultAgentServiceMcpServers,
|
|
15
|
+
} from "./agent-service-mcp-server-config.js";
|
|
11
16
|
import { toChildRunToolInputRecord } from "./child-run-execution-support.js";
|
|
12
|
-
import {
|
|
13
|
-
import { clientAllowsStudioMcp, type RuntimeClientProfile } from "./runtime-client-profile.js";
|
|
17
|
+
import type { RuntimeClientProfile } from "./runtime-client-profile.js";
|
|
14
18
|
import { getConfirmedProjectContextSwitchId } from "./project-context.js";
|
|
15
19
|
import {
|
|
16
20
|
getProjectSteeringMutation,
|
|
@@ -188,12 +192,10 @@ export type CreateHostedProjectRemoteToolSourcesInput =
|
|
|
188
192
|
authToken: string;
|
|
189
193
|
apiMcpUrl: string;
|
|
190
194
|
studioMcpUrl?: string | null;
|
|
191
|
-
|
|
195
|
+
mcpServers?: readonly AgentServiceMcpServerConfig[];
|
|
192
196
|
clientProfile?: RuntimeClientProfile | null;
|
|
193
197
|
getProjectId: () => string | null | undefined;
|
|
194
198
|
conversationId?: string;
|
|
195
|
-
apiSourceId?: string;
|
|
196
|
-
studioSourceId?: string;
|
|
197
199
|
createRemoteToolSource?: (config: RemoteMCPToolSourceConfig) => RemoteToolSource;
|
|
198
200
|
onStudioProjectSwitch?: HostedProjectRemoteToolSourceProjectSwitchHandler;
|
|
199
201
|
};
|
|
@@ -230,41 +232,31 @@ export function createHostedProjectRemoteToolSources(
|
|
|
230
232
|
input: CreateHostedProjectRemoteToolSourcesInput,
|
|
231
233
|
): RemoteToolSource[] {
|
|
232
234
|
const createRemoteToolSource = input.createRemoteToolSource ?? createRemoteMCPToolSource;
|
|
233
|
-
const sources = [
|
|
234
|
-
|
|
235
|
-
input,
|
|
236
|
-
createRemoteToolSource({
|
|
237
|
-
id: input.apiSourceId ?? "veryfront-mcp",
|
|
238
|
-
endpoint: input.apiMcpUrl,
|
|
239
|
-
headers: {
|
|
240
|
-
Authorization: `Bearer ${input.authToken}`,
|
|
241
|
-
},
|
|
242
|
-
}),
|
|
243
|
-
),
|
|
244
|
-
];
|
|
235
|
+
const sources: RemoteToolSource[] = [];
|
|
236
|
+
const mcpServers = input.mcpServers ?? defaultAgentServiceMcpServers();
|
|
245
237
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
238
|
+
for (const server of mcpServers) {
|
|
239
|
+
const remoteConfig = createAgentServiceRemoteMcpConfig({
|
|
240
|
+
server,
|
|
241
|
+
authToken: input.authToken,
|
|
242
|
+
apiMcpUrl: input.apiMcpUrl,
|
|
243
|
+
studioMcpUrl: input.studioMcpUrl,
|
|
244
|
+
clientProfile: input.clientProfile,
|
|
245
|
+
getProjectId: input.getProjectId,
|
|
246
|
+
conversationId: input.conversationId,
|
|
247
|
+
});
|
|
248
|
+
if (!remoteConfig) {
|
|
249
|
+
continue;
|
|
250
|
+
}
|
|
251
251
|
|
|
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
|
-
);
|
|
252
|
+
sources.push(
|
|
253
|
+
createHostedProjectRemoteToolSourceFromConfig(
|
|
254
|
+
input,
|
|
255
|
+
createRemoteToolSource(remoteConfig),
|
|
256
|
+
server.kind === "veryfront-studio" ? input.onStudioProjectSwitch : undefined,
|
|
257
|
+
),
|
|
258
|
+
);
|
|
259
|
+
}
|
|
268
260
|
|
|
269
261
|
return sources;
|
|
270
262
|
}
|
package/src/src/agent/index.ts
CHANGED
|
@@ -337,13 +337,15 @@ export {
|
|
|
337
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,
|
|
@@ -61,6 +61,7 @@ import {
|
|
|
61
61
|
fetchDefaultHostedProjectSteering,
|
|
62
62
|
} from "./default-hosted-project-steering-refresh.js";
|
|
63
63
|
import { type HostedProjectSkillIdsContext } from "./hosted-project-steering-adapter.js";
|
|
64
|
+
import type { AgentServiceMcpServerConfig } from "./agent-service-mcp-server-config.js";
|
|
64
65
|
import type { RuntimeLoadSkillToolContext } from "./runtime-load-skill-tool.js";
|
|
65
66
|
import type { RuntimeProjectSteeringLookup } from "./runtime-project-skill-catalog.js";
|
|
66
67
|
import type { RuntimeSkillDefinition } from "./runtime-skill-metadata.js";
|
|
@@ -113,13 +114,19 @@ export type NodeVeryfrontCloudAgentServiceProcessTarget =
|
|
|
113
114
|
|
|
114
115
|
export type NodeVeryfrontCloudAgentServiceAgentSource = "auto" | "code" | "markdown";
|
|
115
116
|
|
|
116
|
-
export type
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
117
|
+
export type VeryfrontMcpServerKind = "api" | "studio";
|
|
118
|
+
|
|
119
|
+
export type NodeVeryfrontCloudAgentServiceMcpServer = AgentServiceMcpServerConfig;
|
|
120
|
+
|
|
121
|
+
export function veryfrontMcpServer(
|
|
122
|
+
kind: VeryfrontMcpServerKind = "api",
|
|
123
|
+
): AgentServiceMcpServerConfig {
|
|
124
|
+
if (kind === "studio") {
|
|
125
|
+
return { kind: "veryfront-studio" };
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return { kind: "veryfront-api" };
|
|
129
|
+
}
|
|
123
130
|
|
|
124
131
|
type AgentServicePathOption = string | URL;
|
|
125
132
|
|
|
@@ -137,7 +144,11 @@ export type NodeVeryfrontCloudAgentServiceOptions = {
|
|
|
137
144
|
*/
|
|
138
145
|
entrypointUrl?: AgentServicePathOption;
|
|
139
146
|
agentSource?: NodeVeryfrontCloudAgentServiceAgentSource;
|
|
140
|
-
|
|
147
|
+
/**
|
|
148
|
+
* Remote MCP servers available to the runtime. Defaults to the Veryfront API
|
|
149
|
+
* MCP server. Pass [] to run without remote MCP tools.
|
|
150
|
+
*/
|
|
151
|
+
mcpServers?: readonly NodeVeryfrontCloudAgentServiceMcpServer[];
|
|
141
152
|
forwardedConfigNamespace?: string;
|
|
142
153
|
createBashTool?: AgentServiceSandboxToolsOptions["createBashTool"];
|
|
143
154
|
env?: CreateNodeAgentServiceRuntimeInfrastructureOptions["env"];
|
|
@@ -239,6 +250,12 @@ function resolveDefaultProcessTarget(): NodeVeryfrontCloudAgentServiceProcessTar
|
|
|
239
250
|
return process;
|
|
240
251
|
}
|
|
241
252
|
|
|
253
|
+
function resolveMcpServers(
|
|
254
|
+
options: Pick<NodeVeryfrontCloudAgentServiceOptions, "mcpServers">,
|
|
255
|
+
): readonly NodeVeryfrontCloudAgentServiceMcpServer[] {
|
|
256
|
+
return options.mcpServers ?? [veryfrontMcpServer()];
|
|
257
|
+
}
|
|
258
|
+
|
|
242
259
|
async function loadDefaultCreateBashTool(): Promise<
|
|
243
260
|
AgentServiceSandboxToolsOptions["createBashTool"]
|
|
244
261
|
> {
|
|
@@ -466,12 +483,12 @@ function getInvokeAgentConfig(
|
|
|
466
483
|
context: NodeVeryfrontCloudAgentServiceContext,
|
|
467
484
|
): DefaultHostedInvokeAgentConfig {
|
|
468
485
|
const config = context.infrastructure.getConfig();
|
|
469
|
-
const studioMcpUrl = context.options.mcp?.studio ? config.VERYFRONT_STUDIO_MCP_URL : "";
|
|
470
486
|
|
|
471
487
|
return {
|
|
472
488
|
apiUrl: config.VERYFRONT_API_URL,
|
|
473
489
|
apiMcpUrl: config.VERYFRONT_MCP_URL,
|
|
474
|
-
studioMcpUrl,
|
|
490
|
+
studioMcpUrl: config.VERYFRONT_STUDIO_MCP_URL,
|
|
491
|
+
mcpServers: resolveMcpServers(context.options),
|
|
475
492
|
enableDurableInvokeAgent: config.VERYFRONT_ENABLE_DURABLE_INVOKE_AGENT,
|
|
476
493
|
};
|
|
477
494
|
}
|
|
@@ -551,8 +568,8 @@ function createAgentRuntime(
|
|
|
551
568
|
config: {
|
|
552
569
|
apiUrl: config.VERYFRONT_API_URL,
|
|
553
570
|
apiMcpUrl: config.VERYFRONT_MCP_URL,
|
|
554
|
-
studioMcpUrl:
|
|
555
|
-
|
|
571
|
+
studioMcpUrl: config.VERYFRONT_STUDIO_MCP_URL,
|
|
572
|
+
mcpServers: resolveMcpServers(context.options),
|
|
556
573
|
},
|
|
557
574
|
buildLocalTools: (taskContext) => buildLocalTools(context, options, taskContext),
|
|
558
575
|
refreshSystem,
|