MCPcopy Index your code
hub / github.com/Opencode-DCP/opencode-dynamic-context-pruning / pruneToolOutputs

Function pruneToolOutputs

lib/messages/prune.ts:73–97  ·  view source on GitHub ↗
(state: SessionState, logger: Logger, messages: WithParts[])

Source from the content-addressed store, hash-verified

71}
72
73const pruneToolOutputs = (state: SessionState, logger: Logger, messages: WithParts[]): void => {
74 for (const msg of messages) {
75 if (isMessageCompacted(state, msg)) {
76 continue
77 }
78
79 const parts = Array.isArray(msg.parts) ? msg.parts : []
80 for (const part of parts) {
81 if (part.type !== "tool") {
82 continue
83 }
84 if (!state.prune.tools.has(part.callID)) {
85 continue
86 }
87 if (part.state.status !== "completed") {
88 continue
89 }
90 if (part.tool === "question" || part.tool === "edit" || part.tool === "write") {
91 continue
92 }
93
94 part.state.output = PRUNED_TOOL_OUTPUT_REPLACEMENT
95 }
96 }
97}
98
99const pruneToolInputs = (state: SessionState, logger: Logger, messages: WithParts[]): void => {
100 for (const msg of messages) {

Callers 1

pruneFunction · 0.85

Calls 1

isMessageCompactedFunction · 0.90

Tested by

no test coverage detected