MCPcopy
hub / github.com/coder/mux / resolveTotalUsageForStreamEnd

Method resolveTotalUsageForStreamEnd

src/node/services/streamManager.ts:968–981  ·  view source on GitHub ↗
(
    streamInfo: WorkspaceStreamInfo,
    totalUsage: LanguageModelV2Usage | undefined
  )

Source from the content-addressed store, hash-verified

966 }
967
968 private resolveTotalUsageForStreamEnd(
969 streamInfo: WorkspaceStreamInfo,
970 totalUsage: LanguageModelV2Usage | undefined
971 ): LanguageModelV2Usage | undefined {
972 const cumulativeUsage = streamInfo.cumulativeUsage;
973 if (
974 (streamInfo.didRetryPreviousResponseIdAtStep || streamInfo.didRetryAfterEmptyOutput) &&
975 hasTokenUsage(cumulativeUsage)
976 ) {
977 return cumulativeUsage;
978 }
979
980 return totalUsage;
981 }
982
983 private async backfillReasoningTokensFromParts(
984 streamInfo: Pick<

Calls 1

hasTokenUsageFunction · 0.85

Tested by

no test coverage detected