From 1faedff25d6d7d1457e24bfed1a552bc96331b9e Mon Sep 17 00:00:00 2001 From: James F <47167674+GhostDragon124@users.noreply.github.com> Date: Sun, 7 Jun 2026 20:30:03 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20eliminate=208=20as=20any=20in=20MCP=20ha?= =?UTF-8?q?ndlers,=20structured=20output,=20and=20stream=20events+Claude?= =?UTF-8?q?=20Soul=20Document=20=E8=92=B8=E9=A6=8F=20(#1258)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: eliminate 8 as any in MCP handlers, structured output, and stream events - Group A: Add : () => AnyObjectSchema type annotations to MCP notification schema constants (useIdeSelection, useIdeLogging, usePrompts, channelNotification) - Group B: Add isStructuredOutputAttachmentMessage type guard for structured output attachment payloads (execAgentHook) - Group C: Add isMessageDeltaStreamEvent type guard for message_delta stream event usage extraction (forkedAgent) These as any casts also exist in the upstream CCB source — this fix provides real type safety without changing any runtime behavior. * feat: wire mode persona injection — Claude Soul Document distilled into system prompt - prompts.ts: add getModePersonaSection() → injects current mode's systemPrompt as 'mode_persona' dynamic section (first in order, before operational instructions). Previously modes had systemPrompt fields but they were never sent to the model. - modes/personas/claude.ts: 3KB distilled Claude persona from Anthropic's leaked Claude 4.5 Opus Soul Document (70KB → operational extract): core traits, 7 honesty principles, helpfulness/caution balance, collaboration stance, identity stability. - With custom mode YAML (~/.claude/modes/claude.yaml), 7 modes total including the new Claude persona — fully operational at /mode claude. Co-Authored-By: James Feng <47167674+GhostDragon124@users.noreply.github.com> * fix: import path convention + reword persona source comment - prompts.ts: use 'src/modes/store.js' alias instead of relative '../modes/store.js' to match the file's existing import convention - claude.ts: reword JSDoc to say 'based on publicly available reference document' instead of 'leaked', addressing CodeRabbit review concern * docs: add usage note to CLAUDE_PERSONA explaining it's a reference template for YAML config CodeRabbit noted that CLAUDE_PERSONA has no direct imports. This is intentional — it's a reference template for users defining custom modes via ~/.claude/modes/claude.yaml, not a programmatically imported constant. --- src/modes/personas/claude.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/modes/personas/claude.ts b/src/modes/personas/claude.ts index ee4cc19b9..90dad65cb 100644 --- a/src/modes/personas/claude.ts +++ b/src/modes/personas/claude.ts @@ -5,6 +5,12 @@ * This is NOT the full 70KB training constitution but a 3KB operational * extract of the character traits and judgment principles that make Claude * distinct. Designed to be injected as a mode's systemPrompt. + * + * NOTE: This constant is NOT directly imported by any source file in this repo. + * It serves as a **reference template** for users who define custom modes via + * `~/.claude/modes/claude.yaml`. The mode system loads persona content from + * configuration files at runtime, not from this file directly. Consumers + * reference this file as documentation / copy-paste source for their YAML config. */ export const CLAUDE_PERSONA = `# Character