mirror of
https://github.com/logancyang/obsidian-copilot.git
synced 2026-07-22 07:50:24 +00:00
* fix: restore expanded search limits for time-range and tag queries PR #2273 removed the agent-facing returnAll parameter but also removed the implicit expanded limits that time-range and tag-focused queries relied on. This restores the behavior: when a search has a timeRange or tag terms, automatically use RETURN_ALL_LIMIT (100) instead of the default maxSourceChunks, and pass returnAll to the underlying retrievers. The agent still cannot explicitly request returnAll via the tool schema. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: two-tier search result formatting to reduce context bloat for expanded queries When search results exceed maxSourceChunks, split into two tiers: - Tier 1 (first maxSourceChunks docs): full content XML as before - Tier 2 (overflow docs): metadata-only with title, path, mtime, 150-char snippet Achieves ~85% context reduction for expanded-limit queries while preserving discoverability. Adds formatMetadataOnlyDocuments() as a pure, testable utility. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat: two-tier search formatting for time-range and tag queries - Add isFilterOnlyResults() and isTimeDominantResults() helpers in searchResultUtils - Update formatMetadataOnlyDocuments() with configurable snippetLength (default 300) - Update prepareLocalSearchResult() with three-case logic: - Time-dominant: sort by mtime desc, top maxSourceChunks get full content, rest metadata-only - Tag-only: all docs get metadata-only (no ranking available) - Ranked: existing behavior unchanged - Extract FILTER_SOURCES to module-level constant to avoid per-call Set allocation - Add tests for isFilterOnlyResults, isTimeDominantResults, and custom snippetLength Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix: update readNote instruction in metadata-only search results Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address Codex P1/P2 review findings for two-tier search P1: Remove title-match from FILTER_SOURCES so explicit note references ([[Note Name]]) get full content in tier 1, not metadata-only. This restores prior behavior where title-match queries provided full content without requiring an extra readNote tool call. P2: Fall back to parsing tags directly from the query string when salientTerms has no tag terms. Mirrors the regex logic in FilterRetriever so needsExpandedLimits is true even when salientTerms is incomplete. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * revert: remove unrelated Prettier formatting changes Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: preserve no-results marker and sanitize metadata snippets - Guard the metadata-only path with tier2Docs.length > 0 so empty-result searches fall through to formatSearchResultsForLLM and return the expected "No relevant documents found." marker instead of an empty string. - Apply sanitizeContentForCitations to doc.content in formatMetadataOnlyDocuments before slicing the snippet, preventing leaked citation markers (e.g. [^12], [3]) from note content into the tier-2 metadata prompt. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix: decouple timeDominant detection from filterOnly Time-range queries via FilterRetriever often produce a mix of "time-filtered" and "title-match" (daily notes from getTitleMatches) docs. Since "title-match" is not in FILTER_SOURCES, isFilterOnlyResults returns false for these result sets, making the old `timeDominant = filterOnly && isTimeDominantResults(...)` always false — skipping the mtime-based recency sort for time-range queries. Fix by evaluating isTimeDominantResults independently: if any doc has source "time-filtered", use mtime sort regardless of whether all docs are filter-only. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix: populate tagTerms from query when salientTerms misses hashtags When salientTerms is incomplete (e.g. query="#python" with empty salientTerms), tagTerms was always an empty array, so SelfHostRetriever received no server-side tag filters despite expanding to RETURN_ALL_LIMIT. Extract hashtags from the raw query using the same regex as FilterRetriever as a fallback, and assign the result directly to tagTerms so all retriever paths (including SelfHostRetriever) get proper tag constraints. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| cache | ||
| commands | ||
| components | ||
| context | ||
| contexts | ||
| core | ||
| editor | ||
| hooks | ||
| imageProcessing | ||
| integration_tests | ||
| lib | ||
| LLMProviders | ||
| memory | ||
| mentions | ||
| miyo | ||
| search | ||
| services | ||
| settings | ||
| state | ||
| styles | ||
| system-prompts | ||
| tests | ||
| tools | ||
| types | ||
| utils | ||
| aiParams.ts | ||
| chainFactory.ts | ||
| chainUtils.ts | ||
| chatUtils.toolMarkers.test.ts | ||
| chatUtils.ts | ||
| composerUtils.ts | ||
| constants.ts | ||
| context.ts | ||
| contextProcessor.dataview.test.ts | ||
| contextProcessor.embeds.test.ts | ||
| contextProcessor.selectedText.test.ts | ||
| contextProcessor.ts | ||
| encryptionService.test.ts | ||
| encryptionService.ts | ||
| error.ts | ||
| errorFormat.ts | ||
| langchainStream.test.ts | ||
| langchainStream.ts | ||
| logFileManager.ts | ||
| logger.ts | ||
| main.ts | ||
| noteUtils.ts | ||
| plusUtils.ts | ||
| rateLimiter.ts | ||
| types.ts | ||
| utils.cleanMessageForCopy.test.ts | ||
| utils.test.ts | ||
| utils.ts | ||