feat: add Connect to Pixel Agents terminal context menu#53
Open
pghoya2956 wants to merge 3 commits intopablodelucca:mainfrom
Open
feat: add Connect to Pixel Agents terminal context menu#53pghoya2956 wants to merge 3 commits intopablodelucca:mainfrom
pghoya2956 wants to merge 3 commits intopablodelucca:mainfrom
Conversation
- Create agentFactory.ts with createAgentState() to eliminate 4-site duplication
- Apply factory in agentManager.ts (launchNewTerminal, restoreAgents)
- Fix OfficeCanvas wheel handler: use DOM addEventListener with { passive: false }
instead of React onWheel to allow preventDefault without console warnings
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Export adoptTerminalForFile for reuse by other modules - Add terminal double-adoption guard (prevents same terminal from being adopted twice) - Return number | null (adopted agent ID or null if skipped) - Use createAgentState factory Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add terminal tab right-click → "Connect to Pixel Agents" command for manually connecting a terminal running Claude to a character - Resolve project dir via shellIntegration.cwd → creationOptions.cwd → single-root workspace fallback - Find best untracked JSONL file by mtime, skip past history - Improve auto-adoption: when only 1 unowned terminal exists, adopt it automatically without requiring focus - Update CLAUDE.md with new architecture entry and adoption docs Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ziomik
pushed a commit
to ziomik/pixel-agents
that referenced
this pull request
Mar 5, 2026
Implemented multi-building town layout with worker movement based on workflow state. ## What's Implemented ### Building Zones System - Created buildingZones.ts with 7 building definitions: - Planning Area (3 seats, whiteboards) - To Do Office (3 seats, desks) - Doing Office (8 seats, desks + computers) - Review Room (4 seats, meeting table) - Testing Lab (4 seats, testing stations) - Done Lounge (4 seats, relaxation area) - Park (4 seats, benches) - Each building has bounds, seat IDs, entry points for pathfinding ### Town Layout - Created townLayout.ts with complete furniture placement - 30x24 tile grid with buildings in distinct zones - Proper desk+chair combinations for auto-facing detection - Decorations (plants, cooler, whiteboards, PCs) - Walkable floor with wall boundaries ### Movement Logic - Created buildingMovement.ts with: - moveCharacterToBuilding() - finds seat, calculates path, moves worker - isCharacterInBuilding() - checks if already in target building - Automatic seat assignment within buildings - Pathfinding integration (uses existing A* from tileMap) ### Data Integration - Extended DevClawWorker interface with currentBuilding field - Backend sends: 'doing' | 'review' | 'testing' | 'done' | 'park' | 'planning' | 'todo' - Defaults: active workers → 'doing', idle → 'park' ### DevClawApp Updates - Uses townLayout instead of default office layout - Initial spawn: assigns workers to correct building based on currentBuilding - useEffect listener: moves workers when currentBuilding changes - Proper seat assignment and collision handling ## Acceptance Criteria ✅ Town layout includes all 6+ building types ✅ Workers spawn in correct buildings based on initial state ✅ Workers walk (with animation) when currentBuilding changes ✅ Collision detection works (uses existing tileMap system) ✅ Multiple workers can be in same building (multiple seats per building) ✅ Zoom level preserved (4x, already configured) Note: Office tileset (office-tileset.png) exists in public/assets but not integrated into renderer - current implementation uses pixel-agents default sprites with new layout structure. Tileset rendering would require deeper changes to sprite system. ## Files - webview-ui/src/office/layout/buildingZones.ts (new) - webview-ui/src/office/layout/townLayout.ts (new) - webview-ui/src/office/engine/buildingMovement.ts (new) - webview-ui/src/hooks/useDevClawData.ts (updated) - webview-ui/src/DevClawApp.tsx (updated) - webview-ui/src/devclawApi.ts (new - WebSocket helper) - webview-ui/src/main.tsx (updated - DevClawApp integration) - webview-ui/src/vscodeApi.ts (updated)
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
AgentStatefactory (agentFactory.ts) to eliminate 4-site initialization duplicationOfficeCanvasProblem
Previously, only terminals created via the "+ Agent" button were tracked. Users running
claudedirectly in a terminal got no character. The auto-detection logic only tried the focused terminal, which was timing-dependent and failed entirely with multiple terminals.Solution
Manual connect (primary path): Terminal tab right-click → "Connect to Pixel Agents" → resolves project dir → finds best untracked JSONL by mtime → creates character. Works reliably with any number of terminals.
1:1 auto-adopt (convenience): When a new JSONL file appears and exactly 1 unowned terminal exists, auto-adopt without requiring focus.
Changes
src/constants.tsCOMMAND_CONNECT_TERMINALconstantpackage.jsonterminal/title/contextmenusrc/extension.tssrc/PixelAgentsViewProvider.tsconnectTerminal(),resolveProjectDir(),findBestJsonlFile()src/fileWatcher.tsadoptTerminalForFilewith guardsrc/agentFactory.tscreateAgentState()factorysrc/agentManager.tswebview-ui/src/office/components/OfficeCanvas.tsxCLAUDE.mdTest plan
claude→ character appearsclaude→ auto character creation (no focus needed)🤖 Generated with Claude Code