Skip to content

Commit 43b7692

Browse files
fix(cli): support nested tools and strict flag for openai-compatible providers
This fixes the CLI equivalent of anomalyco#11171, where tool.name was undefined for nested tool objects. A patch is applied to the underlying @ai-sdk/openai-compatible package.
1 parent 8b99648 commit 43b7692

3 files changed

Lines changed: 47 additions & 1 deletion

File tree

‎bun.lock‎

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@
106106
},
107107
"patchedDependencies": {
108108
"@standard-community/[email protected]": "patches/@standard-community%[email protected]",
109-
"@openrouter/[email protected]": "patches/@openrouter%[email protected]"
109+
"@openrouter/[email protected]": "patches/@openrouter%[email protected]",
110+
"@ai-sdk/[email protected]": "patches/@ai-sdk%[email protected]"
110111
}
111112
}

‎patches/@ai-sdk%[email protected]‎

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
diff --git a/dist/index.js b/dist/index.js
2+
index 210819172d611c64900564de97c1f23c5f5c132f..e8ea9508ba7aa21bc3c10bab4b4b9ae2d9295ae5 100644
3+
--- a/dist/index.js
4+
+++ b/dist/index.js
5+
@@ -243,12 +243,14 @@ function prepareTools({
6+
if (tool.type === "provider-defined") {
7+
toolWarnings.push({ type: "unsupported-tool", tool });
8+
} else {
9+
+ const t = tool.function ?? tool;
10+
openaiCompatTools.push({
11+
type: "function",
12+
function: {
13+
- name: tool.name,
14+
- description: tool.description,
15+
- parameters: tool.inputSchema
16+
+ name: t.name,
17+
+ description: t.description,
18+
+ parameters: t.parameters ?? t.inputSchema,
19+
+ strict: t.strict,
20+
}
21+
});
22+
}
23+
diff --git a/dist/index.mjs b/dist/index.mjs
24+
index e6f9923d1d91f832d8a15d126b900a7f5303d767..0c4fa435598166d34666b370e1a99037f6541766 100644
25+
--- a/dist/index.mjs
26+
+++ b/dist/index.mjs
27+
@@ -227,12 +227,14 @@ function prepareTools({
28+
if (tool.type === "provider-defined") {
29+
toolWarnings.push({ type: "unsupported-tool", tool });
30+
} else {
31+
+ const t = tool.function ?? tool;
32+
openaiCompatTools.push({
33+
type: "function",
34+
function: {
35+
- name: tool.name,
36+
- description: tool.description,
37+
- parameters: tool.inputSchema
38+
+ name: t.name,
39+
+ description: t.description,
40+
+ parameters: t.parameters ?? t.inputSchema,
41+
+ strict: t.strict,
42+
}
43+
});
44+
}

0 commit comments

Comments
 (0)