veryfront 0.1.859 → 0.1.861

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  "name": "veryfront",
3
- "version": "0.1.859",
3
+ "version": "0.1.861",
4
4
  "license": "Apache-2.0",
5
5
  "nodeModulesDir": "auto",
6
6
  "minimumDependencyAge": {
@@ -58,6 +58,7 @@ export type PrepareHostedChatRuntimeToolAssemblyInput<TTraceAttributes extends H
58
58
  export declare function filterHostedChatRuntimeLocalTools(input: {
59
59
  tools: HostToolSet;
60
60
  allowedToolNames?: HostedChatRuntimeAllowedToolNames;
61
+ sourceProviderToolNames?: readonly string[];
61
62
  }): HostToolSet;
62
63
  /** Prepare hosted chat runtime tool assembly. */
63
64
  export declare function prepareHostedChatRuntimeToolAssembly<TTraceAttributes extends HostToolTraceAttributes = HostToolTraceAttributes>(input: PrepareHostedChatRuntimeToolAssemblyInput<TTraceAttributes>): Promise<HostedChatRuntimeToolAssemblyResult>;
@@ -1 +1 @@
1
- {"version":3,"file":"chat-runtime-tool-assembly.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/hosted/chat-runtime-tool-assembly.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAGL,KAAK,WAAW,EAChB,KAAK,uBAAuB,EAE5B,KAAK,8BAA8B,EACnC,KAAK,yBAAyB,EAC9B,KAAK,gBAAgB,EACrB,KAAK,OAAO,EAEZ,KAAK,qBAAqB,EAC3B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,KAAK,8BAA8B,EAGpC,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAAE,KAAK,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AACnF,OAAO,EAEL,KAAK,4CAA4C,EACjD,KAAK,6CAA6C,EAClD,KAAK,iDAAiD,EACtD,KA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C;IACpD,sBAAsB,CAAC,EAAE,6CAA6C,CAAC;IACvE,yBAAyB,CAAC,EAAE,wCAAwC,CAAC;IACrE,kBAAkB,CAAC,EAAE,4CAA4C,CAAC;IAClE,qBAAqB,CAAC,EAAE,iDAAiD,CAAC;IAC1E,iCAAiC,CAAC,EAAE,OAAO,CAAC;CAC7C,CAAC;AA8BF,8CAA8C;AAC9C,wBAAgB,iCAAiC,CAAC,KAAK,EAAE;IACvD,KAAK,EAAE,WAAW,CAAC;IACnB,gBAAgB,CAAC,EAAE,iCAAiC,CAAC;IACrD,uBAAuB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC7C,GAAG,WAAW,CAWd;AAED,iDAAiD;AACjD,wBAAsB,oCAAoC,CACxD,gBAAgB,SAAS,uBAAuB,GAAG,uBAAuB,EAE1E,KAAK,EAAE,yCAAyC,CAAC,gBAAgB,CAAC,GACjE,OAAO,CAAC,mCAAmC,CAAC,CA0F9C"}
@@ -5,6 +5,7 @@ import { selectProviderCompatibleToolNames } from "../runtime/provider-tool-comp
5
5
  import { getProviderNativeToolNames } from "../runtime/provider-native-tool-inventory.js";
6
6
  import { flattenSystemInstructions, withRuntimeToolInventory } from "../runtime/tool-inventory.js";
7
7
  import { normalizeHostedRuntimeAllowedToolNames, resolveHostedRuntimeAllowedToolNames, } from "./runtime-essential-tools.js";
8
+ const HOSTED_LOCAL_PROVIDER_TOOL_NAMES = new Set(["web_fetch"]);
8
9
  function activeProjectId(taskContext) {
9
10
  return taskContext.projectId || null;
10
11
  }
@@ -24,7 +25,11 @@ function filterPostFormInputLocalTools(tools, taskContext) {
24
25
  /** Filter hosted chat runtime local tools. */
25
26
  export function filterHostedChatRuntimeLocalTools(input) {
26
27
  const allowedToolNames = normalizeHostedRuntimeAllowedToolNames(input.allowedToolNames);
27
- const entries = Object.entries(input.tools).filter(([toolName]) => allowedToolNames ? allowedToolNames.has(toolName) : true);
28
+ const sourceProviderToolNames = new Set(input.sourceProviderToolNames ?? []);
29
+ const entries = Object.entries(input.tools).filter(([toolName]) => allowedToolNames
30
+ ? allowedToolNames.has(toolName) ||
31
+ (HOSTED_LOCAL_PROVIDER_TOOL_NAMES.has(toolName) && sourceProviderToolNames.has(toolName))
32
+ : true);
28
33
  return Object.fromEntries(entries.sort(([left], [right]) => left.localeCompare(right)));
29
34
  }
30
35
  /** Prepare hosted chat runtime tool assembly. */
@@ -37,6 +42,7 @@ export async function prepareHostedChatRuntimeToolAssembly(input) {
37
42
  const sortedLocalTools = filterHostedChatRuntimeLocalTools({
38
43
  tools: filterPostFormInputLocalTools(input.localTools, input.taskContext),
39
44
  allowedToolNames,
45
+ sourceProviderToolNames: input.sourceProviderToolNames,
40
46
  });
41
47
  const localHostTools = input.traceLocalTools
42
48
  ? traceHostTools(sortedLocalTools, input.traceLocalTools)
@@ -64,8 +70,10 @@ export async function prepareHostedChatRuntimeToolAssembly(input) {
64
70
  projectScopedRemoteToolOptions: input.projectScopedRemoteToolOptions,
65
71
  });
66
72
  const sourceProviderToolNames = new Set(input.sourceProviderToolNames ?? []);
67
- const providerToolNames = getProviderNativeToolNames({ model: input.taskContext.model }).filter((toolName) => sourceProviderToolNames.has(toolName) ||
68
- (allowedToolNames ? allowedToolNames.has(toolName) : false));
73
+ const localProviderToolNames = new Set(Object.keys(sortedLocalTools).filter((toolName) => HOSTED_LOCAL_PROVIDER_TOOL_NAMES.has(toolName)));
74
+ const providerToolNames = getProviderNativeToolNames({ model: input.taskContext.model }).filter((toolName) => !localProviderToolNames.has(toolName) &&
75
+ (sourceProviderToolNames.has(toolName) ||
76
+ (allowedToolNames ? allowedToolNames.has(toolName) : false)));
69
77
  const localToolNames = Object.keys(localHostTools);
70
78
  const availableToolNames = selectProviderCompatibleToolNames([...new Set([...localToolNames, ...remoteToolNames, ...providerToolNames])].sort(), {
71
79
  model: input.taskContext.model,
@@ -1 +1 @@
1
- {"version":3,"file":"veryfront-cloud-agent-service.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/hosted/veryf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BAAmB,EAAE,CAAC;IACrC,QAAQ,EAAE,2BAA2B,CAAC,UAAU,CAAC,CAAC;IAClD,cAAc,EAAE,gCAAgC,CAAC;CAClD,CAAC;AACF,gEAAgE;AAChE,MAAM,MAAM,6BAA6B,GAAG,+CAA+C,CAAC;AAC5F,4DAA4D;AAC5D,MAAM,MAAM,yBAAyB,GAAG,2CAA2C,CAAC;AA8XpF,wBAAgB,sBAAsB,CAAC,KAAK,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,WAAW,CAYhF;AAqcD,yDAAyD;AACzD,wBAAsB,2CAA2C,CAC/D,OAAO,GAAE,qCAA0C,GAClD,OAAO,CAAC,yBAAyB,CAAC,+CAA+C,CAAC,CAAC,CAKrF;AAED,iDAAiD;AACjD,wBAAsB,mCAAmC,CACvD,OAAO,GAAE,qCAA0C,GAClD,OAAO,CAAC,2BAA2B,CAAC,+CAA+C,CAAC,CAAC,CAgBvF;AAED,4BAA4B;AAC5B,wBAAsB,iBAAiB,CACrC,OAAO,GAAE,qCAA0C,GAClD,OAAO,CAAC,IAAI,CAAC,CAiDf"}
1
+ {"version":3,"file":"veryfront-cloud-agent-service.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/hosted/veryfront-cloud-agent-service.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,wBAAwB,CAAC;AAiB9E,OAAO,EAGL,KAAK,WAAW,EAIjB,MAAM,qBAAqB,CAAC;AAiB7B,OAAO,EAGL,KAAK,0BAA0B,EAChC,MAAM,yBAAyB,CAAC;AAQjC,OAAO,EAAE,KAAK,+BAA+B,EAAE,MAAM,4BAA4B,CAAC;AAClF,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,uCAAuC,CAAC;AAC9F,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAmBzE,OAAO,EACL,KAAK,2BAA2B,EAEjC,MAAM,iCAAiC,CAAC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A+C,CAAC,CAAC,CAKrF;AAED,iDAAiD;AACjD,wBAAsB,mCAAmC,CACvD,OAAO,GAAE,qCAA0C,GAClD,OAAO,CAAC,2BAA2B,CAAC,+CAA+C,CAAC,CAAC,CAgBvF;AAED,4BAA4B;AAC5B,wBAAsB,iBAAiB,CACrC,OAAO,GAAE,qCAA0C,GAClD,OAAO,CAAC,IAAI,CAAC,CAiDf"}
@@ -20,6 +20,7 @@ import { buildAgentRunTraceAttributes, buildExecuteToolTraceAttributes, filterAg
20
20
  import { runAgentServiceMain, } from "../service/bootstrap.js";
21
21
  import { loadAgentServiceEnvFiles } from "../service/env-files.js";
22
22
  import { createHostedFormInputTool } from "./form-input-tool.js";
23
+ import { createHostedWebFetchTool } from "./web-fetch-tool.js";
23
24
  import { createHostedAgentProjectSteering, } from "./agent-project-steering.js";
24
25
  import { createLiveStudioMcpTools } from "../project/live-studio-mcp-tools.js";
25
26
  import { createDefaultHostedChatRuntime, } from "./default-chat-runtime.js";
@@ -392,6 +393,7 @@ function buildLocalTools(context, options, taskContext) {
392
393
  form_input: createHostedFormInputTool(taskContext, config.VERYFRONT_API_URL),
393
394
  load_skill: createLoadSkillTool(context, taskContext),
394
395
  sleep: sleepTool,
396
+ web_fetch: createHostedWebFetchTool(),
395
397
  };
396
398
  if (options.allowDelegation !== false) {
397
399
  tools.invoke_agent = createInvokeAgentTool(context, taskContext);
@@ -0,0 +1,28 @@
1
+ /** Input payload for hosted web_fetch. */
2
+ export type HostedWebFetchToolInput = {
3
+ url: string;
4
+ };
5
+ /** Output payload matching provider-native web_fetch result shape. */
6
+ export type HostedWebFetchToolOutput = {
7
+ type: "web_fetch_result";
8
+ url: string;
9
+ content: {
10
+ type: "document";
11
+ source: {
12
+ type: "text";
13
+ mediaType: string;
14
+ data: string;
15
+ };
16
+ };
17
+ retrievedAt: string;
18
+ status: number;
19
+ truncated?: boolean;
20
+ };
21
+ /** Options accepted by hosted web_fetch. */
22
+ export type HostedWebFetchToolOptions = {
23
+ fetch?: typeof fetch;
24
+ maxContentChars?: number;
25
+ };
26
+ /** Create hosted web_fetch tool that allows direct explicit URL fetches. */
27
+ export declare function createHostedWebFetchTool(options?: HostedWebFetchToolOptions): import("../../tool/types.js").Tool<HostedWebFetchToolInput, HostedWebFetchToolOutput>;
28
+ //# sourceMappingURL=web-fetch-tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web-fetch-tool.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/hosted/web-fetch-tool.ts"],"names":[],"mappings":"AAKA,0CAA0C;AAC1C,MAAM,MAAM,uBAAuB,GAAG;IACpC,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,sEAAsE;AACtE,MAAM,MAAM,wBAAwB,GAAG;IACrC,IAAI,EAAE,kBAAkB,CAAC;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE;QACP,IAAI,EAAE,UAAU,CAAC;QACjB,MAAM,EAAE;YACN,IAAI,EAAE,MAAM,CAAC;YACb,SAAS,EAAE,MAAM,CAAC;YAClB,IAAI,EAAE,MAAM,CAAC;SACd,CAAC;KACH,CAAC;IACF,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,4CAA4C;AAC5C,MAAM,MAAM,yBAAyB,GAAG;IACtC,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAmEF,4EAA4E;AAC5E,wBAAgB,wBAAwB,CAAC,OAAO,GAAE,yBAA8B,yFAa/E"}
@@ -0,0 +1,68 @@
1
+ import { defineSchema } from "../../schemas/index.js";
2
+ import { tool } from "../../tool/index.js";
3
+ const DEFAULT_MAX_CONTENT_CHARS = 500_000;
4
+ const getHostedWebFetchInputSchema = defineSchema((v) => v.object({
5
+ url: v.string().min(1),
6
+ }));
7
+ function parseFetchUrl(value) {
8
+ let url;
9
+ try {
10
+ url = new URL(value);
11
+ }
12
+ catch {
13
+ throw new Error("web_fetch requires an absolute URL");
14
+ }
15
+ if (url.protocol !== "http:" && url.protocol !== "https:") {
16
+ throw new Error("web_fetch only supports http and https URLs");
17
+ }
18
+ if (url.username || url.password) {
19
+ throw new Error("web_fetch does not support credentials in URLs");
20
+ }
21
+ return url;
22
+ }
23
+ async function executeHostedWebFetch(input, options, context) {
24
+ const url = parseFetchUrl(input.url);
25
+ const response = await options.fetch(url.toString(), {
26
+ method: "GET",
27
+ redirect: "follow",
28
+ signal: context?.abortSignal,
29
+ headers: {
30
+ accept: "text/html,application/xhtml+xml,application/xml,text/markdown,text/plain,*/*;q=0.8",
31
+ "user-agent": "Veryfront web_fetch",
32
+ },
33
+ });
34
+ if (!response.ok) {
35
+ throw new Error(`web_fetch failed with HTTP ${response.status}`);
36
+ }
37
+ const mediaType = response.headers.get("content-type") ?? "text/plain";
38
+ const text = await response.text();
39
+ const truncated = text.length > options.maxContentChars;
40
+ return {
41
+ type: "web_fetch_result",
42
+ url: response.url || url.toString(),
43
+ content: {
44
+ type: "document",
45
+ source: {
46
+ type: "text",
47
+ mediaType,
48
+ data: truncated ? text.slice(0, options.maxContentChars) : text,
49
+ },
50
+ },
51
+ retrievedAt: new Date().toISOString(),
52
+ status: response.status,
53
+ ...(truncated ? { truncated } : {}),
54
+ };
55
+ }
56
+ /** Create hosted web_fetch tool that allows direct explicit URL fetches. */
57
+ export function createHostedWebFetchTool(options = {}) {
58
+ const resolvedOptions = {
59
+ fetch: options.fetch ?? globalThis.fetch,
60
+ maxContentChars: options.maxContentChars ?? DEFAULT_MAX_CONTENT_CHARS,
61
+ };
62
+ return tool({
63
+ id: "web_fetch",
64
+ description: "Fetch the content of an explicit http or https URL directly. Use this for canonical documentation or pages named in the task or available context; no prior web_search is required.",
65
+ inputSchema: getHostedWebFetchInputSchema(),
66
+ execute: (input, context) => executeHostedWebFetch(input, resolvedOptions, context),
67
+ });
68
+ }
@@ -5,7 +5,7 @@ import { type RuntimeLoadedSkillResponse, type RuntimeLoadedSkillResponseMessage
5
5
  /** Shared runtime load skill continuation note value. */
6
6
  export declare const RUNTIME_LOAD_SKILL_CONTINUATION_NOTE = "IMPORTANT: load_skill only loads instructions. It does not perform the task or finish the turn. Continue the same turn after calling it. Keep the root assistant visibly owning the work. For multi-step or isolated work, call invoke_agent; otherwise keep working directly with the allowed tools. Delegate only when isolation, parallelism, or a different tool/model budget materially helps. Pass through any returned model, thinking, or maxSteps overrides to invoke_agent when delegating. If the current run exposes fewer tools than the loaded skill metadata, use only the tools that are actually available right now.";
7
7
  /** Shared runtime load skill description value. */
8
- export declare const RUNTIME_LOAD_SKILL_DESCRIPTION = "Load the full instructions for a skill. Use this when you need detailed guidance for a specific task type. If the skill specifies allowed-tools, you MUST only use those tools while following this skill. load_skill does not perform the task by itself. Continue the same turn after calling it. Keep the root assistant visibly owning the work. For multi-step or isolated work, call invoke_agent; otherwise keep working directly with the allowed tools. Delegate only when isolation, parallelism, or a different tool/model budget materially helps. Use the optional `file` parameter to load a specific reference file from the skill.";
8
+ export declare const RUNTIME_LOAD_SKILL_DESCRIPTION = "Load the full instructions for a skill. Use this when you need detailed guidance for a specific task type. If the skill specifies allowed-tools, you MUST only use those tools while following this skill. load_skill does not perform the task by itself. Continue the same turn after calling it. Keep the root assistant visibly owning the work. For multi-step or isolated work, call invoke_agent; otherwise keep working directly with the allowed tools. Delegate only when isolation, parallelism, or a different tool/model budget materially helps. 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.";
9
9
  /** Context for runtime load skill tool. */
10
10
  export type RuntimeLoadSkillToolContext = RuntimeProjectSkillContext & {
11
11
  availableSkillIds?: readonly string[];
@@ -1 +1 @@
1
- {"version":3,"file":"load-skill-tool.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/load-skill-tool.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC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QAAQ,CAAC,EAAE,4BAA4B,CAAC;IACxC,MAAM,CAAC,EAAE,0BAA0B,CAAC;CACrC,CAAC;AAEF,eAAO,MAAM,kCAAkC;;;GAS9C,CAAC;AAKF,iDAAiD;AACjD,MAAM,MAAM,yBAAyB,GAAG,WAAW,CACjD,UAAU,CAAC,OAAO,kCAAkC,CAAC,CACtD,CAAC;AAEF,qDAAqD;AACrD,MAAM,MAAM,mCAAmC,GAAG;IAChD,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,4CAA4C;AAC5C,MAAM,MAAM,2BAA2B,GAAG;IACxC,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,2CAA2C;AAC3C,MAAM,MAAM,0BAA0B,GAClC,0BAA0B,GAC1B,mCAAmC,GACnC,2BAA2B,CAAC;AAqPhC,sCAAsC;AACtC,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,2BAA2B,GACnC,IAAI,CAAC,yBAAyB,EAAE,0BAA0B,CAAC,CA8C7D"}
@@ -7,19 +7,19 @@ import { narrowPolicyAfterSubmittedForm } from "./skill-policy-enforcement.js";
7
7
  /** Shared runtime load skill continuation note value. */
8
8
  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} ${LOAD_SKILL_USE_ALLOWED_TOOLS} ${LOAD_SKILL_DELEGATION_THRESHOLD} ${LOAD_SKILL_OVERRIDE_FORWARDING} ${LOAD_SKILL_TOOL_INTERSECTION}`;
9
9
  /** Shared runtime load skill description value. */
10
- 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. If the skill specifies allowed-tools, you MUST only use those tools while following this skill. load_skill does not perform the task by itself. ${LOAD_SKILL_CONTINUE_SAME_TURN} ${LOAD_SKILL_ROOT_OWNERSHIP} ${LOAD_SKILL_USE_ALLOWED_TOOLS} ${LOAD_SKILL_DELEGATION_THRESHOLD} Use the optional \`file\` parameter to load a specific reference file from the skill.`;
10
+ 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. If the skill specifies allowed-tools, you MUST only use those tools while following this skill. load_skill does not perform the task by itself. ${LOAD_SKILL_CONTINUE_SAME_TURN} ${LOAD_SKILL_ROOT_OWNERSHIP} ${LOAD_SKILL_USE_ALLOWED_TOOLS} ${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.`;
11
11
  const DEFAULT_RUNTIME_LOAD_SKILL_RESPONSE_MESSAGES = {
12
12
  allowedToolsNote: "IMPORTANT: While following this skill, you MUST only use the tools listed in allowedTools.",
13
13
  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.",
14
14
  unavailableCurrentRunToolsDelegationNote: "IMPORTANT: Some tools required by this skill are not available in the current run. Use invoke_agent for the isolated work and pass delegationTools as the child tools allowlist.",
15
15
  overrideNote: LOAD_SKILL_OVERRIDE_FORWARDING,
16
- referenceNote: "Use load_skill with the `file` parameter to load any of these reference files.",
16
+ referenceNote: "After this skill is loaded, use load_skill with the `file` parameter only for one of these listed reference files.",
17
17
  };
18
18
  export const getRuntimeLoadSkillToolInputSchema = defineSchema((v) => v.object({
19
19
  skillId: v.string()
20
20
  .regex(/^[a-zA-Z0-9_-]+$/, 'skillId must contain only letters, numbers, "_" or "-"')
21
21
  .describe('The skill ID to load (e.g., "react-components", "api-design")'),
22
- file: v.string().optional().describe('Optional reference file to load (e.g. "references/quickstart.md")'),
22
+ file: v.string().optional().describe("Optional reference file to load. First load the skill with only skillId, then use file only for a reference path listed by that loaded skill."),
23
23
  }));
24
24
  /** @deprecated Use getRuntimeLoadSkillToolInputSchema() */
25
25
  const runtimeLoadSkillToolInputSchema = lazySchema(getRuntimeLoadSkillToolInputSchema);
@@ -141,7 +141,7 @@ function buildRuntimeLoadSkillInputSchema(options) {
141
141
  const enumValues = [first, ...rest];
142
142
  return defineSchema((v) => v.object({
143
143
  skillId: v.enum(enumValues).describe(`The skill ID to load. Available skill IDs: ${knownIds.join(", ")}`),
144
- file: v.string().optional().describe('Optional reference file to load (e.g. "references/quickstart.md")'),
144
+ file: v.string().optional().describe("Optional reference file to load. First load the skill with only skillId, then use file only for a reference path listed by that loaded skill."),
145
145
  }))();
146
146
  }
147
147
  async function loadRuntimeSkillReferenceFile(options, skillId, file) {
@@ -149,6 +149,24 @@ async function loadRuntimeSkillReferenceFile(options, skillId, file) {
149
149
  if (!normalizedFile) {
150
150
  return { error: `Invalid reference file path: ${file}` };
151
151
  }
152
+ const loadedSkillKey = buildRuntimeSkillCacheKey(options.context, skillId);
153
+ const loadedSkillResponse = options.context.loadedSkillResponses?.[loadedSkillKey];
154
+ if (!loadedSkillResponse) {
155
+ return {
156
+ error: `Skill "${skillId}" must be loaded before reference file "${normalizedFile}". ` +
157
+ `Call load_skill with only {"skillId":"${skillId}"} first, then request one of the listed reference files.`,
158
+ };
159
+ }
160
+ const advertisedReferences = loadedSkillResponse.references ?? [];
161
+ if (!advertisedReferences.includes(normalizedFile)) {
162
+ const availableReferences = advertisedReferences.length > 0
163
+ ? advertisedReferences.join(", ")
164
+ : "none";
165
+ return {
166
+ error: `Reference file not advertised by loaded skill "${skillId}": ${normalizedFile}. ` +
167
+ `Available references: ${availableReferences}`,
168
+ };
169
+ }
152
170
  const loadedSkillReferenceResponses = options.context.loadedSkillReferenceResponses ??= {};
153
171
  const referenceKey = buildRuntimeSkillReferenceCacheKey(options.context, skillId, normalizedFile);
154
172
  if (loadedSkillReferenceResponses[referenceKey]) {
@@ -23,6 +23,7 @@ import * as dntShim from "../../_dnt.shims.js";
23
23
  import { createProxyHandler, INTERNAL_PROXY_HEADERS } from "./handler.js";
24
24
  import { createCacheFromEnv } from "./cache/index.js";
25
25
  import { isRetryableConnectionError } from "./retry.js";
26
+ import { closeBridgePeer, getServerWebSocketErrorLogLevel } from "./websocket-bridge.js";
26
27
  import { register } from "../extensions/contracts.js";
27
28
  import { createAuthProvider } from "../../extensions/ext-auth-jwt/src/index.js";
28
29
  import { endSpan, extractContext, initializeOTLPWithApis, injectContext, ProxySpanNames, shutdownOTLP, startServerSpan, withContext, withSpan, } from "./tracing.js";
@@ -188,12 +189,16 @@ function handleWebSocketUpgrade(req, url) {
188
189
  };
189
190
  serverSocket.onerror = (event) => {
190
191
  clearConnectTimeout();
191
- proxyLogger.error("[WebSocket] Server connection error", {
192
+ const error = event instanceof ErrorEvent ? event.message : "Unknown error";
193
+ const logLevel = getServerWebSocketErrorLogLevel(error);
194
+ proxyLogger[logLevel]("[WebSocket] Server connection error", {
192
195
  projectSlug,
193
196
  environment: scope,
194
197
  targetUrl: targetUrl.toString(),
195
- error: event instanceof ErrorEvent ? event.message : "Unknown error",
198
+ error,
196
199
  });
200
+ closeBridgePeer(clientSocket, 1011, "Server connection error");
201
+ closeBridgePeer(serverSocket, 1011, "Server connection error");
197
202
  };
198
203
  serverSocket.onclose = (event) => {
199
204
  clearConnectTimeout();
@@ -0,0 +1,6 @@
1
+ type BridgePeer = Pick<WebSocket, "close" | "readyState">;
2
+ export type ServerWebSocketErrorLogLevel = "warn" | "error";
3
+ export declare function getServerWebSocketErrorLogLevel(message: string): ServerWebSocketErrorLogLevel;
4
+ export declare function closeBridgePeer(peer: BridgePeer | null, code: number, reason: string): void;
5
+ export {};
6
+ //# sourceMappingURL=websocket-bridge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"websocket-bridge.d.ts","sourceRoot":"","sources":["../../../src/src/proxy/websocket-bridge.ts"],"names":[],"mappings":"AAAA,KAAK,UAAU,GAAG,IAAI,CAAC,SAAS,EAAE,OAAO,GAAG,YAAY,CAAC,CAAC;AAE1D,MAAM,MAAM,4BAA4B,GAAG,MAAM,GAAG,OAAO,CAAC;AAS5D,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,MAAM,GAAG,4BAA4B,CAI7F;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAI3F"}
@@ -0,0 +1,18 @@
1
+ const TRANSIENT_SERVER_ERROR_PATTERNS = [
2
+ /unexpected eof/i,
3
+ /connection reset/i,
4
+ /connection closed/i,
5
+ /socket closed/i,
6
+ ];
7
+ export function getServerWebSocketErrorLogLevel(message) {
8
+ return TRANSIENT_SERVER_ERROR_PATTERNS.some((pattern) => pattern.test(message))
9
+ ? "warn"
10
+ : "error";
11
+ }
12
+ export function closeBridgePeer(peer, code, reason) {
13
+ if (!peer)
14
+ return;
15
+ if (peer.readyState !== WebSocket.OPEN && peer.readyState !== WebSocket.CONNECTING)
16
+ return;
17
+ peer.close(code, reason);
18
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-bridge.d.ts","sourceRoot":"","sources":["../../../src/src/runtime/runtime-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,2DAA2D,CAAC;AAC9G,OAAO,KAAK,EACV,yBAAyB,EACzB,mBAAmB,EACnB,6BAA6B,EAC7B,cAAc,EACf,MAAM,wCAAwC,CAAC;AAChD,OAAO,KAAK,EACV,gBAAgB,EAChB,YAAY,EAEb,MAAM,sBAAsB,CAAC;AAE9B,KAAK,mBAAmB,GAAG;IACzB,KAAK,EAAE,YAAY,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,4BAA4B,EAAE,CAAC;IACzC,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,2BAA2B,CAAC,EAAE,6BAA6B,CAAC;IAC5D,eAAe,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AAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B,CAAC;AAEF,KAAK,gBAAgB,GAAG;IACtB,KAAK,EAAE,gBAAgB,CAAC;IACxB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B,CAAC;AAmfF,wBAAgB,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,WAAW,CAAC,yBAAyB,CAAC,CA0BjG;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,mBAAmB,CAyC1E;AAED,wBAAgB,KAAK,CAAC,OAAO,EAAE,YAAY;;;;;;;;GAW1C;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,gBAAgB;;;;;;;GAUlD;AACD,6DAA6D;AAC7D,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,CAsBjE"}
@@ -16,6 +16,13 @@ function normalizeSystemPrompt(system) {
16
16
  }
17
17
  return undefined;
18
18
  }
19
+ function getProviderRequestMessages(messages) {
20
+ const requestMessages = [...messages];
21
+ while (requestMessages.at(-1)?.role === "assistant") {
22
+ requestMessages.pop();
23
+ }
24
+ return requestMessages;
25
+ }
19
26
  function toRuntimePrompt(system, messages) {
20
27
  const prompt = [];
21
28
  if (system && system.length > 0) {
@@ -315,7 +322,7 @@ async function* textDeltasFromStream(stream) {
315
322
  }
316
323
  export function generateText(options) {
317
324
  return resolveDirectTools(options.tools).then((tools) => options.model.doGenerate({
318
- prompt: toRuntimePrompt(normalizeSystemPrompt(options.system), options.messages),
325
+ prompt: toRuntimePrompt(normalizeSystemPrompt(options.system), getProviderRequestMessages(options.messages)),
319
326
  maxOutputTokens: options.maxOutputTokens,
320
327
  ...(options.temperature === undefined ? {} : { temperature: options.temperature }),
321
328
  topP: options.topP,
@@ -337,7 +344,7 @@ export function generateText(options) {
337
344
  }
338
345
  export function streamText(options) {
339
346
  const directResultPromise = resolveDirectTools(options.tools).then((tools) => options.model.doStream({
340
- prompt: toRuntimePrompt(normalizeSystemPrompt(options.system), options.messages),
347
+ prompt: toRuntimePrompt(normalizeSystemPrompt(options.system), getProviderRequestMessages(options.messages)),
341
348
  maxOutputTokens: options.maxOutputTokens,
342
349
  ...(options.temperature === undefined ? {} : { temperature: options.temperature }),
343
350
  topP: options.topP,
@@ -1,3 +1,3 @@
1
1
  /** Shared version value. */
2
- export declare const VERSION = "0.1.859";
2
+ export declare const VERSION = "0.1.861";
3
3
  //# sourceMappingURL=version-constant.d.ts.map
@@ -1,4 +1,4 @@
1
1
  // Keep in sync with deno.json version.
2
2
  // scripts/release.ts updates this constant during releases.
3
3
  /** Shared version value. */
4
- export const VERSION = "0.1.859";
4
+ export const VERSION = "0.1.861";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "veryfront",
3
- "version": "0.1.859",
3
+ "version": "0.1.861",
4
4
  "description": "The simplest way to build AI-powered apps",
5
5
  "keywords": [
6
6
  "react",