Skip to content

(session-state): local-transcript adapter for sessions launched outside the app - #269

Merged
devsuitup merged 1 commit into
mainfrom
feat/246-local-transcript
Sep 11, 2026
Merged

devsuitup merged 1 commit into
mainfrom
feat/246-local-transcript

Conversation

@devsuitup

Copy link
Copy Markdown
Owner

Step 4 of #246, after #268.

What

  • local-transcript-activity.js (main, pure factory): from the existing fs.watch(PROJECTS_DIR) callback, a top-level <folder>/<sessionId>.jsonl change becomes { sessionId, at } on a new session-transcript-activity channel, coalesced to one event per second per session, and only when the session has no live PTY in the app (sessionHasPty, same matching as cli-session-state's findSession). Subagent legs are ignored (step 5). The event stays out of the debounced flushChanges() path. No second watcher.
  • public/local-transcript-adapter.js: one persistent createSessionState('local-transcript') per id; event → transcriptTouched + busy:true; 20 s decay → busy:false, armReady:false (never .response-ready, never waitingForInput/attention); liveness:'alive' + descriptorStatus from session.status/statusUpdatedAt when present; attached:false. Painting through the existing projection (applyStateClasses / slot) — no new class writer.
  • PTY takeover: app.js updateRunningIndicators calls localTranscriptPtyTakeover(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).
  • Mutation: decay with armReady:true turns 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).

…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.
@devsuitup
devsuitup merged commit 317b04b into main Sep 11, 2026
10 checks passed
@devsuitup
devsuitup deleted the feat/246-local-transcript branch September 11, 2026 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant