From 9c7992699fe07738aae2164a08da061babb873cd Mon Sep 17 00:00:00 2001 From: Klappy Date: Fri, 17 Apr 2026 16:46:16 +0000 Subject: [PATCH] fix(registry): expand local tool registry mode enum to all 9 modes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Parallels PR #102 which fixed the same enum in workers/src/index.ts. The local tool registry at src/core/tool-registry.js drives the local MCP server (src/mcp/server.js) and CLI (src/cli.js) and had the same 3-mode enum, creating a contract divergence between the deployment surfaces for the same logical API. Two sites in src/core/tool-registry.js: - Line 47-55 (unified oddkit tool) - Line 113-121 (dedicated oddkit_challenge tool) Both expanded to the full 9-mode enum with description text matching PR #102's style. Mode families explained, voice-dump suppression called out in the dedicated tool description. Sweep verified: grep across src/ and workers/ for the 3-mode string returns only the first line of each 9-mode block now — zero stale enums. Caught by bugbot on PR #103 (the promotion PR for #102). Flagged appropriately as Low severity (the CF Worker surface is the primary production path; the local surface is used for dev/CLI). Fixing in a separate PR so #103 can promote cleanly without rebase. Verification: - npm run typecheck: clean - tests/smoke.sh: 6/6 pass Longer-term (same as #102 flagged): drop enum entirely and let canon be the validator. Hardcoding mode vocabulary in schema is the same Vodka anti-pattern shape challenge stop words used to be. --- src/core/tool-registry.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/core/tool-registry.js b/src/core/tool-registry.js index 18e2892..3368d82 100644 --- a/src/core/tool-registry.js +++ b/src/core/tool-registry.js @@ -46,8 +46,12 @@ Use when: }, mode: { type: "string", - enum: ["exploration", "planning", "execution"], - description: "Optional epistemic mode hint.", + enum: [ + "exploration", "planning", "execution", + "voice-dump", "drafting", "peer-review-ready", + "canon-tier-2", "canon-tier-1", "published-essay", + ], + description: "Optional mode hint. Epistemic modes (exploration/planning/execution) or writing-lifecycle modes (voice-dump/drafting/peer-review-ready/canon-tier-2/canon-tier-1/published-essay). Sourced from odd/challenge/stakes-calibration.", }, canon_url: { type: "string", @@ -107,7 +111,15 @@ export const TOOLS = [ type: "object", properties: { input: { type: "string", description: "A claim, assumption, or proposal to challenge." }, - mode: { type: "string", enum: ["exploration", "planning", "execution"], description: "Optional epistemic mode for proportional challenge." }, + mode: { + type: "string", + enum: [ + "exploration", "planning", "execution", + "voice-dump", "drafting", "peer-review-ready", + "canon-tier-2", "canon-tier-1", "published-essay", + ], + description: "Mode for proportional challenge. Epistemic (exploration/planning/execution) or writing-lifecycle (voice-dump/drafting/peer-review-ready/canon-tier-2/canon-tier-1/published-essay). voice-dump suppresses all challenge output.", + }, canon_url: { type: "string", description: "Optional: GitHub repo URL for canon override." }, }, required: ["input"],