MCPcopy Index your code
hub / github.com/coder/coder / publishCompactionError

Function publishCompactionError

coderd/x/chatd/chatloop/compaction.go:185–196  ·  view source on GitHub ↗

publishCompactionError sends a tool-result error part so connected clients see that compaction failed.

(config CompactionOptions, msg string)

Source from the content-addressed store, hash-verified

183// publishCompactionError sends a tool-result error part so
184// connected clients see that compaction failed.
185func publishCompactionError(config CompactionOptions, msg string) {
186 if config.PublishMessagePart == nil || config.ToolCallID == "" {
187 return
188 }
189 errJSON, _ := json.Marshal(map[string]any{
190 "error": msg,
191 })
192 config.PublishMessagePart(
193 codersdk.ChatMessageRoleTool,
194 codersdk.ChatMessageToolResult(config.ToolCallID, config.ToolName, errJSON, true, false),
195 )
196}
197
198// normalizedCompactionConfig returns a copy of the compaction options
199// with defaults applied. The bool is false when compaction is

Callers 1

tryCompactFunction · 0.85

Calls 2

ChatMessageToolResultFunction · 0.92
MarshalMethod · 0.45

Tested by

no test coverage detected