MCPcopy Index your code
hub / github.com/simstudioai/sim / buildDeltaEntries

Method buildDeltaEntries

apps/sim/lib/logs/execution/logger.ts:1326–1354  ·  view source on GitHub ↗
(alreadyBilled: Map<string, number>)

Source from the content-addressed store, hash-verified

1324 // (delta 0 at terminal) and only genuinely new usage is charged. A future
1325 // change that relabels historical spans would break this invariant.
1326 const buildDeltaEntries = (alreadyBilled: Map<string, number>) => {
1327 const entries: Array<{
1328 category: 'model' | 'fixed' | 'tool'
1329 source: 'workflow'
1330 description: string
1331 cost: number
1332 eventKey: string
1333 metadata?: ModelUsageMetadata | null
1334 }> = []
1335 for (const line of targets) {
1336 const billed = alreadyBilled.get(`${line.category}::${line.description}`) ?? 0
1337 const delta = line.target - billed
1338 if (delta <= COST_EPSILON) continue
1339 entries.push({
1340 category: line.category,
1341 source: 'workflow',
1342 description: line.description,
1343 cost: delta,
1344 eventKey: stableEventKey({
1345 executionId: executionId ?? '',
1346 category: line.category,
1347 description: line.description,
1348 billedBefore: billed.toFixed(8),
1349 }),
1350 ...(line.metadata !== undefined ? { metadata: line.metadata } : {}),
1351 })
1352 }
1353 return entries
1354 }
1355
1356 if (executionId) {
1357 // Serialize concurrent completion boundaries for this execution so the

Callers

nothing calls this directly

Calls 3

stableEventKeyFunction · 0.90
getMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected