mirror of
https://github.com/logancyang/obsidian-copilot.git
synced 2026-07-22 07:50:24 +00:00
* refactor: modular context compaction architecture Split context compaction into focused modules: - contextBlockRegistry: single source of truth for block types - compactionUtils: shared pure functions for truncation/extraction - ChatHistoryCompactor: tool result compaction at memory save time - L2ContextCompactor: L3→L2 context compaction with previews Key changes: - Never compact selected_text (non-recoverable content) - Single consolidated re-fetch instruction at end of L2 context - Write-time compaction via memoryManager.saveContext() - Parse prior_context blocks in segment extraction - Backwards compatibility via re-exports Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: use brace-balanced extraction for readNote JSON parsing The previous regex-based approach stopped at the first closing brace, truncating JSON payloads containing nested braces (e.g., code snippets). This caused JSON.parse to fail and skip compaction entirely. Now uses a proper brace-balanced parser that correctly handles: - Nested objects and arrays - Braces inside string literals - Escaped characters in strings Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: preserve all documents in localSearch compaction Previously, compactToolResultBlock used extractContentFromBlock which only extracts the first <content> match. For localSearch results with multiple <document> blocks, this caused all documents after the first to be lost during compaction. Now localSearch blocks are handled specially: - All documents are extracted and preserved - Each document keeps its title and path - Content is truncated to preview length - Output lists all documents with [[wikilink]] format Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * test: skip flaky composer integration tests Skip composer integration tests due to intermittent 503 errors from Gemini API causing CI failures. The tests depend on external API availability which is unreliable. TODO(@logancyang, @wenzhengjiang): Re-enable once composer is revamped. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: preserve all blocks when compacting multi-block L2 segments When URL context segments contain multiple concatenated <url_content> blocks (from processUrlList), the previous compaction only processed the first block. Now detects multiple blocks of the same type and compacts each one independently, preserving all URL context. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: preserve mixed XML block types during L2 compaction The previous fix only handled multiple blocks of the same type. When segments contain mixed block types (e.g., web_tab_context mixed with youtube_video_context from processContextWebTabs), blocks of other types were dropped. Now uses CONTEXT_BLOCK_TYPES registry to match all known block types and compacts each one independently, preserving all context regardless of block type mix. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| use-draggable.ts | ||
| use-raf-throttled-callback.ts | ||
| use-resizable.ts | ||
| use-streaming-chat-session.ts | ||
| useActiveFile.ts | ||
| useChatFileDrop.ts | ||
| useChatManager.ts | ||
| useChatScrolling.ts | ||
| useLatestVersion.ts | ||
| useProjectContextStatus.ts | ||