MCPcopy Create free account
hub / github.com/cortexkit/magic-context / fetchMessages

Function fetchMessages

packages/plugin/scripts/longmemeval/runner.ts:341–354  ·  view source on GitHub ↗
(
    client: OpencodeClient,
    config: RunnerConfig,
    sessionId: string,
)

Source from the content-addressed store, hash-verified

339}
340
341async function fetchMessages(
342 client: OpencodeClient,
343 config: RunnerConfig,
344 sessionId: string,
345): Promise<SessionMessageShape[]> {
346 const response = await withRetry(config, `session.messages:${sessionId}`, (_attempt, signal) =>
347 client.session.messages({
348 path: { id: sessionId },
349 query: { directory: config.projectDirectory },
350 signal,
351 }),
352 );
353 return Array.isArray(response.data) ? (response.data as SessionMessageShape[]) : [];
354}
355
356function findLatestAssistantMessage(messages: SessionMessageShape[]): SessionMessageShape | null {
357 const assistantMessages = messages

Callers 1

sendPromptAndCaptureFunction · 0.85

Calls 1

withRetryFunction · 0.85

Tested by

no test coverage detected