MCPcopy
hub / github.com/opactorai/Claudable / flushAssistantMessage

Function flushAssistantMessage

lib/services/cli/codex.ts:642–672  ·  view source on GitHub ↗
(force = false)

Source from the content-addressed store, hash-verified

640 };
641
642 const flushAssistantMessage = async (force = false) => {
643 const combined = buildAssistantPayload();
644
645 if (!combined) {
646 if (force) {
647 assistantMessageId = null;
648 lastStreamedAssistantPayload = null;
649 resetAssistantBuffers();
650 }
651 return;
652 }
653
654 const id = assistantMessageId ?? (assistantMessageId = randomUUID());
655 lastStreamedAssistantPayload = null;
656
657 await persistMessage(
658 projectId,
659 {
660 id,
661 role: 'assistant',
662 messageType: 'chat',
663 content: combined,
664 metadata: { cli_type: 'codex' },
665 },
666 requestId,
667 { isStreaming: false, isFinal: true },
668 );
669
670 assistantMessageId = null;
671 resetAssistantBuffers();
672 };
673
674 const emitCommandStart = async (item: Record<string, unknown>) => {
675 const id = pickFirstString(item.id) ?? randomUUID();

Callers 2

handleItemCompletedFunction · 0.85
executeCodexFunction · 0.85

Calls 3

buildAssistantPayloadFunction · 0.85
resetAssistantBuffersFunction · 0.85
persistMessageFunction · 0.70

Tested by

no test coverage detected