ai-agentmanager 1.57.0 → 1.57.2

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 CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.57.2 (2026-11-18)
4
+
5
+ - **The More menu scrolls on a phone.** It was longer than the screen and cut off, so its last items (Terminal, Screen) could not be reached. It now ends at the bottom of the screen and scrolls.
6
+ - **Screen: Return from a phone's keyboard.** Letters typed in **Type here** arrived but Return did not: it was sent only when the phone reported it as a key press. It is now sent however the phone reports it, once; delete the same.
7
+ - **Screen: Keys….** A list in the bar sends shortcuts and keys a phone's keyboard does not have: ⌘Space, ⌘Tab, ⌘`, copy, paste, cut, select all, undo, save, close window, quit, force quit, the arrows, delete and Space (Ctrl and Alt ones where the computer is not a Mac). Not yet tried against a real Mac: Command is sent as the Super key.
8
+ - **Shortcuts:** `Shift+S` opens Screen and `Shift+T` the Terminal on this computer; both are in the **?** list.
9
+
10
+ ## 1.57.1 (2026-11-18)
11
+
12
+ - **Screen: zoom.** **−** and **+** in the bar draw the screen at 150% to 400%, and the button between them goes back to **Fit**. Zoomed in, **Move** lets a drag move around the screen; with it off, a tap clicks in the computer as before.
13
+ - **Screen: show the password.** The sign-in has a **Show the password** box: typed blind on a phone, a password goes wrong easily, and the Mac only says it was refused.
14
+ - **Screen: a Mac with Remote Management on.** Such a Mac lets in only the users on its own list and refuses anyone else as if the password were wrong. When this computer's user is not on it, the Screen dialog says so before you sign in, with where to add the user and the command that does it.
15
+ - **Tried:** Screen now works past a real Mac's sign-in, from a real phone. Zoom, Move and the password box are tried in desktop Chrome only; the Remote Management note is not tried in a browser.
16
+
3
17
  ## 1.57.0 (2026-11-17)
4
18
 
5
19
  - **Screen: this computer's desktop in the page, from the phone too.** A pop-up that waits for an answer, another program you want to watch: **Screen** in the top bar shows the computer's whole screen, and your clicks, taps and typing go back to it. It works on the computer itself and on any device signed in through remote access. On a phone the bar has a **Type here** field for the keyboard, and **Esc**, **Tab** and **⏎**.
package/README.md CHANGED
@@ -885,7 +885,9 @@ It does not capture the screen itself. The computer's own screen sharing does, a
885
885
  2. On the computer itself: **Screen → Turn on** (or `agentmgr screen --on`).
886
886
  3. From any signed-in device: **Screen → Connect**, and sign in with your Mac user name and password when the Mac asks. They go to the Mac's screen sharing and are not kept.
887
887
 
888
- On a phone, the bar has a **Type here** field for the keyboard, and **Esc**, **Tab** and **⏎**.
888
+ On a phone, the bar has a **Type here** field for the keyboard, and **Esc**, **Tab** and **⏎**. **−** and **+** zoom in up to 400% (the button between them goes back to **Fit**); zoomed in, **Move** lets a drag move around the screen instead of clicking in it. The sign-in has **Show the password**, for a password typed on a phone. **Keys…** sends shortcuts and keys a phone's keyboard does not have: ⌘Space, ⌘Tab, copy, paste, undo, close, quit, force quit, the arrows and delete. With a keyboard, `Shift+S` opens Screen and `Shift+T` the Terminal on this computer.
889
+
890
+ A Mac with **Remote Management** on (instead of plain Screen Sharing) lets in only the users listed under **Sharing → Remote Management → ⓘ**, and refuses anyone else as if the password were wrong. The Screen dialog says so when this computer's user is not listed, with the command that adds it.
889
891
 
890
892
  - **Whoever uses it controls the whole computer,** not only the agents. So it is off until you turn it on, it can be turned on only on the computer itself (not from a signed-in device), and the computer's screen sharing still asks for its own sign-in every time.
891
893
  - **Who is looking:** while another device views the screen, the **Screen** button shows a dot, and its tooltip and `agentmgr screen` name the device and its address. **Turn off** ends every view at once.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-agentmanager",
3
- "version": "1.57.0",
3
+ "version": "1.57.2",
4
4
  "description": "Run background coding agents (Claude Code, Codex) per intent, and keep track of them from a web UI, your phone or the CLI",
5
5
  "keywords": [
6
6
  "claude",
package/public/app.js CHANGED
@@ -427,6 +427,8 @@ function shortcut(act) {
427
427
  if (act === 'usage') return usageUi.open();
428
428
  if (act === 'skills') return skillsUi.open();
429
429
  if (act === 'today') return todayUi.open();
430
+ if (act === 'screen') return $('#screen-btn').click();
431
+ if (act === 'machine') return $('#machine-btn').click();
430
432
  if (act.startsWith('tab:')) return showTab(act.slice(4));
431
433
  return false;
432
434
  }
package/public/index.html CHANGED
@@ -1025,6 +1025,11 @@
1025
1025
  <button class="ghost small" data-screen-key="esc" title="Escape">Esc</button>
1026
1026
  <button class="ghost small" data-screen-key="tab" title="Tab">Tab</button>
1027
1027
  <button class="ghost small" data-screen-key="enter" title="Return">⏎</button>
1028
+ <select id="screen-combo" class="screen-combo" aria-label="Send a shortcut or a key" title="Shortcuts and keys a phone's keyboard does not have"><option value="">Keys…</option></select>
1029
+ <button class="ghost small" data-screen-zoom="-1" title="Zoom out" aria-label="Zoom out">−</button>
1030
+ <button class="ghost small" id="screen-zoom-now" data-screen-zoom="0" title="Fit the whole screen">Fit</button>
1031
+ <button class="ghost small" data-screen-zoom="1" title="Zoom in" aria-label="Zoom in">+</button>
1032
+ <button class="ghost small" id="screen-move" data-screen="move" title="Drag to move around the zoomed screen instead of clicking in it" aria-pressed="false" hidden>Move</button>
1028
1033
  </span>
1029
1034
  <button id="screen-off" class="ghost small" data-screen="off" title="No device can reach this computer's screen until you turn it on again here" hidden>Turn off</button>
1030
1035
  <button class="ghost small" data-screen="close" title="Close (ends your connection to the screen)">Close</button>
package/public/keys.js CHANGED
@@ -33,6 +33,8 @@ export const SHORTCUTS = [
33
33
  [['B'], 'Board: every agent as a card, by where its work stands', 'board'],
34
34
  [['q'], 'Decide: recommendations, standing decisions, impact, dates at risk', 'decide'],
35
35
  [['z'], "Usage: each engine's plan limits, used and left", 'usage'],
36
+ [['S'], "Screen: this computer's desktop", 'screen'],
37
+ [['T'], 'Terminal on this computer', 'machine'],
36
38
  [['1'], 'Agents tab', 'tab:agents'],
37
39
  [['2'], 'Inbox: what needs you', 'tab:inbox'],
38
40
  [['3'], 'Backlog', 'tab:backlog'],
@@ -76,11 +78,11 @@ export const SHORTCUTS = [
76
78
  // A single key, as an event names it, to its action.
77
79
  export const SINGLE = {
78
80
  j: 'next', k: 'prev', Enter: 'terminal', t: 'terminal',
79
- r: 'changes', s: 'start', X: 'stop', e: 'edit', n: 'new', a: 'ask', '/': 'filter', w: 'watch', p: 'standup', m: 'map', i: 'issues', o: 'actions', h: 'assistant', ',': 'settings', d: 'designs', g: 'reviews', v: 'value', l: 'news', c: 'plan', u: 'os', B: 'board', q: 'decide', z: 'usage', y: 'today', b: 'bugs', '?': 'help',
81
+ r: 'changes', s: 'start', X: 'stop', e: 'edit', n: 'new', a: 'ask', '/': 'filter', w: 'watch', p: 'standup', m: 'map', i: 'issues', o: 'actions', h: 'assistant', ',': 'settings', d: 'designs', g: 'reviews', v: 'value', l: 'news', c: 'plan', u: 'os', B: 'board', q: 'decide', z: 'usage', y: 'today', b: 'bugs', S: 'screen', T: 'machine', '?': 'help',
80
82
  1: 'tab:agents', 2: 'tab:inbox', 3: 'tab:backlog', 4: 'tab:land', 5: 'tab:built',
81
83
  };
82
84
  // While Watch is open: only what makes sense there.
83
- const ON_WATCH = new Set(['today', 'new', 'ask', 'watch', 'standup', 'map', 'issues', 'actions', 'assistant', 'settings', 'designs', 'reviews', 'value', 'news', 'plan', 'os', 'board', 'decide', 'usage', 'bugs', 'help']);
85
+ const ON_WATCH = new Set(['today', 'new', 'ask', 'watch', 'standup', 'map', 'issues', 'actions', 'assistant', 'settings', 'designs', 'reviews', 'value', 'news', 'plan', 'os', 'board', 'decide', 'usage', 'bugs', 'screen', 'machine', 'help']);
84
86
 
85
87
  /** Typing somewhere: a field, an editor or a terminal (xterm types through a textarea). */
86
88
  const typing = (el) => Boolean(el?.closest?.('input, textarea, select, [contenteditable=""], [contenteditable="true"], .xterm, .cm-editor'));
package/public/screen.js CHANGED
@@ -90,6 +90,32 @@ const keysymOf = (ch) => {
90
90
  return cp < 0x100 ? cp : 0x01000000 + cp;
91
91
  };
92
92
 
93
+ // Shortcuts for the bar's Keys list. On a Mac the screen sharing service takes Super as Command
94
+ // and Alt as Option.
95
+ const MOD = { cmd: 0xffeb, ctrl: 0xffe3, alt: 0xffe9, shift: 0xffe1 };
96
+ const key = (ch) => ch.codePointAt(0);
97
+ const COMBOS = (mac) => {
98
+ const m = mac ? 'cmd' : 'ctrl';
99
+ const sign = mac ? '⌘' : 'Ctrl+';
100
+ return [
101
+ ...(mac ? [['⌘Space · Spotlight', ['cmd'], 0x20], ['⌘Tab · switch app', ['cmd'], KEYS.tab], ['⌘` · next window', ['cmd'], key('`')]] : [['Alt+Tab · switch window', ['alt'], KEYS.tab]]),
102
+ [`${sign}C · copy`, [m], key('c')],
103
+ [`${sign}V · paste`, [m], key('v')],
104
+ [`${sign}X · cut`, [m], key('x')],
105
+ [`${sign}A · select all`, [m], key('a')],
106
+ [`${sign}Z · undo`, [m], key('z')],
107
+ [`${sign}S · save`, [m], key('s')],
108
+ [`${sign}W · close window`, [m], key('w')],
109
+ ...(mac ? [['⌘Q · quit app', ['cmd'], key('q')], ['⌥⌘Esc · force quit', ['alt', 'cmd'], KEYS.esc]] : [['Alt+F4 · close', ['alt'], 0xffc1]]),
110
+ ['↑', [], KEYS.up],
111
+ ['↓', [], KEYS.down],
112
+ ['←', [], KEYS.left],
113
+ ['→', [], KEYS.right],
114
+ ['⌫ · delete', [], KEYS.back],
115
+ ['Space', [], 0x20],
116
+ ];
117
+ };
118
+
93
119
  export function initScreen({ api, esc, toast, $ }) {
94
120
  const dialog = $('#screen-dialog');
95
121
  const body = $('#screen-body');
@@ -100,6 +126,39 @@ export function initScreen({ api, esc, toast, $ }) {
100
126
  let ended = null; // why the last connection ended
101
127
 
102
128
  const remote = () => document.body.classList.contains('remote');
129
+
130
+ // Zoom: the screen is drawn larger than the dialog and scrolled. A finger on it clicks in the
131
+ // computer, so moving around is its own mode (Move), which puts a sheet over the screen.
132
+ const ZOOMS = [1, 1.5, 2, 3, 4];
133
+ let zoom = 1;
134
+ let moving = false;
135
+ let stage = null;
136
+ function layout(keep = true) {
137
+ if (!stage) return;
138
+ const cx = keep && view.scrollWidth ? (view.scrollLeft + view.clientWidth / 2) / view.scrollWidth : 0.5;
139
+ const cy = keep && view.scrollHeight ? (view.scrollTop + view.clientHeight / 2) / view.scrollHeight : 0.5;
140
+ if (zoom === 1) moving = false;
141
+ view.classList.toggle('zoomed', zoom > 1);
142
+ // The outer size: scrollbars that take room must not make the screen smaller than the zoom says.
143
+ const w = view.offsetWidth;
144
+ const h = view.offsetHeight;
145
+ stage.style.width = `${Math.round(w * zoom)}px`;
146
+ stage.style.height = `${Math.round(h * zoom)}px`;
147
+ view.scrollLeft = cx * w * zoom - w / 2;
148
+ view.scrollTop = cy * h * zoom - h / 2;
149
+ stage.querySelector('.screen-pan').hidden = !moving;
150
+ $('#screen-zoom-now').textContent = zoom === 1 ? 'Fit' : `${Math.round(zoom * 100)}%`;
151
+ const move = $('#screen-move');
152
+ move.hidden = zoom === 1;
153
+ move.setAttribute('aria-pressed', String(moving));
154
+ move.classList.toggle('on', moving);
155
+ }
156
+ function setZoom(step) {
157
+ const at = ZOOMS.indexOf(zoom);
158
+ zoom = step === 0 ? 1 : ZOOMS[Math.max(0, Math.min(ZOOMS.length - 1, at + step))];
159
+ layout();
160
+ }
161
+ new ResizeObserver(() => layout()).observe(view);
103
162
  const others = (v = status?.viewers ?? []) => v.filter((x) => x.who !== 'this computer');
104
163
 
105
164
  /** The dot on the button: someone on another device is looking at this computer's screen. */
@@ -111,6 +170,15 @@ export function initScreen({ api, esc, toast, $ }) {
111
170
  if (dialog.open && !rfb) render();
112
171
  }
113
172
 
173
+ /** A Mac with Remote Management on refuses a user it does not list, whatever the password. */
174
+ function notListed() {
175
+ const m = status?.mac;
176
+ if (!m || m.allowed) return '';
177
+ return `<div class="screen-note"><p><b>This Mac will refuse ${esc(m.user)}, even with the right password.</b> It has Remote Management on, which lets in only the users listed there, and ${esc(m.user)} is not one of them.</p>
178
+ <p>On the Mac: <b>System Settings → General → Sharing → Remote Management → ⓘ</b>, add your user with Observe and Control. Or in a terminal on it (the Terminal button here will do):</p>
179
+ <p><code>${esc(m.fix)}</code></p></div>`;
180
+ }
181
+
114
182
  function render() {
115
183
  const s = status;
116
184
  const connected = Boolean(rfb);
@@ -138,7 +206,7 @@ export function initScreen({ api, esc, toast, $ }) {
138
206
  return;
139
207
  }
140
208
  state.textContent = ended ? 'Ended' : 'Ready';
141
- body.innerHTML = `${ended ? `<p><b>Ended:</b> ${esc(ended)}</p>` : '<h3>Ready</h3>'}
209
+ body.innerHTML = `${ended ? `<p><b>Ended:</b> ${esc(ended)}</p>` : '<h3>Ready</h3>'}${notListed()}
142
210
  <p class="hint">${s.platform === 'darwin' ? 'The Mac asks for your Mac user name and password next. They go to the Mac and are not kept.' : 'The computer asks for its screen sharing password next. It is not kept.'}</p>
143
211
  <p><button class="primary" data-screen="connect">${ended ? 'Connect again' : 'Connect'}</button></p>${viewed}`;
144
212
  }
@@ -175,7 +243,7 @@ export function initScreen({ api, esc, toast, $ }) {
175
243
  body.innerHTML = `<form id="screen-login" class="screen-login" autocomplete="off">
176
244
  <h3>${mac ? 'Sign in to this Mac' : 'Screen sharing password'}</h3>
177
245
  ${types.includes('username') ? `<label>${mac ? 'Mac user name' : 'User name'} <input name="username" autocapitalize="none" autocorrect="off" spellcheck="false" required /></label>` : ''}
178
- ${types.includes('password') ? '<label>Password <input name="password" type="password" autocomplete="off" required /></label>' : ''}
246
+ ${types.includes('password') ? '<label>Password <input name="password" type="password" autocomplete="off" autocapitalize="none" autocorrect="off" spellcheck="false" required /></label><label class="screen-show"><input type="checkbox" data-screen-show /> Show the password</label>' : ''}
179
247
  <p class="hint">Sent to the computer's screen sharing and not kept anywhere.</p>
180
248
  <p><button class="primary" type="submit">Sign in</button> <button type="button" class="ghost" data-screen="cancel">Cancel</button></p>
181
249
  </form>`;
@@ -192,8 +260,12 @@ export function initScreen({ api, esc, toast, $ }) {
192
260
  } catch (err) {
193
261
  return drop(`The viewer could not be loaded (${err.message})`);
194
262
  }
195
- view.replaceChildren();
196
- const mine = new RFB(view, REMOTE ? new StreamChannel() : `ws://${location.host}/ws/screen`);
263
+ stage = document.createElement('div');
264
+ stage.className = 'screen-stage';
265
+ stage.innerHTML = '<div class="screen-pan" hidden></div>';
266
+ view.replaceChildren(stage);
267
+ zoom = 1;
268
+ const mine = new RFB(stage, REMOTE ? new StreamChannel() : `ws://${location.host}/ws/screen`);
197
269
  rfb = mine;
198
270
  mine.scaleViewport = true;
199
271
  mine.background = '#0f1117';
@@ -202,7 +274,10 @@ export function initScreen({ api, esc, toast, $ }) {
202
274
  mine.addEventListener('connect', () => {
203
275
  if (rfb !== mine) return;
204
276
  state.textContent = 'Connected';
277
+ combos = COMBOS(status?.platform === 'darwin');
278
+ combo.innerHTML = '<option value="">Keys…</option>' + combos.map(([label], i) => `<option value="${i}">${esc(label)}</option>`).join('');
205
279
  render();
280
+ layout(false);
206
281
  mine.focus();
207
282
  });
208
283
  mine.addEventListener('disconnect', (e) => rfb === mine && drop(e.detail?.clean ? 'The connection was closed' : 'The connection was lost, or screen access is off'));
@@ -225,9 +300,16 @@ export function initScreen({ api, esc, toast, $ }) {
225
300
  rfb?.sendCredentials(creds);
226
301
  });
227
302
 
303
+ // Typed blind on a phone, a password goes wrong easily: let it be seen.
304
+ dialog.addEventListener('change', (e) => {
305
+ if (e.target.matches('[data-screen-show]')) e.target.form.password.type = e.target.checked ? 'text' : 'password';
306
+ });
307
+
228
308
  dialog.addEventListener('click', async (e) => {
229
309
  const key = e.target.closest('[data-screen-key]');
230
310
  if (key && rfb) return rfb.sendKey(KEYS[key.dataset.screenKey], null);
311
+ const z = e.target.closest('[data-screen-zoom]');
312
+ if (z) return setZoom(Number(z.dataset.screenZoom));
231
313
  const b = e.target.closest('[data-screen]');
232
314
  if (!b) return;
233
315
  const what = b.dataset.screen;
@@ -240,26 +322,52 @@ export function initScreen({ api, esc, toast, $ }) {
240
322
  render();
241
323
  } else if (what === 'check') await refresh();
242
324
  else if (what === 'connect') await connect();
243
- else if (what === 'cancel') drop('You cancelled the sign-in');
325
+ else if (what === 'move') {
326
+ moving = !moving;
327
+ layout();
328
+ } else if (what === 'cancel') drop('You cancelled the sign-in');
244
329
  else if (what === 'close') dialog.close();
245
330
  } catch (err) {
246
331
  toast(`Error: ${err.message}`, 6000);
247
332
  }
248
333
  });
249
334
 
335
+ // Shortcuts and keys a phone's keyboard does not have: held in order, released in reverse.
336
+ let combos = [];
337
+ const combo = $('#screen-combo');
338
+ combo.addEventListener('change', () => {
339
+ const picked = combos[combo.value];
340
+ combo.value = '';
341
+ if (!picked || !rfb) return;
342
+ const [, mods, sym] = picked;
343
+ for (const m of mods) rfb.sendKey(MOD[m], null, true);
344
+ rfb.sendKey(sym, null);
345
+ for (const m of [...mods].reverse()) rfb.sendKey(MOD[m], null, false);
346
+ });
347
+
250
348
  // A phone has no keyboard until a field is focused: what is typed here is sent key by key.
251
349
  const typed = $('#screen-type');
252
350
  typed.addEventListener('input', () => {
253
351
  if (rfb) for (const ch of typed.value) rfb.sendKey(keysymOf(ch), null);
254
352
  typed.value = '';
255
353
  });
354
+ let keyAt = 0; // when a key below was last sent, so it is not sent twice
256
355
  typed.addEventListener('keydown', (e) => {
257
356
  const k = { Enter: 'enter', Backspace: 'back', Tab: 'tab', Escape: 'esc' }[e.key];
258
357
  if (!k || !rfb) return;
259
358
  e.preventDefault();
260
359
  e.stopPropagation();
360
+ keyAt = Date.now();
261
361
  rfb.sendKey(KEYS[k], null);
262
362
  });
363
+ // A phone's keyboard does not always say which key it was in keydown: Return and delete also
364
+ // arrive as what they would do to the field.
365
+ typed.addEventListener('beforeinput', (e) => {
366
+ const k = { insertLineBreak: 'enter', insertParagraph: 'enter', deleteContentBackward: 'back' }[e.inputType];
367
+ if (!k || !rfb) return;
368
+ e.preventDefault();
369
+ if (Date.now() - keyAt > 80) rfb.sendKey(KEYS[k], null);
370
+ });
263
371
 
264
372
  // Esc belongs to the screen while it is shown, not to the dialog.
265
373
  dialog.addEventListener('cancel', (e) => rfb && e.preventDefault());
package/public/style.css CHANGED
@@ -106,7 +106,8 @@ a:hover { text-decoration: underline; }
106
106
  .top-more { position: static; }
107
107
  #top-more-btn.has-news::after { content: ''; display: inline-block; width: 7px; height: 7px; margin-left: 6px; border-radius: 50%; background: var(--accent); vertical-align: middle; }
108
108
  #top-more-menu { position: fixed; top: auto; right: 16px; margin-top: 6px; min-width: 200px; }
109
- #top-more-menu > button { display: flex; align-items: center; gap: 8px; }
109
+ #top-more-menu { overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
110
+ #top-more-menu > button { display: flex; align-items: center; gap: 8px; flex: none; }
110
111
 
111
112
  /* ---------- controls */
112
113
  button {
@@ -963,8 +964,13 @@ input.inline { display: inline-block; width: 80px; padding: 1px 4px; }
963
964
  .screen-dialog #screen-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-left: 8px; }
964
965
  .screen-body { flex: 1; min-height: 0; overflow: auto; padding: 18px 20px; max-width: 640px; line-height: 1.5; }
965
966
  .screen-body h3 { margin: 0 0 8px; }
966
- .screen-view { flex: 1; min-height: 0; display: flex; background: #0f1117; touch-action: none; }
967
- .screen-view > div { flex: 1; }
967
+ .screen-view { flex: 1; min-height: 0; overflow: hidden; background: #0f1117; }
968
+ .screen-view.zoomed { overflow: auto; }
969
+ .screen-stage { position: relative; width: 100%; height: 100%; }
970
+ .screen-stage > div:not(.screen-pan) { touch-action: none; }
971
+ .screen-pan { position: absolute; inset: 0; z-index: 2; cursor: grab; touch-action: pan-x pan-y; }
972
+ .screen-dialog .term-bar { flex-wrap: wrap; row-gap: 4px; }
973
+ .screen-keys button.on { background: var(--accent, #4c8dff); color: #fff; }
968
974
  .screen-keys { display: inline-flex; gap: 4px; align-items: center; }
969
975
  .screen-type { width: 110px; padding: 2px 6px; font-size: 16px; } /* 16px: iOS zooms the page for less */
970
976
  .screen-login label { display: block; margin: 8px 0; }
@@ -1810,3 +1816,7 @@ table.eval-items tr.eval-na td { color: var(--muted); }
1810
1816
  }
1811
1817
  .os-local td:first-child { white-space: normal; overflow-wrap: anywhere; }
1812
1818
  .os-local-no code { opacity: 0.6; }
1819
+ .screen-note { border-left: 3px solid var(--warn, #d9a441); padding: 2px 10px; margin: 10px 0; }
1820
+ .screen-note code { display: block; overflow-wrap: anywhere; user-select: all; }
1821
+ .screen-login .screen-show input { display: inline; width: auto; margin: 0 4px 0 0; }
1822
+ .screen-combo { width: 74px; padding: 2px 4px; font-size: 13px; background: #161a22; color: #c9d1d9; border: 1px solid #30363d; border-radius: 6px; }
package/public/topnav.js CHANGED
@@ -59,6 +59,8 @@ export function initTopNav({ $ }) {
59
59
  e.stopPropagation();
60
60
  menu.hidden = !menu.hidden;
61
61
  btn.setAttribute('aria-expanded', String(!menu.hidden));
62
+ // On a phone the menu is longer than the screen: it ends at the bottom and scrolls.
63
+ if (!menu.hidden) menu.style.maxHeight = `${Math.max(120, (window.visualViewport?.height ?? innerHeight) - menu.getBoundingClientRect().top - 8)}px`;
62
64
  });
63
65
  // A button in the menu does its own thing (its handler is unchanged); then the menu closes.
64
66
  menu.addEventListener('click', () => setTimeout(close));
package/src/screen.js CHANGED
@@ -7,7 +7,10 @@
7
7
  // Whoever uses it controls the whole computer, so it is off until turned on, and only from the
8
8
  // computer itself.
9
9
  import net from 'node:net';
10
+ import fs from 'node:fs';
11
+ import os from 'node:os';
10
12
  import crypto from 'node:crypto';
13
+ import { execFile } from 'node:child_process';
11
14
 
12
15
  export const SCREEN_DEFAULTS = { enabled: false, port: 5900 };
13
16
  const HOST = '127.0.0.1'; // never another computer: this is not a way into the network
@@ -36,9 +39,26 @@ export function listening(port, ms = 800) {
36
39
  });
37
40
  }
38
41
 
42
+ const out = (cmd, args) => new Promise((resolve) => execFile(cmd, args, { timeout: 3000 }, (err, stdout) => resolve(err ? null : String(stdout).trim())));
43
+ const KICKSTART = '/System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart';
44
+
45
+ /**
46
+ * A Mac with Remote Management on (instead of plain Screen Sharing) lets in only the users listed
47
+ * there, and refuses everyone else as if the password were wrong. Whether this computer's user is
48
+ * let in: `{ user, allowed, fix }`, or null where that does not apply.
49
+ */
50
+ export async function macAccess() {
51
+ if (process.platform !== 'darwin' || !fs.existsSync('/Library/Application Support/Apple/Remote Desktop/RemoteManagement.launchd')) return null;
52
+ const user = os.userInfo().username;
53
+ const everyone = (await out('/usr/bin/defaults', ['read', '/Library/Preferences/com.apple.RemoteManagement', 'ARD_AllLocalUsers'])) === '1';
54
+ const listed = /naprivs:\s*-?\d/.test((await out('/usr/bin/dscl', ['.', '-read', `/Users/${user}`, 'naprivs'])) ?? '');
55
+ return { user, allowed: everyone || listed, fix: `sudo ${KICKSTART} -configure -users ${user} -access -on -privs -ControlObserve` };
56
+ }
57
+
39
58
  export class Screen {
40
- /** `onChange(viewers)` is called when someone connects or leaves. */
41
- constructor({ config, onChange = () => {}, log = () => {} }) {
59
+ /** `onChange(viewers)` is called when someone connects or leaves. `mac` stands in for macAccess in tests. */
60
+ constructor({ config, onChange = () => {}, log = () => {}, mac = macAccess }) {
61
+ this.mac = mac;
42
62
  this.config = config;
43
63
  this.onChange = onChange;
44
64
  this.log = log;
@@ -55,7 +75,8 @@ export class Screen {
55
75
 
56
76
  async status() {
57
77
  const s = this.settings;
58
- return { ...s, platform: process.platform, listening: await listening(s.port), viewers: this.viewers() };
78
+ const [on, mac] = await Promise.all([listening(s.port), s.enabled ? this.mac() : null]);
79
+ return { ...s, platform: process.platform, listening: on, mac, viewers: this.viewers() };
59
80
  }
60
81
 
61
82
  /** From the computer itself only (the route is local-only). Turning it off ends every viewer. */