@1presence/bridge 0.89.0 → 0.90.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +4 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -303,7 +303,7 @@ async function handleMessage(conversationId, text, sessionId, history, auth, vau
|
|
|
303
303
|
const startedAt = Date.now();
|
|
304
304
|
const turnSessionId = sessionId ?? conversationId;
|
|
305
305
|
const claudePinnedSessionId = isUuid(conversationId) ? conversationId : crypto.randomUUID();
|
|
306
|
-
function buildSpoolRecord(usage, model) {
|
|
306
|
+
function buildSpoolRecord(usage, model, contextTokens) {
|
|
307
307
|
const s = accumulator.state();
|
|
308
308
|
return {
|
|
309
309
|
sessionId: turnSessionId,
|
|
@@ -317,6 +317,7 @@ async function handleMessage(conversationId, text, sessionId, history, auth, vau
|
|
|
317
317
|
usage: usage
|
|
318
318
|
? { ...usage, ...(model ? { model } : {}) }
|
|
319
319
|
: null,
|
|
320
|
+
...(typeof contextTokens === 'number' && contextTokens > 0 ? { contextTokens } : {}),
|
|
320
321
|
startedAt,
|
|
321
322
|
finalizedAt: Date.now(),
|
|
322
323
|
};
|
|
@@ -404,9 +405,10 @@ async function handleMessage(conversationId, text, sessionId, history, auth, vau
|
|
|
404
405
|
costUsd,
|
|
405
406
|
model,
|
|
406
407
|
usage: mapped,
|
|
408
|
+
...(contextTokens > 0 ? { contextTokens } : {}),
|
|
407
409
|
}));
|
|
408
410
|
}
|
|
409
|
-
void finalizeAndPost(buildSpoolRecord(mapped, model));
|
|
411
|
+
void finalizeAndPost(buildSpoolRecord(mapped, model, contextTokens));
|
|
410
412
|
},
|
|
411
413
|
onError: (message, usage, model) => {
|
|
412
414
|
const elapsed = stopTurnTimer();
|