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

Function createCacheEditsBlock

src/services/compact/cachedMicrocompact.ts:106–130  ·  view source on GitHub ↗
(
  state: CachedMCState,
  toolUseIds: string[],
)

Source from the content-addressed store, hash-verified

104}
105
106export function createCacheEditsBlock(
107 state: CachedMCState,
108 toolUseIds: string[],
109): CacheEditsBlock | null {
110 const uniqueIds = toolUseIds.filter(
111 (toolUseId, index, ids) =>
112 ids.indexOf(toolUseId) === index && !state.deletedRefs.has(toolUseId),
113 )
114
115 if (uniqueIds.length === 0) {
116 return null
117 }
118
119 for (const toolUseId of uniqueIds) {
120 state.deletedRefs.add(toolUseId)
121 }
122
123 return {
124 type: 'cache_edits',
125 edits: uniqueIds.map(cache_reference => ({
126 type: 'delete',
127 cache_reference,
128 })),
129 }
130}

Callers

nothing calls this directly

Calls 2

hasMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected