Skip to content

feat: add VS Code extension panel session support#77

Open
drewf wants to merge 2 commits intopablodelucca:mainfrom
drewf:feature/extension-session-support
Open

feat: add VS Code extension panel session support#77
drewf wants to merge 2 commits intopablodelucca:mainfrom
drewf:feature/extension-session-support

Conversation

@drewf
Copy link

@drewf drewf commented Mar 6, 2026

Adds support for Claude Code sessions running in the VS Code native extension panel (WebSocket transport, no terminal object). These sessions produce identical JSONL transcripts but were invisible because pixel-agents was coupled to vscode.Terminal.

Approach: Scan the project JSONL directory for active files not tracked by any agent, and adopt them as "external" sessions. Inspired by PR #43's external agent scanner concept, simplified without tmux features.

Changes:

  • src/types.ts — terminalRef optional, added isExternal flag
  • src/constants.ts — External scanning timing constants
  • src/fileWatcher.ts — External session detection, adoption, and stale cleanup
  • src/agentManager.ts — Persist/restore for external agents
  • src/PixelAgentsViewProvider.ts — Graceful handling for missing terminal

Note: Depends on #76 (fix: recognize 'Agent' tool name for sub-agent visualization) — merge that first for sub-agent visualization to work correctly.

Closes #74

drewf and others added 2 commits March 5, 2026 23:34
Claude Code renamed the sub-agent tool from 'Task' to 'Agent', breaking
sub-agent character spawning. The transcript parser only recognized 'Task'
in four places:

- PERMISSION_EXEMPT_TOOLS set
- formatToolStatus switch (generates 'Subtask:' status prefix)
- Tool completion handler (clears sub-agent tracking)
- Progress record handler (validates parent tool type)

Add 'Agent' alongside 'Task' in all four locations so sub-agent
characters spawn correctly with current Claude Code versions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Detect and track Claude Code sessions running in the VS Code native
extension panel (WebSocket transport), not just terminal-based sessions.

Changes:
- Make terminalRef optional in AgentState, add isExternal flag
- Add external session scanning (5s interval) for untracked JSONL files
- Auto-adopt recently-modified JSONL files as external agents
- Auto-remove stale external agents after 5min inactivity
- Handle optional terminalRef in focusAgent/closeAgent handlers
- Persist/restore external agents across window reloads

The JSONL transcript format is identical between terminal and extension
sessions, so the existing parsing pipeline works unmodified. Only
session discovery and lifecycle management needed changes (~15% of code).
@PolGuixe
Copy link

PolGuixe commented Mar 6, 2026

+1

3 similar comments
@durnonimous
Copy link

+1

@mattyx97
Copy link

mattyx97 commented Mar 7, 2026

+1

@JerryMalmstrom
Copy link

+1

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.

Support Claude Code VS Code extension (native panel) sessions

5 participants