operon-agents-core 0.1.0-alpha.13 → 0.1.0-alpha.14
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.
|
@@ -12,6 +12,13 @@ import type { Api } from "../protocol/index.ts";
|
|
|
12
12
|
* API is reached here only by Claude models, which take the native `tool_addition` path.
|
|
13
13
|
*/
|
|
14
14
|
export declare const OPENROUTER_TOOL_SEARCH = "openrouter:tool_search";
|
|
15
|
+
/**
|
|
16
|
+
* Tools one search may reveal. OpenRouter's default is 5 (cap 50), and a model reads a
|
|
17
|
+
* truncated page as the whole catalog: asked for Linear with 157 deferred tools, it got the
|
|
18
|
+
* five attachment tools back and concluded `list_issues` did not exist. 20 covers a typical
|
|
19
|
+
* MCP server's matches; a revealed tool costs input tokens only once it is found.
|
|
20
|
+
*/
|
|
21
|
+
export declare const OPENROUTER_TOOL_SEARCH_MAX_RESULTS = 20;
|
|
15
22
|
export declare function supportsOpenRouterToolSearch(model: Model<Api>): boolean;
|
|
16
23
|
/** Mark `deferred` function tools and add the search tool at pi's public payload seam. */
|
|
17
24
|
export declare function withOpenRouterToolSearch(options: ModelsSimpleStreamOptions, deferred: ReadonlySet<string>): ModelsSimpleStreamOptions;
|
|
@@ -10,6 +10,13 @@
|
|
|
10
10
|
* API is reached here only by Claude models, which take the native `tool_addition` path.
|
|
11
11
|
*/
|
|
12
12
|
export const OPENROUTER_TOOL_SEARCH = "openrouter:tool_search";
|
|
13
|
+
/**
|
|
14
|
+
* Tools one search may reveal. OpenRouter's default is 5 (cap 50), and a model reads a
|
|
15
|
+
* truncated page as the whole catalog: asked for Linear with 157 deferred tools, it got the
|
|
16
|
+
* five attachment tools back and concluded `list_issues` did not exist. 20 covers a typical
|
|
17
|
+
* MCP server's matches; a revealed tool costs input tokens only once it is found.
|
|
18
|
+
*/
|
|
19
|
+
export const OPENROUTER_TOOL_SEARCH_MAX_RESULTS = 20;
|
|
13
20
|
export function supportsOpenRouterToolSearch(model) {
|
|
14
21
|
return model.api === "openai-responses" && isOpenRouter(model.baseUrl);
|
|
15
22
|
}
|
|
@@ -42,7 +49,7 @@ export function withOpenRouterToolSearch(options, deferred) {
|
|
|
42
49
|
// OpenRouter rejects a deferred tool without the search tool, and the search tool
|
|
43
50
|
// with nothing to search is only noise.
|
|
44
51
|
if (marked)
|
|
45
|
-
next = { ...payload, tools: [{ type: OPENROUTER_TOOL_SEARCH }, ...tools] };
|
|
52
|
+
next = { ...payload, tools: [{ type: OPENROUTER_TOOL_SEARCH, parameters: { max_results: OPENROUTER_TOOL_SEARCH_MAX_RESULTS } }, ...tools] };
|
|
46
53
|
}
|
|
47
54
|
return (await inspect?.(next, model)) ?? next;
|
|
48
55
|
},
|