MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / outputTextMessage

Method outputTextMessage

apps/cli/src/agent/output-manager.ts:283–319  ·  view source on GitHub ↗
(
		ts: number,
		text: string,
		isPartial: boolean,
		alreadyDisplayedComplete: boolean | undefined,
		skipFirstUserMessage: boolean,
	)

Source from the content-addressed store, hash-verified

281 }
282
283 private outputTextMessage(
284 ts: number,
285 text: string,
286 isPartial: boolean,
287 alreadyDisplayedComplete: boolean | undefined,
288 skipFirstUserMessage: boolean,
289 ): void {
290 // Skip the initial user prompt echo (first message with no prior messages)
291 if (skipFirstUserMessage && this.displayedMessages.size === 0 && !this.displayedMessages.has(ts)) {
292 this.displayedMessages.set(ts, { ts, text, partial: !!isPartial })
293 return
294 }
295
296 if (isPartial && text) {
297 // Stream partial content
298 this.streamContent(ts, text, "[assistant]")
299 this.displayedMessages.set(ts, { ts, text, partial: true })
300 } else if (!isPartial && text && !alreadyDisplayedComplete) {
301 // Message complete - ensure all content is output
302 const streamed = this.streamedContent.get(ts)
303
304 if (streamed) {
305 // We were streaming - output any remaining delta and finish
306 if (text.length > streamed.text.length && text.startsWith(streamed.text)) {
307 const delta = text.slice(streamed.text.length)
308 this.writeRaw(delta)
309 }
310 this.finishStream(ts)
311 } else {
312 // Not streamed yet - output complete message
313 this.output("\n[assistant]", text)
314 }
315
316 this.displayedMessages.set(ts, { ts, text, partial: false })
317 this.streamedContent.set(ts, { ts, text, headerShown: true })
318 }
319 }
320
321 private outputReasoningMessage(
322 ts: number,

Callers 1

outputSayMessageMethod · 0.95

Calls 7

streamContentMethod · 0.95
writeRawMethod · 0.95
finishStreamMethod · 0.95
outputMethod · 0.95
hasMethod · 0.65
setMethod · 0.65
getMethod · 0.65

Tested by

no test coverage detected