( trigger: 'auto', preTokens: number, tokensSaved: number, compactedToolIds: string[], clearedAttachmentUUIDs: string[], )
| 4992 | } |
| 4993 | |
| 4994 | export function createMicrocompactBoundaryMessage( |
| 4995 | trigger: 'auto', |
| 4996 | preTokens: number, |
| 4997 | tokensSaved: number, |
| 4998 | compactedToolIds: string[], |
| 4999 | clearedAttachmentUUIDs: string[], |
| 5000 | ): SystemMicrocompactBoundaryMessage { |
| 5001 | logForDebugging( |
| 5002 | `[microcompact] saved ~${formatTokens(tokensSaved)} tokens (cleared ${compactedToolIds.length} tool results)`, |
| 5003 | ) |
| 5004 | return { |
| 5005 | type: 'system', |
| 5006 | subtype: 'microcompact_boundary', |
| 5007 | content: 'Context microcompacted', |
| 5008 | isMeta: false, |
| 5009 | timestamp: new Date().toISOString(), |
| 5010 | uuid: randomUUID(), |
| 5011 | level: 'info', |
| 5012 | microcompactMetadata: { |
| 5013 | trigger, |
| 5014 | preTokens, |
| 5015 | tokensSaved, |
| 5016 | compactedToolIds, |
| 5017 | clearedAttachmentUUIDs, |
| 5018 | }, |
| 5019 | } |
| 5020 | } |
| 5021 | |
| 5022 | export function createSystemAPIErrorMessage( |
| 5023 | error: APIError, |
no test coverage detected