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

Method handleUsage

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

* 处理 token 使用信息

(usage: CodexEvent['usage'])

Source from the content-addressed store, hash-verified

393 return [{ type: 'edit', path }];
394 });
395
396 const summary = fileChanges.length > 0
397 ? fileChanges
398 .map((c) => ('path' in c ? `${c.type}: ${c.path}` : `${c.type}: ${c.from} → ${c.to}`))
399 .join('\n')
400 : 'File changes';
401
402 const entry = createToolUse('apply_patch', summary, 'file_edit', item.id, item.id);
403 this.upsertItemEntry(item.id, {
404 ...entry,
405 metadata: {
406 ...entry.metadata,
407 status: this.getMcpToolStatus(item),
408 ...(fileChanges.length > 0 ? { fileChanges } : {}),
409 },
410 });

Callers 1

handleEventMethod · 0.95

Calls 4

createTokenUsageInfoFunction · 0.85
addNormalizedEntryFunction · 0.85
nextMethod · 0.80
pushPatchMethod · 0.80

Tested by

no test coverage detected