diff --git a/src/agents/pi-embedded-subscribe.ts b/src/agents/pi-embedded-subscribe.ts index 0d0a6c6102dee..3eaeec6110a51 100644 --- a/src/agents/pi-embedded-subscribe.ts +++ b/src/agents/pi-embedded-subscribe.ts @@ -526,7 +526,10 @@ export function subscribeEmbeddedPiSession(params: SubscribeEmbeddedPiSessionPar const startTime = Date.now(); log.info(`[TRACE] stripBlockTags start textLength=${text.length} timestamp=${startTime}`); if (!text) { - log.info(`[TRACE] stripBlockTags end textLength=${text.length}RdurationMs=${endTime - startTime} timestamp=${endTime}`); + const endTime = Date.now(); + log.info( + `[TRACE] stripBlockTags end textLength=${text.length}RdurationMs=${endTime - startTime} timestamp=${endTime}`, + ); return text; } @@ -573,8 +576,11 @@ export function subscribeEmbeddedPiSession(params: SubscribeEmbeddedPiSessionPar if (!params.enforceFinalTag) { state.inlineCode = finalCodeSpans.inlineState; FINAL_TAG_SCAN_RE.lastIndex = 0; - out = stripTagsOutsideCodeSpans(processed, FINAL_TAG_SCAN_RE, finalCodeSpans.isInside); - log.info(`[TRACE] stripBlockTags end textLength=${text.length}RdurationMs=${endTime - startTime} timestamp=${endTime}`); + const out = stripTagsOutsideCodeSpans(processed, FINAL_TAG_SCAN_RE, finalCodeSpans.isInside); + const endTime = Date.now(); + log.info( + `[TRACE] stripBlockTags end textLength=${text.length}RdurationMs=${endTime - startTime} timestamp=${endTime}`, + ); return out; } @@ -614,7 +620,10 @@ export function subscribeEmbeddedPiSession(params: SubscribeEmbeddedPiSessionPar // we have seen a tag. Otherwise, we leak "thinking out loud" text // (e.g. "**Locating Manulife**...") that the model emitted without tags. if (!everInFinal) { - log.info(`[TRACE] stripBlockTags end textLength=${text.length}RdurationMs=${endTime - startTime} timestamp=${endTime}`); + const endTime = Date.now(); + log.info( + `[TRACE] stripBlockTags end textLength=${text.length}RdurationMs=${endTime - startTime} timestamp=${endTime}`, + ); return ""; } @@ -623,8 +632,10 @@ export function subscribeEmbeddedPiSession(params: SubscribeEmbeddedPiSessionPar const resultCodeSpans = buildCodeSpanIndex(result, inlineStateStart); state.inlineCode = resultCodeSpans.inlineState; const endTime = Date.now(); - out = stripTagsOutsideCodeSpans(result, FINAL_TAG_SCAN_RE, resultCodeSpans.isInside); - log.info(`[TRACE] stripBlockTags end textLength=${text.length}RdurationMs=${endTime - startTime} timestamp=${endTime}`); + const out = stripTagsOutsideCodeSpans(result, FINAL_TAG_SCAN_RE, resultCodeSpans.isInside); + log.info( + `[TRACE] stripBlockTags end textLength=${text.length}RdurationMs=${endTime - startTime} timestamp=${endTime}`, + ); return out; };