MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / markComplete

Function markComplete

cli/src/utils/message-updater.ts:57–91  ·  view source on GitHub ↗
(metadata?: Partial<ChatMessage>)

Source from the content-addressed store, hash-verified

55 }
56
57 const markComplete = (metadata?: Partial<ChatMessage>) => {
58 updateAiMessage((msg) => {
59 const { metadata: messageMetadata, ...rest } = metadata ?? {}
60
61 // Mark native reasoning blocks as complete by setting thinkingOpen = false
62 // This ensures thinking blocks auto-collapse when the message finishes
63 // Check for thinkingOpen !== false to handle both true (native) and undefined (legacy)
64 const updatedBlocks = msg.blocks?.map((block) => {
65 if (
66 block.type === 'text' &&
67 (block as TextContentBlock).textType === 'reasoning' &&
68 (block as TextContentBlock).thinkingOpen !== false
69 ) {
70 return { ...block, thinkingOpen: false } as ContentBlock
71 }
72 return block
73 })
74
75 const nextMessage: ChatMessage = {
76 ...msg,
77 isComplete: true,
78 ...(updatedBlocks && { blocks: updatedBlocks }),
79 ...rest,
80 }
81
82 if (messageMetadata) {
83 nextMessage.metadata = {
84 ...(msg.metadata ?? {}),
85 ...messageMetadata,
86 }
87 }
88
89 return nextMessage
90 })
91 }
92
93 const setError = (message: string) => {
94 updateAiMessage((msg) => ({

Callers

nothing calls this directly

Calls 3

updateAiMessageFunction · 0.85
disposeFunction · 0.85
flushFunction · 0.70

Tested by

no test coverage detected