@opencode/codemode 0.0.0-dev-1286 → 0.0.0-dev-1289
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/dist/tool-runtime.js +14 -1
- package/package.json +1 -1
package/dist/tool-runtime.js
CHANGED
|
@@ -397,7 +397,20 @@ const resolve = (root, path, index) => {
|
|
|
397
397
|
: `Unknown tool '${name}'.`, ["Use search to find available tools."]);
|
|
398
398
|
}
|
|
399
399
|
if (node.tool === undefined) {
|
|
400
|
-
|
|
400
|
+
const name = segments.join(".");
|
|
401
|
+
const under = index.filter((entry) => entry.description.path.startsWith(`${name}.`));
|
|
402
|
+
const ranked = rank(under, segments.at(-1) ?? "", index);
|
|
403
|
+
const shown = [...ranked, ...under.filter((entry) => !ranked.includes(entry))]
|
|
404
|
+
.slice(0, 3)
|
|
405
|
+
.map((entry) => toolExpression(entry.description.path));
|
|
406
|
+
const more = under.length - shown.length;
|
|
407
|
+
throw new ToolRuntimeError("UnknownTool", shown.length === 0
|
|
408
|
+
? `Tool '${name}' is not callable.`
|
|
409
|
+
: `Tool '${name}' is not callable, it is a namespace. Did you mean ${new Intl.ListFormat("en", { type: "disjunction" }).format(shown)}?`, [
|
|
410
|
+
more > 0
|
|
411
|
+
? `${more} more under '${name}'. Use search({ namespace: ${JSON.stringify(name)} }) to list them.`
|
|
412
|
+
: "Use search to find available tools.",
|
|
413
|
+
]);
|
|
401
414
|
}
|
|
402
415
|
return node.tool;
|
|
403
416
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@opencode/codemode",
|
|
4
|
-
"version": "0.0.0-dev-
|
|
4
|
+
"version": "0.0.0-dev-1289",
|
|
5
5
|
"description": "Effect-native confined code execution over schema-described tools",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"license": "MIT",
|