veryfront 0.1.187 → 0.1.188

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.187",
3
+ "version": "0.1.188",
4
4
  "license": "Apache-2.0",
5
5
  "nodeModulesDir": "auto",
6
6
  "exclude": [
@@ -1 +1 @@
1
- {"version":3,"file":"ag-ui-browser-encoder.d.ts","sourceRoot":"","sources":["../../../src/src/agent/ag-ui-browser-encoder.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,MAAM,MAAM,sBAAsB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAEhF,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,uBAAuB;IACtC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,QAAQ,EAAE,OAAO,CAAC;IAClB,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,oBAAoB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAClC,gBAAgB,EAAE,OAAO,CAAC;IAC1B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,QAAQ,EAAE,8BAA8B,CAAC;CAC1C;AAED,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,MAAM,CAAC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C;AAED,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED,wBAAgB,6BAA6B,IAAI,uBAAuB,CAYvE;AAkLD,wBAAgB,wCAAwC,CACtD,KAAK,EAAE,uBAAuB,EAC9B,KAAK,EAAE,sBAAsB,GAC5B,uBAAuB,EAAE,CAwJ3B;AAED,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,uBAAuB,EAC9B,QAAQ,EAAE,aAAa,GAAG,IAAI,GAC7B,uBAAuB,EAAE,CAmC3B"}
@@ -129,6 +129,20 @@ function createStepEvent(state, type) {
129
129
  },
130
130
  };
131
131
  }
132
+ function createReasoningEvent(state, event, type) {
133
+ const messageId = getReasoningMessageId(state, event);
134
+ return {
135
+ event: type,
136
+ payload: type === "ReasoningMessageStart"
137
+ ? { messageId, role: "reasoning" }
138
+ : type === "ReasoningMessageContent"
139
+ ? {
140
+ messageId,
141
+ delta: typeof event.delta === "string" ? event.delta : "",
142
+ }
143
+ : { messageId },
144
+ };
145
+ }
132
146
  export function mapRuntimeStreamEventToAgUiBrowserEvents(state, event) {
133
147
  if (event.type.startsWith("data-")) {
134
148
  const name = event.type.slice("data-".length);
@@ -182,26 +196,14 @@ export function mapRuntimeStreamEventToAgUiBrowserEvents(state, event) {
182
196
  }
183
197
  case "reasoning-start":
184
198
  state.sawVisibleOutput = true;
185
- return [{
186
- event: "ReasoningMessageStart",
187
- payload: { messageId: getReasoningMessageId(state, event), role: "reasoning" },
188
- }];
199
+ return [createReasoningEvent(state, event, "ReasoningMessageStart")];
189
200
  case "reasoning-delta":
190
201
  state.sawVisibleOutput = true;
191
- return [{
192
- event: "ReasoningMessageContent",
193
- payload: {
194
- messageId: getReasoningMessageId(state, event),
195
- delta: typeof event.delta === "string" ? event.delta : "",
196
- },
197
- }];
202
+ return [createReasoningEvent(state, event, "ReasoningMessageContent")];
198
203
  case "reasoning-end": {
199
- const messageId = getReasoningMessageId(state, event);
204
+ const reasoningEvent = createReasoningEvent(state, event, "ReasoningMessageEnd");
200
205
  state.reasoningMessageId = null;
201
- return [{
202
- event: "ReasoningMessageEnd",
203
- payload: { messageId },
204
- }];
206
+ return [reasoningEvent];
205
207
  }
206
208
  case "tool-input-start":
207
209
  state.sawVisibleOutput = true;
@@ -86,6 +86,7 @@ export { agentAsTool, createWorkflow, getAgent, getAgentsAsTools, getAllAgentIds
86
86
  export { agent } from "./factory.js";
87
87
  export { type AgUiRuntimeContextItem, AgUiRuntimeContextItemSchema, type AgUiRuntimeInjectedTool, AgUiRuntimeInjectedToolSchema, type AgUiRuntimeMessage, AgUiRuntimeMessageSchema, type AgUiRuntimeRequest, AgUiRuntimeRequestSchema, } from "./runtime-ag-ui-contract.js";
88
88
  export { type AgUiBrowserEncodedEvent, type AgUiBrowserEncoderState, type AgUiBrowserRunFinishedMetadata, type AgUiRuntimeStreamEvent, createAgUiBrowserEncoderState, finalizeAgUiBrowserEvents, mapRuntimeStreamEventToAgUiBrowserEvents, } from "./ag-ui-browser-encoder.js";
89
+ export { expandAllowedRemoteToolNames, getProviderNativeToolNames, type ProviderNativeToolInventoryOptions, } from "./provider-native-tool-inventory.js";
89
90
  export { type AgUiCancelHandlerOptions, type AgUiResumeHandlerOptions, type AgUiResumeSignal, AgUiResumeSignalSchema, createAgUiCancelHandler, createAgUiResumeHandler, } from "./ag-ui-run-control.js";
90
91
  export { type AgUiContextItem, type AgUiHandlerConfigWithAgent, type AgUiHandlerOptions, type AgUiInjectedTool, type AgUiRequest, AgUiRequestSchema, createAgUiHandler, } from "./ag-ui-handler.js";
91
92
  export { type HumanInputField, type HumanInputFieldInput, HumanInputFieldSchema, type HumanInputOption, HumanInputOptionSchema, type HumanInputPendingRequest, HumanInputPendingRequestSchema, type HumanInputRequest, type HumanInputRequestInput, HumanInputRequestSchema, type HumanInputResult, HumanInputResultSchema, HumanInputResumeError, InvalidHumanInputResultError, waitForHumanInput, type WaitForHumanInputOptions, } from "./human-input.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/src/agent/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+EG;AACH,OAAO,yBAAyB,CAAC;AAGjC,YAAY,EACV,KAAK,EACL,WAAW,EACX,YAAY,EACZ,eAAe,EACf,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,OAAO,IAAI,YAAY,EACvB,WAAW,EACX,aAAa,EACb,WAAW,EACX,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,cAAc,EACd,QAAQ,EACR,YAAY,EACZ,oBAAoB,EACpB,qBAAqB,EACrB,cAAc,GACf,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEnF,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,YAAY,EACZ,iBAAiB,EACjB,KAAK,MAAM,EACX,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,WAAW,EACX,KAAK,iBAAiB,EACtB,aAAa,GACd,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,WAAW,EACX,cAAc,EACd,QAAQ,EACR,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,YAAY,GAClB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EACL,KAAK,sBAAsB,EAC3B,4BAA4B,EAC5B,KAAK,uBAAuB,EAC5B,6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iBAAiB,EACjB,mBAAmB,GACpB,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/src/agent/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+EG;AACH,OAAO,yBAAyB,CAAC;AAGjC,YAAY,EACV,KAAK,EACL,WAAW,EACX,YAAY,EACZ,eAAe,EACf,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,OAAO,IAAI,YAAY,EACvB,WAAW,EACX,aAAa,EACb,WAAW,EACX,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,cAAc,EACd,QAAQ,EACR,YAAY,EACZ,oBAAoB,EACpB,qBAAqB,EACrB,cAAc,GACf,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEnF,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,YAAY,EACZ,iBAAiB,EACjB,KAAK,MAAM,EACX,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,WAAW,EACX,KAAK,iBAAiB,EACtB,aAAa,GACd,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,WAAW,EACX,cAAc,EACd,QAAQ,EACR,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,YAAY,GAClB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EACL,KAAK,sBAAsB,EAC3B,4BAA4B,EAC5B,KAAK,uBAAuB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B,EACjB,iBAAiB,EACjB,uBAAuB,EACvB,KAAK,8BAA8B,EACnC,KAAK,gBAAgB,EACrB,KAAK,wBAAwB,EAC7B,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,oBAAoB,CAAC"}
@@ -85,6 +85,7 @@ export { agentAsTool, createWorkflow, getAgent, getAgentsAsTools, getAllAgentIds
85
85
  export { agent } from "./factory.js";
86
86
  export { AgUiRuntimeContextItemSchema, AgUiRuntimeInjectedToolSchema, AgUiRuntimeMessageSchema, AgUiRuntimeRequestSchema, } from "./runtime-ag-ui-contract.js";
87
87
  export { createAgUiBrowserEncoderState, finalizeAgUiBrowserEvents, mapRuntimeStreamEventToAgUiBrowserEvents, } from "./ag-ui-browser-encoder.js";
88
+ export { expandAllowedRemoteToolNames, getProviderNativeToolNames, } from "./provider-native-tool-inventory.js";
88
89
  export { AgUiResumeSignalSchema, createAgUiCancelHandler, createAgUiResumeHandler, } from "./ag-ui-run-control.js";
89
90
  export { AgUiRequestSchema, createAgUiHandler, } from "./ag-ui-handler.js";
90
91
  export { HumanInputFieldSchema, HumanInputOptionSchema, HumanInputPendingRequestSchema, HumanInputRequestSchema, HumanInputResultSchema, HumanInputResumeError, InvalidHumanInputResultError, waitForHumanInput, } from "./human-input.js";
@@ -0,0 +1,11 @@
1
+ export interface ProviderNativeToolInventoryOptions {
2
+ model?: string;
3
+ provider?: string;
4
+ }
5
+ interface ExpandAllowedRemoteToolNamesOptions extends ProviderNativeToolInventoryOptions {
6
+ toolNames: readonly string[];
7
+ }
8
+ export declare function getProviderNativeToolNames(options?: ProviderNativeToolInventoryOptions): string[];
9
+ export declare function expandAllowedRemoteToolNames(options: ExpandAllowedRemoteToolNamesOptions): string[];
10
+ export {};
11
+ //# sourceMappingURL=provider-native-tool-inventory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider-native-tool-inventory.d.ts","sourceRoot":"","sources":["../../../src/src/agent/provider-native-tool-inventory.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,kCAAkC;IACjD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,UAAU,mCAAoC,SAAQ,kCAAkC;IACtF,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;CAC9B;AA2BD,wBAAgB,0BAA0B,CACxC,OAAO,CAAC,EAAE,kCAAkC,GAC3C,MAAM,EAAE,CAOV;AAED,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,mCAAmC,GAC3C,MAAM,EAAE,CAOV"}
@@ -0,0 +1,39 @@
1
+ const ANTHROPIC_PROVIDER_NATIVE_TOOL_NAMES = [
2
+ "web_fetch",
3
+ "web_search",
4
+ ];
5
+ function resolveHostedProvider(model) {
6
+ if (!model) {
7
+ return undefined;
8
+ }
9
+ const [provider, second] = model.split("/", 3);
10
+ if (!provider) {
11
+ return undefined;
12
+ }
13
+ if (provider === "veryfront-cloud") {
14
+ return second || undefined;
15
+ }
16
+ return provider;
17
+ }
18
+ function resolveProvider(options) {
19
+ if (options?.provider && options.provider.length > 0) {
20
+ return options.provider;
21
+ }
22
+ return resolveHostedProvider(options?.model);
23
+ }
24
+ export function getProviderNativeToolNames(options) {
25
+ switch (resolveProvider(options)) {
26
+ case "anthropic":
27
+ return [...ANTHROPIC_PROVIDER_NATIVE_TOOL_NAMES];
28
+ default:
29
+ return [];
30
+ }
31
+ }
32
+ export function expandAllowedRemoteToolNames(options) {
33
+ return [
34
+ ...new Set([
35
+ ...options.toolNames,
36
+ ...getProviderNativeToolNames(options),
37
+ ]),
38
+ ].sort();
39
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"model-tool-converter.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/model-tool-converter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAW9D,MAAM,WAAW,iCAAiC;IAChD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC7B;AAmCD;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,cAAc,EAAE,EACvB,OAAO,CAAC,EAAE,iCAAiC,GAC1C,cAAc,GAAG,SAAS,CAwB5B"}
1
+ {"version":3,"file":"model-tool-converter.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/model-tool-converter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAW9D,MAAM,WAAW,iCAAiC;IAChD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC7B;AA8BD;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,cAAc,EAAE,EACvB,OAAO,CAAC,EAAE,iCAAiC,GAC1C,cAAc,GAAG,SAAS,CAwB5B"}
@@ -1,27 +1,25 @@
1
+ import { getProviderNativeToolNames } from "../provider-native-tool-inventory.js";
1
2
  import { addRuntimeTool, createRuntimeJsonSchema, createRuntimeTool, } from "./runtime-tool-builder.js";
2
3
  import { createAnthropicWebFetchToolSet, createAnthropicWebSearchToolSet, } from "./provider-native-tools.js";
3
- function resolveHostedProvider(model) {
4
- if (!model)
5
- return undefined;
6
- const [provider, second] = model.split("/", 3);
7
- if (!provider)
8
- return undefined;
9
- if (provider === "veryfront-cloud") {
10
- return second || undefined;
11
- }
12
- return provider;
13
- }
14
4
  function resolveProviderNativeTools(options) {
15
- if (!options?.allowedToolNames?.some((toolName) => toolName === "web_search" || toolName === "web_fetch")) {
5
+ const providerNativeToolNames = new Set(getProviderNativeToolNames({
6
+ model: options?.model,
7
+ }));
8
+ if (providerNativeToolNames.size === 0) {
16
9
  return undefined;
17
10
  }
18
- if (resolveHostedProvider(options.model) !== "anthropic") {
11
+ const allowedProviderNativeToolNames = options?.allowedToolNames?.filter((toolName) => providerNativeToolNames.has(toolName)) ?? [];
12
+ if (allowedProviderNativeToolNames.length === 0) {
19
13
  return undefined;
20
14
  }
21
- return {
22
- ...createAnthropicWebSearchToolSet(),
23
- ...createAnthropicWebFetchToolSet(),
24
- };
15
+ const toolSet = {};
16
+ if (allowedProviderNativeToolNames.includes("web_search")) {
17
+ Object.assign(toolSet, createAnthropicWebSearchToolSet());
18
+ }
19
+ if (allowedProviderNativeToolNames.includes("web_fetch")) {
20
+ Object.assign(toolSet, createAnthropicWebFetchToolSet());
21
+ }
22
+ return Object.keys(toolSet).length > 0 ? toolSet : undefined;
25
23
  }
26
24
  /**
27
25
  * Convert veryfront tool definitions to the current model-runtime ToolSet.
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.1.187";
1
+ export declare const VERSION = "0.1.188";
2
2
  //# sourceMappingURL=version-constant.d.ts.map
@@ -1,3 +1,3 @@
1
1
  // Keep in sync with deno.json version.
2
2
  // scripts/release.ts updates this constant during releases.
3
- export const VERSION = "0.1.187";
3
+ export const VERSION = "0.1.188";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "veryfront",
3
- "version": "0.1.187",
3
+ "version": "0.1.188",
4
4
  "description": "The simplest way to build AI-powered apps",
5
5
  "keywords": [
6
6
  "react",
package/src/deno.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  "name": "veryfront",
3
- "version": "0.1.187",
3
+ "version": "0.1.188",
4
4
  "license": "Apache-2.0",
5
5
  "nodeModulesDir": "auto",
6
6
  "exclude": [
@@ -200,6 +200,25 @@ function createStepEvent(
200
200
  };
201
201
  }
202
202
 
203
+ function createReasoningEvent(
204
+ state: AgUiBrowserEncoderState,
205
+ event: AgUiRuntimeStreamEvent,
206
+ type: "ReasoningMessageStart" | "ReasoningMessageContent" | "ReasoningMessageEnd",
207
+ ): AgUiBrowserEncodedEvent {
208
+ const messageId = getReasoningMessageId(state, event);
209
+ return {
210
+ event: type,
211
+ payload: type === "ReasoningMessageStart"
212
+ ? { messageId, role: "reasoning" }
213
+ : type === "ReasoningMessageContent"
214
+ ? {
215
+ messageId,
216
+ delta: typeof event.delta === "string" ? event.delta : "",
217
+ }
218
+ : { messageId },
219
+ };
220
+ }
221
+
203
222
  export function mapRuntimeStreamEventToAgUiBrowserEvents(
204
223
  state: AgUiBrowserEncoderState,
205
224
  event: AgUiRuntimeStreamEvent,
@@ -261,28 +280,16 @@ export function mapRuntimeStreamEventToAgUiBrowserEvents(
261
280
 
262
281
  case "reasoning-start":
263
282
  state.sawVisibleOutput = true;
264
- return [{
265
- event: "ReasoningMessageStart",
266
- payload: { messageId: getReasoningMessageId(state, event), role: "reasoning" },
267
- }];
283
+ return [createReasoningEvent(state, event, "ReasoningMessageStart")];
268
284
 
269
285
  case "reasoning-delta":
270
286
  state.sawVisibleOutput = true;
271
- return [{
272
- event: "ReasoningMessageContent",
273
- payload: {
274
- messageId: getReasoningMessageId(state, event),
275
- delta: typeof event.delta === "string" ? event.delta : "",
276
- },
277
- }];
287
+ return [createReasoningEvent(state, event, "ReasoningMessageContent")];
278
288
 
279
289
  case "reasoning-end": {
280
- const messageId = getReasoningMessageId(state, event);
290
+ const reasoningEvent = createReasoningEvent(state, event, "ReasoningMessageEnd");
281
291
  state.reasoningMessageId = null;
282
- return [{
283
- event: "ReasoningMessageEnd",
284
- payload: { messageId },
285
- }];
292
+ return [reasoningEvent];
286
293
  }
287
294
 
288
295
  case "tool-input-start":
@@ -160,6 +160,11 @@ export {
160
160
  finalizeAgUiBrowserEvents,
161
161
  mapRuntimeStreamEventToAgUiBrowserEvents,
162
162
  } from "./ag-ui-browser-encoder.js";
163
+ export {
164
+ expandAllowedRemoteToolNames,
165
+ getProviderNativeToolNames,
166
+ type ProviderNativeToolInventoryOptions,
167
+ } from "./provider-native-tool-inventory.js";
163
168
  export {
164
169
  type AgUiCancelHandlerOptions,
165
170
  type AgUiResumeHandlerOptions,
@@ -0,0 +1,60 @@
1
+ const ANTHROPIC_PROVIDER_NATIVE_TOOL_NAMES = [
2
+ "web_fetch",
3
+ "web_search",
4
+ ] as const;
5
+
6
+ export interface ProviderNativeToolInventoryOptions {
7
+ model?: string;
8
+ provider?: string;
9
+ }
10
+
11
+ interface ExpandAllowedRemoteToolNamesOptions extends ProviderNativeToolInventoryOptions {
12
+ toolNames: readonly string[];
13
+ }
14
+
15
+ function resolveHostedProvider(model?: string): string | undefined {
16
+ if (!model) {
17
+ return undefined;
18
+ }
19
+
20
+ const [provider, second] = model.split("/", 3);
21
+ if (!provider) {
22
+ return undefined;
23
+ }
24
+
25
+ if (provider === "veryfront-cloud") {
26
+ return second || undefined;
27
+ }
28
+
29
+ return provider;
30
+ }
31
+
32
+ function resolveProvider(options?: ProviderNativeToolInventoryOptions): string | undefined {
33
+ if (options?.provider && options.provider.length > 0) {
34
+ return options.provider;
35
+ }
36
+
37
+ return resolveHostedProvider(options?.model);
38
+ }
39
+
40
+ export function getProviderNativeToolNames(
41
+ options?: ProviderNativeToolInventoryOptions,
42
+ ): string[] {
43
+ switch (resolveProvider(options)) {
44
+ case "anthropic":
45
+ return [...ANTHROPIC_PROVIDER_NATIVE_TOOL_NAMES];
46
+ default:
47
+ return [];
48
+ }
49
+ }
50
+
51
+ export function expandAllowedRemoteToolNames(
52
+ options: ExpandAllowedRemoteToolNamesOptions,
53
+ ): string[] {
54
+ return [
55
+ ...new Set([
56
+ ...options.toolNames,
57
+ ...getProviderNativeToolNames(options),
58
+ ]),
59
+ ].sort();
60
+ }
@@ -7,6 +7,7 @@
7
7
  * @module agent/runtime/model-tool-converter
8
8
  */
9
9
  import type { ToolDefinition } from "../../tool/index.js";
10
+ import { getProviderNativeToolNames } from "../provider-native-tool-inventory.js";
10
11
  import type { RuntimeToolSet } from "./runtime-tool-types.js";
11
12
  import {
12
13
  addRuntimeTool,
@@ -23,37 +24,32 @@ export interface ConvertToolsToRuntimeToolsOptions {
23
24
  allowedToolNames?: string[];
24
25
  }
25
26
 
26
- function resolveHostedProvider(model?: string): string | undefined {
27
- if (!model) return undefined;
28
-
29
- const [provider, second] = model.split("/", 3);
30
- if (!provider) return undefined;
31
- if (provider === "veryfront-cloud") {
32
- return second || undefined;
33
- }
34
-
35
- return provider;
36
- }
37
-
38
27
  function resolveProviderNativeTools(
39
28
  options?: ConvertToolsToRuntimeToolsOptions,
40
29
  ): RuntimeToolSet | undefined {
41
- if (
42
- !options?.allowedToolNames?.some((toolName) =>
43
- toolName === "web_search" || toolName === "web_fetch"
44
- )
45
- ) {
30
+ const providerNativeToolNames = new Set(getProviderNativeToolNames({
31
+ model: options?.model,
32
+ }));
33
+
34
+ if (providerNativeToolNames.size === 0) {
46
35
  return undefined;
47
36
  }
48
37
 
49
- if (resolveHostedProvider(options.model) !== "anthropic") {
38
+ const allowedProviderNativeToolNames =
39
+ options?.allowedToolNames?.filter((toolName) => providerNativeToolNames.has(toolName)) ?? [];
40
+ if (allowedProviderNativeToolNames.length === 0) {
50
41
  return undefined;
51
42
  }
52
43
 
53
- return {
54
- ...createAnthropicWebSearchToolSet(),
55
- ...createAnthropicWebFetchToolSet(),
56
- };
44
+ const toolSet: RuntimeToolSet = {};
45
+ if (allowedProviderNativeToolNames.includes("web_search")) {
46
+ Object.assign(toolSet, createAnthropicWebSearchToolSet());
47
+ }
48
+ if (allowedProviderNativeToolNames.includes("web_fetch")) {
49
+ Object.assign(toolSet, createAnthropicWebFetchToolSet());
50
+ }
51
+
52
+ return Object.keys(toolSet).length > 0 ? toolSet : undefined;
57
53
  }
58
54
 
59
55
  /**
@@ -1,3 +1,3 @@
1
1
  // Keep in sync with deno.json version.
2
2
  // scripts/release.ts updates this constant during releases.
3
- export const VERSION = "0.1.187";
3
+ export const VERSION = "0.1.188";