veryfront 0.1.1213 → 0.1.1215
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/conversation/delegation-policy.d.ts +1 -3
- package/esm/src/agent/conversation/delegation-policy.d.ts.map +1 -1
- package/esm/src/agent/conversation/delegation-policy.js +1 -3
- package/esm/src/agent/index.d.ts +1 -1
- package/esm/src/agent/index.d.ts.map +1 -1
- package/esm/src/agent/index.js +1 -1
- package/esm/src/agent/runtime/agent-loop-skill-state.d.ts +10 -12
- package/esm/src/agent/runtime/agent-loop-skill-state.d.ts.map +1 -1
- package/esm/src/agent/runtime/agent-loop-skill-state.js +11 -17
- package/esm/src/agent/runtime/agent-runtime-step.d.ts +0 -1
- package/esm/src/agent/runtime/agent-runtime-step.d.ts.map +1 -1
- package/esm/src/agent/runtime/agent-runtime-step.js +2 -2
- 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 +7 -13
- package/esm/src/agent/runtime/load-skill-tool.d.ts +2 -2
- package/esm/src/agent/runtime/load-skill-tool.d.ts.map +1 -1
- package/esm/src/agent/runtime/load-skill-tool.js +12 -68
- package/esm/src/agent/runtime/project-skill-catalog.d.ts.map +1 -1
- package/esm/src/agent/runtime/project-skill-catalog.js +1 -6
- package/esm/src/agent/runtime/skill-metadata.d.ts +4 -18
- package/esm/src/agent/runtime/skill-metadata.d.ts.map +1 -1
- package/esm/src/agent/runtime/skill-metadata.js +17 -78
- package/esm/src/agent/runtime/skill-policy-enforcement.d.ts +1 -5
- package/esm/src/agent/runtime/skill-policy-enforcement.d.ts.map +1 -1
- package/esm/src/agent/runtime/skill-policy-enforcement.js +12 -55
- package/esm/src/agent/runtime/skill-prompt.d.ts +2 -2
- package/esm/src/agent/runtime/skill-prompt.d.ts.map +1 -1
- package/esm/src/agent/runtime/skill-prompt.js +8 -44
- package/esm/src/html/hydration-script-builder/hydration-runtime.generated.js +1 -1
- package/esm/src/platform/adapters/index.d.ts +25 -0
- package/esm/src/platform/adapters/index.d.ts.map +1 -0
- package/esm/src/platform/adapters/index.js +23 -0
- package/esm/src/platform/adapters/security/index.d.ts +8 -0
- package/esm/src/platform/adapters/security/index.d.ts.map +1 -0
- package/esm/src/platform/adapters/security/index.js +7 -0
- package/esm/src/platform/adapters/token/factory.d.ts +10 -0
- package/esm/src/platform/adapters/token/factory.d.ts.map +1 -0
- package/esm/src/platform/adapters/token/factory.js +79 -0
- package/esm/src/platform/adapters/token/index.d.ts +9 -0
- package/esm/src/platform/adapters/token/index.d.ts.map +1 -0
- package/esm/src/platform/adapters/token/index.js +8 -0
- package/esm/src/platform/adapters/token/integration.d.ts +6 -0
- package/esm/src/platform/adapters/token/integration.d.ts.map +1 -0
- package/esm/src/platform/adapters/token/integration.js +61 -0
- package/esm/src/platform/adapters/token/veryfront/adapter.d.ts +22 -0
- package/esm/src/platform/adapters/token/veryfront/adapter.d.ts.map +1 -0
- package/esm/src/platform/adapters/token/veryfront/adapter.js +88 -0
- package/esm/src/platform/adapters/token/veryfront/api-client.d.ts +15 -0
- package/esm/src/platform/adapters/token/veryfront/api-client.d.ts.map +1 -0
- package/esm/src/platform/adapters/token/veryfront/api-client.js +212 -0
- package/esm/src/platform/adapters/token/veryfront/index.d.ts +10 -0
- package/esm/src/platform/adapters/token/veryfront/index.d.ts.map +1 -0
- package/esm/src/platform/adapters/token/veryfront/index.js +9 -0
- package/esm/src/platform/adapters/token/veryfront/memory-adapter.d.ts +20 -0
- package/esm/src/platform/adapters/token/veryfront/memory-adapter.d.ts.map +1 -0
- package/esm/src/platform/adapters/token/veryfront/memory-adapter.js +52 -0
- package/esm/src/platform/adapters/token/veryfront/types.d.ts +86 -0
- package/esm/src/platform/adapters/token/veryfront/types.d.ts.map +1 -0
- package/esm/src/platform/adapters/token/veryfront/types.js +81 -0
- package/esm/src/platform/compat/http/pinned-fetch.d.ts +1 -1
- package/esm/src/proxy/handler.d.ts.map +1 -1
- package/esm/src/proxy/handler.js +17 -1
- package/esm/src/security/http/auth.d.ts.map +1 -1
- package/esm/src/security/http/auth.js +7 -0
- package/esm/src/security/http/config.d.ts +5 -0
- package/esm/src/security/http/config.d.ts.map +1 -1
- package/esm/src/security/http/config.js +16 -1
- package/esm/src/security/http/csp-report-endpoint.d.ts +29 -0
- package/esm/src/security/http/csp-report-endpoint.d.ts.map +1 -0
- package/esm/src/security/http/csp-report-endpoint.js +30 -0
- package/esm/src/security/http/csrf/csrf-handler.d.ts.map +1 -1
- package/esm/src/security/http/csrf/csrf-handler.js +6 -0
- package/esm/src/security/http/derived-csp-cache.d.ts +33 -0
- package/esm/src/security/http/derived-csp-cache.d.ts.map +1 -0
- package/esm/src/security/http/derived-csp-cache.js +101 -0
- package/esm/src/security/http/derived-csp-origins.d.ts +54 -0
- package/esm/src/security/http/derived-csp-origins.d.ts.map +1 -0
- package/esm/src/security/http/derived-csp-origins.js +156 -0
- package/esm/src/security/http/response/security-handler.d.ts +1 -2
- package/esm/src/security/http/response/security-handler.d.ts.map +1 -1
- package/esm/src/security/http/response/security-handler.js +25 -9
- package/esm/src/security/sandbox/constants.d.ts +3 -0
- package/esm/src/security/sandbox/constants.d.ts.map +1 -0
- package/esm/src/security/sandbox/constants.js +2 -0
- package/esm/src/security/sandbox/deno-sandbox.d.ts +71 -0
- package/esm/src/security/sandbox/deno-sandbox.d.ts.map +1 -0
- package/esm/src/security/sandbox/deno-sandbox.js +184 -0
- package/esm/src/security/sandbox/permission-system.d.ts +11 -0
- package/esm/src/security/sandbox/permission-system.d.ts.map +1 -0
- package/esm/src/security/sandbox/permission-system.js +85 -0
- package/esm/src/server/handlers/request/csp-report.handler.d.ts +56 -0
- package/esm/src/server/handlers/request/csp-report.handler.d.ts.map +1 -0
- package/esm/src/server/handlers/request/csp-report.handler.js +189 -0
- package/esm/src/server/runtime-handler/index.d.ts +1 -1
- package/esm/src/server/runtime-handler/index.d.ts.map +1 -1
- package/esm/src/server/runtime-handler/index.js +3 -0
- package/esm/src/server/runtime-handler/project-runtime-context.d.ts.map +1 -1
- package/esm/src/server/runtime-handler/project-runtime-context.js +97 -1
- package/esm/src/server/utils/domain-parser.d.ts +9 -0
- package/esm/src/server/utils/domain-parser.d.ts.map +1 -1
- package/esm/src/server/utils/domain-parser.js +11 -0
- package/esm/src/skill/allowed-tools.d.ts +18 -42
- package/esm/src/skill/allowed-tools.d.ts.map +1 -1
- package/esm/src/skill/allowed-tools.js +31 -182
- package/esm/src/skill/index.d.ts +1 -1
- package/esm/src/skill/index.d.ts.map +1 -1
- package/esm/src/skill/index.js +2 -2
- package/esm/src/skill/parser.d.ts.map +1 -1
- package/esm/src/skill/parser.js +6 -37
- package/esm/src/skill/tools.d.ts.map +1 -1
- package/esm/src/skill/tools.js +2 -3
- package/esm/src/skill/types.d.ts +1 -3
- package/esm/src/skill/types.d.ts.map +1 -1
- package/esm/src/skill/validation.d.ts.map +1 -1
- package/esm/src/skill/validation.js +31 -3
- package/esm/src/types/server.d.ts +10 -0
- package/esm/src/types/server.d.ts.map +1 -1
- package/esm/src/utils/cors-policy-limits.d.ts +9 -2
- package/esm/src/utils/cors-policy-limits.d.ts.map +1 -1
- package/esm/src/utils/cors-policy-limits.js +8 -1
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/esm/src/workflow/api.d.ts +2 -2
- package/package.json +8 -8
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { defineSchema, lazySchema } from "../../schemas/index.js";
|
|
2
2
|
import { INPUT_VALIDATION_FAILED } from "../../errors/index.js";
|
|
3
|
-
import { matchesAllowedTool } from "../../skill/allowed-tools.js";
|
|
4
3
|
import { zodToJsonSchema } from "../../tool/schema/zod-json-schema.js";
|
|
5
|
-
import { LOAD_SKILL_CONTINUE_SAME_TURN, LOAD_SKILL_DELEGATION_THRESHOLD, LOAD_SKILL_OVERRIDE_FORWARDING, LOAD_SKILL_ROOT_OWNERSHIP,
|
|
4
|
+
import { LOAD_SKILL_CONTINUE_SAME_TURN, LOAD_SKILL_DELEGATION_THRESHOLD, LOAD_SKILL_OVERRIDE_FORWARDING, LOAD_SKILL_ROOT_OWNERSHIP, } from "../conversation/delegation-policy.js";
|
|
6
5
|
import { listRuntimeBuiltinSkillReferencesWithinLimit, readRuntimeBuiltinSkillReferenceWithinLimit, readRuntimeBuiltinSkillWithinLimit, } from "./builtin-skill-files.js";
|
|
7
6
|
import { createSkillOperationBudget, } from "../../skill/operation-budget.js";
|
|
8
7
|
import { SKILL_ALLOWED_TOOL_MAX_PATTERNS, SKILL_ALLOWED_TOOL_PATTERN_MAX_LENGTH, SKILL_DOCUMENT_MAX_CHARACTERS, SKILL_FILE_OPERATION_TIMEOUT_MS, SKILL_ID_MAX_LENGTH, SKILL_LOADABLE_REFERENCE_MAX_ENTRIES, SKILL_RELATIVE_PATH_MAX_LENGTH, SKILL_RUNTIME_AVAILABLE_TOOL_MAX_ENTRIES, SKILL_RUNTIME_LOADED_REFERENCE_CACHE_MAX_ENTRIES, SKILL_RUNTIME_LOADED_SKILL_CACHE_MAX_ENTRIES, } from "../../skill/limits.js";
|
|
@@ -23,13 +22,10 @@ function isRuntimeLoadSkillArray(value) {
|
|
|
23
22
|
}
|
|
24
23
|
}
|
|
25
24
|
/** Fail-closed continuation note used when no delegation tool is known available. */
|
|
26
|
-
export const RUNTIME_LOAD_SKILL_CONTINUATION_NOTE = `IMPORTANT: load_skill only loads instructions. It does not perform the task or finish the turn. ${LOAD_SKILL_CONTINUE_SAME_TURN} ${LOAD_SKILL_ROOT_OWNERSHIP}
|
|
25
|
+
export const RUNTIME_LOAD_SKILL_CONTINUATION_NOTE = `IMPORTANT: load_skill only loads instructions. It does not perform the task or finish the turn. ${LOAD_SKILL_CONTINUE_SAME_TURN} ${LOAD_SKILL_ROOT_OWNERSHIP}`;
|
|
27
26
|
/** Shared runtime load skill description value. */
|
|
28
|
-
export const RUNTIME_LOAD_SKILL_DESCRIPTION = `Load the full instructions for a skill. Use this when you need detailed guidance for a specific task type.
|
|
27
|
+
export const RUNTIME_LOAD_SKILL_DESCRIPTION = `Load the full instructions for a skill. Use this when you need detailed guidance for a specific task type. load_skill does not perform the task by itself. ${LOAD_SKILL_CONTINUE_SAME_TURN} ${LOAD_SKILL_ROOT_OWNERSHIP} ${LOAD_SKILL_DELEGATION_THRESHOLD} First call load_skill with only skillId. Use the optional \`file\` parameter only after the skill is loaded and only for a reference file listed by that loaded skill.`;
|
|
29
28
|
const DEFAULT_RUNTIME_LOAD_SKILL_RESPONSE_MESSAGES = {
|
|
30
|
-
allowedToolsNote: "IMPORTANT: While following this skill, you MUST only use the tools listed in allowedTools.",
|
|
31
|
-
noCurrentRunToolsNote: "IMPORTANT: While following this skill, no direct-execution tools from this skill are available in the current run. allowedTools is intentionally empty; do not attempt direct tool execution in this run.",
|
|
32
|
-
unavailableCurrentRunToolsDelegationNote: "IMPORTANT: Some tools required by this skill are not available in the current run. Use an available scoped agent_<id> delegation tool for the isolated work, or invoke_agent only when that exact legacy tool is present.",
|
|
33
29
|
overrideNote: LOAD_SKILL_OVERRIDE_FORWARDING,
|
|
34
30
|
referenceNote: "After this skill is loaded, use load_skill with the `file` parameter only for one of these listed reference files.",
|
|
35
31
|
};
|
|
@@ -40,15 +36,15 @@ function getAvailableScopedDelegateToolNames(availableToolNames) {
|
|
|
40
36
|
}
|
|
41
37
|
function buildRuntimeLoadSkillDelegationAdvice(availableToolNames) {
|
|
42
38
|
if (availableToolNames === undefined) {
|
|
43
|
-
return `For multi-step or isolated work, call invoke_agent; otherwise keep working directly with the
|
|
39
|
+
return `For multi-step or isolated work, call invoke_agent; otherwise keep working directly with the available tools. ${LOAD_SKILL_DELEGATION_THRESHOLD} ${LOAD_SKILL_OVERRIDE_FORWARDING}`;
|
|
44
40
|
}
|
|
45
41
|
const scopedDelegateToolNames = getAvailableScopedDelegateToolNames(availableToolNames);
|
|
46
42
|
if (scopedDelegateToolNames.length > 0) {
|
|
47
43
|
const tools = scopedDelegateToolNames.map((toolName) => `\`${toolName}\``).join(", ");
|
|
48
|
-
return `For multi-step or isolated work, use only these available scoped delegation tools: ${tools}; otherwise keep working directly with the
|
|
44
|
+
return `For multi-step or isolated work, use only these available scoped delegation tools: ${tools}; otherwise keep working directly with the available tools. ${LOAD_SKILL_DELEGATION_THRESHOLD}`;
|
|
49
45
|
}
|
|
50
46
|
if (availableToolNames.includes("invoke_agent")) {
|
|
51
|
-
return `For multi-step or isolated work, call the available legacy invoke_agent tool; otherwise keep working directly with the
|
|
47
|
+
return `For multi-step or isolated work, call the available legacy invoke_agent tool; otherwise keep working directly with the available tools. ${LOAD_SKILL_DELEGATION_THRESHOLD} ${LOAD_SKILL_OVERRIDE_FORWARDING}`;
|
|
52
48
|
}
|
|
53
49
|
return "";
|
|
54
50
|
}
|
|
@@ -59,31 +55,8 @@ function buildRuntimeLoadSkillContinuationNote(availableToolNames) {
|
|
|
59
55
|
LOAD_SKILL_CONTINUE_SAME_TURN,
|
|
60
56
|
LOAD_SKILL_ROOT_OWNERSHIP,
|
|
61
57
|
delegationAdvice,
|
|
62
|
-
LOAD_SKILL_TOOL_INTERSECTION,
|
|
63
58
|
].filter((part) => part.length > 0).join(" ");
|
|
64
59
|
}
|
|
65
|
-
function buildUnavailableCurrentRunToolsDelegationNote(availableToolNames) {
|
|
66
|
-
if (availableToolNames === undefined) {
|
|
67
|
-
return DEFAULT_RUNTIME_LOAD_SKILL_RESPONSE_MESSAGES.unavailableCurrentRunToolsDelegationNote;
|
|
68
|
-
}
|
|
69
|
-
const scopedDelegateToolNames = getAvailableScopedDelegateToolNames(availableToolNames);
|
|
70
|
-
if (scopedDelegateToolNames.length > 0) {
|
|
71
|
-
const tools = scopedDelegateToolNames.map((toolName) => `\`${toolName}\``).join(", ");
|
|
72
|
-
return `IMPORTANT: Some tools required by this skill are not available in the current run. Use only these available scoped delegation tools for isolated work: ${tools}.`;
|
|
73
|
-
}
|
|
74
|
-
if (availableToolNames.includes("invoke_agent")) {
|
|
75
|
-
return "IMPORTANT: Some tools required by this skill are not available in the current run. Use the available legacy invoke_agent tool for isolated work.";
|
|
76
|
-
}
|
|
77
|
-
return "";
|
|
78
|
-
}
|
|
79
|
-
function getEffectiveAvailableToolNames(response, availableToolNames) {
|
|
80
|
-
const allowedTools = response.allowedTools;
|
|
81
|
-
if (availableToolNames === undefined)
|
|
82
|
-
return [];
|
|
83
|
-
if (allowedTools === undefined)
|
|
84
|
-
return [...availableToolNames];
|
|
85
|
-
return availableToolNames.filter((toolName) => allowedTools.some((pattern) => matchesAllowedTool(toolName, pattern)));
|
|
86
|
-
}
|
|
87
60
|
function rememberBoundedRecordValue(record, key, value, maxEntries) {
|
|
88
61
|
const keys = Object.keys(record);
|
|
89
62
|
const keyIsEnumerable = keys.includes(key);
|
|
@@ -246,19 +219,10 @@ function snapshotRuntimeLoadSkillAvailableToolNames(value) {
|
|
|
246
219
|
},
|
|
247
220
|
});
|
|
248
221
|
}
|
|
249
|
-
function snapshotRuntimeLoadSkillResponseMessages(messages
|
|
222
|
+
function snapshotRuntimeLoadSkillResponseMessages(messages) {
|
|
250
223
|
if (messages !== undefined && (!messages || typeof messages !== "object")) {
|
|
251
224
|
throw new TypeError("Runtime load skill messages must be an object");
|
|
252
225
|
}
|
|
253
|
-
const allowedToolsNote = messages === undefined
|
|
254
|
-
? undefined
|
|
255
|
-
: readRuntimeLoadSkillDataProperty(messages, "allowedToolsNote", "Runtime load skill messages");
|
|
256
|
-
const noCurrentRunToolsNote = messages === undefined
|
|
257
|
-
? undefined
|
|
258
|
-
: readRuntimeLoadSkillDataProperty(messages, "noCurrentRunToolsNote", "Runtime load skill messages");
|
|
259
|
-
const configuredDelegationNote = messages === undefined
|
|
260
|
-
? undefined
|
|
261
|
-
: readRuntimeLoadSkillDataProperty(messages, "unavailableCurrentRunToolsDelegationNote", "Runtime load skill messages");
|
|
262
226
|
const overrideNote = messages === undefined
|
|
263
227
|
? undefined
|
|
264
228
|
: readRuntimeLoadSkillDataProperty(messages, "overrideNote", "Runtime load skill messages");
|
|
@@ -266,14 +230,7 @@ function snapshotRuntimeLoadSkillResponseMessages(messages, availableToolNames)
|
|
|
266
230
|
? undefined
|
|
267
231
|
: readRuntimeLoadSkillDataProperty(messages, "referenceNote", "Runtime load skill messages");
|
|
268
232
|
return {
|
|
269
|
-
configuredDelegationNote: configuredDelegationNote,
|
|
270
233
|
messages: {
|
|
271
|
-
allowedToolsNote: allowedToolsNote ??
|
|
272
|
-
DEFAULT_RUNTIME_LOAD_SKILL_RESPONSE_MESSAGES.allowedToolsNote,
|
|
273
|
-
noCurrentRunToolsNote: noCurrentRunToolsNote ??
|
|
274
|
-
DEFAULT_RUNTIME_LOAD_SKILL_RESPONSE_MESSAGES.noCurrentRunToolsNote,
|
|
275
|
-
unavailableCurrentRunToolsDelegationNote: configuredDelegationNote ??
|
|
276
|
-
buildUnavailableCurrentRunToolsDelegationNote(availableToolNames),
|
|
277
234
|
overrideNote: overrideNote ??
|
|
278
235
|
DEFAULT_RUNTIME_LOAD_SKILL_RESPONSE_MESSAGES.overrideNote,
|
|
279
236
|
referenceNote: referenceNote ??
|
|
@@ -288,29 +245,16 @@ function buildLoadedSkillResponse(input) {
|
|
|
288
245
|
const availableToolNames = snapshotRuntimeLoadSkillAvailableToolNames(readRuntimeLoadSkillDataProperty(input.options.context, "availableToolNames", "Runtime load skill context"));
|
|
289
246
|
const logger = readRuntimeLoadSkillDataProperty(input.options, "logger", "Runtime load skill options");
|
|
290
247
|
const skillDocumentParserProvider = readRuntimeLoadSkillDataProperty(input.options, "skillDocumentParserProvider", "Runtime load skill options");
|
|
291
|
-
const {
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
instructions: input.instructions,
|
|
295
|
-
nextStep: configuredNextStep ?? "",
|
|
296
|
-
messages: responseMessages,
|
|
297
|
-
references: input.references,
|
|
298
|
-
availableToolNames,
|
|
299
|
-
skillDocumentParserProvider,
|
|
300
|
-
});
|
|
301
|
-
const effectiveAvailableToolNames = getEffectiveAvailableToolNames(preliminaryResponse, availableToolNames);
|
|
248
|
+
const { messages: responseMessages } = snapshotRuntimeLoadSkillResponseMessages(messagesInput);
|
|
249
|
+
// Fail closed on an unknown tool inventory: an undefined list must not be
|
|
250
|
+
// read as "every delegate tool is present".
|
|
302
251
|
const nextStep = configuredNextStep ??
|
|
303
|
-
buildRuntimeLoadSkillContinuationNote(
|
|
304
|
-
const generatedDelegationNote = buildUnavailableCurrentRunToolsDelegationNote(effectiveAvailableToolNames);
|
|
252
|
+
buildRuntimeLoadSkillContinuationNote(availableToolNames ?? []);
|
|
305
253
|
const response = buildStrictRuntimeLoadedSkillResponse({
|
|
306
254
|
skillId: input.skillId,
|
|
307
255
|
instructions: input.instructions,
|
|
308
256
|
nextStep,
|
|
309
|
-
messages:
|
|
310
|
-
...responseMessages,
|
|
311
|
-
unavailableCurrentRunToolsDelegationNote: configuredDelegationNote ??
|
|
312
|
-
generatedDelegationNote,
|
|
313
|
-
},
|
|
257
|
+
messages: responseMessages,
|
|
314
258
|
references: input.references,
|
|
315
259
|
availableToolNames,
|
|
316
260
|
logger,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-skill-catalog.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/project-skill-catalog.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EACV,4BAA4B,EAC5B,kBAAkB,EAClB,0BAA0B,EAC1B,6BAA6B,EAC9B,MAAM,2BAA2B,CAAC;AASnC,OAAO,EAIL,KAAK,sBAAsB,EAC3B,KAAK,0BAA0B,EAChC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,iCAAiC,CAAC;AAgBzC,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,kDAAkD,CAAC;AA8FpG,+DAA+D;AAC/D,MAAM,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2BAA2B,CAAC;CAC3D,GAAG,sBAAsB,EAAE,CAqD3B;AAED,2CAA2C;AAC3C,wBAAsB,6BAA6B,CACjD,KAAK,EAAE,4BAA4B,GAAG,iCAAiC,GACtE,OAAO,CAAC,MAAM,CAAC,CA8BjB;AAED,4CAA4C;AAC5C,wBAAsB,6BAA6B,CACjD,KAAK,EAAE,4BAA4B,GAAG,iCAAiC,GACtE,OAAO,CAAC,sBAAsB,EAAE,CAAC,CA+MnC"}
|
|
@@ -67,7 +67,7 @@ function getRetainedMetadataCharacters(definition) {
|
|
|
67
67
|
]) {
|
|
68
68
|
total += value?.length ?? 0;
|
|
69
69
|
}
|
|
70
|
-
for (const value of definition.allowedTools)
|
|
70
|
+
for (const value of definition.allowedTools ?? [])
|
|
71
71
|
total += value.length;
|
|
72
72
|
for (const value of definition.references ?? [])
|
|
73
73
|
total += value.length;
|
|
@@ -182,10 +182,6 @@ function snapshotBuiltinSkillDefinition(value, index) {
|
|
|
182
182
|
const metadata = rawMetadata === undefined
|
|
183
183
|
? undefined
|
|
184
184
|
: snapshotBuiltinMetadata(rawMetadata, index);
|
|
185
|
-
const allowedToolsDeclared = readOwnDataProperty(value, "allowedToolsDeclared", label, false);
|
|
186
|
-
if (allowedToolsDeclared !== undefined && typeof allowedToolsDeclared !== "boolean") {
|
|
187
|
-
throw new TypeError(`${label}.allowedToolsDeclared must be a boolean`);
|
|
188
|
-
}
|
|
189
185
|
const thinking = readOwnDataProperty(value, "thinking", label, false);
|
|
190
186
|
if (thinking !== undefined &&
|
|
191
187
|
thinking !== false &&
|
|
@@ -203,7 +199,6 @@ function snapshotBuiltinSkillDefinition(value, index) {
|
|
|
203
199
|
description: requireBuiltinString(value, "description", index, true),
|
|
204
200
|
instructions: requireBuiltinString(value, "instructions", index, true),
|
|
205
201
|
allowedTools: allowedTools,
|
|
206
|
-
...(allowedToolsDeclared === undefined ? {} : { allowedToolsDeclared }),
|
|
207
202
|
...(metadata === undefined ? {} : { metadata: metadata }),
|
|
208
203
|
...(thinking === undefined ? {} : { thinking: thinking }),
|
|
209
204
|
...(maxSteps === undefined ? {} : { maxSteps }),
|
|
@@ -31,14 +31,12 @@ export type RuntimeSkillDefinition = {
|
|
|
31
31
|
displayName?: string;
|
|
32
32
|
description: string;
|
|
33
33
|
instructions: string;
|
|
34
|
-
allowedTools: string[];
|
|
35
34
|
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* declared policy.
|
|
35
|
+
* `allowed-tools` frontmatter, recorded verbatim. The Agent Skills spec
|
|
36
|
+
* defines this as pre-approval metadata, so the runtime carries it but never
|
|
37
|
+
* enforces it. See veryfront/veryfront-issue-inbox#406.
|
|
40
38
|
*/
|
|
41
|
-
|
|
39
|
+
allowedTools?: string[];
|
|
42
40
|
metadata?: Record<string, string>;
|
|
43
41
|
model?: string;
|
|
44
42
|
thinking?: false | number;
|
|
@@ -57,15 +55,6 @@ export type RuntimeSkillDefinition = {
|
|
|
57
55
|
*/
|
|
58
56
|
sourcePath?: string;
|
|
59
57
|
};
|
|
60
|
-
/**
|
|
61
|
-
* Catalog-policy check that preserves the legacy public definition contract.
|
|
62
|
-
*
|
|
63
|
-
* Non-empty arrays always describe a policy. Strict builders persist the
|
|
64
|
-
* omitted-versus-empty distinction in an additive serializable discriminator;
|
|
65
|
-
* legacy definitions without it retain their historical empty-array
|
|
66
|
-
* interpretation until their instructions are loaded and parsed.
|
|
67
|
-
*/
|
|
68
|
-
export declare function hasRuntimeSkillAllowedToolsPolicy(definition: RuntimeSkillDefinition): boolean;
|
|
69
58
|
/**
|
|
70
59
|
* Whether a runtime skill definition is visible to the caller identified by
|
|
71
60
|
* the scope — the same owner-aware rule as the local skill registry: unowned
|
|
@@ -99,9 +88,6 @@ export declare function resolveRuntimeSkillSelectorForAgent(input: {
|
|
|
99
88
|
}): ResolvedSkillSelectorSnapshot<RuntimeSkillDefinition>;
|
|
100
89
|
/** Public API contract for runtime loaded skill response messages. */
|
|
101
90
|
export type RuntimeLoadedSkillResponseMessages = {
|
|
102
|
-
allowedToolsNote: string;
|
|
103
|
-
noCurrentRunToolsNote: string;
|
|
104
|
-
unavailableCurrentRunToolsDelegationNote: string;
|
|
105
91
|
overrideNote: string;
|
|
106
92
|
referenceNote: string;
|
|
107
93
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skill-metadata.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/skill-metadata.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,2BAA2B,EAGjC,MAAM,kDAAkD,CAAC;
|
|
1
|
+
{"version":3,"file":"skill-metadata.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/skill-metadata.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,2BAA2B,EAGjC,MAAM,kDAAkD,CAAC;AAkB1D,OAAO,EAEL,KAAK,6BAA6B,EAEnC,MAAM,yBAAyB,CAAC;AA+BjC,2EAA2E;AAC3E,eAAO,MAAM,8BAA8B,MAAM,CAAC;AAClD,2EAA2E;AAC3E,eAAO,MAAM,iCAAiC,UAAY,CAAC;AAC3D,2EAA2E;AAC3E,eAAO,MAAM,uBAAuB,OAAQ,CAAC;AAM7C,gFAAgF;AAChF,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAOxE;AAiGD,yDAAyD;AACzD,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC;IAC7C,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,QAAQ,EAAE,KAAK,GAAG,MAAM,GAAG,SAAS,CAAC;IACrC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;CAC9B;A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
4
|
import { tryResolve } from "../../extensions/contracts.js";
|
|
5
5
|
import { SkillDocumentParserProviderName, snapshotSkillDocumentParserProvider, } from "../../extensions/parser/skill-document-parser.js";
|
|
6
6
|
import { loadDefaultSkillDocumentParserProvider } from "../../extensions/parser/skill-defaults.js";
|
|
7
|
-
import { matchesAllowedTool, snapshotAllowedToolPatterns, validateStrictAllowedToolPatterns, } from "../../skill/allowed-tools.js";
|
|
8
7
|
import { SKILL_ALLOWED_TOOL_MAX_PATTERNS, SKILL_ALLOWED_TOOL_PATTERN_MAX_LENGTH, SKILL_DOCUMENT_MAX_CHARACTERS, SKILL_ID_MAX_LENGTH, SKILL_LOADABLE_REFERENCE_MAX_ENTRIES, SKILL_PATH_SEGMENT_MAX_LENGTH, SKILL_RELATIVE_PATH_MAX_LENGTH, SKILL_RUNTIME_AVAILABLE_TOOL_MAX_ENTRIES, SKILL_SUBDIR_MAX_ENTRIES, } from "../../skill/limits.js";
|
|
9
8
|
import { parseBoundedSkillDocument, } from "../../skill/document-parser.js";
|
|
10
9
|
import { validateSkillFileMetadata } from "../../skill/parser.js";
|
|
@@ -55,7 +54,20 @@ function normalizeStrictAllowedTools(value) {
|
|
|
55
54
|
if (ArrayIsArray(value) && patterns.some((entry) => entry.length === 0)) {
|
|
56
55
|
throw new TypeError("Allowed-tools patterns must not be empty");
|
|
57
56
|
}
|
|
58
|
-
|
|
57
|
+
const kept = patterns.filter((entry) => entry.length > 0);
|
|
58
|
+
// Bounded but not grammar-checked: `allowed-tools` is spec pre-approval
|
|
59
|
+
// metadata the runtime never enforces, so any spec-conformant value must
|
|
60
|
+
// parse (including `Bash(git:*)`). Bounds still apply because the value
|
|
61
|
+
// comes from untrusted frontmatter.
|
|
62
|
+
if (kept.length > SKILL_ALLOWED_TOOL_MAX_PATTERNS) {
|
|
63
|
+
throw new RangeError(`Allowed-tools accepts at most ${SKILL_ALLOWED_TOOL_MAX_PATTERNS} patterns`);
|
|
64
|
+
}
|
|
65
|
+
for (const entry of kept) {
|
|
66
|
+
if (entry.length > SKILL_ALLOWED_TOOL_PATTERN_MAX_LENGTH) {
|
|
67
|
+
throw new RangeError(`Allowed-tools patterns must be at most ${SKILL_ALLOWED_TOOL_PATTERN_MAX_LENGTH} characters`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return kept;
|
|
59
71
|
}
|
|
60
72
|
function normalizeStrictMetadata(value) {
|
|
61
73
|
if (value === undefined)
|
|
@@ -189,19 +201,6 @@ export const getRuntimeSkillFrontmatterSchema = defineSchema((v) => {
|
|
|
189
201
|
* @deprecated Use {@link getRuntimeSkillFrontmatterSchema}.
|
|
190
202
|
*/
|
|
191
203
|
export const RuntimeSkillFrontmatterSchema = lazySchema(getRuntimeSkillFrontmatterSchema);
|
|
192
|
-
/**
|
|
193
|
-
* Catalog-policy check that preserves the legacy public definition contract.
|
|
194
|
-
*
|
|
195
|
-
* Non-empty arrays always describe a policy. Strict builders persist the
|
|
196
|
-
* omitted-versus-empty distinction in an additive serializable discriminator;
|
|
197
|
-
* legacy definitions without it retain their historical empty-array
|
|
198
|
-
* interpretation until their instructions are loaded and parsed.
|
|
199
|
-
*/
|
|
200
|
-
export function hasRuntimeSkillAllowedToolsPolicy(definition) {
|
|
201
|
-
if (definition.allowedTools.length > 0)
|
|
202
|
-
return true;
|
|
203
|
-
return definition.allowedToolsDeclared === true;
|
|
204
|
-
}
|
|
205
204
|
/**
|
|
206
205
|
* Whether a runtime skill definition is visible to the caller identified by
|
|
207
206
|
* the scope — the same owner-aware rule as the local skill registry: unowned
|
|
@@ -258,24 +257,6 @@ export function resolveRuntimeSkillSelectorForAgent(input) {
|
|
|
258
257
|
function canUseLegacyInvokeAgent(availableToolNameSet) {
|
|
259
258
|
return availableToolNameSet?.has("invoke_agent") === true;
|
|
260
259
|
}
|
|
261
|
-
function isDelegationToolName(toolName) {
|
|
262
|
-
return toolName === "invoke_agent" || toolName.startsWith("agent_");
|
|
263
|
-
}
|
|
264
|
-
function isToolAllowedByResolvedPolicy(toolName, declaredAllowedTools, hasDeclaredAllowedTools) {
|
|
265
|
-
return !hasDeclaredAllowedTools ||
|
|
266
|
-
declaredAllowedTools.some((pattern) => matchesAllowedTool(toolName, pattern));
|
|
267
|
-
}
|
|
268
|
-
function hasAllowedAvailableDelegationTool(availableToolNameSet, declaredAllowedTools, hasDeclaredAllowedTools) {
|
|
269
|
-
if (availableToolNameSet === null)
|
|
270
|
-
return false;
|
|
271
|
-
for (const toolName of availableToolNameSet) {
|
|
272
|
-
if (isDelegationToolName(toolName) &&
|
|
273
|
-
isToolAllowedByResolvedPolicy(toolName, declaredAllowedTools, hasDeclaredAllowedTools)) {
|
|
274
|
-
return true;
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
return false;
|
|
278
|
-
}
|
|
279
260
|
function snapshotAvailableRuntimeToolNames(value) {
|
|
280
261
|
if (value === undefined)
|
|
281
262
|
return null;
|
|
@@ -566,9 +547,7 @@ function parseRuntimeSkillDirectoryDocument(content, input, logger) {
|
|
|
566
547
|
...source.document.metadata,
|
|
567
548
|
name: metadata.name,
|
|
568
549
|
description: metadata.description,
|
|
569
|
-
allowedTools: metadata.allowedTools === undefined
|
|
570
|
-
? []
|
|
571
|
-
: snapshotAllowedToolPatterns(metadata.allowedTools),
|
|
550
|
+
allowedTools: Object.freeze(metadata.allowedTools === undefined ? [] : [...metadata.allowedTools]),
|
|
572
551
|
metadata: metadata.metadata === undefined
|
|
573
552
|
? undefined
|
|
574
553
|
: Object.freeze({ ...metadata.metadata }),
|
|
@@ -618,8 +597,7 @@ function buildRuntimeSkillDefinitionFromDocument(input, parsed) {
|
|
|
618
597
|
...(displayName === undefined ? {} : { displayName }),
|
|
619
598
|
description: metadata.description ?? extractDescriptionFromMarkdown(body, input.id),
|
|
620
599
|
instructions: input.content,
|
|
621
|
-
allowedTools:
|
|
622
|
-
allowedToolsDeclared: parsed.allowedToolsDeclared,
|
|
600
|
+
allowedTools: Object.freeze([...metadata.allowedTools]),
|
|
623
601
|
...(metadataSnapshot === undefined ? {} : { metadata: metadataSnapshot }),
|
|
624
602
|
...(metadata.model ? { model: metadata.model } : {}),
|
|
625
603
|
...(metadata.thinking !== undefined ? { thinking: metadata.thinking } : {}),
|
|
@@ -704,9 +682,6 @@ export function normalizeRuntimeSkillReferencePath(path) {
|
|
|
704
682
|
return normalizeStrictRuntimeSkillReferencePath(path);
|
|
705
683
|
}
|
|
706
684
|
const RUNTIME_LOADED_SKILL_MESSAGE_FIELDS = [
|
|
707
|
-
"allowedToolsNote",
|
|
708
|
-
"noCurrentRunToolsNote",
|
|
709
|
-
"unavailableCurrentRunToolsDelegationNote",
|
|
710
685
|
"overrideNote",
|
|
711
686
|
"referenceNote",
|
|
712
687
|
];
|
|
@@ -757,53 +732,17 @@ export function buildStrictRuntimeLoadedSkillResponse(input) {
|
|
|
757
732
|
skillDocumentParserProvider: snapshot.skillDocumentParserProvider,
|
|
758
733
|
});
|
|
759
734
|
const metadata = parsedSource?.document.metadata ?? null;
|
|
760
|
-
const invalidMetadata = parsedSource === null;
|
|
761
|
-
const declaredAllowedTools = metadata?.allowedTools ?? [];
|
|
762
735
|
const availableToolNameSet = snapshotAvailableRuntimeToolNames(snapshot.availableToolNames);
|
|
763
|
-
const isAvailableAllowedToolPattern = (pattern) => {
|
|
764
|
-
if (availableToolNameSet === null)
|
|
765
|
-
return false;
|
|
766
|
-
for (const toolName of availableToolNameSet) {
|
|
767
|
-
if (matchesAllowedTool(toolName, pattern))
|
|
768
|
-
return true;
|
|
769
|
-
}
|
|
770
|
-
return false;
|
|
771
|
-
};
|
|
772
|
-
const currentRunAllowedTools = availableToolNameSet
|
|
773
|
-
? declaredAllowedTools.filter(isAvailableAllowedToolPattern)
|
|
774
|
-
: declaredAllowedTools;
|
|
775
|
-
const unavailableCurrentRunTools = availableToolNameSet && declaredAllowedTools.length > 0
|
|
776
|
-
? declaredAllowedTools.filter((pattern) => !isAvailableAllowedToolPattern(pattern))
|
|
777
|
-
: [];
|
|
778
736
|
const hasOverrides = metadata?.model !== undefined || metadata?.thinking !== undefined ||
|
|
779
737
|
metadata?.maxSteps !== undefined;
|
|
780
|
-
const hasDeclaredAllowedTools = invalidMetadata || parsedSource.allowedToolsDeclared;
|
|
781
738
|
return {
|
|
782
739
|
skillId: snapshot.skillId,
|
|
783
740
|
instructions: snapshot.instructions,
|
|
784
741
|
nextStep: snapshot.nextStep,
|
|
785
|
-
...(hasDeclaredAllowedTools
|
|
786
|
-
? {
|
|
787
|
-
allowedTools: currentRunAllowedTools,
|
|
788
|
-
note: currentRunAllowedTools.length > 0
|
|
789
|
-
? snapshot.messages.allowedToolsNote
|
|
790
|
-
: snapshot.messages.noCurrentRunToolsNote,
|
|
791
|
-
}
|
|
792
|
-
: {}),
|
|
793
|
-
...(hasDeclaredAllowedTools ? { delegationTools: declaredAllowedTools } : {}),
|
|
794
|
-
...(unavailableCurrentRunTools.length > 0
|
|
795
|
-
? {
|
|
796
|
-
unavailableCurrentRunTools,
|
|
797
|
-
...(hasAllowedAvailableDelegationTool(availableToolNameSet, declaredAllowedTools, hasDeclaredAllowedTools)
|
|
798
|
-
? { delegationNote: snapshot.messages.unavailableCurrentRunToolsDelegationNote }
|
|
799
|
-
: {}),
|
|
800
|
-
}
|
|
801
|
-
: {}),
|
|
802
742
|
...(metadata?.model ? { model: metadata.model } : {}),
|
|
803
743
|
...(metadata?.thinking !== undefined ? { thinking: metadata.thinking } : {}),
|
|
804
744
|
...(metadata?.maxSteps !== undefined ? { maxSteps: metadata.maxSteps } : {}),
|
|
805
|
-
...(hasOverrides && canUseLegacyInvokeAgent(availableToolNameSet)
|
|
806
|
-
isToolAllowedByResolvedPolicy("invoke_agent", declaredAllowedTools, hasDeclaredAllowedTools)
|
|
745
|
+
...(hasOverrides && canUseLegacyInvokeAgent(availableToolNameSet)
|
|
807
746
|
? {
|
|
808
747
|
overrideNote: snapshot.messages.overrideNote,
|
|
809
748
|
}
|
|
@@ -9,13 +9,11 @@ export declare const SUBMITTED_FORM_INPUT_CONTEXT_KEY = "hasSubmittedFormInputRe
|
|
|
9
9
|
export declare const INACTIVE_SKILL_TOOL_AVAILABILITY: SkillToolAvailability;
|
|
10
10
|
export type ActiveSkillState = {
|
|
11
11
|
activeSkillId: string | undefined;
|
|
12
|
-
activeSkillPolicy: string[] | undefined;
|
|
13
12
|
activeSkillToolAvailability: SkillToolAvailability;
|
|
14
13
|
activeSkillDelegationOverrides: SkillDelegationOverrides | undefined;
|
|
15
14
|
};
|
|
16
15
|
export declare function hydrateActiveSkillStateFromMessages(messages: readonly Message[]): ActiveSkillState;
|
|
17
16
|
export declare function extractSkillId(result: unknown): string | undefined;
|
|
18
|
-
export declare function extractSkillPolicy(result: unknown): string[] | undefined;
|
|
19
17
|
export declare function extractSkillToolAvailability(result: unknown): SkillToolAvailability | undefined;
|
|
20
18
|
/** Apply only a validated body-load response; reference/error results preserve state. */
|
|
21
19
|
export declare function applySkillActivationResult(current: ActiveSkillState, result: unknown): ActiveSkillState;
|
|
@@ -25,8 +23,6 @@ export declare function filterToolsAfterSubmittedFormInput(tools: readonly ToolD
|
|
|
25
23
|
id?: string;
|
|
26
24
|
toolAvailability?: SkillToolAvailability;
|
|
27
25
|
}): ToolDefinition[];
|
|
28
|
-
export declare function removeFormInputAfterSubmission(toolName: string, result: unknown, activeSkillPolicy: string[] | undefined): string[] | undefined;
|
|
29
|
-
export declare function narrowPolicyAfterSubmittedForm(activeSkillPolicy: string[] | undefined): string[] | undefined;
|
|
30
26
|
export type SkillPolicyResult = {
|
|
31
27
|
allowed: true;
|
|
32
28
|
} | {
|
|
@@ -41,5 +37,5 @@ export type SkillPolicyOptions = {
|
|
|
41
37
|
};
|
|
42
38
|
/** Identify a valid skill-body activation call without confusing reference reads for activation. */
|
|
43
39
|
export declare function isSkillBodyLoadRequest(toolName: string, input: unknown): boolean;
|
|
44
|
-
export declare function enforceSkillPolicy(toolName: string,
|
|
40
|
+
export declare function enforceSkillPolicy(toolName: string, options?: SkillPolicyOptions): SkillPolicyResult;
|
|
45
41
|
//# sourceMappingURL=skill-policy-enforcement.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skill-policy-enforcement.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/skill-policy-enforcement.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,EAEL,KAAK,qBAAqB,
|
|
1
|
+
{"version":3,"file":"skill-policy-enforcement.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/skill-policy-enforcement.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,EAEL,KAAK,qBAAqB,EAC3B,MAAM,8BAA8B,CAAC;AAgBtC,OAAO,EAEL,KAAK,wBAAwB,EAC9B,MAAM,iCAAiC,CAAC;AAKzC,eAAO,MAAM,kBAAkB,eAAe,CAAC;AAC/C,eAAO,MAAM,kBAAkB,eAAe,CAAC;AAC/C,eAAO,MAAM,oBAAoB,iBAAiB,CAAC;AACnD,eAAO,MAAM,gCAAgC,gCAAgC,CAAC;AAI9E,eAAO,MAAM,gCAAgC,EAAE,qBAI7C,CAAC;AAgFH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,2BAA2B,EAAE,qBAAqB,CAAC;IACnD,8BAA8B,EAAE,wBAAwB,GAAG,SAAS,CAAC;CACtE,CAAC;AAEF,wBAAgB,mCAAmC,CACjD,QAAQ,EAAE,SAAS,OAAO,EAAE,GAC3B,gBAAgB,CAelB;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAIlE;AAiCD,wBAAgB,4BAA4B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{
|
|
3
|
-
import {
|
|
2
|
+
import { isSkillToolAvailable, } from "../../skill/allowed-tools.js";
|
|
3
|
+
import { SKILL_DOCUMENT_MAX_CHARACTERS, SKILL_ID_MAX_LENGTH, SKILL_LOADABLE_REFERENCE_MAX_ENTRIES, SKILL_SUBDIR_MAX_ENTRIES, } from "../../skill/limits.js";
|
|
4
4
|
import { SKILL_READABLE_DIRS } from "../../skill/types.js";
|
|
5
5
|
import { hasControlCharacters, isWellFormedUtf16 } from "../../skill/string-safety.js";
|
|
6
6
|
import { hasToolExecutionErrorMarker, readToolResultOwnDataProperty, UNREADABLE_TOOL_RESULT_PROPERTY, } from "../../tool/result.js";
|
|
@@ -86,14 +86,9 @@ function isSkillActivationResult(result) {
|
|
|
86
86
|
instructions.length <= SKILL_DOCUMENT_MAX_CHARACTERS &&
|
|
87
87
|
isWellFormedUtf16(instructions);
|
|
88
88
|
}
|
|
89
|
-
function getSkillActivationRequiredError(toolName) {
|
|
90
|
-
return `Tool "${toolName}" cannot run before load_skill succeeds in the same step. ` +
|
|
91
|
-
`Call "${LOAD_SKILL_TOOL_ID}" first to establish the active skill context.`;
|
|
92
|
-
}
|
|
93
89
|
export function hydrateActiveSkillStateFromMessages(messages) {
|
|
94
90
|
let state = {
|
|
95
91
|
activeSkillId: undefined,
|
|
96
|
-
activeSkillPolicy: undefined,
|
|
97
92
|
activeSkillToolAvailability: INACTIVE_SKILL_TOOL_AVAILABILITY,
|
|
98
93
|
activeSkillDelegationOverrides: undefined,
|
|
99
94
|
};
|
|
@@ -112,34 +107,6 @@ export function extractSkillId(result) {
|
|
|
112
107
|
const skillId = readToolResultOwnDataProperty(result, "skillId");
|
|
113
108
|
return typeof skillId === "string" ? skillId : undefined;
|
|
114
109
|
}
|
|
115
|
-
export function extractSkillPolicy(result) {
|
|
116
|
-
if (!isRecord(result))
|
|
117
|
-
return undefined;
|
|
118
|
-
const field = readToolResultOwnDataProperty(result, "allowedTools");
|
|
119
|
-
if (field === undefined)
|
|
120
|
-
return undefined;
|
|
121
|
-
const patternCount = getBoundedArrayLength(field, SKILL_ALLOWED_TOOL_MAX_PATTERNS);
|
|
122
|
-
if (field === UNREADABLE_TOOL_RESULT_PROPERTY || patternCount === null) {
|
|
123
|
-
logger.warn("load_skill returned invalid allowedTools; falling back to empty policy (no tools)");
|
|
124
|
-
return [];
|
|
125
|
-
}
|
|
126
|
-
const patterns = [];
|
|
127
|
-
for (let index = 0; index < patternCount; index += 1) {
|
|
128
|
-
const pattern = readToolResultOwnDataProperty(field, index);
|
|
129
|
-
if (typeof pattern !== "string") {
|
|
130
|
-
logger.warn("load_skill returned invalid allowedTools; falling back to empty policy (no tools)");
|
|
131
|
-
return [];
|
|
132
|
-
}
|
|
133
|
-
patterns.push(pattern);
|
|
134
|
-
}
|
|
135
|
-
try {
|
|
136
|
-
return snapshotAllowedToolPatterns(patterns);
|
|
137
|
-
}
|
|
138
|
-
catch (error) {
|
|
139
|
-
logger.warn("load_skill returned invalid tool patterns; falling back to empty policy (no tools)", { error });
|
|
140
|
-
return [];
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
110
|
function extractStringArrayField(result, field, allowedDirectories, maxEntries) {
|
|
144
111
|
const raw = readToolResultOwnDataProperty(result, field);
|
|
145
112
|
const entryCount = getBoundedArrayLength(raw, maxEntries);
|
|
@@ -178,14 +145,13 @@ export function applySkillActivationResult(current, result) {
|
|
|
178
145
|
try {
|
|
179
146
|
return {
|
|
180
147
|
activeSkillId: extractSkillId(result),
|
|
181
|
-
activeSkillPolicy: extractSkillPolicy(result),
|
|
182
148
|
activeSkillToolAvailability: extractSkillToolAvailability(result) ??
|
|
183
149
|
INACTIVE_SKILL_TOOL_AVAILABILITY,
|
|
184
150
|
activeSkillDelegationOverrides: extractSkillDelegationOverrides(result),
|
|
185
151
|
};
|
|
186
152
|
}
|
|
187
153
|
catch (error) {
|
|
188
|
-
logger.warn("load_skill returned an unreadable activation result; preserving prior
|
|
154
|
+
logger.warn("load_skill returned an unreadable activation result; preserving prior state", {
|
|
189
155
|
error,
|
|
190
156
|
});
|
|
191
157
|
return current;
|
|
@@ -264,18 +230,6 @@ export function filterToolsAfterSubmittedFormInput(tools, messages, runtimeConte
|
|
|
264
230
|
}];
|
|
265
231
|
});
|
|
266
232
|
}
|
|
267
|
-
export function removeFormInputAfterSubmission(toolName, result, activeSkillPolicy) {
|
|
268
|
-
if (toolName !== FORM_INPUT_TOOL_ID || !isSubmittedFormInputResult(result) ||
|
|
269
|
-
activeSkillPolicy === undefined) {
|
|
270
|
-
return activeSkillPolicy;
|
|
271
|
-
}
|
|
272
|
-
return narrowPolicyAfterSubmittedForm(activeSkillPolicy);
|
|
273
|
-
}
|
|
274
|
-
export function narrowPolicyAfterSubmittedForm(activeSkillPolicy) {
|
|
275
|
-
if (activeSkillPolicy === undefined)
|
|
276
|
-
return undefined;
|
|
277
|
-
return snapshotAllowedToolPatterns(activeSkillPolicy.filter((allowedToolName) => allowedToolName !== FORM_INPUT_TOOL_ID));
|
|
278
|
-
}
|
|
279
233
|
function isActiveSkillReferenceLoad(options) {
|
|
280
234
|
if (!options.activeSkillId ||
|
|
281
235
|
!isRecord(options.toolInput) ||
|
|
@@ -300,10 +254,7 @@ export function isSkillBodyLoadRequest(toolName, input) {
|
|
|
300
254
|
const file = readToolResultOwnDataProperty(input, "file");
|
|
301
255
|
return typeof skillId === "string" && skillId.length > 0 && file === undefined;
|
|
302
256
|
}
|
|
303
|
-
export function enforceSkillPolicy(toolName,
|
|
304
|
-
if (mustLoadSkillFirst && toolName !== LOAD_SKILL_TOOL_ID) {
|
|
305
|
-
return { allowed: false, error: getSkillActivationRequiredError(toolName) };
|
|
306
|
-
}
|
|
257
|
+
export function enforceSkillPolicy(toolName, options = {}) {
|
|
307
258
|
if (options.hasSubmittedFormInput === true &&
|
|
308
259
|
POST_SUBMITTED_FORM_INPUT_BLOCKED_TOOL_IDS.has(toolName)) {
|
|
309
260
|
return {
|
|
@@ -319,10 +270,16 @@ export function enforceSkillPolicy(toolName, activeSkillPolicy, mustLoadSkillFir
|
|
|
319
270
|
error: `Tool "${toolName}" cannot load or switch skill bodies after form_input was submitted. Only an advertised reference file from the active skill may be loaded.`,
|
|
320
271
|
};
|
|
321
272
|
}
|
|
322
|
-
if (!
|
|
273
|
+
if (!isSkillToolAvailable(toolName, options.skillToolAvailability)) {
|
|
274
|
+
// The two cases need different remedies and the model acts on this text: with
|
|
275
|
+
// no skill loaded it should call load_skill, while a loaded skill that
|
|
276
|
+
// advertises no matching file cannot be fixed by retrying.
|
|
277
|
+
const hasActiveSkill = readToolResultOwnDataProperty(options.skillToolAvailability, "hasActiveSkill") === true;
|
|
323
278
|
return {
|
|
324
279
|
allowed: false,
|
|
325
|
-
error:
|
|
280
|
+
error: hasActiveSkill
|
|
281
|
+
? `Tool "${toolName}" is unavailable because the active skill advertises no matching file.`
|
|
282
|
+
: `Tool "${toolName}" is unavailable because no skill is loaded. Call load_skill first.`,
|
|
326
283
|
};
|
|
327
284
|
}
|
|
328
285
|
return { allowed: true };
|
|
@@ -5,9 +5,9 @@ export declare const MAX_RUNTIME_SKILL_PROMPT_ENTRIES = 30;
|
|
|
5
5
|
/** Maximum runtime tool-name surface accepted while constructing a skill prompt. */
|
|
6
6
|
export declare const MAX_RUNTIME_SKILL_AVAILABLE_TOOL_NAMES = 1000;
|
|
7
7
|
/** Formats bounded runtime skill metadata for prompt use. */
|
|
8
|
-
export declare function formatStrictRuntimeSkillMetadata(skill: RuntimeSkillDefinition
|
|
8
|
+
export declare function formatStrictRuntimeSkillMetadata(skill: RuntimeSkillDefinition): string;
|
|
9
9
|
/** Formats bounded runtime skill metadata for prompt use. */
|
|
10
|
-
export declare function formatRuntimeSkillMetadata(skill: RuntimeSkillDefinition
|
|
10
|
+
export declare function formatRuntimeSkillMetadata(skill: RuntimeSkillDefinition): string;
|
|
11
11
|
type RuntimeSkillPromptOptions = {
|
|
12
12
|
availableToolNames?: readonly string[];
|
|
13
13
|
includeSkillToolUsage?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skill-prompt.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/skill-prompt.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"skill-prompt.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/skill-prompt.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,KAAK,KAAK,EAAgC,MAAM,sBAAsB,CAAC;AAChF,OAAO,EAKL,KAAK,sBAAsB,EAC5B,MAAM,qBAAqB,CAAC;AAE7B,sDAAsD;AACtD,eAAO,MAAM,gCAAgC,KAAK,CAAC;AACnD,oFAAoF;AACpF,eAAO,MAAM,sCAAsC,OAA2C,CAAC;AAiW/F,6DAA6D;AAC7D,wBAAgB,gCAAgC,CAAC,KAAK,EAAE,sBAAsB,GAAG,MAAM,CAuCtF;AAED,6DAA6D;AAC7D,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,sBAAsB,GAAG,MAAM,CAEhF;AAoED,KAAK,yBAAyB,GAAG;IAC/B,kBAAkB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACvC,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC,CAAC;AAEF,iFAAiF;AACjF,wBAAgB,4CAA4C,CAC1D,MAAM,EAAE,SAAS,sBAAsB,EAAE,EACzC,OAAO,GAAE,yBAA8B,GACtC,MAAM,CAmDR;AAED,wEAAwE;AACxE,wBAAgB,sCAAsC,CACpD,MAAM,EAAE,SAAS,sBAAsB,EAAE,EACzC,OAAO,GAAE,yBAA8B,GACtC,MAAM,CAER;AAoID;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,MAAM,CAM3E"}
|