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

Function message

packages/app/src/utils/diffs.ts:28–49  ·  view source on GitHub ↗
(value: Message)

Source from the content-addressed store, hash-verified

26}
27
28export function message(value: Message): Message {
29 if (value.role !== "user") return value
30
31 const raw = value.summary as unknown
32 if (raw === undefined) return value
33 if (!object(raw)) return { ...value, summary: undefined }
34
35 const title = typeof raw.title === "string" ? raw.title : undefined
36 const body = typeof raw.body === "string" ? raw.body : undefined
37 const next = diffs(raw.diffs)
38
39 if (title === raw.title && body === raw.body && next === raw.diffs) return value
40
41 return {
42 ...value,
43 summary: {
44 ...(title === undefined ? {} : { title }),
45 ...(body === undefined ? {} : { body }),
46 diffs: next,
47 },
48 }
49}

Callers 4

diffs.test.tsFile · 0.90
retryTextFunction · 0.50
DialogMessageFunction · 0.50
tabs.stories.tsxFile · 0.50

Calls 2

diffsFunction · 0.85
objectFunction · 0.70

Tested by

no test coverage detected