MCPcopy Create free account
hub / github.com/github/copilot-sdk / removePrefixConversations

Function removePrefixConversations

test/harness/replayingCapiProxy.ts:930–943  ·  view source on GitHub ↗
(
  conversations: NormalizedConversation[],
)

Source from the content-addressed store, hash-verified

928// information from the shorter ones. Avoiding duplication makes it reasonable for humans to reason
929// about diffs in the stored conversations when things change.
930function removePrefixConversations(
931 conversations: NormalizedConversation[],
932): NormalizedConversation[] {
933 const result = [...conversations];
934 for (let i = result.length - 1; i >= 0; i--) {
935 for (let j = i - 1; j >= 0; j--) {
936 if (isPrefix(result[j].messages, result[i].messages)) {
937 result.splice(j, 1);
938 i--; // adjust index since we removed an element before current position
939 }
940 }
941 }
942 return result;
943}
944
945function isPrefix(
946 shorter: NormalizedMessage[],

Callers 1

transformHttpExchangesFunction · 0.85

Calls 1

isPrefixFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…