MCPcopy Create free account
hub / github.com/anomalyco/opencode / replayContentPart

Method replayContentPart

packages/opencode/src/acp/event.ts:94–114  ·  view source on GitHub ↗
(message: SessionMessageResponse, part: Part)

Source from the content-addressed store, hash-verified

92 }
93
94 private async replayContentPart(message: SessionMessageResponse, part: Part) {
95 if (part.type !== "text" && part.type !== "file" && part.type !== "reasoning") return
96
97 const sessionUpdate =
98 part.type === "reasoning"
99 ? "agent_thought_chunk"
100 : message.info.role === "user"
101 ? "user_message_chunk"
102 : "agent_message_chunk"
103
104 for (const chunk of partsToContentChunks([part as ReplayPart])) {
105 await this.input.connection.sessionUpdate({
106 sessionId: message.info.sessionID,
107 update: {
108 sessionUpdate,
109 messageId: message.info.id,
110 ...chunk,
111 },
112 })
113 }
114 }
115
116 private async run() {
117 while (!this.abort.signal.aborted) {

Callers 1

replayMessageMethod · 0.95

Calls 1

partsToContentChunksFunction · 0.90

Tested by

no test coverage detected