INNER CODE UNIT · TypeScript
rememberNativeCard
celia-sh/Novella · .pi/extensions/trellis/index.ts:175
function rememberNativeCard(id: string, card: NativeCardHandle) {
nativeCards.set(id, card);
const active = activeSubagentToolCallId
? nativeCards.get(activeSubagentToolCallId)
: undefined;
if (!active || card.updatedAt >= active.updatedAt)
activeSubagentToolCallId = id;
for (const key of nativeCards.keys()) {
if (nativeCards.size <= MAX_NATIVE_CARDS) break;
if (key !== activeSubagentToolCallId) nativeCards.delete(key);
}
}
function totalUsage(d: ProgressDetails): Usage {
const u: Usage = {
input: 0,
output: 0,
cacheRead: 0,
cacheWrite: 0,