(session-state): local-transcript adapter for sessions launched outside the app - #269
Merged
Merged
Conversation
…de the app Step 4 of #246. The main process turns transcript growth seen by the existing ~/.claude/projects watcher into a coalesced session-transcript-activity event for sessions that have no PTY in the app; the renderer adapter feeds a local-transcript state (busy on event, decay without arming response-ready, liveness and status from the CLI descriptor) into the shared projection, and hands the row to the local-pty path as soon as the user opens it.
This was referenced Sep 11, 2026
Merged
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.
Step 4 of #246, after #268.
What
local-transcript-activity.js(main, pure factory): from the existingfs.watch(PROJECTS_DIR)callback, a top-level<folder>/<sessionId>.jsonlchange becomes{ sessionId, at }on a newsession-transcript-activitychannel, coalesced to one event per second per session, and only when the session has no live PTY in the app (sessionHasPty, same matching ascli-session-state'sfindSession). Subagent legs are ignored (step 5). The event stays out of the debouncedflushChanges()path. No second watcher.public/local-transcript-adapter.js: one persistentcreateSessionState('local-transcript')per id; event →transcriptTouched+busy:true; 20 s decay →busy:false, armReady:false(never.response-ready, neverwaitingForInput/attention);liveness:'alive'+descriptorStatusfromsession.status/statusUpdatedAtwhen present;attached:false. Painting through the existing projection (applyStateClasses/ slot) — no new class writer.app.js updateRunningIndicatorscallslocalTranscriptPtyTakeover(id)when a non-remote row gains a PTY (timer and state dropped, slot repainted by the local-pty path). Timers pruned on sidebar refresh.preload.js:onSessionTranscriptActivity. Docs:session-state.md(ports table, adapter section, status "steps 1-4 done, 5 pending"),session-cache.md,ipc-bridge.md.Proof
test/local-transcript-activity.test.js(session id from watch parts, subagent leg ignored, PTY-owned session ignored, coalescing),test/main-local-transcript-wiring.test.js(source check of the wiring),test/local-transcript-adapter.test.js(event → busy, decay → idle without response-ready, PTY takeover),test/dom-sidebar-local-transcript.test.js(row without PTY: busy slot after event, age and no response-ready after decay).armReady:trueturns two tests red; reverted.task check: 1205 + 119 pass, 0 fail, pre-existing skips (commit hook run at CPU 100 %, green).Not verified in the running app: the watcher event on a real external CLI session (tests only).