MCPcopy Index your code
hub / github.com/Opencode-DCP/opencode-dynamic-context-pruning / isMessageCompacted

Function isMessageCompacted

lib/state/utils.ts:12–25  ·  view source on GitHub ↗
(state: SessionState, msg: WithParts)

Source from the content-addressed store, hash-verified

10import { countTokens } from "../token-utils"
11
12export const isMessageCompacted = (state: SessionState, msg: WithParts): boolean => {
13 if (!isMessageWithInfo(msg)) {
14 return false
15 }
16
17 if (msg.info.time.created < state.lastCompaction) {
18 return true
19 }
20 const pruneEntry = state.prune.messages.byMessageId.get(msg.info.id)
21 if (pruneEntry && pruneEntry.activeBlockIds.length > 0) {
22 return true
23 }
24 return false
25}
26
27interface PersistedPruneMessagesState {
28 byMessageId: Record<string, PrunedMessageEntry>

Callers 10

collectToolIdsAfterIndexFunction · 0.90
analyzeContextTokensFunction · 0.90
syncToolCacheFunction · 0.90
buildPriorityMapFunction · 0.90
buildToolIdListFunction · 0.90
pruneFullToolFunction · 0.90
pruneToolOutputsFunction · 0.90
pruneToolInputsFunction · 0.90
pruneToolErrorsFunction · 0.90
countTurnsFunction · 0.85

Calls 1

isMessageWithInfoFunction · 0.90

Tested by

no test coverage detected