From 65195abbe070b6e1b6dff9ac80efe0c0c99ce055 Mon Sep 17 00:00:00 2001 From: DrSmoothl <1787882683@qq.com> Date: Tue, 30 Jun 2026 18:45:34 +0800 Subject: [PATCH] fix(mcp): add role/stream to Catalog types to match generated catalog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Phase 0 added `role` to FieldDoc and `stream` to ActionDoc and regenerated catalog.ts, but the mcp package's own CatalogParam/CatalogAction types (intentionally decoupled from onebot per ADR-0005) weren't updated — so `tsc --noEmit` failed on the generated catalog.ts (TS2353, unknown properties role/stream). The mcp vitest suite passed because esbuild doesn't type-check the generated snapshot, which is why this slipped. CatalogParam gains role?: string (loose, to stay decoupled from onebot's FieldRole union); CatalogAction gains stream?: boolean. `pnpm typecheck` is green across all packages. --- packages/mcp/src/types.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/mcp/src/types.ts b/packages/mcp/src/types.ts index 96b2c9da..ed431e5b 100644 --- a/packages/mcp/src/types.ts +++ b/packages/mcp/src/types.ts @@ -11,6 +11,11 @@ export interface CatalogParam { default?: unknown; desc?: string; values?: ReadonlyArray; + /** Semantic role (group_id / user_id / member_id / image / face_id / …), + * orthogonal to `type`; drives smart-widget selection in the WebUI console. + * Kept as a loose string here so the package stays decoupled from onebot's + * FieldRole union. */ + role?: string; /** JSON Schema fragment for this single field. */ schema?: Record; } @@ -27,6 +32,9 @@ export interface CatalogAction { * read/write tool routing: read-only → query_action, else → invoke_action. * Classified at the source spec by what the action's `run` actually does. */ readOnly: boolean; + /** True for Stream API actions (multi-frame transport). Absent ⇒ ordinary + * single-response action. */ + stream?: boolean; params: CatalogParam[]; /** Cross-field invariants, e.g. "exactly one of: message_id | (group_id+user_id)". */ invariants: string[];