MCPcopy Create free account
hub / github.com/agent-tower/core / finish

Method finish

packages/server/src/output/codex-parser.ts:463–482  ·  view source on GitHub ↗

* 完成解析

(exitCode?: number)

Source from the content-addressed store, hash-verified

461
462 return lines.join('\n');
463 }
464
465 private formatJsonValue(value: unknown): string {
466 if (typeof value === 'string') {
467 return stripAnsiSequences(value);
468 }
469
470 try {
471 return stripAnsiSequences(JSON.stringify(value, null, 2));
472 } catch {
473 return stripAnsiSequences(String(value));
474 }
475 }
476
477 private getMcpToolStatus(item: CodexItem): ToolStatus {
478 const rawStatus = item.status?.toLowerCase();
479
480 if (item.error != null) return 'failed';
481 if (rawStatus === 'completed' || rawStatus === 'success' || rawStatus === 'succeeded') return 'success';
482 if (rawStatus === 'failed' || rawStatus === 'error' || rawStatus === 'cancelled' || rawStatus === 'canceled') return 'failed';
483 if (rawStatus === 'denied') return 'denied';
484 if (rawStatus === 'pending_approval') return 'pending_approval';
485 if (rawStatus === 'timed_out' || rawStatus === 'timeout') return 'timed_out';

Callers

nothing calls this directly

Calls 7

parseJsonSegmentsMethod · 0.95
createErrorMessageFunction · 0.85
addNormalizedEntryFunction · 0.85
trimMethod · 0.80
nextMethod · 0.80
pushPatchMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected