MCPcopy Create free account
hub / github.com/codehamr/codehamr / InlineStatus

Function InlineStatus

internal/tools/bash.go:194–217  ·  view source on GitHub ↗

InlineStatus is the one-liner the TUI prints per tool call.

(call chmctx.ToolCall)

Source from the content-addressed store, hash-verified

192// string "true" silently read as false would make write_file OVERWRITE where
193// append was asked for, destroying the earlier parts of a chunked write behind
194// a success-shaped result.
195func boolArg(args map[string]any, key string) bool {
196 switch v := args[key].(type) {
197 case bool:
198 return v
199 case float64:
200 // `"append": 1`. Every JSON number decodes to float64, and a model that
201 // has just been told to "send the next part with append true" writing 1
202 // is common enough that missing it silently truncated the file.
203 return v != 0
204 case string:
205 return strings.EqualFold(v, "true") || v == "1"
206 }
207 return false
208}
209
210func runRaw(parent context.Context, call chmctx.ToolCall) string {
211 // A truncated/oversized tool call leaves llm.resolve()'s _parse_error
212 // sentinel where real args should be. Without this guard the call falls
213 // through to an empty path/cmd and returns a misleading "(empty path)",
214 // hiding that the server cut the arguments at its output-token limit, the
215 // failure that makes a model re-emit the same too-large write for minutes.
216 // Name the real cause and the recovery so it self-corrects in one step.
217 if msg, ok := call.Arguments["_parse_error"].(string); ok {
218 return fmt.Sprintf("(tool arguments were not valid JSON: %s, most likely the "+
219 "content was too large and the server truncated the call at its output-token "+
220 "limit. Do NOT retry the same whole-file write. Send it in parts of at most "+

Callers 7

dispatchNextToolMethod · 0.92
TestInlineStatusReadFileFunction · 0.85
TestInlineStatusEditFileFunction · 0.85
TestInlineStatusBashFunction · 0.85
TestInlineStatusGenericFunction · 0.85

Calls 1

firstLineFunction · 0.70

Tested by 6

TestInlineStatusReadFileFunction · 0.68
TestInlineStatusEditFileFunction · 0.68
TestInlineStatusBashFunction · 0.68
TestInlineStatusGenericFunction · 0.68