fix: expose tool call summaries in otel (#216)
This commit is contained in:
@@ -1510,16 +1510,22 @@ function toolCallSummaryFromNotification(message: JsonRecord): JsonRecord | null
|
|||||||
const item = asRecordAt(asRecordAt(message, "params"), "item");
|
const item = asRecordAt(asRecordAt(message, "params"), "item");
|
||||||
const itemType = typeof item.type === "string" ? item.type : "unknown";
|
const itemType = typeof item.type === "string" ? item.type : "unknown";
|
||||||
if (!isVisibleCodexToolItemType(itemType)) return null;
|
if (!isVisibleCodexToolItemType(itemType)) return null;
|
||||||
const command = toolCallCommandSummary(item, itemType, toolCallName(item, itemType));
|
const redacted = redactJson(item);
|
||||||
|
const command = toolCallCommandSummary(redacted, itemType, toolCallName(redacted, itemType));
|
||||||
|
const outputSummary = toolCallOutputSummary(redacted);
|
||||||
return {
|
return {
|
||||||
method,
|
method,
|
||||||
itemId: stringAt(item, "id"),
|
itemId: stringAt(redacted, "id"),
|
||||||
itemType,
|
itemType,
|
||||||
toolName: toolCallName(item, itemType),
|
toolName: toolCallName(redacted, itemType),
|
||||||
status: toolCallStatus(method, item),
|
status: toolCallStatus(method, item),
|
||||||
exitCode: typeof item.exitCode === "number" ? item.exitCode : null,
|
exitCode: typeof redacted.exitCode === "number" ? redacted.exitCode : null,
|
||||||
durationMs: typeof item.durationMs === "number" ? item.durationMs : null,
|
durationMs: typeof redacted.durationMs === "number" ? redacted.durationMs : null,
|
||||||
|
cwd: typeof redacted.cwd === "string" ? redacted.cwd : null,
|
||||||
|
processId: typeof redacted.processId === "string" || typeof redacted.processId === "number" ? String(redacted.processId) : null,
|
||||||
|
command: command ? String(boundedTextSummary(command, { limitChars: 600 }).text) : null,
|
||||||
commandFingerprint: command ? shortHash(command) : null,
|
commandFingerprint: command ? shortHash(command) : null,
|
||||||
|
outputSummary: outputSummary ? String(boundedTextSummary(outputSummary, { limitChars: 600 }).text) : null,
|
||||||
valuesPrinted: false,
|
valuesPrinted: false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user