sideby 0.44.0 → 0.45.1

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 (39) hide show
  1. package/dist/build.json +1 -1
  2. package/dist/src/cli/commands.d.ts +4 -0
  3. package/dist/src/cli/commands.js +9 -8
  4. package/dist/src/cli/json-schemas.js +51 -0
  5. package/dist/src/core/ask.js +4 -3
  6. package/dist/src/core/cli-commands.js +0 -10
  7. package/dist/src/core/egress.d.ts +1 -7
  8. package/dist/src/core/egress.js +7 -36
  9. package/dist/src/core/history.d.ts +1 -1
  10. package/dist/src/core/history.js +2 -2
  11. package/dist/src/core/network.d.ts +5 -35
  12. package/dist/src/core/network.js +18 -54
  13. package/dist/src/core/task-spec.js +10 -3
  14. package/dist/src/core/themes.js +0 -7
  15. package/dist/src/core/update.d.ts +1 -1
  16. package/dist/src/core/update.js +4 -12
  17. package/dist/src/families/claude/quota-fetch.js +2 -2
  18. package/dist/src/families/claude/tuning.d.ts +0 -1
  19. package/dist/src/families/claude/tuning.js +1 -1
  20. package/dist/src/network/hook.js +1 -1
  21. package/dist/src/network/page.d.ts +1 -1
  22. package/dist/src/network/page.js +15 -181
  23. package/dist/src/panel/handler.js +57 -25
  24. package/dist/src/panel/page-logic.d.ts +11 -29
  25. package/dist/src/panel/page-logic.js +11 -33
  26. package/dist/src/panel/page-script.js +5 -34
  27. package/dist/src/panel/page-styles.js +9 -18
  28. package/dist/src/quota/claude-statusline.js +1 -1
  29. package/dist/src/runtime.d.ts +2 -1
  30. package/dist/src/runtime.js +9 -6
  31. package/dist/src/types.d.ts +2 -2
  32. package/dist/src/unattended/hook.js +0 -1
  33. package/dist/testing/index.js +1 -1
  34. package/package.json +2 -1
  35. package/schemas/network-diagnose.json +239 -0
  36. package/skills/sideby/SKILL.md +1 -1
  37. package/skills/sideby/references/network.md +5 -3
  38. package/dist/src/network/page-script.d.ts +0 -40
  39. package/dist/src/network/page-script.js +0 -270
@@ -2,6 +2,8 @@
2
2
  // browser runs exactly the code these tests cover. Each function must be self-contained: no imports, no
3
3
  // references to module scope or to each other except through parameters, and only type annotations as
4
4
  // TypeScript (they are stripped by Node and by the build, leaving plain JavaScript).
5
+ import { networkDiagnoseTaskFacts } from 'network-portal';
6
+ export { networkDiagnoseTaskFacts };
5
7
  /** A short countdown such as `2h 05m`, `3d 4h` or `12m` (`2小时05分` in Chinese); fixed shape so it does not jump. */
6
8
  export function formatDuration(ms, lang) {
7
9
  const zh = lang === 'zh';
@@ -611,10 +613,6 @@ export function panelHint(hint, fixable, action) {
611
613
  return hint;
612
614
  return hint.replace(/run `sideby doctor --fix`/g, (_m, at) => at === 0 ? action.charAt(0).toUpperCase() + action.slice(1) : action);
613
615
  }
614
- /**
615
- * Whether the Panel fixes Finding `f` with a button of its own: a sideby skill behind this version while the
616
- * Update plan says sideby may update it (`skillUpdatable`). Such Findings stay out of the prompt for an AI agent.
617
- */
618
616
  /**
619
617
  * A Local Build the Panel can leave for npm itself (ADR-0024): the global `sideby` still runs it and the Panel may
620
618
  * write. Then switching to the release is the update, offered as a button instead of the `pnpm local --off` command.
@@ -733,6 +731,10 @@ export function findingSentence(f, table, en, prefix = 'finding.') {
733
731
  });
734
732
  return missing ? '' : out;
735
733
  }
734
+ /**
735
+ * Whether the Panel fixes Finding `f` with a button of its own: a sideby skill behind this version while the
736
+ * Update plan says sideby may update it (`skillUpdatable`). Such Findings stay out of the prompt for an AI agent.
737
+ */
736
738
  export function panelFixes(f, skillUpdatable) {
737
739
  return skillUpdatable && f.code === 'skill.outdated';
738
740
  }
@@ -1319,30 +1321,6 @@ export function networkTaskFacts(n) {
1319
1321
  out.push(`${a.ref}: not checked here (${a.skip})`);
1320
1322
  return out;
1321
1323
  }
1322
- export function networkDiagnoseTaskFacts(d) {
1323
- const out = [`diagnosed: ${d.checkedAt} (offline; no trace sent)`];
1324
- for (const t of d.targets) {
1325
- let host = t.url;
1326
- try {
1327
- host = new URL(t.url).hostname;
1328
- }
1329
- catch {
1330
- /* keep the URL */
1331
- }
1332
- const listener = t.listener
1333
- ? `TCP ${t.listener.host}:${t.listener.port} ${t.listener.reachable ? 'reachable' : 'not reachable'}${t.listener.error ? ` (${t.listener.error})` : ''}; this does not prove the proxy protocol works`
1334
- : t.guardSupport === 'direct'
1335
- ? 'direct; no proxy TCP listener to test'
1336
- : 'no local TCP listener probe (remote proxy, invalid address, or no explicit port)';
1337
- const support = t.guardSupport === 'unsupported'
1338
- ? '; Guard does not support this proxy scheme; configure HTTP CONNECT or direct before an online check'
1339
- : t.guardSupport === 'invalid'
1340
- ? '; proxy address invalid; correct it and start a new session'
1341
- : '';
1342
- out.push(`${host}: proxy ${t.proxy}; ${listener}${support}; Guard ${t.guard.status}${t.guard.loc ? `, country ${t.guard.loc}` : ''}${t.guard.checkedAt ? `, checked ${t.guard.checkedAt}` : ', not checked yet'}${t.guard.error ? `, ${t.guard.error}` : ''}`);
1343
- }
1344
- return out;
1345
- }
1346
1324
  /** The kinds of AI Task (spec §3.28); anything else is refused. */
1347
1325
  export const AI_TASK_KINDS = [
1348
1326
  'free',
@@ -1762,10 +1740,6 @@ export function panelMigration(config, local) {
1762
1740
  patch.language = local.lang;
1763
1741
  return patch.theme || patch.language ? patch : null;
1764
1742
  }
1765
- /**
1766
- * The line under the start-at-login switch (spec §3.29) as a message key, whether it is on, whether the switch can
1767
- * be moved, and the action beside it: `fix` turns it on again so it starts this sideby. Read-only: no switch, no action.
1768
- */
1769
1743
  /**
1770
1744
  * A key press in the Panel's shortcut recorder as config `menubar.hotkey` writes it (`ctrl+opt+s`), or null while only
1771
1745
  * modifiers are held or the key is not a letter or digit. Reads `code`, not `key`: on a Mac ⌥S types "ß".
@@ -1791,6 +1765,10 @@ export function hotkeyPressKind(code) {
1791
1765
  return 'wait';
1792
1766
  return 'unsupported';
1793
1767
  }
1768
+ /**
1769
+ * The line under the start-at-login switch (spec §3.29) as a message key, whether it is on, whether the switch can
1770
+ * be moved, and the action beside it: `fix` turns it on again so it starts this sideby. Read-only: no switch, no action.
1771
+ */
1794
1772
  export function autostartNote(s, readOnly) {
1795
1773
  if (!s)
1796
1774
  return { key: 'as.checking', on: false, toggle: false, action: null };
@@ -1898,7 +1876,6 @@ export function widthFollower(shown, tierOf, apply, settleMs, timers) {
1898
1876
  };
1899
1877
  }
1900
1878
  // ---------- Session History (spec §3.33) ----------
1901
- /** When a History row was last active: "x min ago" within a week, then its date (key `time.on`). */
1902
1879
  /**
1903
1880
  * Whether the end of a list is close enough to load its next page: within `margin` px of the bottom of what can be
1904
1881
  * seen, which is the viewport where the list's box grows with its rows (the page scrolls, not the box).
@@ -1906,6 +1883,7 @@ export function widthFollower(shown, tierOf, apply, settleMs, timers) {
1906
1883
  export function tailInView(tailTop, boxBottom, viewHeight, margin = 200) {
1907
1884
  return tailTop < Math.min(boxBottom, viewHeight) + margin;
1908
1885
  }
1886
+ /** When a History row was last active: "x min ago" within a week, then its date (key `time.on`). */
1909
1887
  export function historyWhen(iso, now) {
1910
1888
  const ts = Date.parse(iso || '');
1911
1889
  if (!Number.isFinite(ts))
@@ -196,7 +196,6 @@ const MAIN = String.raw `
196
196
  // nothing is watched; off, an older server without the feed.
197
197
  const chg = { seq: null, ctl: null, watching: false, retryAt: 0, off: false }
198
198
 
199
- // ---------- preferences ----------
200
199
  // Kept in localStorage, which can be missing or throw (private windows, blocked storage): every access is guarded
201
200
  // and the defaults apply.
202
201
  const PREFS_KEY = 'sideby.panel.v2'
@@ -231,7 +230,6 @@ const MAIN = String.raw `
231
230
  }
232
231
  // The categories of the side list, in the order the user dragged them to.
233
232
  p.histCatOrder = Array.isArray(raw.histCatOrder) ? raw.histCatOrder.filter((c) => typeof c === 'string' && c).slice(0, HIST_FOLD_MAX) : []
234
- // The categories folded in the side list.
235
233
  p.histCatFold = {}
236
234
  if (raw.histCatFold && typeof raw.histCatFold === 'object')
237
235
  for (const k of Object.keys(raw.histCatFold).filter((k) => raw.histCatFold[k] === true).slice(0, HIST_FOLD_MAX)) p.histCatFold[k] = true
@@ -251,7 +249,6 @@ const MAIN = String.raw `
251
249
  function viewPrefs() { return panelPrefs(cfgPanel, { theme: prefs.theme, lang: prefs.lang }, CFG) }
252
250
  let lang = panelLang(BOOT.lang, viewPrefs().language, navigator.language)
253
251
 
254
- // ---------- text ----------
255
252
  function t(key, vars) {
256
253
  const table = MESSAGES[lang] || {}
257
254
  let s = Object.hasOwn(table, key) ? table[key] : Object.hasOwn(MESSAGES.en, key) ? MESSAGES.en[key] : key
@@ -446,7 +443,6 @@ const MAIN = String.raw `
446
443
  return out
447
444
  }
448
445
 
449
- // ---------- updating in place ----------
450
446
  // A refresh rebuilds the markup, then keeps every existing element whose markup did not change, so focus, hover,
451
447
  // text selection and scroll stay put and only changed rows are swapped. Children match by data-key, else by
452
448
  // position; a data-patch container that changed is updated child by child instead of being replaced. Rows carry
@@ -621,7 +617,6 @@ const MAIN = String.raw `
621
617
  return svg
622
618
  }
623
619
 
624
- // ---------- server calls ----------
625
620
  // The token is per server process: after sideby ui restarts, the first write gets 403 "bad-token". The page then
626
621
  // fetches the new token from api/session and sends that same request once more; the server refused it before
627
622
  // running it, so the retry cannot apply anything twice. A request that got no answer is never replayed.
@@ -671,7 +666,6 @@ const MAIN = String.raw `
671
666
  }
672
667
  }
673
668
 
674
- // ---------- connection ----------
675
669
  // A request that cannot reach the server shows a small notice and polls api/health, waiting 1 s and then up to 5 s
676
670
  // between tries. Once it answers, the page renews its token and reloads the state; writes are left for the user.
677
671
  const conn = { lost: false, timer: 0, delay: 1000 }
@@ -705,7 +699,6 @@ const MAIN = String.raw `
705
699
  $('conn').hidden = !conn.lost
706
700
  }
707
701
 
708
- // ---------- toasts ----------
709
702
  // Bottom center, newest last, at most three. The same text again restarts its timer instead of stacking.
710
703
  // Hovering a toast pauses it, so an Undo stays reachable.
711
704
  const toasts = []
@@ -771,7 +764,6 @@ const MAIN = String.raw `
771
764
  setTimeout(done, 1000)
772
765
  }
773
766
 
774
- // ---------- small parts ----------
775
767
  function ago(iso) {
776
768
  const ts = Date.parse(iso)
777
769
  if (!Number.isFinite(ts)) return ''
@@ -936,7 +928,6 @@ const MAIN = String.raw `
936
928
  document.addEventListener('pointerdown', hideDataTip, true)
937
929
  window.addEventListener('scroll', hideDataTip, true)
938
930
 
939
- // ---------- floating panels: menus and popovers ----------
940
931
  // One shared base for everything that floats next to a button: it is placed under (or above) its anchor, kept
941
932
  // inside the window, closed by a click outside, Escape or a resize, and only one is open at a time. One taller than
942
933
  // the room it gets scrolls inside itself (menuPlacement), and that scroll never closes it; a scroll of the page
@@ -1296,7 +1287,6 @@ const MAIN = String.raw `
1296
1287
  return b
1297
1288
  }
1298
1289
 
1299
- // ---------- Doctor history ----------
1300
1290
  // Health comes from the Doctor history, which keeps the latest result per Account: an Account that was
1301
1291
  // never checked shows "Not checked", never "Healthy".
1302
1292
  function entries() {
@@ -1327,7 +1317,6 @@ const MAIN = String.raw `
1327
1317
  }
1328
1318
  function setupFor(fam) { return S.state && S.state.quotaSetups.find((s) => s.family === fam) }
1329
1319
 
1330
- // ---------- header and summary ----------
1331
1320
  function renderUpdated() {
1332
1321
  const busy = S.loading && !S.silent
1333
1322
  const every = Math.round((S.fastUntil > Date.now() ? FAST_MS : AUTO_MS) / 1000)
@@ -1482,7 +1471,6 @@ const MAIN = String.raw `
1482
1471
  return wins.map((w) => passedWindow(w, q.observedAt, now) ? t('stat.pickReset', { w: winShort(w.label) }) : t('stat.pickLeft', { w: winShort(w.label), n: String(Math.max(0, 100 - Math.round(Number(w.usedPercent) || 0))) })).join(' · ')
1483
1472
  }
1484
1473
 
1485
- // ---------- toolbar ----------
1486
1474
  const tb = {}
1487
1475
  function seg(label, options, value, onPick) {
1488
1476
  const btns = options.map((o) => h('button', { class: 'seg-btn', type: 'button', 'aria-pressed': String(o[0] === value), title: o[2] || null, 'aria-label': o[2] || t('tb.segLabel', { group: label, option: o[1] }), onclick: () => {
@@ -1571,7 +1559,6 @@ const MAIN = String.raw `
1571
1559
  }
1572
1560
  })
1573
1561
 
1574
- // ---------- accounts ----------
1575
1562
  // One column per Quota window label. 5h and 7d always have one, so rows of every group line up under the same
1576
1563
  // header; a label only some account reports (such as 60m) adds a column, at most three in all.
1577
1564
  const KNOWN_WINDOWS = { '5h': 300, '7d': 10080 }
@@ -3296,7 +3283,6 @@ const MAIN = String.raw `
3296
3283
  setTimeout(() => el.classList.remove('flash'), 2600)
3297
3284
  }
3298
3285
 
3299
- // ---------- Health check ----------
3300
3286
  async function runCheck() {
3301
3287
  if (S.checking || S.fixing) return
3302
3288
  S.checking = true
@@ -3453,7 +3439,6 @@ const MAIN = String.raw `
3453
3439
  extra ? h('span', { class: 'note-sub' }, extra) : null)
3454
3440
  }
3455
3441
 
3456
- // ---------- dialogs ----------
3457
3442
  const dlg = { el: null, kind: null, busy: false, onClose: null }
3458
3443
  function ensureDialog() {
3459
3444
  if (dlg.el) return dlg.el
@@ -4819,7 +4804,6 @@ const MAIN = String.raw `
4819
4804
  renderHistorySide()
4820
4805
  historyChanged(false)
4821
4806
  }
4822
- // ---------- grouping the list ----------
4823
4807
  // A "Display" popover by the filters picks how the list is grouped; a group folds from its header and stays
4824
4808
  // folded in this browser. The server pages through the groups in order and counts folded ones without their rows.
4825
4809
  function groupName(by) {
@@ -5144,7 +5128,6 @@ const MAIN = String.raw `
5144
5128
  Promise.resolve(loadHistory(false, d.sessions.length, true)).then(loadProjects)
5145
5129
  }
5146
5130
 
5147
- // ---------- reading one past session ----------
5148
5131
  // Read only. The newest 200 messages first, older ones on request; a run of tool calls is one line. The dialog
5149
5132
  // opens once the messages are in, at its final size, scrolled to the end.
5150
5133
  const hv = { data: null, open: {}, loading: false }
@@ -5803,7 +5786,6 @@ const MAIN = String.raw `
5803
5786
  load()
5804
5787
  }
5805
5788
 
5806
- // ---------- auto handoff ----------
5807
5789
  // Settings come with /api/state; readiness (which runs a check of the sideby on PATH) only when the dialog opens.
5808
5790
  let ah = null
5809
5791
  const HINT_QUIET_MS = 24 * 3600000
@@ -6126,7 +6108,6 @@ const MAIN = String.raw `
6126
6108
  setKids(dlg.el, dialogFrame(t('md.title') + ' · ' + a.ref, a.family, body, foot))
6127
6109
  }
6128
6110
 
6129
- // ---------- the Auto Handoff page ----------
6130
6111
  // Off: one sentence and one button. On: where each account's work would go next, the last hand-overs and what is
6131
6112
  // still missing. Turning on is one plan shown first (hp.preview) and one confirmation; no commands to copy.
6132
6113
  const hp = { data: null, plan: null, loading: false, error: null, preview: null, previewing: false, applying: false, failed: null, changed: false, busyOff: false, askSame: false, askApi: false }
@@ -6325,7 +6306,8 @@ const MAIN = String.raw `
6325
6306
  const st = ahState().settings
6326
6307
  return st.sameFamily && st.otherFamilies ? null : h('p', { class: 'note', 'data-enter': 'none-hint' }, t('hp.noneAll'))
6327
6308
  }
6328
- // Up to ADR-0046 API accounts took over by themselves; this asks once, where Auto Handoff is on.
6309
+ // A user who turned Auto Handoff on before API accounts needed their own switch has not chosen yet (ADR-0046);
6310
+ // this asks once, and either answer ends the question.
6329
6311
  function hpApiBanner() {
6330
6312
  const st = ahState()
6331
6313
  if (!st || !st.apiUndecided || BOOT.readOnly) return null
@@ -6438,7 +6420,6 @@ const MAIN = String.raw `
6438
6420
  renderPageChrome()
6439
6421
  }
6440
6422
 
6441
- // ---------- words ----------
6442
6423
  // A moment relative to now: "08:00" today, else "tomorrow 08:00", "Mon 08:00" or "Nov 3 08:00".
6443
6424
  function uaDayWord(ms, now) {
6444
6425
  const w = uaWhen(ms, now)
@@ -6477,7 +6458,6 @@ const MAIN = String.raw `
6477
6458
  return [t('ua.off'), p.next ? uaAt('next', p.next.at) : null]
6478
6459
  }
6479
6460
 
6480
- // ---------- the header badge ----------
6481
6461
  // "Unattended · until 08:00" while it is on, to the page in one click. It fades in and out; a refresh with the same
6482
6462
  // words leaves it alone.
6483
6463
  function renderUaBadge() {
@@ -6509,7 +6489,6 @@ const MAIN = String.raw `
6509
6489
  }
6510
6490
  }
6511
6491
 
6512
- // ---------- motion ----------
6513
6492
  // Like patch, and a [data-ua] part that was not there grows in while one that went away shrinks out where it was.
6514
6493
  // A first draw animates nothing; reduced motion only switches.
6515
6494
  function uaPatch(box, kids) {
@@ -6558,7 +6537,6 @@ const MAIN = String.raw `
6558
6537
  a.finished.then(end, end)
6559
6538
  }
6560
6539
 
6561
- // ---------- turning it on and off ----------
6562
6540
  function uaOpenChooser() {
6563
6541
  const st = uaStatusNow()
6564
6542
  if (!st) return
@@ -6634,7 +6612,6 @@ const MAIN = String.raw `
6634
6612
  uaRedraw()
6635
6613
  }
6636
6614
 
6637
- // ---------- the Schedule ----------
6638
6615
  // Each row keeps an id while the page shows it, so a removed Slot is the row that leaves and an edited one stays the
6639
6616
  // same element (focus stays in its time field). A Schedule changed elsewhere matches rows by what they cover.
6640
6617
  function uaSchedule() {
@@ -6773,7 +6750,6 @@ const MAIN = String.raw `
6773
6750
  return out
6774
6751
  }
6775
6752
 
6776
- // ---------- Pending Decisions ----------
6777
6753
  function uaWhenShort(iso) {
6778
6754
  const ms = Date.parse(iso)
6779
6755
  const now = Date.now()
@@ -7001,7 +6977,6 @@ const MAIN = String.raw `
7001
6977
  })))]
7002
6978
  }
7003
6979
 
7004
- // ---------- the page ----------
7005
6980
  function uaCoverage(st) {
7006
6981
  const have = new Set(S.state.accounts.map((a) => a.family))
7007
6982
  const lines = [h('li', null, t('ua.coverLine'))]
@@ -7348,9 +7323,8 @@ const MAIN = String.raw `
7348
7323
  return out
7349
7324
  }
7350
7325
  function famTitleOf(fam) { const f = S.state && S.state.families.find((x) => x.id === fam); return f ? f.title : fam }
7351
- // ---------- settings ----------
7352
- // One header button holds what is set once and rarely changed: language, theme, Remote Control and Auto Handoff.
7353
- // A dot on it says Remote Control starts by itself, so that state stays visible after its banner is gone.
7326
+ // One header button opens the settings; settingsSections() lists the sections that have something to show
7327
+ // right now, and the button hides when none do. A dot on it says Remote Control starts by itself, so that state stays visible after its banner is gone.
7354
7328
  function settingsSections() {
7355
7329
  const out = []
7356
7330
  if (!LANG_FIXED) out.push('lang')
@@ -7414,7 +7388,7 @@ const MAIN = String.raw `
7414
7388
  return setLink(leave, t('ai.title'), t(skillInstalled() ? 'ai.installed' : 'ai.notInstalled'), skillInstalled() ? 'chip-ok' : '', () => openAsk(), true)
7415
7389
  }
7416
7390
  // The dialog's sections, in order: General, Menu bar, Accounts, Quota checks, Auto Handoff, Progress updates,
7417
- // Network check, Let AI help. Each is
7391
+ // Folder trust, Shared memory, Network check, Let AI help. Each is
7418
7392
  // { id, title, items, foot }: foot is the one line that explains the whole section.
7419
7393
  function settingsGroups(leave) {
7420
7394
  const secs = settingsSections()
@@ -9487,7 +9461,6 @@ const MAIN = String.raw `
9487
9461
  return h('button', { class: 'link-btn small', type: 'button', 'aria-label': full, 'data-tip': full, onclick: () => openPick(fam) }, offer.name ? t('pk.offerShort', { name: offer.name }) : t('pk.offerNoNameShort'))
9488
9462
  }
9489
9463
 
9490
- // ---------- banners ----------
9491
9464
  // Offered once on macOS (spec §3.31), when quota shows and the menu bar item is off; "No thanks" is for good.
9492
9465
  function menubarHint() {
9493
9466
  if (BOOT.readOnly || prefs.mbHintDone) return null
@@ -9576,7 +9549,6 @@ const MAIN = String.raw `
9576
9549
  exb.el = el
9577
9550
  }
9578
9551
 
9579
- // ---------- loading ----------
9580
9552
  function renderAll() { renderTop(); renderBanners(); renderSummary(); renderFamilyFilter(); renderAccounts(); renderCheckup(); renderPageChrome() }
9581
9553
  // A load that starts while another runs is queued, never dropped, so a change made meanwhile (a new
9582
9554
  // account, a fix) always ends up on screen; and only the newest response is ever rendered. A silent load is a
@@ -10090,7 +10062,6 @@ const MAIN = String.raw `
10090
10062
  setKids(dlg.el, dialogFrame(t('upd.title'), null, body, foot))
10091
10063
  }
10092
10064
 
10093
- // ---------- start ----------
10094
10065
  $('ver').textContent = BOOT.version ? 'sideby v' + BOOT.version : 'sideby'
10095
10066
  $('ver').disabled = !BOOT.updates
10096
10067
  $('ver').addEventListener('click', () => openVerPop($('ver')))
@@ -111,7 +111,7 @@ code, .mono { font-family: var(--mono); font-size: 12px; }
111
111
  .ver-pill.has-update { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
112
112
  .ver-pill.has-update::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
113
113
  .logo { display: inline-flex; flex: none; width: 40px; height: 40px; border-radius: var(--radius-xl); background: var(--logo-bg); box-shadow: inset 0 0 0 1px var(--logo-line); }
114
- /* The painted mark (core/brand-mark.ts), 3 px in from the tile's edge; desktop/icon.ts lays the app icon out the same way. */
114
+ /* The painted mark (core/brand-mark.ts), 4 px in from the tile's edge; desktop/icon.ts insets the app icon by MARK_INSET (3 of 40 px) instead. */
115
115
  .logo img { display: block; width: 100%; height: 100%; padding: 4px; box-sizing: border-box; object-fit: contain; }
116
116
  .top-actions { display: flex; align-items: center; gap: 8px; }
117
117
  .section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
@@ -164,7 +164,6 @@ code, .mono { font-family: var(--mono); font-size: 12px; }
164
164
  .sk-pick { height: 24px; width: 45%; }
165
165
  .label-tip { display: inline-flex; align-items: center; gap: 8px; }
166
166
 
167
- /* Toolbar */
168
167
  .toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
169
168
  .search { position: relative; flex: 1 1 160px; min-width: 120px; display: block; }
170
169
  .search-ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
@@ -199,7 +198,6 @@ code, .mono { font-family: var(--mono); font-size: 12px; }
199
198
  .acct-head h2 { display: flex; align-items: baseline; gap: 12px; }
200
199
  #acct-count { font-weight: 400; }
201
200
 
202
- /* Family groups */
203
201
  .group { margin-bottom: 16px; min-width: 0; }
204
202
  .group-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow); }
205
203
  .group-head { display: flex; align-items: center; gap: 12px; padding: 8px 12px 8px 8px; min-height: 48px; flex-wrap: wrap; }
@@ -332,8 +330,8 @@ code, .mono { font-family: var(--mono); font-size: 12px; }
332
330
  .row-toggle[aria-expanded=true]:not(:hover) { background: transparent; color: var(--muted); }
333
331
  .fold-hit:hover .row-toggle[aria-expanded=true] { background: var(--hover); color: var(--text); }
334
332
  /* The details under a row's name (a Same Login's after a dashed line). Their left edge is the name's: the open arrow (--ctl-h-sm,
335
- less its 14px of negative margins), 10px, the 26px mark, 10px and the pin's 18px. */
336
- .row-detail { grid-area: detail; display: flex; flex-wrap: wrap; gap: 12px 36px; margin: 12px 0 4px calc(var(--ctl-h-sm) + 50px); padding-top: 12px; border-top: 1px dashed var(--border); cursor: default; }
333
+ less its 16px of negative margins), 12px, the 26px mark, 12px and the pin's 20px. */
334
+ .row-detail { grid-area: detail; display: flex; flex-wrap: wrap; gap: 12px 36px; margin: 12px 0 4px calc(var(--ctl-h-sm) + 54px); padding-top: 12px; border-top: 1px dashed var(--border); cursor: default; }
337
335
  .rd-item { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
338
336
  /* An open account's details sit in one bordered panel under the name: four cells side by side (how it runs, its web
339
337
  sign-in, tokens, health), each a label above its value, with the same widths in every row. Without browser
@@ -437,7 +435,8 @@ code, .mono { font-family: var(--mono); font-size: 12px; }
437
435
  .ctx-anchor { position: fixed; width: 0; height: 0; pointer-events: none; }
438
436
  .row-notes { grid-area: notes; display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
439
437
 
440
- /* Quota meters: percent and countdown over a bar colored by level (ok, warn at 60%, fail at 85% used). */
438
+ /* Quota meters: percent and countdown over a bar colored by level (core/quota-levels.ts: warn at 60%, fail at 85% used;
439
+ long windows warn at 85%, fail at 95%). */
441
440
  .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; }
442
441
  .row > .quota { grid-template-columns: repeat(var(--qn), var(--q-w)); }
443
442
  .meter { min-width: 0; }
@@ -497,7 +496,6 @@ code, .mono { font-family: var(--mono); font-size: 12px; }
497
496
  /* In the wide list the column titles name the windows; elsewhere each meter carries its label. */
498
497
  .rows .m-label, .rows .m-unit { display: none; }
499
498
 
500
- /* Chips and badges */
501
499
  .badge { flex: none; display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: var(--radius-xl); color: var(--on-badge); font-weight: 600; font-size: 12px; letter-spacing: .02em; }
502
500
  .badge-logo { background: var(--surface-2); border: 1px solid var(--border); color: var(--text); }
503
501
  .badge svg { display: block; width: 20px; height: 20px; fill: currentColor; }
@@ -533,7 +531,6 @@ code, .mono { font-family: var(--mono); font-size: 12px; }
533
531
  .dot-ok { background: var(--ok-bar); } .dot-fail { background: var(--fail-bar); } .dot-warn { background: var(--warn-bar); }
534
532
  .title-logo { display: flex; align-items: center; gap: 8px; min-width: 0; }
535
533
 
536
- /* Cards view */
537
534
  /* Cards in a row share one height, so their foot lines and buttons line up; the foot sits at the bottom. */
538
535
  .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
539
536
  .panel, .card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow); }
@@ -613,7 +610,6 @@ a.btn:hover { text-decoration: none; }
613
610
  .btn:focus-visible { border-color: var(--focus); }
614
611
  .note a, .banner a { color: inherit; text-decoration: underline; text-underline-offset: 2px; font-weight: 600; }
615
612
 
616
- /* Notes and banners */
617
613
  .note { background: var(--surface-2); border-radius: var(--radius-sm); padding: 8px 12px; font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
618
614
  .note b { color: inherit; }
619
615
  .note-read .read-why { overflow-wrap: anywhere; }
@@ -750,7 +746,6 @@ a.btn:hover { text-decoration: none; }
750
746
  .copy { display: flex; align-items: center; gap: 8px; max-width: 100%; min-width: 0; }
751
747
  .copy code { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 4px 8px; overflow-x: auto; white-space: nowrap; color: var(--text); min-width: 0; }
752
748
 
753
- /* Health check */
754
749
  .diff { margin: 0; max-height: 260px; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px 0; font-family: var(--mono); font-size: 12px; line-height: 1.55; }
755
750
  .diff span { display: block; padding: 0 12px; white-space: pre; }
756
751
  .diff .add { background: var(--ok-soft); color: var(--ok); } .diff .del { background: var(--fail-soft); color: var(--fail); } .diff .hunk { color: var(--faint); }
@@ -770,7 +765,6 @@ a.btn:hover { text-decoration: none; }
770
765
  .fix-result.is-ok { background: var(--ok-soft); color: var(--ok); } .fix-result.is-warn { background: var(--warn-soft); color: var(--warn); }
771
766
  .fix-result ul { margin: 8px 0 0; padding-left: 20px; }
772
767
 
773
- /* Forms */
774
768
  .form { display: flex; flex-direction: column; gap: 16px; }
775
769
  .field { display: flex; flex-direction: column; gap: 8px; border: 0; padding: 0; margin: 0; min-width: 0; }
776
770
  /* A picker's wrapper (.select-wrap) is a span too, but no label: its button and menu keep their own type. */
@@ -866,8 +860,8 @@ ${UI_CSS}
866
860
  .app-row:first-child { border-top: 0; }
867
861
  .app-row > .ident { flex: 1; }
868
862
  .app-actions { flex: none; justify-content: flex-end; }
869
- /* The open arrow of an account row is --ctl-h-sm wide less its 14px of negative margins. */
870
- .app-gap { flex: none; width: calc(var(--ctl-h-sm) - 14px); }
863
+ /* The open arrow of an account row is --ctl-h-sm wide less its 16px of negative margins. */
864
+ .app-gap { flex: none; width: calc(var(--ctl-h-sm) - 16px); }
871
865
  .app-foot { display: flex; flex-direction: column; gap: 8px; padding: 12px 16px 12px; border-top: 1px solid var(--border); }
872
866
  .app-foot > .btn { align-self: flex-start; }
873
867
  .app-new { display: flex; gap: 8px; align-items: center; max-width: 420px; }
@@ -893,7 +887,6 @@ ${UI_CSS}
893
887
  .steps li { min-width: 0; }
894
888
  .steps li > span:not(.copy) { display: block; margin-bottom: 4px; }
895
889
 
896
- /* Dialog */
897
890
  .dialog { padding: 0; border: 1px solid var(--border); border-radius: var(--radius-xl); background: var(--surface); color: var(--text); width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 48px); box-shadow: var(--float-shadow); }
898
891
  .dialog[open] { display: flex; }
899
892
  .dialog::backdrop { background: var(--scrim); }
@@ -906,7 +899,6 @@ ${UI_CSS}
906
899
  .dlg-body { padding: 12px 20px 16px; overflow: auto; display: flex; flex-direction: column; gap: 12px; }
907
900
  .dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-xl) var(--radius-xl); }
908
901
 
909
- /* Menu, tooltips, toasts */
910
902
  .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: var(--radius-lg); box-shadow: var(--float-shadow); overflow-y: auto; overscroll-behavior: contain; }
911
903
  .menu-item { display: flex; align-items: center; gap: 12px; width: 100%; height: 32px; padding: 0 12px; border: 0; border-radius: var(--radius-sm); background: none; color: var(--text); font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
912
904
  .menu-item .ic { flex: none; color: var(--muted); }
@@ -1023,7 +1015,6 @@ ${UI_CSS}
1023
1015
  @keyframes toast-bump { 50% { transform: scale(1.03); } }
1024
1016
  .conn { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 55; display: flex; align-items: center; gap: 8px; max-width: calc(100vw - 24px); padding: 8px 16px; border-radius: var(--radius-pill); background: var(--warn-soft); color: var(--warn); border: 1px solid var(--border); box-shadow: var(--float-shadow); font-size: 13px; font-weight: 600; }
1025
1017
 
1026
- /* Empty, loading and filtered states */
1027
1018
  .empty { text-align: center; padding: 36px 20px; background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius-xl); display: flex; flex-direction: column; align-items: center; gap: 12px; }
1028
1019
  .empty-sm { padding: 28px 20px; }
1029
1020
  /* The empty state is a block of its own, apart from what follows it (Grok Bot windows). */
@@ -1144,8 +1135,8 @@ ${UI_CSS}
1144
1135
  .dlg-head { padding: 16px 16px 4px; } .dlg-body { padding: 12px 16px 16px; } .dlg-foot { padding: 12px 16px; flex-wrap: wrap; }
1145
1136
  }
1146
1137
  /* A change of layout band runs as a short View Transition (page-script.ts followWidth): each block below moves and
1147
- resizes to its new place while its old and new look cross-fade; the rest of the page cross-fades as one. Same
1148
- length and ease as a Portal's sliding sidebar (.26s, quick start, soft landing), so both read as one move. */
1138
+ resizes to its new place while its old and new look cross-fade; the rest of the page cross-fades as one. It runs
1139
+ for --duration-slow with --ease-out (quick start, soft landing). */
1149
1140
  ::view-transition-group(*) { animation-duration: var(--duration-slow); animation-timing-function: var(--ease-out); }
1150
1141
  /* Old and new looks keep their own size (pinned top left) instead of stretching to the moving box, so text never
1151
1142
  grows or shrinks on the way. */
@@ -127,7 +127,7 @@ async function analyze(ctx) {
127
127
  /**
128
128
  * Adds `refreshInterval` to a status line sideby wrapped earlier (ADR-0056). The backup's wrapped hash follows the new
129
129
  * bytes only while it named the file as it was, so teardown still restores the original; otherwise it stays as it is
130
- * and teardown refuses as before.
130
+ * and teardown still refuses.
131
131
  */
132
132
  async function applyUpgrade(ctx, a, mode) {
133
133
  const { upgrade: _, ...plan } = a.plan;
@@ -13,7 +13,7 @@ import { type HandoffDecision, type UsedAccount } from './core/handoff-select.ts
13
13
  import { type DoctorHistory } from './core/last-doctor.ts';
14
14
  import { type HostLaunch, type PreparedLaunch } from './core/launch.ts';
15
15
  import { type LimitResetPlan, type LimitResetResult } from './core/limit-reset.ts';
16
- import { type ListenerProbe, type NetworkDiagnosis, type NetworkOverview } from './core/network.ts';
16
+ import { type ListenerProbe, type NetworkDiagnosis, type NetworkOverview, type NetworkSystemDeps } from './core/network.ts';
17
17
  import { type Paths } from './core/paths.ts';
18
18
  import { type PickChoice } from './core/pick-commands.ts';
19
19
  import { type ProgressView } from './core/progress.ts';
@@ -608,6 +608,7 @@ export declare function createRuntime(opts?: {
608
608
  fetcher?: TraceFetcher;
609
609
  print?: string;
610
610
  probe?: ListenerProbe;
611
+ system?: NetworkSystemDeps;
611
612
  };
612
613
  /**
613
614
  * Internal, for tests: how long a Limit Reset request may take before it counts as unanswered (spec §3.40), so a
@@ -66,8 +66,9 @@ async function readIdentity(f, account) {
66
66
  }
67
67
  }
68
68
  /**
69
- * An Account's Login Key (ADR-0028), only for grouping a Same Login: it stays inside `groupsOf` and never reaches an
70
- * output, an error, a log or a cache. Undefined for a Family without a reader, or on any problem.
69
+ * An Account's Login Key (ADR-0028), for grouping a Same Login (`groupsOf`) and for a Limit Reset's login check
70
+ * (`loginKeyNow`, ADR-0072). It stays inside the Runtime and never reaches an output, an error, a log or a cache.
71
+ * Undefined for a Family without a reader, or on any problem.
71
72
  */
72
73
  async function readLoginKey(account) {
73
74
  const read = LOGIN_KEY_READERS.get(account.family);
@@ -259,8 +260,8 @@ export async function createRuntime(opts = {}) {
259
260
  p.args = beforeDashes(p.args, args);
260
261
  };
261
262
  /**
262
- * Network Guard, Unattended Mode and Progress Reminders on a prepared Launch, in that order; hooks only for a session
263
- * (`run`).
263
+ * Network Guard, Unattended Mode, Progress Reminders and Shared Project Memory on a prepared Launch, in that order;
264
+ * all but Network Guard only for a session (`run`).
264
265
  */
265
266
  const sessionReady = async (p, session, o) => {
266
267
  const parts = [];
@@ -721,7 +722,7 @@ export async function createRuntime(opts = {}) {
721
722
  };
722
723
  };
723
724
  // The Live Sessions of each Account, for spreading picks (ADR-0083). A listing that fails counts none: the pick
724
- // still happens, ranked as before.
725
+ // still happens, ranked as if no Account had a Live Session.
725
726
  const liveSessionCounts = async () => {
726
727
  if (opts.picks?.liveSessions)
727
728
  return opts.picks.liveSessions();
@@ -1169,7 +1170,8 @@ export async function createRuntime(opts = {}) {
1169
1170
  ...inputs,
1170
1171
  // Claude Code's advisor (spec §3.41, ADR-0074): unlocked in Claude subscription sessions while config says so.
1171
1172
  ...(config.advisor?.unlock === true ? { advisorUnlock: true } : {}),
1172
- // Claude API Accounts get the variable that turns experimental betas off, moved here from a shared settings file.
1173
+ // Claude API Accounts get the variable that turns experimental betas off at Launch, so a settings file that
1174
+ // Subscription Accounts share never carries it (ADR-0074).
1173
1175
  ...(config.claude?.apiBetasOff === true ? { apiBetasOff: true } : {}),
1174
1176
  // Config `ask.permissions: account` (ADR-0070): the AI Task keeps the Account's own arguments, as `run` does.
1175
1177
  ...(opts.aiTask && aiTaskPermissions(config) === 'checked' ? { aiTask: true } : {}),
@@ -1224,6 +1226,7 @@ export async function createRuntime(opts = {}) {
1224
1226
  env,
1225
1227
  envFor: async (a) => accountEnv(familyOf(a.family), a, env),
1226
1228
  ...(opts.network?.probe ? { probe: opts.network.probe } : {}),
1229
+ ...(opts.network?.system ? { system: opts.network.system } : {}),
1227
1230
  now,
1228
1231
  });
1229
1232
  },
@@ -341,8 +341,8 @@ export interface HandoffEligibility {
341
341
  export interface FamilyHandoff {
342
342
  /**
343
343
  * What this Family can start: `quota` before the limit (prepare and threshold, from its Quota), `limit` after a
344
- * turn failed at the limit. Empty: it can only receive. Plugin Families can only receive for now: the hook entry
345
- * loads built-in readers only.
344
+ * turn failed at the limit. Empty: it can only receive. Plugin Families can only receive: the hook entry loads
345
+ * built-in readers only.
346
346
  */
347
347
  starts: readonly ('quota' | 'limit')[];
348
348
  /** Host arguments that load sideby's hooks for one run; omitted when the hooks come from `hookSetup`. */
@@ -275,7 +275,6 @@ const FILE_TOOLS = {
275
275
  MultiEdit: 'file_path',
276
276
  NotebookEdit: 'notebook_path',
277
277
  };
278
- /** Words that run the next word as the command: the program is the word after them (and their options). */
279
278
  /** Programs that run another one, each with its options that take a value of their own (`sudo -u root`, `nice -n 10`). */
280
279
  const WRAPPERS = {
281
280
  sudo: ['-u', '-g', '-C', '-h', '-p', '-U', '-r', '-t', '-T', '-D', '--user', '--group'],
@@ -19,7 +19,7 @@ export async function withFakeHome(fn) {
19
19
  XDG_STATE_HOME: join(home, '.local', 'state'),
20
20
  PATH: `${bin}:/usr/bin:/bin`,
21
21
  NO_COLOR: '1',
22
- // No Update Check from tests (spec §3.23): it is sideby's only network request. Delete it to test checks.
22
+ // No Update Check from tests (spec §3.23): it is a network request of sideby's own. Delete it to test checks.
23
23
  SIDEBY_NO_UPDATE_NOTIFIER: '1',
24
24
  };
25
25
  const h = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sideby",
3
- "version": "0.44.0",
3
+ "version": "0.45.1",
4
4
  "description": "Run work, personal and API-key accounts at the same time, without their configs drifting apart.",
5
5
  "license": "MIT",
6
6
  "author": "Adonis0123 (https://github.com/Adonis0123)",
@@ -76,6 +76,7 @@
76
76
  "postpublish": "node scripts/pin-english-npm-readme.ts --restore"
77
77
  },
78
78
  "dependencies": {
79
+ "network-portal": "0.1.0",
79
80
  "typebox": "^1.3.34"
80
81
  },
81
82
  "devDependencies": {