veryfront 0.1.644 → 0.1.646
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/factory.js +7 -7
- package/esm/src/agent/hosted/chat-preparation.d.ts +4 -1
- package/esm/src/agent/hosted/chat-preparation.d.ts.map +1 -1
- package/esm/src/agent/hosted/chat-preparation.js +8 -0
- package/esm/src/agent/hosted/chat-runtime-tool-assembly.d.ts +1 -0
- package/esm/src/agent/hosted/chat-runtime-tool-assembly.d.ts.map +1 -1
- package/esm/src/agent/hosted/chat-runtime-tool-assembly.js +4 -1
- package/esm/src/agent/hosted/default-chat-runtime.d.ts.map +1 -1
- package/esm/src/agent/hosted/default-chat-runtime.js +5 -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 +25 -1
- package/esm/src/agent/hosted/veryfront-cloud-agent-service.d.ts +5 -4
- package/esm/src/agent/hosted/veryfront-cloud-agent-service.d.ts.map +1 -1
- package/esm/src/agent/hosted/veryfront-cloud-agent-service.js +7 -6
- package/esm/src/agent/index.d.ts +2 -2
- package/esm/src/agent/index.d.ts.map +1 -1
- package/esm/src/agent/index.js +1 -1
- package/esm/src/agent/runtime/index.d.ts +1 -1
- package/esm/src/agent/runtime/index.d.ts.map +1 -1
- package/esm/src/agent/runtime/index.js +25 -20
- package/esm/src/agent/runtime/mcp-server-tool-sources.d.ts +9 -0
- package/esm/src/agent/runtime/mcp-server-tool-sources.d.ts.map +1 -0
- package/esm/src/agent/runtime/mcp-server-tool-sources.js +59 -0
- package/esm/src/agent/runtime/message-preparation.d.ts +1 -0
- package/esm/src/agent/runtime/message-preparation.d.ts.map +1 -1
- package/esm/src/agent/runtime/message-preparation.js +3 -1
- package/esm/src/agent/runtime/model-tool-converter.d.ts +1 -1
- package/esm/src/agent/runtime/model-tool-converter.d.ts.map +1 -1
- package/esm/src/agent/runtime/model-tool-converter.js +1 -1
- package/esm/src/agent/service/mcp-server-config.d.ts +4 -0
- package/esm/src/agent/service/mcp-server-config.d.ts.map +1 -1
- package/esm/src/agent/streaming/fork-runtime-stream.js +1 -1
- package/esm/src/agent/types.d.ts +44 -5
- package/esm/src/agent/types.d.ts.map +1 -1
- package/esm/src/chat/message-prep.d.ts +5 -1
- package/esm/src/chat/message-prep.d.ts.map +1 -1
- package/esm/src/chat/message-prep.js +55 -2
- package/esm/src/discovery/transpiler.d.ts.map +1 -1
- package/esm/src/discovery/transpiler.js +3 -1
- package/esm/src/internal-agents/run-stream.d.ts.map +1 -1
- package/esm/src/internal-agents/run-stream.js +2 -2
- package/esm/src/react/components/chat/chat/components/skill-badge.d.ts +1 -1
- package/esm/src/react/components/chat/chat/components/skill-badge.js +3 -3
- package/esm/src/react/components/chat/chat/utils/message-parts.d.ts +1 -1
- package/esm/src/react/components/chat/chat/utils/message-parts.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/utils/message-parts.js +4 -4
- package/esm/src/rendering/orchestrator/module-loader/index.d.ts +7 -0
- package/esm/src/rendering/orchestrator/module-loader/index.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/module-loader/index.js +33 -1
- package/esm/src/server/handlers/dev/framework-candidates.generated.js +7 -7
- package/esm/src/server/handlers/request/agent-stream.handler.d.ts.map +1 -1
- package/esm/src/server/handlers/request/agent-stream.handler.js +35 -10
- package/esm/src/skill/prompt-augmentation.d.ts +1 -1
- package/esm/src/skill/prompt-augmentation.js +5 -5
- package/esm/src/skill/tools.d.ts +6 -6
- package/esm/src/skill/tools.js +13 -13
- package/esm/src/skill/types.d.ts +1 -1
- package/esm/src/skill/types.js +3 -3
- package/esm/src/transforms/mdx/esm-module-loader/cache/index.d.ts +23 -0
- package/esm/src/transforms/mdx/esm-module-loader/cache/index.d.ts.map +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/cache/index.js +85 -2
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/package.json +1 -1
|
@@ -20,6 +20,7 @@ import { addSpanEvent, setSpanAttributes, withSpan, } from "../../observability/
|
|
|
20
20
|
import { convertToTextGenerationRuntimeMessages } from "./text-generation-runtime-message-converter.js";
|
|
21
21
|
import { convertToolsToRuntimeTools } from "./model-tool-converter.js";
|
|
22
22
|
import { resolveProviderOptionsWithDefaults } from "./default-provider-options.js";
|
|
23
|
+
import { getRuntimeRemoteToolSources, } from "./mcp-server-tool-sources.js";
|
|
23
24
|
import { createStreamState, processStream, } from "./chat-stream-handler.js";
|
|
24
25
|
import { repairToolCall } from "./repair-tool-call.js";
|
|
25
26
|
import { stripLeadingEmptyObjectPlaceholder } from "../streaming/data-stream.js";
|
|
@@ -45,7 +46,7 @@ import { resolveConfiguredAgentModel, resolveRuntimeModel } from "./model-resolu
|
|
|
45
46
|
import { stringifyToolError, throwIfAborted } from "./error-utils.js";
|
|
46
47
|
import { appendCurrentRunToolStateToSystemPrompt, createCurrentRunToolState, recordCurrentRunToolResult, } from "./current-run-tool-state.js";
|
|
47
48
|
const logger = serverLogger.component("agent");
|
|
48
|
-
const LOAD_SKILL_TOOL_ID = "
|
|
49
|
+
const LOAD_SKILL_TOOL_ID = "load_skill";
|
|
49
50
|
function isAbortError(error, abortSignal) {
|
|
50
51
|
if (abortSignal?.aborted && error === abortSignal.reason) {
|
|
51
52
|
return true;
|
|
@@ -59,7 +60,7 @@ function getToolResultError(result) {
|
|
|
59
60
|
return stringifyToolError(result.error);
|
|
60
61
|
}
|
|
61
62
|
function getSkillActivationRequiredError(toolName) {
|
|
62
|
-
return `Tool "${toolName}" cannot run before
|
|
63
|
+
return `Tool "${toolName}" cannot run before load_skill succeeds in the same step. ` +
|
|
63
64
|
`Call "${LOAD_SKILL_TOOL_ID}" first to establish the active skill context.`;
|
|
64
65
|
}
|
|
65
66
|
function warnLocalToolSkipping(agentId, modelId) {
|
|
@@ -291,7 +292,7 @@ function isToolResultPart(part) {
|
|
|
291
292
|
return part.type === "tool-result" && "result" in part;
|
|
292
293
|
}
|
|
293
294
|
/**
|
|
294
|
-
* Extract and validate the skill policy from a
|
|
295
|
+
* Extract and validate the skill policy from a load_skill tool result.
|
|
295
296
|
* Returns `[]` (no tools allowed) for invalid/missing policies instead of
|
|
296
297
|
* `undefined` (no restrictions), preventing accidental policy bypass.
|
|
297
298
|
*/
|
|
@@ -307,7 +308,7 @@ export function extractSkillPolicy(result) {
|
|
|
307
308
|
const raw = skillResult.allowedTools;
|
|
308
309
|
if (!Array.isArray(raw) || !raw.every((v) => typeof v === "string")) {
|
|
309
310
|
// Invalid shape — fail closed (empty policy = no tools allowed)
|
|
310
|
-
logger.warn("
|
|
311
|
+
logger.warn("load_skill returned invalid allowedTools; falling back to empty policy (no tools)");
|
|
311
312
|
return [];
|
|
312
313
|
}
|
|
313
314
|
// Validate each pattern against the regex
|
|
@@ -315,7 +316,7 @@ export function extractSkillPolicy(result) {
|
|
|
315
316
|
return validateAllowedToolPatterns(raw);
|
|
316
317
|
}
|
|
317
318
|
catch (error) {
|
|
318
|
-
logger.warn("
|
|
319
|
+
logger.warn("load_skill returned invalid tool patterns; falling back to empty policy (no tools)", { error });
|
|
319
320
|
return [];
|
|
320
321
|
}
|
|
321
322
|
}
|
|
@@ -338,13 +339,6 @@ export function enforceSkillPolicy(toolName, activeSkillPolicy, mustLoadSkillFir
|
|
|
338
339
|
return { allowed: true };
|
|
339
340
|
}
|
|
340
341
|
function getRuntimeAllowedRemoteTools(config) {
|
|
341
|
-
if (Object.hasOwn(config, "allowedRemoteTools")) {
|
|
342
|
-
const raw = config.allowedRemoteTools;
|
|
343
|
-
if (!Array.isArray(raw)) {
|
|
344
|
-
return [];
|
|
345
|
-
}
|
|
346
|
-
return raw.every((toolName) => typeof toolName === "string") ? raw : [];
|
|
347
|
-
}
|
|
348
342
|
const configWithRuntimeFilters = config;
|
|
349
343
|
if (!Object.hasOwn(configWithRuntimeFilters, "__vfAllowedRemoteTools")) {
|
|
350
344
|
return undefined;
|
|
@@ -355,6 +349,13 @@ function getRuntimeAllowedRemoteTools(config) {
|
|
|
355
349
|
}
|
|
356
350
|
return raw.every((toolName) => typeof toolName === "string") ? raw : [];
|
|
357
351
|
}
|
|
352
|
+
function getRuntimeProviderTools(config) {
|
|
353
|
+
const raw = config.providerTools;
|
|
354
|
+
if (!Array.isArray(raw)) {
|
|
355
|
+
return [];
|
|
356
|
+
}
|
|
357
|
+
return raw.every((toolName) => typeof toolName === "string") ? raw : [];
|
|
358
|
+
}
|
|
358
359
|
function getRuntimeForwardedIntegrationToolDefs(config) {
|
|
359
360
|
const configWithFilters = config;
|
|
360
361
|
const raw = configWithFilters.__vfForwardedIntegrationToolDefs;
|
|
@@ -587,7 +588,9 @@ export class AgentRuntime {
|
|
|
587
588
|
// Request-scoped skill policy (not class-level mutable state)
|
|
588
589
|
let activeSkillPolicy;
|
|
589
590
|
const allowedRemoteToolNames = getRuntimeAllowedRemoteTools(this.config);
|
|
591
|
+
const providerTools = getRuntimeProviderTools(this.config);
|
|
590
592
|
const forwardedRemoteToolDefinitions = getRuntimeForwardedIntegrationToolDefs(this.config);
|
|
593
|
+
const remoteToolSources = getRuntimeRemoteToolSources(this.config);
|
|
591
594
|
let currentSystemPrompt = systemPrompt;
|
|
592
595
|
let currentRuntimeContext = runtimeContext;
|
|
593
596
|
for (let step = 0; step < maxSteps; step++) {
|
|
@@ -601,7 +604,7 @@ export class AgentRuntime {
|
|
|
601
604
|
includeSkillTools: Boolean(this.config.skills),
|
|
602
605
|
allowedRemoteToolNames,
|
|
603
606
|
forwardedRemoteToolDefinitions,
|
|
604
|
-
remoteToolSources
|
|
607
|
+
remoteToolSources,
|
|
605
608
|
remoteToolContext: toolContext,
|
|
606
609
|
});
|
|
607
610
|
// Layer 1: Filter tools based on active skill policy (planning-time)
|
|
@@ -620,7 +623,7 @@ export class AgentRuntime {
|
|
|
620
623
|
messages: convertToTextGenerationRuntimeMessages(currentMessages),
|
|
621
624
|
tools: convertToolsToRuntimeTools(tools, {
|
|
622
625
|
model: effectiveModel,
|
|
623
|
-
|
|
626
|
+
providerTools,
|
|
624
627
|
}),
|
|
625
628
|
experimental_repairToolCall: repairToolCall,
|
|
626
629
|
maxOutputTokens: this.resolveMaxOutputTokens(effectiveModel, maxOutputTokensOverride),
|
|
@@ -748,7 +751,7 @@ export class AgentRuntime {
|
|
|
748
751
|
...toolContext,
|
|
749
752
|
projectId: cacheCtx?.projectId ?? toolContext?.projectId,
|
|
750
753
|
};
|
|
751
|
-
const result = await executeConfiguredTool(tc.toolName, toolCall.args, this.config.tools, executionContext, allowedRemoteToolNames,
|
|
754
|
+
const result = await executeConfiguredTool(tc.toolName, toolCall.args, this.config.tools, executionContext, allowedRemoteToolNames, remoteToolSources);
|
|
752
755
|
await this.notifyToolResult({
|
|
753
756
|
mode: "generate",
|
|
754
757
|
toolName: tc.toolName,
|
|
@@ -766,7 +769,7 @@ export class AgentRuntime {
|
|
|
766
769
|
toolCall.status = "completed";
|
|
767
770
|
toolCall.result = result;
|
|
768
771
|
toolCall.executionTime = Date.now() - startTime;
|
|
769
|
-
// Track skill policy from
|
|
772
|
+
// Track skill policy from load_skill results
|
|
770
773
|
if (tc.toolName === LOAD_SKILL_TOOL_ID) {
|
|
771
774
|
activeSkillPolicy = extractSkillPolicy(result);
|
|
772
775
|
mustLoadSkillFirst = false;
|
|
@@ -830,7 +833,9 @@ export class AgentRuntime {
|
|
|
830
833
|
let finalFinishReason;
|
|
831
834
|
let latestAssistantText = "";
|
|
832
835
|
const allowedRemoteToolNames = getRuntimeAllowedRemoteTools(this.config);
|
|
836
|
+
const providerTools = getRuntimeProviderTools(this.config);
|
|
833
837
|
const forwardedRemoteToolDefinitions = getRuntimeForwardedIntegrationToolDefs(this.config);
|
|
838
|
+
const remoteToolSources = getRuntimeRemoteToolSources(this.config);
|
|
834
839
|
let currentSystemPrompt = systemPrompt;
|
|
835
840
|
let currentRuntimeContext = runtimeContext;
|
|
836
841
|
for (let step = 0; step < maxSteps; step++) {
|
|
@@ -845,7 +850,7 @@ export class AgentRuntime {
|
|
|
845
850
|
includeSkillTools: Boolean(this.config.skills),
|
|
846
851
|
allowedRemoteToolNames,
|
|
847
852
|
forwardedRemoteToolDefinitions,
|
|
848
|
-
remoteToolSources
|
|
853
|
+
remoteToolSources,
|
|
849
854
|
remoteToolContext: toolContext,
|
|
850
855
|
});
|
|
851
856
|
// Layer 1: Filter tools based on active skill policy (planning-time)
|
|
@@ -855,7 +860,7 @@ export class AgentRuntime {
|
|
|
855
860
|
const modelSystemPrompt = appendCurrentRunToolStateToSystemPrompt(currentSystemPrompt, currentRunToolState);
|
|
856
861
|
const runtimeTools = convertToolsToRuntimeTools(tools, {
|
|
857
862
|
model: effectiveModel,
|
|
858
|
-
|
|
863
|
+
providerTools,
|
|
859
864
|
});
|
|
860
865
|
const result = streamText({
|
|
861
866
|
model: languageModel,
|
|
@@ -1051,7 +1056,7 @@ export class AgentRuntime {
|
|
|
1051
1056
|
toolCallId: tc.id,
|
|
1052
1057
|
...toolContext,
|
|
1053
1058
|
};
|
|
1054
|
-
const result = await executeConfiguredTool(tc.name, toolCall.args, this.config.tools, executionContext, allowedRemoteToolNames,
|
|
1059
|
+
const result = await executeConfiguredTool(tc.name, toolCall.args, this.config.tools, executionContext, allowedRemoteToolNames, remoteToolSources);
|
|
1055
1060
|
throwIfAborted(abortSignal);
|
|
1056
1061
|
await this.notifyToolResult({
|
|
1057
1062
|
mode: "stream",
|
|
@@ -1071,7 +1076,7 @@ export class AgentRuntime {
|
|
|
1071
1076
|
toolCall.result = result;
|
|
1072
1077
|
toolCall.executionTime = Date.now() - startTime;
|
|
1073
1078
|
toolCalls.push(toolCall);
|
|
1074
|
-
// Track skill policy from
|
|
1079
|
+
// Track skill policy from load_skill results
|
|
1075
1080
|
if (tc.name === LOAD_SKILL_TOOL_ID) {
|
|
1076
1081
|
activeSkillPolicy = extractSkillPolicy(result);
|
|
1077
1082
|
mustLoadSkillFirst = false;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type RemoteToolSource } from "../../tool/index.js";
|
|
2
|
+
import type { AgentConfig } from "../types.js";
|
|
3
|
+
export type RuntimeRemoteToolConfig = {
|
|
4
|
+
__vfRemoteToolSources?: RemoteToolSource[];
|
|
5
|
+
__vfAllowedRemoteTools?: string[];
|
|
6
|
+
};
|
|
7
|
+
/** Return remote tool sources for direct agent runtime config. */
|
|
8
|
+
export declare function getRuntimeRemoteToolSources(config: AgentConfig): RemoteToolSource[] | undefined;
|
|
9
|
+
//# sourceMappingURL=mcp-server-tool-sources.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-server-tool-sources.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/mcp-server-tool-sources.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6B,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvF,OAAO,KAAK,EACV,WAAW,EAIZ,MAAM,aAAa,CAAC;AAGrB,MAAM,MAAM,uBAAuB,GAAG;IACpC,qBAAqB,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC3C,sBAAsB,CAAC,EAAE,MAAM,EAAE,CAAC;CACnC,CAAC;AAwEF,kEAAkE;AAClE,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,WAAW,GAAG,gBAAgB,EAAE,GAAG,SAAS,CAQ/F"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { createRemoteMCPToolSource } from "../../tool/index.js";
|
|
2
|
+
async function resolveValue(value, context) {
|
|
3
|
+
return typeof value === "function"
|
|
4
|
+
? await value(context)
|
|
5
|
+
: value;
|
|
6
|
+
}
|
|
7
|
+
async function resolveHeaders(auth, context) {
|
|
8
|
+
if (!auth) {
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
11
|
+
if (auth.type === "bearer") {
|
|
12
|
+
return { Authorization: `Bearer ${await resolveValue(auth.token, context)}` };
|
|
13
|
+
}
|
|
14
|
+
return await resolveValue(auth.headers, context);
|
|
15
|
+
}
|
|
16
|
+
function isToolAllowed(toolName, policy) {
|
|
17
|
+
if (policy?.allow && !policy.allow.includes(toolName)) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
if (policy?.deny?.includes(toolName)) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
function filterToolDefinitions(definitions, policy) {
|
|
26
|
+
return definitions.filter((definition) => isToolAllowed(definition.name, policy));
|
|
27
|
+
}
|
|
28
|
+
function isHttpMcpServerConfig(server) {
|
|
29
|
+
return "transport" in server;
|
|
30
|
+
}
|
|
31
|
+
function createMcpServerToolSource(server) {
|
|
32
|
+
const source = createRemoteMCPToolSource({
|
|
33
|
+
id: server.id,
|
|
34
|
+
endpoint: (context) => resolveValue(server.transport.url, context),
|
|
35
|
+
headers: (context) => resolveHeaders(server.auth, context),
|
|
36
|
+
...(server.fetch ? { fetch: server.fetch } : {}),
|
|
37
|
+
});
|
|
38
|
+
return {
|
|
39
|
+
id: source.id,
|
|
40
|
+
async listTools(context) {
|
|
41
|
+
return filterToolDefinitions(await source.listTools(context), server.toolPolicy);
|
|
42
|
+
},
|
|
43
|
+
executeTool(toolName, args, context) {
|
|
44
|
+
if (!isToolAllowed(toolName, server.toolPolicy)) {
|
|
45
|
+
throw new Error(`Tool "${toolName}" is not allowed for MCP server "${server.id}"`);
|
|
46
|
+
}
|
|
47
|
+
return source.executeTool(toolName, args, context);
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/** Return remote tool sources for direct agent runtime config. */
|
|
52
|
+
export function getRuntimeRemoteToolSources(config) {
|
|
53
|
+
const runtimeConfig = config;
|
|
54
|
+
const remoteToolSources = [
|
|
55
|
+
...(runtimeConfig.__vfRemoteToolSources ?? []),
|
|
56
|
+
...(config.mcpServers ?? []).filter(isHttpMcpServerConfig).map(createMcpServerToolSource),
|
|
57
|
+
];
|
|
58
|
+
return remoteToolSources.length > 0 ? remoteToolSources : undefined;
|
|
59
|
+
}
|
|
@@ -6,6 +6,7 @@ export type PrepareAgentRuntimeMessagesFromUiMessagesOptions = {
|
|
|
6
6
|
messages: readonly ChatUiMessage[];
|
|
7
7
|
emptyConversationPrompt?: string;
|
|
8
8
|
resolveFileUrl?: RuntimeFileUrlResolver;
|
|
9
|
+
providerOwnedToolNames?: readonly string[];
|
|
9
10
|
};
|
|
10
11
|
/** Prepare agent runtime messages from UI messages. */
|
|
11
12
|
export declare function prepareAgentRuntimeMessagesFromUiMessages(options: PrepareAgentRuntimeMessagesFromUiMessagesOptions): Promise<AgentRuntimeMessage[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message-preparation.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/message-preparation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EACL,KAAK,mBAAmB,EAEzB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAEL,KAAK,sBAAsB,EAC5B,MAAM,+BAA+B,CAAC;AAKvC,2EAA2E;AAC3E,MAAM,MAAM,gDAAgD,GAAG;IAC7D,QAAQ,EAAE,SAAS,aAAa,EAAE,CAAC;IACnC,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,cAAc,CAAC,EAAE,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"message-preparation.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/message-preparation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EACL,KAAK,mBAAmB,EAEzB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAEL,KAAK,sBAAsB,EAC5B,MAAM,+BAA+B,CAAC;AAKvC,2EAA2E;AAC3E,MAAM,MAAM,gDAAgD,GAAG;IAC7D,QAAQ,EAAE,SAAS,aAAa,EAAE,CAAC;IACnC,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,cAAc,CAAC,EAAE,sBAAsB,CAAC;IACxC,sBAAsB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC5C,CAAC;AAEF,uDAAuD;AACvD,wBAAsB,yCAAyC,CAC7D,OAAO,EAAE,gDAAgD,GACxD,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAmBhC"}
|
|
@@ -15,7 +15,9 @@ export async function prepareAgentRuntimeMessagesFromUiMessages(options) {
|
|
|
15
15
|
const refreshedMessages = options.resolveFileUrl
|
|
16
16
|
? await resolveRuntimeMessageFileUrls(options.messages, options.resolveFileUrl)
|
|
17
17
|
: [...options.messages];
|
|
18
|
-
return convertProviderMessagesToAgentRuntimeMessages(prepareProviderModelMessagesFromUiMessages(refreshedMessages
|
|
18
|
+
return convertProviderMessagesToAgentRuntimeMessages(prepareProviderModelMessagesFromUiMessages(refreshedMessages, {
|
|
19
|
+
providerOwnedToolNames: options.providerOwnedToolNames,
|
|
20
|
+
}));
|
|
19
21
|
}
|
|
20
22
|
function isEmptyConversation(messages) {
|
|
21
23
|
if (messages.length === 0)
|
|
@@ -10,7 +10,7 @@ import type { ToolDefinition } from "../../tool/index.js";
|
|
|
10
10
|
import type { RuntimeToolSet } from "./runtime-tool-types.js";
|
|
11
11
|
export interface ConvertToolsToRuntimeToolsOptions {
|
|
12
12
|
model?: string;
|
|
13
|
-
|
|
13
|
+
providerTools?: string[];
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
16
|
* Convert veryfront tool definitions to the current model-runtime ToolSet.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-tool-converter.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/model-tool-converter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAe9D,MAAM,WAAW,iCAAiC;IAChD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,
|
|
1
|
+
{"version":3,"file":"model-tool-converter.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/model-tool-converter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAe9D,MAAM,WAAW,iCAAiC;IAChD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B;AA8BD;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,cAAc,EAAE,EACvB,OAAO,CAAC,EAAE,iCAAiC,GAC1C,cAAc,GAAG,SAAS,CA6B5B"}
|
|
@@ -9,7 +9,7 @@ function resolveProviderNativeTools(options) {
|
|
|
9
9
|
if (providerNativeToolNames.size === 0) {
|
|
10
10
|
return undefined;
|
|
11
11
|
}
|
|
12
|
-
const allowedProviderNativeToolNames = options?.
|
|
12
|
+
const allowedProviderNativeToolNames = options?.providerTools?.filter((toolName) => providerNativeToolNames.has(toolName)) ?? [];
|
|
13
13
|
if (allowedProviderNativeToolNames.length === 0) {
|
|
14
14
|
return undefined;
|
|
15
15
|
}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import type { RemoteMCPToolSourceConfig } from "../../tool/index.js";
|
|
2
|
+
import type { AgentMcpToolPolicy } from "../types.js";
|
|
2
3
|
import { type RuntimeClientProfile } from "../runtime/client-profile.js";
|
|
3
4
|
export type AgentServiceVeryfrontApiMcpServerConfig = {
|
|
4
5
|
kind: "veryfront-api";
|
|
5
6
|
id?: string;
|
|
7
|
+
toolPolicy?: AgentMcpToolPolicy;
|
|
6
8
|
};
|
|
7
9
|
export type AgentServiceVeryfrontStudioMcpServerConfig = {
|
|
8
10
|
kind: "veryfront-studio";
|
|
9
11
|
id?: string;
|
|
12
|
+
toolPolicy?: AgentMcpToolPolicy;
|
|
10
13
|
};
|
|
11
14
|
export type AgentServiceGenericMcpServerConfig = {
|
|
12
15
|
kind?: "generic";
|
|
@@ -16,6 +19,7 @@ export type AgentServiceGenericMcpServerConfig = {
|
|
|
16
19
|
fetch?: RemoteMCPToolSourceConfig["fetch"];
|
|
17
20
|
listMethod?: RemoteMCPToolSourceConfig["listMethod"];
|
|
18
21
|
callMethod?: RemoteMCPToolSourceConfig["callMethod"];
|
|
22
|
+
toolPolicy?: AgentMcpToolPolicy;
|
|
19
23
|
};
|
|
20
24
|
export type AgentServiceMcpServerConfig = AgentServiceVeryfrontApiMcpServerConfig | AgentServiceVeryfrontStudioMcpServerConfig | AgentServiceGenericMcpServerConfig;
|
|
21
25
|
export type CreateAgentServiceRemoteMcpConfigInput = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-server-config.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/service/mcp-server-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"mcp-server-config.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/service/mcp-server-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEtD,OAAO,EAAyB,KAAK,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEhG,MAAM,MAAM,uCAAuC,GAAG;IACpD,IAAI,EAAE,eAAe,CAAC;IACtB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,kBAAkB,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,0CAA0C,GAAG;IACvD,IAAI,EAAE,kBAAkB,CAAC;IACzB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,kBAAkB,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,kCAAkC,GAAG;IAC/C,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,yBAAyB,CAAC,UAAU,CAAC,CAAC;IAChD,OAAO,CAAC,EAAE,yBAAyB,CAAC,SAAS,CAAC,CAAC;IAC/C,KAAK,CAAC,EAAE,yBAAyB,CAAC,OAAO,CAAC,CAAC;IAC3C,UAAU,CAAC,EAAE,yBAAyB,CAAC,YAAY,CAAC,CAAC;IACrD,UAAU,CAAC,EAAE,yBAAyB,CAAC,YAAY,CAAC,CAAC;IACrD,UAAU,CAAC,EAAE,kBAAkB,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,2BAA2B,GACnC,uCAAuC,GACvC,0CAA0C,GAC1C,kCAAkC,CAAC;AAEvC,MAAM,MAAM,sCAAsC,GAAG;IACnD,MAAM,EAAE,2BAA2B,CAAC;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,aAAa,CAAC,EAAE,oBAAoB,GAAG,IAAI,CAAC;IAC5C,YAAY,CAAC,EAAE,MAAM,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAC/C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,wBAAgB,6BAA6B,IAAI,2BAA2B,EAAE,CAE7E;AAyDD,wBAAgB,iCAAiC,CAC/C,KAAK,EAAE,sCAAsC,GAC5C,yBAAyB,GAAG,IAAI,CAUlC"}
|
|
@@ -105,7 +105,7 @@ export async function runAgentRuntimeForkStep(input) {
|
|
|
105
105
|
...(input.providerOptions
|
|
106
106
|
? { resolveModelTransport: () => ({ providerOptions: input.providerOptions }) }
|
|
107
107
|
: {}),
|
|
108
|
-
|
|
108
|
+
__vfAllowedRemoteTools: input.forkToolNames,
|
|
109
109
|
};
|
|
110
110
|
const runtime = new AgentRuntime("invoke-agent-child-runtime", runtimeConfig);
|
|
111
111
|
const stream = await runWithVeryfrontCloudContextAsync({
|
package/esm/src/agent/types.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Agent type definitions
|
|
3
3
|
**************************/
|
|
4
4
|
import type { ModelRuntime } from "../provider/types.js";
|
|
5
|
-
import type {
|
|
5
|
+
import type { Tool, ToolExecutionContext } from "../tool/index.js";
|
|
6
6
|
import type { Memory } from "./memory/memory-interface.js";
|
|
7
7
|
export type { AgentContext, AgentResponse, AgentStatus, EdgeConfig, MemoryConfig, Message, MessagePart, ModelProvider, StreamToolCall, ToolCall, ToolCallPart, ToolCallPartWithArgs, ToolCallPartWithInput, ToolResultPart, } from "./schemas/index.js";
|
|
8
8
|
import type { Message, MessagePart, ToolCall, ToolCallPart, ToolCallPartWithArgs, ToolCallPartWithInput } from "./schemas/index.js";
|
|
@@ -40,6 +40,44 @@ export interface Suggestions {
|
|
|
40
40
|
welcomeMessage?: string;
|
|
41
41
|
suggestions: Suggestion[];
|
|
42
42
|
}
|
|
43
|
+
/** Policy for tools exposed by one MCP server. */
|
|
44
|
+
export interface AgentMcpToolPolicy {
|
|
45
|
+
allow?: string[];
|
|
46
|
+
deny?: string[];
|
|
47
|
+
approval?: "never";
|
|
48
|
+
}
|
|
49
|
+
/** HTTP transport configuration for one MCP server. */
|
|
50
|
+
export interface AgentMcpHttpTransport {
|
|
51
|
+
type: "http";
|
|
52
|
+
url: string | ((context?: ToolExecutionContext) => string | Promise<string>);
|
|
53
|
+
}
|
|
54
|
+
/** Authentication configuration for one MCP server. */
|
|
55
|
+
export type AgentMcpServerAuth = {
|
|
56
|
+
type: "bearer";
|
|
57
|
+
token: string | ((context?: ToolExecutionContext) => string | Promise<string>);
|
|
58
|
+
} | {
|
|
59
|
+
type: "headers";
|
|
60
|
+
headers: HeadersInit | ((context?: ToolExecutionContext) => HeadersInit | Promise<HeadersInit>);
|
|
61
|
+
};
|
|
62
|
+
/** Veryfront-owned MCP server kind. */
|
|
63
|
+
export type AgentVeryfrontMcpServerKind = "veryfront-api" | "veryfront-studio";
|
|
64
|
+
/** Veryfront-owned MCP server available to an agent. */
|
|
65
|
+
export interface AgentVeryfrontMcpServerConfig {
|
|
66
|
+
kind: AgentVeryfrontMcpServerKind;
|
|
67
|
+
id?: string;
|
|
68
|
+
toolPolicy?: AgentMcpToolPolicy;
|
|
69
|
+
}
|
|
70
|
+
/** HTTP MCP server available to an agent. */
|
|
71
|
+
export interface AgentHttpMcpServerConfig {
|
|
72
|
+
id: string;
|
|
73
|
+
kind?: "http";
|
|
74
|
+
transport: AgentMcpHttpTransport;
|
|
75
|
+
auth?: AgentMcpServerAuth;
|
|
76
|
+
toolPolicy?: AgentMcpToolPolicy;
|
|
77
|
+
fetch?: typeof fetch;
|
|
78
|
+
}
|
|
79
|
+
/** MCP server available to an agent. */
|
|
80
|
+
export type AgentMcpServerConfig = AgentHttpMcpServerConfig | AgentVeryfrontMcpServerConfig;
|
|
43
81
|
/** Configuration used by agent. */
|
|
44
82
|
export interface AgentConfig {
|
|
45
83
|
id?: string;
|
|
@@ -68,12 +106,13 @@ export interface AgentConfig {
|
|
|
68
106
|
sessionId?: string;
|
|
69
107
|
projectId?: string;
|
|
70
108
|
};
|
|
71
|
-
remoteTools?: RemoteToolSource[];
|
|
72
109
|
/**
|
|
73
|
-
*
|
|
74
|
-
* `
|
|
110
|
+
* Provider-native tools executed by the selected model provider, such as
|
|
111
|
+
* Anthropic `web_search` and `web_fetch`.
|
|
75
112
|
*/
|
|
76
|
-
|
|
113
|
+
providerTools?: string[];
|
|
114
|
+
/** Remote MCP servers available to this agent. */
|
|
115
|
+
mcpServers?: AgentMcpServerConfig[];
|
|
77
116
|
maxSteps?: number;
|
|
78
117
|
streaming?: boolean;
|
|
79
118
|
memory?: MemoryConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/src/agent/types.ts"],"names":[],"mappings":"AAAA;;4BAE4B;AAE5B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/src/agent/types.ts"],"names":[],"mappings":"AAAA;;4BAE4B;AAE5B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,IAAI,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAEnE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAG3D,YAAY,EACV,YAAY,EACZ,aAAa,EACb,WAAW,EACX,UAAU,EACV,YAAY,EACZ,OAAO,EACP,WAAW,EACX,aAAa,EACb,cAAc,EACd,QAAQ,EACR,YAAY,EACZ,oBAAoB,EACpB,qBAAqB,EACrB,cAAc,GACf,MAAM,oBAAoB,CAAC;AAG5B,OAAO,KAAK,EACV,OAAO,EACP,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,oBAAoB,EACpB,qBAAqB,EACtB,MAAM,oBAAoB,CAAC;AAE5B;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC;AAGjC,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEnE,0CAA0C;AAC1C,MAAM,MAAM,UAAU,GAClB;IACA,IAAI,EAAE,QAAQ,CAAC;IACf,EAAE,CAAC,EAAE,KAAK,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,KAAK,CAAC;IACpB,IAAI,CAAC,EAAE,KAAK,CAAC;CACd,GACC;IACA,EAAE,EAAE,MAAM,CAAC;IACX,IA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K,EAAE;QACZ,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;QACrB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAClC,qGAAqG;QACrG,KAAK,CAAC,EAAE,WAAW,CAAC;QACpB,iEAAiE;QACjE,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,IAAI,CAAC;QAC1C,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;QAClC,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,aAAa,KAAK,IAAI,CAAC;QAC7C,WAAW,CAAC,EAAE,WAAW,CAAC;KAC3B,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAE/B,mFAAmF;IACnF,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAE7C,SAAS,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC;IAE7B,cAAc,IAAI,OAAO,CAAC;QACxB,aAAa,EAAE,MAAM,CAAC;QACtB,eAAe,EAAE,MAAM,CAAC;QACxB,IAAI,EAAE,MAAM,CAAC;KACd,CAAC,CAAC;IAEH,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B"}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { type ChatUiMessage, type ProviderModelMessage } from "./types.js";
|
|
2
|
+
/** Options accepted by prepare provider model messages from UI messages. */
|
|
3
|
+
export interface PrepareProviderModelMessagesFromUiMessagesOptions {
|
|
4
|
+
providerOwnedToolNames?: readonly string[];
|
|
5
|
+
}
|
|
2
6
|
/** Estimate tokens. */
|
|
3
7
|
export declare function estimateTokens(value: unknown): number;
|
|
4
8
|
/** Compress turn. */
|
|
@@ -16,7 +20,7 @@ export declare function stripPendingToolParts(messages: ChatUiMessage[]): ChatUi
|
|
|
16
20
|
/** Sanitize provider model messages. */
|
|
17
21
|
export declare function sanitizeProviderModelMessages(messages: ProviderModelMessage[]): ProviderModelMessage[];
|
|
18
22
|
/** Prepare provider model messages from UI messages. */
|
|
19
|
-
export declare function prepareProviderModelMessagesFromUiMessages(messages: ChatUiMessage[]): ProviderModelMessage[];
|
|
23
|
+
export declare function prepareProviderModelMessagesFromUiMessages(messages: ChatUiMessage[], options?: PrepareProviderModelMessagesFromUiMessagesOptions): ProviderModelMessage[];
|
|
20
24
|
/** Mask old tool outputs. */
|
|
21
25
|
export declare function maskOldToolOutputs(messages: ProviderModelMessage[]): ProviderModelMessage[];
|
|
22
26
|
/** Repair tool pairs. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message-prep.d.ts","sourceRoot":"","sources":["../../../src/src/chat/message-prep.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AAQjC,OAAO,EAKL,KAAK,aAAa,EAGlB,KAAK,oBAAoB,EAE1B,MAAM,YAAY,CAAC;AAMpB,uBAAuB;AACvB,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAErD;AAOD,qBAAqB;AACrB,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,oBAAoB,EAAE,EAChC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GACb,oBAAoB,EAAE,CAiCxB;AAqCD,kDAAkD;AAClD,wBAAgB,qCAAqC,CACnD,QAAQ,EAAE,oBAAoB,EAAE,EAChC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GACf,oBAAoB,EAAE,CAiExB;AA+BD,4DAA4D;AAC5D,wBAAgB,6BAA6B,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAGxE;AAED,gDAAgD;AAChD,wBAAgB,kCAAkC,CAAC,QAAQ,EAAE,aAAa,EAAE,GAAG,aAAa,EAAE,CAwB7F;AAED,qDAAqD;AACrD,wBAAgB,wCA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qB,CAAC,QAAQ,EAAE,aAAa,EAAE,GAAG,aAAa,EAAE,CAiBhF;AAsFD,wCAAwC;AACxC,wBAAgB,6BAA6B,CAC3C,QAAQ,EAAE,oBAAoB,EAAE,GAC/B,oBAAoB,EAAE,CAwBxB;AA4ED,wDAAwD;AACxD,wBAAgB,0CAA0C,CACxD,QAAQ,EAAE,aAAa,EAAE,EACzB,OAAO,GAAE,iDAAsD,GAC9D,oBAAoB,EAAE,CAqBxB;AA2OD,6BAA6B;AAC7B,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,oBAAoB,EAAE,GAAG,oBAAoB,EAAE,CA4E3F;AAWD,yBAAyB;AACzB,wBAAgB,eAAe,CAAC,QAAQ,EAAE,oBAAoB,EAAE,GAAG,oBAAoB,EAAE,CA4IxF;AAED,yBAAyB;AACzB,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAGjF;AAED,sCAAsC;AACtC,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,oBAAoB,EAAE,GAAG,oBAAoB,EAAE,CA4B7F;AAED,wBAAwB;AACxB,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,oBAAoB,EAAE,EAChC,QAAQ,GAAE,MAAU,GACnB,oBAAoB,EAAE,CAexB;AAED,2BAA2B;AAC3B,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,oBAAoB,EAAE,GAAG,oBAAoB,EAAE,CA0D1F;AAED,4BAA4B;AAC5B,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,oBAAoB,EAAE,EAChC,MAAM,GAAE,MAA6B,EACrC,QAAQ,GAAE,MAAU,GACnB,oBAAoB,EAAE,CAMxB"}
|
|
@@ -387,11 +387,64 @@ function filterValidMessages(messages) {
|
|
|
387
387
|
return true;
|
|
388
388
|
});
|
|
389
389
|
}
|
|
390
|
+
function getMessagePartToolCallId(part) {
|
|
391
|
+
if (!part || typeof part !== "object" || Array.isArray(part))
|
|
392
|
+
return undefined;
|
|
393
|
+
return getStringField(part, "toolCallId", "") ||
|
|
394
|
+
getStringField(part, "tool_call_id", "") ||
|
|
395
|
+
getStringField(part, "id", "") ||
|
|
396
|
+
undefined;
|
|
397
|
+
}
|
|
398
|
+
function getMessagePartToolName(part) {
|
|
399
|
+
if (!part || typeof part !== "object" || Array.isArray(part))
|
|
400
|
+
return undefined;
|
|
401
|
+
const record = part;
|
|
402
|
+
const explicitToolName = getStringField(part, "toolName", "") ||
|
|
403
|
+
getStringField(part, "tool_name", "") ||
|
|
404
|
+
getStringField(part, "name", "") ||
|
|
405
|
+
undefined;
|
|
406
|
+
if (explicitToolName)
|
|
407
|
+
return explicitToolName;
|
|
408
|
+
const type = typeof record.type === "string" ? record.type : undefined;
|
|
409
|
+
return type?.startsWith("tool-") && type !== "tool-call" && type !== "tool-result"
|
|
410
|
+
? type.replace(/^tool-/, "")
|
|
411
|
+
: undefined;
|
|
412
|
+
}
|
|
413
|
+
function stripProviderOwnedToolParts(messages, providerOwnedToolNames) {
|
|
414
|
+
if (!providerOwnedToolNames || providerOwnedToolNames.length === 0) {
|
|
415
|
+
return messages;
|
|
416
|
+
}
|
|
417
|
+
const providerOwnedNames = new Set(providerOwnedToolNames);
|
|
418
|
+
const providerOwnedToolCallIds = new Set();
|
|
419
|
+
return messages.map((message) => {
|
|
420
|
+
if (message.role === "user" || message.role === "system") {
|
|
421
|
+
providerOwnedToolCallIds.clear();
|
|
422
|
+
return message;
|
|
423
|
+
}
|
|
424
|
+
let mutated = false;
|
|
425
|
+
const parts = message.parts.filter((part) => {
|
|
426
|
+
const toolName = getMessagePartToolName(part);
|
|
427
|
+
const toolCallId = getMessagePartToolCallId(part);
|
|
428
|
+
const ownedByName = toolName ? providerOwnedNames.has(toolName) : false;
|
|
429
|
+
const ownedByCallId = toolCallId ? providerOwnedToolCallIds.has(toolCallId) : false;
|
|
430
|
+
if (!ownedByName && !ownedByCallId) {
|
|
431
|
+
return true;
|
|
432
|
+
}
|
|
433
|
+
if (toolCallId) {
|
|
434
|
+
providerOwnedToolCallIds.add(toolCallId);
|
|
435
|
+
}
|
|
436
|
+
mutated = true;
|
|
437
|
+
return false;
|
|
438
|
+
});
|
|
439
|
+
return mutated ? { ...message, parts } : message;
|
|
440
|
+
});
|
|
441
|
+
}
|
|
390
442
|
/** Prepare provider model messages from UI messages. */
|
|
391
|
-
export function prepareProviderModelMessagesFromUiMessages(messages) {
|
|
443
|
+
export function prepareProviderModelMessagesFromUiMessages(messages, options = {}) {
|
|
392
444
|
const validMessages = messages.filter((message) => message && typeof message === "object" && "role" in message);
|
|
393
445
|
const normalizedMessages = normalizeMessageFilePartMediaTypes(validMessages);
|
|
394
|
-
const
|
|
446
|
+
const strippedProviderOwnedToolMessages = stripProviderOwnedToolParts(normalizedMessages, options.providerOwnedToolNames);
|
|
447
|
+
const strippedPendingToolMessages = stripPendingToolParts(strippedProviderOwnedToolMessages);
|
|
395
448
|
const strippedSupersededToolMessages = stripSupersededToolErrorParts(strippedPendingToolMessages);
|
|
396
449
|
const rewrittenMessages = rewriteUnsupportedFilePartsAsAnnotations(strippedSupersededToolMessages);
|
|
397
450
|
const providerModelMessages = convertUiMessagesToProviderModelMessages(rewrittenMessages);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transpiler.d.ts","sourceRoot":"","sources":["../../../src/src/discovery/transpiler.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAmIvD;;GAEG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"transpiler.d.ts","sourceRoot":"","sources":["../../../src/src/discovery/transpiler.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAmIvD;;GAEG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,OAAO,CAAC,CAkGlB;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAE1C"}
|
|
@@ -198,7 +198,9 @@ export async function importModule(file, context) {
|
|
|
198
198
|
: await rewriteDiscoveryImports(js, context.baseDir ?? ".", localFs, fileDir);
|
|
199
199
|
await localFs.writeTextFile(tempFile, transformedCode);
|
|
200
200
|
try {
|
|
201
|
-
const
|
|
201
|
+
const moduleUrl = pathHelper.toFileUrl(tempFile);
|
|
202
|
+
moduleUrl.searchParams.set("v", String(Date.now()));
|
|
203
|
+
const module = await import(moduleUrl.href);
|
|
202
204
|
transpileCache.set(file, module);
|
|
203
205
|
return module;
|
|
204
206
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-stream.d.ts","sourceRoot":"","sources":["../../../src/src/internal-agents/run-stream.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,KAAK,EACV,KAAK,YAAY,IAAI,OAAO,EAC5B,KAAK,aAAa,EAEnB,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"run-stream.d.ts","sourceRoot":"","sources":["../../../src/src/internal-agents/run-stream.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,KAAK,EACV,KAAK,YAAY,IAAI,OAAO,EAC5B,KAAK,aAAa,EAEnB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,KAAK,EACV,+BAA+B,EAC/B,8BAA8B,EAC/B,MAAM,qBAAqB,CAAC;AAkB7B,OAAO,EAA0B,KAAK,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC3F,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAkCxD,MAAM,WAAW,+BAA+B;IAC9C,cAAc,EAAE,sBAAsB,CAAC;IACvC,mBAAmB,CAAC,EAAE;QACpB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;KAC1B,CAAC;IACF,cAAc,CAAC,EAAE,+BAA+B,CAAC,gBAAgB,CAAC,CAAC;IACnE,8BAA8B,CAAC,EAAE,CAC/B,KAAK,EAAE,+BAA+B,KACnC,OAAO,CAAC,8BAA8B,CAAC,CAAC;IAC7C,aAAa,CAAC,EAAE,CACd,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,KAClC;QACH,MAAM,EAAE,CACN,QAAQ,EAAE,OAAO,EAAE,EACnB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjC,SAAS,CAAC,EAAE;YACV,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,aAAa,KAAK,IAAI,CAAC;SAC9C,EACD,aAAa,CAAC,EAAE,MAAM,EACtB,uBAAuB,CAAC,EAAE,MAAM,EAChC,WAAW,CAAC,EAAE,WAAW,KACtB,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC;KAC1C,CAAC;CACH;AA6QD,wBAAsB,gCAAgC,CACpD,KAAK,EAAE,oBAAoB,EAC3B,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,+BAA+B,GACpC,OAAO,CAAC,QAAQ,CAAC,CA0SnB"}
|
|
@@ -17,7 +17,7 @@ const PROJECT_AGENT_SANDBOX_BASH_TOOL_NAME = "bash";
|
|
|
17
17
|
const INTERNAL_AGENT_RUNTIME_HEARTBEAT_INTERVAL_MS = 25_000;
|
|
18
18
|
const INTERNAL_AGENT_RUNTIME_HEARTBEAT_FRAME = new TextEncoder().encode(": internal-agent-runtime-heartbeat\n\n");
|
|
19
19
|
function getAgentAllowedRemoteToolNames(agent) {
|
|
20
|
-
const raw = agent.config.
|
|
20
|
+
const raw = agent.config.__vfAllowedRemoteTools;
|
|
21
21
|
return Array.isArray(raw) && raw.every((toolName) => typeof toolName === "string") ? raw : [];
|
|
22
22
|
}
|
|
23
23
|
function mergeRemoteToolNames(source, forwarded) {
|
|
@@ -250,7 +250,7 @@ export async function createRuntimeAgentStreamResponse(input, agent, deps) {
|
|
|
250
250
|
...agent.config,
|
|
251
251
|
tools: mergedTools,
|
|
252
252
|
...(allowedRemoteToolNames !== undefined
|
|
253
|
-
? {
|
|
253
|
+
? { __vfAllowedRemoteTools: allowedRemoteToolNames }
|
|
254
254
|
: {}),
|
|
255
255
|
...(forwardedIntegrationToolDefs !== undefined
|
|
256
256
|
? { __vfForwardedIntegrationToolDefs: forwardedIntegrationToolDefs }
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Skill Badge
|
|
2
|
+
* Skill Badge - compact indicator for skill tool calls (load_skill, load_skill_reference, execute_skill_script).
|
|
3
3
|
* @module react/components/chat/components/skill-badge
|
|
4
4
|
*/
|
|
5
5
|
import * as React from "../../../../../../react/react.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Skill Badge
|
|
2
|
+
* Skill Badge - compact indicator for skill tool calls (load_skill, load_skill_reference, execute_skill_script).
|
|
3
3
|
* @module react/components/chat/components/skill-badge
|
|
4
4
|
*/
|
|
5
5
|
import * as React from "../../../../../../react/react.js";
|
|
@@ -12,12 +12,12 @@ export function SkillBadge({ tool, className }) {
|
|
|
12
12
|
const isComplete = tool.state === "output-available";
|
|
13
13
|
const isError = tool.state === "output-error";
|
|
14
14
|
let label;
|
|
15
|
-
if (tool.toolName === "
|
|
15
|
+
if (tool.toolName === "load_skill") {
|
|
16
16
|
label = isComplete
|
|
17
17
|
? `Skill: ${skillId ?? "unknown"}`
|
|
18
18
|
: `Loading skill${skillId ? `: ${skillId}` : ""}...`;
|
|
19
19
|
}
|
|
20
|
-
else if (tool.toolName === "
|
|
20
|
+
else if (tool.toolName === "load_skill_reference") {
|
|
21
21
|
const ref = input?.reference;
|
|
22
22
|
label = isComplete ? `Reference: ${ref ?? "unknown"}` : `Reading${ref ? `: ${ref}` : ""}...`;
|
|
23
23
|
}
|
|
@@ -8,7 +8,7 @@ import type { Source } from "../components/sources.js";
|
|
|
8
8
|
export declare function getTextContent(message: ChatMessage): string;
|
|
9
9
|
/** Check if a part is a tool part */
|
|
10
10
|
export declare function isToolPart(part: ChatMessagePart): part is ChatToolPart | ChatDynamicToolPart;
|
|
11
|
-
/** Check if a tool part is a skill-related tool
|
|
11
|
+
/** Check if a tool part is a skill-related tool. */
|
|
12
12
|
export declare function isSkillToolPart(tool: ChatToolPart | ChatDynamicToolPart): boolean;
|
|
13
13
|
/** Check if a part is a reasoning part */
|
|
14
14
|
export declare function isReasoningPart(part: ChatMessagePart): part is {
|