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

Function normalizeToolResultOrder

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

Source from the content-addressed store, hash-verified

876}
877
878function normalizeToolResultOrder(conversations: NormalizedConversation[]) {
879 for (const conv of conversations) {
880 for (let start = 0; start < conv.messages.length; ) {
881 if (conv.messages[start].role !== "tool") {
882 start++;
883 continue;
884 }
885
886 let end = start + 1;
887 while (end < conv.messages.length && conv.messages[end].role === "tool") {
888 end++;
889 }
890
891 conv.messages
892 .slice(start, end)
893 .sort(compareToolResultMessages)
894 .forEach((message, index) => {
895 conv.messages[start + index] = message;
896 });
897 start = end;
898 }
899 }
900}
901
902function compareToolResultMessages(
903 left: NormalizedMessage,

Callers 2

loadStoredDataMethod · 0.85
transformHttpExchangesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…