Browser-based terminal manager with ttyd, tmux, and persistent sessions
  • JavaScript 47.1%
  • Shell 17%
  • Dockerfile 14.3%
  • CSS 13%
  • HTML 8.6%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Claude Haiku d204fc30fd Add: Auto-create sessions for unknown named URLs
- Sessions are now auto-created when accessed with unknown named URLs
- Example: accessing /?session=teamwork creates a session on first access
- Invalid queries silently redirect (302) instead of returning errors (400/404)
- Refactored session creation logic into allocate_session() function
- Function handles atomic allocation with lock protection
- Improved error handling in terminal.js for better UX
- Comprehensive test updates for new auto-create behavior

Benefits:
✅ Seamless session creation on first access
✅ No error pages for unknown sessions
✅ Consistent behavior across numeric and named sessions
✅ Clean architectural refactor with lock-protected allocation
✅ Better user experience with silent redirects
2026-10-07 10:13:10 +00:00
build Add: Auto-create sessions for unknown named URLs 2026-10-07 10:13:10 +00:00
nginx Fix: Patch compatibility - restore Dockerfile and docker-compose settings 2026-10-07 08:29:04 +00:00
scripts Update: Add session labeling/renaming feature 2026-10-07 09:10:33 +00:00
tests Add: Auto-create sessions for unknown named URLs 2026-10-07 10:13:10 +00:00
.env.example Fix: Patch compatibility - restore Dockerfile and docker-compose settings 2026-10-07 08:29:04 +00:00
.gitattributes Initial commit: cloud-terminal Docker project 2026-10-06 14:31:50 +00:00
.gitignore Initial commit: cloud-terminal Docker project 2026-10-06 14:31:50 +00:00
docker-compose.yml Fix: Patch compatibility - restore Dockerfile and docker-compose settings 2026-10-07 08:29:04 +00:00
ENV.md Fix: Patch compatibility - restore Dockerfile and docker-compose settings 2026-10-07 08:29:04 +00:00
FIXES_APPLIED.md Update: New toolbar UI with searchable session selector 2026-10-07 08:54:41 +00:00
MIGRATION.md Refactor: Separate Nginx from terminal container into dedicated service 2026-10-07 07:43:23 +00:00
QUICKREF.md Update: Add session labeling/renaming feature 2026-10-07 09:10:33 +00:00
README.md Add: Auto-create sessions for unknown named URLs 2026-10-07 10:13:10 +00:00
STANDARDS_REVIEW.md Refactor: Separate Nginx from terminal container into dedicated service 2026-10-07 07:43:23 +00:00
WORKSPACE_SESSIONS.md Update: Add session labeling/renaming feature 2026-10-07 09:10:33 +00:00

Unknown named URLs now create a session with that name at the lowest available number within the URL folder. Existing named sessions reconnect. Invalid session query values redirect silently to / (main session 1). No warning banner is added. Creation failures such as permission errors still report an error rather than pretending a session was created.

Renamed sessions now have URL aliases: /?session=test or /claude?session=docker. Numbered URLs still attach to the same session and the toolbar replaces them with the current alias after loading. Names are unique within each folder’s running sessions, case-insensitively; different folders may reuse the same name; numeric-only names are reserved for session numbers. Spaces and Unicode are URL-encoded. Renaming changes the alias; an old named link now creates a new session under its former name if none exists, while numbered links remain stable. Labels/aliases last for the lifetime of their tmux session.

Rename fix: tmux set-option now uses an explicit session-qualified target. Failed commands are logged, and non-missing-session errors no longer report that the session disappeared.

Cloud Terminal

Two non-root Compose services: Nginx publishes the HTTP port; terminal runs the Python pages/session API, ttyd and tmux. The workspace and home volumes retain files. Browser disconnects preserve sessions; terminal-container restarts end live processes.

Start or update

Keep your existing .env and volume names. These files preserve your working Dockerfile, literal build.no_cache: true, and absolute Nginx bind mounts under /opt/claude/docker/cloud-terminal. If deploying elsewhere, change both Nginx bind mount source paths in docker-compose.yml to the real paths visible to the Docker daemon.

docker compose config -q
docker compose up -d --build
docker compose restart nginx

Rebuilding terminal ends current sessions. Saved files remain. Do not use down -v. The rebuild is required for ttyd's disableLeaveAlert option; a browser refresh alone does not apply it.

Open http://127.0.0.1:7681/ for the terminal. The Cloud Terminal home link opens / (main session 1). HOST_BIND_IP and HOST_PORT control host access. No login gateway is included.

Workspace and sessions

WORKSPACE_ROOT defaults to /workspace. / opens main at the root; /claude starts in /workspace/claude, creating it as needed. /claude?session=2 opens a separate session in that folder. Reopening an existing session preserves its current directory and running programs.

Names use one URL segment with 1–64 letters, numbers, hyphens or underscores, starting with a letter or number. Session 1 is the URL without a query. DEFAULT_SESSION (main by default) also aliases the root. See WORKSPACE_SESSIONS.md for details.

The old /_sessions page and its assets have been removed. All management is in the toolbar.

Toolbar

The centered Open new terminal... input searches all currently running sessions. Results sort by folder alphabetically, then session number. Enter opens the first result; arrow keys choose another. Every valid typed folder name has a creation action underneath: Open new session if that folder has running sessions, otherwise Open new terminal. It creates a numbered session and opens it in the same page.

At the right, the session menu lists only folders with running sessions. Selecting a folder reveals its numbered sessions and pencil/trash buttons. The currently displayed folder/session are highlighted. Pencil opens a rename prompt; labels are stored on the running tmux session and shown in the menu and search. Numbered URLs and working directories stay unchanged. Labels disappear when their session ends. Deleting requires confirmation and ends programs in that session; files remain. If deleting the displayed session, the UI switches to another running session or leaves the terminal empty if none remain. Polling refreshes the list every three seconds.

New session creates another session for the currently displayed folder. Switching changes only the terminal iframe and URL; old sessions remain alive. Browser Back/Forward works. ttyd's leave-page warning is disabled. Session deletion still asks for confirmation.

Runtime fixes preserved

See FIXES_APPLIED.md for your supplied deployment fixes and host validation. Dockerfile line continuations are preserved as plain text without null bytes. Compose uses the working literal no_cache: true and absolute Nginx mount paths. Those files are unchanged by this toolbar update.

Verification

bash scripts/verify-live.sh
cd tests
python3 -m unittest test_workspace
node test_toolbar.js

The verification script rebuilds and leaves the stack running. This update passed manager/workspace tests, toolbar interaction tests using a simulated DOM, JavaScript/Python syntax checks, and null-byte/source-preservation checks. Docker and actual browser rendering/WebSocket interaction are pending host verification for this update.

Check dropdown grouping/highlights, search and Enter, confirmed deletion, and switching without a warning in your browser after rebuilding. See ENV.md and QUICKREF.md for other settings and operational commands. Older validation statements in STANDARDS_REVIEW.md refer to earlier releases.