fix(anthropic-auto-compact): use OpenCode's official compaction mechanism and proper retry
🤖 GENERATED WITH ASSISTANCE OF [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
This commit is contained in:
@@ -21,6 +21,11 @@ interface StoredToolPart {
|
||||
input: Record<string, unknown>
|
||||
output?: string
|
||||
error?: string
|
||||
time?: {
|
||||
start: number
|
||||
end?: number
|
||||
compacted?: number
|
||||
}
|
||||
}
|
||||
truncated?: boolean
|
||||
originalSize?: number
|
||||
@@ -124,6 +129,11 @@ export function truncateToolResult(partPath: string): {
|
||||
part.originalSize = originalSize
|
||||
part.state.output = TRUNCATION_MESSAGE
|
||||
|
||||
if (!part.state.time) {
|
||||
part.state.time = { start: Date.now() }
|
||||
}
|
||||
part.state.time.compacted = Date.now()
|
||||
|
||||
writeFileSync(partPath, JSON.stringify(part, null, 2))
|
||||
|
||||
return { success: true, toolName, originalSize }
|
||||
|
||||
Reference in New Issue
Block a user