MCPcopy Create free account
hub / github.com/Work-Fisher/code-claw / parseLastJsonLine

Function parseLastJsonLine

tools/claw-launcher-ui/server.mjs:2352–2367  ·  view source on GitHub ↗
(text)

Source from the content-addressed store, hash-verified

2350}
2351
2352function parseLastJsonLine(text) {
2353 const lines = stripAnsi(text)
2354 .split('\n')
2355 .map(line => line.trim())
2356 .filter(Boolean)
2357
2358 for (let index = lines.length - 1; index >= 0; index -= 1) {
2359 try {
2360 return JSON.parse(lines[index])
2361 } catch {
2362 // keep scanning
2363 }
2364 }
2365
2366 return null
2367}
2368
2369function buildToolArtifacts(payload) {
2370 const uses = Array.isArray(payload?.tool_uses) ? payload.tool_uses : []

Callers 1

finalizeClawRunFunction · 0.85

Calls 2

stripAnsiFunction · 0.85
parseMethod · 0.45

Tested by

no test coverage detected