From 532135bc9bd842db7e8c1b65f7c8b4ef326481f7 Mon Sep 17 00:00:00 2001 From: Cameron Pfiffer Date: Mon, 10 Aug 2026 17:29:44 -0700 Subject: [PATCH] Stream inspector updates from Jazz. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Push content-dark change signals over SSE so root activity, run state, counts, and selected-source observations refresh without exposing the raw Jazz account to the browser. 👾 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta Code --- src/jazz/store.ts | 16 ++++++++++ src/web/inspector.ts | 61 +++++++++++++++++++++++++++++++++++-- test/inspector.test.ts | 68 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 142 insertions(+), 3 deletions(-) diff --git a/src/jazz/store.ts b/src/jazz/store.ts index 17a7ba0..854c3e4 100644 --- a/src/jazz/store.ts +++ b/src/jazz/store.ts @@ -834,6 +834,22 @@ export class JazzThoughtStore { ); } + subscribeInspectorActivity(onChange: () => void): () => void { + const unsubscribers = [ + this.db.subscribeAll( + thoughtstreamApp.events.where({}).orderBy("observedAt", "desc").limit(1), + () => onChange(), + ), + this.db.subscribeAll( + thoughtstreamApp.sources.where({}), + () => onChange(), + ), + ]; + return () => { + for (const unsubscribe of unsubscribers) unsubscribe(); + }; + } + async queryConsumerEvents(query: ConsumerEventQuery): Promise { if (query.eventTypes.length === 0 || query.acceptedPrivacy.length === 0) return []; const rows = await this.db.all(thoughtstreamApp.events.where({ diff --git a/src/web/inspector.ts b/src/web/inspector.ts index 4ef4655..159a614 100644 --- a/src/web/inspector.ts +++ b/src/web/inspector.ts @@ -194,6 +194,10 @@ async function handleRequest( }); return; } + if (url.pathname === "/api/live") { + streamInspectorActivity(store, request, response); + return; + } if (url.pathname === "/api/proposals") { sendJson(response, 200, await projectProposalQueue(store)); return; @@ -572,7 +576,7 @@ export function renderInspectorHtml(): string {

thought stream

loading
root activity…
Loading root activity…
Select an observation to see what processed it and what, if anything, happened.