MCPcopy Create free account
hub / github.com/agentforce314/clawcodex / parseToolTrailResultLine

Function parseToolTrailResultLine

ui-tui/src/lib/text.ts:252–272  ·  view source on GitHub ↗
(line: string)

Source from the content-addressed store, hash-verified

250export const isToolTrailResultLine = (line: string) => line.endsWith(' ✓') || line.endsWith(' ✗')
251
252export const parseToolTrailResultLine = (line: string) => {
253 if (!isToolTrailResultLine(line)) {
254 return null
255 }
256
257 const mark = line.endsWith(' ✗') ? '✗' : '✓'
258 const body = line.slice(0, -2)
259 const sep = body.indexOf(' :: ')
260
261 if (sep >= 0) {
262 return { call: body.slice(0, sep), detail: body.slice(sep + 4), mark }
263 }
264
265 const legacy = body.indexOf(': ')
266
267 if (legacy > 0) {
268 return { call: body.slice(0, legacy), detail: body.slice(legacy + 2), mark }
269 }
270
271 return { call: body, detail: '', mark }
272}
273
274export const splitToolDuration = (call: string) => {
275 const match = call.match(/^(.*?)( \(\d+(?:\.\d)?s\))$/)

Callers 2

thinking.tsxFile · 0.85
text.test.tsFile · 0.85

Calls 1

isToolTrailResultLineFunction · 0.85

Tested by

no test coverage detected