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

Function sendBannerIfNeeded

packages/plugin/scripts/longmemeval/runner.ts:501–523  ·  view source on GitHub ↗
(args: {
    client: OpencodeClient;
    config: RunnerConfig;
    sessionId: string;
    questionState: QuestionRunState;
    state: RunnerStateFile;
    questionId: string;
    bannerText: string;
    markBannerSent: () => void;
    alreadySent: boolean;
    operationLabel: string;
})

Source from the content-addressed store, hash-verified

499}
500
501async function sendBannerIfNeeded(args: {
502 client: OpencodeClient;
503 config: RunnerConfig;
504 sessionId: string;
505 questionState: QuestionRunState;
506 state: RunnerStateFile;
507 questionId: string;
508 bannerText: string;
509 markBannerSent: () => void;
510 alreadySent: boolean;
511 operationLabel: string;
512}): Promise<void> {
513 if (args.alreadySent) return;
514 const result = await sendPromptAndCapture(args.client, args.config, args.sessionId, args.bannerText, {
515 operationLabel: args.operationLabel,
516 tools: {},
517 });
518 addOpenCodeUsage(args.questionState, result.usage, result.actualCostUsd, args.config);
519 args.markBannerSent();
520 args.questionState.updatedAt = nowIso();
521 args.state.inProgress[args.questionId] = args.questionState;
522 await persistState(args.config, args.state);
523}
524
525async function replayHaystack(args: {
526 client: OpencodeClient;

Callers 2

replayHaystackFunction · 0.85
askFinalQuestionFunction · 0.85

Calls 4

sendPromptAndCaptureFunction · 0.85
addOpenCodeUsageFunction · 0.85
nowIsoFunction · 0.85
persistStateFunction · 0.85

Tested by

no test coverage detected