fix(mcp): add role/stream to Catalog types to match generated catalog

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.
This commit is contained in:
DrSmoothl committed 2026-06-30 18:45:34 +08:00
1 parent d5fbd6fa06
commit 65195abbe0
1 file changed
+8
+8
View File
@@ -11,6 +11,11 @@ export interface CatalogParam {
default?: unknown;
desc?: string;
values?: ReadonlyArray<string | number>;
/** 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<string, unknown>;
}
@@ -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[];