( trigger: 'auto', preTokens: number, tokensSaved: number, compactedToolIds: string[], clearedAttachmentUUIDs: string[], )
| 4655 | } |
| 4656 | |
| 4657 | export function createMicrocompactBoundaryMessage( |
| 4658 | trigger: 'auto', |
| 4659 | preTokens: number, |
| 4660 | tokensSaved: number, |
| 4661 | compactedToolIds: string[], |
| 4662 | clearedAttachmentUUIDs: string[], |
| 4663 | ): SystemMicrocompactBoundaryMessage { |
| 4664 | logForDebugging( |
| 4665 | `[microcompact] saved ~${formatTokens(tokensSaved)} tokens (cleared ${compactedToolIds.length} tool results)`, |
| 4666 | ) |
| 4667 | return { |
| 4668 | type: 'system', |
| 4669 | subtype: 'microcompact_boundary', |
| 4670 | content: 'Context microcompacted', |
| 4671 | isMeta: false, |
| 4672 | timestamp: new Date().toISOString(), |
| 4673 | uuid: randomUUID(), |
| 4674 | level: 'info', |
| 4675 | microcompactMetadata: { |
| 4676 | trigger, |
| 4677 | preTokens, |
| 4678 | tokensSaved, |
| 4679 | compactedToolIds, |
| 4680 | clearedAttachmentUUIDs, |
| 4681 | }, |
| 4682 | } |
| 4683 | } |
| 4684 | |
| 4685 | export function createSystemAPIErrorMessage( |
| 4686 | error: APIError, |
no test coverage detected