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
@@ -24,7 +24,13 @@ export function init(T1) {
24
24
  return `${h}h ${m}m`;
25
25
  }
26
26
 
27
+ // With no shell open the footer says so (the page script sets it) and is
28
+ // left alone: there is no shell to describe and no latency worth showing,
29
+ // even though the page still holds a shell-less connection.
30
+ const noShell = () => window.__terminalOne?.sessionView?.()?.state === 'ended';
31
+
27
32
  function updateFooter() {
33
+ if (noShell()) return;
28
34
  const parts = [];
29
35
  if (currentCommand) parts.push(currentCommand);
30
36
  if (currentCwd) parts.push(currentCwd);
@@ -49,6 +55,16 @@ export function init(T1) {
49
55
  connectedAt = Date.now();
50
56
  updateFooter();
51
57
  });
58
+ // The first `ready` can arrive before this module loads. Start from the
59
+ // session the page already has, instead of waiting for an event that has
60
+ // been and gone: without this the first latency tick replaced the shell and
61
+ // folder in the footer with the latency alone.
62
+ const started = window.__terminalOne?.sessionView?.();
63
+ if (started && started.state === 'live' && started.current) {
64
+ currentCommand = started.current.command || '';
65
+ currentCwd = started.current.cwd || '';
66
+ connectedAt = Date.now();
67
+ }
52
68
 
53
69
  // Track connection events from the global status text.
54
70
  const statusEl = document.getElementById('status');
@@ -60,6 +76,12 @@ export function init(T1) {
60
76
  } else if (text.includes('Disconnected') || text.includes('Closed') || text.includes('Exited')) {
61
77
  connectedAt = 0;
62
78
  rttMs = null;
79
+ } else if (text.includes('No shell')) {
80
+ // No shell is open, so there is no shell for the footer to describe.
81
+ connectedAt = 0;
82
+ rttMs = null;
83
+ currentCommand = '';
84
+ currentCwd = '';
63
85
  }
64
86
  updateFooter();
65
87
  });
@@ -85,6 +107,7 @@ export function init(T1) {
85
107
  let pingInFlight = false;
86
108
  setInterval(() => {
87
109
  if (pingInFlight) return;
110
+ if (noShell()) return;
88
111
  const ws = T1.ws || window.__terminalOne?.ws;
89
112
  if (ws && ws.readyState === WebSocket.OPEN) {
90
113
  const start = performance.now();
@@ -3,6 +3,14 @@
3
3
  *
4
4
  * Session tabs in the header can be dragged to reorder; the new order is
5
5
  * persisted to localStorage.
6
+ *
7
+ * Retired on 2026-11-28 and no longer loaded by public/index.html. The code
8
+ * below is kept as it was. It did not work as described: the saved order was
9
+ * never read back, so the next re-render undid a drag; only a mouse could
10
+ * reach it; and it moved a chip's button out of the wrapper that now carries
11
+ * the chip's close control. The row's order is the server's (creation order)
12
+ * and sessions are told apart by name. Do not re-add it to FEATURE_MODULES as
13
+ * it stands.
6
14
  */
7
15
  const LS_ORDER = 'terminalone.sessionOrder';
8
16
 
@@ -1,9 +1,11 @@
1
1
  /**
2
- * Window title reflects shell cwd.
2
+ * Window title reflects shell cwd and the running version.
3
3
  *
4
4
  * The server sends cwd via the ready/footer metadata. We update document.title
5
- * to "TerminalOne — ~/path" whenever it changes.
5
+ * to "Townmouse <version> — ~/path" whenever either changes.
6
6
  */
7
+ import { currentVersion } from './app-version.mjs';
8
+
7
9
  export function init(T1) {
8
10
  function basename(path) {
9
11
  if (!path) return '';
@@ -26,7 +28,11 @@ export function init(T1) {
26
28
  function update() {
27
29
  const footer = document.getElementById('footerMeta')?.textContent || '';
28
30
  const cwd = parseCwd(footer);
29
- if (cwd) document.title = `Townmouse — ${basename(cwd)}`;
31
+ // The version rides in the title, so the window itself says what is running.
32
+ const version = currentVersion();
33
+ const name = version ? `Townmouse ${version}` : 'Townmouse';
34
+ if (cwd) document.title = `${name} — ${basename(cwd)}`;
35
+ else if (version) document.title = name;
30
36
  }
31
37
 
32
38
  const footerEl = document.getElementById('footerMeta');
@@ -34,6 +40,7 @@ export function init(T1) {
34
40
  const mo = new MutationObserver(update);
35
41
  mo.observe(footerEl, { childList: true });
36
42
  }
43
+ document.addEventListener('townmouse:version', update);
37
44
  update();
38
45
 
39
46
  window.__terminalOneWindowTitle = { update, parseCwd, basename };