You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add experimental Shielded Terminal for API key masking in VS Code
Add a Shielded Terminal (Pseudoterminal + node-pty proxy) that masks
API keys in terminal output before rendering. Designed to work with
Claude Code and other CLI tools during demos/livestreams.
Key technical decisions:
- DEC 2026 sync block buffering: Claude Code wraps each Ink render in
\x1b[?2026h...\x1b[?2026l. Buffer entire sync blocks before masking
to ensure keys split across PTY chunks are fully assembled.
- ANSI + whitespace stripping for matching: Ink inserts \r\n + indent
spaces when word-wrapping long keys. Strip ALL whitespace alongside
ANSI codes for regex matching, preserve structural chars in output.
- node-pty triple fallback: system → VS Code internal (asar) → VS Code
internal (plain). Falls back to child_process line-mode terminal.
Features:
- 25 built-in terminal patterns (OpenAI, Anthropic, GitHub, AWS, etc.)
- Ctrl+Shift+T or Command Palette → "Open Shielded Terminal"
- "Open Terminal With Command" (default: claude)
- Opens as editor tab (TerminalLocation.Editor)
- Shield always ON by default, syncs with Demo Mode
- Pattern updates from Core via IPC reflected in real-time
Known limitations (marked experimental):
- Rewind confirmation page may show partial key tail
- node-pty required for full PTY features (tab completion, colors)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: CLAUDE.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -103,6 +103,9 @@ These are absolute rules — never violate them:
103
103
-**Clipboard capture whitespace stripping**: `detectKeysInClipboard()` strips all whitespace and newlines from clipboard content before pattern matching (`components(separatedBy: .whitespacesAndNewlines).joined()`). API keys never contain spaces, but clipboard copy may introduce line breaks from word-wrap.
104
104
-**Clipboard capture built-in patterns**: `ClipboardEngine.builtInCapturePatterns` contains 22 well-known API key patterns (OpenAI, Anthropic, GitHub, AWS, Google, Stripe, etc.) for detecting NEW keys not yet in the vault. This is separate from `patternCacheEntries()` which only matches stored keys.
105
105
-**NSAlert in menu bar app**: Must call `alert.layout()` then set `alert.window.level = .floating` + `orderFrontRegardless()` before `runModal()`. Without this, the alert either doesn't appear or creates a dock icon. Do NOT use `setActivationPolicy(.regular)`.
106
+
-**Terminal masking sync block buffering** (experimental): Shielded Terminal buffers PTY output by detecting DEC 2026 sync block markers (`\x1b[?2026h`/`\x1b[?2026l`). Complete sync blocks are masked atomically. Non-sync data uses 30ms timeout buffer. This matches claude-chill's approach.
107
+
-**Terminal masking ANSI-aware matching**: `maskTerminalOutput()` strips ANSI escape codes AND all whitespace (spaces, tabs, newlines) before regex matching. Ink word-wraps long keys with `\r\n` + indentation; stripping all whitespace allows regex to match keys across visual line breaks. Structural characters (ANSI + whitespace) within matched ranges are preserved in output via `extractStructural()`.
0 commit comments