Compaction overhaul (#5186)

Co-authored-by: Douwe Osinga <douwe@squareup.com>
Co-authored-by: David Katz <dkatz@squareup.com>
Co-authored-by: Alex Hancock <alexhancock@block.xyz>
This commit is contained in:
Douwe Osinga
2025-10-15 18:39:12 -04:00
committed by GitHub
parent ef9e68f2c6
commit 7c1f5dcb2f
56 changed files with 3069 additions and 4465 deletions
+10 -20
View File
@@ -72,18 +72,10 @@ export type ConfigResponse = {
export type Content = RawTextContent | RawImageContent | RawEmbeddedResource | RawAudioContent | RawResource;
export type ContextLengthExceeded = {
msg: string;
};
/**
* Request payload for context management operations
*/
export type ContextManageRequest = {
/**
* Operation to perform: "truncation" or "summarize"
*/
manageAction: string;
/**
* Collection of messages to be managed
*/
@@ -110,6 +102,10 @@ export type ContextManageResponse = {
export type Conversation = Array<Message>;
export type ConversationCompacted = {
msg: string;
};
export type CreateRecipeRequest = {
author?: AuthorRequest | null;
session_id: string;
@@ -383,9 +379,9 @@ export type LoadedProvider = {
*/
export type Message = {
content: Array<MessageContent>;
created?: number;
created: number;
id?: string | null;
metadata?: MessageMetadata;
metadata: MessageMetadata;
role: Role;
};
@@ -408,10 +404,8 @@ export type MessageContent = (TextContent & {
type: 'thinking';
}) | (RedactedThinkingContent & {
type: 'redactedThinking';
}) | (ContextLengthExceeded & {
type: 'contextLengthExceeded';
}) | (SummarizationRequested & {
type: 'summarizationRequested';
}) | (ConversationCompacted & {
type: 'conversationCompacted';
});
/**
@@ -421,11 +415,11 @@ export type MessageMetadata = {
/**
* Whether the message should be included in the agent's context window
*/
agentVisible?: boolean;
agentVisible: boolean;
/**
* Whether the message should be visible to the user in the UI
*/
userVisible?: boolean;
userVisible: boolean;
};
/**
@@ -794,10 +788,6 @@ export type SuccessCheck = {
type: 'Shell';
};
export type SummarizationRequested = {
msg: string;
};
export type TextContent = {
_meta?: {
[key: string]: unknown;