okami.mom/strata

git clone https://git.nkp.pet/okami.mom/strata

Niko1221Trial2 merge f-0291-pr-nv (97b3d614f)1306424be

main
590 B11 linesraw
1import type { ToolCall } from './types';
2
3/** The actions of one chat that wait for an answer, oldest first (the approval dock above the message box shows them, #4725). */
4export function pendingApprovals(session: { messages: { id: string; tools?: ToolCall[] }[] } | null | undefined): { messageId: string; tool: ToolCall }[] {
5    const out: { messageId: string; tool: ToolCall }[] = [];
6    for (const m of session?.messages ?? [])
7        for (const tool of m.tools ?? [])
8            if (tool.state === 'proposed')
9                out.push({ messageId: m.id, tool });
10    return out;
11}