Commit Graph

418 Commits

Author SHA1 Message Date
alex 6ee667c384 feat: add profile includes management UI
- Add includes section to profile editor with drag-and-drop reordering
- Display included profiles with scope badges (Global, Project, Tool)
- Add 'Add Include' dropdown filtered by compatibility and cycle prevention
- Add remove button per include row
- Save includes together with profile form
- Add include count badges to profile list sidebar
- Add drag icon to Icon component

Implements config-profile-includes-ui tasks 1.1-4.3
2026-05-24 21:02:07 +00:00
Fusion 21285498ae fix: mobile terminal black screen - replace grid with flexbox layout
- Root cause: CSS Grid 1fr row got 0 height inside flex parent
- Fix: Replace grid layout with flexbox column for mobile terminal wrapper
- Header and keys strip use flex-shrink: 0
- Content area uses flex: 1 to fill remaining space
- Remove debug logging
2026-05-24 23:00:32 +02:00
Fusion 9751b65dce debug: add more logging to trace mobile terminal black screen 2026-05-24 22:56:02 +02:00
Fusion 612217ad89 fix: mobile terminal black screen - grid cell had 0 height
- Root cause: .mobile-terminal-wrapper used height: 100vh inside flex parent
- Fix: Use flex: 1 instead so grid properly allocates 1fr height to content
- Add .shell.mobile-terminal-shell CSS to ensure full viewport coverage
- Remove debug logging
2026-05-24 22:51:31 +02:00
Fusion b9ea806c0d Merge branch 'dev' of ssh://git.commumedia.org:2222/alex/headquarter into dev 2026-05-24 22:46:55 +02:00
Fusion 22f736ce20 debug: add console logging to trace mobile terminal black screen issue 2026-05-24 22:46:48 +02:00
alex deb22bec0f fix: prevent duplicate session action requests causing 404s
- Add early return guards in all session action handlers (start, stop, delete, recreate tunnel)
- Prevents race conditions where double-clicks or rapid clicks fire duplicate API calls
- First delete succeeds, second would 404 because instance is already deleted
- Applied to both sessions page and dashboard/home page
2026-05-24 19:40:42 +00:00
alex 9320e175d1 Merge branch 'dev' of ssh://git.commumedia.org:2222/alex/headquarter into dev 2026-05-24 19:33:49 +00:00
alex d8f220d825 fix: unify session loading states across pages
- Add per-item busy overlay to SessionCard component
- Remove full-screen loading overlay from sessions page
- Remove loadingAction state, use per-item busy state only
- Add handleStart to sessions page for consistency
- Add session-card CSS for busy overlay positioning
- Both home and sessions pages now use same per-item loading pattern
2026-05-24 19:33:38 +00:00
Fusion 77b7c82563 Merge branch 'dev' of ssh://git.commumedia.org:2222/alex/headquarter into dev 2026-05-24 21:29:30 +02:00
Fusion 3fc392a314 fix: handle ERR_NETWORK_CHANGED from Docker network changes
- Add retry logic for transient network errors in API client
- Retry up to 2 times with exponential backoff on network errors
- Reduce session polling from 10s to 30s to decrease error frequency
- Handle 502/503/504 gateway errors with retries as well
2026-05-24 21:29:16 +02:00
alex edd8882fa0 Merge branch 'dev' of ssh://git.commumedia.org:2222/alex/headquarter into dev 2026-05-24 19:25:52 +00:00
alex 760369b102 fix: constrain loading overlays to components
- Add position: relative to create-session-form-wrapper so overlay fills only the form
- Remove text from instance busy overlay, show only spinner
- Delete progress indicator now fills only the target card
2026-05-24 19:25:42 +00:00
Fusion 8da527f964 Merge branch 'dev' of ssh://git.commumedia.org:2222/alex/headquarter into dev 2026-05-24 21:21:47 +02:00
Fusion 76fbd74d20 fix: ensure terminal opens before fit and add dimension guards
- Open terminal before calling fitTerminal() to avoid race conditions
- Add container dimension checks before fitting
- Add guards to prevent fit/refresh with 0x0 dimensions
- Only send resize messages when dimensions are valid
- Prevent xterm.js internal errors from invalid dimension access
2026-05-24 21:21:34 +02:00
alex 384beeca8a Merge branch 'dev' of ssh://git.commumedia.org:2222/alex/headquarter into dev 2026-05-24 19:20:32 +00:00
alex 869efda214 fix: per-item loading animations in instance list
- Replace full-screen loading with per-instance busy state
- Add busy overlay with spinner to instance cards
- Disable action buttons while instance is busy
- Add CSS for visual dimming and overlay positioning

Fixes add-config-profiles: instance UI polish
2026-05-24 19:20:21 +00:00
Fusion 51b5d723ac fix: terminal clear on reset and data loss for text starting with {
Frontend:
- Clear xterm.js screen when receiving 'connected' status after reset
- Send resize message after clearing to ensure proper dimensions
- Fixes terminal artifacts after reset

Backend:
- Fix data loss bug: text starting with '{' but not valid JSON was silently dropped
- Now writes such text to session as regular input
- Fixes missing characters when user types '{'
2026-05-24 21:15:04 +02:00
Fusion 33b482ce91 fix: terminal reconnect typing and reset functionality
Frontend:
- Fix term.onData to use wsRef.current instead of captured ws variable
- Fix fitTerminal to use wsRef.current for resize messages
- Fix sendData callback to use wsRef.current
- This fixes 'cannot type' after WebSocket reconnect

Backend:
- Add SessionRef class for mutable session reference
- Update _read_loop and _write_loop to use SessionRef
- Reset now updates session_ref.session instead of returning
- This keeps the WebSocket alive after reset instead of closing it
2026-05-24 20:57:33 +02:00
Fusion 0cb2eefd29 fix: send SIGWINCH to docker exec process for container terminal resize
Instead of sending stty commands through the user's terminal session
(which causes 'inappropriate ioctl' errors), send SIGWINCH signal to
the docker exec process on the host. Docker exec should forward this
to the container process, causing the shell to re-read its terminal size.

This avoids:
- Visible stty commands in the terminal
- ioctl errors from stty
- Interference with user's shell session
2026-05-24 20:47:14 +02:00
Fusion 5f5dc9c851 fix: revert docker exec -i change and use stty with line hiding
Reverted docker exec back to -it (required for interactive bash).
Instead, sends stty command with \r to hide it from the terminal display:
- \r moves cursor to start of line (overwrites prompt)
- stty command executes silently (no output on success)
- \r moves cursor back to start, hiding echoed command

This sends stty on EVERY resize so the container shell always matches
frontend dimensions.
2026-05-24 20:40:02 +02:00
Fusion 4864d269e8 Merge branch 'dev' of ssh://git.commumedia.org:2222/alex/headquarter into dev 2026-05-24 20:35:16 +02:00
Fusion 29e4bed9e6 fix: use docker exec -i instead of -it so host PTY resize propagates to container
Removes -t flag from docker exec so it uses our PTY slave directly instead
of creating its own PTY inside the container. This allows TIOCSWINSZ on the
host PTY master to propagate naturally to the container shell via SIGWINCH.

Also removes all stty command injection logic since resize now works natively.
2026-05-24 20:35:07 +02:00
alex c8da0ab6c4 fix: retry start/restart on network errors
When Docker starts a container, it creates network interfaces which
triggers Chrome's ERR_NETWORK_CHANGED error, aborting the request.
The backend successfully starts the container but the frontend never
gets the response, showing 'failed to create session' even though
the session is up.

Fix: Add retry with exponential backoff for startInstance and
restartInstance when network errors occur (no HTTP response).
Retries up to 2 times with 1.5s delay between attempts.

Fixes: False 'failed to create session' errors when launching tools.
2026-05-24 18:33:25 +00:00
alex b04a458975 Merge branch 'dev' of ssh://git.commumedia.org:2222/alex/headquarter into dev 2026-05-24 18:29:10 +00:00
alex 2299bd51ba fix: handle already-serialized mount dicts in profile update
When FastAPI parses the request body and model_dump() is called,
nested MountItem models are already serialized to plain dicts.
The update handler was unconditionally calling model_dump() again,
causing AttributeError on dict objects.

Fix: Check if mount items are already dicts before calling model_dump().

Fixes: 422 error when updating profiles with mounts.
2026-05-24 18:29:03 +00:00
Fusion 45fb0c753c Merge branch 'dev' of ssh://git.commumedia.org:2222/alex/headquarter into dev 2026-05-24 20:24:49 +02:00
Fusion c82e628e6f fix: send stty resize on every resize with hidden command output
Backend:
- Remove _stty_sent guard to send stty on EVERY resize
- Use stty -echo to hide command, then delete the command line with ANSI escapes
- Change log level from info to debug

Frontend:
- Add window resize listener as fallback to ResizeObserver
- 250ms debounce to avoid excessive refits
- Proper cleanup on unmount
2026-05-24 20:24:41 +02:00
alex 383a874bcf Merge branch 'dev' of ssh://git.commumedia.org:2222/alex/headquarter into dev 2026-05-24 18:23:08 +00:00
alex 18634387c7 feat: config profiles top-level navigation with split-pane UI
- Move Config Profiles from settings to top-level navigation
- Implement split-pane layout: profile list on left, editor on right
- Add project and tool type dropdowns with live data
- Keep form open after save with success feedback
- Add sticky save bar at bottom of editor
- Remove Config Profiles tab from Settings page

OpenSpec: add-config-profiles
2026-05-24 18:23:01 +00:00
Fusion 4b09f611d6 Merge branch 'dev' of ssh://git.commumedia.org:2222/alex/headquarter into dev 2026-05-24 20:13:17 +02:00
Fusion 5c998f5bf9 fix: revert all terminal resize fixes that caused layout issues
Reverted terminal.tsx, terminal_session.py, and terminal.py to clean state
from before the resize debugging saga. Removed:
- Debug console.log statements
- Explicit term.resize() calls that broke xterm.js
- position: relative CSS overrides on .xterm
- stty -echo wrapper and asyncio.sleep delay
- Extra requestAnimationFrame refresh calls

Kept:
- Mobile terminal features (special keys, modifiers, font size)
- ResizeObserver for container resize detection
- Basic fit() and WebSocket resize messaging
2026-05-24 20:13:10 +02:00
alex c595a513d5 Merge branch 'dev' of ssh://git.commumedia.org:2222/alex/headquarter into dev 2026-05-24 18:10:56 +00:00
alex 08bd8bf7f9 fix: config profile form focus loss and path validation messages
- Fix React key stability in env vars, files, and mount file inputs
  to prevent focus loss on every keystroke
- Improve validation error messages to explain Files vs Mounts
- Add helper text in UI clarifying relative vs absolute paths

Fixes focus loss bug and improves UX for path validation errors.
2026-05-24 18:10:51 +00:00
Fusion 1b7308d091 Merge branch 'dev' of ssh://git.commumedia.org:2222/alex/headquarter into dev 2026-05-24 20:04:02 +02:00
Fusion 1060cb60ed fix: remove position override on mobile xterm to prevent layout issues 2026-05-24 20:03:56 +02:00
alex b58696bb7e Merge branch 'dev' of ssh://git.commumedia.org:2222/alex/headquarter into dev 2026-05-24 18:00:54 +00:00
alex 4d0834069b chore: merge migration heads for remove_is_builtin and add_config_profiles 2026-05-24 18:00:49 +00:00
Fusion fc41b51bf0 Merge branch 'dev' of ssh://git.commumedia.org:2222/alex/headquarter into dev 2026-05-24 19:59:49 +02:00
Fusion 3dbb6321fc fix: force explicit resize and add delayed refit after WebSocket connect 2026-05-24 19:59:35 +02:00
alex 7282b91d99 Merge branch 'dev' of ssh://git.commumedia.org:2222/alex/headquarter into dev 2026-05-24 17:58:49 +00:00
alex 9ad11a021c feat: add config profiles
- Add ConfigProfile and ConfigProfileInclude data models with migrations
- Implement profile resolver service with ordered includes and merge rules
- Add profile CRUD API with validation, compatibility, and cycle detection
- Add instance API plumbing for profile selection on create/start/restart
- Add resolved profile preview and default resolution APIs
- Add frontend config profile API client and management UI
- Add launch/restart profile selection UI
- Add backend integration and unit tests (31 passing)

OpenSpec: add-config-profiles
Quality gates: ruff, TypeScript compile, 31 tests passing
2026-05-24 17:58:39 +00:00
Fusion 9f29ac15da fix: improve terminal resize with better stty command and logging 2026-05-24 19:52:00 +02:00
Fusion 3092038e40 debug: add console logging for terminal resize debugging 2026-05-24 19:44:21 +02:00
Fusion 738e01bb7c fix: add window resize fallback and delay refresh to next frame
- Add window resize listener as fallback for ResizeObserver
- Use 250ms debounce to avoid early layout reads
- Delay term.refresh() to next animation frame so renderer
  can process resize before we force redraw
- Clean up window resize listener on unmount
2026-05-24 19:31:15 +02:00
Fusion 4d0c70de98 fix: hide stty resize command from terminal output using ANSI escapes 2026-05-24 19:17:54 +02:00
Fusion 701bd57293 fix: send stty resize on every resize, not just first time
The _stty_sent guard prevented the container shell from updating its
terminal size after the first resize. This caused visual mismatches
where xterm.js displayed at the new size but the shell still wrapped
output at the old size.

Remove the guard so stty is sent on every resize event.
2026-05-24 19:07:37 +02:00
Fusion 85f04447ea fix: force xterm.js canvas redraw on resize via internal renderer 2026-05-24 18:51:15 +02:00
Fusion d931f3071d Revert "fix: add window resize listener and refresh on font size change"
This reverts commit 4a356fe88e.
2026-05-24 18:42:14 +02:00
Fusion 4a356fe88e fix: add window resize listener and refresh on font size change
- Add window resize listener to complement ResizeObserver
- Clear window resize timeout on cleanup
- Force term.refresh() after font size changes
- Send resize message after font size change
2026-05-24 18:18:41 +02:00