MCPcopy Create free account
hub / github.com/arctic-cli/interface / computeDiff

Function computeDiff

packages/arctic/src/session/summary.ts:186–212  ·  view source on GitHub ↗
(input: { messages: MessageV2.WithParts[] })

Source from the content-addressed store, hash-verified

184 )
185
186 async function computeDiff(input: { messages: MessageV2.WithParts[] }) {
187 let from: string | undefined
188 let to: string | undefined
189
190 // scan assistant messages to find earliest from and latest to
191 // snapshot
192 for (const item of input.messages) {
193 if (!from) {
194 for (const part of item.parts) {
195 if (part.type === "step-start" && part.snapshot) {
196 from = part.snapshot
197 break
198 }
199 }
200 }
201
202 for (const part of item.parts) {
203 if (part.type === "step-finish" && part.snapshot) {
204 to = part.snapshot
205 break
206 }
207 }
208 }
209
210 if (from && to) return Snapshot.diffFull(from, to)
211 return []
212 }
213}

Callers 2

summarizeSessionFunction · 0.85
summarizeMessageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected