ide на основе vs code
Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
This document specifies the two clipping strategies used to select and truncate recently viewed file content for inclusion in the NES/xtab prompt.
| Input | Description | |---|---| | recentlyViewedCodeSnippets | Files ordered most-recent-first. Each entry carries content, optional focal ranges (character-offset ranges of edit locations), and an editEntryCount weight. | | totalBudget | Maximum tokens for the entire recently-viewed-files section (opts.recentlyViewedDocuments.maxTokens). | | pageSize | Number of lines per page for paged clipping. | | computeTokens | Token counting function. |
All strategies use page-based clipping. File content is divided into pages of pageSize lines. Token costs are computed per page. Pages are included or excluded as whole units — no partial pages.
All strategies reverse the collected snippets before returning, so the final prompt order is least-recent-first (oldest file at top, most recent at bottom).
clipAroundFocalRangesThe AroundEditRange and Proportional strategies share clipAroundFocalRanges for files with focal ranges. This function enforces a strict budget: if the focal pages alone exceed the remaining token budget, the file is skipped entirely (returns undefined). This prevents any single file from overshooting the budget. The caller interprets undefined as "nothing fit" and either breaks the loop (greedy strategies) or carries the budget forward (proportional strategy).
When clipping around focal ranges, selectFocalRangesWithinSpanCap limits the span to pageSize × 3 lines. Focal ranges are ordered most-recent-first; ranges are greedily included until adding the next one would exceed the span cap. This prevents wide-scatter edits (e.g., line 10 + line 90) from causing the initial focal span to cover the entire document.
---
Uses collectRecentDocuments: collects the last `nDocuments` unique documents, keeping only the most recent entry per document.
For edit entries, focal ranges are extracted from edit.getNewRanges() (the character-offset ranges of the replacement text in the post-edit document). For visible-range entries, the visibleRanges are used as focal ranges.
Greedy, most-recent-first:
1. Process files in most-recent-first order. 2. For files with focal ranges: call clipAroundFocalRanges.
pageSize × 3 lines.included (the "focal pages").
and downward from the focal pages.
is exhausted. 3. For files without focal ranges: fall through to clipFullDocument (top-to-bottom clipping). 4. When the budget reaches 0 or a file can't fit, stop processing.
only the most recent edit location determines the clip center.
---
Uses collectRecentDocumentsGrouped: collects the last nDocuments unique documents, keeping all entries per document (not just the latest). This allows historyEntriesToCodeSnippet to merge focal ranges from multiple edits in the same file, giving the model visibility into all recent edit locations within each document.
For older edit entries, focal ranges are transformed forward through the chain of subsequent edits so they remain valid in the most recent content.
Two-pass:
#### Pass 1 — Compute Minimum Focal Costs & Select Files
1. For each file, compute the focal page cost via computeFocalPageCost: the token cost of the pages containing the file's focal ranges (after span-capping). Files without focal ranges have a focal cost of 0.
2. Sum all focal costs. If the sum exceeds totalBudget, drop files from the end of the list (oldest first) until the sum fits.
3. If no files can be included, return empty.
#### Pass 2 — Distribute Expansion Budget & Clip
1. Compute expansionBudget = totalBudget − sumFocalCosts.
2. Compute per-file weights from editEntryCount (default 1).
3. Each included file gets an expansion share: floor(expansionBudget × (weight / totalWeight)).
4. Process files most-recent-first. Each file's effective budget is: focalCost + expansionShare + unspentBudget (carry-forward from previous).
5. For files with focal ranges: call clipAroundFocalRanges with the effective budget. The focal pages are guaranteed to fit (by construction from pass 1).
6. For files without focal ranges: call clipFullDocument.
7. Any unspent budget carries forward to the next file.
never exceeds totalBudget. (Formatting overhead — tags, file path headers — is not counted against the budget, matching all strategies.)
output. A file is only included if its focal cost fits within the remaining budget after accounting for all other included files.
most-recent-first input) are dropped first.
proportionally to edit-entry count, so files with more edits get more surrounding context.
small), the unspent tokens flow to the next file.
---
| Property | AroundEditRange | Proportional | |---|---|---| | Budget allocation | Greedy, most-recent-first | Two-pass proportional | | Clip center | Edit/visible ranges | Edit ranges | | File dropping | Implicit (focal cost exceeds remaining budget) | Explicit (oldest first) | | Multi-edit per file | Single entry per file | All entries merged | | Budget overrun risk | None | None | | History collection | collectRecentDocuments | collectRecentDocumentsGrouped |
The focal page cost for a file is computed by computeFocalPageCost:
1. Apply selectFocalRangesWithinSpanCap to cap the focal range span to pageSize × 3 lines (prioritizing the most recent focal ranges). 2. Convert the character-offset range to line numbers via the content's transformer. 3. Map to page indices: firstPageIdx = floor((startLine − 1) / pageSize), lastPageIdxIncl = floor((endLine − 1) / pageSize). 4. Sum the token cost of all pages from firstPageIdx to lastPageIdxIncl.