MCPcopy Create free account
hub / github.com/Noumena-Network/code / buildCostCommandText

Function buildCostCommandText

src/commands/cost/cost.ts:11–38  ·  view source on GitHub ↗
(params: {
  session: CommandAvailabilitySession
  totalCost: string
  isUsingOverage: boolean
  isInternalBuild: boolean
})

Source from the content-addressed store, hash-verified

9} from '../../utils/commandAvailability.js'
10
11export function buildCostCommandText(params: {
12 session: CommandAvailabilitySession
13 totalCost: string
14 isUsingOverage: boolean
15 isInternalBuild: boolean
16}): string {
17 const { session, totalCost, isUsingOverage, isInternalBuild } = params
18
19 if (!hasOauthCommandAvailabilitySession(session)) {
20 return totalCost
21 }
22
23 let value: string
24
25 if (isUsingOverage) {
26 value =
27 'You are currently using your overages to power your Code usage. We will automatically switch you back to your subscription rate limits when they reset'
28 } else {
29 value =
30 'You are currently using your subscription to power your Code usage'
31 }
32
33 if (isInternalBuild) {
34 value += `\n\n[NOUMENA-ONLY] Showing cost anyway:\n ${totalCost}`
35 }
36
37 return value
38}
39
40export const call: LocalCommandCall = async () => {
41 const totalCost = formatTotalCost()

Callers 2

callFunction · 0.85
cost.test.tsFile · 0.85

Calls 1

Tested by

no test coverage detected