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

Function summarize

packages/opencode/src/cli/cmd/run/stream.ts:36–64  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

34}
35
36function summarize(value: unknown): unknown {
37 if (typeof value === "string") {
38 if (value.length <= 160) {
39 return value
40 }
41
42 return {
43 type: "string",
44 length: value.length,
45 preview: `${value.slice(0, 160)}...`,
46 }
47 }
48
49 if (Array.isArray(value)) {
50 return {
51 type: "array",
52 length: value.length,
53 }
54 }
55
56 if (!value || typeof value !== "object") {
57 return value
58 }
59
60 return {
61 type: "object",
62 keys: Object.keys(value),
63 }
64}
65
66function traceCommit(commit: StreamCommit) {
67 return {

Callers 2

traceCommitFunction · 0.70
traceSubagentStateFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected