MCPcopy Index your code
hub / github.com/coder/mux / extractOutputTokens

Function extractOutputTokens

src/node/services/devToolsMiddleware.ts:97–116  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

95}
96
97function extractOutputTokens(value: unknown): DevToolsUsage["outputTokens"] | undefined {
98 if (typeof value === "number") {
99 return value;
100 }
101
102 if (!isRecord(value)) {
103 return undefined;
104 }
105
106 const total = extractTokenTotal(value);
107 if (total === undefined) {
108 return undefined;
109 }
110
111 return {
112 total,
113 text: extractOptionalTokenCount(value, "text"),
114 reasoning: extractOptionalTokenCount(value, "reasoning"),
115 };
116}
117
118function createEmptyStep(
119 stepId: string,

Callers 1

extractUsageFunction · 0.85

Calls 3

extractTokenTotalFunction · 0.85
isRecordFunction · 0.70

Tested by

no test coverage detected