MCPcopy Create free account
hub / github.com/Noumena-Network/code / classifyToolResultContext

Function classifyToolResultContext

src/buddy/observer.ts:285–304  ·  view source on GitHub ↗
(
  toolOutput: string,
)

Source from the content-addressed store, hash-verified

283}
284
285function classifyToolResultContext(
286 toolOutput: string,
287): 'error' | 'large-diff' | 'test-fail' | null {
288 if (!toolOutput) {
289 return null
290 }
291 if (TEST_FAIL_RE.test(toolOutput)) {
292 return 'test-fail'
293 }
294 if (ERROR_RE.test(toolOutput)) {
295 return 'error'
296 }
297 if (/^(@@ |diff )/m.test(toolOutput)) {
298 const changedLineCount = toolOutput.match(/^[+-](?![+-])/gm)?.length ?? 0
299 if (changedLineCount > LARGE_DIFF_THRESHOLD) {
300 return 'large-diff'
301 }
302 }
303 return null
304}
305
306function buildReactionTranscript(
307 messages: readonly Message[],

Callers 1

fireCompanionObserverFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected