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

Method say

src/core/task/Task.ts:1685–1807  ·  view source on GitHub ↗
(
		type: ClineSay,
		text?: string,
		images?: string[],
		partial?: boolean,
		checkpoint?: Record<string, unknown>,
		progressStatus?: ToolProgressStatus,
		options: {
			isNonInteractive?: boolean
		} = {},
		contextCondense?: ContextCondense,
		contextTruncation?: ContextTruncation,
	)

Source from the content-addressed store, hash-verified

1683 }
1684
1685 async say(
1686 type: ClineSay,
1687 text?: string,
1688 images?: string[],
1689 partial?: boolean,
1690 checkpoint?: Record<string, unknown>,
1691 progressStatus?: ToolProgressStatus,
1692 options: {
1693 isNonInteractive?: boolean
1694 } = {},
1695 contextCondense?: ContextCondense,
1696 contextTruncation?: ContextTruncation,
1697 ): Promise<undefined> {
1698 if (this.abort) {
1699 throw new Error(`[RooCode#say] task ${this.taskId}.${this.instanceId} aborted`)
1700 }
1701
1702 if (partial !== undefined) {
1703 const lastMessage = this.clineMessages.at(-1)
1704
1705 const isUpdatingPreviousPartial =
1706 lastMessage && lastMessage.partial && lastMessage.type === "say" && lastMessage.say === type
1707
1708 if (partial) {
1709 if (isUpdatingPreviousPartial) {
1710 // Existing partial message, so update it.
1711 lastMessage.text = text
1712 lastMessage.images = images
1713 lastMessage.partial = partial
1714 lastMessage.progressStatus = progressStatus
1715 // Fire-and-forget: webview post is internally guarded, but the
1716 // `RooCodeEventName.Message` emit can synchronously throw via a
1717 // consumer-attached listener. Surface that as a log, not an
1718 // unhandled rejection.
1719 this.updateClineMessage(lastMessage).catch((error) => {
1720 console.error("[Task#say] updateClineMessage failed:", error)
1721 })
1722 } else {
1723 // This is a new partial message, so add it with partial state.
1724 const sayTs = Date.now()
1725
1726 if (!options.isNonInteractive) {
1727 this.lastMessageTs = sayTs
1728 }
1729
1730 await this.addToClineMessages({
1731 ts: sayTs,
1732 type: "say",
1733 say: type,
1734 text,
1735 images,
1736 partial,
1737 contextCondense,
1738 contextTruncation,
1739 })
1740 }
1741 } else {
1742 // New now have a complete version of a previously partial message.

Callers 15

condenseContextMethod · 0.95
startTaskMethod · 0.95
resumeTaskFromHistoryMethod · 0.95
attemptApiRequestMethod · 0.95
backoffAndAnnounceMethod · 0.95
executeMethod · 0.80
executeMethod · 0.80
handlePartialMethod · 0.80

Calls 4

updateClineMessageMethod · 0.95
addToClineMessagesMethod · 0.95
saveClineMessagesMethod · 0.95
errorMethod · 0.65

Tested by

no test coverage detected