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

Function toolCommit

packages/opencode/test/cli/run/scrollback.surface.test.ts:234–257  ·  view source on GitHub ↗
(input: {
  tool: string
  phase: StreamCommit["phase"]
  toolState?: StreamCommit["toolState"]
  text?: string
  state?: Record<string, unknown>
  id?: string
  messageID?: string
})

Source from the content-addressed store, hash-verified

232}
233
234function toolCommit(input: {
235 tool: string
236 phase: StreamCommit["phase"]
237 toolState?: StreamCommit["toolState"]
238 text?: string
239 state?: Record<string, unknown>
240 id?: string
241 messageID?: string
242}): StreamCommit {
243 const id = input.id ?? `${input.tool}-1`
244 const messageID = input.messageID ?? `msg-${input.tool}`
245
246 return {
247 kind: "tool",
248 text: input.text ?? "",
249 phase: input.phase,
250 source: "tool",
251 partID: id,
252 messageID,
253 tool: input.tool,
254 ...(input.toolState ? { toolState: input.toolState } : {}),
255 ...(input.state ? { part: toolPart(input.tool, input.state, id, messageID) } : {}),
256 }
257}
258
259test("finalizes markdown tables for streamed and coalesced input", async () => {
260 const text =

Callers 1

Calls 1

toolPartFunction · 0.70

Tested by

no test coverage detected