feat(agents-server-ui): add state explorer panel to entity view#4156
Open
feat(agents-server-ui): add state explorer panel to entity view#4156
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #4156 +/- ##
==========================================
- Coverage 68.08% 64.72% -3.36%
==========================================
Files 130 139 +9
Lines 16211 17174 +963
Branches 3912 4184 +272
==========================================
+ Hits 11037 11116 +79
- Misses 5170 6054 +884
Partials 4 4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Registers a durable `coding-session` entity that spawns claude/codex, mirrors their normalized JSONL event stream into the entity's durable stream, and exposes a dedicated UI for Create / Attach / Import flows (including cross-agent import via the normalized format). Key pieces: - agents-runtime: `HandlerContext.useCodingAgent(sessionId, opts)` + `codingSession(id)` observation source + `CodingSessionHandle` types. - agents: `registerCodingSession(registry, opts)` wires the entity. Per prompt, starts an fs-watch + poll loop that tails the JSONL via `tailSession` and appends events using content-derived idempotent keys so the UI sees user turns, assistant tokens, and tool calls as they land. First create-mode prompt discovers the CLI-assigned session id via pre/post `discoverSessions` diff. Import uses `importLocalSession` (same-agent: native rewrite; cross-agent: normalized round-trip). - agents-server-ui: `CodingSessionSpawnDialog` (Create/Attach/Import tabs), `CodingSessionTimeline` rendering NormalizedEvent variants via Streamdown + paired tool_call/tool_result blocks, `CodingSessionView` composing timeline + MessageInput, `useCodingSession` hook. Sidebar routes `coding-session` to the dedicated dialog; router branches body by entity type. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Three fixes to the coding-session handler: 1. Replace `discoverSessions` (reads ~/.claude/history.jsonl) with direct filesystem scanning of the project directory. `claude -p` doesn't register sessions in history, so discovery always returned 0 new sessions. Now scans ~/.claude/projects/<sanitized-cwd>/ for .jsonl files and diffs pre/post to find the CLI-created session. 2. Guard firstWake insert with `alreadyInitialized` check — the runtime can call the handler with firstWake=true multiple times if the manifest hasn't been written yet, causing a duplicate-key error on sessionMeta_insert. 3. Skip empty-text prompts (used as handler triggers for attach mode) instead of sending them to the CLI. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The runtime skips the handler on first wake when there's no fresh user input. For coding-session attach/import mode this means session history never loads until the user sends a prompt. Work around by sending an empty initial message on spawn — the handler skips empty-text prompts but still runs firstWake setup. Applied to both the UI (CodingSessionSpawnDialog) and the CLI (--initial-message flag on the spawn command). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds a collapsible right side panel to the entity view that visualizes StreamDB state in real-time. Adapts the 3-panel state visualizer (TypeList + StateTable + EventSidebar) from the Electric Cloud Dashboard. Supports time-travel through state events, FK navigation, column sorting/resizing, and live tail toggle. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Update pnpm-lock.yaml for new dependencies - Replace fixed 50% split with draggable vertical separator - Move events panel to horizontal bottom layout with draggable separator - Add consistent section headers (Types, Records, Events) with badges - Move state explorer toggle to header icon + dropdown menu - Fix overflow issues in all panel containers - Remove unused cursorIndex prop from StateTable - Fix highlighted row border-left shifting cells (use box-shadow) - Remove dead liveTail dependency from useEffect - Clean up unused imports and constant-as-state patterns Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… timeline Set ScrollArea to vertical-only scrollbars to prevent horizontal overflow sliders from appearing on hover. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…is open Use width: 100% with box-sizing: border-box on the timeline content wrapper so it respects the parent container width instead of expanding to fit code blocks. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…lorer Clear the virtualizer's cached row measurements when the viewport width changes (e.g. state explorer panel opens/closes). Without this, the virtualizer uses stale measurements from the previous width, causing broken absolute positioning of timeline rows. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…youts - Add a floating arrow-down button that appears when scrolled up in the timeline and scrolls to the latest entry on click - Move state explorer panel to EntityPage so it works for all entity types (horton + coding-session), not just generic entities - Fix React hooks violation: useCallback was after early returns - Fix layout shift when toggling state explorer button - Unify CodingSessionView to use the same fragment pattern as GenericEntityBody, removing redundant flex wrapper Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
c1553dd to
43aebbe
Compare
…imeline Adds the same floating arrow-down button to CodingSessionTimeline that was already added to EntityTimeline, ensuring consistent UX across both entity view types. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…olor Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Components
Test plan
pnpm --filter @electric-ax/agents-server-ui dev)🤖 Generated with Claude Code