MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / getMessagesSinceLastSummary

Function getMessagesSinceLastSummary

src/core/condense/index.ts:519–528  ·  view source on GitHub ↗
(messages: ApiMessage[])

Source from the content-addressed store, hash-verified

517 * so the first message since the last summary is guaranteed to be a user message.
518 */
519export function getMessagesSinceLastSummary(messages: ApiMessage[]): ApiMessage[] {
520 const lastSummaryIndexReverse = [...messages].reverse().findIndex((message) => message.isSummary)
521
522 if (lastSummaryIndexReverse === -1) {
523 return messages
524 }
525
526 const lastSummaryIndex = messages.length - lastSummaryIndexReverse - 1
527 return messages.slice(lastSummaryIndex)
528}
529
530/**
531 * Filters the API conversation history to get the "effective" messages to send to the API.

Callers 5

attemptApiRequestMethod · 0.90
condense.spec.tsFile · 0.90
index.spec.tsFile · 0.90
summarizeConversationFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected