Skip to content

feat(terminal): 在无桌面工作区使用隔离的只读 PTY / view saved workspace text through an isolated native PTY - #14

Draft
Facetomyself wants to merge 10 commits into
feat/web-workbench-client-interactionsfrom
feat/web-workbench-terminal-viewer
Draft

Facetomyself wants to merge 10 commits into
feat/web-workbench-client-interactionsfrom
feat/web-workbench-terminal-viewer

Conversation

@Facetomyself

@Facetomyself Facetomyself commented Nov 26, 2026 •

Copy link
Copy Markdown
Owner

Stacked on #13. Refs sqfcyily#67. The standard workbench still runs by itself. The optional Compose overlay adds one non-root, network-isolated terminal worker. This is an actual Linux pseudoterminal for a fixed read-only text viewer, not a general-purpose command shell, a simulated terminal or model automation.

  • In the existing workspace dialog, explicitly open a clean saved text file. The main app verifies the approved project, every named ancestor, the leaf and the exact byte revision. It sends only bounded text to the worker; no project path, model credentials or workspace/data mounts enter the other container. Replacement, grant/permission loss and logout revoke the view.
  • The locked native PTY addon launches one fixed program. Its stdin, stdout and stderr must be real TTYs. Navigation uses real individual keys; resizing uses the kernel's terminal dimensions, and normal Quit requires a real exit receipt. Transport loss is an unknown result, never a synthetic exit 0. The UI uses only escaped text cells, no arbitrary commands/ANSI/clipboard escape interpreter.
  • Each private Unix connection owns one viewer; the public surface checks the original owner login, workspace and request sequence. It has bounded frames and event replay, idle/hard expiry, resource limits and scoped teardown. Ordinary workspace/chat remain independent of worker availability. Only close/exit are marked complete; program discovery, creation, input, output and resize are explicitly limited to the viewer’s semantics.
  • Tests include real native keys/SIGWINCH/exit, bounded Unicode display, source/parent ACL and replacement, independent logins, loss of the worker, actual browser controls and an independent amd64 Compose job observing both live children with three /dev/pts descriptors. Hosted receipts are below. The separate optional feat(browser): 隔离人工网页接管与工作台身份 / isolate manual browser handoff from workbench credentials #7 human browser handoff is still an inherited, unfinished gate.

Verified at 324c757

  • Node 22, real native PTY and sandboxed Chrome: 150/150 workbench checks, 377/377 headless checks and 30/30 native/Unix-protocol checks. Eleven ordinary browser business workflows passed. The viewer verified two real opens; 80×12, native PageDown/Home/End, resizing to 64×8 and back, a genuine Quit exit 0, cursor replay with no duplicate exit and closing a live viewer from the workspace. Two owner logins, stale or replaced source, revoked login and worker interruption were tested through the real HTTP and Unix path. When the worker connection is lost the exit code is unknown, not zero. The separate optional feat(browser): 隔离人工网页接管与工作台身份 / isolate manual browser handoff from workbench credentials #7 browser handoff remains red, so the combined CI is not all-green.
  • Actual production main and worker images in native amd64 Docker Compose: workbench config sha256:c148fce20cfaa7e17d2aeb05d30af670432f61523f3aa54dc232188fc69a640d, worker config sha256:8282ab0455b9c9520328b12a208ded905ccefd15b1527ce693ec5ae6fbbfc2b1. The worker had network none, UID/GID 1000, read-only root, cap-drop ALL and NNP, with neither projects nor workbench data or keys mounted. The test correlated two separate browser openings with distinct live viewer PID/start identities; each had all three standard descriptors on one real /dev/pts slave and was reaped. The fixture bytes, file identity/mtime and mounts stayed unchanged, services remained healthy and the temporary Compose resources were removed. This is a hosted native runner, not a new deployment on the old target machine.
  • The same packaged job also held four real near-limit text snapshots open under the worker’s 128 MiB / 1 CPU / 64 PID settings. A fifth viewer was rejected, all four still handled a key and kernel resize, all exited normally, capacity recovered, no cgroup OOM: observed peak 87,924,736 bytes (about 83.9 MiB) and 44 tasks including threads. This is a measured fixture, not a general workload guarantee.
  • Final synthetic browser screenshot: the file editor and launch button no longer duplicate the open viewer; page navigation/resize/quit, full native screen and visible rows are on screen together. Closing restores the original editor contents and keyboard focus. --coverage: 43 implemented / 36 partial / 103 without a recorded scope / 4 desktop-only, with the separate platform value implemented.

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.

1 participant