MCPcopy Index your code
hub / github.com/anomalyco/opencode / childMessage

Function childMessage

packages/opencode/test/cli/run/subagent-data.test.ts:153–210  ·  view source on GitHub ↗
(input: {
  messageID: string
  sessionID: string
  role: "user" | "assistant"
  parts: ChildMessage["parts"]
})

Source from the content-addressed store, hash-verified

151}
152
153function childMessage(input: {
154 messageID: string
155 sessionID: string
156 role: "user" | "assistant"
157 parts: ChildMessage["parts"]
158}) {
159 if (input.role === "user") {
160 return {
161 info: {
162 id: input.messageID,
163 sessionID: input.sessionID,
164 role: "user",
165 time: {
166 created: 1,
167 },
168 agent: "test",
169 model: {
170 providerID: "openai",
171 modelID: "gpt-5",
172 },
173 },
174 parts: input.parts,
175 } satisfies ChildMessage
176 }
177
178 return {
179 info: {
180 id: input.messageID,
181 sessionID: input.sessionID,
182 role: "assistant",
183 time: {
184 created: 2,
185 completed: 3,
186 },
187 parentID: "msg-user-1",
188 providerID: "openai",
189 modelID: "gpt-5",
190 mode: "default",
191 agent: "explore",
192 path: {
193 cwd: "/tmp",
194 root: "/tmp",
195 },
196 cost: 0,
197 tokens: {
198 input: 1,
199 output: 1,
200 reasoning: 0,
201 cache: {
202 read: 0,
203 write: 0,
204 },
205 },
206 finish: "stop",
207 },
208 parts: input.parts,
209 } satisfies ChildMessage
210}

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected