townmouse 0.0.0-stage → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/CHANGELOG.md +196 -0
  2. package/DESIGN.md +153 -0
  3. package/LICENSE +661 -0
  4. package/README.md +600 -2
  5. package/SECURITY.md +60 -0
  6. package/TOWNMOUSE.md +91 -0
  7. package/assets/brand/mascot/README.md +23 -0
  8. package/assets/brand/mascot/townmouse-aristocrat.png +0 -0
  9. package/assets/brand/mascot/townmouse-icon.svg +1 -0
  10. package/assets/brand/mascot/townmouse-monocled.png +0 -0
  11. package/bin/townmouse +68 -0
  12. package/docs/PACKAGING.md +371 -0
  13. package/docs/browser-workspace.md +237 -0
  14. package/docs/panes.md +442 -0
  15. package/native/TownmouseApp.swift +108 -0
  16. package/npm-shrinkwrap.json +1282 -0
  17. package/package.json +93 -4
  18. package/public/apple-touch-icon.png +0 -0
  19. package/public/brand/floydslabs-credit.png +0 -0
  20. package/public/brand/floydslabs-credit.webp +0 -0
  21. package/public/brand/townmouse-aristocrat.webp +0 -0
  22. package/public/brand/townmouse-monocled.webp +0 -0
  23. package/public/browser-picture.mjs +159 -0
  24. package/public/clipboard-text.mjs +5 -0
  25. package/public/favicon-16x16.png +0 -0
  26. package/public/favicon-32x32.png +0 -0
  27. package/public/favicon.ico +0 -0
  28. package/public/favicon.svg +1 -0
  29. package/public/features/app-version.mjs +35 -0
  30. package/public/features/autosave.mjs +80 -0
  31. package/public/features/clipboard.mjs +69 -0
  32. package/public/features/command-palette.mjs +181 -0
  33. package/public/features/desktop-palette.mjs +19 -0
  34. package/public/features/export.mjs +37 -0
  35. package/public/features/file-drop.mjs +77 -0
  36. package/public/features/floating-palette.mjs +113 -0
  37. package/public/features/fontsize.mjs +72 -0
  38. package/public/features/haptic-keys.mjs +42 -0
  39. package/public/features/history-undo.mjs +102 -0
  40. package/public/features/keepalive.mjs +36 -0
  41. package/public/features/keybar-config.mjs +70 -0
  42. package/public/features/keyboard-shortcuts.mjs +74 -0
  43. package/public/features/links.mjs +139 -0
  44. package/public/features/multi-window-sync.mjs +76 -0
  45. package/public/features/osc-bridge.mjs +64 -0
  46. package/public/features/phone-landscape-focus.mjs +157 -0
  47. package/public/features/recent-commands.mjs +100 -0
  48. package/public/features/search.mjs +134 -0
  49. package/public/features/session-lock.mjs +96 -0
  50. package/public/features/session-manager.mjs +251 -0
  51. package/public/features/settings-sync.mjs +77 -0
  52. package/public/features/shortcut-help.mjs +85 -0
  53. package/public/features/smart-completions.mjs +101 -0
  54. package/public/features/smart-suggest.mjs +124 -0
  55. package/public/features/snippets.mjs +85 -0
  56. package/public/features/split-view.mjs +102 -0
  57. package/public/features/status-metrics.mjs +137 -0
  58. package/public/features/stylus-support.mjs +124 -0
  59. package/public/features/swipe-history.mjs +141 -0
  60. package/public/features/swipe-sessions.mjs +85 -0
  61. package/public/features/tab-reorder.mjs +70 -0
  62. package/public/features/theme-system.mjs +51 -0
  63. package/public/features/toast-status.mjs +118 -0
  64. package/public/features/two-finger-menu.mjs +87 -0
  65. package/public/features/voice-input.mjs +244 -0
  66. package/public/features/wake-fullscreen.mjs +67 -0
  67. package/public/features/window-title.mjs +47 -0
  68. package/public/features/zoom.mjs +80 -0
  69. package/public/icon-128.png +0 -0
  70. package/public/icon-180.png +0 -0
  71. package/public/icon-192.png +0 -0
  72. package/public/icon-48.png +0 -0
  73. package/public/icon-512-maskable.png +0 -0
  74. package/public/icon-512.png +0 -0
  75. package/public/icon.svg +1 -0
  76. package/public/index.html +2304 -0
  77. package/public/input-chunks.mjs +22 -0
  78. package/public/input-guard.mjs +218 -0
  79. package/public/manifest.json +56 -0
  80. package/public/panes.css +1433 -0
  81. package/public/panes.html +211 -0
  82. package/public/panes.mjs +3183 -0
  83. package/public/service-worker.js +67 -0
  84. package/public/workspace.css +1621 -0
  85. package/public/workspace.mjs +1715 -0
  86. package/scripts/install-service.sh +303 -0
  87. package/scripts/node-runtime.sh +138 -0
  88. package/scripts/panes +568 -0
  89. package/scripts/prepare-native.sh +35 -0
  90. package/scripts/retire-legacy-service.sh +76 -0
  91. package/scripts/run-hooks +69 -0
  92. package/scripts/townmouse.sh +152 -0
  93. package/scripts/uninstall-service.sh +65 -0
  94. package/src/agent-guide.js +329 -0
  95. package/src/attachments.js +128 -0
  96. package/src/browser-dom.js +548 -0
  97. package/src/browser-workspace.js +1733 -0
  98. package/src/chrome-resolve.js +80 -0
  99. package/src/owner-page.js +43 -0
  100. package/src/pty-permissions.js +99 -0
  101. package/src/regex-worker.js +13 -0
  102. package/src/replay-text.js +189 -0
  103. package/src/request-boundary.js +58 -0
  104. package/src/safe-regex.js +87 -0
  105. package/src/server.js +1582 -0
  106. package/src/shell-resolve.js +42 -0
  107. package/src/static-deps.js +61 -0
  108. package/src/workspace-panes.js +1431 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,196 @@
1
+ # Changelog
2
+
3
+ All notable changes to Townmouse and the TerminalOne engine it embeds.
4
+
5
+ Townmouse is version 0.4.0 and is licensed AGPL-3.0-only. The 1.0.x entries below are the engine's inherited release history; the version numbers and dates stay exactly where history put them.
6
+
7
+ ## [0.4.0] — 2026-11-29
8
+
9
+ This release carries everything in 0.3.0, which was never published, and what is listed here.
10
+
11
+ ### Fixed
12
+
13
+ - **A browser pane keeps one size whether it is active or not.** Its editing rows used to be removed from an inactive pane, so the picture shrank on a click and the page inside was laid out again. The rows now keep their place, hidden, and clicking into a pane or away from it changes only which pane is active.
14
+ - **A pinch or a zoom key no longer zooms the pane workspace**, wherever the fingers or the keyboard are: over the picture, the title bar, a terminal pane, the bottom bar or inside an open sheet. A plain scroll over the picture still scrolls the page inside, and the menu's Larger text and Smaller text still change the terminal's text size.
15
+ - **A new browser pane is ready for its address.** After "Add browser pane" the pane is active and the address box has the focus, and keys typed in the half-second before the pane exists are kept for it. Before, the focus stayed in the terminal and a typed address ran there as a command.
16
+ - **The keyboard stays where the person put it.** Typing with the Menu open no longer reaches the terminal, and a change made by an agent no longer throws away a half-typed address.
17
+ - On a phone a browser pane keeps its height: at 393 wide the picture is 383×337 again (it had become 383×227).
18
+ - A blank pane's address box no longer reads "about:blank", which turned a typed address into an invalid one.
19
+ - The block that could appear before a prompt in a narrow terminal pane is gone. It was the mark zsh prints before a prompt, drawn at the shell's width in a pane a column narrower. Earlier output is now shown at the shell's width, and the pane fits to its own afterwards.
20
+ - **The top row lists the shells that exist, one chip each.** Two parts of the page each kept a record of sessions in the browser's storage, under two different keys per session, so the row grew two chips per shell, showed only the last five, and kept chips for shells that had ended. A chip labelled with the short session code could not be resumed, and clicking it printed `[resume unavailable — starting fresh shell]` and started another shell. The row is now the server's list, sent to the page whenever it changes and rebuilt on every load. A chip is a named button that switches to its shell and never starts one.
21
+ - **A shell is no longer killed five minutes after nobody is looking.** A shell with no viewer was cleaned up while its chip stayed. A shell now keeps running until it is closed, its shell exits, or the app stops.
22
+ - **Shells can be closed.** Every shell has a close control on its chip and in the Sessions list, and Tools keeps Close terminal. Each asks first, names the shell and says what the window will show next; confirming ends the shell process. Until now nothing could end a shell short of stopping the app.
23
+ - **A shell that cannot be resumed is announced, not replaced.** A page whose shell was gone started a new one with a line of yellow text. It now says what happened, as far as that is known (the app was restarted; the shell was closed), and lands on a shell that exists or on one clear action. A window with no shell no longer reconnects into a new shell on its own.
24
+ - The title names the shell being viewed. It was fixed text, so it could disagree with the footer. The footer also keeps the shell and folder after a first load.
25
+ - Reloading a page no longer pastes a saved copy of the last screen on top of the resumed shell.
26
+ - Opening the Sessions list no longer wraps the + button onto a second line.
27
+ - **A shell shows its recent output every time it is rejoined.** The output used to be handed to the first page that rejoined the shell and then dropped, so the second time (switching back from another shell, a reload, a window opened anew) only a prompt was left on screen, which reads as "my session is gone". Each shell now keeps its most recent output (up to 512K characters, whole lines) and every rejoin shows it: once, in order, at whatever width. The store is a list of blocks, so a shell that prints a lot costs almost nothing to keep.
28
+ - **A shell takes typing again after it is rejoined.** The page waits for a resumed shell's replay to be fully on screen before it fits the terminal to the window. That word was lost on the way: a feature that watches for clipboard and notification instructions had replaced the terminal's write with one that dropped it. After any rejoin that replayed something, nothing the shell printed next was shown and the terminal stopped following the window's size until the person switched away and back. 0.3.0 has this too.
29
+ - **A replay is not answered or obeyed a second time.** Old output can ask the terminal where the cursor is. Answered again at a rejoin, the answer was typed into the shell and sat at the prompt as stray characters. Old output can tell the page to set the clipboard or raise a notification; obeyed again at each rejoin, the clipboard was overwritten with something old. The page no longer answers a question from a replay, and an instruction is carried only with output nobody has seen yet.
30
+ - **The terminal's line spacing no longer depends on when its web font arrived.** The grid is measured when the terminal is opened, and the terminal library measures it again only when its font setting changes. If the font was still on its way at that moment, the grid kept the stand-in font's tighter line spacing until the next rejoin: lines 19 px apart and 39 rows, where the font gives 21 px and 35 rows, on about two first loads in five. Each time a font finishes loading, the terminal is now measured again and fitted.
31
+
32
+ ### Added
33
+
34
+ - **The app says which version it is.** The tab title carries the version on both surfaces, Menu and Settings show it under their title where nothing scrolls, and `/health` reports it. It used to be known only to `townmouse --version`.
35
+ - **No change ships without a version.** `npm run version:check` is the one definition of "the version is right": the version agrees in `package.json`, both lockfiles, the changelog and the release notes, each with one release date. Every pull request runs it against the last release tag and refuses a change to what ships unless the version is higher. At release time the same check runs before publishing. `npm run version:bump <version>` writes a new version into every place at once. The rule is written in `docs/PACKAGING.md`, under Versioning.
36
+ - **The browser pane is smooth while a person watches it and quiet while they do not.** Chrome sends a picture each time the page repaints, up to 30 a second for one pane and 48 across all panes; before, one picture was taken a second, watched or not. On a Mac with two panes changing: 1.9 pictures a second before, 29 after, and a click reaches the page in about 6 ms instead of about 250. A pane that cannot be seen is not pictured at all. An agent's `observe` still takes its own picture and never waits behind a person's.
37
+ - **Agents reach a pane only as far as the owner grants.** A pane belongs to whoever opened it. One the owner opened is Private to agents until the owner chooses View only or Allow control in that pane's header; the server enforces it on every route, not only in the page, so an agent cannot read, type into, move, resize or close a Private pane and sees none of its title, address, folder or output. An agent asks with `panes pane request <pane-id> --level view|control`, and the ask is shown under that pane's header. An agent's own panes, and the Orchestrator pane, are every agent's to use.
38
+ - **A password field's value never comes back from a page**, on any route: not in an element catalog, not in the result of a click or of typing, not in the report of the focused field, and a password field cannot be waited on. Typing into the field still works, and the page still receives what was typed.
39
+ - Shells have names (`Shell 1`, `Shell 2`, or a name chosen in the Sessions list), and the Sessions list states how many of the ten sessions are in use.
40
+ - Agents can list, start, rename, show and close the shells they start in the terminal row: `panes session list|create|rename|activate|close` and `/api/sessions`, with the pane API's token. The agent guide describes them.
41
+ - `tests/session-row.test.cjs` covers the row, closing (the real shell process), a reload, the agent API, the limit, three layouts and an app restart.
42
+ - `tests/resume-replay.test.cjs` covers a shell rejoined again and again (switching, a reload, a new window, phone and desktop widths), output printed while nobody watched, typing after a rejoin, the cap on what is replayed, and a replay that asks a question or sets the clipboard.
43
+ - `tests/pane-stability.test.cjs`, `tests/browser-picture-rate.test.cjs`, `tests/pane-access.test.cjs`, `tests/pane-access-ui.test.cjs`, `tests/password-results.test.cjs`, `tests/owner-key.test.cjs`, `tests/terminal-fit.test.cjs` and `tests/check-version.test.mjs` cover the rest of the above; each fails on the version before.
44
+
45
+ ### Changed
46
+
47
+ - Session chips can no longer be dragged to reorder. The drag was announced only by the pointer shape, its order was never kept past a redraw, and neither keyboard nor touch could reach it. The row follows the order the shells were opened in.
48
+
49
+ ### Security
50
+
51
+ - `GET /admin/sessions` and `POST /admin/sessions/:id/kill` are removed. Either could be called by any local process that could reach loopback, without the workspace token. The session list and close now live under `/api/sessions` behind the token; the owner's page uses its own WebSocket.
52
+ - **A shell in the terminal row belongs to whoever started it**, as a pane does. The key decides whose shell a new one is (`createdBy` in the body is ignored); on a shell the person started, rename, show and close answer an agent with 403 `OWNER_ONLY` and leave the shell as it was; and an agent's `session list` holds only the shells agents started, with `ownerStarted` counting the rest. An agent's `session list` therefore shows none of the person's shell names or folders. At the cap, an agent holding no shell it may close is told that the person started them all. This is a rule for agents using this API: it does not read or type into any shell, and it does not change the page's own WebSocket, which has never asked for a secret.
53
+ - Who is asking is read from the key presented, never from a field in the request. The person's page holds a key of its own that lives for one run of the server; agents hold the workspace token.
54
+ - **The owner's key is not had by ordinary requests.** The page is handed its key only when it was opened as a navigation and asks from its own page. A program that merely fetches the page and then asks for the workspace is refused, in words that tell an agent what to do instead (`panes state`, then `panes pane request`). The single-browser workspace's route is guarded the same way.
55
+ - **What these rules do not do.** They hold for agents that use the tools Townmouse gives them: the `panes` command, a pane's environment and the pane API. They do not hold against a program on the same Mac that presents itself as the owner's page, by sending a browser's navigation details on purpose, or that drives a real browser. That is what the next stage, agents separated from the owner, is for.
56
+
57
+ ## [0.3.0] — 2026-11-28
58
+
59
+ ### Changed
60
+
61
+ - **Townmouse has its own service identity on macOS.** The always-on service is installed as `com.floyd.townmouse` on port 11002, its launcher is `townmouse`, and the app bundle's identifier is `com.floyd.townmouse`. Until now the service installer was TerminalOne's with the name swapped: it wrote `com.floyd.terminalone`, took port 11001 and wrote a `t1` launcher, so on a Mac that also had TerminalOne, `t1` and TerminalOne.app opened Townmouse. TerminalOne keeps its label, its port and `t1`.
62
+ - **The default port is 11002 everywhere**: the server, the `townmouse` command, the macOS wrapper, `scripts/panes`, `start.sh` and the container (`EXPOSE 11002`). Set `PORT` to use another port when you start the server yourself; the macOS service, its launcher and its icon stay on 11002. Update any bookmark, proxy front or `docker run -p` mapping that named 11001.
63
+ - **Upgrading retires the service 0.2.x left behind.** `scripts/install-service.sh` and `scripts/uninstall-service.sh` stop and remove a Townmouse service that 0.2.x installed under TerminalOne's label, and remove the `t1` launcher 0.2.x wrote. The old service is recognised by the package beside its server, whatever its folder is called. A TerminalOne service or launcher is never touched, and neither is a `townmouse` command the installer did not write, such as the one npm creates for the package. If 0.2.x displaced TerminalOne on your Mac, run TerminalOne's own `scripts/install-service.sh` afterwards to restore it.
64
+ - `scripts/t1.sh` is now `scripts/townmouse.sh`. The installed `townmouse` launcher accepts `--port <n>`, `--no-open`, `--version` and `--help` like the npm command, starts the service when it is not healthy, and only then opens the workspace.
65
+ - The macOS wrapper no longer falls back to a `t1` launcher.
66
+
67
+ ### Fixed
68
+
69
+ - The service installer test still looked for the engine's pre-rename source file and could not pass, and neither it nor the launcher test ran as part of `npm test`. Both are repaired, extended to prove TerminalOne's service and launcher are left alone, and run in `npm test`, in CI and in a new macOS CI job.
70
+ - The smoke and feature tests start their servers on ports of their own instead of product ports, so the test suite cannot collide with an installed service.
71
+ - The macOS wrapper is compiled for macOS 13 and newer, as its bundle declares. The compiler had stamped its own default (macOS 28 on one toolchain), so Launch Services refused to open the icon with `kLSIncompatibleSystemVersionErr` while the program ran when started by hand. A macOS CI job now compiles the wrapper with the real compiler and checks that stamp.
72
+
73
+ ### Unchanged
74
+
75
+ - `TERMINALONE_*` environment variable names.
76
+
77
+ ## [0.2.1] — 2026-11-21
78
+
79
+ ### Security
80
+
81
+ - Element catalogs never serialize a password field's value. A catalog is served to view-only bearer grants, so returning it would cross the sharing boundary that the image and page text already respect.
82
+ - Browser URL waits match literally. A client-supplied regular expression was tested on the event loop, where a catastrophic pattern could stall every terminal, browser, and API request.
83
+ - Terminal wait patterns run in a worker thread with a deadline, so a pattern that backtracks pathologically is terminated and refused instead of stalling the server; patterns are capped at 200 characters.
84
+
85
+ ### Packaging
86
+
87
+ - `repository.url` normalized to `git+https://…`, the form npm requires at publish time.
88
+
89
+ ## [0.2.0] — 2026-11-21
90
+
91
+ ### Standard browser view
92
+
93
+ - One compact address row is the header. Agent access sits behind **Share** instead of occupying its own row, and the state line is a single slim line.
94
+ - A **Collapse** control hides every bar above the page and remembers the choice, leaving a 32 px strip that names the current page and restores the controls. Measured gain: 112 px on desktop, 180 px on tablet, 127 px on phone.
95
+ - The mascot lives in the navigation rail only; it no longer occupies the working area.
96
+
97
+ ### Agent control
98
+
99
+ - Browser panes address controls by role and name across cross-origin frames and open shadow roots. Every observation carries an id, capture time, viewport, scroll offset, address, title, and a truncation flag.
100
+ - A coordinate target from a page that has changed since it was observed is refused with "look again"; element refs are stable and re-checked before use.
101
+ - Actions report `completed`, `missing`, `wrong-kind`, `failed`, `stale`, or `unconfirmed`, with the focused control and value. Navigation returns the new page's title.
102
+ - Modifier chords (`Alt+M`), hover, drag, replace-typing, named-area scrolling, and bounded waits.
103
+ - Ordinary commands run as tracked jobs with an exit code; `pane read` defaults to clean screen text and `--raw` keeps the original terminal data.
104
+ - Program, agent-reported, and command status are three separate channels, and a fresh program clears the previous agent report.
105
+ - Visible maximize/restore control and a fixed-size browser lock that the owner's viewer cannot resize.
106
+ - New panes drop inherited parent-harness session markers (`CLAUDECODE`, `CLAUDE_CODE_CHILD_SESSION`, and related).
107
+
108
+ ### Packaging
109
+
110
+ - Dependency assets resolve through Node's lookup paths, so a normal `npm install` with hoisted dependencies serves the terminal engine instead of 404ing it.
111
+ - The server repairs node-pty's macOS spawn-helper mode at startup; npm 12 skips dependency install scripts by default, so the postinstall cannot be the only fix.
112
+ - Browser panes fall back to an installed Chrome, Chromium, Edge, or Brave; `GET /health` reports the resolved engine.
113
+ - `npx townmouse` works on Node 22–26. Node 22 is still preferred; the engine range is `>=22 <27`.
114
+ - Containers accept a remapped host port, the image has a `HEALTHCHECK`, and the build context no longer carries `.runtime`.
115
+ - The macOS installer scripts ship in the npm package.
116
+ - New gates: `npm run test:package` installs the packed tarball with `--ignore-scripts` and exercises the installed application; `tests/agent-control.test.cjs` covers 36 agent journeys.
117
+ - On Linux the package gate installs with the native build, because node-pty has no Linux prebuild. The server now explains a missing terminal engine and names the remedy (`npm rebuild node-pty`, `npm install --allow-scripts=node-pty townmouse`, or the container) instead of dying in a require stack.
118
+
119
+ ## [0.1.0] — 2026-11-15
120
+
121
+ ### Workspace
122
+
123
+ - Four-pane workspace tabs: any mix of PTY terminals and real Chromium browsers, up to four panes per tab and 24 tabs.
124
+ - Terminal agents receive `TOWNMOUSE_API`, `TOWNMOUSE_TOKEN`, `TOWNMOUSE_TAB_ID`, `TOWNMOUSE_PANE_ID`, and `TOWNMOUSE_PANES_CLI` in every pane; `scripts/panes` controls tabs, panes, URLs, input, reads, named keys, bracketed send-text, waits, agent state, dialogs, attachments, and pane order.
125
+ - Pane terminals start at the client's measured dimensions, expose `lastOutputAt`/`idleMs`/exit status, and accept agent-reported working/blocked/idle/done state.
126
+ - Workspace state, tab titles, pane cwd, browser URLs, and active selection survive a server restart.
127
+ - Visible tab strip, draggable terminal/browser separators, 7-second idle chrome collapse, and phone/tablet/desktop layouts.
128
+ - Draggable pane dividers with per-tab ratios, keyboard resizing, double-click reset, pane headers that drag to reorder, and a maximize chord.
129
+ - Phone key bar for panes (Esc, Tab, sticky Ctrl/Alt, Ctrl+C, arrows, Home/End, PgUp/PgDn), a word-wrapped Reader transcript, terminal context menus, and a shortcut sheet.
130
+ - Restart epochs and a restored-layout notice; answerable page dialogs; browser Forward; software-keyboard inset handling.
131
+
132
+ ### Attachments
133
+
134
+ - Attach button in the main bottom navigation and pane menu, backed by a multi-file picker.
135
+ - Image and file paste uploads once and inserts a shell-quoted path; terminal agents and humans see the stored path.
136
+ - Drops outside a terminal never type file bytes or `data:` URIs into a PTY.
137
+
138
+ ### Fixed
139
+
140
+ - Resuming at a different width replays a control-free transcript built from the width each output was produced at, so shell redraws cannot fragment commands.
141
+ - Blank browser panes survive restart instead of being discarded; restarts mint an epoch and tell the client what was not restored.
142
+ - Queued terminal input survives a workspace tab switch and reuses one queue per pane.
143
+ - A page popup can no longer crash the server; a superseded window can no longer detach a live resumed shell; dead Chromium pages are pruned.
144
+ - Slow terminal readers are disconnected into the polling fallback instead of growing server memory without bound; at most four SSE streams are open.
145
+ - The attachment picker inserts its path and shows a copyable URL card; active HTML/SVG downloads instead of rendering.
146
+ - Bare Ctrl+C always interrupts, even with a selection.
147
+
148
+ ### Security
149
+
150
+ - Owner bootstrap and attachment uploads require an HttpOnly SameSite owner capability minted on page navigation. Header-less local callers and pane-token callers receive 403.
151
+ - Attachments are served with a sandbox CSP and `Cross-Origin-Resource-Policy: same-origin`.
152
+ - Chromium keeps its renderer sandbox by default; containers/CI opt out explicitly with `TOWNMOUSE_CHROMIUM_NO_SANDBOX=1`. Session and pane APIs bind loopback only unless Docker sets `HOST=0.0.0.0` for port forwarding.
153
+ - Attachment uploads are owner- or pane-token gated, daily-quota bounded, archived by age, and served with a sandbox CSP plus download disposition for active document types.
154
+
155
+ ### Packaging and tests
156
+
157
+ - npm CLI (`bin/townmouse`), Dockerfile, npm files allowlist, and AGPL-3.0-only licensing.
158
+ - New regression coverage for pane API limits, persistence, resume width, attachment picker/paste/drop, and popup safety.
159
+
160
+ ## [1.0.3] — 2026-11-08
161
+
162
+ - The engine learned to take dictation. Voice / speech-to-text has a settings section; the STT command, model, language, and argument template are saved server-side in `~/.config/terminalone/voice.json` and used at transcription time.
163
+ - Audio is staged under `~/.cache/terminalone`. The server accepts `.txt` or `.srt` output and no longer assumes `whisper` is on `PATH` or that a fixed `tiny.en` model is the only game in town.
164
+ - Explicit `TERMINALONE_STT_*` environment values override the saved setting for deployment and tests.
165
+
166
+ ## [1.0.2] — 2026-11-06
167
+
168
+ - Added a one-tap **Ctrl+b** shortcut for herdr to the iPhone/iPad key bar and the Snippets row. It sends Control plus lowercase b immediately, without switching keyboards or pressing Enter.
169
+ - Shell respawn storms are bounded, early input survives, and terminal context resets more cleanly after disconnects.
170
+ - If `/bin/zsh` is missing on the host, the engine falls back to an available shell.
171
+ - Hardened the browser input-guard so short batched keystrokes are not dropped.
172
+ - Patched body-parser, proxy-addr, and qs advisories, and pinned CI to Node 22.
173
+ - Moved the package homepage to https://floydslabs.com and refreshed the commercial studio screenshots.
174
+
175
+ ## [1.0.0] — 2026-06-26
176
+
177
+ ### Initial public release
178
+
179
+ This is the first public release of TerminalOne, the browser-based terminal engine Townmouse embeds: 39 feature modules and PWA install support.
180
+
181
+ ### Features
182
+
183
+ - Live PTY terminal via WebSocket — your actual shell, in your browser
184
+ - 39 feature modules covering command palette, session switching, search, clipboard, export, zoom, theme catalog, autosave, OS notification bridge, configurable key bar, and more
185
+ - Voice input module with bounded browser microphone capture, local Whisper-backed server transcription, review-before-run insertion, and oversized audio guards
186
+ - PWA support — install on iPad/iPhone as a standalone fullscreen app
187
+ - macOS launchd service installer with `t1` CLI launcher and Spotlight integration
188
+ - Responsive layout across phone, tablet, and desktop
189
+ - Settings import/export and theme system with dark/light mode
190
+ - 20/20 ShellFish-parity features implemented and tested
191
+
192
+ ### Build and test
193
+
194
+ - 6 test suites (input-guard, smoke, feature, feature-behavior, voice, responsive)
195
+ - Install/uninstall/reinstall verified end-to-end
196
+ - Beta release review cleared with no blockers
package/DESIGN.md ADDED
@@ -0,0 +1,153 @@
1
+ # TOWNMOUSE design
2
+
3
+ ## Or: A quiet light frame around a black rectangle, with one mouse doing all the shouting
4
+
5
+ - **DOCUMENT CLASSIFICATION:** DESIGN RECORD / MODERATE CHAOS / TECHNICALLY CREDIBLE
6
+ - **DATE RECORDED:** 2026-11-15 — late enough that the coffee has opinions
7
+ - **LOCATION:** The garage; the good monitor faces the cats
8
+ - **BEVERAGE:** Coffee that tastes like motor oil and exactly one blue accent
9
+ - **FELINE SUPERVISION:** Bella approved the quiet parts; Bowser is monitoring the separator
10
+ - **CURRENT STATE:** Porcelain, ink, and a terminal that stays black
11
+
12
+ ## Product job (Or: What This Thing Is For, Before Anyone Says "Platform")
13
+
14
+ Townmouse is a terminal and agent browser workspace. A person needs to run a real shell and a real browser page on the same host, switch between them quickly, and understand exactly what an agent can see or control. The terminal is the anchor; the browser is a peer surface.
15
+
16
+ That is the whole job. Everything below is in service of it, or it does not ship.
17
+
18
+ ## Selected workflow (Or: We Read the Studio, We Did Not Move In)
19
+
20
+ Primary: the Legacy Design Studio's Frontend Design workflow (`frontend-design/SKILL.md`). Supplemental review: the Studio's Open Design anti-AI-slop guide (`open-design/craft/anti-ai-slop.md`). The Studio is read in place from its installed library; the application stays in this repository and the Studio supplies guidance only.
21
+
22
+ We read the Studio. We did not rename the garage or schedule a kickoff about the kickoff.
23
+
24
+ ## Design plan (Or: One Blue Accent, a System Sans, and a Firm No)
25
+
26
+ **Color.** Porcelain `#eef1f5`, ink `#202832`, glass `#ffffffcc`, line `#cbd2dc`, blue `#175cbb`, terminal `#14171b`. The blue is the only chrome accent. The terminal surface keeps its own dark palette; workspace chrome never inherits the terminal's accent or elevation colors. If the chrome starts glowing, we have failed.
27
+
28
+ **Type.** The system sans (SF on Apple platforms) for workspace chrome. The terminal keeps its monospace face. Type sizes step 10 / 11 / 12 / 13 / 14 / 18 / 20 / 22 px; the brand wordmark is 19 px with tight tracking. No font pilgrimage. The system sans is already installed, and the terminal has a job.
29
+
30
+ **Layout.** A quiet, light frame around a dark terminal. Navigation is one consistent model with device-specific structures; the terminal and browser surfaces are never merely scaled from one device to another. Three devices, three structures. Scaling is not design.
31
+
32
+ **Principles.**
33
+
34
+ - The terminal is uninterrupted. Controls sit outside the black surface.
35
+ - State is explicit: Human or Agent, Private / View only / Control, session and working directory.
36
+ - Every primary control is reachable and at least 44pt.
37
+ - Spend boldness in one place: the Townmouse character and the terminal's contrast. Everything around it stays quiet.
38
+ - No emoji, decorative gradients, invented metrics, template hero, or identical card grid.
39
+
40
+ That last bullet is not a mood. It is a checklist.
41
+
42
+ **Brand character.** Townmouse is the monocled colonial mouse: the terminal is the house, the browser is the town. The full-figure illustration is the single bold visual move: the large sidebar brand art, the browser empty state, and the README. The bust portrait is the small SVG icon asset (favicon, app/PWA icons, and tiny chrome), shown uncropped. Both are the owner's original 1254×1254 RGBA PNGs, scaled with `object-fit: contain`; the character is never cropped. The character is never repeated as an emoji.
43
+
44
+ The ancestry is deliberate: the name completes the *Pigs (Three Different Ones)* triptych with FATCHIN and RATBAG — oversight, labor, and the space they operate in. The mouse is the product's identity, not a sticker on the terminal.
45
+
46
+ **Assets.** Originals live in `assets/brand/mascot/` (`townmouse-aristocrat.png`, `townmouse-monocled.png`), copied byte-for-byte from the owner's files, with their checksums recorded in that folder's `README.md`. The bust is wrapped as `townmouse-icon.svg` for the SVG icon surfaces. Optimized transparent WebP files live in `public/brand/`; the generated PWA/app icons are `public/icon-*.png`, including the padded maskable icon. If it is not the owner's pixels, it does not ship.
47
+
48
+ **Creator credit.** A small Floyd’s Labs neon-cats mark appears in the desktop sidebar and in the Tools sheet, labeled “Built at Floyd’s Labs” and linking to floydslabs.com. It is a creator credit, distinct from the Townmouse character, and stays small enough never to compete with the product brand. The cats get the credit; the mouse gets the product.
49
+
50
+ ## Three layouts (Or: Three Structures, Not One Structure Scaled Three Times)
51
+
52
+ The layouts share a navigation model, not a pixel grid. Each device gets the structure it can actually use.
53
+
54
+ **Desktop (1440×900 and wider).** A 208px sidebar holds the brand, Terminal, Browser, the tab list, New tab, Agent, Tools, and the real local server address. The terminal fills the main frame. Opening a browser splits the frame horizontally with a 60px header and a 30px footer. The 12px separator between terminal and browser is draggable left and right; the terminal keeps at least 320px and the browser at least 420px. Browser tabs live in the sidebar; sharing controls are always visible in the browser surface.
55
+
56
+ **Tablet (820×1180).** A 72px labeled rail holds the mark, Terminal, Browser, Agent, and Tools. The terminal fills the frame. Opening a browser stacks the terminal above the browser with a draggable separator; the key bar and footer leave the split so the browser gets the space. The separator can be dragged up and down between a 25% and 75% browser share. Browser tabs, Share, Expand, and Hide live in the browser tab strip. Share reveals the permissions row. Expand gives the browser the whole frame.
57
+
58
+ **Phone (393×852).** A bottom navigation holds Terminal, Browser, Agent, and Tools. One task surface is visible at a time. The terminal key bar collapses to one row of essentials plus a chevron that reveals the rest. In the browser, the state row sits at the top. The tab strip, address bar, and Share sit at the bottom above the remote keyboard, within thumb reach. The address bar carries back, forward, reload, the URL, and Go; Share opens the permissions row above the address bar. The tab itself carries Close. The control rows keep their 44pt targets but carry almost no outer padding. After seven seconds without a touch, every chrome row except the bottom navigation collapses, and the terminal or browser fills the frame. The first touch wakes the chrome; the bottom navigation stays awake and operable throughout.
59
+
60
+ Content first is the phone's whole personality. The navigation never leaves.
61
+
62
+ ## Pane workspace (Or: Four Live Things in a 2x2 Box)
63
+
64
+ `/panes.html` is the agent-first workspace. A workspace tab holds one to four panes in a 2x2 grid; each pane is a live PTY terminal or a live headless-browser page. Tabs are the units the human or the orchestrator creates and selects, and every tab can hold a different mix of terminals and browsers. The browser is the substrate: browser panes are real pages rendered by the server, and terminal panes are real PTYs. No iframe cosplay.
65
+
66
+ The orchestrator pane is spawned with `TOWNMOUSE_API`, `TOWNMOUSE_TOKEN`, `TOWNMOUSE_PANE_ID` and `scripts/panes`, so an agent creates tabs, adds panes, opens URLs and runs commands without copying a connection code. The bottom bar is the only chrome: back, host/session pill, tab count, keyboard, and menu. That is the whole chrome. It is enough.
67
+
68
+ This follows the Chrome split-view model — live tabs sharing one surface with a draggable divider — extended to four panes per tab.
69
+
70
+ The pane workspace is the same product, not a second identity. It uses the graphite family (`#0a0d12` / `#11161d`) and the one Townmouse blue as `--accent` (#8ab4ff, the dark-surface step of `#175cbb`). The old mint-on-green palette is retired.
71
+
72
+ Recorded 2026-11-29, after using the workspace as a person. A browser pane keeps one size whether it is active or not; on a phone it is taller than a stacked pane by exactly its two rows, so the page keeps the height it had. The keyboard stays where the person put it: a rebuild of the panes never moves it, and an open sheet owns it until the person closes it. The sheets stay non-modal, as the docked panels do. The running version is a quiet muted line under the title of Menu and of Settings, in the part that never scrolls.
73
+
74
+ ## Surface protection (Or: A Menu May Never Cover a Live Face)
75
+
76
+ Recorded 2026-11-18. This is a hard invariant, not a preference: **no menu, sheet, dialog, toast, or panel may paint over a live terminal or browser surface.** Chrome either docks and reflows the surface, or replaces it as a first-class mode with an explicit way back. Scope of this pass: the workspace chrome and pane surfaces listed below. The inherited command palette, shortcut help, search, recent-commands popover, and session-lock overlays are not yet ported and remain known exceptions.
77
+
78
+ - **Tools, Sessions, the close confirmation, Settings, and the browser page-text dialogs are docked peers.** On desktop (≥1100px) they reserve a 300px right column; on tablet (700–1099px) a 32dvh bottom row; on phone (≤699px) a 44dvh bottom row above the four-item navigation. The live surface shrinks; it is never covered. No scrim, no backdrop blur, no inert background, no focus trap.
79
+ - **Desktop menu is collapsible, not fixed overhead.** `#workspace-nav-toggle` trades the 208px labeled sidebar for a 72px icon rail and remembers the choice. The rail keeps a New tab control; when there are 2+ browser tabs the tab strip also appears in the browser surface so tabs stay reachable, and a single tab costs no extra height.
80
+ - **Reader view** is a mode, not an overlay: it replaces the transcript surface and always shows Close.
81
+ - **Notifications live in the flow.** Banner, toasts, and the attachment handoff card are siblings in the shell and push the terminal down. The pane workspace puts its notice in the bottom stack.
82
+ - **Pane workspace menus dock.** Tabs, menu, shortcuts, and confirmations reserve a 360px right column at ≥900px and a 48dvh bottom row below that. Context actions are a docked action rail above the workspace bar, not a floating menu on a pane.
83
+ - **Phone navigation is four surfaces** — Terminal, Browser, Agent, Tools. Panes and Attach are labeled rows in the Tools dock, because they are actions, not surfaces.
84
+ - **Visible control boundaries.** `--ws-control: #7c8898` (3.60:1 on white, 3.18:1 on paper) replaces the 1.3–1.5:1 hairline on inputs, key caps, tab chips, and both resize grips. The pale `--ws-line` remains decorative only. Dark pane controls use `#5f6f88` on `#11161d` (3.4:1).
85
+ - **Enforced by software.** `npm run test:ui` (`tests/ui-surfaces.test.cjs`) fails if any docked panel intersects `#terminal` or `.browser-canvas` at 1440×900, 1150×800, 820×1180, 393×852, or 932×430, or if a rendered live surface extends outside `.app-shell`; it also asserts the contrast floors, no horizontal overflow, the four-item phone navigation, and the Panes/Attach rows in Tools.
86
+
87
+ ## Navigation and browser model (Or: Who Can See What, and Who Can Touch It)
88
+
89
+ - The top row holds one chip per live shell, in the order the shells were opened. A chip is a button named for its shell (a default such as `Shell 2`, or a name the person gives it; the session code stays as secondary detail in the footer), shows whether that shell is current, and carries a close control. Activating a chip switches to that shell and never starts another. The row scrolls sideways when it is full and never wraps; it gives way before the title, which names the current shell.
90
+ - The session pill is a button. It names the current shell and opens a Sessions sheet that lists every shell with Rename and Close, marks the current one, states how many of the ten sessions are in use, and offers New session. The footer keeps the shell command, working directory, and uptime.
91
+ - Human and agent browser tabs share one tab strip. Each tab advertises Human or Agent; the persistent state row shows the active kind and permission.
92
+ - Human tabs start Private. View only and Allow control rotate the connection token. Private revokes subsequent token requests. Close tab destroys the context.
93
+ - The agent browser has control granted and keeps running when its view is hidden.
94
+ - On the pane workspace the same three levels exist, in the same words, per pane. The server decides whose pane it is from the key that asks (the page's key or an agent's workspace token), never from a field in a request, and enforces the level on every route. A pane the person opens starts Private; an agent's own pane, and the Orchestrator pane, are the agents'. Each of the person's panes carries **Agent access** in its header, beside its kind, as one control that both states and changes the level: Private in the quiet tone, View only and Allow control in the agent tone that already marks an agent's pane. It is a native select, named for assistive technology, 44pt on a touch screen, and in a half-width pane its caption gives way to the pane's title. The bottom bar is unchanged. Lowering a level ends what agents hold on the pane at once (their output stream closes, pending waits and queued actions stop), the way the terminal surface rotates its token; the grant lives in memory and does not survive a restart. An agent's ask docks between a pane's header and its body, in the pane it is about, and the pane's content gives up the row: nothing is drawn over a live surface. Its content arrives in place (opacity and 4px of travel, 200ms, `cubic-bezier(.2,.8,.2,1)`; reduced motion: immediate); the control takes its new tone over 180ms with the same easing. The ask clears itself after five minutes, and "Not now" holds further asks on that pane for five minutes. No password field's value leaves a page in any result.
95
+
96
+ State is not a badge in a corner. It is the answer to the only question that matters: what can this thing see and do?
97
+
98
+ ## Shell sessions (Or: nothing runs in the ether)
99
+
100
+ Recorded 2026-11-29. The row is the server's list and nothing else: the page keeps no names or ids of its own, so a chip can exist only for a shell that is running. One list feeds the row, the Sessions sheet, `GET /health` and the agent's `GET /api/sessions`.
101
+
102
+ - **A shell lives until it is closed.** Switching away, closing the browser or letting the computer sleep does not end it. Until this date a shell with no viewer was killed after five minutes while its chip stayed, and clicking that chip started a new shell in its place. At most ten run at once; the cap is stated in the Sessions sheet, where it would be hit.
103
+ - **The page never starts a shell on the quiet.** A shell is started by the + button, by New session, by Start a shell, or by an opening window that finds none. When the shell a window was viewing ends, the window moves to the next one in the row (to the right, else to the left) and says which shell it left and why; with none left it shows the no-shell state with one action. A session that cannot be resumed is announced, never swapped for a fresh one in silence.
104
+ - **The title and the current chip are the same session.** Both are drawn from the server's description of the shell this window is viewing.
105
+ - **An app restart ends every shell**, because each is a process of the app. Nothing is recreated: the window opens one new shell and says the earlier ones ended. Their processes, their state and their running jobs are gone, and a fresh prompt shown under an old name would be a lie.
106
+ - **Order is the order of opening.** The same order appears in the row, in the Sessions sheet and in the agent's list. Chips are not draggable: a grabbing pointer was the only thing that announced it, the order was never kept past a redraw, and neither keyboard nor touch could reach it. Sessions are told apart by name.
107
+ - **A shell belongs to whoever started it**, as a pane does. An agent reaches the shells agents started (`panes session`): it may list, start, rename, show and close those, and its list counts the person's without naming them. On a shell the person started, rename, show and close are the person's alone. `session activate` on one of its own shells moves every open window to it, and exists for when the person asked to see it. Its creates and renames leave the person's view alone.
108
+ - **A shell rejoined shows what it last showed.** Each shell keeps its most recent output, and every rejoin shows it once, in order, whatever route brought the person back: a switch, a reload, a window opened anew. A replay is not answered: nothing is typed into the shell on account of old output, and an instruction in output already shown (to set the clipboard, to raise a notice) is not carried out again.
109
+
110
+ ## Motions (Or: Six Motions, Then We Stop)
111
+
112
+ Six motions, all with a job. The house style is arrive, do not perform.
113
+
114
+ 1. **Drawer reveal** — Tools opens and closes; 260ms; `cubic-bezier(.2,.8,.2,1)`; reduced-motion: immediate, no transform.
115
+ 2. **Surface switch** — terminal or browser surface enters; 220ms; `cubic-bezier(.2,.8,.2,1)`; reduced-motion: immediate.
116
+ 3. **Control press** — pointer down/up on controls; 180ms; `cubic-bezier(.2,.8,.2,1)`; reduced-motion: no transform/transition.
117
+ 4. **Active tab feedback** — selected tab background and border; 200ms; `cubic-bezier(.2,.8,.2,1)`; reduced-motion: immediate. The current shell's chip uses this motion.
118
+ 5. **Tool state** — active tool row fill, white text, and checkmark; 180ms; `cubic-bezier(.2,.8,.2,1)`; reduced-motion: immediate.
119
+ 6. **Ask arrival** — an agent's access ask docks under a pane's header: the row is there at once and its content arrives in place, opacity 0 to 1 and 4px up to rest; 200ms; `cubic-bezier(.2,.8,.2,1)`; reduced-motion: immediate.
120
+
121
+ Reduced motion also disables the xterm cursor blink and the two-finger inertia scroller. No parallax or continuous motion is used.
122
+
123
+ ## Accessibility (Or: 44pt, 2px, and No Traps)
124
+
125
+ - Native buttons, inputs, selects, and modal dialogs; visible 2px focus ring.
126
+ - Browser tabs use `role="tab"` with `aria-selected`; the tab lists use `role="tablist"`. Workspace navigation uses `aria-current="page"`.
127
+ - The phone permission select keeps an accessible name; the visual label is present when Share is open.
128
+ - Primary controls and tab close are at least 44pt. The split separator is a visible line with a grip, pointer and touch drag, and keyboard support: Left and Right arrows on the desktop vertical separator, Up and Down on the tablet horizontal separator, with Home and End jumping to the bounds. Safe-area insets are respected at the top, bottom, and around the phone sheet.
129
+ - The phone's collapsed state is not a trap: keydown wakes the chrome, the bottom navigation remains reachable, and the first touch on the content only restores the chrome instead of activating the page or terminal underneath.
130
+ - Closing a shell is destructive, from a chip, from the Sessions sheet or from Tools, and always uses the same in-design confirmation with Cancel and Close terminal. It names the shell and says what the window will show next. The settings dialog uses the workspace type system and 44px fields.
131
+ - Text and controls meet contrast on the porcelain chrome; the terminal keeps its own theme.
132
+
133
+ This is load-bearing. None of it is a nice-to-have, and none of it is negotiable.
134
+
135
+ ## Anti-AI-slop review (Or: The Checklist We Actually Ran)
136
+
137
+ Reviewed against the Open Design checklist:
138
+
139
+ - No indigo accent, no two-stop trust gradient, no emoji, no invented metrics, no filler copy.
140
+ - No identical rounded card grid; Tools is a grouped list with task headings, icons, descriptions, and a destructive row separated by color and confirmation.
141
+ - The only repeated card-like shapes are controls and tabs, which carry different roles.
142
+ - The character is the identity: a monocled colonial mouse holding a terminal sign, used large in the sidebar brand art and the browser empty state; the bust portrait is the small SVG icon asset. The terminal surface stays black; the chrome stays quiet.
143
+ - The empty browser state is specific to the product ("A place for the web" with local-host guidance), not placeholder content.
144
+
145
+ That is the review. It was not a vibe check.
146
+
147
+ ## Evidence (Or: Math. Not Vibes.)
148
+
149
+ The layout, surface-clearance, contrast, and interaction claims above were
150
+ verified with the project's own test suite and device captures at 393×852,
151
+ 820×1180, 1440×900, and 1920×1080. The suite is retained for release gating and
152
+ is not part of the installed package.
153
+