@compilr-dev/sdk 0.1.24 → 0.1.25
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.
|
@@ -97,6 +97,7 @@ export declare class MetaToolsRegistry {
|
|
|
97
97
|
}
|
|
98
98
|
/**
|
|
99
99
|
* Create the three meta-tools + fallback handler, all bound to a registry instance.
|
|
100
|
+
* Pass FallbackOptions to enable auto-loading in both use_tool and createFallback paths.
|
|
100
101
|
*/
|
|
101
|
-
export declare function createMetaTools(registry: MetaToolsRegistry): MetaTools;
|
|
102
|
+
export declare function createMetaTools(registry: MetaToolsRegistry, options?: FallbackOptions): MetaTools;
|
|
102
103
|
export declare const META_TOOLS_SYSTEM_PROMPT_PREFIX = "\n## Tool Index (Specialized Tools)\n\nThese tools are called **exactly like direct tools** \u2014 just use the tool name with parameters. No special syntax or wrapper needed. The system routes them automatically.\n\n**IMPORTANT \u2014 These are CLI system tools, NOT your project's backend. Never use localhost/curl to access them.**\n\n**Parameter Rules:**\n- For **zero-parameter calls**: call the tool directly (e.g., `workitem_query()`, `git_status()`).\n- For **calls WITH parameters**: you MUST call `get_tool_info(\"tool_name\")` first to get parameter details. The signatures below are summaries only \u2014 do NOT guess parameter structure from them.\n- After a failed tool call, always call `get_tool_info()` before retrying.\n\n";
|
|
@@ -143,8 +143,9 @@ export class MetaToolsRegistry {
|
|
|
143
143
|
// =============================================================================
|
|
144
144
|
/**
|
|
145
145
|
* Create the three meta-tools + fallback handler, all bound to a registry instance.
|
|
146
|
+
* Pass FallbackOptions to enable auto-loading in both use_tool and createFallback paths.
|
|
146
147
|
*/
|
|
147
|
-
export function createMetaTools(registry) {
|
|
148
|
+
export function createMetaTools(registry, options) {
|
|
148
149
|
// -------------------------------------------------------------------------
|
|
149
150
|
// list_tools
|
|
150
151
|
// -------------------------------------------------------------------------
|
|
@@ -240,13 +241,16 @@ export function createMetaTools(registry) {
|
|
|
240
241
|
execute: async ({ tool_name, args }) => {
|
|
241
242
|
// 0. Check tool filter
|
|
242
243
|
if (!registry.isToolAllowed(tool_name)) {
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
244
|
+
// Give consumer a chance to load the capability and update the filter
|
|
245
|
+
if (!(options?.onFilteredTool?.(tool_name) && registry.isToolAllowed(tool_name))) {
|
|
246
|
+
const filter = registry.getFilter();
|
|
247
|
+
const allowedTools = filter
|
|
248
|
+
? Array.from(filter).filter((t) => registry.getTool(t) !== undefined)
|
|
249
|
+
: [];
|
|
250
|
+
return createErrorResult(`Tool '${tool_name}' is not available for this agent. ` +
|
|
251
|
+
`Your available meta-registry tools: ${allowedTools.slice(0, 10).join(', ')}${allowedTools.length > 10 ? '...' : ''} ` +
|
|
252
|
+
`Call list_tools() to see all available tools.`);
|
|
253
|
+
}
|
|
250
254
|
}
|
|
251
255
|
// 1. Find the tool
|
|
252
256
|
const tool = registry.getTool(tool_name);
|