( trigger: 'auto', preTokens: number, tokensSaved: number, compactedToolIds: string[], clearedAttachmentUUIDs: string[], )
| 4555 | } |
| 4556 | |
| 4557 | export function createMicrocompactBoundaryMessage( |
| 4558 | trigger: 'auto', |
| 4559 | preTokens: number, |
| 4560 | tokensSaved: number, |
| 4561 | compactedToolIds: string[], |
| 4562 | clearedAttachmentUUIDs: string[], |
| 4563 | ): SystemMicrocompactBoundaryMessage { |
| 4564 | logForDebugging( |
| 4565 | `[microcompact] saved ~${formatTokens(tokensSaved)} tokens (cleared ${compactedToolIds.length} tool results)`, |
| 4566 | ) |
| 4567 | return { |
| 4568 | type: 'system', |
| 4569 | subtype: 'microcompact_boundary', |
| 4570 | content: 'Context microcompacted', |
| 4571 | isMeta: false, |
| 4572 | timestamp: new Date().toISOString(), |
| 4573 | uuid: randomUUID(), |
| 4574 | level: 'info', |
| 4575 | microcompactMetadata: { |
| 4576 | trigger, |
| 4577 | preTokens, |
| 4578 | tokensSaved, |
| 4579 | compactedToolIds, |
| 4580 | clearedAttachmentUUIDs, |
| 4581 | }, |
| 4582 | } |
| 4583 | } |
| 4584 | |
| 4585 | export function createSystemAPIErrorMessage( |
| 4586 | error: APIError, |
no test coverage detected