townmouse 0.2.1 → 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 (41) hide show
  1. package/CHANGELOG.md +72 -2
  2. package/DESIGN.md +26 -42
  3. package/README.md +286 -54
  4. package/SECURITY.md +3 -0
  5. package/TOWNMOUSE.md +1 -1
  6. package/bin/townmouse +2 -2
  7. package/docs/PACKAGING.md +104 -8
  8. package/docs/browser-workspace.md +62 -9
  9. package/docs/panes.md +199 -9
  10. package/native/TownmouseApp.swift +5 -5
  11. package/npm-shrinkwrap.json +1282 -0
  12. package/package.json +11 -7
  13. package/public/browser-picture.mjs +159 -0
  14. package/public/features/app-version.mjs +35 -0
  15. package/public/features/autosave.mjs +5 -1
  16. package/public/features/multi-window-sync.mjs +3 -1
  17. package/public/features/osc-bridge.mjs +8 -3
  18. package/public/features/session-manager.mjs +202 -100
  19. package/public/features/status-metrics.mjs +23 -0
  20. package/public/features/tab-reorder.mjs +8 -0
  21. package/public/features/window-title.mjs +10 -3
  22. package/public/index.html +617 -78
  23. package/public/input-guard.mjs +10 -2
  24. package/public/panes.css +189 -13
  25. package/public/panes.html +4 -1
  26. package/public/panes.mjs +667 -109
  27. package/public/workspace.css +198 -24
  28. package/public/workspace.mjs +346 -106
  29. package/scripts/install-service.sh +97 -63
  30. package/scripts/panes +134 -5
  31. package/scripts/retire-legacy-service.sh +76 -0
  32. package/scripts/{t1.sh → townmouse.sh} +60 -21
  33. package/scripts/uninstall-service.sh +31 -15
  34. package/src/agent-guide.js +72 -3
  35. package/src/attachments.js +2 -2
  36. package/src/browser-dom.js +5 -2
  37. package/src/browser-workspace.js +549 -62
  38. package/src/owner-page.js +43 -0
  39. package/src/request-boundary.js +1 -1
  40. package/src/server.js +588 -128
  41. package/src/workspace-panes.js +423 -91
package/README.md CHANGED
@@ -17,16 +17,20 @@ work in both. So can an agent. No hosted dashboard, no per-seat invoice, no
17
17
  "contact sales" button lurking behind the terminal.
18
18
 
19
19
  This is local software: a Node server and a static front end. The server listens
20
- on `127.0.0.1` at port 11001 by default, and anything the terminal runs has your
20
+ on `127.0.0.1` at port 11002 by default, and anything the terminal runs has your
21
21
  account's authority. That is the deal. Treat it like a loaded shell, because it
22
- is one.
22
+ is one. Port 11001 belongs to TerminalOne, the terminal engine Townmouse embeds,
23
+ so the two products run side by side on one machine.
23
24
 
24
25
  ## What it does (Or: Fewer tabs, more work)
25
26
 
26
- - **Terminal.** A real PTY with your shell, session resume, the key bar, themes,
27
- and the existing terminal feature modules. The session pill opens a switcher
28
- with every named shell and a New session action. The footer shows the shell,
29
- working directory, and uptime. The terminal does not pretend to be a text box.
27
+ - **Terminal.** A real PTY with your shell, the key bar, themes, and the
28
+ existing terminal feature modules. Every shell you open is a session with a
29
+ chip in the top row: click a chip to go back to that shell, close it from its
30
+ chip or from the Sessions list, and give it a name in the list. A shell keeps
31
+ running while you look at another one, until you close it or the app stops;
32
+ at most ten run at once. The footer shows the shell, working directory, and
33
+ uptime. The terminal does not pretend to be a text box.
30
34
  - **Pane workspace.** The native path for agent work. Open `/panes.html` for a
31
35
  2x2 grid of up to four live panes per tab, each one a terminal or a browser
32
36
  page. The orchestrator agent creates and drives them through the injected
@@ -40,8 +44,9 @@ is one.
40
44
  compatibility.
41
45
  - **Agent browser.** A separate context with control granted. Hide view keeps it
42
46
  running headless; reopen Agent to observe the same context. In the pane
43
- workspace, the agent gets native access through the injected environment. The
44
- single-browser view keeps its bearer-token path for compatibility.
47
+ workspace, the agent works through the injected environment, on its own panes
48
+ and on the owner's panes the owner has granted. The single-browser view keeps
49
+ its bearer-token path for compatibility.
45
50
  - **Three layouts.** Desktop sidebar, tablet rail, phone bottom navigation. The
46
51
  phone shows one task surface at a time; its key bar collapses to one row and
47
52
  expands on demand. After seven seconds without a touch, the phone chrome drops
@@ -51,6 +56,17 @@ is one.
51
56
  workspace load from the local server. Offline coverage is the shell only; live
52
57
  PTYs and browser pages still need the server.
53
58
 
59
+ ### The three layouts (Or: One product, three rooms)
60
+
61
+ ![Desktop layout](docs/screenshots/desktop-1440x900.png)
62
+ ![Tablet layout](docs/screenshots/tablet-820x1180.png)
63
+ ![Phone layout](docs/screenshots/phone-393x852.png)
64
+
65
+ Desktop keeps a persistent sidebar and runs terminal and browser side by side;
66
+ tablet replaces it with a labeled rail and stacks the surfaces over an
67
+ always-visible key bar; phone uses bottom navigation for one surface at a time
68
+ and folds the key bar into a compact row.
69
+
54
70
  ## Requirements (Or: The parts you actually need)
55
71
 
56
72
  Node.js 22.x (preferred; 22–26 are accepted) and npm on macOS or Linux. Puppeteer
@@ -58,7 +74,9 @@ is a production dependency because browser tabs and panes are real Chromium
58
74
  pages; `npm ci` downloads a compatible Chromium. If that download is skipped —
59
75
  npm 12 skips dependency install scripts by default — TownMouse falls back to an
60
76
  installed Chrome, Chromium, Edge, or Brave. Set `TERMINALONE_CHROME` to choose a
61
- specific binary. `GET /health` reports which engine resolved.
77
+ specific binary. `GET /health` reports which engine resolved. The pages need a
78
+ browser that marks its own requests: Chrome 76 or later, Safari 16.4 or later,
79
+ or Firefox 90 or later.
62
80
 
63
81
  On Linux, npm 12 skips dependency install scripts by default and node-pty has no
64
82
  prebuilt Linux binary; install with `--allow-scripts=node-pty`, or run
@@ -68,9 +86,9 @@ prebuilt Linux binary; install with `--allow-scripts=node-pty`, or run
68
86
  needs rebuilding, `npm run repair` does that. The engine is native code; it is
69
87
  not going to apologize for needing a compiler.
70
88
 
71
- ## Run it (Or: From source, from npm, or from a container)
89
+ ## Run it (Or: Four doors, one room)
72
90
 
73
- ### From source
91
+ ### From source (Or: The workbench)
74
92
 
75
93
  ```sh
76
94
  git clone https://github.com/CaptainPhantasy/townmouse.git
@@ -79,26 +97,88 @@ npm ci
79
97
  npm start
80
98
  ```
81
99
 
82
- Open `http://localhost:11001`. The server binds to `127.0.0.1`. A terminal can
100
+ Open `http://localhost:11002`. The server binds to `127.0.0.1`. A terminal can
83
101
  run commands with your account's permissions; keep the server on loopback
84
102
  unless you have an authenticated proxy in front.
85
103
 
86
- ### From npm
104
+ ### From npm (Or: The package is the product)
87
105
 
88
106
  ```sh
89
- npx townmouse
107
+ npm install -g townmouse
108
+ townmouse --version
109
+ townmouse # starts the server and opens the workspace
110
+ townmouse --port 12000 --no-open
90
111
  ```
91
112
 
92
- `npx townmouse` runs without a global install; `npm install -g townmouse` puts
93
- the `townmouse` command on your PATH. The binary starts the server, prints the
94
- URL, and opens a browser unless you pass `--no-open`. Use `--port` for a port
95
- other than 11001:
113
+ `npx townmouse` runs it without a global install. The command starts the server,
114
+ prints the URL, and opens a browser unless `--no-open` is passed; `--help` and
115
+ `--version` do what they say.
116
+
117
+ A running copy says which version it is by itself: on the line under the Menu
118
+ title in the pane workspace, on the line under the Settings title in the
119
+ terminal workspace, and in the window title. `GET /health` returns it as
120
+ `version`.
121
+
122
+ The first run creates `~/.townmouse` (mode 0700) holding the workspace token
123
+ (mode 0600) and the attachment tree. Back that directory up before upgrades; it
124
+ is the part that is yours.
96
125
 
97
126
  ```sh
98
- townmouse --port 12000 --no-open
127
+ npm run doctor # Node version and native modules
128
+ npm run repair # rebuild node-pty if the engine and the runtime disagree
99
129
  ```
100
130
 
101
- ### With Docker
131
+ On Linux with npm 12, dependency install scripts are skipped by default and
132
+ node-pty has no Linux prebuild. Allow the build, or rebuild afterwards, then
133
+ check:
134
+
135
+ ```sh
136
+ npm install -g --allow-scripts=node-pty townmouse
137
+ # or, in an existing install:
138
+ npm rebuild node-pty
139
+ npm run doctor
140
+ ```
141
+
142
+ If the terminal engine cannot load, the server says so and names those remedies
143
+ instead of printing a stack trace.
144
+
145
+ On macOS, the installed package can also run as an always-on service with its own
146
+ `townmouse` launcher:
147
+
148
+ ```sh
149
+ "$(npm root -g)/townmouse/scripts/install-service.sh"
150
+ townmouse # starts the service if needed, then opens the workspace
151
+ "$(npm root -g)/townmouse/scripts/uninstall-service.sh"
152
+ ```
153
+
154
+ The service is `com.floyd.townmouse` on port 11002. TerminalOne keeps its own
155
+ service, port 11001 and `t1`; installing Townmouse never takes them over.
156
+
157
+ Upgrade, roll back, uninstall:
158
+
159
+ ```sh
160
+ npm install -g townmouse@latest # upgrade
161
+ npm install -g townmouse@0.2.1 # roll back to a known version
162
+ npm rm -g townmouse # uninstall
163
+ ```
164
+
165
+ Data is compatible within a minor version. A breaking data change would get a
166
+ migration note, not a shrug.
167
+
168
+ ### From the release tarball (Or: When the registry is not the route)
169
+
170
+ Every release attaches the exact tarball and its checksum, byte for byte the
171
+ same artifact the registry serves:
172
+
173
+ ```sh
174
+ VERSION=0.2.1 # set to the release you want
175
+ curl -LO "https://github.com/CaptainPhantasy/townmouse/releases/download/v$VERSION/townmouse-$VERSION.tgz"
176
+ curl -LO "https://github.com/CaptainPhantasy/townmouse/releases/download/v$VERSION/SHA256SUMS"
177
+ shasum -a 256 -c SHA256SUMS
178
+ npm install -g "./townmouse-$VERSION.tgz"
179
+ ```
180
+
181
+ ### With Docker (Or: The room in a box)
102
182
 
103
183
  ```sh
104
184
  TOWNMOUSE_VERSION=$(node -p "require('./package.json').version") \
@@ -108,13 +188,17 @@ TOWNMOUSE_VERSION=$(node -p "require('./package.json').version") \
108
188
  --build-arg GIT_REVISION="$GIT_REVISION" \
109
189
  -t townmouse:"$TOWNMOUSE_VERSION" \
110
190
  -t townmouse:latest .
111
- docker run --rm -p 127.0.0.1:11001:11001 \
191
+ docker run --rm -p 127.0.0.1:11002:11002 \
112
192
  -v townmouse-home:/home/node/.townmouse \
113
193
  -v townmouse-config:/home/node/.config/terminalone \
114
- townmouse
194
+ townmouse:latest
115
195
  ```
116
196
 
117
- The image uses `node:22-bookworm-slim` and installs Chromium. The volume holds
197
+ The image carries Open Container labels for its version and the exact commit it
198
+ was built from, so an image can be traced back to the source. It is built
199
+ locally today; a registry tag will be added when the registry is chosen.
200
+
201
+ The image uses `node:22-alpine` and installs Chromium. The volume holds
118
202
  the workspace data. Mount project directories explicitly; the terminal starts
119
203
  in `/home/node`. `GET /health` returns `status: "ok"`.
120
204
 
@@ -135,9 +219,11 @@ WebSocket connections. Start Townmouse with the exact public address:
135
219
 
136
220
  ```sh
137
221
  TERMINALONE_TRUSTED_ORIGINS=https://townmouse.example.com npm start
222
+ # or, from an installed package:
223
+ TERMINALONE_TRUSTED_ORIGINS=https://townmouse.example.com townmouse --no-open
138
224
  ```
139
225
 
140
- The proxy must forward to `http://127.0.0.1:11001`, preserve the public `Host`
226
+ The proxy must forward to `http://127.0.0.1:11002`, preserve the public `Host`
141
227
  header and browser `Origin`, and support WebSocket upgrades. The setting takes
142
228
  exact HTTPS origins separated by commas; wildcards, paths, embedded credentials,
143
229
  and plain HTTP remote addresses are rejected. It allows an address. It does not
@@ -167,7 +253,7 @@ before it gives the machine a funeral.
167
253
  or shows the shortcut sheet. **Keyboard** focuses the active terminal; in a
168
254
  browser pane it focuses the page-type field. `Alt+T` creates a tab, `Alt+1..9`
169
255
  selects one, `Alt+Arrow` moves pane focus, `Alt+Shift+Arrow` reorders a pane,
170
- `Alt+M` maximizes, and `Alt+W` asks before closing the active pane. Drag a pane
256
+ `Alt+M` maximizes (the pane header also carries a visible maximize/restore control), and `Alt+W` asks before closing the active pane. Drag a pane
171
257
  header to reorder it, or drag the divider between panes to resize them.
172
258
 
173
259
  Browser panes accept clicks, wheel scrolling, touch-drag scrolling, typing,
@@ -176,6 +262,16 @@ rendered by the server, and its viewport reflows to the pane's actual size so
176
262
  text wraps at the pane edge. `alert`/`confirm`/`prompt` dialogs wait for an
177
263
  answer in a pane card (or `panes pane dialog`) instead of deadlocking the page.
178
264
 
265
+ **Your panes are yours.** Each pane you open says in its header what an agent
266
+ may do in it, under **Agent access**: **Private**, **View only**, or **Allow
267
+ control**. These are the same three levels, in the same words, as the browser
268
+ tab's Share row. Yours start Private, and no agent can see into one, read from
269
+ it or type into it until you say so. When an agent needs one of your panes, it
270
+ asks; the ask appears on that pane, with its reason, and you answer there: View
271
+ only, Allow control, or Not now. Setting a pane back to Private ends what an
272
+ agent was doing on it at once. The Orchestrator pane, and any pane an agent
273
+ opens, belong to the agents, and are marked that way.
274
+
179
275
  Drop or paste a file or image onto a terminal pane. The file is uploaded once
180
276
  into the state directory's `attachments/<date>/` tree (25 MB per request; daily
181
277
  quota; old buckets archived), and a shell-quoted absolute path is inserted into
@@ -198,29 +294,74 @@ TOWNMOUSE_PANES_CLI=<repo>/scripts/panes
198
294
  No code is copied between the browser and the terminal. Run the CLI directly:
199
295
 
200
296
  ```bash
297
+ "$TOWNMOUSE_PANES_CLI" guide
201
298
  "$TOWNMOUSE_PANES_CLI" state
202
299
  "$TOWNMOUSE_PANES_CLI" tab create --title "Second workspace"
203
300
  "$TOWNMOUSE_PANES_CLI" pane create --kind terminal
204
301
  "$TOWNMOUSE_PANES_CLI" pane create --kind browser --url https://example.com
205
- "$TOWNMOUSE_PANES_CLI" pane url <pane-id> https://example.com
206
- "$TOWNMOUSE_PANES_CLI" pane run <pane-id> "npm test"
207
- "$TOWNMOUSE_PANES_CLI" pane send-text <pane-id> "multi-line prompt"
208
- "$TOWNMOUSE_PANES_CLI" pane keys <pane-id> ctrl+c
302
+ "$TOWNMOUSE_PANES_CLI" pane exec <pane-id> -- "npm test" # tracked job, exit code
303
+ "$TOWNMOUSE_PANES_CLI" pane run <pane-id> "npm test" # typed line, unconfirmed
209
304
  "$TOWNMOUSE_PANES_CLI" pane wait <pane-id> --match "PASS" --timeout 60000
305
+ "$TOWNMOUSE_PANES_CLI" pane read <pane-id> --lines 120 # clean screen text
306
+ "$TOWNMOUSE_PANES_CLI" pane read <pane-id> --raw
307
+ "$TOWNMOUSE_PANES_CLI" pane browser observe --elements
308
+ "$TOWNMOUSE_PANES_CLI" pane browser click --ref e12
309
+ "$TOWNMOUSE_PANES_CLI" pane browser type --ref e12 --replace "café 東京"
310
+ "$TOWNMOUSE_PANES_CLI" pane browser key Alt+M
311
+ "$TOWNMOUSE_PANES_CLI" pane browser scroll --ref e12 --dy 400
312
+ "$TOWNMOUSE_PANES_CLI" pane browser wait --text "Saved" --timeout 10000
313
+ "$TOWNMOUSE_PANES_CLI" pane browser sizing fixed --width 1280 --height 800
210
314
  "$TOWNMOUSE_PANES_CLI" pane status <pane-id> --state blocked
211
- "$TOWNMOUSE_PANES_CLI" pane read <pane-id> --lines 120
212
315
  "$TOWNMOUSE_PANES_CLI" pane text <pane-id>
316
+ "$TOWNMOUSE_PANES_CLI" pane request <pane-id> --level control --message "why"
213
317
  "$TOWNMOUSE_PANES_CLI" attach ./screenshot.png --pane <pane-id>
214
318
  ```
215
319
 
216
- `pane create` defaults to the current tab. The orchestrator can create as many
217
- tabs as the server allows; each tab holds up to four panes. A tab can be all
218
- terminals, all browsers, or any mix. `pane text` reads the browser page's
219
- readable content, because an agent should not have to guess what a pane is
220
- showing. `pane wait` blocks on text, a regex, an idle interval, or an
221
- agent-reported state; `pane status` records working, blocked, idle, or done so
222
- the pane header and orchestrator agree. `attach` uploads with the scoped pane
223
- token and prints the path and URL.
320
+ `panes guide` prints the instruction sheet an agent gets on connect: every tool,
321
+ what it needs, what it returns, and what this connection may not do. `pane
322
+ create` defaults to the current tab; a tab holds up to four panes and can mix
323
+ terminals and browsers freely.
324
+
325
+ A pane you open through the CLI or the API is yours to use, and so is the
326
+ Orchestrator pane. A pane the owner opened is Private to you until they give it
327
+ View only (you can read it) or Allow control (you can read and drive it).
328
+ `panes state` says what you have on every pane, under `agentAccess`; a Private
329
+ pane of the owner's appears there as an empty shape. A refusal names the pane's
330
+ level and the command to ask for more:
331
+
332
+ ```sh
333
+ "$TOWNMOUSE_PANES_CLI" pane request <pane-id> --level view|control --message "what you need it for"
334
+ ```
335
+
336
+ The ask is shown on that pane, and the command waits for the answer (up to two
337
+ minutes; `--timeout` changes it, `--no-wait` returns at once, `--cancel`
338
+ withdraws it). It exits 0 when the owner gives access, 3 while the answer is
339
+ still waiting, and 5 when the owner says Not now. A pane the owner just said Not
340
+ now to cannot be asked about for five minutes. To show the owner one of your own
341
+ panes, report it with `pane status` and bring it forward with `panes active`.
342
+
343
+ `pane exec` runs one non-interactive command as a tracked job and returns its id,
344
+ status, exit code, and output; `pane job` reads it again. `pane run` types into
345
+ the interactive terminal and does not prove the command finished. `pane read`
346
+ returns clean screen text; `--raw` keeps the original escape data. `pane wait`
347
+ blocks on text, a regex, an idle interval, or an agent-reported state, always
348
+ with a timeout. Regex patterns run in a worker thread with a deadline, so a
349
+ pathological pattern is refused instead of stalling the server.
350
+
351
+ Browser panes are driven by ref from `pane browser observe --elements`: role,
352
+ name, value, state, and box, across cross-origin frames and open shadow roots.
353
+ Coordinate clicks still work. Every action reports completed, missing,
354
+ wrong-kind, failed, stale, or unconfirmed, and a target from a changed page is
355
+ refused with "look again". `pane text` reads the page's visible text and says
356
+ when it was cut short. The owner's view of a browser pane is refreshed quickly
357
+ only while someone can see it (up to 30 pictures a second while the page is
358
+ changing) and not at all while they cannot; an agent's `observe` is its own
359
+ capture and does not depend on that.
360
+
361
+ Status is three separate facts, not one badge: the program is running or exited;
362
+ the agent last reported a state (with the age of that report); and the last
363
+ tracked command has its own result. `attach` uploads with the scoped pane token
364
+ and prints the path and URL.
224
365
 
225
366
  The workspace survives a server restart: tab titles, pane kinds, terminal
226
367
  working directories, browser URLs, pane order, and the active tab are saved in
@@ -228,6 +369,63 @@ working directories, browser URLs, pane order, and the active tab are saved in
228
369
  does not survive its server. The layout does; the client sees a new epoch and
229
370
  is told that scrollback and running jobs were not restored.
230
371
 
372
+ ## Shell sessions (Or: every shell is accounted for)
373
+
374
+ Every shell on the terminal screen is a session, and the top row lists them:
375
+ one chip per live shell, in the order you opened them. A chip names its shell
376
+ (`Shell 1`, `Shell 2`, or a name you give it), the current one is marked, and
377
+ the title reads `Townmouse / <name>`. Clicking a chip, or pressing Enter on it
378
+ from the keyboard, always takes you to that shell. It never starts another.
379
+ Left and Right move between chips. On a phone the chips give way to the
380
+ Sessions list, which the session pill opens.
381
+
382
+ A shell keeps running while you look at another one, and after you close the
383
+ browser or the computer sleeps, until you close it or the app stops. At most
384
+ ten run at once. The Sessions list says how many are in use, and starting an
385
+ eleventh is refused with that reason.
386
+
387
+ ### For a person (Or: three things to do with a shell)
388
+
389
+ - **Switch.** Click a chip, or open the session pill (it names the current
390
+ shell) and choose from the list.
391
+ - **Name.** In the Sessions list, press the pencil beside a shell. Enter
392
+ saves; Escape keeps the old name. Names are unique.
393
+ - **Close.** Press the × on a chip, or Close in the list, or Close terminal in
394
+ Tools. Every close asks first and names the shell. Confirming ends that
395
+ shell and anything still running in it. If you closed the shell you were in,
396
+ the window moves to the next one. If it was the only one, the terminal area
397
+ says so and offers Start a shell. A shell is never started on your behalf.
398
+
399
+ A reload brings back the same row and the same current shell. Come back to a
400
+ shell by any route, a switch, a reload or a window opened anew, and it shows
401
+ its recent output, once, and takes your typing at once. An app restart
402
+ ends every shell, because each shell is a process of the app. Afterwards the
403
+ window shows one new shell and says that the earlier ones ended. Nothing from
404
+ before is listed as if it were still running.
405
+
406
+ ### For an agent (Or: the same list, the same actions)
407
+
408
+ The shells agents start in the terminal row answer under `/api/sessions` with
409
+ the same workspace token as the pane API, and in the command-line tool as
410
+ `panes session`. A shell belongs to whoever started it: these commands reach
411
+ the shells agents started, `session list` shows those and only counts yours,
412
+ and an agent cannot rename, show or close a shell you started.
413
+
414
+ ```bash
415
+ "$TOWNMOUSE_PANES_CLI" session list
416
+ "$TOWNMOUSE_PANES_CLI" session create --name build --cwd ~/code/app
417
+ "$TOWNMOUSE_PANES_CLI" session rename build --name tests
418
+ "$TOWNMOUSE_PANES_CLI" session activate tests # only when the owner asked to see it
419
+ "$TOWNMOUSE_PANES_CLI" session close tests
420
+ ```
421
+
422
+ A session is named by its name, its id, or the first eight or more characters
423
+ of its id, among the shells in `session list`. Creating and renaming leave the
424
+ shell the owner is looking at alone, and the owner sees each change in the row
425
+ at once. `activate` is the one action that moves the owner's view: every open
426
+ Townmouse terminal window shows that shell. Close the shells you start. They
427
+ do not go away on their own.
428
+
231
429
  ## The single-browser workspace (Or: The compatibility wing)
232
430
 
233
431
  The pane workspace is the native path. The original single-browser workspace
@@ -238,13 +436,15 @@ Open **Browser** or a new tab. Enter a web address, search phrase, or localhost
238
436
  URL. Navigation, clicks, typing, and scrolling happen in the real page on the
239
437
  terminal host, not in an iframe.
240
438
 
241
- Human tabs start Private. The compatibility sharing flow keeps View only,
242
- Allow control, and Copy connection. Changing the permission rotates the token;
439
+ Human tabs start Private. **Share** opens the permission row at every width -
440
+ View only, Allow control, Copy connection, Read page, Close tab - and it starts
441
+ closed so the page keeps the space. Changing the permission rotates the token;
243
442
  choosing Private rejects subsequent token requests; closing a tab destroys its
244
- context. On a phone or tablet, **Share** opens the permission row, Read page,
245
- and Close tab. On a phone, the tab strip, address bar, and Share sit together at
246
- the bottom above the remote keyboard; the address bar carries back, forward,
247
- reload, and Go.
443
+ context. A **Collapse** control removes every bar above the page and remembers
444
+ the choice, leaving a slim strip that names the page and brings the controls
445
+ back. The mascot stays in the navigation rail. On a phone, the tab strip,
446
+ address bar, and type row sit at the bottom above the remote keyboard; the
447
+ address bar carries back, forward, reload, and Go.
248
448
 
249
449
  The agent browser is a separate context with control granted. Hide view keeps it
250
450
  running headless; reopen Agent to observe the same context. Its bearer-token API
@@ -261,13 +461,45 @@ agent work in the pane workspace, use the injected environment and
261
461
  against a process that already has unrestricted access to the host.
262
462
  - Grants protect cooperative API clients. They do not protect against a hostile
263
463
  process with host access.
464
+ - On the pane workspace, a pane the person opens is Private to agents until they
465
+ grant View only or Allow control from that pane's header. The server enforces
466
+ it on every route, not only in the page: an agent cannot read, type into,
467
+ move, resize or close a Private pane, and sees none of its title, address,
468
+ folder or output. What an agent has on a pane is stated in every state
469
+ response (`agentAccess`). An agent's own panes, and the Orchestrator pane, are
470
+ every agent's to use.
471
+ - On the terminal screen, a shell you open is yours: an agent cannot rename it,
472
+ bring your window to it, or close it, and its name and folder are not shown
473
+ to agents, only counted. The server enforces this on every route, not only in
474
+ the page. A shell an agent opens is any agent's to rename, show and close.
475
+ - The server tells the owner's page from an agent by the key each presents,
476
+ never by a field in the request. The page is handed its own key once, by a
477
+ route that answers only a page reached by a navigation in a browser and only
478
+ to that page's own request; agents hold the workspace token. Neither is asked
479
+ for the other.
480
+ - **What the per-pane setting holds against, and what it does not.** It holds
481
+ against an agent's own key (the `panes` command, a pane's environment). It
482
+ does not hold against a program on the same Mac that presents itself as the
483
+ owner's page: one making ordinary requests is refused, but one that sends a
484
+ browser's navigation details on purpose, or drives a real browser, is not told
485
+ apart from the page. That is what the next stage, agents separated from the
486
+ owner, is for.
264
487
  - Browser sessions and grants live in memory. Restarting the server closes them;
265
488
  saved browser profiles and seamless session persistence are not implemented.
489
+ The pane layout survives a restart; the grants on your panes do not, so your
490
+ panes come back Private and an agent asks again.
491
+ - Shell sessions are processes of the app. Each keeps running, with or without
492
+ a viewer, until it is closed; all of them end when the app stops.
266
493
  - Browser audio, native file-picker and download dialogs, extensions, and
267
494
  password-manager integration are not provided. Dropped files use the
268
495
  attachment path above.
269
496
  - The browser viewer is image-based: it is remote interaction, not a native DOM
270
497
  exposed to the viewer's assistive technology.
498
+ - A password field's value never comes back from a page, on any route: not in an
499
+ element catalog, not in the result of a click or of typing, not in the report
500
+ of the focused field, and a password field cannot be waited on. An agent can
501
+ focus and type into one without reading it, and the page still receives what
502
+ was typed.
271
503
 
272
504
  ### Your data (Or: The files that stay yours)
273
505
 
@@ -276,6 +508,9 @@ Workspace data lives in `~/.townmouse`:
276
508
  - `pane-token` — the workspace API token, mode 600.
277
509
  - `attachments/<date>/` — dropped files, mode 700/600.
278
510
  - `workspace.json` — tabs, panes, URLs, and the active tab, mode 600.
511
+ - `~/.config/terminalone/voice.json` — voice command, model, language, and
512
+ arguments, mode 600. Outside `~/.townmouse`, so a Docker run mounts it as the
513
+ second volume.
279
514
 
280
515
  Back up `~/.townmouse` before upgrades. Project files live wherever you mounted
281
516
  them, never inside the package directory. Docker uses the `townmouse-home`
@@ -283,14 +518,9 @@ volume for the same data.
283
518
 
284
519
  ## Development (Or: Tests before vibes)
285
520
 
286
- ```sh
287
- npm start # run the workspace
288
- npm test # security, unit, smoke, feature, voice, responsive, pane API, and agent-control suites
289
- npm run test:workspace # browser workspace journeys; starts its own preview site
290
- npm run test:package # install the packed tarball and run the installed app
291
- npm run doctor # check Node and native modules
292
- npm run repair # rebuild native modules
293
- ```
521
+ The project keeps its own test suite and its release gates use it; the suite is
522
+ not part of the installed package. `npm start` runs the workspace from source,
523
+ and `npm run doctor` checks the native engine.
294
524
 
295
525
  Design notes live in [DESIGN.md](DESIGN.md). The product follows the Legacy
296
526
  Design Studio's Frontend Design workflow, with the Open Design anti-AI-slop
@@ -305,8 +535,10 @@ More docs:
305
535
 
306
536
  ## Status (Or: Version 0.2.1, and honest about it)
307
537
 
308
- Version 0.2.1. 0.1.0 was the first product cut. Two working surfaces: the single
309
- terminal/browser workspace and the pane workspace. The pane workspace is the
538
+ Version 0.2.1. 0.1.0 was the first product cut. Available from npm as
539
+ `townmouse@0.2.1`, as a checksummed tarball on the GitHub release, and as a
540
+ locally built container image. Two working surfaces: the single terminal/browser
541
+ workspace and the pane workspace. The pane workspace is the
310
542
  native path for agent work; the single-browser workspace remains for
311
543
  compatibility. Known limits are under Security and in
312
544
  [docs/PACKAGING.md](docs/PACKAGING.md).
package/SECURITY.md CHANGED
@@ -43,6 +43,9 @@ Report vulnerabilities privately via **GitHub Security Advisories**:
43
43
  - Townmouse binds to `127.0.0.1` by default. Keep it on loopback. An HTTPS proxy or tunnel in front must authenticate **every** request before it forwards it, including WebSocket upgrades. `TERMINALONE_TRUSTED_ORIGINS` allows an address; it does not add authentication.
44
44
  - A terminal runs commands with your account's permissions. Browser tabs are isolated Chromium contexts, not your personal Safari or Chrome profile.
45
45
  - View and control grants protect cooperative API clients. They are not a security boundary against a process that already has unrestricted access to the host.
46
+ - On the pane workspace, a pane the owner opens is Private to agents until the owner grants View only or Allow control from its header. The server enforces the level on every route and tells the owner's page from an agent by the key presented, never by a field in the request. An agent's own panes, and the Orchestrator pane, are every agent's to use.
47
+ - **What the per-pane setting holds against, and what it does not.** It holds against an agent's own key: the `panes` command, and the token in a pane's environment. It does not hold against a program on the same Mac that presents itself as the owner's page. The owner's key is handed only to a page reached by a navigation in a browser (`Sec-Fetch-Mode: navigate`) and only to that page's own request (`Sec-Fetch-Site: same-origin`), so a program making ordinary requests is refused and told what an agent does instead; a program that sends those details on purpose, or drives a real browser, is not told apart from the page, because nothing that looks only at an HTTP request can tell them apart. Separating agents from the owner at that level is the next stage.
48
+ - No route returns a password field's value: not the element catalog, not the result of a click or of typing, not the report of the focused element, and a password field cannot be waited on.
46
49
  - Browser sessions and grants are held in memory; restarting the server closes them. At most 32 browser contexts can remain open.
47
50
  - Browser audio, file upload/download dialogs, extensions, and password-manager integration are not provided.
48
51
  - The request boundary accepts any port on a loopback hostname so a container can be published on a different host port. It still requires an exact same-origin `Origin`/`Host` match, so a page served from another local port cannot drive the server. A non-loopback hostname must be listed in `TERMINALONE_TRUSTED_ORIGINS` as an exact HTTPS origin.
package/TOWNMOUSE.md CHANGED
@@ -72,7 +72,7 @@ Version 0.1.0. Two working surfaces: the single terminal/browser workspace and t
72
72
 
73
73
  Three deliberate layouts: desktop sidebar, tablet rail, phone bottom navigation. Phone shows one task surface at a time; the key bar collapses to one row and expands with the chevron. Tablet and phone put browser tabs and sharing controls in the browser surface; on phone the tab strip, address bar, and Share sit together at the bottom. Those rows are tightly padded, and after seven seconds without a touch the content takes the whole frame while the bottom navigation stays; the next touch wakes the chrome.
74
74
 
75
- The session pill opens a Sessions sheet with switching and New session. Tools is a grouped surface. Close terminal uses an in-design confirmation. None of that is decorative. It is the product.
75
+ The top row lists one chip per shell; the session pill opens a Sessions sheet with switching, renaming, closing and New session. Tools is a grouped surface. Closing a shell uses an in-design confirmation. None of that is decorative. It is the product.
76
76
 
77
77
  ## Naming and Ancestry (Or: The Triptych, and Why There Are Three)
78
78
 
package/bin/townmouse CHANGED
@@ -5,7 +5,7 @@ const path = require('path');
5
5
  const pkg = require('../package.json');
6
6
 
7
7
  const ROOT = path.join(__dirname, '..');
8
- let port = Number(process.env.PORT) || 11001;
8
+ let port = Number(process.env.PORT) || 11002;
9
9
  let openBrowser = true;
10
10
 
11
11
  for (let i = 0; i < process.argv.length; i++) {
@@ -15,7 +15,7 @@ for (let i = 0; i < process.argv.length; i++) {
15
15
 
16
16
  Usage: townmouse [--port <n>] [--no-open]
17
17
 
18
- --port <n> Port for the local server (default 11001)
18
+ --port <n> Port for the local server (default 11002)
19
19
  --no-open Do not open a browser window
20
20
  `);
21
21
  process.exit(0);