Reverse engineer anything with agents, from app behavior down to native binaries.
TypeScript agent-skillsai-agentsbinary-analysisclaude-codeclicodexcordisdecompilerdeveloper-toolsdshdsh-pluginghidrahopperllmmcpmodel-context-protocolreareverse-engineeringstatic-analysistouhou
fix(mcp): cover prompt objectives in catalog identity
morlutob57a054d5e77
diff --git a/src/catalogIdentity.ts b/src/catalogIdentity.tsindex 774cfc00f..1d40aad02 100644--- a/src/catalogIdentity.ts+++ b/src/catalogIdentity.ts@@ -4,6 +4,7 @@ import canonicalize from "canonicalize";import { z } from "zod";import { PROMPT_CONTRACTS } from "./contracts/promptContracts.js";+import type { PromptContract } from "./contracts/promptContracts.js";import { TOOL_CONTRACTS } from "./contracts/toolContracts.js";import type { ToolContract } from "./contracts/toolContractTypes.js";import { CLI_COMMAND_NAMES } from "./cliCommandNames.js";@@ -43,13 +44,19 @@ const createToolCatalog = (contracts: readonly ToolContract[]) =>},}));-const promptCatalog = PROMPT_CONTRACTS.map((contract) => ({- name: contract.name,- title: contract.title,- description: contract.description,- arguments: contract.arguments,- steps: contract.steps,-})).sort((left, right) => compareUnicodeCodePoints(left.name, right.name));+const createPromptCatalog = (contracts: readonly PromptContract[]) =>+ contracts+ .map((contract) => ({+ name: contract.name,+ title: contract.title,+ description: contract.description,+ objective: contract.objective,+ arguments: contract.arguments,+ steps: contract.steps,+ }))+ .sort((left, right) => compareUnicodeCodePoints(left.name, right.name));++const promptCatalog = createPromptCatalog(PROMPT_CONTRACTS);const digest = (value: unknown): string => {const encoded = canonicalize(value);@@ -65,15 +72,17 @@ const digest = (value: unknown): string => {*/export const createCatalogDigests = (contracts: readonly ToolContract[] = TOOL_CONTRACTS,+ promptContracts: readonly PromptContract[] = PROMPT_CONTRACTS,) => {const tools = createToolCatalog(sortByName(contracts));+ const prompts = createPromptCatalog(promptContracts);return {tools_sha256: digest(tools),- prompts_sha256: digest(promptCatalog),+ prompts_sha256: digest(prompts),combined_sha256: digest({cli: CLI_COMMAND_NAMES,tools,- prompts: promptCatalog,+ prompts,}),} as const;};diff --git a/tests/boundary/mcp/serverIdentity.test.ts b/tests/boundary/mcp/serverIdentity.test.tsindex 934d0d18f..0a35896fc 100644--- a/tests/boundary/mcp/serverIdentity.test.ts+++ b/tests/boundary/mcp/serverIdentity.test.ts@@ -243,6 +243,26 @@ describe("server and catalog identity", () => {});});+describe("guided prompt catalog identity", () => {+ it("covers each guided prompt's objective in the catalog digest", () => {+ const [first] = PROMPT_CONTRACTS;+ if (first === undefined) throw new Error("expected a prompt contract");+ const changed = PROMPT_CONTRACTS.map((contract) =>+ contract === first+ ? { ...contract, objective: `${contract.objective} changed` }+ : contract,+ );+ const digests = createCatalogDigests(TOOL_CONTRACTS, changed);+ expect(digests.prompts_sha256).not.toBe(+ CATALOG_IDENTITY.digests.prompts_sha256,+ );+ expect(digests.combined_sha256).not.toBe(+ CATALOG_IDENTITY.digests.combined_sha256,+ );+ expect(digests.tools_sha256).toBe(CATALOG_IDENTITY.digests.tools_sha256);+ });+});+describe("live server identity over MCP", () => {it("exposes live identity, a stable catalog, and changing availability", async () => {const session = createTestBinarySession(availabilityProvider());