add targets field to filter tools per agent harness (pi/claude/all)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -32,6 +32,7 @@ type ToolMeta = {
|
|||||||
label: string;
|
label: string;
|
||||||
description: string;
|
description: string;
|
||||||
inputs: Record<string, ToolParam>;
|
inputs: Record<string, ToolParam>;
|
||||||
|
targets?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
type DiscoveredTool = {
|
type DiscoveredTool = {
|
||||||
@@ -138,6 +139,7 @@ function discoverTools(dirs: string[]): DiscoveredTool[] {
|
|||||||
const { meta } = parseFrontmatter(content);
|
const { meta } = parseFrontmatter(content);
|
||||||
|
|
||||||
if (!meta.name || !meta.description) continue;
|
if (!meta.name || !meta.description) continue;
|
||||||
|
if ((meta.targets as string ?? 'all') === 'pi') continue;
|
||||||
if (seen.has(meta.name)) continue;
|
if (seen.has(meta.name)) continue;
|
||||||
seen.add(meta.name);
|
seen.add(meta.name);
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ type MarketplaceTool = {
|
|||||||
body: string;
|
body: string;
|
||||||
version: number;
|
version: number;
|
||||||
language: string;
|
language: string;
|
||||||
|
targets: string;
|
||||||
inputs: Record<string, ToolInput>;
|
inputs: Record<string, ToolInput>;
|
||||||
implementation: string;
|
implementation: string;
|
||||||
};
|
};
|
||||||
@@ -37,6 +38,9 @@ function buildToolMd(tool: MarketplaceTool): string {
|
|||||||
lines.push(`description: ${tool.description}`);
|
lines.push(`description: ${tool.description}`);
|
||||||
lines.push(`version: ${tool.version}`);
|
lines.push(`version: ${tool.version}`);
|
||||||
lines.push(`language: ${tool.language}`);
|
lines.push(`language: ${tool.language}`);
|
||||||
|
if (tool.targets && tool.targets !== 'all') {
|
||||||
|
lines.push(`targets: ${tool.targets}`);
|
||||||
|
}
|
||||||
|
|
||||||
if (tool.inputs && Object.keys(tool.inputs).length > 0) {
|
if (tool.inputs && Object.keys(tool.inputs).length > 0) {
|
||||||
lines.push('inputs:');
|
lines.push('inputs:');
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ type ToolMeta = {
|
|||||||
description: string;
|
description: string;
|
||||||
language: 'typescript' | 'bash' | 'python';
|
language: 'typescript' | 'bash' | 'python';
|
||||||
inputs: Record<string, ToolParam>;
|
inputs: Record<string, ToolParam>;
|
||||||
|
targets?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
function parseFrontmatter(content: string): { meta: Partial<ToolMeta>; body: string } {
|
function parseFrontmatter(content: string): { meta: Partial<ToolMeta>; body: string } {
|
||||||
@@ -171,6 +172,8 @@ function discoverTools(dir: string): Array<{ toolDir: string; entryFile: string;
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((meta.targets as string ?? 'all') === 'claude') continue;
|
||||||
|
|
||||||
discovered.push({ toolDir, entryFile, meta: meta as ToolMeta });
|
discovered.push({ toolDir, entryFile, meta: meta as ToolMeta });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user