veryfront 0.1.131 → 0.1.136
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/_dnt.polyfills.d.ts +11 -0
- package/esm/_dnt.polyfills.d.ts.map +1 -1
- package/esm/_dnt.polyfills.js +14 -0
- package/esm/cli/commands/build/handler.js +2 -0
- package/esm/cli/commands/deploy/command.d.ts.map +1 -1
- package/esm/cli/commands/deploy/command.js +2 -0
- package/esm/cli/commands/files/command.d.ts.map +1 -1
- package/esm/cli/commands/files/command.js +1 -0
- package/esm/cli/commands/uploads/command.d.ts.map +1 -1
- package/esm/cli/commands/uploads/command.js +1 -0
- package/esm/cli/help/tips.d.ts +3 -0
- package/esm/cli/help/tips.d.ts.map +1 -1
- package/esm/cli/help/tips.js +15 -1
- package/esm/cli/router.d.ts.map +1 -1
- package/esm/cli/router.js +4 -0
- package/esm/cli/shared/animation.d.ts +3 -0
- package/esm/cli/shared/animation.d.ts.map +1 -0
- package/esm/cli/shared/animation.js +23 -0
- package/esm/cli/templates/manifest.d.ts +6 -0
- package/esm/cli/templates/manifest.js +12 -6
- package/esm/cli/ui/progress.d.ts.map +1 -1
- package/esm/cli/ui/progress.js +13 -1
- package/esm/deno.js +1 -1
- package/esm/src/agent/index.d.ts +1 -1
- package/esm/src/agent/index.d.ts.map +1 -1
- package/esm/src/agent/runtime/ai-stream-handler.d.ts.map +1 -1
- package/esm/src/agent/runtime/ai-stream-handler.js +56 -5
- package/esm/src/agent/runtime/index.d.ts.map +1 -1
- package/esm/src/agent/runtime/index.js +21 -3
- package/esm/src/agent/runtime/model-tool-converter.d.ts +5 -1
- package/esm/src/agent/runtime/model-tool-converter.d.ts.map +1 -1
- package/esm/src/agent/runtime/model-tool-converter.js +35 -4
- package/esm/src/agent/runtime/tool-helpers.d.ts +2 -1
- package/esm/src/agent/runtime/tool-helpers.d.ts.map +1 -1
- package/esm/src/agent/runtime/tool-helpers.js +6 -3
- package/esm/src/agent/types.d.ts +19 -0
- package/esm/src/agent/types.d.ts.map +1 -1
- package/esm/src/channels/control-plane.d.ts +67 -0
- package/esm/src/channels/control-plane.d.ts.map +1 -1
- package/esm/src/channels/control-plane.js +27 -0
- package/esm/src/discovery/handlers/tool-handler.d.ts.map +1 -1
- package/esm/src/discovery/handlers/tool-handler.js +12 -2
- package/esm/src/html/html-injection.d.ts +2 -0
- package/esm/src/html/html-injection.d.ts.map +1 -1
- package/esm/src/html/html-injection.js +10 -5
- package/esm/src/html/nonce-injection.d.ts +3 -0
- package/esm/src/html/nonce-injection.d.ts.map +1 -0
- package/esm/src/html/nonce-injection.js +249 -0
- package/esm/src/internal-agents/ag-ui-sse.d.ts +1 -0
- package/esm/src/internal-agents/ag-ui-sse.d.ts.map +1 -1
- package/esm/src/internal-agents/ag-ui-sse.js +18 -0
- package/esm/src/internal-agents/run-stream.d.ts.map +1 -1
- package/esm/src/internal-agents/run-stream.js +26 -4
- package/esm/src/platform/adapters/fs/veryfront/proxy-manager.d.ts +1 -0
- package/esm/src/platform/adapters/fs/veryfront/proxy-manager.d.ts.map +1 -1
- package/esm/src/platform/adapters/fs/veryfront/proxy-manager.js +15 -1
- package/esm/src/platform/adapters/fs/veryfront/types.d.ts +2 -0
- package/esm/src/platform/adapters/fs/veryfront/types.d.ts.map +1 -1
- package/esm/src/platform/adapters/fs/veryfront/websocket-manager.d.ts.map +1 -1
- package/esm/src/platform/adapters/fs/veryfront/websocket-manager.js +2 -0
- package/esm/src/proxy/handler.d.ts.map +1 -1
- package/esm/src/proxy/handler.js +25 -5
- package/esm/src/react/components/Head.d.ts +9 -0
- package/esm/src/react/components/Head.d.ts.map +1 -1
- package/esm/src/react/components/Head.js +9 -0
- package/esm/src/react/context/index.d.ts +9 -0
- package/esm/src/react/context/index.d.ts.map +1 -1
- package/esm/src/react/context/index.js +9 -0
- package/esm/src/react/router/index.d.ts +9 -0
- package/esm/src/react/router/index.d.ts.map +1 -1
- package/esm/src/react/router/index.js +9 -0
- package/esm/src/rendering/orchestrator/html.d.ts +1 -0
- package/esm/src/rendering/orchestrator/html.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/html.js +81 -89
- package/esm/src/rendering/script-page-handling.js +1 -0
- package/esm/src/server/handlers/dev/framework-candidates.generated.d.ts.map +1 -1
- package/esm/src/server/handlers/dev/framework-candidates.generated.js +9 -0
- package/esm/src/server/handlers/request/ssr/ssr-response-builder.d.ts.map +1 -1
- package/esm/src/server/handlers/request/ssr/ssr-response-builder.js +3 -7
- package/esm/src/server/handlers/request/static.handler.d.ts.map +1 -1
- package/esm/src/server/handlers/request/static.handler.js +18 -10
- package/esm/src/tool/factory.d.ts.map +1 -1
- package/esm/src/tool/factory.js +14 -4
- package/esm/src/tool/types.d.ts +2 -0
- package/esm/src/tool/types.d.ts.map +1 -1
- package/esm/src/transforms/pipeline/stages/ssr-vf-modules/constants.d.ts +1 -0
- package/esm/src/transforms/pipeline/stages/ssr-vf-modules/constants.d.ts.map +1 -1
- package/esm/src/transforms/pipeline/stages/ssr-vf-modules/constants.js +3 -0
- package/esm/src/transforms/pipeline/stages/ssr-vf-modules/import-finder.d.ts.map +1 -1
- package/esm/src/transforms/pipeline/stages/ssr-vf-modules/import-finder.js +4 -2
- package/esm/src/transforms/pipeline/stages/ssr-vf-modules/index.d.ts +1 -1
- package/esm/src/transforms/pipeline/stages/ssr-vf-modules/index.d.ts.map +1 -1
- package/esm/src/transforms/pipeline/stages/ssr-vf-modules/index.js +10 -9
- package/esm/src/transforms/pipeline/stages/ssr-vf-modules/path-resolver.d.ts.map +1 -1
- package/esm/src/transforms/pipeline/stages/ssr-vf-modules/path-resolver.js +3 -1
- 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/_dnt.polyfills.ts +27 -0
- package/src/cli/commands/build/handler.ts +3 -0
- package/src/cli/commands/deploy/command.ts +3 -0
- package/src/cli/commands/files/command.ts +1 -0
- package/src/cli/commands/uploads/command.ts +3 -0
- package/src/cli/help/tips.ts +18 -1
- package/src/cli/router.ts +5 -0
- package/src/cli/shared/animation.ts +25 -0
- package/src/cli/templates/manifest.js +12 -6
- package/src/cli/ui/progress.ts +13 -1
- package/src/deno.js +1 -1
- package/src/src/agent/index.ts +2 -0
- package/src/src/agent/runtime/ai-stream-handler.ts +64 -6
- package/src/src/agent/runtime/index.ts +26 -1
- package/src/src/agent/runtime/model-tool-converter.ts +47 -3
- package/src/src/agent/runtime/tool-helpers.ts +15 -3
- package/src/src/agent/types.ts +23 -0
- package/src/src/channels/control-plane.ts +31 -0
- package/src/src/discovery/handlers/tool-handler.ts +13 -2
- package/src/src/html/html-injection.ts +16 -5
- package/src/src/html/nonce-injection.ts +300 -0
- package/src/src/internal-agents/ag-ui-sse.ts +20 -0
- package/src/src/internal-agents/run-stream.ts +35 -4
- package/src/src/platform/adapters/fs/veryfront/proxy-manager.ts +29 -3
- package/src/src/platform/adapters/fs/veryfront/types.ts +2 -0
- package/src/src/platform/adapters/fs/veryfront/websocket-manager.ts +2 -0
- package/src/src/proxy/handler.ts +43 -5
- package/src/src/react/components/Head.tsx +10 -0
- package/src/src/react/context/index.tsx +10 -0
- package/src/src/react/router/index.tsx +10 -0
- package/src/src/rendering/orchestrator/html.ts +125 -100
- package/src/src/rendering/script-page-handling.ts +1 -0
- package/src/src/server/handlers/dev/framework-candidates.generated.ts +9 -0
- package/src/src/server/handlers/request/ssr/ssr-response-builder.ts +7 -11
- package/src/src/server/handlers/request/static.handler.ts +22 -10
- package/src/src/tool/factory.ts +17 -4
- package/src/src/tool/types.ts +2 -0
- package/src/src/transforms/pipeline/stages/ssr-vf-modules/constants.ts +4 -0
- package/src/src/transforms/pipeline/stages/ssr-vf-modules/import-finder.ts +4 -2
- package/src/src/transforms/pipeline/stages/ssr-vf-modules/index.ts +18 -15
- package/src/src/transforms/pipeline/stages/ssr-vf-modules/path-resolver.ts +4 -1
- package/src/src/utils/version-constant.ts +1 -1
|
@@ -12,6 +12,32 @@ import { isDynamicTool } from "./tool-helpers.js";
|
|
|
12
12
|
import { serverLogger } from "../../utils/index.js";
|
|
13
13
|
import { setActiveSpanAttributes, withSpan } from "../../observability/tracing/otlp-setup.js";
|
|
14
14
|
const logger = serverLogger.component("agent");
|
|
15
|
+
function isRecord(value) {
|
|
16
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
17
|
+
}
|
|
18
|
+
function normalizeToolInputString(input) {
|
|
19
|
+
if (typeof input === "string") {
|
|
20
|
+
return input;
|
|
21
|
+
}
|
|
22
|
+
return JSON.stringify(input ?? null) ?? "null";
|
|
23
|
+
}
|
|
24
|
+
function normalizeToolInputObject(input) {
|
|
25
|
+
if (isRecord(input)) {
|
|
26
|
+
return input;
|
|
27
|
+
}
|
|
28
|
+
if (typeof input === "string") {
|
|
29
|
+
try {
|
|
30
|
+
const parsed = JSON.parse(input);
|
|
31
|
+
if (isRecord(parsed)) {
|
|
32
|
+
return parsed;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
return {};
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return {};
|
|
40
|
+
}
|
|
15
41
|
function createAbortError(reason) {
|
|
16
42
|
if (reason instanceof Error) {
|
|
17
43
|
return reason;
|
|
@@ -23,6 +49,17 @@ function throwIfAborted(abortSignal) {
|
|
|
23
49
|
throw createAbortError(abortSignal.reason);
|
|
24
50
|
}
|
|
25
51
|
}
|
|
52
|
+
function stringifyToolError(output) {
|
|
53
|
+
if (typeof output === "string" && output.length > 0) {
|
|
54
|
+
return output;
|
|
55
|
+
}
|
|
56
|
+
try {
|
|
57
|
+
return JSON.stringify(output);
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
return String(output);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
26
63
|
export function createStreamState() {
|
|
27
64
|
return {
|
|
28
65
|
accumulatedText: "",
|
|
@@ -91,17 +128,14 @@ export function processStream(result, state, controller, encoder, textPartId, ca
|
|
|
91
128
|
case "tool-call": {
|
|
92
129
|
// tool-call fires when the full tool call is available
|
|
93
130
|
const toolId = part.toolCallId;
|
|
94
|
-
const inputStr =
|
|
131
|
+
const inputStr = normalizeToolInputString(part.input);
|
|
95
132
|
state.toolCalls.set(toolId, {
|
|
96
133
|
id: toolId,
|
|
97
134
|
name: part.toolName,
|
|
98
135
|
arguments: inputStr,
|
|
99
136
|
});
|
|
100
137
|
const dynamic = isDynamicTool(part.toolName);
|
|
101
|
-
|
|
102
|
-
const inputObj = (part.input && typeof part.input === "object" && !Array.isArray(part.input))
|
|
103
|
-
? part.input
|
|
104
|
-
: {};
|
|
138
|
+
const inputObj = normalizeToolInputObject(part.input);
|
|
105
139
|
sendSSE(controller, encoder, {
|
|
106
140
|
type: "tool-input-available",
|
|
107
141
|
toolCallId: toolId,
|
|
@@ -111,6 +145,23 @@ export function processStream(result, state, controller, encoder, textPartId, ca
|
|
|
111
145
|
});
|
|
112
146
|
break;
|
|
113
147
|
}
|
|
148
|
+
case "tool-result": {
|
|
149
|
+
const isError = "isError" in part && part.isError === true;
|
|
150
|
+
if (isError) {
|
|
151
|
+
sendSSE(controller, encoder, {
|
|
152
|
+
type: "tool-output-error",
|
|
153
|
+
toolCallId: part.toolCallId,
|
|
154
|
+
errorText: stringifyToolError(part.output),
|
|
155
|
+
});
|
|
156
|
+
break;
|
|
157
|
+
}
|
|
158
|
+
sendSSE(controller, encoder, {
|
|
159
|
+
type: "tool-output-available",
|
|
160
|
+
toolCallId: part.toolCallId,
|
|
161
|
+
output: part.output,
|
|
162
|
+
});
|
|
163
|
+
break;
|
|
164
|
+
}
|
|
114
165
|
case "finish": {
|
|
115
166
|
state.finishReason = part.finishReason;
|
|
116
167
|
if (part.totalUsage) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,K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,OAAO,CAAC,EACjC,SAAS,CAAC,EAAE;QACV,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;KAC9C,EACD,aAAa,CAAC,EAAE,MAAM,EACtB,uBAAuB,CAAC,EAAE,MAAM,EAChC,WAAW,CAAC,EAAE,WAAW,GACxB,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;IAsHtC;;OAEG;YACW,gBAAgB;IAuO9B;;;;OAIG;YACW,yBAAyB;IAiPvC;;OAEG;YACW,eAAe;IAqC7B;;OAEG;YACW,mBAAmB;IAOjC;;OAEG;IACH,OAAO,CAAC,eAAe;IAKvB,OAAO,CAAC,sBAAsB;IAY9B;;OAEG;IACH,SAAS,IAAI,MAAM,CAAC,OAAO,CAAC;IAI5B;;OAEG;IACG,cAAc,IAAI,OAAO,CAAC;QAC9B,aAAa,EAAE,MAAM,CAAC;QACtB,eAAe,EAAE,MAAM,CAAC;QACxB,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IAIF;;OAEG;IACG,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;CAGnC"}
|
|
@@ -117,6 +117,17 @@ function isLocalModel(model) {
|
|
|
117
117
|
m.provider === "local" ||
|
|
118
118
|
(typeof m.modelId === "string" && m.modelId.startsWith("local/"));
|
|
119
119
|
}
|
|
120
|
+
function getRuntimeAllowedRemoteTools(config) {
|
|
121
|
+
const configWithRuntimeFilters = config;
|
|
122
|
+
if (!Object.hasOwn(configWithRuntimeFilters, "__vfAllowedRemoteTools")) {
|
|
123
|
+
return undefined;
|
|
124
|
+
}
|
|
125
|
+
const raw = configWithRuntimeFilters.__vfAllowedRemoteTools;
|
|
126
|
+
if (!Array.isArray(raw)) {
|
|
127
|
+
return [];
|
|
128
|
+
}
|
|
129
|
+
return raw.every((toolName) => typeof toolName === "string") ? raw : [];
|
|
130
|
+
}
|
|
120
131
|
export class AgentRuntime {
|
|
121
132
|
id;
|
|
122
133
|
config;
|
|
@@ -281,11 +292,13 @@ export class AgentRuntime {
|
|
|
281
292
|
}
|
|
282
293
|
// Request-scoped skill policy (not class-level mutable state)
|
|
283
294
|
let activeSkillPolicy;
|
|
295
|
+
const allowedRemoteToolNames = getRuntimeAllowedRemoteTools(this.config);
|
|
284
296
|
for (let step = 0; step < maxSteps; step++) {
|
|
285
297
|
this.status = "thinking";
|
|
286
298
|
addSpanEvent(loopSpan, "step_start", { step });
|
|
287
299
|
let tools = isLocal ? [] : await getAvailableTools(this.config.tools, {
|
|
288
300
|
includeSkillTools: Boolean(this.config.skills),
|
|
301
|
+
allowedRemoteToolNames,
|
|
289
302
|
});
|
|
290
303
|
// Layer 1: Filter tools based on active skill policy (planning-time)
|
|
291
304
|
if (activeSkillPolicy) {
|
|
@@ -387,7 +400,7 @@ export class AgentRuntime {
|
|
|
387
400
|
agentId: this.id,
|
|
388
401
|
toolCallId: tc.toolCallId,
|
|
389
402
|
projectId: cacheCtx?.projectId,
|
|
390
|
-
});
|
|
403
|
+
}, allowedRemoteToolNames);
|
|
391
404
|
toolCall.status = "completed";
|
|
392
405
|
toolCall.result = result;
|
|
393
406
|
toolCall.executionTime = Date.now() - startTime;
|
|
@@ -473,11 +486,13 @@ export class AgentRuntime {
|
|
|
473
486
|
// Request-scoped skill policy (not class-level mutable state)
|
|
474
487
|
let activeSkillPolicy;
|
|
475
488
|
let finalFinishReason;
|
|
489
|
+
const allowedRemoteToolNames = getRuntimeAllowedRemoteTools(this.config);
|
|
476
490
|
for (let step = 0; step < maxSteps; step++) {
|
|
477
491
|
throwIfAborted(abortSignal);
|
|
478
492
|
sendSSE(controller, encoder, { type: "step-start" });
|
|
479
493
|
let tools = isLocalStreaming ? [] : await getAvailableTools(this.config.tools, {
|
|
480
494
|
includeSkillTools: Boolean(this.config.skills),
|
|
495
|
+
allowedRemoteToolNames,
|
|
481
496
|
});
|
|
482
497
|
// Layer 1: Filter tools based on active skill policy (planning-time)
|
|
483
498
|
if (activeSkillPolicy) {
|
|
@@ -487,7 +502,10 @@ export class AgentRuntime {
|
|
|
487
502
|
model: languageModel,
|
|
488
503
|
system: systemPrompt,
|
|
489
504
|
messages: convertToModelMessages(currentMessages),
|
|
490
|
-
tools: convertToolsToAISDK(tools
|
|
505
|
+
tools: convertToolsToAISDK(tools, {
|
|
506
|
+
model: effectiveModel,
|
|
507
|
+
allowedToolNames: allowedRemoteToolNames,
|
|
508
|
+
}),
|
|
491
509
|
maxOutputTokens: this.resolveMaxOutputTokens(maxOutputTokensOverride),
|
|
492
510
|
temperature: DEFAULT_TEMPERATURE,
|
|
493
511
|
abortSignal,
|
|
@@ -566,7 +584,7 @@ export class AgentRuntime {
|
|
|
566
584
|
agentId: this.id,
|
|
567
585
|
toolCallId: tc.id,
|
|
568
586
|
...toolContext,
|
|
569
|
-
});
|
|
587
|
+
}, allowedRemoteToolNames);
|
|
570
588
|
throwIfAborted(abortSignal);
|
|
571
589
|
toolCall.status = "completed";
|
|
572
590
|
toolCall.result = result;
|
|
@@ -8,11 +8,15 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import type { ToolSet } from "ai";
|
|
10
10
|
import type { ToolDefinition } from "../../tool/index.js";
|
|
11
|
+
export interface ConvertToolsToAISDKOptions {
|
|
12
|
+
model?: string;
|
|
13
|
+
allowedToolNames?: string[];
|
|
14
|
+
}
|
|
11
15
|
/**
|
|
12
16
|
* Convert veryfront tool definitions to AI SDK ToolSet.
|
|
13
17
|
*
|
|
14
18
|
* The AI SDK tool() function wraps each tool with its schema.
|
|
15
19
|
* We don't provide `execute` — the agent runtime handles execution.
|
|
16
20
|
*/
|
|
17
|
-
export declare function convertToolsToAISDK(tools: ToolDefinition[]): ToolSet | undefined;
|
|
21
|
+
export declare function convertToolsToAISDK(tools: ToolDefinition[], options?: ConvertToolsToAISDKOptions): ToolSet | undefined;
|
|
18
22
|
//# sourceMappingURL=model-tool-converter.d.ts.map
|
|
@@ -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;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"model-tool-converter.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/model-tool-converter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAG1D,MAAM,WAAW,0BAA0B;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC7B;AAgCD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,cAAc,EAAE,EACvB,OAAO,CAAC,EAAE,0BAA0B,GACnC,OAAO,GAAG,SAAS,CAoBrB"}
|
|
@@ -7,15 +7,38 @@
|
|
|
7
7
|
* @module ai/agent/runtime/model-tool-converter
|
|
8
8
|
*/
|
|
9
9
|
import { jsonSchema, tool } from "ai";
|
|
10
|
+
import { anthropic } from "@ai-sdk/anthropic";
|
|
11
|
+
function resolveHostedProvider(model) {
|
|
12
|
+
if (!model)
|
|
13
|
+
return undefined;
|
|
14
|
+
const [provider, second] = model.split("/", 3);
|
|
15
|
+
if (!provider)
|
|
16
|
+
return undefined;
|
|
17
|
+
if (provider === "veryfront-cloud") {
|
|
18
|
+
return second || undefined;
|
|
19
|
+
}
|
|
20
|
+
return provider;
|
|
21
|
+
}
|
|
22
|
+
function resolveProviderNativeTools(options) {
|
|
23
|
+
if (!options?.allowedToolNames?.includes("web_search")) {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
if (resolveHostedProvider(options.model) !== "anthropic") {
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
web_search: anthropic.tools.webSearch_20250305({
|
|
31
|
+
maxUses: 5,
|
|
32
|
+
}),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
10
35
|
/**
|
|
11
36
|
* Convert veryfront tool definitions to AI SDK ToolSet.
|
|
12
37
|
*
|
|
13
38
|
* The AI SDK tool() function wraps each tool with its schema.
|
|
14
39
|
* We don't provide `execute` — the agent runtime handles execution.
|
|
15
40
|
*/
|
|
16
|
-
export function convertToolsToAISDK(tools) {
|
|
17
|
-
if (!tools.length)
|
|
18
|
-
return undefined;
|
|
41
|
+
export function convertToolsToAISDK(tools, options) {
|
|
19
42
|
const toolSet = {};
|
|
20
43
|
for (const def of tools) {
|
|
21
44
|
toolSet[def.name] = tool({
|
|
@@ -23,5 +46,13 @@ export function convertToolsToAISDK(tools) {
|
|
|
23
46
|
inputSchema: jsonSchema(def.parameters),
|
|
24
47
|
});
|
|
25
48
|
}
|
|
26
|
-
|
|
49
|
+
const providerNativeTools = resolveProviderNativeTools(options);
|
|
50
|
+
if (providerNativeTools) {
|
|
51
|
+
for (const [name, providerTool] of Object.entries(providerNativeTools)) {
|
|
52
|
+
if (!Object.hasOwn(toolSet, name)) {
|
|
53
|
+
toolSet[name] = providerTool;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return Object.keys(toolSet).length > 0 ? toolSet : undefined;
|
|
27
58
|
}
|
|
@@ -28,7 +28,7 @@ export declare function isDynamicTool(name: string): boolean;
|
|
|
28
28
|
*/
|
|
29
29
|
export type ToolConfigEntry = Tool<any, any> | boolean;
|
|
30
30
|
export declare function resolveConfiguredTool(toolsConfig: true | Record<string, ToolConfigEntry> | undefined, toolName: string): Tool | null;
|
|
31
|
-
export declare function executeConfiguredTool(toolName: string, input: Record<string, unknown>, toolsConfig: true | Record<string, ToolConfigEntry> | undefined, context?: ToolExecutionContext): Promise<unknown>;
|
|
31
|
+
export declare function executeConfiguredTool(toolName: string, input: Record<string, unknown>, toolsConfig: true | Record<string, ToolConfigEntry> | undefined, context?: ToolExecutionContext, allowedRemoteToolNames?: string[]): Promise<unknown>;
|
|
32
32
|
/**
|
|
33
33
|
* Get available tools based on agent configuration.
|
|
34
34
|
* When tools === true, loads all tools from registry.
|
|
@@ -40,5 +40,6 @@ export declare function executeConfiguredTool(toolName: string, input: Record<st
|
|
|
40
40
|
export declare function getAvailableTools(toolsConfig: true | Record<string, ToolConfigEntry> | undefined, options?: {
|
|
41
41
|
includeSkillTools?: boolean;
|
|
42
42
|
includeIntegrationTools?: boolean;
|
|
43
|
+
allowedRemoteToolNames?: string[];
|
|
43
44
|
}): Promise<ToolDefinition[]>;
|
|
44
45
|
//# sourceMappingURL=tool-helpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-helpers.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/tool-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAYtF;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACxC,cAAc,CAuBhB;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEnD;AAED;;;GAGG;AAEH,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,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ACzC,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,WAAW,EAAE,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,GAAG,SAAS,EAC/D,OAAO,CAAC,EAAE,oBAAoB,EAC9B,sBAAsB,CAAC,EAAE,MAAM,EAAE,GAChC,OAAO,CAAC,OAAO,CAAC,CAyBlB;AAoBD;;;;;;;GAOG;AACH,wBAAsB,iBAAiB,CACrC,WAAW,EAAE,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,GAAG,SAAS,EAC/D,OAAO,CAAC,EAAE;IACR,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,sBAAsB,CAAC,EAAE,MAAM,EAAE,CAAC;CACnC,GACA,OAAO,CAAC,cAAc,EAAE,CAAC,CA4E3B"}
|
|
@@ -59,7 +59,7 @@ export function resolveConfiguredTool(toolsConfig, toolName) {
|
|
|
59
59
|
}
|
|
60
60
|
return null;
|
|
61
61
|
}
|
|
62
|
-
export async function executeConfiguredTool(toolName, input, toolsConfig, context) {
|
|
62
|
+
export async function executeConfiguredTool(toolName, input, toolsConfig, context, allowedRemoteToolNames) {
|
|
63
63
|
const configuredTool = resolveConfiguredTool(toolsConfig, toolName);
|
|
64
64
|
if (configuredTool) {
|
|
65
65
|
return await configuredTool.execute(input, context);
|
|
@@ -71,6 +71,9 @@ export async function executeConfiguredTool(toolName, input, toolsConfig, contex
|
|
|
71
71
|
}
|
|
72
72
|
// Fall back to remote execution for integration tools (e.g., github:list-repos)
|
|
73
73
|
if (isRemoteIntegrationTool(toolName)) {
|
|
74
|
+
if (allowedRemoteToolNames && !allowedRemoteToolNames.includes(toolName)) {
|
|
75
|
+
throw new Error(`Tool "${toolName}" is not allowed for this run`);
|
|
76
|
+
}
|
|
74
77
|
return await executeRemoteIntegrationTool(toolName, input, context?.endUserId);
|
|
75
78
|
}
|
|
76
79
|
return await executeTool(toolName, input, context);
|
|
@@ -113,7 +116,7 @@ export async function getAvailableTools(toolsConfig, options) {
|
|
|
113
116
|
if (options?.includeIntegrationTools !== false) {
|
|
114
117
|
try {
|
|
115
118
|
const { getRemoteIntegrationToolDefinitions } = await import("../../integrations/remote-tools.js");
|
|
116
|
-
const remoteDefs = await getRemoteIntegrationToolDefinitions();
|
|
119
|
+
const remoteDefs = (await getRemoteIntegrationToolDefinitions()).filter((def) => !options?.allowedRemoteToolNames || options.allowedRemoteToolNames.includes(def.name));
|
|
117
120
|
for (const def of remoteDefs) {
|
|
118
121
|
logToolDefinition(def.name, def);
|
|
119
122
|
}
|
|
@@ -143,7 +146,7 @@ export async function getAvailableTools(toolsConfig, options) {
|
|
|
143
146
|
if (options?.includeIntegrationTools !== false) {
|
|
144
147
|
try {
|
|
145
148
|
const { getRemoteIntegrationToolDefinitions } = await import("../../integrations/remote-tools.js");
|
|
146
|
-
const remoteDefs = await getRemoteIntegrationToolDefinitions();
|
|
149
|
+
const remoteDefs = (await getRemoteIntegrationToolDefinitions()).filter((def) => !options?.allowedRemoteToolNames || options.allowedRemoteToolNames.includes(def.name));
|
|
147
150
|
for (const def of remoteDefs) {
|
|
148
151
|
// Skip if already present (e.g., explicitly configured by name)
|
|
149
152
|
if (!tools.some((t) => t.name === def.name)) {
|
package/esm/src/agent/types.d.ts
CHANGED
|
@@ -12,6 +12,24 @@ import type { Message, MessagePart, ToolCall, ToolCallPart, ToolCallPartWithArgs
|
|
|
12
12
|
*/
|
|
13
13
|
export type ModelString = string;
|
|
14
14
|
import type { EdgeConfig, MemoryConfig } from "./schemas/index.js";
|
|
15
|
+
export type AgentSuggestion = {
|
|
16
|
+
id: string;
|
|
17
|
+
type: "prompt";
|
|
18
|
+
title: string;
|
|
19
|
+
description?: string;
|
|
20
|
+
prompt: string;
|
|
21
|
+
} | {
|
|
22
|
+
id: string;
|
|
23
|
+
type: "task";
|
|
24
|
+
title: string;
|
|
25
|
+
description?: string;
|
|
26
|
+
task: string;
|
|
27
|
+
prompt?: string;
|
|
28
|
+
};
|
|
29
|
+
export interface AgentSuggestions {
|
|
30
|
+
welcomeMessage?: string;
|
|
31
|
+
suggestions: AgentSuggestion[];
|
|
32
|
+
}
|
|
15
33
|
export interface AgentConfig {
|
|
16
34
|
id?: string;
|
|
17
35
|
/**
|
|
@@ -45,6 +63,7 @@ export interface AgentConfig {
|
|
|
45
63
|
* and registers the skill tools.
|
|
46
64
|
*/
|
|
47
65
|
skills?: true | string[];
|
|
66
|
+
suggestions?: AgentSuggestions;
|
|
48
67
|
/** Set to false to disable the default security middleware */
|
|
49
68
|
security?: false;
|
|
50
69
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/src/agent/types.ts"],"names":[],"mappings":"AAAA;;4BAE4B;AAC5B,OAAO,KAAK,OAAO,MAAM,qBAAqB,CAAC;AAG/C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAE7C,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,MAAM,WAAW,WAAW;IAC1B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;;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AAE,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;KACnC,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAE/B,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAE7D,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"}
|
|
@@ -24,6 +24,37 @@ export declare const RuntimeAgentSkillSchema: z.ZodObject<{
|
|
|
24
24
|
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
25
25
|
examples: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
26
26
|
}, z.core.$strip>;
|
|
27
|
+
export declare const RuntimeAgentSuggestionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
28
|
+
id: z.ZodString;
|
|
29
|
+
type: z.ZodLiteral<"prompt">;
|
|
30
|
+
title: z.ZodString;
|
|
31
|
+
description: z.ZodOptional<z.ZodString>;
|
|
32
|
+
prompt: z.ZodString;
|
|
33
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
34
|
+
id: z.ZodString;
|
|
35
|
+
type: z.ZodLiteral<"task">;
|
|
36
|
+
title: z.ZodString;
|
|
37
|
+
description: z.ZodOptional<z.ZodString>;
|
|
38
|
+
task: z.ZodString;
|
|
39
|
+
prompt: z.ZodOptional<z.ZodString>;
|
|
40
|
+
}, z.core.$strip>], "type">;
|
|
41
|
+
export declare const RuntimeAgentSuggestionsSchema: z.ZodObject<{
|
|
42
|
+
welcomeMessage: z.ZodOptional<z.ZodString>;
|
|
43
|
+
suggestions: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
44
|
+
id: z.ZodString;
|
|
45
|
+
type: z.ZodLiteral<"prompt">;
|
|
46
|
+
title: z.ZodString;
|
|
47
|
+
description: z.ZodOptional<z.ZodString>;
|
|
48
|
+
prompt: z.ZodString;
|
|
49
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
50
|
+
id: z.ZodString;
|
|
51
|
+
type: z.ZodLiteral<"task">;
|
|
52
|
+
title: z.ZodString;
|
|
53
|
+
description: z.ZodOptional<z.ZodString>;
|
|
54
|
+
task: z.ZodString;
|
|
55
|
+
prompt: z.ZodOptional<z.ZodString>;
|
|
56
|
+
}, z.core.$strip>], "type">>;
|
|
57
|
+
}, z.core.$strip>;
|
|
27
58
|
export declare const RuntimeAgentSchema: z.ZodObject<{
|
|
28
59
|
id: z.ZodString;
|
|
29
60
|
name: z.ZodString;
|
|
@@ -37,6 +68,23 @@ export declare const RuntimeAgentSchema: z.ZodObject<{
|
|
|
37
68
|
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
38
69
|
examples: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
39
70
|
}, z.core.$strip>>>;
|
|
71
|
+
suggestions: z.ZodOptional<z.ZodObject<{
|
|
72
|
+
welcomeMessage: z.ZodOptional<z.ZodString>;
|
|
73
|
+
suggestions: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
74
|
+
id: z.ZodString;
|
|
75
|
+
type: z.ZodLiteral<"prompt">;
|
|
76
|
+
title: z.ZodString;
|
|
77
|
+
description: z.ZodOptional<z.ZodString>;
|
|
78
|
+
prompt: z.ZodString;
|
|
79
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
80
|
+
id: z.ZodString;
|
|
81
|
+
type: z.ZodLiteral<"task">;
|
|
82
|
+
title: z.ZodString;
|
|
83
|
+
description: z.ZodOptional<z.ZodString>;
|
|
84
|
+
task: z.ZodString;
|
|
85
|
+
prompt: z.ZodOptional<z.ZodString>;
|
|
86
|
+
}, z.core.$strip>], "type">>;
|
|
87
|
+
}, z.core.$strip>>;
|
|
40
88
|
}, z.core.$strip>;
|
|
41
89
|
export declare const RuntimeAgentListResponseSchema: z.ZodObject<{
|
|
42
90
|
agents: z.ZodArray<z.ZodObject<{
|
|
@@ -52,6 +100,23 @@ export declare const RuntimeAgentListResponseSchema: z.ZodObject<{
|
|
|
52
100
|
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
53
101
|
examples: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
54
102
|
}, z.core.$strip>>>;
|
|
103
|
+
suggestions: z.ZodOptional<z.ZodObject<{
|
|
104
|
+
welcomeMessage: z.ZodOptional<z.ZodString>;
|
|
105
|
+
suggestions: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
106
|
+
id: z.ZodString;
|
|
107
|
+
type: z.ZodLiteral<"prompt">;
|
|
108
|
+
title: z.ZodString;
|
|
109
|
+
description: z.ZodOptional<z.ZodString>;
|
|
110
|
+
prompt: z.ZodString;
|
|
111
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
112
|
+
id: z.ZodString;
|
|
113
|
+
type: z.ZodLiteral<"task">;
|
|
114
|
+
title: z.ZodString;
|
|
115
|
+
description: z.ZodOptional<z.ZodString>;
|
|
116
|
+
task: z.ZodString;
|
|
117
|
+
prompt: z.ZodOptional<z.ZodString>;
|
|
118
|
+
}, z.core.$strip>], "type">>;
|
|
119
|
+
}, z.core.$strip>>;
|
|
55
120
|
}, z.core.$strip>>;
|
|
56
121
|
}, z.core.$strip>;
|
|
57
122
|
declare const dispatchClaimsSchema: z.ZodObject<{
|
|
@@ -82,6 +147,8 @@ declare const controlPlaneClaimsSchema: z.ZodObject<{
|
|
|
82
147
|
export type ControlPlaneSurface = z.infer<typeof ControlPlaneSurfaceSchema>;
|
|
83
148
|
export type ControlPlaneAgentsListRequest = z.infer<typeof ControlPlaneAgentsListRequestSchema>;
|
|
84
149
|
export type RuntimeAgentSkill = z.infer<typeof RuntimeAgentSkillSchema>;
|
|
150
|
+
export type RuntimeAgentSuggestion = z.infer<typeof RuntimeAgentSuggestionSchema>;
|
|
151
|
+
export type RuntimeAgentSuggestions = z.infer<typeof RuntimeAgentSuggestionsSchema>;
|
|
85
152
|
export type RuntimeAgent = z.infer<typeof RuntimeAgentSchema>;
|
|
86
153
|
export type RuntimeAgentListResponse = z.infer<typeof RuntimeAgentListResponseSchema>;
|
|
87
154
|
export type DispatchClaims = z.infer<typeof dispatchClaimsSchema>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control-plane.d.ts","sourceRoot":"","sources":["../../../src/src/channels/control-plane.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGxD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAUxB,eAAO,MAAM,yBAAyB;;;;;EAA+C,CAAC;AAEtF,eAAO,MAAM,mCAAmC;;;;;;;;;iBAI9C,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;;;;iBAMlC,CAAC;AAEH,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"control-plane.d.ts","sourceRoot":"","sources":["../../../src/src/channels/control-plane.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGxD,OAAO,EAAE,CAAC,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,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E,MAAM,WAAW,yBAAyB;IACxC,sBAAsB,EAAE,CAAC,GAAG,EAAE,cAAc,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/D,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,KAAK,GAAG,SAAS,CAAC;IAC5C,cAAc,EAAE,MAAM,MAAM,EAAE,CAAC;CAChC;AAiLD,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE,yBAAyB,GAC9B,OAAO,CAAC,wBAAwB,CAAC,CAUnC;AAED,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE;IACP,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;CACtB,GACA,OAAO,CAAC,cAAc,CAAC,CAmBzB;AAED,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE;IACP,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,mBAAmB,CAAC;IACtC,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;CACtB,GACA,OAAO,CAAC,kBAAkB,CAAC,CAmB7B"}
|
|
@@ -21,6 +21,27 @@ export const RuntimeAgentSkillSchema = z.object({
|
|
|
21
21
|
tags: z.array(z.string()).optional(),
|
|
22
22
|
examples: z.array(z.string()).optional(),
|
|
23
23
|
});
|
|
24
|
+
export const RuntimeAgentSuggestionSchema = z.discriminatedUnion("type", [
|
|
25
|
+
z.object({
|
|
26
|
+
id: z.string().min(1),
|
|
27
|
+
type: z.literal("prompt"),
|
|
28
|
+
title: z.string().min(1),
|
|
29
|
+
description: z.string().optional(),
|
|
30
|
+
prompt: z.string().min(1),
|
|
31
|
+
}),
|
|
32
|
+
z.object({
|
|
33
|
+
id: z.string().min(1),
|
|
34
|
+
type: z.literal("task"),
|
|
35
|
+
title: z.string().min(1),
|
|
36
|
+
description: z.string().optional(),
|
|
37
|
+
task: z.string().min(1),
|
|
38
|
+
prompt: z.string().min(1).optional(),
|
|
39
|
+
}),
|
|
40
|
+
]);
|
|
41
|
+
export const RuntimeAgentSuggestionsSchema = z.object({
|
|
42
|
+
welcomeMessage: z.string().min(1).optional(),
|
|
43
|
+
suggestions: z.array(RuntimeAgentSuggestionSchema),
|
|
44
|
+
});
|
|
24
45
|
export const RuntimeAgentSchema = z.object({
|
|
25
46
|
id: z.string().min(1),
|
|
26
47
|
name: z.string().min(1),
|
|
@@ -28,6 +49,7 @@ export const RuntimeAgentSchema = z.object({
|
|
|
28
49
|
model: z.string().nullable().optional(),
|
|
29
50
|
version: z.string().nullable().optional(),
|
|
30
51
|
skills: z.array(RuntimeAgentSkillSchema).optional(),
|
|
52
|
+
suggestions: RuntimeAgentSuggestionsSchema.optional(),
|
|
31
53
|
});
|
|
32
54
|
export const RuntimeAgentListResponseSchema = z.object({
|
|
33
55
|
agents: z.array(RuntimeAgentSchema),
|
|
@@ -150,6 +172,10 @@ function resolveAgentSkills(agent) {
|
|
|
150
172
|
}
|
|
151
173
|
function getRuntimeAgentMetadata(id, agent) {
|
|
152
174
|
const rawConfig = agent.config;
|
|
175
|
+
const suggestionsParseResult = rawConfig.suggestions === undefined
|
|
176
|
+
? null
|
|
177
|
+
: RuntimeAgentSuggestionsSchema.safeParse(rawConfig.suggestions);
|
|
178
|
+
const suggestions = suggestionsParseResult?.success ? suggestionsParseResult.data : undefined;
|
|
153
179
|
return RuntimeAgentSchema.parse({
|
|
154
180
|
id,
|
|
155
181
|
name: typeof rawConfig.name === "string" && rawConfig.name.trim().length > 0
|
|
@@ -159,6 +185,7 @@ function getRuntimeAgentMetadata(id, agent) {
|
|
|
159
185
|
model: agent.config.model ?? null,
|
|
160
186
|
version: typeof rawConfig.version === "string" ? rawConfig.version : null,
|
|
161
187
|
skills: resolveAgentSkills(agent),
|
|
188
|
+
...(suggestions === undefined ? {} : { suggestions }),
|
|
162
189
|
});
|
|
163
190
|
}
|
|
164
191
|
export async function listRuntimeAgents(ctx, deps) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-handler.d.ts","sourceRoot":"","sources":["../../../../src/src/discovery/handlers/tool-handler.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAEhD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"tool-handler.d.ts","sourceRoot":"","sources":["../../../../src/src/discovery/handlers/tool-handler.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAEhD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAQpD,eAAO,MAAM,WAAW,EAAE,gBAAgB,CAAC,IAAI,CAiB9C,CAAC"}
|
|
@@ -3,12 +3,22 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { registerTool } from "../../mcp/index.js";
|
|
5
5
|
import { filenameToId } from "../discovery-utils.js";
|
|
6
|
+
function hasGeneratedToolId(tool) {
|
|
7
|
+
return typeof tool.__veryfrontGeneratedId === "string" &&
|
|
8
|
+
tool.id === tool.__veryfrontGeneratedId;
|
|
9
|
+
}
|
|
6
10
|
export const toolHandler = {
|
|
7
11
|
typeName: "tool",
|
|
8
12
|
validate: (item) => item !== null && typeof item === "object" && typeof item.execute === "function",
|
|
9
|
-
getId: (
|
|
13
|
+
getId: (tool, file) => {
|
|
14
|
+
return typeof tool.id === "string" &&
|
|
15
|
+
tool.id.trim().length > 0 &&
|
|
16
|
+
!hasGeneratedToolId(tool)
|
|
17
|
+
? tool.id
|
|
18
|
+
: filenameToId(file);
|
|
19
|
+
},
|
|
10
20
|
register: (id, tool) => {
|
|
11
|
-
const toolWithId = { ...tool, id };
|
|
21
|
+
const toolWithId = tool.id === id ? tool : { ...tool, id };
|
|
12
22
|
registerTool(id, toolWithId);
|
|
13
23
|
return toolWithId;
|
|
14
24
|
},
|
|
@@ -27,6 +27,8 @@ export interface InjectHTMLContentOptions {
|
|
|
27
27
|
yjsGuid?: string;
|
|
28
28
|
/** Pre-built import map JSON for ESM module resolution (injected into <head>) */
|
|
29
29
|
importMapJson?: string;
|
|
30
|
+
/** Framework-generated project stylesheet for production shells */
|
|
31
|
+
projectStylesheetHref?: string;
|
|
30
32
|
}
|
|
31
33
|
export declare function injectHTMLContent(template: string, content: string, metadata: HTMLMetadata, options: InjectHTMLContentOptions): string;
|
|
32
34
|
//# sourceMappingURL=html-injection.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html-injection.d.ts","sourceRoot":"","sources":["../../../src/src/html/html-injection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAkB/D,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sEAAsE;IACtE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2EAA2E;IAC3E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kDAAkD;IAClD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,gDAAgD;IAChD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,0CAA0C;IAC1C,SAAS,CAAC,E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iFAAiF;IACjF,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mEAAmE;IACnE,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AAgBD,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,YAAY,EACtB,OAAO,EAAE,wBAAwB,GAChC,MAAM,CAwGR"}
|
|
@@ -37,6 +37,10 @@ export function injectHTMLContent(template, content, metadata, options) {
|
|
|
37
37
|
const importMapTag = `<script type="importmap"${nonceAttr}>\n${options.importMapJson}\n</script>`;
|
|
38
38
|
html = html.replace(/<\/head>/i, `${importMapTag}\n</head>`);
|
|
39
39
|
}
|
|
40
|
+
if (options.projectStylesheetHref && /<\/head>/i.test(html) && !hasProjectStylesheet(html)) {
|
|
41
|
+
const projectStylesheetTag = `<link rel="stylesheet" href="${options.projectStylesheetHref}">`;
|
|
42
|
+
html = html.replace(/<\/head>/i, `${projectStylesheetTag}\n</head>`);
|
|
43
|
+
}
|
|
40
44
|
const shouldUsePreviewStylesheet = options.mode === "development" ||
|
|
41
45
|
options.environment === "preview";
|
|
42
46
|
if (shouldUsePreviewStylesheet && /<\/head>/i.test(html) && !hasProjectStylesheet(html)) {
|
|
@@ -54,23 +58,24 @@ export function injectHTMLContent(template, content, metadata, options) {
|
|
|
54
58
|
environment: options.environment,
|
|
55
59
|
}),
|
|
56
60
|
});
|
|
57
|
-
const
|
|
61
|
+
const nonceAttr = buildNonceAttribute(options.nonce);
|
|
62
|
+
const hydrationScript = `<script id="veryfront-hydration-data" type="application/json"${nonceAttr}>${hydrationData}</script>`;
|
|
58
63
|
html = html.replace(/<\/body>/i, `${hydrationScript}</body>`);
|
|
59
64
|
}
|
|
60
65
|
if (options.mode === "development") {
|
|
61
66
|
const hasDevScriptsPlaceholder = /{{\s*devScripts\s*}}/i.test(html);
|
|
62
67
|
if (hasDevScriptsPlaceholder) {
|
|
63
|
-
html = html.replace(/{{\s*devScripts\s*}}/gi, getDevScripts());
|
|
68
|
+
html = html.replace(/{{\s*devScripts\s*}}/gi, getDevScripts(options.devPort, options.nonce));
|
|
64
69
|
}
|
|
65
|
-
html = html.replace(/{{\s*devStyles\s*}}/gi, getDevStyles());
|
|
70
|
+
html = html.replace(/{{\s*devStyles\s*}}/gi, getDevStyles(options.nonce));
|
|
66
71
|
if (!hasDevScriptsPlaceholder && hasBodyClose) {
|
|
67
|
-
html = html.replace(/<\/body>/i, `${getDevStyles()}${getDevScripts()}</body>`);
|
|
72
|
+
html = html.replace(/<\/body>/i, `${getDevStyles(options.nonce)}${getDevScripts(options.devPort, options.nonce)}</body>`);
|
|
68
73
|
}
|
|
69
74
|
}
|
|
70
75
|
else {
|
|
71
76
|
html = html.replace(/{{\s*devScripts\s*}}/gi, "");
|
|
72
77
|
html = html.replace(/{{\s*devStyles\s*}}/gi, "");
|
|
73
|
-
const prodScripts = getProdScripts(options.slug);
|
|
78
|
+
const prodScripts = getProdScripts(options.slug, options.nonce);
|
|
74
79
|
const hasProdScriptsPlaceholder = /{{\s*prodScripts\s*}}/i.test(html);
|
|
75
80
|
if (hasProdScriptsPlaceholder) {
|
|
76
81
|
html = html.replace(/{{\s*prodScripts\s*}}/gi, prodScripts);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nonce-injection.d.ts","sourceRoot":"","sources":["../../../src/src/html/nonce-injection.ts"],"names":[],"mappings":"AAgIA,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CA6DvE;AAED,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC,EAClC,KAAK,CAAC,EAAE,MAAM,GACb,cAAc,CAAC,UAAU,CAAC,CAyG5B"}
|