(
usage: MakaPiUsageSummary,
msg: {
costUsd?: number;
input?: number;
cacheHitInput?: number;
cacheRead?: number;
cacheWriteInput?: number;
cacheCreation?: number;
cacheMissInput?: number;
contextRemaining?: number;
},
)
| 212 | } |
| 213 | |
| 214 | function accumulateUsage( |
| 215 | usage: MakaPiUsageSummary, |
| 216 | msg: { |
| 217 | costUsd?: number; |
| 218 | input?: number; |
| 219 | cacheHitInput?: number; |
| 220 | cacheRead?: number; |
| 221 | cacheWriteInput?: number; |
| 222 | cacheCreation?: number; |
| 223 | cacheMissInput?: number; |
| 224 | contextRemaining?: number; |
| 225 | }, |
| 226 | ): void { |
| 227 | usage.costUsd += msg.costUsd ?? 0; |
| 228 | const hit = msg.cacheHitInput ?? msg.cacheRead ?? 0; |
| 229 | const write = msg.cacheWriteInput ?? msg.cacheCreation ?? 0; |
| 230 | usage.cacheHitInput += hit; |
| 231 | usage.cacheMissInput += msg.cacheMissInput ?? Math.max(0, (msg.input ?? 0) - hit - write); |
| 232 | usage.contextRemaining = msg.contextRemaining; |
| 233 | } |
| 234 | |
| 235 | export function appendUserPrompt(state: MakaPiTranscriptState, text: string): void { |
| 236 | state.entries.push({ kind: 'user', text }); |
no outgoing calls
no test coverage detected