sideby 0.16.1 → 0.18.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 (128) hide show
  1. package/README.md +7 -3
  2. package/ai-tasks.json +90 -0
  3. package/dist/build.json +1 -1
  4. package/dist/src/cli/commands.d.ts +25 -1
  5. package/dist/src/cli/commands.js +802 -15
  6. package/dist/src/cli/json-schemas.js +252 -1
  7. package/dist/src/cli/main.js +143 -4
  8. package/dist/src/core/after-install.d.ts +54 -0
  9. package/dist/src/core/after-install.js +78 -0
  10. package/dist/src/core/ask.d.ts +222 -0
  11. package/dist/src/core/ask.js +465 -0
  12. package/dist/src/core/attachments.d.ts +50 -0
  13. package/dist/src/core/attachments.js +442 -0
  14. package/dist/src/core/autostart.d.ts +118 -0
  15. package/dist/src/core/autostart.js +302 -0
  16. package/dist/src/core/brand-mark.d.ts +49 -11
  17. package/dist/src/core/brand-mark.js +116 -38
  18. package/dist/src/core/config.d.ts +102 -0
  19. package/dist/src/core/config.js +289 -11
  20. package/dist/src/core/desktop-app.d.ts +1 -1
  21. package/dist/src/core/desktop-app.js +2 -2
  22. package/dist/src/core/edit-settings.d.ts +24 -0
  23. package/dist/src/core/edit-settings.js +97 -0
  24. package/dist/src/core/handoff-brief.d.ts +4 -2
  25. package/dist/src/core/handoff-brief.js +6 -1
  26. package/dist/src/core/handoff-chain.d.ts +24 -0
  27. package/dist/src/core/handoff-chain.js +2 -0
  28. package/dist/src/core/handoff-run.d.ts +4 -3
  29. package/dist/src/core/handoff-run.js +14 -9
  30. package/dist/src/core/launch.d.ts +17 -4
  31. package/dist/src/core/launch.js +32 -24
  32. package/dist/src/core/local-build.d.ts +17 -5
  33. package/dist/src/core/local-build.js +61 -23
  34. package/dist/src/core/lock.d.ts +30 -0
  35. package/dist/src/core/lock.js +143 -0
  36. package/dist/src/core/probe.d.ts +78 -0
  37. package/dist/src/core/probe.js +127 -0
  38. package/dist/src/core/quota-levels.d.ts +6 -1
  39. package/dist/src/core/quota-levels.js +16 -5
  40. package/dist/src/core/same-login.d.ts +9 -4
  41. package/dist/src/core/same-login.js +9 -4
  42. package/dist/src/core/secret-file.d.ts +26 -0
  43. package/dist/src/core/secret-file.js +126 -7
  44. package/dist/src/core/task-spec.d.ts +95 -0
  45. package/dist/src/core/task-spec.js +209 -0
  46. package/dist/src/core/terminal.d.ts +93 -0
  47. package/dist/src/core/terminal.js +376 -0
  48. package/dist/src/core/update.d.ts +34 -12
  49. package/dist/src/core/update.js +96 -84
  50. package/dist/src/desktop/icon.js +12 -15
  51. package/dist/src/families/claude/ai-task.d.ts +8 -0
  52. package/dist/src/families/claude/ai-task.js +38 -0
  53. package/dist/src/families/claude/handoff-hook.js +4 -4
  54. package/dist/src/families/claude/index.js +6 -0
  55. package/dist/src/families/claude/quota-cache.d.ts +24 -7
  56. package/dist/src/families/claude/quota-cache.js +72 -21
  57. package/dist/src/families/codex/handoff-hook.js +4 -4
  58. package/dist/src/families/codex/index.js +16 -0
  59. package/dist/src/families/codex/login-key.d.ts +8 -0
  60. package/dist/src/families/codex/login-key.js +33 -0
  61. package/dist/src/families/grok/handoff-hook.js +4 -4
  62. package/dist/src/families/grok/index.js +4 -0
  63. package/dist/src/families/login-keys.d.ts +6 -0
  64. package/dist/src/families/login-keys.js +6 -0
  65. package/dist/src/families/pi/index.js +5 -0
  66. package/dist/src/handoff/hook.js +51 -30
  67. package/dist/src/handoff/levels.d.ts +24 -0
  68. package/dist/src/handoff/levels.js +70 -0
  69. package/dist/src/handoff/messages.d.ts +6 -3
  70. package/dist/src/handoff/messages.js +20 -7
  71. package/dist/src/handoff/reader.d.ts +6 -3
  72. package/dist/src/menubar/agent.d.ts +3 -0
  73. package/dist/src/menubar/agent.js +21 -0
  74. package/dist/src/menubar/script.d.ts +8 -0
  75. package/dist/src/menubar/script.js +457 -0
  76. package/dist/src/menubar/snapshot.d.ts +115 -0
  77. package/dist/src/menubar/snapshot.js +255 -0
  78. package/dist/src/menubar/strings.d.ts +87 -0
  79. package/dist/src/menubar/strings.js +88 -0
  80. package/dist/src/panel/background.js +15 -21
  81. package/dist/src/panel/handler.d.ts +41 -2
  82. package/dist/src/panel/handler.js +394 -10
  83. package/dist/src/panel/i18n.d.ts +205 -2
  84. package/dist/src/panel/i18n.js +441 -35
  85. package/dist/src/panel/page-logic.d.ts +301 -0
  86. package/dist/src/panel/page-logic.js +532 -0
  87. package/dist/src/panel/page-script.js +1135 -185
  88. package/dist/src/panel/page-styles.js +111 -32
  89. package/dist/src/panel/page.d.ts +12 -0
  90. package/dist/src/panel/page.js +7 -0
  91. package/dist/src/panel/server.d.ts +16 -2
  92. package/dist/src/panel/server.js +41 -13
  93. package/dist/src/plugins/check.d.ts +47 -0
  94. package/dist/src/plugins/check.js +544 -0
  95. package/dist/src/plugins/scaffold.d.ts +21 -0
  96. package/dist/src/plugins/scaffold.js +123 -0
  97. package/dist/src/quota/statusline-tap.js +1 -1
  98. package/dist/src/runtime.d.ts +19 -1
  99. package/dist/src/runtime.js +53 -14
  100. package/dist/src/types.d.ts +33 -0
  101. package/package.json +4 -3
  102. package/schemas/ask-choices.json +168 -0
  103. package/schemas/ask-print.json +87 -0
  104. package/schemas/ask.json +180 -0
  105. package/schemas/autostart.json +165 -0
  106. package/schemas/config-get.json +132 -0
  107. package/schemas/config-set.json +107 -0
  108. package/schemas/config.json +90 -7
  109. package/schemas/edit.json +119 -0
  110. package/schemas/error.json +4 -0
  111. package/schemas/families.json +4 -0
  112. package/schemas/key.json +93 -0
  113. package/schemas/list.json +4 -0
  114. package/schemas/local.json +1 -1
  115. package/schemas/menubar-snapshot.json +646 -0
  116. package/schemas/menubar-start.json +112 -0
  117. package/schemas/menubar.json +165 -0
  118. package/schemas/plugins-check.json +113 -0
  119. package/schemas/plugins-new.json +87 -0
  120. package/schemas/terminal.json +152 -0
  121. package/schemas/try.json +109 -0
  122. package/schemas/update.json +4 -0
  123. package/skills/sideby/SKILL.md +16 -6
  124. package/skills/sideby/references/accounts.md +1 -1
  125. package/skills/sideby/references/ai-tasks.md +126 -0
  126. package/skills/sideby/references/handoff.md +3 -1
  127. package/skills/sideby/references/panel.md +20 -0
  128. package/skills/sideby/references/update.md +1 -1
@@ -125,7 +125,7 @@ code, .mono { font-family: var(--mono); font-size: 0.92em; }
125
125
 
126
126
  /* Toolbar */
127
127
  .toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
128
- .search { position: relative; flex: 1 1 240px; min-width: 0; display: block; }
128
+ .search { position: relative; flex: 1 1 160px; min-width: 120px; display: block; }
129
129
  .search-ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
130
130
  .search .search-input { padding-left: 34px; padding-right: 34px; height: var(--ctl-h); }
131
131
  .kbd { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); font: 11px/16px var(--mono); color: var(--faint); border: 1px solid var(--border); border-radius: 4px; padding: 0 5px; pointer-events: none; }
@@ -197,7 +197,8 @@ code, .mono { font-family: var(--mono); font-size: 0.92em; }
197
197
  .next-why { margin: 0 0 10px; max-width: 280px; line-height: 1.5; }
198
198
  .next-cmd { display: block; margin-top: 8px; color: var(--muted); font-size: 11px; }
199
199
  /* A Same Login (spec §3.21, ADR-0026): one row; opened, a short line per directory. */
200
- .tag-login { font-weight: 400; }
200
+ .login-mark { display: inline-flex; flex: none; color: var(--muted); cursor: help; }
201
+ .login-mark .ic { width: 13px; height: 13px; }
201
202
  .login-detail { flex-direction: column; gap: 8px; }
202
203
  .login-detail .rd-note { margin: 0; }
203
204
  /* The directories share one set of columns (subgrid), so a wider cell in one line moves every line alike. */
@@ -220,9 +221,9 @@ code, .mono { font-family: var(--mono); font-size: 0.92em; }
220
221
  .arrange-tools { display: inline-flex; align-items: center; gap: 2px; }
221
222
  .arrange-tools .icon-btn { width: 28px; height: 28px; }
222
223
  .arrange-tools .icon-btn .ic { width: 14px; height: 14px; }
223
- .pin-btn { color: var(--faint); }
224
- .pin-btn[aria-pressed="true"] { color: var(--accent); }
225
- .pin-btn[aria-pressed="true"] .ic { fill: currentColor; }
224
+ /* One width for "Pin to top" and "Unpin", so the arrows line up down the list. */
225
+ .arrange-tools .pin-btn { min-width: 96px; margin-left: 6px; justify-content: center; }
226
+ .pin-btn[aria-disabled="true"] { color: var(--faint); cursor: not-allowed; }
226
227
  .drag-handle { width: 20px; height: 28px; color: var(--muted); cursor: grab; }
227
228
  .drag-handle:hover { color: var(--accent); }
228
229
  .drag-handle .ic { width: 14px; height: 14px; }
@@ -235,6 +236,7 @@ code, .mono { font-family: var(--mono); font-size: 0.92em; }
235
236
  /* The arrow at a row's start opens and closes its details; so does a click anywhere else in the row. */
236
237
  .row-toggle { width: 28px; height: 28px; margin: -4px -6px -4px -8px; }
237
238
  .fold-hit { cursor: pointer; }
239
+ .fold-hit .row-detail { cursor: auto; }
238
240
  .fold-hit:hover .row-toggle { background: var(--hover); color: var(--text); }
239
241
  .row-toggle[aria-expanded=true] .chev { transform: rotate(90deg); }
240
242
  .row-toggle[aria-expanded=true]:not(:hover) { background: transparent; color: var(--muted); }
@@ -251,9 +253,12 @@ code, .mono { font-family: var(--mono); font-size: 0.92em; }
251
253
  .col-head > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
252
254
  .col-head .quota > span { overflow: hidden; text-overflow: ellipsis; }
253
255
  .ident { grid-area: id; display: flex; align-items: center; gap: 10px; min-width: 0; }
254
- .ident-text { min-width: 0; flex: 1; }
256
+ .ident-text { min-width: 0; flex: 1; position: relative; padding-left: 18px; }
257
+ /* The pin sits in the text column's own gutter, so the name and the email below it start at the same place. */
258
+ .ident-text .pin-slot, .ident-text .pin-mark { position: absolute; left: 0; top: 2px; margin: 0; }
255
259
  .ident-name { display: flex; align-items: center; gap: 6px; min-width: 0; flex-wrap: wrap; row-gap: 3px; }
256
260
  .ident-name .name { font-weight: var(--strong-weight); font-size: var(--font-size); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
261
+ .ident-name .alias { color: var(--muted); font-family: var(--mono); font-size: 12px; white-space: nowrap; }
257
262
  .ident-email { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
258
263
  .email-btn, .model-btn { all: unset; cursor: pointer; border-radius: 4px; }
259
264
  .model-btn:hover { color: var(--text); text-decoration: underline dotted; }
@@ -263,11 +268,12 @@ code, .mono { font-family: var(--mono); font-size: 0.92em; }
263
268
  .br-list { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
264
269
  .br-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--ctl-radius); }
265
270
  .email-btn:hover { color: var(--text); text-decoration: underline dotted; }
271
+ /* A button is laid out as one box, so the parent's ellipsis does not reach its text: it ends its own. */
272
+ .ident-email .email-btn { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
266
273
  .email-btn:focus-visible { outline: var(--focus-outline); outline-offset: 2px; }
267
- .ident-email:has(.br-btn) { display: flex; align-items: center; }
268
- .ident-email:has(.br-btn) > * { flex: none; }
269
- .ident-email:has(.br-btn) > .email-btn:not(.br-btn) { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
270
- .br-btn { display: inline-flex; align-items: center; gap: 3px; vertical-align: bottom; }
274
+ .br-btn { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 12px; max-width: 100%; }
275
+ .br-btn:hover { color: var(--text); text-decoration: underline dotted; }
276
+ .card > .rd-browser { flex-direction: row; align-items: center; gap: 8px; }
271
277
  .br-ico { width: 12px; height: 12px; flex: none; }
272
278
  .ident-email + .ident-sub { color: var(--faint); margin-top: 0; }
273
279
  .tools .tb-icon { width: var(--ctl-h); height: var(--ctl-h); border-color: var(--border-strong); background: var(--surface); }
@@ -281,31 +287,37 @@ code, .mono { font-family: var(--mono); font-size: 0.92em; }
281
287
  .plan { text-transform: capitalize; }
282
288
  .row > .quota { grid-area: quota; }
283
289
  .row > .last { grid-area: last; }
290
+ .ident-meta { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
291
+ .ident-meta > :first-child { min-width: 0; }
292
+ .last-inline { display: none; }
284
293
  .row > .row-end { grid-area: more; display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
285
- /* The row's pin (spec §3.25): filled and always there on a pinned row; on the others it shows on hover or focus. */
286
294
  .row-run { width: 28px; height: 28px; color: var(--muted); }
287
295
  .row-run .ic { width: 15px; height: 15px; }
288
296
  .row-run:hover { color: var(--accent); }
289
- .row-pin { width: 28px; height: 28px; color: var(--faint); opacity: 0; transition: opacity .12s, color .12s; }
290
- .row-pin .ic { width: 15px; height: 15px; }
291
- .row:hover .row-pin, .card:hover .row-pin, .row-pin:focus-visible, .row-pin.is-on { opacity: 1; }
292
297
  .card-head > .row-end { display: flex; align-items: center; gap: 2px; margin-left: auto; }
293
- .row-pin:hover { color: var(--accent); }
294
- .row-pin.is-on { color: var(--accent); }
295
- .row-pin.is-on .ic { fill: currentColor; }
296
- .row-pin[aria-disabled="true"] { cursor: not-allowed; }
297
- @media (hover: none) { .row-pin { opacity: .6; } }
298
+ /* A pinned row's mark (spec §3.25, §3.27): a small muted outline pin right before the name, not a button. */
299
+ .pin-mark { display: inline-flex; flex: none; margin-right: -2px; color: var(--faint); }
300
+ .pin-mark .ic { width: 12px; height: 12px; }
301
+ /* The pin before the name (spec §3.27): always there when pinned; a fainter one on hover or focus in the row
302
+ otherwise. The slot keeps its width either way, so the name never moves. */
303
+ .pin-slot { display: inline-grid; place-items: center; flex: none; width: 16px; height: 16px; margin: 0 -4px 0 -2px; padding: 0; border: 0; border-radius: 4px; background: none; color: var(--faint); cursor: pointer; opacity: 0; }
304
+ .pin-slot .ic { width: 12px; height: 12px; }
305
+ .pin-slot.is-on { opacity: 1; }
306
+ .row:hover .pin-slot:not(.is-on), .row:focus-within .pin-slot:not(.is-on), .card:hover .pin-slot:not(.is-on), .card:focus-within .pin-slot:not(.is-on) { opacity: .5; }
307
+ .pin-slot:hover, .pin-slot:focus-visible { opacity: 1 !important; color: var(--accent); background: var(--hover); outline: none; }
308
+ .ctx-anchor { position: fixed; width: 0; height: 0; pointer-events: none; }
298
309
  .row-notes { grid-area: notes; display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
299
310
 
300
311
  /* Quota meters: percent and countdown over a bar colored by level (ok, warn at 60%, fail at 85% used). */
301
- .quota { display: grid; grid-template-columns: repeat(var(--qn), minmax(0, 1fr)); column-gap: var(--col-gap); row-gap: 4px; min-width: 0; }
312
+ .quota { display: grid; grid-template-columns: repeat(var(--qr, var(--qn)), minmax(0, 1fr)); column-gap: var(--col-gap); row-gap: 4px; min-width: 0; }
302
313
  .row > .quota { grid-template-columns: repeat(var(--qn), var(--q-w)); }
303
314
  .meter { min-width: 0; }
304
- .m-top { display: flex; align-items: baseline; gap: 6px; font-size: 12px; line-height: 1.35; white-space: nowrap; min-width: 0; }
315
+ /* The countdown never ends in an ellipsis: where the line is too short it wraps to a line of its own, at the right. */
316
+ .m-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; font-size: 12px; line-height: 1.35; white-space: nowrap; min-width: 0; }
305
317
  .m-label { color: var(--muted); font-weight: var(--strong-weight); }
306
318
  .m-pct { font-weight: var(--strong-weight); font-size: 13px; font-variant-numeric: tabular-nums; }
307
319
  .m-unit { color: var(--faint); font-weight: 400; font-size: 11.5px; }
308
- .m-reset { margin-left: auto; color: var(--faint); font-size: 11.5px; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; }
320
+ .m-reset { margin-left: auto; color: var(--faint); font-size: 11.5px; font-variant-numeric: tabular-nums; }
309
321
  .m-passed { color: var(--muted); }
310
322
  .m-none { color: var(--faint); }
311
323
  .bar { height: 6px; border-radius: 999px; background: var(--track); overflow: hidden; margin-top: 5px; }
@@ -521,6 +533,31 @@ input[type=text]:hover:not(:disabled), input[type=number]:hover:not(:disabled),
521
533
  input[type=text]:focus, input[type=search]:focus, select:focus { border-color: var(--focus); }
522
534
  input[type=text]:disabled, select:disabled { background-color: var(--surface-2); color: var(--faint); cursor: not-allowed; }
523
535
  input.invalid { border-color: var(--fail); }
536
+ /* AI Tasks (spec §3.28): the text box, the key field, the example chips and the account and terminal pickers. */
537
+ input[type=password] { height: var(--field-h); border-radius: var(--ctl-radius); border: 1px solid var(--border-strong); background-color: var(--surface); color: var(--text); font: inherit; padding: 0 12px; width: 100%; }
538
+ textarea.ask-text { min-height: 64px; resize: vertical; border-radius: var(--ctl-radius); border: 1px solid var(--border-strong); background-color: var(--surface); color: var(--text); font: inherit; padding: 8px 12px; width: 100%; line-height: 1.45; }
539
+ input[type=password]:focus, textarea.ask-text:focus { border-color: var(--focus); }
540
+ textarea.ask-text:focus-visible, input[type=password]:focus-visible { outline: var(--focus-outline); outline-offset: 2px; box-shadow: var(--focus-ring); }
541
+ textarea::placeholder { color: var(--faint); }
542
+ .ask-chips { display: flex; flex-wrap: wrap; gap: 6px; }
543
+ .ask-chips .chip { font: inherit; font-size: var(--small); text-align: left; white-space: normal; }
544
+ .ask-attach-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
545
+ .ask-files-wrap { display: grid; gap: 6px; }
546
+ .ask-files-wrap:empty { display: none; }
547
+ .ask-files { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
548
+ .ask-file { position: relative; display: grid; gap: 2px; width: 104px; padding: 4px; border: 1px solid var(--border); border-radius: var(--ctl-radius); background: var(--surface); }
549
+ .ask-file.is-error { border-color: var(--fail); }
550
+ .ask-file-img, .ask-file-face { width: 94px; height: 64px; border-radius: calc(var(--ctl-radius) - 2px); }
551
+ .ask-file-img { object-fit: cover; display: block; }
552
+ .ask-file-face { display: grid; place-items: center; align-content: center; gap: 2px; background: var(--surface-2); color: var(--muted); }
553
+ .ask-file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
554
+ .ask-file-x { position: absolute; top: 2px; right: 2px; width: 22px; height: 22px; background: var(--surface); }
555
+ .dialog.drop-on { outline: 2px dashed var(--focus); outline-offset: -6px; }
556
+ .ask-pick {display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
557
+ .ask-setup .link-btn { display: inline-flex; align-items: center; gap: 6px; }
558
+ .ask-setup .ic { width: 14px; height: 14px; }
559
+ .fam-other { background: transparent; color: inherit; font: inherit; text-align: left; border-style: dashed; }
560
+ .q-ask { margin-left: 6px; }
524
561
  /* The select draws its own chevron with two gradient strokes (the CSP allows no external images), so it follows the
525
562
  text color in both schemes and on hover. */
526
563
  select { --chevron: var(--muted); appearance: none; padding-right: 32px; cursor: pointer; text-overflow: ellipsis;
@@ -581,7 +618,7 @@ select:is(:hover, :focus) { --chevron: var(--text); }
581
618
  .dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
582
619
 
583
620
  /* Menu, tooltips, toasts */
584
- .menu { position: fixed; z-index: 40; min-width: 230px; max-width: min(380px, calc(100vw - 16px)); padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: calc(var(--ctl-radius) + 2px); box-shadow: var(--float-shadow); }
621
+ .menu { position: fixed; z-index: 40; min-width: 230px; max-width: min(380px, calc(100vw - 16px)); padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: calc(var(--ctl-radius) + 2px); box-shadow: var(--float-shadow); overflow-y: auto; overscroll-behavior: contain; }
585
622
  .menu-item { display: flex; align-items: center; gap: 10px; width: 100%; height: 32px; padding: 0 10px; border: 0; border-radius: calc(var(--ctl-radius) - 2px); background: none; color: var(--text); font: inherit; font-size: var(--control-size); text-align: left; cursor: pointer; }
586
623
  .menu-item .ic { flex: none; color: var(--muted); }
587
624
  .menu-item:hover:not(:disabled), .menu-item:focus-visible { background: var(--hover); outline: none; }
@@ -604,6 +641,24 @@ select:is(:hover, :focus) { --chevron: var(--text); }
604
641
  .set-hint { color: var(--faint); font-size: 12px; max-width: 260px; }
605
642
  .set-link { margin: 0 -8px; width: calc(100% + 16px); }
606
643
  .set-link .chip { margin-left: auto; }
644
+ /* Groups in the settings (spec §3.29): a small muted title, then its rows; a line between groups. */
645
+ .pop-settings { width: 340px; }
646
+ .set-group { display: flex; flex-direction: column; gap: 8px; }
647
+ .set-check .set-label { white-space: normal; }
648
+ .set-link .menu-label { flex: 1 1 auto; min-width: 0; white-space: normal; line-height: 1.3; }
649
+ .set-link { height: auto; min-height: 32px; padding-top: 6px; padding-bottom: 6px; }
650
+ .set-link .chip { flex: none; }
651
+ .set-group-title { color: var(--faint); font-size: 11px; font-weight: var(--strong-weight); letter-spacing: .02em; }
652
+ .popover .set-sep { margin: 0 -14px; }
653
+ .set-hint .link-btn { font-size: 12px; }
654
+ /* "More settings…" stays at the bottom of a popover that scrolls. */
655
+ .set-more { position: sticky; bottom: -12px; margin: 0 -14px -12px; width: calc(100% + 28px); height: 40px; padding: 0 16px 0 17px; border-top: 1px solid var(--border); border-radius: 0; background: var(--surface); }
656
+ .set-more:hover { background: var(--hover); }
657
+ .set-more .ic { margin-left: auto; }
658
+ .set-dialog { display: flex; flex-direction: column; gap: 12px; }
659
+ .set-dialog .set-hint { max-width: none; }
660
+ .set-dialog .set-link { margin: 0 -10px; width: calc(100% + 20px); }
661
+ .as-code { display: block; margin: -4px 0 4px; padding: 8px 10px; border-radius: var(--ctl-radius); background: var(--hover); font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; }
607
662
  .set-dot { background: var(--warn-bar); }
608
663
  .tip { display: inline-flex; position: relative; vertical-align: middle; }
609
664
  .tip-btn { display: inline-grid; place-items: center; width: 16px; height: 16px; padding: 0; border: 1px solid var(--border-strong); border-radius: 50%; background: var(--surface); color: var(--muted); font: 700 10px/1 var(--font); cursor: help; }
@@ -654,25 +709,36 @@ select:is(:hover, :focus) { --chevron: var(--text); }
654
709
  .checkup { margin-top: 8px; }
655
710
  .foot { margin-top: 28px; text-align: center; }
656
711
 
657
- @media (max-width: 1100px) {
712
+ /* The narrow-screen layouts hang on the root's data-width (page-logic.ts widthTier: up to 1100px medium, 760 narrow,
713
+ 560 phone) rather than on media queries, so the page script can change them once a sliding width settles, inside a
714
+ View Transition. :where() keeps each rule's specificity what it was inside a media query. */
715
+ :where(:root[data-width=medium], :root[data-width=narrow], :root[data-width=phone]) {
658
716
  .col-head { display: none; }
659
717
  .app-row { flex-wrap: wrap; }
660
718
  .app-actions { width: 100%; justify-content: flex-start; }
661
- .row { grid-template-columns: minmax(0, 1fr) auto var(--m-w); grid-template-areas: "id last more" "quota quota quota" "detail detail detail" "notes notes notes"; row-gap: 10px; }
719
+ /* No column titles here, so the last use sits right after the name and email, on the email's line, and the
720
+ menu stays on the name's line; the quota windows share the full width below. */
721
+ .row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "id more" "quota quota" "detail detail" "notes notes"; row-gap: 8px; }
662
722
  .row-detail { margin-left: 0; }
663
723
 
664
- .row > .quota { grid-template-columns: repeat(var(--qn), minmax(0, 1fr)); max-width: 560px; }
724
+ .row > .quota { grid-template-columns: repeat(var(--qr, var(--qn)), minmax(0, 1fr)); }
665
725
  .rows .m-label, .rows .m-unit, .rows .u-unit { display: inline; }
666
726
  .rows .usage { justify-content: flex-start; }
667
- .row > .last { justify-self: end; }
727
+ .row > .last { display: none; }
728
+ .last-inline { display: flex; flex: none; gap: 6px; color: var(--muted); font-size: 12px; white-space: nowrap; margin-top: 1px; }
729
+ .last-inline::before { content: "·"; color: var(--faint); }
730
+ .row > .row-end { align-self: start; margin-top: -2px; }
668
731
  }
669
- @media (max-width: 760px) {
732
+ :where(:root[data-width=narrow], :root[data-width=phone]) {
733
+ /* The toolbar stays one line: "New account" keeps its icon, its name moves to the tooltip and the label. */
734
+ .toolbar > .btn-primary { width: var(--ctl-h); padding: 0; justify-content: center; }
735
+ .toolbar > .btn-primary > span { display: none; }
670
736
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
671
737
  .stat:nth-child(3) { border-left: 0; }
672
738
  .stat:nth-child(n+3) { border-top: 1px solid var(--border); }
673
739
  }
674
- @media (max-width: 560px) {
675
- :root { --gutter: 14px; }
740
+ :root[data-width=phone] { --gutter: 14px; }
741
+ :where(:root[data-width=phone]) {
676
742
  .top-in { padding: 16px var(--gutter) 0; }
677
743
  .header-bar .top-in { min-height: 0; padding: 12px var(--gutter); }
678
744
  .update-btn span { display: none; }
@@ -689,8 +755,13 @@ select:is(:hover, :focus) { --chevron: var(--text); }
689
755
  .search { flex-basis: 100%; }
690
756
  .tools { width: 100%; }
691
757
  .tools .tb-select { flex: 1 1 140px; min-width: 0; }
692
- .toolbar > .btn-primary { flex: 1; }
693
- .row { padding: 10px 12px; }
758
+ .toolbar > .btn-primary { flex: 1; width: auto; padding: 0 14px; }
759
+ .toolbar > .btn-primary > span { display: inline; }
760
+ /* A phone keeps the last use as a column of its own: the line under the name has no room for it. */
761
+ .row { padding: 10px 12px; grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "id last more" "quota quota quota" "detail detail detail" "notes notes notes"; }
762
+ .row > .last { display: block; justify-self: end; }
763
+ .last-inline { display: none; }
764
+ .row > .row-end { align-self: center; margin-top: 0; }
694
765
  #accounts { --col-gap: 14px; }
695
766
  /* One window per line, so the reset time is never cut off. */
696
767
  .row > .quota { grid-template-columns: 1fr; row-gap: 10px; max-width: none; }
@@ -706,6 +777,14 @@ select:is(:hover, :focus) { --chevron: var(--text); }
706
777
  .panel { padding: 14px; }
707
778
  .dlg-head { padding: 14px 14px 2px; } .dlg-body { padding: 10px 14px 14px; } .dlg-foot { padding: 10px 14px; }
708
779
  }
780
+ /* A change of layout band runs as a short View Transition (page-script.ts followWidth): each block below moves and
781
+ resizes to its new place while its old and new look cross-fade; the rest of the page cross-fades as one. Same
782
+ length and ease as a Portal's sliding sidebar (.26s, quick start, soft landing), so both read as one move. */
783
+ ::view-transition-group(*) { animation-duration: .26s; animation-timing-function: cubic-bezier(.32, .72, 0, 1); }
784
+ /* Old and new looks keep their own size (pinned top left) instead of stretching to the moving box, so text never
785
+ grows or shrinks on the way. */
786
+ ::view-transition-old(*), ::view-transition-new(*) { animation-duration: .26s; height: 100%; object-fit: none; object-position: left top; }
787
+ .vt-width :is(.top-in, .summary, .stat, .section-head, .toolbar, .group-list, .group-head, .row) { view-transition-name: match-element; }
709
788
  @media (prefers-reduced-motion: reduce) {
710
789
  .sk, .spin, .is-spinning svg, .toast, .toast.bump, .view-in > *, .row.flash, .card.flash, .pulse { animation: none; }
711
790
  .bar > span, .chev, .row { transition: none; }
@@ -21,6 +21,18 @@ export interface PageOptions {
21
21
  lang?: 'auto' | 'en' | 'zh';
22
22
  /** createPanelHandler's `updates`: false hides everything about sideby updates. */
23
23
  updates?: boolean;
24
+ /**
25
+ * createPanelHandler's `ask`: with the bridge, inside a frame, AI Task entries post to the Portal and the page script
26
+ * hides the header button; opened on its own, the Panel keeps both.
27
+ */
28
+ ask?: {
29
+ bridge: 'postMessage';
30
+ };
31
+ /** Config `panel` (spec §3.29): the theme and language saved for the Panel. */
32
+ panel?: {
33
+ theme?: string;
34
+ language?: string;
35
+ };
24
36
  }
25
37
  /** JSON that is safe inside a `<script>` element: no `</script>`, `<!--` or line separators survive. */
26
38
  export declare function jsonForScript(value: unknown): string;
@@ -7,6 +7,7 @@ import { ALIAS_NAME, RESERVED_ALIASES } from '../core/config.js';
7
7
  import { QUOTA_FAIL_PERCENT, QUOTA_WARN_PERCENT, USAGE_DAYS } from '../core/quota-levels.js';
8
8
  import { SKILL_INSTALL } from '../core/skill-check.js';
9
9
  import { MESSAGES } from './i18n.js';
10
+ import { widthTier } from './page-logic.js';
10
11
  import { PAGE_SCRIPT } from './page-script.js';
11
12
  import { pageStyles } from './page-styles.js';
12
13
  import { resolveTheme } from './theme.js';
@@ -25,6 +26,8 @@ export function jsonForScript(value) {
25
26
  function attr(value) {
26
27
  return value.replace(/&/g, '&amp;').replace(/"/g, '&quot;').replace(/</g, '&lt;');
27
28
  }
29
+ // The layout band (page-logic.ts widthTier) is set in the head, so the first paint already has the narrow-screen
30
+ // layout; the page script then follows the width as it changes.
28
31
  const SKELETON_ROW = `<div class="sk-row"><span class="sk sk-badge"></span><span class="sk sk-title"></span><span class="sk sk-bar"></span><span class="sk sk-bar"></span></div>`;
29
32
  const SKELETON_STAT = `<div class="stat"><span class="sk sk-stat w70"></span></div>`;
30
33
  export function renderPage(opts) {
@@ -40,8 +43,10 @@ export function renderPage(opts) {
40
43
  local: opts.local ?? null,
41
44
  readOnly: Boolean(opts.readOnly),
42
45
  updates: opts.updates !== false,
46
+ ask: opts.ask ?? null,
43
47
  colorScheme: theme.colorScheme,
44
48
  lang,
49
+ panel: opts.panel ?? {},
45
50
  warn: QUOTA_WARN_PERCENT,
46
51
  fail: QUOTA_FAIL_PERCENT,
47
52
  usageDays: USAGE_DAYS,
@@ -61,6 +66,7 @@ export function renderPage(opts) {
61
66
  <title>sideby</title>
62
67
  <link rel="icon" type="image/svg+xml" href="${attr(opts.basePath)}/favicon.svg?v=${FAVICON_VERSION}">
63
68
  <style${nonce}>${pageStyles(theme)}</style>
69
+ <script${nonce}>document.documentElement.dataset.width = (${widthTier})(window.innerWidth)</script>
64
70
  </head>
65
71
  <body${theme.header === 'bar' ? ' class="header-bar"' : ''}>
66
72
  <header class="top">
@@ -74,6 +80,7 @@ export function renderPage(opts) {
74
80
  </div>
75
81
  <div class="top-actions">
76
82
  <button id="update" class="btn update-btn" type="button" hidden></button>
83
+ <button id="ask-ai" class="btn" type="button" aria-haspopup="dialog" aria-label="Let AI do it"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M6 9h12a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-6a2 2 0 0 1 2-2zM12 5v4M9.5 13.5v1M14.5 13.5v1"/></svg><span class="hide-sm" data-i18n="ask.button">Let AI do it</span></button>
77
84
  <button id="settings" class="btn" type="button" aria-haspopup="dialog" aria-expanded="false"${lang === 'auto' ? '' : ' hidden'}><span data-i18n="set.button">Settings</span></button>
78
85
  <button id="refresh" class="btn" type="button" aria-label="Refresh"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M20 11a8 8 0 1 0-2.3 5.7"/><path d="M20 4v7h-7"/></svg><span class="hide-sm" data-i18n="top.refresh">Refresh</span></button>
79
86
  </div>
@@ -1,5 +1,12 @@
1
1
  import type { Runtime } from '../runtime.ts';
2
2
  export declare const DEFAULT_PANEL_PORT = 17420;
3
+ /**
4
+ * Whose Panel this is: a hash of the system user and HOME, so `sideby ui` reuses only its own user's Panel. Another
5
+ * user of the same Mac may run one on the same port; reusing it would show that user's accounts and start none of
6
+ * ours. A hash, so the health answer names no path. It only tells Panels apart; it is not authentication. The real
7
+ * path, so one HOME reached through a symlink gives one owner.
8
+ */
9
+ export declare function panelOwner(home?: string): string;
3
10
  export interface PanelServerOptions {
4
11
  runtimeFactory: () => Promise<Runtime>;
5
12
  port?: number;
@@ -11,6 +18,8 @@ export interface PanelServerOptions {
11
18
  * --stop` can tell this Panel from a reused pid or from another Panel before it sends a signal.
12
19
  */
13
20
  instance?: string;
21
+ /** panelOwner() of the HOME this Panel serves; defaults to this process's HOME. */
22
+ owner?: string;
14
23
  }
15
24
  export interface PanelServer {
16
25
  url: string;
@@ -22,11 +31,16 @@ export interface PanelIdentity {
22
31
  pid?: number;
23
32
  /** buildId() of the code serving it; absent from Panels older than this field. */
24
33
  build?: string;
34
+ /** panelOwner() of the user it serves; absent from Panels older than this field. */
35
+ owner?: string;
25
36
  }
26
37
  /** What the sideby Panel on this port says about itself, or undefined when none answers. */
27
38
  export declare function panelIdentity(port: number): Promise<PanelIdentity | undefined>;
28
- /** True when a sideby Panel answers on this port. */
29
- export declare function isSidebyPanel(port: number): Promise<boolean>;
39
+ /**
40
+ * True when a sideby Panel of this user answers on this port. One that names another owner belongs to another user
41
+ * and counts as a busy port; one too old to name an owner is taken as ours, as before.
42
+ */
43
+ export declare function isSidebyPanel(port: number, owner?: string): Promise<boolean>;
30
44
  /** Opens `url` in the default browser; returns false (and never throws) when that is not possible. */
31
45
  export declare function openBrowser(url: string): Promise<boolean>;
32
46
  export declare function startPanelServer(opts: PanelServerOptions): Promise<PanelServer>;
@@ -1,11 +1,34 @@
1
1
  // Standalone Panel server for `sideby ui`: loopback only, reuses a running Panel, shifts past busy ports.
2
2
  import { spawn } from 'node:child_process';
3
+ import { createHash } from 'node:crypto';
4
+ import { realpathSync } from 'node:fs';
3
5
  import { createServer } from 'node:http';
4
- import { buildId } from '../core/version.js';
6
+ import { homedir } from 'node:os';
7
+ import { resolve } from 'node:path';
8
+ import { buildId, packageVersion } from '../core/version.js';
5
9
  import { createPanelHandler } from './handler.js';
6
10
  export const DEFAULT_PANEL_PORT = 17420;
7
11
  const PORT_ATTEMPTS = 20;
8
12
  const LOOPBACK = '127.0.0.1';
13
+ /**
14
+ * Whose Panel this is: a hash of the system user and HOME, so `sideby ui` reuses only its own user's Panel. Another
15
+ * user of the same Mac may run one on the same port; reusing it would show that user's accounts and start none of
16
+ * ours. A hash, so the health answer names no path. It only tells Panels apart; it is not authentication. The real
17
+ * path, so one HOME reached through a symlink gives one owner.
18
+ */
19
+ export function panelOwner(home = process.env.HOME || homedir()) {
20
+ let dir = resolve(home);
21
+ try {
22
+ dir = realpathSync(dir);
23
+ }
24
+ catch {
25
+ // keep the resolved path when HOME does not exist
26
+ }
27
+ return createHash('sha256')
28
+ .update(`sideby-panel\0${process.getuid?.() ?? ''}\0${dir}`)
29
+ .digest('hex')
30
+ .slice(0, 16);
31
+ }
9
32
  function listen(server, port) {
10
33
  return new Promise((resolve, reject) => {
11
34
  const onError = (err) => {
@@ -37,15 +60,20 @@ export async function panelIdentity(port) {
37
60
  ...(typeof body.instance === 'string' ? { instance: body.instance } : {}),
38
61
  ...(Number.isInteger(body.pid) ? { pid: body.pid } : {}),
39
62
  ...(typeof body.build === 'string' ? { build: body.build } : {}),
63
+ ...(typeof body.owner === 'string' ? { owner: body.owner } : {}),
40
64
  };
41
65
  }
42
66
  catch {
43
67
  return undefined;
44
68
  }
45
69
  }
46
- /** True when a sideby Panel answers on this port. */
47
- export async function isSidebyPanel(port) {
48
- return (await panelIdentity(port)) !== undefined;
70
+ /**
71
+ * True when a sideby Panel of this user answers on this port. One that names another owner belongs to another user
72
+ * and counts as a busy port; one too old to name an owner is taken as ours, as before.
73
+ */
74
+ export async function isSidebyPanel(port, owner = panelOwner()) {
75
+ const id = await panelIdentity(port);
76
+ return id !== undefined && (id.owner === undefined || id.owner === owner);
49
77
  }
50
78
  /** Opens `url` in the default browser; returns false (and never throws) when that is not possible. */
51
79
  export function openBrowser(url) {
@@ -69,6 +97,9 @@ export function openBrowser(url) {
69
97
  export async function startPanelServer(opts) {
70
98
  const log = opts.log ?? ((s) => console.log(s));
71
99
  const first = opts.port ?? DEFAULT_PANEL_PORT;
100
+ const owner = opts.owner ?? panelOwner();
101
+ // /api/health always names app and version (ADR-0006), also when the caller did not pass one.
102
+ const version = opts.version ?? packageVersion();
72
103
  const announce = async (url, reused) => {
73
104
  log(reused ? `sideby panel is already running at ${url}` : `sideby panel: ${url}`);
74
105
  if (opts.open && !(await openBrowser(url)))
@@ -79,20 +110,17 @@ export async function startPanelServer(opts) {
79
110
  const handler = createPanelHandler({
80
111
  runtime: opts.runtimeFactory,
81
112
  allowedHosts: hosts,
82
- ...(opts.version ? { version: opts.version } : {}),
113
+ version,
83
114
  });
84
115
  const server = createServer((req, res) => {
85
- if (opts.instance &&
86
- req.method === 'GET' &&
87
- req.url === '/api/health' &&
88
- hosts.includes(req.headers.host ?? '')) {
116
+ if (req.method === 'GET' && req.url === '/api/health' && hosts.includes(req.headers.host ?? '')) {
89
117
  res.writeHead(200, { 'content-type': 'application/json; charset=utf-8', 'cache-control': 'no-store' });
90
118
  res.end(JSON.stringify({
91
119
  app: 'sideby',
92
- ...(opts.version ? { version: opts.version } : {}),
120
+ version,
93
121
  build: buildId(),
94
- instance: opts.instance,
95
- pid: process.pid,
122
+ owner,
123
+ ...(opts.instance ? { instance: opts.instance, pid: process.pid } : {}),
96
124
  }));
97
125
  return;
98
126
  }
@@ -124,7 +152,7 @@ export async function startPanelServer(opts) {
124
152
  }),
125
153
  };
126
154
  }
127
- if (await isSidebyPanel(port)) {
155
+ if (await isSidebyPanel(port, owner)) {
128
156
  await announce(url, true);
129
157
  return { url, reused: true, close: async () => { } };
130
158
  }
@@ -0,0 +1,47 @@
1
+ import type { Plugin } from '../types.ts';
2
+ export interface PluginProblem {
3
+ /** Stable machine code such as `shared-item.parent`. */
4
+ code: string;
5
+ message: string;
6
+ /** One sentence saying what to change. */
7
+ fix: string;
8
+ }
9
+ export interface PluginCheckResult {
10
+ ok: boolean;
11
+ /** The plugin's name, when its manifest or export could be read. */
12
+ plugin?: string;
13
+ /** Family ids the plugin registered. */
14
+ families: string[];
15
+ problems: PluginProblem[];
16
+ }
17
+ /**
18
+ * Checks the Family Plugin in `dir` (the folder holding `plugin.json`): manifest, trust (owner, modes), that it
19
+ * only `import type`s from sideby, and a leak scan for home paths, personal emails and token-shaped strings. When the
20
+ * loader would trust it, also its FamilyDef fields and a discover / launch / doctor round, run by {@link checkRound} in
21
+ * a child process with a throwaway HOME, killed after `timeoutMs` (20 s). An untrusted plugin is never copied,
22
+ * changed or run. Never throws for a broken plugin: every problem is in `problems`, each with a `fix`.
23
+ */
24
+ export declare function checkPlugin(opts: {
25
+ dir: string;
26
+ timeoutMs?: number;
27
+ }): Promise<PluginCheckResult>;
28
+ /**
29
+ * The child side of {@link runRound}: reads the job, runs {@link checkRound} and writes its report to fd 3, then
30
+ * exits so a timer or handle the plugin left open cannot keep it alive.
31
+ */
32
+ export declare function checkRoundMain(arg: string | undefined): Promise<void>;
33
+ /**
34
+ * `checkPlugin` for a Plugin that ships inside sideby: `dir` is its source folder, scanned for leaks. The same field
35
+ * checks and discover / launch / doctor round run; it loads as the only built-in.
36
+ */
37
+ export declare function checkBuiltinPlugin(opts: {
38
+ plugin: Plugin;
39
+ dir: string;
40
+ }): Promise<PluginCheckResult>;
41
+ /** What is missing or wrong in one FamilyDef, as written by the Plugin. */
42
+ export declare function defProblems(raw: unknown): PluginProblem[];
43
+ /**
44
+ * The plugin's sources against the rules that need no loading: value imports from sideby, TODOs left from the
45
+ * skeleton, and the leak scan. Messages give the file and line only, never the matched value.
46
+ */
47
+ export declare function scanSources(dir: string): Promise<PluginProblem[]>;