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.
- package/CHANGELOG.md +72 -2
- package/DESIGN.md +26 -42
- package/README.md +286 -54
- package/SECURITY.md +3 -0
- package/TOWNMOUSE.md +1 -1
- package/bin/townmouse +2 -2
- package/docs/PACKAGING.md +104 -8
- package/docs/browser-workspace.md +62 -9
- package/docs/panes.md +199 -9
- package/native/TownmouseApp.swift +5 -5
- package/npm-shrinkwrap.json +1282 -0
- package/package.json +11 -7
- package/public/browser-picture.mjs +159 -0
- package/public/features/app-version.mjs +35 -0
- package/public/features/autosave.mjs +5 -1
- package/public/features/multi-window-sync.mjs +3 -1
- package/public/features/osc-bridge.mjs +8 -3
- package/public/features/session-manager.mjs +202 -100
- package/public/features/status-metrics.mjs +23 -0
- package/public/features/tab-reorder.mjs +8 -0
- package/public/features/window-title.mjs +10 -3
- package/public/index.html +617 -78
- package/public/input-guard.mjs +10 -2
- package/public/panes.css +189 -13
- package/public/panes.html +4 -1
- package/public/panes.mjs +667 -109
- package/public/workspace.css +198 -24
- package/public/workspace.mjs +346 -106
- package/scripts/install-service.sh +97 -63
- package/scripts/panes +134 -5
- package/scripts/retire-legacy-service.sh +76 -0
- package/scripts/{t1.sh → townmouse.sh} +60 -21
- package/scripts/uninstall-service.sh +31 -15
- package/src/agent-guide.js +72 -3
- package/src/attachments.js +2 -2
- package/src/browser-dom.js +5 -2
- package/src/browser-workspace.js +549 -62
- package/src/owner-page.js +43 -0
- package/src/request-boundary.js +1 -1
- package/src/server.js +588 -128
- package/src/workspace-panes.js +423 -91
package/public/input-guard.mjs
CHANGED
|
@@ -172,8 +172,15 @@ export class InputGuard {
|
|
|
172
172
|
|
|
173
173
|
/** Preserve the browser's input source while xterm emits onData. Capture runs
|
|
174
174
|
* before xterm's listeners; eventPhase becomes zero when dispatch ends, so an
|
|
175
|
-
* asynchronous composition finalization never inherits a stale keyboard flag.
|
|
176
|
-
|
|
175
|
+
* asynchronous composition finalization never inherits a stale keyboard flag.
|
|
176
|
+
*
|
|
177
|
+
* `ignoreGenerated` is asked about each piece of input that has no key, paste
|
|
178
|
+
* or composition behind it. The terminal's answers to questions it was asked
|
|
179
|
+
* arrive that way. While a resumed shell's earlier output is being replayed,
|
|
180
|
+
* those questions were asked long ago, and an answer would be typed into a
|
|
181
|
+
* shell that is waiting for a command: the page passes a function that is true
|
|
182
|
+
* for the length of a replay. */
|
|
183
|
+
export function bindInputGuard(term, guard, { ignoreGenerated } = {}) {
|
|
177
184
|
let inputEvent = null;
|
|
178
185
|
let composing = false;
|
|
179
186
|
const capture = (event) => { inputEvent = event; };
|
|
@@ -195,6 +202,7 @@ export function bindInputGuard(term, guard) {
|
|
|
195
202
|
source = inputEvent.type === 'paste' ? 'paste' : 'keyboard';
|
|
196
203
|
}
|
|
197
204
|
}
|
|
205
|
+
if (source === 'unknown' && ignoreGenerated && ignoreGenerated()) return;
|
|
198
206
|
guard.onData(data, { source });
|
|
199
207
|
});
|
|
200
208
|
return () => {
|
package/public/panes.css
CHANGED
|
@@ -13,10 +13,17 @@
|
|
|
13
13
|
--mint: var(--accent);
|
|
14
14
|
--mint-ink: #07101d;
|
|
15
15
|
--danger: #ffb3ac;
|
|
16
|
+
--agent: #e9d6a1; /* the tone that marks anything an agent can reach */
|
|
16
17
|
--bar-height: 52px;
|
|
17
18
|
--radius: 8px;
|
|
18
19
|
--panel-w: 360px;
|
|
19
20
|
--panel-h: 48dvh;
|
|
21
|
+
/* A browser pane's address row and typing row are built from these, and the
|
|
22
|
+
phone layout adds their height to the pane (see "Phone: panes stack"), so
|
|
23
|
+
the page keeps the room it had before the rows existed. */
|
|
24
|
+
--browser-row-pad: 5px;
|
|
25
|
+
--browser-control-h: 30px;
|
|
26
|
+
--browser-rows-h: calc((var(--browser-control-h) + var(--browser-row-pad) * 2 + 1px) * 2);
|
|
20
27
|
--font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
|
21
28
|
--font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
|
|
22
29
|
color-scheme: dark;
|
|
@@ -24,6 +31,11 @@
|
|
|
24
31
|
|
|
25
32
|
*, *::before, *::after { box-sizing: border-box; }
|
|
26
33
|
|
|
34
|
+
/* The workspace is an application, not a document: a finger may scroll it but
|
|
35
|
+
must not zoom it, wherever the touch starts. An element with a stricter rule,
|
|
36
|
+
such as a browser pane's picture, keeps its own. */
|
|
37
|
+
*, *::before, *::after { touch-action: pan-x pan-y; }
|
|
38
|
+
|
|
27
39
|
html, body { height: 100%; }
|
|
28
40
|
|
|
29
41
|
body {
|
|
@@ -242,7 +254,7 @@ button { cursor: pointer; }
|
|
|
242
254
|
align-items: center;
|
|
243
255
|
gap: 4px;
|
|
244
256
|
flex: none;
|
|
245
|
-
padding:
|
|
257
|
+
padding: var(--browser-row-pad);
|
|
246
258
|
border-bottom: 1px solid var(--line);
|
|
247
259
|
background: var(--surface);
|
|
248
260
|
}
|
|
@@ -253,7 +265,7 @@ button { cursor: pointer; }
|
|
|
253
265
|
align-items: center;
|
|
254
266
|
justify-content: center;
|
|
255
267
|
flex: none;
|
|
256
|
-
height:
|
|
268
|
+
height: var(--browser-control-h);
|
|
257
269
|
min-width: 30px;
|
|
258
270
|
padding: 0 8px;
|
|
259
271
|
border: 1px solid var(--line-strong);
|
|
@@ -285,7 +297,7 @@ button { cursor: pointer; }
|
|
|
285
297
|
.address-input {
|
|
286
298
|
flex: 1 1 auto;
|
|
287
299
|
min-width: 0;
|
|
288
|
-
height:
|
|
300
|
+
height: var(--browser-control-h);
|
|
289
301
|
padding: 0 8px;
|
|
290
302
|
border: 1px solid var(--line-strong);
|
|
291
303
|
border-radius: 6px;
|
|
@@ -326,7 +338,7 @@ button { cursor: pointer; }
|
|
|
326
338
|
display: flex;
|
|
327
339
|
flex: none;
|
|
328
340
|
gap: 4px;
|
|
329
|
-
padding:
|
|
341
|
+
padding: var(--browser-row-pad);
|
|
330
342
|
border-top: 1px solid var(--line);
|
|
331
343
|
background: var(--surface);
|
|
332
344
|
}
|
|
@@ -334,7 +346,7 @@ button { cursor: pointer; }
|
|
|
334
346
|
.browser-type-input {
|
|
335
347
|
flex: 1 1 auto;
|
|
336
348
|
min-width: 0;
|
|
337
|
-
height:
|
|
349
|
+
height: var(--browser-control-h);
|
|
338
350
|
padding: 0 9px;
|
|
339
351
|
border: 1px solid var(--line-strong);
|
|
340
352
|
border-radius: 6px;
|
|
@@ -650,6 +662,23 @@ button { cursor: pointer; }
|
|
|
650
662
|
letter-spacing: -0.01em;
|
|
651
663
|
}
|
|
652
664
|
|
|
665
|
+
/* Which version is running: a quiet line under the menu's title, in the part
|
|
666
|
+
of the sheet that never scrolls away. */
|
|
667
|
+
.sheet-heading {
|
|
668
|
+
display: flex;
|
|
669
|
+
flex-direction: column;
|
|
670
|
+
gap: 1px;
|
|
671
|
+
min-width: 0;
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
.sheet-version {
|
|
675
|
+
margin: 0;
|
|
676
|
+
color: var(--muted);
|
|
677
|
+
font-family: var(--font-mono);
|
|
678
|
+
font-size: 11px;
|
|
679
|
+
line-height: 1.35;
|
|
680
|
+
}
|
|
681
|
+
|
|
653
682
|
.icon-button {
|
|
654
683
|
display: inline-flex;
|
|
655
684
|
align-items: center;
|
|
@@ -866,27 +895,34 @@ button { cursor: pointer; }
|
|
|
866
895
|
}
|
|
867
896
|
|
|
868
897
|
|
|
869
|
-
/* Phone: panes stack instead of shrinking to unreadable quarters.
|
|
898
|
+
/* Phone: panes stack instead of shrinking to unreadable quarters. Content
|
|
899
|
+
first: a browser pane is taller by exactly its two rows, so the page shows
|
|
900
|
+
as much as it did before the rows kept their place in the background. */
|
|
870
901
|
@media (max-width: 600px) {
|
|
902
|
+
:root { --pane-min-h: 45dvh; }
|
|
871
903
|
.pane-grid,
|
|
872
904
|
.pane-grid[data-count="2"],
|
|
873
905
|
.pane-grid[data-count="3"],
|
|
874
906
|
.pane-grid[data-count="4"] {
|
|
875
907
|
grid-template-columns: minmax(0, 1fr);
|
|
876
908
|
grid-template-rows: none;
|
|
877
|
-
grid-auto-rows: minmax(
|
|
909
|
+
grid-auto-rows: minmax(var(--pane-min-h), auto);
|
|
878
910
|
align-content: start;
|
|
879
911
|
overflow-y: auto;
|
|
880
912
|
}
|
|
881
913
|
.pane-grid[data-count="1"] { grid-template-rows: minmax(0, 1fr); grid-auto-rows: auto; overflow: hidden; }
|
|
882
914
|
.pane-grid[data-count="3"] > .pane:first-child { grid-column: auto; }
|
|
883
|
-
.pane { min-height:
|
|
915
|
+
.pane { min-height: var(--pane-min-h); }
|
|
916
|
+
.pane-grid:not([data-count="1"]) .pane-browser { min-height: calc(var(--pane-min-h) + var(--browser-rows-h)); }
|
|
884
917
|
.pane-grid[data-count="1"] .pane { min-height: 0; }
|
|
885
918
|
}
|
|
886
919
|
|
|
887
|
-
/*
|
|
888
|
-
|
|
889
|
-
|
|
920
|
+
/* A browser pane keeps one size whether it is active or not. In the background
|
|
921
|
+
its toolbar and typing row keep their place, with only their contents hidden.
|
|
922
|
+
Taking the rows away squeezed the picture and made the page inside lay itself
|
|
923
|
+
out again on every click. */
|
|
924
|
+
.pane-browser:not(.is-active) .browser-toolbar > *,
|
|
925
|
+
.pane-browser:not(.is-active) .browser-type-row > * { visibility: hidden; }
|
|
890
926
|
|
|
891
927
|
/* Drop target feedback for native file attachment. */
|
|
892
928
|
.pane.drop-target {
|
|
@@ -949,11 +985,13 @@ button { cursor: pointer; }
|
|
|
949
985
|
/* Touch targets: every interactive control is at least 44x44 where a finger
|
|
950
986
|
is the pointer. Keep desktop density; expand only on coarse/mobile. */
|
|
951
987
|
@media (pointer: coarse), (max-width: 699px) {
|
|
988
|
+
/* The browser pane's controls grow here, so its rows grow with them. */
|
|
989
|
+
:root { --browser-control-h: 44px; }
|
|
952
990
|
.bar-button { min-width: 44px; min-height: 44px; }
|
|
953
991
|
.icon-button { width: 44px; height: 44px; }
|
|
954
992
|
.pane-close, .pane-maximize { width: 44px; min-width: 44px; height: 44px; }
|
|
955
|
-
.browser-icon-button, .address-go { min-width: 44px;
|
|
956
|
-
.
|
|
993
|
+
.browser-icon-button, .address-go { min-width: 44px; }
|
|
994
|
+
.pane-bar input, .pane-bar select { height: 44px; }
|
|
957
995
|
.tab-select { min-height: 44px; }
|
|
958
996
|
.tab-close { min-width: 44px; }
|
|
959
997
|
.menu-item { min-height: 44px; }
|
|
@@ -1255,3 +1293,141 @@ button { cursor: pointer; }
|
|
|
1255
1293
|
bottom: max(calc(var(--panel-h) + 16px), calc(var(--keyboard-inset, 0px) + var(--bar-height) + env(safe-area-inset-bottom, 0px) + 216px));
|
|
1256
1294
|
}
|
|
1257
1295
|
}
|
|
1296
|
+
|
|
1297
|
+
/* ─── Agent access ───────────────────────────────────────────────────────── */
|
|
1298
|
+
|
|
1299
|
+
/* What an agent may do in a pane is said in the pane's own header, next to
|
|
1300
|
+
its kind. The owner's panes carry the control; an agent's pane carries its
|
|
1301
|
+
"agent" badge instead. The pane is a size container, so its own width and
|
|
1302
|
+
not the window's decides what fits in the header. */
|
|
1303
|
+
.pane { container-type: inline-size; }
|
|
1304
|
+
|
|
1305
|
+
.pane-access {
|
|
1306
|
+
display: inline-flex;
|
|
1307
|
+
align-items: center;
|
|
1308
|
+
gap: 5px;
|
|
1309
|
+
flex: none;
|
|
1310
|
+
color: var(--muted);
|
|
1311
|
+
transition: color 180ms cubic-bezier(.2, .8, .2, 1);
|
|
1312
|
+
}
|
|
1313
|
+
|
|
1314
|
+
.pane-access-label {
|
|
1315
|
+
font-family: var(--font-mono);
|
|
1316
|
+
font-size: 9.5px;
|
|
1317
|
+
font-weight: 500;
|
|
1318
|
+
letter-spacing: 0.09em;
|
|
1319
|
+
text-transform: uppercase;
|
|
1320
|
+
white-space: nowrap;
|
|
1321
|
+
}
|
|
1322
|
+
|
|
1323
|
+
/* Grant change: the control's text and boundary take the agent tone, 180ms,
|
|
1324
|
+
cubic-bezier(.2,.8,.2,1); reduced motion: immediate. */
|
|
1325
|
+
.pane-access-select {
|
|
1326
|
+
appearance: none;
|
|
1327
|
+
-webkit-appearance: none;
|
|
1328
|
+
height: 22px;
|
|
1329
|
+
min-width: 0;
|
|
1330
|
+
padding: 0 8px;
|
|
1331
|
+
border: 1px solid var(--line-strong);
|
|
1332
|
+
border-radius: 6px;
|
|
1333
|
+
background: #0d1219;
|
|
1334
|
+
color: inherit;
|
|
1335
|
+
font-family: var(--font-ui);
|
|
1336
|
+
font-size: 11px;
|
|
1337
|
+
font-weight: 600;
|
|
1338
|
+
line-height: 1;
|
|
1339
|
+
cursor: pointer;
|
|
1340
|
+
transition: border-color 180ms cubic-bezier(.2, .8, .2, 1);
|
|
1341
|
+
}
|
|
1342
|
+
|
|
1343
|
+
/* The chevron is drawn from the control's own colour, in the stroke the other
|
|
1344
|
+
icons use. It sits on the label, so a tap on it reaches the control. */
|
|
1345
|
+
.pane-access::after {
|
|
1346
|
+
content: '';
|
|
1347
|
+
flex: none;
|
|
1348
|
+
width: 10px;
|
|
1349
|
+
height: 10px;
|
|
1350
|
+
margin-left: -3px;
|
|
1351
|
+
background-color: currentColor;
|
|
1352
|
+
-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
|
|
1353
|
+
mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
|
|
1354
|
+
transition: color 180ms cubic-bezier(.2, .8, .2, 1);
|
|
1355
|
+
}
|
|
1356
|
+
|
|
1357
|
+
/* Focus is the file's own 2px ring for every select; nothing extra is needed. */
|
|
1358
|
+
|
|
1359
|
+
.pane[data-agent-access="view"] .pane-access,
|
|
1360
|
+
.pane[data-agent-access="control"] .pane-access { color: var(--agent); }
|
|
1361
|
+
.pane[data-agent-access="view"] .pane-access-select,
|
|
1362
|
+
.pane[data-agent-access="control"] .pane-access-select { border-color: color-mix(in srgb, var(--agent) 50%, transparent); }
|
|
1363
|
+
|
|
1364
|
+
/* The caption yields first: the pane's own title keeps its room. */
|
|
1365
|
+
@container (max-width: 559px) {
|
|
1366
|
+
.pane-access-label { display: none; }
|
|
1367
|
+
}
|
|
1368
|
+
|
|
1369
|
+
/* Touch: the control fills the header, which is 44pt on a touch screen. */
|
|
1370
|
+
@media (pointer: coarse) {
|
|
1371
|
+
.pane-header { height: 44px; }
|
|
1372
|
+
}
|
|
1373
|
+
@media (pointer: coarse), (max-width: 699px) {
|
|
1374
|
+
.pane-access-select { height: 44px; min-width: 44px; padding: 0 10px; }
|
|
1375
|
+
}
|
|
1376
|
+
@media (max-width: 699px) {
|
|
1377
|
+
.pane-access-select { font-size: 16px; }
|
|
1378
|
+
}
|
|
1379
|
+
|
|
1380
|
+
/* An agent's ask docks under the header of the pane it is about, and the
|
|
1381
|
+
pane's content gives up the row. It never covers a live surface. */
|
|
1382
|
+
.pane-ask {
|
|
1383
|
+
flex: none;
|
|
1384
|
+
display: flex;
|
|
1385
|
+
flex-wrap: wrap;
|
|
1386
|
+
align-items: center;
|
|
1387
|
+
justify-content: space-between;
|
|
1388
|
+
gap: 6px 12px;
|
|
1389
|
+
padding: 6px 10px;
|
|
1390
|
+
border-bottom: 1px solid color-mix(in srgb, var(--agent) 50%, transparent);
|
|
1391
|
+
background: #151d27; /* the notice card's surface */
|
|
1392
|
+
}
|
|
1393
|
+
.pane-ask[hidden] { display: none; }
|
|
1394
|
+
|
|
1395
|
+
.pane-ask-text {
|
|
1396
|
+
flex: 1 1 220px;
|
|
1397
|
+
min-width: 0;
|
|
1398
|
+
margin: 0;
|
|
1399
|
+
color: var(--muted);
|
|
1400
|
+
font-size: 12px;
|
|
1401
|
+
line-height: 1.4;
|
|
1402
|
+
overflow-wrap: anywhere;
|
|
1403
|
+
}
|
|
1404
|
+
.pane-ask-text strong { color: var(--text); font-weight: 600; }
|
|
1405
|
+
|
|
1406
|
+
/* Alone on its row, the actions sit on the right, where this surface puts them. */
|
|
1407
|
+
.pane-ask-actions { display: flex; flex: 0 0 auto; gap: 6px; margin-left: auto; }
|
|
1408
|
+
.pane-ask-actions .btn { height: 28px; min-height: 28px; padding: 0 10px; font-size: 11.5px; }
|
|
1409
|
+
|
|
1410
|
+
/* Ask arrival: the row is there at once and the content arrives in place,
|
|
1411
|
+
opacity 0 to 1 and 4px up to rest, 200ms, cubic-bezier(.2,.8,.2,1).
|
|
1412
|
+
Reduced motion: immediate (the global rule above). */
|
|
1413
|
+
@keyframes pane-ask-in {
|
|
1414
|
+
from { opacity: 0; transform: translateY(-4px); }
|
|
1415
|
+
to { opacity: 1; transform: none; }
|
|
1416
|
+
}
|
|
1417
|
+
.pane-ask > * { animation: pane-ask-in 200ms cubic-bezier(.2, .8, .2, 1); }
|
|
1418
|
+
|
|
1419
|
+
@media (pointer: coarse), (max-width: 699px) {
|
|
1420
|
+
.pane-ask-actions .btn { height: 44px; min-height: 44px; padding: 0 13px; font-size: 12px; }
|
|
1421
|
+
}
|
|
1422
|
+
|
|
1423
|
+
/* A tab holding an ask the person has not seen yet. */
|
|
1424
|
+
.tabstrip-item.has-ask .tabstrip-tab::before {
|
|
1425
|
+
content: '';
|
|
1426
|
+
display: inline-block;
|
|
1427
|
+
width: 6px;
|
|
1428
|
+
height: 6px;
|
|
1429
|
+
margin-right: 6px;
|
|
1430
|
+
border-radius: 50%;
|
|
1431
|
+
background: var(--agent);
|
|
1432
|
+
vertical-align: 1px;
|
|
1433
|
+
}
|
package/public/panes.html
CHANGED
|
@@ -76,7 +76,10 @@
|
|
|
76
76
|
<dialog class="sheet sheet-menu" id="menu-dialog" aria-labelledby="menu-dialog-title">
|
|
77
77
|
<div class="sheet-inner">
|
|
78
78
|
<header class="sheet-header">
|
|
79
|
-
<
|
|
79
|
+
<div class="sheet-heading">
|
|
80
|
+
<h2 id="menu-dialog-title">Menu</h2>
|
|
81
|
+
<p class="sheet-version" data-app-version-label>Townmouse</p>
|
|
82
|
+
</div>
|
|
80
83
|
<button type="button" class="icon-button" data-close aria-label="Close menu">
|
|
81
84
|
<svg viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round"><path d="M6 6l12 12M18 6L6 18"/></svg>
|
|
82
85
|
</button>
|