sideby 0.35.6 → 0.35.7

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 (55) hide show
  1. package/dist/build.json +1 -1
  2. package/dist/src/cli/commands.d.ts +9 -1
  3. package/dist/src/cli/commands.js +59 -16
  4. package/dist/src/cli/json-schemas.js +20 -0
  5. package/dist/src/cli/main.js +11 -5
  6. package/dist/src/core/cli-commands.js +1 -1
  7. package/dist/src/core/config.d.ts +7 -0
  8. package/dist/src/core/config.js +9 -0
  9. package/dist/src/core/doctor.d.ts +5 -1
  10. package/dist/src/core/doctor.js +16 -0
  11. package/dist/src/core/edit-settings.d.ts +27 -1
  12. package/dist/src/core/edit-settings.js +78 -4
  13. package/dist/src/core/handoff-select.d.ts +3 -1
  14. package/dist/src/core/handoff-select.js +11 -1
  15. package/dist/src/core/handoff.d.ts +13 -1
  16. package/dist/src/core/handoff.js +16 -5
  17. package/dist/src/core/login-mark.d.ts +3 -0
  18. package/dist/src/core/login-mark.js +22 -0
  19. package/dist/src/core/pick-commands.d.ts +4 -2
  20. package/dist/src/core/pick-commands.js +7 -2
  21. package/dist/src/core/quota-fetch.d.ts +7 -1
  22. package/dist/src/core/quota-fetch.js +38 -1
  23. package/dist/src/core/quota-store.d.ts +5 -0
  24. package/dist/src/core/quota-store.js +3 -0
  25. package/dist/src/core/search-catalog.js +9 -0
  26. package/dist/src/families/claude/index.js +3 -0
  27. package/dist/src/families/claude/login-events.d.ts +24 -0
  28. package/dist/src/families/claude/login-events.js +163 -0
  29. package/dist/src/families/claude/quota-fetch.js +14 -0
  30. package/dist/src/menubar/snapshot.d.ts +2 -0
  31. package/dist/src/menubar/snapshot.js +6 -2
  32. package/dist/src/menubar/strings.d.ts +4 -0
  33. package/dist/src/menubar/strings.js +4 -0
  34. package/dist/src/panel/handler.d.ts +14 -1
  35. package/dist/src/panel/handler.js +48 -14
  36. package/dist/src/panel/i18n.d.ts +23 -0
  37. package/dist/src/panel/i18n.js +46 -0
  38. package/dist/src/panel/page-logic.d.ts +44 -2
  39. package/dist/src/panel/page-logic.js +43 -3
  40. package/dist/src/panel/page-script.js +124 -7
  41. package/dist/src/panel/page-styles.js +8 -0
  42. package/dist/src/panel/page.d.ts +7 -0
  43. package/dist/src/panel/page.js +1 -0
  44. package/dist/src/runtime.d.ts +16 -1
  45. package/dist/src/runtime.js +51 -2
  46. package/dist/src/types.d.ts +37 -0
  47. package/package.json +3 -3
  48. package/schemas/config.json +11 -0
  49. package/schemas/edit.json +4 -0
  50. package/schemas/list.json +24 -0
  51. package/schemas/next.json +18 -0
  52. package/skills/sideby/SKILL.md +4 -2
  53. package/skills/sideby/references/accounts.md +9 -0
  54. package/skills/sideby/references/diagnose.md +6 -1
  55. package/skills/sideby/references/panel.md +1 -1
@@ -1,5 +1,6 @@
1
1
  // HTTP handler for the local Panel. Mountable under any basePath; standalone and embedded use the same rules.
2
2
  import { randomBytes, timingSafeEqual } from 'node:crypto';
3
+ import { realpath } from 'node:fs/promises';
3
4
  import { aliasesByAccount, startArgsOf } from '../core/accounts.js';
4
5
  import { listAppProfiles, openAppProfile, removeAppProfile, } from '../core/app-profiles.js';
5
6
  import { openLoginInTerminal, openPickInTerminal, pickTaskAccount, previewAttachments, promptForTask, setCustomTerminal, setPreferredTerminal, startAiTask, taskContext, terminals, tryAccount, } from '../core/ask.js';
@@ -7,9 +8,9 @@ import { ATTACHMENT_LIMITS, MAX_ATTACHMENTS, MAX_UPLOAD_BYTES, removeStaged, sta
7
8
  import { applyAutostart, autostartStatus, PANEL_AGENT, planAutostart, } from '../core/autostart.js';
8
9
  import { FAVICON_SVG, ICON_SVG } from '../core/brand-mark.js';
9
10
  import { browserReport, openInBrowser, setBrowserChoice, setBrowserSignIns, } from '../core/browser-profiles.js';
10
- import { aiTaskPermissions, aliasArgs, aliasRefs, editConfigPanel, editConfigTerminal, editConfigUpdate, loadConfig, } from '../core/config.js';
11
+ import { aiTaskPermissions, aliasArgs, aliasRefs, EDITORS, editConfigPanel, editConfigPath, editConfigTerminal, editConfigUpdate, loadConfig, } from '../core/config.js';
11
12
  import { openDesktopApp, withDesktopApps } from '../core/desktop-app.js';
12
- import { editSettings } from '../core/edit-settings.js';
13
+ import { editSettings, isEditor } from '../core/edit-settings.js';
13
14
  import { UserError } from '../core/errors.js';
14
15
  import { planHandoff } from '../core/handoff.js';
15
16
  import { applyHandoffEnable, planHandoffEnable } from '../core/handoff-enable.js';
@@ -59,14 +60,15 @@ export const MAX_QUEUED_WRITES = 4;
59
60
  export const LIVE_SESSIONS_SOURCE = Symbol('sideby.panel.liveSessions');
60
61
  /** The longest text "Send to it" takes; the page's text box has the same limit. */
61
62
  export const MAX_MESSAGE_TEXT = 8000;
62
- function resolveAsk(ask) {
63
- if (ask === undefined)
63
+ /** The `ask` and `open` options: `{ bridge: 'postMessage' }` or left out; anything else is a TypeError. */
64
+ function resolveBridge(name, value) {
65
+ if (value === undefined)
64
66
  return undefined;
65
- if (!ask ||
66
- typeof ask !== 'object' ||
67
- ask.bridge !== 'postMessage' ||
68
- Object.keys(ask).length !== 1)
69
- throw new TypeError('panel ask must be { bridge: "postMessage" } or left out');
67
+ if (!value ||
68
+ typeof value !== 'object' ||
69
+ value.bridge !== 'postMessage' ||
70
+ Object.keys(value).length !== 1)
71
+ throw new TypeError(`panel ${name} must be { bridge: "postMessage" } or left out`);
70
72
  return { bridge: 'postMessage' };
71
73
  }
72
74
  const PANEL_LANGS = ['auto', 'en', 'zh'];
@@ -260,6 +262,7 @@ export function handoffByFamily(rt, accounts, now) {
260
262
  isMain: a.isMain,
261
263
  kind: a.kind,
262
264
  login: a.login ?? 'unknown',
265
+ ...(a.loginProblem ? { loginProblem: a.loginProblem } : {}),
263
266
  quota: a.quota ?? { status: 'unavailable', reason: 'unrecognized' },
264
267
  })), now,
265
268
  // The same plan as `sideby next`: the same Takeover Limits, and past them the least used Account (a Last Resort).
@@ -630,6 +633,7 @@ async function buildState(rt, opts) {
630
633
  ...(history ? { history } : {}),
631
634
  ...(rt.config.aliases ? { configAliases: aliasRefs(rt.config.aliases) } : {}),
632
635
  ...(rt.config.pickCommands ? { pickCommands: { ...rt.config.pickCommands } } : {}),
636
+ editor: isEditor(rt.config.editor) ? rt.config.editor : 'system',
633
637
  ...(Object.keys(pickOffers).length ? { pickOffers } : {}),
634
638
  shellSetup: { ...shellSt, rc: tildify(shellSt.rc, ctx.home), block: setupBlock(shellSt.shell) },
635
639
  ...(Object.keys(handoff).length ? { handoff } : {}),
@@ -977,7 +981,8 @@ export function createPanelHandler(opts) {
977
981
  const theme = resolveTheme(opts.theme);
978
982
  const lang = resolveLang(opts.lang);
979
983
  const updates = opts.updates !== false;
980
- const ask = resolveAsk(opts.ask);
984
+ const ask = resolveBridge('ask', opts.ask);
985
+ const openBridge = resolveBridge('open', opts.open);
981
986
  const token = randomBytes(32).toString('base64url');
982
987
  const serial = writeQueue();
983
988
  const readings = new Map();
@@ -1809,17 +1814,45 @@ export function createPanelHandler(opts) {
1809
1814
  };
1810
1815
  },
1811
1816
  },
1812
- // Opens the Account's Host settings file with the system's default program (spec §3.30, ADR-0033). It reads none
1813
- // of the file but starts a program, so a read-only Panel refuses it (writes defaults to true).
1817
+ // Opens the Account's Host settings file with config `editor`, else the system's default program (spec §3.30,
1818
+ // ADR-0033). It reads none of the file but starts a program, so a read-only Panel refuses it (writes defaults to
1819
+ // true). `open: false` (the open bridge) starts nothing and adds `realPath`, the real file's absolute path, for the
1820
+ // Portal to open.
1814
1821
  '/api/account/edit-settings': {
1815
1822
  async run(body) {
1816
1823
  const account = optString(body, 'account');
1817
1824
  if (!account)
1818
1825
  throw new HttpError(400, '"account" is required');
1826
+ if (body.open !== undefined && typeof body.open !== 'boolean')
1827
+ throw new HttpError(400, '"open" must be true or false');
1819
1828
  const rt = await getRuntime();
1820
- const r = await editSettings(rt, account);
1829
+ const open = body.open !== false;
1830
+ const r = await editSettings(rt, account, { open });
1821
1831
  const home = rt.paths.home;
1822
- return { ...r, path: tildify(r.path, home), ...(r.target ? { target: tildify(r.target, home) } : {}) };
1832
+ return {
1833
+ ...r,
1834
+ path: tildify(r.path, home),
1835
+ ...(r.target ? { target: tildify(r.target, home) } : {}),
1836
+ // The file's real path even when the account directory itself is a link (only then is `target` unset).
1837
+ ...(open ? {} : { realPath: await realpath(r.path) }),
1838
+ };
1839
+ },
1840
+ },
1841
+ // The editor "Open settings.json" uses: config `editor` (spec §3.30); `system` or null removes the key.
1842
+ '/api/editor': {
1843
+ async run(body) {
1844
+ const editor = body.editor;
1845
+ if (editor !== null && !isEditor(editor))
1846
+ throw new HttpError(400, `"editor" must be one of ${EDITORS.join(', ')} or null`);
1847
+ const rt = await getRuntime();
1848
+ const chosen = editor === null || editor === 'system' ? undefined : editor;
1849
+ const r = await editConfigPath(rt.paths.configFile, 'editor', chosen);
1850
+ // A Panel given one Runtime keeps using it: the next open and /api/state read the new choice from it.
1851
+ if (chosen === undefined)
1852
+ delete rt.config.editor;
1853
+ else
1854
+ rt.config.editor = chosen;
1855
+ return { changed: r.changed, editor: r.after ?? 'system' };
1823
1856
  },
1824
1857
  },
1825
1858
  // Unattended Mode (spec §3.37): the page's status and Pending Decisions. A read-only Panel reads them too.
@@ -2337,6 +2370,7 @@ export function createPanelHandler(opts) {
2337
2370
  lang,
2338
2371
  updates,
2339
2372
  ...(ask ? { ask } : {}),
2373
+ ...(openBridge ? { open: openBridge } : {}),
2340
2374
  ...(panel ? { panel } : {}),
2341
2375
  }));
2342
2376
  return true;
@@ -159,6 +159,8 @@ declare const en: {
159
159
  'need.health-fail.other': string;
160
160
  'need.signed-out.one': string;
161
161
  'need.signed-out.other': string;
162
+ 'need.login-expired.one': string;
163
+ 'need.login-expired.other': string;
162
164
  'need.not-installed.one': string;
163
165
  'need.not-installed.other': string;
164
166
  'need.quota-high.one': string;
@@ -168,6 +170,7 @@ declare const en: {
168
170
  'why.error': string;
169
171
  'why.health-fail': string;
170
172
  'why.signed-out': string;
173
+ 'why.login-expired': string;
171
174
  'why.not-installed': string;
172
175
  'why.broken': string;
173
176
  'why.quota-high': string;
@@ -272,6 +275,18 @@ declare const en: {
272
275
  'acct.api': string;
273
276
  'acct.model': string;
274
277
  'acct.signedOut': string;
278
+ 'acct.expired': string;
279
+ 'acct.expiredIn': string;
280
+ 'acct.expiredWaiting': string;
281
+ 'acct.expiredHint': string;
282
+ 'acct.expiredWaitingHint': string;
283
+ 'acct.expiredSince': string;
284
+ 'acct.signInAgain': string;
285
+ 'acct.signInName': string;
286
+ 'exp.banner.one': string;
287
+ 'exp.banner.other': string;
288
+ 'exp.signIn': string;
289
+ 'exp.signInRef': string;
275
290
  'acct.signInHint': string;
276
291
  'acct.signedOutLabel': string;
277
292
  'acct.next': string;
@@ -456,6 +471,7 @@ declare const en: {
456
471
  'ai.ask.handoffRules': string;
457
472
  'ai.ask.rc': string;
458
473
  'ai.ask.relogin': string;
474
+ 'ai.ask.expired': string;
459
475
  'ai.orderHint': string;
460
476
  'ai.emptyHint': string;
461
477
  'ai.how': string;
@@ -753,6 +769,8 @@ declare const en: {
753
769
  'edit.opened': string;
754
770
  'edit.shared': string;
755
771
  'edit.failed': string;
772
+ 'edit.openedWith': string;
773
+ 'edit.noPath': string;
756
774
  'menu.like': string;
757
775
  'menu.tune': string;
758
776
  'menu.model': string;
@@ -1346,6 +1364,11 @@ declare const en: {
1346
1364
  'set.button': string;
1347
1365
  'set.lang': string;
1348
1366
  'set.theme': string;
1367
+ 'set.editor': string;
1368
+ 'set.editor.system': string;
1369
+ 'set.editor.hint': string;
1370
+ 'set.editor.portal': string;
1371
+ 'set.editor.saved': string;
1349
1372
  'set.theme.system': string;
1350
1373
  'set.theme.light': string;
1351
1374
  'set.theme.dark': string;
@@ -161,6 +161,8 @@ const en = {
161
161
  'need.health-fail.other': '{n} with issues',
162
162
  'need.signed-out.one': '{n} signed out',
163
163
  'need.signed-out.other': '{n} signed out',
164
+ 'need.login-expired.one': '{n} sign-in expired',
165
+ 'need.login-expired.other': '{n} sign-ins expired',
164
166
  'need.not-installed.one': '{n} tool missing',
165
167
  'need.not-installed.other': '{n} tool missing',
166
168
  'need.quota-high.one': '{n} near limit',
@@ -170,6 +172,7 @@ const en = {
170
172
  'why.error': 'unreadable',
171
173
  'why.health-fail': 'Health check found issues',
172
174
  'why.signed-out': 'signed out',
175
+ 'why.login-expired': 'sign-in expired',
173
176
  'why.not-installed': 'tool not installed',
174
177
  'why.broken': 'tool install broken',
175
178
  'why.quota-high': '{label} at {pct}% (warns from {warn}%)',
@@ -274,6 +277,18 @@ const en = {
274
277
  'acct.api': 'API',
275
278
  'acct.model': 'Model',
276
279
  'acct.signedOut': 'Signed out',
280
+ 'acct.expired': 'Sign-in expired',
281
+ 'acct.expiredIn': 'Sign-in expired: {name}',
282
+ 'acct.expiredWaiting': 'Sign-in finished, waiting for confirmation',
283
+ 'acct.expiredHint': '{ref}: Claude Code said its sign-in expired{since}. Sign in again to use it; sideby will not pick it until then.',
284
+ 'acct.expiredWaitingHint': '{ref}: the sign-in finished. The mark goes away after its next session or quota check confirms it.',
285
+ 'acct.expiredSince': ' at {time}',
286
+ 'acct.signInAgain': 'Sign in again',
287
+ 'acct.signInName': 'Sign in {name}',
288
+ 'exp.banner.one': '{refs}: sign-in expired. Sign in again to use it; until then sideby will not pick it.',
289
+ 'exp.banner.other': '{refs}: sign-ins expired. Sign in again to use them; until then sideby will not pick them.',
290
+ 'exp.signIn': 'Sign in again',
291
+ 'exp.signInRef': 'Sign in {ref} again',
277
292
  'acct.signInHint': 'Copy the sign-in command',
278
293
  'acct.signedOutLabel': '{ref} is signed out: copy the sign-in command',
279
294
  'acct.next': 'Suggested',
@@ -458,6 +473,7 @@ const en = {
458
473
  'ai.ask.handoffRules': 'When does Auto Handoff switch accounts, and could it use my API accounts?',
459
474
  'ai.ask.rc': 'Turn off Remote Control for every Claude account.',
460
475
  'ai.ask.relogin': 'Two of my accounts are the same login; help me sign one in with another account.',
476
+ 'ai.ask.expired': 'Which of my accounts has an expired sign-in? Help me sign it in again.',
461
477
  'ai.orderHint': 'or ask your AI',
462
478
  'ai.emptyHint': 'Or let your AI assistant set it up for you.',
463
479
  'ai.how': 'How',
@@ -755,6 +771,8 @@ const en = {
755
771
  'edit.opened': 'Opened {ref}’s {file} with your default program.',
756
772
  'edit.shared': 'This file is shared: a change also applies to {names}.',
757
773
  'edit.failed': 'Could not open {file} for {ref}: {msg}',
774
+ 'edit.openedWith': 'Opened {ref}’s {file} in {app}.',
775
+ 'edit.noPath': 'the panel did not get the file’s path; reload the page and try again',
758
776
  'menu.like': 'New account like this',
759
777
  'menu.tune': 'Context tuning',
760
778
  'menu.model': 'Model and effort…',
@@ -1348,6 +1366,11 @@ const en = {
1348
1366
  'set.button': 'Settings',
1349
1367
  'set.lang': 'Language',
1350
1368
  'set.theme': 'Light or dark',
1369
+ 'set.editor': 'Open settings files in',
1370
+ 'set.editor.system': 'Default app',
1371
+ 'set.editor.hint': 'Used by “Open settings.json” in each account’s ⋯ menu and by sideby edit. Pick your editor if the default app shows a window but not the file.',
1372
+ 'set.editor.portal': 'On this page the file opens in the app chosen under “Open in” of the page around the panel; this choice is for sideby edit and the panel opened on its own.',
1373
+ 'set.editor.saved': 'Settings files now open in {app}.',
1351
1374
  'set.theme.system': 'System',
1352
1375
  'set.theme.light': 'Light',
1353
1376
  'set.theme.dark': 'Dark',
@@ -1788,6 +1811,8 @@ const zh = {
1788
1811
  'need.health-fail.other': '{n} 个有问题',
1789
1812
  'need.signed-out.one': '{n} 个未登录',
1790
1813
  'need.signed-out.other': '{n} 个未登录',
1814
+ 'need.login-expired.one': '{n} 个登录已过期',
1815
+ 'need.login-expired.other': '{n} 个登录已过期',
1791
1816
  'need.not-installed.one': '{n} 个缺少工具',
1792
1817
  'need.not-installed.other': '{n} 个缺少工具',
1793
1818
  'need.quota-high.one': '{n} 个接近上限',
@@ -1797,6 +1822,7 @@ const zh = {
1797
1822
  'why.error': '读取失败',
1798
1823
  'why.health-fail': '体检发现问题',
1799
1824
  'why.signed-out': '未登录',
1825
+ 'why.login-expired': '登录已过期',
1800
1826
  'why.not-installed': '缺少工具',
1801
1827
  'why.broken': '工具安装已损坏',
1802
1828
  'why.quota-high': '{label} 已用 {pct}%({warn}% 起提醒)',
@@ -1901,6 +1927,18 @@ const zh = {
1901
1927
  'acct.api': 'API',
1902
1928
  'acct.model': '模型',
1903
1929
  'acct.signedOut': '未登录',
1930
+ 'acct.expired': '登录已过期',
1931
+ 'acct.expiredIn': '登录已过期:{name}',
1932
+ 'acct.expiredWaiting': '已重新登录,等待确认',
1933
+ 'acct.expiredHint': '{ref}:Claude Code 说它的登录已过期{since}。重新登录后才能用;在那之前 sideby 不会选它。',
1934
+ 'acct.expiredWaitingHint': '{ref}:登录已完成。下一次会话或额度查询确认后,这个标记会消失。',
1935
+ 'acct.expiredSince': '({time})',
1936
+ 'acct.signInAgain': '重新登录',
1937
+ 'acct.signInName': '重新登录 {name}',
1938
+ 'exp.banner.one': '{refs} 的登录已过期。重新登录后才能用;在那之前 sideby 不会选它。',
1939
+ 'exp.banner.other': '{refs} 的登录已过期。重新登录后才能用;在那之前 sideby 不会选它们。',
1940
+ 'exp.signIn': '重新登录',
1941
+ 'exp.signInRef': '重新登录 {ref}',
1904
1942
  'acct.signInHint': '复制登录命令',
1905
1943
  'acct.signedOutLabel': '{ref} 未登录:复制登录命令',
1906
1944
  'acct.next': '建议使用',
@@ -2085,6 +2123,7 @@ const zh = {
2085
2123
  'ai.ask.handoffRules': '自动接力什么时候换号?会不会用到我的 API 账号?',
2086
2124
  'ai.ask.rc': '把所有 Claude 账号的远程控制关掉。',
2087
2125
  'ai.ask.relogin': '我有两个账号登录的是同一个号,帮我把其中一个换成别的账号。',
2126
+ 'ai.ask.expired': '哪个账号登录过期了?帮我重新登录。',
2088
2127
  'ai.orderHint': '也可以让 AI 帮你排',
2089
2128
  'ai.emptyHint': '也可以让你的 AI 编程助手帮你装好、加账号。',
2090
2129
  'ai.how': '怎么做',
@@ -2382,6 +2421,8 @@ const zh = {
2382
2421
  'edit.opened': '已用默认程序打开 {ref} 的 {file}。',
2383
2422
  'edit.shared': '这个文件是共用的,改动对 {names} 也生效。',
2384
2423
  'edit.failed': '没能打开 {ref} 的 {file}:{msg}',
2424
+ 'edit.openedWith': '已用 {app} 打开 {ref} 的 {file}。',
2425
+ 'edit.noPath': '面板没拿到文件路径;刷新页面后再试一次',
2385
2426
  'menu.like': '照此新建账号',
2386
2427
  'menu.tune': '上下文调优',
2387
2428
  'menu.model': '模型和 effort…',
@@ -2975,6 +3016,11 @@ const zh = {
2975
3016
  'set.button': '设置',
2976
3017
  'set.lang': '语言',
2977
3018
  'set.theme': '明暗',
3019
+ 'set.editor': '设置文件用什么打开',
3020
+ 'set.editor.system': '默认程序',
3021
+ 'set.editor.hint': '账号「⋯」菜单里的「打开 settings.json」和 sideby edit 都用它。默认程序只弹出窗口、没打开文件时,选你的编辑器。',
3022
+ 'set.editor.portal': '在这个页面里,文件用外层页面「打开方式」里选的应用打开;这里的选择给 sideby edit 和单独打开的面板用。',
3023
+ 'set.editor.saved': '设置文件改为用 {app} 打开。',
2978
3024
  'set.theme.system': '跟随系统',
2979
3025
  'set.theme.light': '浅色',
2980
3026
  'set.theme.dark': '深色',
@@ -33,6 +33,12 @@ export interface LogicAccount {
33
33
  };
34
34
  /** The other Accounts of its Same Login (spec §3.21). */
35
35
  sameLogin?: string[];
36
+ /** Its Expired Login (ADR-0071). */
37
+ loginProblem?: {
38
+ kind: string;
39
+ since?: string;
40
+ signedInAt?: string;
41
+ };
36
42
  usage?: LogicUsage;
37
43
  }
38
44
  /** The parts of an Account's usage the helpers read. */
@@ -116,7 +122,8 @@ export declare function passedWindow(w: {
116
122
  /** The fullest live Quota window in percent, or -1 when the Account has no Quota data. */
117
123
  export declare function quotaPressure(a: LogicAccount, now: number): number;
118
124
  /**
119
- * Why an Account needs a look, most serious first: `error`, `health-fail`, `signed-out`, `not-installed`,
125
+ * Why an Account needs a look, most serious first: `error`, `health-fail`, `signed-out`, `login-expired` (ADR-0071),
126
+ * `not-installed`,
120
127
  * `quota-high` (a live window at or over the warning level), `health-warn`. Empty when all is well. A Quota read from
121
128
  * another Account of the same login (`quota.from`, spec §3.21) is that Account's warning, so it counts once per group.
122
129
  */
@@ -134,13 +141,18 @@ longWarn?: number): string[];
134
141
  export declare function quotaHighLevel(a: LogicAccount, now: number, fail: number, longFail?: number): 'warn' | 'fail';
135
142
  /**
136
143
  * The one status badge an account row shows after its name (spec §3.27), most important first: `health-fail`
137
- * (needs fixing), `quota-high` (running low), the other attention labels (`signed-out`, `not-installed`,
144
+ * (needs fixing; an Expired Login, `login-expired`, before it), `quota-high` (running low), the other attention labels (`signed-out`, `not-installed`,
138
145
  * `health-warn`), then `next` (recommended) and last `api`. Null when none applies. `reasons` are attentionReasons'.
139
146
  */
140
147
  export declare function rowBadge(reasons: string[], opts: {
141
148
  next?: boolean;
142
149
  api?: boolean;
143
150
  }): string | null;
151
+ /**
152
+ * The Accounts whose sign-in expired (ADR-0071), API Accounts never, in the order given: what the Panel's summary
153
+ * banner names. Its content changes only when this list does, so a refresh with the same answer redraws nothing.
154
+ */
155
+ export declare function expiredLogins<T extends LogicAccount>(accounts: readonly T[]): T[];
144
156
  /**
145
157
  * The most serious reason an Account needs a look, as a message key and its values for the Panel to show where the
146
158
  * attention count is: `why.<reason>`; for `quota-high` the fullest live window at or over `warn`, with its label and
@@ -717,6 +729,36 @@ export declare function askBridge(boot: {
717
729
  origin: string;
718
730
  };
719
731
  }): boolean;
732
+ /**
733
+ * Whether "Open settings.json" hands the file to the Portal around the Panel (spec §3.30, ADR-0033 amendment):
734
+ * createPanelHandler was given `open: { bridge: 'postMessage' }` and the page sits in a frame. A Panel opened on its
735
+ * own is its own parent; its server opens the file.
736
+ */
737
+ export declare function openBridged(boot: {
738
+ open?: {
739
+ bridge?: string;
740
+ } | null;
741
+ }, win: {
742
+ parent: unknown;
743
+ }): boolean;
744
+ /**
745
+ * Hands a file to the Portal around the Panel when `openBridged` says so: posts
746
+ * `{ type: 'local-tools:open', version: 1, path }` (an absolute path, never the file's content) to the parent with the
747
+ * Panel's own origin as the target, and says it did. Otherwise, or for a path that is not absolute, posts nothing and
748
+ * returns false.
749
+ */
750
+ export declare function openBridge(boot: {
751
+ open?: {
752
+ bridge?: string;
753
+ } | null;
754
+ }, path: unknown, win: {
755
+ parent: {
756
+ postMessage(message: unknown, targetOrigin: string): void;
757
+ } | null;
758
+ location: {
759
+ origin: string;
760
+ };
761
+ }): boolean;
720
762
  /**
721
763
  * Whether a `message` event asks the Panel to read its state again (ADR-0006, 2026-11-02 amendment): the Portal around
722
764
  * it changed something the Panel shows (its own Unattended switch, say) and posted
@@ -181,7 +181,8 @@ export function quotaPressure(a, now) {
181
181
  return windows.length && max < 0 ? 0 : max;
182
182
  }
183
183
  /**
184
- * Why an Account needs a look, most serious first: `error`, `health-fail`, `signed-out`, `not-installed`,
184
+ * Why an Account needs a look, most serious first: `error`, `health-fail`, `signed-out`, `login-expired` (ADR-0071),
185
+ * `not-installed`,
185
186
  * `quota-high` (a live window at or over the warning level), `health-warn`. Empty when all is well. A Quota read from
186
187
  * another Account of the same login (`quota.from`, spec §3.21) is that Account's warning, so it counts once per group.
187
188
  */
@@ -195,6 +196,8 @@ longWarn = warn) {
195
196
  out.push('health-fail');
196
197
  if (a.login === 'logged-out' && a.kind !== 'api')
197
198
  out.push('signed-out');
199
+ else if (a.loginProblem?.kind === 'expired' && a.kind !== 'api')
200
+ out.push('login-expired');
198
201
  if (a.hostInstalled === false)
199
202
  out.push('not-installed');
200
203
  const q = a.quota;
@@ -236,11 +239,19 @@ export function quotaHighLevel(a, now, fail, longFail = fail) {
236
239
  }
237
240
  /**
238
241
  * The one status badge an account row shows after its name (spec §3.27), most important first: `health-fail`
239
- * (needs fixing), `quota-high` (running low), the other attention labels (`signed-out`, `not-installed`,
242
+ * (needs fixing; an Expired Login, `login-expired`, before it), `quota-high` (running low), the other attention labels (`signed-out`, `not-installed`,
240
243
  * `health-warn`), then `next` (recommended) and last `api`. Null when none applies. `reasons` are attentionReasons'.
241
244
  */
242
245
  export function rowBadge(reasons, opts) {
243
- for (const r of ['health-fail', 'quota-high', 'signed-out', 'not-installed', 'health-warn'])
246
+ // An Expired Login comes first: the account cannot start, so its quota or health says little (ADR-0071).
247
+ for (const r of [
248
+ 'login-expired',
249
+ 'health-fail',
250
+ 'quota-high',
251
+ 'signed-out',
252
+ 'not-installed',
253
+ 'health-warn',
254
+ ])
244
255
  if (reasons.includes(r))
245
256
  return r;
246
257
  if (opts.next)
@@ -249,6 +260,13 @@ export function rowBadge(reasons, opts) {
249
260
  return 'api';
250
261
  return null;
251
262
  }
263
+ /**
264
+ * The Accounts whose sign-in expired (ADR-0071), API Accounts never, in the order given: what the Panel's summary
265
+ * banner names. Its content changes only when this list does, so a refresh with the same answer redraws nothing.
266
+ */
267
+ export function expiredLogins(accounts) {
268
+ return accounts.filter((a) => a.kind !== 'api' && a.loginProblem?.kind === 'expired');
269
+ }
252
270
  /**
253
271
  * The most serious reason an Account needs a look, as a message key and its values for the Panel to show where the
254
272
  * attention count is: `why.<reason>`; for `quota-high` the fullest live window at or over `warn`, with its label and
@@ -1264,6 +1282,28 @@ export function askBridge(boot, opts, win) {
1264
1282
  }, win.location.origin);
1265
1283
  return true;
1266
1284
  }
1285
+ /**
1286
+ * Whether "Open settings.json" hands the file to the Portal around the Panel (spec §3.30, ADR-0033 amendment):
1287
+ * createPanelHandler was given `open: { bridge: 'postMessage' }` and the page sits in a frame. A Panel opened on its
1288
+ * own is its own parent; its server opens the file.
1289
+ */
1290
+ export function openBridged(boot, win) {
1291
+ return boot.open?.bridge === 'postMessage' && Boolean(win.parent) && win.parent !== win;
1292
+ }
1293
+ /**
1294
+ * Hands a file to the Portal around the Panel when `openBridged` says so: posts
1295
+ * `{ type: 'local-tools:open', version: 1, path }` (an absolute path, never the file's content) to the parent with the
1296
+ * Panel's own origin as the target, and says it did. Otherwise, or for a path that is not absolute, posts nothing and
1297
+ * returns false.
1298
+ */
1299
+ export function openBridge(boot, path, win) {
1300
+ if (!openBridged(boot, win) || !win.parent)
1301
+ return false;
1302
+ if (typeof path !== 'string' || !/^(\/|[A-Za-z]:[\\/])/.test(path))
1303
+ return false;
1304
+ win.parent.postMessage({ type: 'local-tools:open', version: 1, path }, win.location.origin);
1305
+ return true;
1306
+ }
1267
1307
  /**
1268
1308
  * Whether a `message` event asks the Panel to read its state again (ADR-0006, 2026-11-02 amendment): the Portal around
1269
1309
  * it changed something the Panel shows (its own Unattended switch, say) and posted