From 6bad368dcb82aac4c107beb522e797a9e5f37f04 Mon Sep 17 00:00:00 2001 From: diegosouzapw Date: Wed, 27 May 2026 21:48:50 -0300 Subject: [PATCH] feat(a2a): add list-capabilities skill with markdown table of 42 skills MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implements executeListCapabilities() which calls getCatalog() + computeCoverage() from the agentSkills catalog (F1/F2) and returns a markdown table covering all 42 skills (22 API + 20 CLI) with ID, name, category, area, endpoints/commands, and raw SKILL.md URL, matching the §3.7 result contract. --- src/lib/a2a/skills/listCapabilities.ts | 72 ++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 src/lib/a2a/skills/listCapabilities.ts diff --git a/src/lib/a2a/skills/listCapabilities.ts b/src/lib/a2a/skills/listCapabilities.ts new file mode 100644 index 0000000000..7520a6d3b5 --- /dev/null +++ b/src/lib/a2a/skills/listCapabilities.ts @@ -0,0 +1,72 @@ +/** + * A2A Skill: List Capabilities + * + * Returns the full catalog of 42 OmniRoute agent skills (22 API + 20 CLI) + * as a markdown table with raw SKILL.md URLs for orchestrating agents. + */ + +import type { A2ATask, TaskArtifact } from "../taskManager"; +import { getCatalog, computeCoverage } from "@/lib/agentSkills/catalog"; +import type { AgentSkill } from "@/lib/agentSkills/types"; + +export interface ListCapabilitiesResult { + artifacts: TaskArtifact[]; + metadata: { + coverage: { + api: { have: number; total: 22 }; + cli: { have: number; total: 20 }; + }; + totalSkills: 42; + generatedAt: string; + source: "agent-skills-catalog"; + }; +} + +function buildMarkdownTable(skills: AgentSkill[]): string { + const header = "| ID | Name | Category | Area | Endpoints/Commands | Raw URL |"; + const separator = "| --- | --- | --- | --- | --- | --- |"; + + const rows = skills.map((skill) => { + const endpointsOrCommands = + skill.category === "api" + ? (skill.endpoints ?? []).join(", ") || "—" + : (skill.cliCommands ?? []).join(", ") || "—"; + + return `| ${skill.id} | ${skill.name} | ${skill.category} | ${skill.area} | ${endpointsOrCommands} | ${skill.rawUrl} |`; + }); + + return [header, separator, ...rows].join("\n"); +} + +export async function executeListCapabilities(_task: A2ATask): Promise { + const catalog = getCatalog(); + const coverage = computeCoverage(); + + const table = buildMarkdownTable(catalog); + + const content = [ + `# OmniRoute Agent Skills Catalog`, + ``, + `Total: ${catalog.length} skills (${coverage.api.total} API + ${coverage.cli.total} CLI)`, + ``, + table, + ].join("\n"); + + return { + artifacts: [ + { + type: "text", + content, + }, + ], + metadata: { + coverage: { + api: { have: coverage.api.have, total: 22 }, + cli: { have: coverage.cli.have, total: 20 }, + }, + totalSkills: 42, + generatedAt: coverage.generatedAt, + source: "agent-skills-catalog", + }, + }; +}