Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(chat): restore missing chat runtime provider export

Steven Enamakela76442fdc635
diff --git a/app/src/providers/ChatRuntimeProvider.tsx b/app/src/providers/ChatRuntimeProvider.tsx
index baec81459d..add3fa5625 100644
--- a/app/src/providers/ChatRuntimeProvider.tsx
+++ b/app/src/providers/ChatRuntimeProvider.tsx
@@ -235,6 +235,9 @@ function hasCompleteSegmentDelivery(
return true;
}
+/** `extraMetadata` key under which `chatDoneExtraMetadata` stamps the turn's timing. */
+export const CHAT_TIMING_METADATA_KEY = 'timing';
+
function chatDoneExtraMetadata(event: ChatDoneEvent): Record<string, unknown> | undefined {
// Stamp the producing turn's request id so the final answer can be grouped
// with its per-turn process trail (Phase 4 anchoring, Option B — see the
@@ -242,6 +245,12 @@ function chatDoneExtraMetadata(event: ChatDoneEvent): Record<string, unknown> |
const meta: Record<string, unknown> = {};
if (event.citations?.length) meta.citations = event.citations;
if (event.request_id) meta.requestId = event.request_id;
+ // Carried through to `metadata.timing` on the converted `ThreadMessageLike`
+ // (`assistantUiMessages.ts`), which is what the vendored `MessageTiming`
+ // element (`useMessageTiming()`) reads to show TTFT/total/tok-s on a
+ // settled reply. `chat_done.timing` is the only place these numbers exist —
+ // there is no per-message timing RPC.
+ if (event.timing) meta[CHAT_TIMING_METADATA_KEY] = event.timing;
return Object.keys(meta).length > 0 ? meta : undefined;
}