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

Function extractInputTokens

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

Source from the content-addressed store, hash-verified

73}
74
75function extractInputTokens(value: unknown): DevToolsUsage["inputTokens"] | undefined {
76 if (typeof value === "number") {
77 return value;
78 }
79
80 if (!isRecord(value)) {
81 return undefined;
82 }
83
84 const total = extractTokenTotal(value);
85 if (total === undefined) {
86 return undefined;
87 }
88
89 return {
90 total,
91 noCache: extractOptionalTokenCount(value, "noCache"),
92 cacheRead: extractOptionalTokenCount(value, "cacheRead"),
93 cacheWrite: extractOptionalTokenCount(value, "cacheWrite"),
94 };
95}
96
97function extractOutputTokens(value: unknown): DevToolsUsage["outputTokens"] | undefined {
98 if (typeof value === "number") {

Callers 1

extractUsageFunction · 0.85

Calls 3

extractTokenTotalFunction · 0.85
isRecordFunction · 0.70

Tested by

no test coverage detected