-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Refactor: Unified context-management architecture with improved UX #9795
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+893
−138
Merged
Changes from 9 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
a67945b
Refactor: Unified context-management architecture with improved UX
hannesrudolph 7aa3a95
refactor: unify context management translation structure
hannesrudolph 8473902
i18n: unify context management translations across all languages
hannesrudolph 2560698
chore: remove deprecated ContextCondenseRow.tsx file
hannesrudolph 8531221
Update webview-ui/src/i18n/locales/es/chat.json
hannesrudolph a3b3280
fix: ensure correct icon handling for context management error state
hannesrudolph 3529237
refactor: simplify over-engineered context management architecture
hannesrudolph 5fae1f9
fix: wait for debounced focus effect to settle in ChatView test
hannesrudolph a6f5626
fix: use FoldVertical icon for context management UI consistency
hannesrudolph 51aeabc
refactor: centralize context management threshold logic with willMana…
hannesrudolph File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| import { describe, it, expect } from "vitest" | ||
| import { CONTEXT_MANAGEMENT_EVENTS, isContextManagementEvent } from "../context-management.js" | ||
|
|
||
| describe("context-management", () => { | ||
| describe("CONTEXT_MANAGEMENT_EVENTS", () => { | ||
| it("should contain all expected event types", () => { | ||
| expect(CONTEXT_MANAGEMENT_EVENTS).toContain("condense_context") | ||
| expect(CONTEXT_MANAGEMENT_EVENTS).toContain("condense_context_error") | ||
| expect(CONTEXT_MANAGEMENT_EVENTS).toContain("sliding_window_truncation") | ||
| expect(CONTEXT_MANAGEMENT_EVENTS).toHaveLength(3) | ||
| }) | ||
| }) | ||
|
|
||
| describe("isContextManagementEvent", () => { | ||
| it("should return true for valid context management events", () => { | ||
| expect(isContextManagementEvent("condense_context")).toBe(true) | ||
| expect(isContextManagementEvent("condense_context_error")).toBe(true) | ||
| expect(isContextManagementEvent("sliding_window_truncation")).toBe(true) | ||
| }) | ||
|
|
||
| it("should return false for non-context-management events", () => { | ||
| expect(isContextManagementEvent("text")).toBe(false) | ||
| expect(isContextManagementEvent("error")).toBe(false) | ||
| expect(isContextManagementEvent(null)).toBe(false) | ||
| expect(isContextManagementEvent(undefined)).toBe(false) | ||
| }) | ||
| }) | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| /** | ||
| * Context Management Types | ||
| * | ||
| * This module provides type definitions for context management events. | ||
| * These events are used to handle different strategies for managing conversation context | ||
| * when approaching token limits. | ||
| * | ||
| * Event Types: | ||
| * - `condense_context`: Context was condensed using AI summarization | ||
| * - `condense_context_error`: An error occurred during context condensation | ||
| * - `sliding_window_truncation`: Context was truncated using sliding window strategy | ||
| */ | ||
|
|
||
| /** | ||
| * Array of all context management event types. | ||
| * Used for runtime type checking. | ||
| */ | ||
| export const CONTEXT_MANAGEMENT_EVENTS = [ | ||
| "condense_context", | ||
| "condense_context_error", | ||
| "sliding_window_truncation", | ||
| ] as const | ||
|
|
||
| /** | ||
| * Union type representing all possible context management event types. | ||
| */ | ||
| export type ContextManagementEvent = (typeof CONTEXT_MANAGEMENT_EVENTS)[number] | ||
|
|
||
| /** | ||
| * Type guard function to check if a value is a valid context management event. | ||
| */ | ||
| export function isContextManagementEvent(value: unknown): value is ContextManagementEvent { | ||
| return typeof value === "string" && (CONTEXT_MANAGEMENT_EVENTS as readonly string[]).includes(value) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.