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

Function truncate

packages/core/src/session/compaction.ts:81–82  ·  view source on GitHub ↗
(value: string)

Source from the content-addressed store, hash-verified

79const estimate = (value: unknown) => Token.estimate(JSON.stringify(value))
80
81const truncate = (value: string) =>
82 value.length <= TOOL_OUTPUT_MAX_CHARS ? value : `${value.slice(0, TOOL_OUTPUT_MAX_CHARS)}\n[truncated]`
83
84export const serializeToolContent = (content: SessionMessage.ToolStateCompleted["content"]) =>
85 content

Callers 1

serializeFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected