-
Notifications
You must be signed in to change notification settings - Fork 2
Comparing changes
Open a pull request
base repository: coder/blink
base: a162ad8
head repository: coder/blink
compare: c02246f
- 7 commits
- 7 files changed
- 2 contributors
Commits on Dec 16, 2025
-
feat(scout-agent): add conversation compaction module
Adds conversation compaction support to prevent context overflow errors. Features: - Token counting using ai-tokenizer with model-specific accuracy - Compaction tool (compact_conversation) for summarizing conversations - Warning message generation when approaching token limits - Context length error detection for various providers - Emergency compaction for when compaction request exceeds context Exports: - countConversationTokens - Count tokens in ModelMessage[] - shouldCompact - Check if compaction is needed - findCompactionSummary - Find existing compaction in messages - applyCompaction - Replace pre-compaction messages with summary - createCompactionTool - Create the compact_conversation tool - createCompactionWarningMessage - Generate warning message - isContextLengthError - Detect context overflow errors - calculateEmergencyCompactionConfig - Plan emergency compaction - createEmergencyCompactionMessage - Generate emergency request - prepareEmergencyCompactionMessages - Split messages for emergency Includes 21 tests covering all functionality.
Configuration menu - View commit details
-
Copy full SHA for 1de5efa - Browse repository at this point
Copy the full SHA 1de5efaView commit details -
Configuration menu - View commit details
-
Copy full SHA for d062a49 - Browse repository at this point
Copy the full SHA d062a49View commit details -
feat(scout-agent): wire compaction logging into buildStreamTextParams
This commit: - Imports applyCompaction and createCompactionTool from ./compaction - Applies compaction to messages before processing in buildStreamTextParams - Logs when compaction is applied (showing message count reduction) - Adds the compaction tool to the tools object so the model can call it - Uses compacted messages for Slack metadata detection and model conversion - Fixes isolated declarations issue in createCompactionTool by adding return type - Fixes test assertion for execute method on Tool type
Configuration menu - View commit details
-
Copy full SHA for f14c7cb - Browse repository at this point
Copy the full SHA f14c7cbView commit details -
feat(scout-agent): add automatic compaction when token threshold exce…
…eded This commit adds: - New compaction option in BuildStreamTextParamsOptions to configure: - warningThreshold: token count that triggers compaction warning (default: 80% of max) - maxTokenThreshold: maximum tokens for context (default: 100k) - modelName: model name for token counting - Set to false to disable compaction features - Token counting using ai-tokenizer after message conversion - Automatic injection of compaction warning message when threshold exceeded - Logging for token thresholds and warning injection - Tests for: - Compaction tool is included by default - Existing compaction summaries are applied - Warning message is injected when threshold exceeded - Compaction can be disabled with compaction: false - Custom thresholds are respected Note: core.test.ts tests may not run locally due to bun/HTTPParser incompatibility, but work in CI.
Configuration menu - View commit details
-
Copy full SHA for 3da054d - Browse repository at this point
Copy the full SHA 3da054dView commit details -
refactor(scout-agent): remove maxTokenThreshold option
maxTokenThreshold was only used for display in the warning message. Simplified to just use warningThreshold for both triggering and display.
Configuration menu - View commit details
-
Copy full SHA for 9701d4d - Browse repository at this point
Copy the full SHA 9701d4dView commit details -
refactor(scout-agent): only include compaction tool when warning is i…
…njected The compact_conversation tool is now only available when the token threshold is exceeded and the warning message is injected. This keeps the tool list clean when compaction is not needed. Updated tests to verify: - Tool is NOT available when under threshold - Tool IS available when warning is injected - Tool is NOT available when compaction is disabled
Configuration menu - View commit details
-
Copy full SHA for a53abda - Browse repository at this point
Copy the full SHA a53abdaView commit details -
Configuration menu - View commit details
-
Copy full SHA for c02246f - Browse repository at this point
Copy the full SHA c02246fView commit details
This comparison is taking too long to generate.
Unfortunately it looks like we can’t render this comparison for you right now. It might be too big, or there might be something weird with your repository.
You can try running this command locally to see the comparison on your machine:
git diff a162ad8...c02246f