feat: extend goose2 context window ux with auto-compaction (#8721)

Signed-off-by: Taylor Ho <taylorkmho@gmail.com>
This commit is contained in:
Taylor Ho
2026-04-21 18:10:22 -07:00
committed by GitHub
parent 7e2fb3ee5c
commit 469c74d8bc
45 changed files with 2226 additions and 231 deletions
@@ -50,6 +50,7 @@ describe("acpNotificationHandler", () => {
.getSessionRuntime("draft-session-1");
expect(runtime.tokenState.accumulatedTotal).toBe(512);
expect(runtime.tokenState.contextLimit).toBe(8192);
expect(runtime.hasUsageSnapshot).toBe(true);
});
it("does not buffer non-usage updates before the local session mapping exists", async () => {
@@ -120,6 +120,9 @@
"title": "Mention an agent",
"filesTitle": "Files"
},
"notifications": {
"compactionComplete": "Conversation compacted. Older context was summarized."
},
"message": {
"copied": "Copied",
"defaultImageAlt": "Attached",
@@ -167,6 +170,7 @@
"model": "Model",
"allModels": "All models",
"searchModels": "Search models...",
"settings": "Settings",
"recommended": "Recommended",
"noModelsAvailable": "No models available",
"noSearchResults": "No matching models",
@@ -51,6 +51,24 @@
"standalone": "Standalone chat"
}
},
"compaction": {
"description": "Manage how Goose trims older context in long-running chats.",
"goose": {
"autoCompact": {
"current": "Threshold",
"description": "Choose when Goose should compact older context before replying. This applies to all Goose chats.",
"helper": "Set to 100% to turn auto-compaction off.",
"label": "Auto-compact context",
"loading": "Loading...",
"off": "Off",
"saveError": "Failed to save auto-compaction setting."
},
"builtIn": "Built in",
"description": "Goose-specific context controls for long-running chats.",
"label": "Goose (Agent)"
},
"title": "Compaction"
},
"deleteProject": {
"description": "Are you sure you want to permanently delete \"{{name}}\"? This cannot be undone.",
"title": "Delete project permanently?"
@@ -172,6 +190,7 @@
"about": "About",
"appearance": "Appearance",
"chats": "Chats",
"compaction": "Compaction",
"doctor": "Doctor",
"general": "General",
"projects": "Projects",
@@ -120,6 +120,9 @@
"title": "Menciona un agente",
"filesTitle": "Archivos"
},
"notifications": {
"compactionComplete": "Conversacion compactada. El contexto anterior se resumio."
},
"message": {
"copied": "Copiado",
"defaultImageAlt": "Adjunto",
@@ -167,6 +170,7 @@
"model": "Modelo",
"allModels": "Todos los modelos",
"searchModels": "Buscar modelos...",
"settings": "Configuración",
"recommended": "Recomendados",
"noModelsAvailable": "No hay modelos disponibles",
"noSearchResults": "Sin resultados",
@@ -51,6 +51,24 @@
"standalone": "Chat independiente"
}
},
"compaction": {
"description": "Administra cómo Goose compacta el contexto anterior en chats largos.",
"goose": {
"autoCompact": {
"current": "Umbral",
"description": "Elige cuándo Goose debe compactar el contexto anterior antes de responder. Esto se aplica a todos los chats de Goose.",
"helper": "Ajústalo al 100% para desactivar la compactación automática.",
"label": "Compactación automática del contexto",
"loading": "Cargando...",
"off": "Desactivado",
"saveError": "No se pudo guardar la configuración de compactación automática."
},
"builtIn": "Integrado",
"description": "Controles de contexto específicos de Goose para chats largos.",
"label": "Goose (Agente)"
},
"title": "Compactación"
},
"deleteProject": {
"description": "¿Seguro que quieres eliminar permanentemente \"{{name}}\"? Esta acción no se puede deshacer.",
"title": "¿Eliminar el proyecto de forma permanente?"
@@ -172,6 +190,7 @@
"about": "Acerca de",
"appearance": "Apariencia",
"chats": "Chats",
"compaction": "Compactación",
"doctor": "Diagnóstico",
"general": "General",
"projects": "Proyectos",
+10
View File
@@ -0,0 +1,10 @@
export function isPromiseLike<T = unknown>(
value: unknown,
): value is PromiseLike<T> {
return (
(typeof value === "object" || typeof value === "function") &&
value !== null &&
"then" in value &&
typeof value.then === "function"
);
}
+2
View File
@@ -34,6 +34,7 @@ export const INITIAL_TOKEN_STATE: TokenState = {
export interface SessionChatRuntime {
chatState: ChatState;
tokenState: TokenState;
hasUsageSnapshot: boolean;
streamingMessageId: string | null;
pendingAssistantProviderId: string | null;
error: string | null;
@@ -43,6 +44,7 @@ export interface SessionChatRuntime {
export const INITIAL_SESSION_CHAT_RUNTIME: SessionChatRuntime = {
chatState: "idle",
tokenState: INITIAL_TOKEN_STATE,
hasUsageSnapshot: false,
streamingMessageId: null,
pendingAssistantProviderId: null,
error: null,
+6
View File
@@ -11,6 +11,9 @@ function Slider({
max = 100,
...props
}: React.ComponentProps<typeof SliderPrimitive.Root>) {
const thumbAriaLabel = props["aria-label"];
const thumbAriaLabelledBy = props["aria-labelledby"];
const isDisabled = props.disabled === true;
const _values = React.useMemo(
() =>
Array.isArray(value)
@@ -51,6 +54,9 @@ function Slider({
<SliderPrimitive.Thumb
data-slot="slider-thumb"
key={index}
aria-label={thumbAriaLabel}
aria-labelledby={thumbAriaLabelledBy}
aria-disabled={isDisabled || undefined}
className="border-primary bg-background ring-ring/50 block size-4 shrink-0 rounded-full border transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50"
/>
))}