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

Function assistantMessage

packages/opencode/test/acp/event.test.ts:170–205  ·  view source on GitHub ↗
(sessionID: string, messageID: string, partID: string, type: DeltaPartType)

Source from the content-addressed store, hash-verified

168}
169
170function assistantMessage(sessionID: string, messageID: string, partID: string, type: DeltaPartType) {
171 return {
172 info: {
173 id: messageID,
174 sessionID,
175 role: "assistant",
176 time: { created: Date.now() },
177 parentID: "msg_parent",
178 modelID: "model",
179 providerID: "provider",
180 mode: "build",
181 agent: "build",
182 path: { cwd: "/workspace", root: "/workspace" },
183 cost: 0,
184 tokens: { input: 0, output: 0, reasoning: 0, cache: { read: 0, write: 0 } },
185 },
186 parts: [
187 type === "text"
188 ? {
189 id: partID,
190 sessionID,
191 messageID,
192 type: "text",
193 text: "",
194 }
195 : {
196 id: partID,
197 sessionID,
198 messageID,
199 type: "reasoning",
200 text: "",
201 time: { start: Date.now() },
202 },
203 ],
204 } satisfies SessionMessageResponse
205}
206
207function assistantToolMessage(part: ToolPart) {
208 return {

Callers 2

event.test.tsFile · 0.70
MessageFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected