veryfront 0.1.645 → 0.1.647
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/ag-ui/handler.d.ts.map +1 -1
- package/esm/src/agent/ag-ui/handler.js +11 -2
- package/esm/src/agent/ag-ui/host-support.d.ts +4 -1
- package/esm/src/agent/ag-ui/host-support.d.ts.map +1 -1
- package/esm/src/agent/ag-ui/host-support.js +84 -17
- package/esm/src/agent/factory.js +7 -7
- package/esm/src/agent/hosted/chat-request.d.ts.map +1 -1
- package/esm/src/agent/hosted/chat-request.js +13 -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/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
|
@@ -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 {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message-parts.d.ts","sourceRoot":"","sources":["../../../../../../../src/src/react/components/chat/chat/utils/message-parts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACV,mBAAmB,EACnB,WAAW,EACX,eAAe,EACf,YAAY,EACb,MAAM,qCAAqC,CAAC;AAC7C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAEvD,+CAA+C;AAC/C,wBAAgB,cAAc,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,CAQ3D;AAED,qCAAqC;AACrC,wBAAgB,UAAU,CAAC,IAAI,EAAE,eAAe,GAAG,IAAI,IAAI,YAAY,GAAG,mBAAmB,CAG5F;AAQD,
|
|
1
|
+
{"version":3,"file":"message-parts.d.ts","sourceRoot":"","sources":["../../../../../../../src/src/react/components/chat/chat/utils/message-parts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACV,mBAAmB,EACnB,WAAW,EACX,eAAe,EACf,YAAY,EACb,MAAM,qCAAqC,CAAC;AAC7C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAEvD,+CAA+C;AAC/C,wBAAgB,cAAc,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,CAQ3D;AAED,qCAAqC;AACrC,wBAAgB,UAAU,CAAC,IAAI,EAAE,eAAe,GAAG,IAAI,IAAI,YAAY,GAAG,mBAAmB,CAG5F;AAQD,oDAAoD;AACpD,wBAAgB,eAAe,CAAC,IAAI,EAAE,YAAY,GAAG,mBAAmB,GAAG,OAAO,CAEjF;AAED,0CAA0C;AAC1C,wBAAgB,eAAe,CAC7B,IAAI,EAAE,eAAe,GACpB,IAAI,IAAI;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,WAAW,GAAG,MAAM,CAAA;CAAE,CAE3E;AAED;;GAEG;AACH,MAAM,MAAM,SAAS,GACjB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACjC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,YAAY,GAAG,mBAAmB,CAAA;CAAE,GAC1D;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,OAAO,CAAA;CAAE,GACzD;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,OAAO,CAAA;CAAE,CAAC;AAE7D;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,eAAe,EAAE,GAAG,SAAS,EAAE,CAkDvE;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,eAAe,EAAE,GAAG,MAAM,EAAE,CAiC1E"}
|
|
@@ -18,11 +18,11 @@ export function isToolPart(part) {
|
|
|
18
18
|
return part.type.startsWith("tool-") && part.type !== "tool-result";
|
|
19
19
|
}
|
|
20
20
|
const SKILL_TOOL_NAMES = new Set([
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
21
|
+
"load_skill",
|
|
22
|
+
"load_skill_reference",
|
|
23
|
+
"execute_skill_script",
|
|
24
24
|
]);
|
|
25
|
-
/** Check if a tool part is a skill-related tool
|
|
25
|
+
/** Check if a tool part is a skill-related tool. */
|
|
26
26
|
export function isSkillToolPart(tool) {
|
|
27
27
|
return SKILL_TOOL_NAMES.has(tool.toolName);
|
|
28
28
|
}
|
|
@@ -2934,9 +2934,8 @@ export const FRAMEWORK_CANDIDATES = [
|
|
|
2934
2934
|
"etc.,",
|
|
2935
2935
|
"event:",
|
|
2936
2936
|
"event?.preventDefault()}",
|
|
2937
|
-
"
|
|
2938
|
-
"
|
|
2939
|
-
"execute-skill-script).",
|
|
2937
|
+
"execute_skill_script",
|
|
2938
|
+
"execute_skill_script).",
|
|
2940
2939
|
"exist",
|
|
2941
2940
|
"expected:",
|
|
2942
2941
|
"export",
|
|
@@ -3607,16 +3606,16 @@ export const FRAMEWORK_CANDIDATES = [
|
|
|
3607
3606
|
"listboxId",
|
|
3608
3607
|
"load():",
|
|
3609
3608
|
"load();",
|
|
3610
|
-
"load-skill",
|
|
3611
|
-
"load-skill,",
|
|
3612
|
-
"load-skill-reference",
|
|
3613
|
-
"load-skill-reference,",
|
|
3614
3609
|
"loadIndex(key:",
|
|
3615
3610
|
"loadIndex(storageKey);",
|
|
3616
3611
|
"loadMermaid():",
|
|
3617
3612
|
"loadMermaid();",
|
|
3618
3613
|
"loadThread(key:",
|
|
3619
3614
|
"loadThread(storageKey,",
|
|
3615
|
+
"load_skill",
|
|
3616
|
+
"load_skill,",
|
|
3617
|
+
"load_skill_reference",
|
|
3618
|
+
"load_skill_reference,",
|
|
3620
3619
|
"loaded.length",
|
|
3621
3620
|
"loaded.push(thread);",
|
|
3622
3621
|
"loaded.sort((a,",
|
|
@@ -5338,6 +5337,7 @@ export const FRAMEWORK_CANDIDATES = [
|
|
|
5338
5337
|
"tool-primitives.tsx",
|
|
5339
5338
|
"tool-result",
|
|
5340
5339
|
"tool-search",
|
|
5340
|
+
"tool.",
|
|
5341
5341
|
"tool.error",
|
|
5342
5342
|
"tool.errorText}",
|
|
5343
5343
|
"tool.error}",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-stream.handler.d.ts","sourceRoot":"","sources":["../../../../../src/src/server/handlers/request/agent-stream.handler.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AACpF,OAAO,EAEL,KAAK,+BAA+B,EACrC,MAAM,wCAAwC,CAAC;
|
|
1
|
+
{"version":3,"file":"agent-stream.handler.d.ts","sourceRoot":"","sources":["../../../../../src/src/server/handlers/request/agent-stream.handler.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AACpF,OAAO,EAEL,KAAK,+BAA+B,EACrC,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EACL,4BAA4B,EAE7B,MAAM,2CAA2C,CAAC;AAwBnD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAmB,aAAa,EAAE,MAAM,aAAa,CAAC;AAUnG,MAAM,WAAW,sBACf,SAAQ,yBAAyB,EAAE,+BAA+B;IAClE,4BAA4B,CAAC,EAAE,OAAO,4BAA4B,CAAC;CACpE;AA2SD,qBAAa,kBAAmB,SAAQ,WAAW;IASrC,OAAO,CAAC,QAAQ,CAAC,IAAI;IARjC,QAAQ,EAAE,eAAe,CAMvB;gBAE2B,IAAI,GAAE,sBAAoC;IAIvE,OAAO,CAAC,sBAAsB;IAwBxB,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;CAiKxE"}
|
|
@@ -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";
|