diff --git a/README.md b/README.md index 7893809..18d891f 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,9 @@ Install into any protoAgent agent from this git URL — it's not tied to one age - A left-rail **Terminal** view (ADR 0026) — an xterm.js page (fit + clickable-links addons) served by the plugin, connected to a shell over a WebSocket. +- **Tabs** — run several sessions in one view (+ to add, × to close, double-click to + rename). Each tab owns its own xterm + WebSocket, and each WebSocket gets its own + PTY shell — closing a tab kills only that shell. - A **real PTY** on the backend — stdlib `pty` (no pip deps), so it's a genuine interactive shell: TUIs, colour, resize, `Ctrl-C`, the works. The wire protocol mirrors protoMaker's terminal (`data`/`exit`/`connected` ⇄ `input`/`resize`/`ping`). @@ -87,8 +90,8 @@ Then open the **Terminal** rail icon. (Make sure the host has an operator bearer ## Roadmap -A solid single terminal session per view. Possible next steps: multi-session tabs, -split panes, a search overlay, and validating the experimental Windows backend. PRs welcome. +Multi-session tabs, a real PTY, themed + offline. Possible next steps: split panes, a +search overlay, and validating the experimental Windows backend. PRs welcome. Enabled by default once installed (the WS bearer gate is the protection) — disable with `plugins.disabled: [terminal]`. diff --git a/protoagent.plugin.yaml b/protoagent.plugin.yaml index b78ce4c..08421e8 100644 --- a/protoagent.plugin.yaml +++ b/protoagent.plugin.yaml @@ -1,6 +1,6 @@ id: terminal name: Terminal -version: 0.3.0 +version: 0.4.0 description: >- A full terminal in the protoAgent console — an xterm.js view wired to a real PTY shell over a WebSocket. The terminal is themed from the protoAgent design system diff --git a/pyproject.toml b/pyproject.toml index d7217c9..2b41add 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "terminal-plugin" -version = "0.3.0" # keep in lockstep with protoagent.plugin.yaml (a test enforces it) +version = "0.4.0" # keep in lockstep with protoagent.plugin.yaml (a test enforces it) description = "A full terminal (xterm.js + a real PTY over WebSocket) as a protoAgent console plugin." requires-python = ">=3.11" diff --git a/tests/test_packaging.py b/tests/test_packaging.py index 242fb3f..73e60e6 100644 --- a/tests/test_packaging.py +++ b/tests/test_packaging.py @@ -54,6 +54,15 @@ def test_view_page_pulls_in_the_protoagent_theme_and_four_rules(): assert "options.theme" in PAGE # re-applies the theme, not just on first paint +def test_view_page_has_multi_session_tabs(): + from terminal.view import PAGE + + # a tab bar + per-session lifecycle (each tab owns its own xterm + WS → its own PTY) + assert 'id="tabs"' in PAGE and 'id="newtab"' in PAGE + assert "newSession" in PAGE and "closeSession" in PAGE and "switchTo" in PAGE + assert "const sessions = new Map()" in PAGE # the session registry + + def test_register_mounts_the_public_router(registry): import terminal diff --git a/view.py b/view.py index 6d188cd..d9c4422 100644 --- a/view.py +++ b/view.py @@ -5,14 +5,17 @@ channel (it carries the operator bearer as a ?token= param) · slug-aware base (works on the host window AND through the fleet proxy) · links the DS plugin-kit. -THEME: the terminal is themed from protoAgent's design system. The page reads the -console's ``--pl-*`` CSS tokens (set by the DS kit's protoagent:init handshake) and -maps them onto xterm's theme object — background/foreground/cursor/selection + the 16 -ANSI colours — and RE-APPLIES on a live re-theme (a MutationObserver on :root). So -the terminal always matches the console's theme. - -No build step — vanilla JS; xterm.js + addons load from jsDelivr (vendoring is a -follow-up). ``PAGE`` is the HTML; api.py returns it on GET /view. +TABS: several independent sessions in one view. Each tab owns its own xterm + fit +addon + WebSocket — and each WebSocket gets its own PTY shell on the backend (one PTY +per connection), so closing a tab kills only that shell. + +THEME: every terminal is themed from protoAgent's design system. The page reads the +console's ``--pl-*`` CSS tokens and maps them onto xterm's theme — background/ +foreground/cursor/selection + the 16 ANSI colours — and RE-APPLIES on a live re-theme +(a MutationObserver on :root), across all open tabs. + +No build step — vanilla JS; xterm.js + addons are VENDORED and served by this plugin +(offline). ``PAGE`` is the HTML; api.py returns it on GET /view. """ from __future__ import annotations @@ -21,12 +24,9 @@