fix(context-blocks): XML sanitization, size limits, and naming#143
fix(context-blocks): XML sanitization, size limits, and naming#143
Conversation
Add contextBlocks field to RepoConfig — a Record<string, string> mapping block names to resolved file paths. Relative paths are resolved against REPO_PATH, absolute paths pass through unchanged. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Returns { [name]: { path, sizeBytes } } for each configured context
block. Size computed via statSync (0 if file not found).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add contextBlocks to WS SendMessage and InterruptMessage schemas - Extend assemblePrompt() to read context block files, wrap in <context> tags with preamble, and separate with ---CONTEXT_END--- - Gracefully skips unknown names and missing files Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ptChat Pass contextBlocks from WS messages through to assemblePrompt at all call sites — skill resolution, passthrough, and interrupt paths. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Store context block names on user messages for UI display. The USER_SEND reducer action now accepts contextNames which are preserved on the FinishedMessage for rendering in the user bubble. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- ContextPicker: multi-select dropdown triggered by @ button, fetches available blocks from /api/config, shows name + file size - ChatInput: @ button in command strip, context pills row above textarea, contextBlocks passed through onSend/onInterrupt and cleared after send - UserBubble: compact "@ Name1, Name2" line when context was attached - ChatView: wires contextBlocks into WS payload and USER_SEND dispatch Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ming - Escape XML-unsafe characters in context block name/source attributes - Truncate context block files exceeding 100 KB with warning - Remove no-op handleToggle useCallback wrapper in ContextPicker - Dispatch USER_SEND on interrupt so context annotation shows in bubble - Rename contextNames → contextBlocks across all frontend files - Add tests for XML-unsafe names and size limit truncation Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Centaur ReviewFound 57 issue(s) (3 critical) (26 warning).
|
|
Already merged to main — all commits including the polish (XML sanitization, size limits) were cherry-picked. |
|
Centaur has opened PR #147 with fixes for the flagged issues. |
Summary
&,",<,>)Builds on #118 with hardening that wasn't included in the initial merge.
Test plan
🤖 Generated with Claude Code