MCPcopy Create free account
hub / github.com/Noumena-Network/code / createMicrocompactBoundaryMessage

Function createMicrocompactBoundaryMessage

src/utils/messages.ts:4657–4683  ·  view source on GitHub ↗
(
  trigger: 'auto',
  preTokens: number,
  tokensSaved: number,
  compactedToolIds: string[],
  clearedAttachmentUUIDs: string[],
)

Source from the content-addressed store, hash-verified

4655}
4656
4657export 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
4685export function createSystemAPIErrorMessage(
4686 error: APIError,

Callers 1

queryLoopFunction · 0.85

Calls 3

randomUUIDFunction · 0.90
formatTokensFunction · 0.85
logForDebuggingFunction · 0.70

Tested by

no test coverage detected