veryfront 0.1.645 → 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-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/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/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/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/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/package.json +1 -1
|
@@ -73,6 +73,28 @@ function mergeAllowedRemoteTools(current, requestedToolNames) {
|
|
|
73
73
|
}
|
|
74
74
|
return [...allowed].sort();
|
|
75
75
|
}
|
|
76
|
+
function getVeryfrontApiMcpPolicy(agent) {
|
|
77
|
+
const requestedToolNames = new Set();
|
|
78
|
+
const deniedToolNames = new Set();
|
|
79
|
+
let allowAll = false;
|
|
80
|
+
for (const server of agent.config.mcpServers ?? []) {
|
|
81
|
+
if (!("kind" in server) || server.kind !== "veryfront-api") {
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
for (const toolName of server.toolPolicy?.deny ?? []) {
|
|
85
|
+
deniedToolNames.add(toolName);
|
|
86
|
+
}
|
|
87
|
+
if (server.toolPolicy?.allow) {
|
|
88
|
+
for (const toolName of server.toolPolicy.allow) {
|
|
89
|
+
requestedToolNames.add(toolName);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
allowAll = true;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return { allowAll, requestedToolNames: [...requestedToolNames], deniedToolNames };
|
|
97
|
+
}
|
|
76
98
|
function hasVeryfrontPlatformRemoteToolSource(remoteTools) {
|
|
77
99
|
return remoteTools?.some((source) => source.id === VERYFRONT_PLATFORM_REMOTE_TOOL_SOURCE_ID) ??
|
|
78
100
|
false;
|
|
@@ -85,11 +107,12 @@ function createStaticRemoteToolSource(source, toolDefinitions) {
|
|
|
85
107
|
};
|
|
86
108
|
}
|
|
87
109
|
async function withVeryfrontPlatformRemoteTools(input) {
|
|
110
|
+
const veryfrontApiMcpPolicy = getVeryfrontApiMcpPolicy(input.agent);
|
|
88
111
|
const requestedToolNames = getRequestedUnresolvedBooleanToolNames({
|
|
89
112
|
agent: input.agent,
|
|
90
113
|
availableToolNames: input.availableToolNames,
|
|
91
|
-
});
|
|
92
|
-
if (requestedToolNames.length === 0 || !input.token) {
|
|
114
|
+
}).concat(veryfrontApiMcpPolicy.requestedToolNames);
|
|
115
|
+
if ((!veryfrontApiMcpPolicy.allowAll && requestedToolNames.length === 0) || !input.token) {
|
|
93
116
|
return input.agent;
|
|
94
117
|
}
|
|
95
118
|
const apiUrl = getHostEnv("VERYFRONT_API_URL") ?? "https://api.veryfront.com";
|
|
@@ -114,24 +137,26 @@ async function withVeryfrontPlatformRemoteTools(input) {
|
|
|
114
137
|
? new Set(platformToolDefinitions.map((tool) => tool.name))
|
|
115
138
|
: null;
|
|
116
139
|
const requestedPlatformToolNames = platformToolNames
|
|
117
|
-
? requestedToolNames.filter((toolName) => platformToolNames.has(toolName))
|
|
118
|
-
: requestedToolNames;
|
|
140
|
+
? (veryfrontApiMcpPolicy.allowAll ? [...platformToolNames] : requestedToolNames).filter((toolName) => platformToolNames.has(toolName) && !veryfrontApiMcpPolicy.deniedToolNames.has(toolName))
|
|
141
|
+
: requestedToolNames.filter((toolName) => !veryfrontApiMcpPolicy.deniedToolNames.has(toolName));
|
|
119
142
|
if (requestedPlatformToolNames.length === 0) {
|
|
120
143
|
return input.agent;
|
|
121
144
|
}
|
|
122
|
-
const
|
|
145
|
+
const runtimeRemoteToolConfig = input.agent.config;
|
|
146
|
+
const remoteTools = runtimeRemoteToolConfig.__vfRemoteToolSources ?? [];
|
|
123
147
|
const platformRemoteToolSources = hasVeryfrontPlatformRemoteToolSource(remoteTools) ? [] : [
|
|
124
148
|
platformToolDefinitions
|
|
125
149
|
? createStaticRemoteToolSource(platformRemoteToolSource, platformToolDefinitions)
|
|
126
150
|
: platformRemoteToolSource,
|
|
127
151
|
];
|
|
152
|
+
const runtimeConfig = {
|
|
153
|
+
...input.agent.config,
|
|
154
|
+
__vfAllowedRemoteTools: mergeAllowedRemoteTools(runtimeRemoteToolConfig.__vfAllowedRemoteTools, requestedPlatformToolNames),
|
|
155
|
+
__vfRemoteToolSources: [...remoteTools, ...platformRemoteToolSources],
|
|
156
|
+
};
|
|
128
157
|
return {
|
|
129
158
|
...input.agent,
|
|
130
|
-
config:
|
|
131
|
-
...input.agent.config,
|
|
132
|
-
allowedRemoteTools: mergeAllowedRemoteTools(input.agent.config.allowedRemoteTools, requestedPlatformToolNames),
|
|
133
|
-
remoteTools: [...remoteTools, ...platformRemoteToolSources],
|
|
134
|
-
},
|
|
159
|
+
config: runtimeConfig,
|
|
135
160
|
};
|
|
136
161
|
}
|
|
137
162
|
function buildAgentStreamEnv(input) {
|
|
@@ -10,7 +10,7 @@ import type { Skill } from "./types.js";
|
|
|
10
10
|
* Build the skill manifest prompt section for an agent's system prompt.
|
|
11
11
|
*
|
|
12
12
|
* Lists all available skills with their descriptions and instructions
|
|
13
|
-
* on how to use the skill tools (
|
|
13
|
+
* on how to use the skill tools (load_skill, load_skill_reference, execute_skill_script).
|
|
14
14
|
*
|
|
15
15
|
* @param skills - Map of resolved skills for the agent
|
|
16
16
|
* @returns Prompt section string, or empty string if no skills
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* Build the skill manifest prompt section for an agent's system prompt.
|
|
10
10
|
*
|
|
11
11
|
* Lists all available skills with their descriptions and instructions
|
|
12
|
-
* on how to use the skill tools (
|
|
12
|
+
* on how to use the skill tools (load_skill, load_skill_reference, execute_skill_script).
|
|
13
13
|
*
|
|
14
14
|
* @param skills - Map of resolved skills for the agent
|
|
15
15
|
* @returns Prompt section string, or empty string if no skills
|
|
@@ -20,7 +20,7 @@ export function buildSkillManifestPrompt(skills) {
|
|
|
20
20
|
const lines = [
|
|
21
21
|
"## Available Skills",
|
|
22
22
|
"",
|
|
23
|
-
"You have access to skills via tool calling. IMPORTANT: You MUST call the
|
|
23
|
+
"You have access to skills via tool calling. IMPORTANT: You MUST call the load_skill tool (not write it as text) to activate a skill before performing skill-related tasks.",
|
|
24
24
|
"",
|
|
25
25
|
];
|
|
26
26
|
for (const [id, skill] of skills) {
|
|
@@ -29,8 +29,8 @@ export function buildSkillManifestPrompt(skills) {
|
|
|
29
29
|
lines.push("");
|
|
30
30
|
lines.push("### Skill Tools (call these as tools, never write them as text)");
|
|
31
31
|
lines.push("");
|
|
32
|
-
lines.push("-
|
|
33
|
-
lines.push("-
|
|
34
|
-
lines.push("-
|
|
32
|
+
lines.push("- load_skill: Call with { skillId } to load a skill's full instructions and available references/resources/scripts");
|
|
33
|
+
lines.push("- load_skill_reference: Call with { skillId, reference } to read a file from the skill's references/, resources/, or assets/ directory");
|
|
34
|
+
lines.push("- execute_skill_script: Call with { skillId, script, args?, env?, timeoutMs? } to execute a script");
|
|
35
35
|
return lines.join("\n");
|
|
36
36
|
}
|
package/esm/src/skill/tools.d.ts
CHANGED
|
@@ -2,25 +2,25 @@
|
|
|
2
2
|
* Skill Tools
|
|
3
3
|
*
|
|
4
4
|
* Three tools exposed to agents for interacting with skills:
|
|
5
|
-
* -
|
|
6
|
-
* -
|
|
7
|
-
* -
|
|
5
|
+
* - load_skill: Load a skill's full instructions
|
|
6
|
+
* - load_skill_reference: Read a reference file from a skill
|
|
7
|
+
* - execute_skill_script: Execute a script from a skill
|
|
8
8
|
*
|
|
9
9
|
* @module
|
|
10
10
|
*/
|
|
11
11
|
import type { Tool } from "../tool/index.js";
|
|
12
12
|
/**
|
|
13
|
-
* Create the
|
|
13
|
+
* Create the load_skill tool.
|
|
14
14
|
* Loads a skill's full instructions, available references, and scripts.
|
|
15
15
|
*/
|
|
16
16
|
export declare function createLoadSkillTool(): Tool;
|
|
17
17
|
/**
|
|
18
|
-
* Create the
|
|
18
|
+
* Create the load_skill_reference tool.
|
|
19
19
|
* Reads a reference file from a skill's references/, resources/, or assets/ directory.
|
|
20
20
|
*/
|
|
21
21
|
export declare function createLoadSkillReferenceTool(): Tool;
|
|
22
22
|
/**
|
|
23
|
-
* Create the
|
|
23
|
+
* Create the execute_skill_script tool.
|
|
24
24
|
* Executes a script from a skill's scripts/ directory.
|
|
25
25
|
*/
|
|
26
26
|
export declare function createExecuteSkillScriptTool(): Tool;
|
package/esm/src/skill/tools.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* Skill Tools
|
|
3
3
|
*
|
|
4
4
|
* Three tools exposed to agents for interacting with skills:
|
|
5
|
-
* -
|
|
6
|
-
* -
|
|
7
|
-
* -
|
|
5
|
+
* - load_skill: Load a skill's full instructions
|
|
6
|
+
* - load_skill_reference: Read a reference file from a skill
|
|
7
|
+
* - execute_skill_script: Execute a script from a skill
|
|
8
8
|
*
|
|
9
9
|
* @module
|
|
10
10
|
*/
|
|
@@ -52,23 +52,23 @@ async function readSkillFile(skill, path) {
|
|
|
52
52
|
}
|
|
53
53
|
function buildSkillAvailabilityNote(references, scripts) {
|
|
54
54
|
if (scripts.length === 0 && references.length === 0) {
|
|
55
|
-
return "This skill has no scripts or reference files. Do NOT call
|
|
55
|
+
return "This skill has no scripts or reference files. Do NOT call execute_skill_script or load_skill_reference.";
|
|
56
56
|
}
|
|
57
57
|
if (scripts.length === 0) {
|
|
58
|
-
return "This skill has no scripts. Do NOT call
|
|
58
|
+
return "This skill has no scripts. Do NOT call execute_skill_script.";
|
|
59
59
|
}
|
|
60
60
|
if (references.length === 0) {
|
|
61
|
-
return "This skill has no reference files. Do NOT call
|
|
61
|
+
return "This skill has no reference files. Do NOT call load_skill_reference.";
|
|
62
62
|
}
|
|
63
63
|
return undefined;
|
|
64
64
|
}
|
|
65
65
|
/**
|
|
66
|
-
* Create the
|
|
66
|
+
* Create the load_skill tool.
|
|
67
67
|
* Loads a skill's full instructions, available references, and scripts.
|
|
68
68
|
*/
|
|
69
69
|
export function createLoadSkillTool() {
|
|
70
70
|
return tool({
|
|
71
|
-
id: "
|
|
71
|
+
id: "load_skill",
|
|
72
72
|
description: "Load a skill's full instructions. Returns the skill's markdown instructions, " +
|
|
73
73
|
"allowed tools policy, and lists of available reference files and scripts.",
|
|
74
74
|
inputSchema: getLoadSkillInputSchema(),
|
|
@@ -86,7 +86,7 @@ export function createLoadSkillTool() {
|
|
|
86
86
|
const content = await readSkillFile(skill, skillMdPath);
|
|
87
87
|
// Parse frontmatter to get instructions
|
|
88
88
|
const parsed = await parseSkillFrontmatter(content);
|
|
89
|
-
// List available files the agent can load through
|
|
89
|
+
// List available files the agent can load through load_skill_reference.
|
|
90
90
|
const [references, resources, scripts] = await Promise.all([
|
|
91
91
|
listSkillSubdir(skill.rootPath, SKILL_REFERENCES_DIR, skill.fsAdapter),
|
|
92
92
|
listSkillSubdir(skill.rootPath, SKILL_RESOURCES_DIR, skill.fsAdapter),
|
|
@@ -105,12 +105,12 @@ export function createLoadSkillTool() {
|
|
|
105
105
|
});
|
|
106
106
|
}
|
|
107
107
|
/**
|
|
108
|
-
* Create the
|
|
108
|
+
* Create the load_skill_reference tool.
|
|
109
109
|
* Reads a reference file from a skill's references/, resources/, or assets/ directory.
|
|
110
110
|
*/
|
|
111
111
|
export function createLoadSkillReferenceTool() {
|
|
112
112
|
return tool({
|
|
113
|
-
id: "
|
|
113
|
+
id: "load_skill_reference",
|
|
114
114
|
description: "Read a reference file from a skill. Only files in the skill's " +
|
|
115
115
|
"references/, resources/, and assets/ directories are accessible.",
|
|
116
116
|
inputSchema: getLoadSkillReferenceInputSchema(),
|
|
@@ -130,12 +130,12 @@ export function createLoadSkillReferenceTool() {
|
|
|
130
130
|
});
|
|
131
131
|
}
|
|
132
132
|
/**
|
|
133
|
-
* Create the
|
|
133
|
+
* Create the execute_skill_script tool.
|
|
134
134
|
* Executes a script from a skill's scripts/ directory.
|
|
135
135
|
*/
|
|
136
136
|
export function createExecuteSkillScriptTool() {
|
|
137
137
|
return tool({
|
|
138
|
-
id: "
|
|
138
|
+
id: "execute_skill_script",
|
|
139
139
|
description: "Execute a script from a skill's scripts/ directory. Returns stdout, stderr, and exit code.",
|
|
140
140
|
inputSchema: getExecuteSkillScriptInputSchema(),
|
|
141
141
|
execute: async (input) => {
|
package/esm/src/skill/types.d.ts
CHANGED
|
@@ -37,7 +37,7 @@ export interface SkillMetadata {
|
|
|
37
37
|
/** Arbitrary key-value metadata */
|
|
38
38
|
metadata?: Record<string, string>;
|
|
39
39
|
}
|
|
40
|
-
/** Full skill content returned by
|
|
40
|
+
/** Full skill content returned by load_skill tool */
|
|
41
41
|
export interface SkillContent {
|
|
42
42
|
/** Markdown instructions (body after frontmatter) */
|
|
43
43
|
instructions: string;
|
package/esm/src/skill/types.js
CHANGED
|
@@ -17,9 +17,9 @@ export const SKILL_DESCRIPTION_MAX_LENGTH = 1024;
|
|
|
17
17
|
export const SKILL_MD_FILENAME = "SKILL.md";
|
|
18
18
|
/** Tool IDs that belong to the skill system (single source of truth) */
|
|
19
19
|
export const SKILL_TOOL_IDS = new Set([
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
20
|
+
"load_skill",
|
|
21
|
+
"load_skill_reference",
|
|
22
|
+
"execute_skill_script",
|
|
23
23
|
]);
|
|
24
24
|
/** Conventional subdirectory names */
|
|
25
25
|
export const SKILL_SCRIPTS_DIR = "scripts";
|