sideby 0.21.0 → 0.23.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 (97) hide show
  1. package/README.md +1 -0
  2. package/ai-tasks.json +14 -0
  3. package/dist/build.json +1 -1
  4. package/dist/src/cli/commands.d.ts +7 -0
  5. package/dist/src/cli/commands.js +441 -31
  6. package/dist/src/cli/format.js +3 -2
  7. package/dist/src/cli/json-schemas.js +157 -47
  8. package/dist/src/cli/main.js +38 -7
  9. package/dist/src/core/accounts.d.ts +6 -1
  10. package/dist/src/core/accounts.js +16 -3
  11. package/dist/src/core/ask.d.ts +2 -1
  12. package/dist/src/core/ask.js +12 -4
  13. package/dist/src/core/claude-settings-file.d.ts +57 -0
  14. package/dist/src/core/claude-settings-file.js +104 -2
  15. package/dist/src/core/config.d.ts +34 -16
  16. package/dist/src/core/config.js +58 -5
  17. package/dist/src/core/create.js +4 -1
  18. package/dist/src/core/desktop-app.js +5 -1
  19. package/dist/src/core/handoff-overview.d.ts +4 -1
  20. package/dist/src/core/handoff-overview.js +3 -2
  21. package/dist/src/core/handoff-rules.d.ts +34 -0
  22. package/dist/src/core/handoff-rules.js +115 -0
  23. package/dist/src/core/handoff-select.js +45 -28
  24. package/dist/src/core/handoff-status.d.ts +37 -7
  25. package/dist/src/core/handoff-status.js +95 -19
  26. package/dist/src/core/handoff.d.ts +4 -1
  27. package/dist/src/core/handoff.js +8 -5
  28. package/dist/src/core/inbound.d.ts +11 -3
  29. package/dist/src/core/inbound.js +26 -74
  30. package/dist/src/core/launch.js +6 -4
  31. package/dist/src/core/quota-levels.d.ts +13 -2
  32. package/dist/src/core/quota-levels.js +21 -3
  33. package/dist/src/core/remote-control.d.ts +10 -12
  34. package/dist/src/core/remote-control.js +29 -86
  35. package/dist/src/core/themes.d.ts +107 -0
  36. package/dist/src/core/themes.js +463 -0
  37. package/dist/src/core/tuning-apply.js +12 -20
  38. package/dist/src/families/agy/index.d.ts +8 -0
  39. package/dist/src/families/agy/index.js +53 -0
  40. package/dist/src/families/agy/quota.d.ts +9 -0
  41. package/dist/src/families/agy/quota.js +110 -0
  42. package/dist/src/families/index.js +7 -0
  43. package/dist/src/families/logos.d.ts +10 -0
  44. package/dist/src/families/logos.js +12 -1
  45. package/dist/src/menubar/script.js +26 -3
  46. package/dist/src/menubar/snapshot.d.ts +33 -6
  47. package/dist/src/menubar/snapshot.js +138 -43
  48. package/dist/src/menubar/strings.d.ts +18 -2
  49. package/dist/src/menubar/strings.js +18 -2
  50. package/dist/src/panel/handler.d.ts +4 -1
  51. package/dist/src/panel/handler.js +206 -46
  52. package/dist/src/panel/i18n.d.ts +106 -7
  53. package/dist/src/panel/i18n.js +260 -62
  54. package/dist/src/panel/page-logic.d.ts +67 -20
  55. package/dist/src/panel/page-logic.js +74 -7
  56. package/dist/src/panel/page-script.js +522 -124
  57. package/dist/src/panel/page-styles.d.ts +2 -0
  58. package/dist/src/panel/page-styles.js +157 -34
  59. package/dist/src/panel/page.js +3 -3
  60. package/dist/src/panel/theme.d.ts +6 -1
  61. package/dist/src/panel/theme.js +4 -0
  62. package/dist/src/panel/themes.d.ts +14 -0
  63. package/dist/src/panel/themes.js +162 -0
  64. package/dist/src/plugins/check.js +27 -13
  65. package/dist/src/plugins/loader.d.ts +11 -0
  66. package/dist/src/plugins/loader.js +47 -1
  67. package/dist/src/runtime.d.ts +9 -2
  68. package/dist/src/runtime.js +12 -5
  69. package/dist/src/types.d.ts +35 -5
  70. package/package.json +2 -2
  71. package/schemas/config.json +45 -2
  72. package/schemas/families.json +13 -5
  73. package/schemas/handoff-disable.json +22 -0
  74. package/schemas/handoff-enable.json +22 -0
  75. package/schemas/handoff-rules.json +302 -0
  76. package/schemas/handoff-status.json +26 -0
  77. package/schemas/hide.json +157 -0
  78. package/schemas/list.json +15 -0
  79. package/schemas/menubar-snapshot.json +309 -2
  80. package/schemas/order.json +26 -1
  81. package/schemas/pin.json +17 -0
  82. package/schemas/theme-check.json +140 -0
  83. package/schemas/theme-export.json +86 -0
  84. package/schemas/theme-import.json +92 -0
  85. package/schemas/theme-preview.json +86 -0
  86. package/schemas/theme-remove.json +87 -0
  87. package/schemas/theme-use.json +88 -0
  88. package/schemas/theme.json +137 -0
  89. package/schemas/unhide.json +157 -0
  90. package/schemas/unpin.json +17 -0
  91. package/skills/sideby/SKILL.md +5 -2
  92. package/skills/sideby/references/accounts.md +1 -0
  93. package/skills/sideby/references/ai-tasks.md +1 -1
  94. package/skills/sideby/references/handoff.md +7 -3
  95. package/skills/sideby/references/panel.md +9 -0
  96. package/skills/sideby/references/quota.md +3 -1
  97. package/skills/sideby/references/themes.md +47 -0
@@ -5,3 +5,5 @@ import { type ResolvedTheme } from './theme.ts';
5
5
  * `data-theme` on the root element.
6
6
  */
7
7
  export declare function pageStyles(theme?: ResolvedTheme): string;
8
+ /** Only the token rules of `pageStyles`: the page swaps them in when the user picks another Theme (spec §3.34). */
9
+ export declare function tokenStyles(theme: ResolvedTheme): string;
@@ -1,11 +1,18 @@
1
1
  // The Panel page's styles: design tokens (a host theme layers its values over them, see theme.ts) and the rules
2
2
  // that read them. Every color, radius and size below comes from a token, so a host theme reaches every component.
3
- import { resolveTheme } from './theme.js';
4
- // Colors defined from other tokens; repeated in both schemes so they follow that scheme's base colors. Dark mode keeps
5
- // the logo tile light: the mark's ink outline (core/brand-mark.ts) needs a light ground.
3
+ import { resolveTheme, THEME_TOKENS } from './theme.js';
4
+ import { BUILTIN_THEMES, DEFAULT_THEME_ID } from './themes.js';
5
+ // The default Theme's colors (spec §3.34): every color token, as declarations for the token blocks below.
6
+ const DEFAULT_THEME = BUILTIN_THEMES.find((t) => t.id === DEFAULT_THEME_ID);
7
+ const colorDecls = (tokens) => Object.entries(tokens)
8
+ .map(([k, v]) => `${THEME_TOKENS[k]}: ${v}`)
9
+ .join('; ');
10
+ // Colors defined from other tokens, before each scheme's Theme colors so a Theme can set them; repeated in both schemes so they follow that scheme's base colors. Dark mode keeps
11
+ // the logo tile light: the mark's ink outline (core/brand-mark.ts) needs a light ground. The mark's body stays the brand
12
+ // blue whatever the Theme (ADR-0050).
6
13
  const DERIVED_COLORS = `
7
14
  --btn-text: var(--text); --btn-hover-text: var(--accent); --check: var(--focus);
8
- --logo-bg: var(--accent-soft); --logo-fg: var(--focus); --logo-line: var(--border);
15
+ --logo-bg: var(--surface-2); --logo-fg: #3f8fc4; --logo-line: var(--border);
9
16
  --focus-outline: 2px solid var(--focus); --focus-ring: none;`;
10
17
  // Design tokens. A host theme (theme.ts) layers its values over these: light values after LIGHT_TOKENS, dark values after
11
18
  // DARK_TOKENS. DARK_TOKENS sets every color token again, so a host's light colors never leak into dark mode, while
@@ -15,34 +22,24 @@ const LIGHT_TOKENS = `
15
22
  --font-size: 14px; --small: 12.5px; --control-size: 13.5px; --heading-size: 15px; --large: 16px; --title-size: 22px;
16
23
  --title-weight: 750; --heading-weight: 650; --strong-weight: 600; --button-weight: 600; --primary-weight: 650;
17
24
  --radius: 14px; --ctl-radius: 8px; --chip-radius: 999px; --ctl-h: 34px; --ctl-h-sm: 28px; --field-h: 36px;
18
- --content-width: 1180px; --gutter: 24px;
19
- --bg: #f2f8fc; --surface: #fcfcfa; --surface-2: #f6fafd; --border: #dce8f0; --border-strong: #c5d7e4;
20
- --text: #15171c; --muted: #555b63; --faint: #8b93a1; --accent: #27658f; --accent-soft: #e5f2fb;
21
- --primary: #d9ebf9; --primary-hover: #cbe3f7; --primary-active: #bcdbf4; --on-primary: #17588a;
22
- --primary-border: #7eb2dd; --primary-hover-border: #5f9dd0; --btn-hover-border: #8fbde3;
23
- --hover: #f0f7fc; --active: #e6f1fa; --focus: #3f8fc4;
24
- --ok: #15803d; --ok-bar: #22c55e; --ok-soft: #e8f7ee; --warn: #b45309; --warn-bar: #f59e0b; --warn-soft: #fdf3e2;
25
- --fail: #c81e1e; --fail-bar: #ef4444; --fail-soft: #fdecec; --track: #e4edf4;
25
+ --content-width: 1180px; --gutter: 24px;${DERIVED_COLORS}
26
26
  --spark: oklch(from var(--accent) clamp(0.55, l, 0.62) max(c, 0.14) h); --spark-soft: oklch(from var(--accent) 0.83 calc(max(c, 0.14) * 0.6) h);
27
- --shadow: 0 1px 2px rgba(16,24,40,.04), 0 2px 8px rgba(16,24,40,.05);
28
- --float-shadow: 0 10px 30px rgba(16,24,40,.14), 0 2px 6px rgba(16,24,40,.06);${DERIVED_COLORS}`;
29
- const DARK_TOKENS = `
30
- --bg: #0e1621; --surface: #141e2a; --surface-2: #111a25; --border: #233244; --border-strong: #30455b;
31
- --text: #e6edf3; --muted: #9aa9b8; --faint: #6b7a8a; --accent: #8cc4ee; --accent-soft: #16314a;
32
- --primary: #1a4366; --primary-hover: #20507a; --primary-active: #265c8a; --on-primary: #dcedfb;
33
- --primary-border: #3d74a3; --primary-hover-border: #4f86b5; --btn-hover-border: #4a7fa8;
34
- --hover: #182736; --active: #1c2f42; --focus: #5aa7dc;
35
- --ok: #4ade80; --ok-bar: #22c55e; --ok-soft: #13291c; --warn: #fbbf24; --warn-bar: #f59e0b; --warn-soft: #2d2410;
36
- --fail: #f87171; --fail-bar: #ef4444; --fail-soft: #331717; --track: #1f2c3a;
27
+ ${colorDecls(DEFAULT_THEME.light)};
28
+ --float-shadow: 0 10px 30px rgba(20,22,24,.14), 0 2px 6px rgba(20,22,24,.06);`;
29
+ const DARK_TOKENS = `${DERIVED_COLORS}
37
30
  --spark: oklch(from var(--accent) clamp(0.7, l, 0.78) max(c, 0.14) h); --spark-soft: oklch(from var(--accent) 0.45 calc(max(c, 0.14) * 0.6) h);
38
- --shadow: 0 1px 2px rgba(0,0,0,.3); --float-shadow: 0 12px 32px rgba(0,0,0,.5), 0 2px 6px rgba(0,0,0,.3);${DERIVED_COLORS}
39
- --logo-bg: #dcebf7; --logo-line: transparent;`;
31
+ ${colorDecls(DEFAULT_THEME.dark)};
32
+ --float-shadow: 0 12px 32px rgba(0,0,0,.5), 0 2px 6px rgba(0,0,0,.3);`;
40
33
  /**
41
34
  * The page's style block: default tokens, the host's tokens over them, then the rules that read them. With
42
35
  * `colorScheme: 'auto'` the page follows the system unless the viewer picked light or dark in the Panel, which sets
43
36
  * `data-theme` on the root element.
44
37
  */
45
38
  export function pageStyles(theme = resolveTheme(undefined)) {
39
+ return tokenStyles(theme) + CSS;
40
+ }
41
+ /** Only the token rules of `pageStyles`: the page swaps them in when the user picks another Theme (spec §3.34). */
42
+ export function tokenStyles(theme) {
46
43
  const rule = (decls, sel = ':root') => (decls.length ? `${sel} { ${decls.join('; ')}; }\n` : '');
47
44
  const scheme = theme.colorScheme === 'auto' ? 'light dark' : theme.colorScheme;
48
45
  let css = `:root {${LIGHT_TOKENS}\n color-scheme: ${scheme};\n}\n${rule(theme.light)}`;
@@ -54,7 +51,7 @@ export function pageStyles(theme = resolveTheme(undefined)) {
54
51
  }
55
52
  else if (theme.colorScheme === 'dark')
56
53
  css += `:root {${DARK_TOKENS}\n}\n${rule(theme.dark)}`;
57
- return css + CSS;
54
+ return css;
58
55
  }
59
56
  const CSS = `
60
57
  * { box-sizing: border-box; }
@@ -107,6 +104,26 @@ code, .mono { font-family: var(--mono); font-size: 0.92em; }
107
104
  .block { margin-bottom: 22px; }
108
105
  .ic { width: 15px; height: 15px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
109
106
 
107
+ /* Themes (spec §3.34): the cards in the Theme dialog, and the short fade while the page takes a new Theme. */
108
+ .theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 12px 0 18px; }
109
+ .theme-card { display: flex; flex-direction: column; gap: 8px; padding: 10px; text-align: left; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: calc(var(--radius) - 4px); cursor: pointer; transition: border-color .15s, box-shadow .15s; }
110
+ .theme-card:hover:not(:disabled) { border-color: var(--btn-hover-border); }
111
+ .theme-card.is-on { border-color: var(--focus); box-shadow: 0 0 0 1px var(--focus); cursor: default; }
112
+ .theme-card:disabled:not(.is-on) { opacity: .6; cursor: default; }
113
+ .theme-card:focus-visible { outline: var(--focus-outline); outline-offset: 2px; }
114
+ .theme-sw { display: flex; height: 28px; border-radius: 6px; overflow: hidden; box-shadow: inset 0 0 0 1px var(--border); }
115
+ .theme-sw span { flex: 1; }
116
+ .theme-name { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-weight: var(--strong-weight); }
117
+ .theme-status { display: flex; align-items: center; gap: 8px; margin: 0 auto 0 0; min-width: 0; color: var(--muted); }
118
+ .theme-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 6px 0; }
119
+ .theme-label { font-weight: var(--strong-weight); }
120
+ .theme-row input[type=color] { width: 40px; height: 30px; padding: 2px; border: 1px solid var(--border-strong); border-radius: var(--ctl-radius); background: var(--surface); cursor: pointer; }
121
+ .theme-files { margin-top: 16px; display: grid; gap: 6px; }
122
+ .theme-file { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; border-top: 1px solid var(--border); }
123
+ .theme-file-name { display: flex; flex-direction: column; min-width: 0; }
124
+ .theme-bad { color: var(--fail); }
125
+ .theme-fade, .theme-fade * { transition: background-color .18s ease, color .18s ease, border-color .18s ease, fill .18s ease !important; }
126
+ @media (prefers-reduced-motion: reduce) { .theme-fade, .theme-fade * { transition: none !important; } }
110
127
  /* Summary: four quiet numbers in one surface. */
111
128
  .summary[hidden], #checkup[hidden] { display: none; }
112
129
  .summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 18px; overflow: hidden; }
@@ -546,15 +563,44 @@ a.btn:hover { text-decoration: none; }
546
563
  .rc-row { padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; display: grid; gap: 2px; }
547
564
  .rc-row code { word-break: break-all; }
548
565
  .banner-actions { display: flex; gap: 8px; flex: none; }
549
- .hp-how { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
566
+ .hp-rules { list-style: none; margin: 0; padding: 0; counter-reset: hp-rule; display: flex; flex-direction: column; }
567
+ .hp-rules > li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--border); }
568
+ .hp-rules > li:last-child { border-bottom: 0; }
569
+ .hp-rule-text::before { counter-increment: hp-rule; content: counter(hp-rule) '. '; color: var(--muted); font-variant-numeric: tabular-nums; }
570
+ .hp-rule-ctl { display: flex; align-items: center; gap: 8px; justify-self: end; }
571
+ .hp-rule-ctl:empty { display: none; }
572
+ .hp-rule-below { grid-column: 1 / -1; margin-top: 8px; }
573
+ .hp-rule-sub { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
574
+ .hp-rules .seg { height: var(--ctl-h-sm); }
575
+ .hp-rules .seg-btn[aria-pressed=true] { background: var(--accent-soft); color: var(--accent); }
576
+ .hp-on-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
577
+ .hp-on-row > p { margin: 0; }
578
+ .hp-ai-order { margin: 0; }
579
+ .hp-ai-order li .title-logo { min-width: 150px; }
580
+ .ah-cross { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px 12px; }
581
+ .ah-fam > summary { cursor: pointer; }
550
582
  .hp-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
551
583
  .hp-steps li { display: flex; gap: 8px; }
552
584
  .hp-steps li::before { content: '•'; color: var(--muted); }
553
585
  .hp-steps li > div { flex: 1; min-width: 0; }
554
586
  .hp-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
555
- .hp-rows li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; padding: 8px 0; border-bottom: 1px solid var(--border); }
587
+ .hp-rows li { display: grid; grid-template-columns: minmax(0, 16rem) 7rem minmax(0, 1fr); align-items: center; column-gap: 14px; padding: 8px 0; border-bottom: 1px solid var(--border); }
556
588
  .hp-rows li:last-child { border-bottom: 0; }
589
+ .hp-rows .num { font-variant-numeric: tabular-nums; }
590
+ .hp-rows li > .num { text-align: end; }
591
+ .hp-recent li { grid-template-columns: minmax(0, 1fr) max-content minmax(0, 12rem); }
592
+ .hp-recent li > .num { white-space: nowrap; }
557
593
  #handoff-page > * + * { margin-top: 12px; }
594
+ #handoff-page > h3 { margin-top: 28px; }
595
+ #handoff-page > h3 + * { margin-top: 8px; }
596
+ :where(:root[data-width=narrow], :root[data-width=phone]) {
597
+ .hp-rows li { grid-template-columns: minmax(0, 1fr) auto; row-gap: 2px; }
598
+ .hp-rows li > :last-child { grid-column: 1 / -1; }
599
+ .hp-rules > li { grid-template-columns: minmax(0, 1fr); row-gap: 8px; }
600
+ .hp-rule-ctl { justify-self: start; }
601
+ .hp-rule-sub { justify-content: flex-start; }
602
+ .hp-rows li > .num { text-align: start; }
603
+ }
558
604
  /* Sessions page (spec §3.32): one row per Live Session; a Session that needs the user gets the warning tint. */
559
605
  #sessions-page > * + * { margin-top: 12px; }
560
606
  .sess-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; column-gap: 12px; padding: 11px 10px 11px 16px; border-top: 1px solid var(--border); transition: background-color .15s; }
@@ -618,7 +664,8 @@ a.btn:hover { text-decoration: none; }
618
664
  .ah-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
619
665
  .disabled-why { color: var(--muted); font-size: var(--small); margin-top: 10px; }
620
666
  .actions { display: flex; gap: 8px; flex-wrap: wrap; }
621
- .spin { display: inline-block; width: 13px; height: 13px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; vertical-align: -2px; flex: none; }
667
+ /* A thin ring with an arc that fades out behind its head: lighter than a thick broken circle at text size. */
668
+ .spin { display: inline-block; width: 14px; height: 14px; border-radius: 50%; background: conic-gradient(from 0deg, transparent 0 8%, color-mix(in srgb, currentColor 18%, transparent) 30%, currentColor); -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 1.75px), #000 calc(100% - 1.5px)); mask: radial-gradient(farthest-side, transparent calc(100% - 1.75px), #000 calc(100% - 1.5px)); animation: spin .75s linear infinite; vertical-align: -2px; flex: none; }
622
669
  @keyframes spin { to { transform: rotate(360deg); } }
623
670
  .copy { display: flex; align-items: center; gap: 6px; max-width: 100%; min-width: 0; }
624
671
  .copy code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 7px; padding: 3px 8px; overflow-x: auto; white-space: nowrap; color: var(--text); min-width: 0; }
@@ -989,7 +1036,7 @@ select:is(:hover, :focus) { --chevron: var(--text); }
989
1036
  .hist-group { display: flex; flex-direction: column; gap: 4px; }
990
1037
  .hist-group + .hist-group { margin-top: 10px; }
991
1038
  .hist-group.is-folded + .hist-group.is-folded { margin-top: 0; }
992
- .hist-ghead { display: flex; align-items: center; min-width: 0; }
1039
+ .hist-ghead { display: flex; align-items: center; min-width: 0; padding-left: 14px; }
993
1040
  .hist-gtoggle { max-width: 100%; padding: 3px 8px 3px 2px; font-size: var(--small); font-weight: var(--strong-weight); }
994
1041
  .hist-gtitle { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
995
1042
  .hist-gtoggle .spin { width: 12px; height: 12px; }
@@ -1014,7 +1061,7 @@ select:is(:hover, :focus) { --chevron: var(--text); }
1014
1061
  /* Inner scroll boxes get a thin bar in the theme's colours; the side list shows it only while the pointer is on it. */
1015
1062
  :is(.hist-side, .hv-msgs, .diff, .dlg-body, .menu) { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
1016
1063
  .hist-side:not(:hover, :focus-within) { scrollbar-color: transparent transparent; }
1017
- .hist-side-h { margin: 0 0 2px 10px; font-size: 11.5px; font-weight: var(--strong-weight); color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
1064
+ .hist-side-h { margin: 0 0 2px 10px; font-size: var(--small); font-weight: 400; color: var(--muted); }
1018
1065
  .hist-projs { display: flex; flex-direction: column; gap: 1px; }
1019
1066
  .hist-proj { display: flex; align-items: center; gap: 6px; width: 100%; padding: 5px 10px; border: 0; border-radius: var(--ctl-radius); background: transparent; color: var(--muted); font: inherit; font-size: var(--small); text-align: left; cursor: pointer; transition: background-color .12s, color .12s; }
1020
1067
  .hist-proj:hover { background: var(--hover); color: var(--text); }
@@ -1056,7 +1103,7 @@ select:is(:hover, :focus) { --chevron: var(--text); }
1056
1103
  .hist-mi-wrap { display: flex; flex-wrap: wrap; align-items: center; row-gap: 2px; margin-left: -14px; }
1057
1104
  .hist-mi { display: inline-flex; align-items: center; min-width: 0; max-width: 100%; }
1058
1105
  .hist-mi::before { content: '·'; flex: none; width: 14px; text-align: center; opacity: .7; }
1059
- .hist-meta b { color: var(--text); font-weight: var(--strong-weight); }
1106
+ .hist-meta b { color: var(--text); font-weight: 500; }
1060
1107
  .hist-pname, .hist-branch { min-width: 0; max-width: 18em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
1061
1108
  .hist-age { white-space: nowrap; }
1062
1109
  .hist-snip { color: var(--muted); font-size: var(--small); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
@@ -1114,7 +1161,8 @@ select:is(:hover, :focus) { --chevron: var(--text); }
1114
1161
  :where(:root[data-width=narrow], :root[data-width=phone]) .hist-grid { grid-template-columns: minmax(0, 1fr); }
1115
1162
  :where(:root[data-width=narrow], :root[data-width=phone]) .hist-side { position: static; max-height: none; flex-direction: row; align-items: center; overflow-x: auto; }
1116
1163
  :where(:root[data-width=narrow], :root[data-width=phone]) .hist-side-h { display: none; }
1117
- :where(:root[data-width=narrow], :root[data-width=phone]) .hist-projs { flex-direction: row; gap: 4px; }
1164
+ :where(:root[data-width=narrow], :root[data-width=phone]) .hist-projs { flex-direction: row; align-items: center; gap: 4px; }
1165
+ :where(:root[data-width=narrow], :root[data-width=phone]) .hist-catbody > .hist-catps { flex-direction: row; overflow: visible; }
1118
1166
  :where(:root[data-width=narrow], :root[data-width=phone]) .hist-proj { width: auto; flex: none; max-width: 16em; }
1119
1167
  :where(:root[data-width=narrow], :root[data-width=phone]) :is(.hist-catgrp, .hist-catps) { flex-direction: row; display: flex; gap: 4px; margin-top: 0; }
1120
1168
  :where(:root[data-width=narrow], :root[data-width=phone]) .hist-catps .hist-proj { padding-left: 10px; }
@@ -1153,9 +1201,84 @@ select:is(:hover, :focus) { --chevron: var(--text); }
1153
1201
  .dialog.dialog-top { margin-top: min(12vh, 96px); max-height: calc(100vh - min(12vh, 96px) - 24px); }
1154
1202
  .dialog:not([open]) { opacity: 0; transform: translateY(4px) scale(.985); pointer-events: none; }
1155
1203
  .dialog:not([open])::backdrop { opacity: 0; }
1204
+ /* Page tabs (2026-10-21): underline tabs across the content width, as GitHub and Vercel draw them. The selected page
1205
+ is in full text color with its mark in the accent and a 2px accent line under it; the others are muted. Each label
1206
+ reserves its bold width, so picking a tab never moves the ones after it. */
1207
+ .pages { margin: 2px 0 22px; }
1208
+ .tabs { display: flex; align-items: flex-end; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
1209
+ .tab { position: relative; isolation: isolate; display: inline-flex; align-items: center; gap: 7px; flex: none; height: 44px; padding: 0 12px; border: 0; background: none; color: var(--muted); font: inherit; font-size: var(--font-size); font-weight: 500; white-space: nowrap; cursor: pointer; transition: color .12s; }
1210
+ .tab::before { content: ""; position: absolute; inset: 6px 2px 7px; z-index: -1; border-radius: var(--ctl-radius); background: var(--hover); opacity: 0; transition: opacity .12s; }
1211
+ .tab:hover { color: var(--text); }
1212
+ .tab:hover::before { opacity: 1; }
1213
+ /* The icon takes its tab's text color, so a tab is always one color: muted, then the accent once selected. */
1214
+ .tab .ic { width: 16px; height: 16px; color: currentColor; transition: color .12s; }
1215
+ .tab-label { display: inline-grid; }
1216
+ .tab-label::after { content: attr(data-label); height: 0; overflow: hidden; visibility: hidden; font-weight: var(--strong-weight); }
1217
+ .tab[aria-selected=true] { color: var(--accent); font-weight: var(--strong-weight); }
1218
+ .tab[aria-selected=true]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 0; height: 2px; border-radius: 2px 2px 0 0; background: var(--accent); animation: tab-line .22s cubic-bezier(.16, 1, .3, 1); }
1219
+ @keyframes tab-line { from { opacity: 0; transform: scaleX(.3); } }
1220
+ .tab:focus-visible { outline: var(--focus-outline); outline-offset: -5px; border-radius: var(--ctl-radius); }
1221
+ .tab-count { min-width: 20px; padding: 0 6px; border-radius: var(--chip-radius); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); color: var(--muted); font-size: 11.5px; font-weight: 500; line-height: 18px; text-align: center; }
1222
+ .tab[aria-selected=true] .tab-count { background: var(--accent-soft); box-shadow: none; color: var(--accent); }
1223
+ .tab-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok-bar); box-shadow: 0 0 0 3px var(--ok-soft); }
1224
+ .tab .seg-badge { margin-left: 0; }
1225
+ .tab .spin { width: 16px; height: 16px; }
1226
+
1227
+ /* Pages other than Accounts open the same way: a title with its actions on the right, one line saying what the page
1228
+ is for, then the content in surfaces. A section inside a page has a small heading with more room above than below. */
1229
+ .page > .section-head { margin-bottom: 4px; min-height: var(--ctl-h); }
1230
+ .page > .section-head h2 { font-size: 18px; letter-spacing: -0.015em; }
1231
+ .page > .section-head + p { margin-bottom: 18px; max-width: 860px; color: var(--muted); font-size: 13px; line-height: 1.6; }
1232
+ .page-sec { margin: 28px 0 10px; font-size: 13.5px; font-weight: var(--heading-weight); color: var(--text); }
1233
+ .page-sec-head { display: flex; flex-direction: column; gap: 2px; margin: 28px 0 10px; }
1234
+ .page-sec-head .page-sec { margin: 0; }
1235
+
1236
+ /* Auto Handoff's status card: its mark, on or off in words, what that means, and the one action that changes it. On,
1237
+ it takes a green edge and tint, so the state reads before the words. */
1238
+ .hp-status { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 18px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); transition: background-color .2s, border-color .2s; }
1239
+ .hp-status-ic { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 11px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); color: var(--muted); }
1240
+ .hp-status-ic .ic { width: 20px; height: 20px; }
1241
+ .hp-status-text { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
1242
+ .hp-status-text b { font-size: var(--large); font-weight: var(--heading-weight); }
1243
+ .hp-status-text p { font-size: 13px; line-height: 1.55; }
1244
+ .hp-status.is-on { border-color: color-mix(in srgb, var(--ok-bar) 40%, var(--border)); background: color-mix(in srgb, var(--ok-soft) 55%, var(--surface)); }
1245
+ .hp-status.is-on .hp-status-ic { background: var(--ok-soft); box-shadow: none; color: var(--ok); }
1246
+ .hp-status + :not(.page-sec-head, .page-sec) { margin-top: 12px; }
1247
+ .page .hp-rules, .page .hp-rows { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
1248
+ .page .hp-rules > li { padding: 12px 16px; min-height: 52px; }
1249
+ .page .hp-rows li { padding: 11px 16px; }
1250
+ .hp-rule-text::before { color: var(--faint); }
1251
+ :where(:root[data-width=narrow], :root[data-width=phone]) .hp-status { grid-template-columns: auto minmax(0, 1fr); }
1252
+ :where(:root[data-width=narrow], :root[data-width=phone]) .hp-status > .btn { grid-column: 1 / -1; justify-self: start; }
1253
+
1254
+ /* Context tuning on its page: one surface per settings file. Now, the suggestion and what it saves are one strip like
1255
+ the Accounts summary; the per-account details sit in the card's foot. */
1256
+ .tg-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
1257
+ .tg-stats { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); background: var(--surface-2); border: 1px solid var(--border); border-radius: calc(var(--radius) - 4px); overflow: hidden; }
1258
+ .tg-stat { min-width: 0; padding: 12px 16px; border-left: 1px solid var(--border); }
1259
+ .tg-stat:first-child { border-left: 0; }
1260
+ .tg-stats .tune-num { font-size: 24px; font-weight: var(--heading-weight); letter-spacing: -0.02em; line-height: 1.35; white-space: nowrap; }
1261
+ #tuning-page .tune-acct { gap: 0; margin: 0 0 16px; overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
1262
+ #tuning-page .tune-group { gap: 12px; padding: 18px 20px; border: 0; border-radius: 0; }
1263
+ #tuning-page .tune-acct > .tune-details { margin: 0; padding: 11px 20px; border-top: 1px solid var(--border); background: var(--surface-2); }
1264
+ #tuning-page .tune-acct > .tune-details:first-child { border-top: 0; }
1265
+ #tuning-page .tune-acct > .tune-details[open] > summary { margin-bottom: 6px; }
1266
+ :where(:root[data-width=phone]) .tg-stats { grid-auto-flow: row; }
1267
+ :where(:root[data-width=phone]) .tg-stat { border-left: 0; border-top: 1px solid var(--border); }
1268
+ :where(:root[data-width=phone]) .tg-stat:first-child { border-top: 0; }
1269
+
1270
+ /* Hidden Families and Accounts (spec §3.25): the line under the list, and the marks while they are shown. */
1271
+ .hidden-bar { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 0 2px; animation: chip-in .16s ease-out; }
1272
+ .hidden-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--fail); flex: none; }
1273
+ .hidden-chip .ic { width: 12px; height: 12px; }
1274
+ .ident-name .hidden-chip { margin-left: 2px; }
1275
+ .group.is-hidden .group-title, .row.is-hidden .name { color: var(--muted); }
1276
+ .hide-btn .ic { width: 16px; height: 16px; }
1277
+ .hide-btn.is-on { color: var(--muted); }
1278
+ .hide-btn:disabled { opacity: .4; cursor: not-allowed; }
1156
1279
  @media (prefers-reduced-motion: reduce) {
1157
- .sk, .spin, .is-spinning svg, .toast, .toast.bump, .toast.toast-out, .view-in > *, .set-pane.view-in, .row.flash, .sess-row.flash, .sess-msg, .seg-badge, .card.flash, .pulse, .sess-busy .sess-dot, .menu, .menu.float-out, .dialog[open], .dialog[open]::backdrop, .enter, .fade-in, .hist-list.swap-in, .tip-body, .tip-float, .row-run.is-done .ic { animation: none; }
1158
- .bar > span, .chev, .row, .sess-row, .sess-copy, .hist-row, .hist-cont, .hist-proj, .hist-catbody, .hist-opt, .hist-list, .icon-btn, .seg-btn, .menu-item, .set-tab, .link-btn, .tag-btn, .email-btn, .btn, .chip-btn, .set-link .ic, .dialog, .dialog[open], .dialog::backdrop { transition: none; }
1280
+ .sk, .spin, .hidden-bar, .is-spinning svg, .toast, .toast.bump, .toast.toast-out, .view-in > *, .set-pane.view-in, .row.flash, .sess-row.flash, .sess-msg, .seg-badge, .card.flash, .pulse, .sess-busy .sess-dot, .menu, .menu.float-out, .dialog[open], .dialog[open]::backdrop, .enter, .fade-in, .hist-list.swap-in, .tip-body, .tip-float, .row-run.is-done .ic, .tab[aria-selected=true]::after { animation: none; }
1281
+ .bar > span, .chev, .row, .sess-row, .sess-copy, .hist-row, .hist-cont, .hist-proj, .hist-catbody, .hist-opt, .hist-list, .icon-btn, .seg-btn, .menu-item, .set-tab, .link-btn, .tag-btn, .email-btn, .btn, .chip-btn, .set-link .ic, .dialog, .dialog[open], .dialog::backdrop, .tab, .tab::before, .tab .ic, .hp-status { transition: none; }
1159
1282
  :is(.btn, .icon-btn, .seg-btn, .set-tab, .chip-btn):active:not(:disabled), .set-link:hover .ic, .dialog:not([open]) { transform: none; }
1160
1283
  }
1161
1284
  `;
@@ -95,9 +95,9 @@ export function renderPage(opts) {
95
95
  <div id="banners"></div>
96
96
  <nav id="pages" class="pages" role="tablist" hidden></nav>
97
97
  <section id="summary" class="summary" aria-busy="true">${SKELETON_STAT.repeat(4)}</section>
98
- <section id="handoff-page" class="block" aria-labelledby="h-handoff" hidden></section>
99
- <section id="tuning-page" class="block" aria-labelledby="h-tuning" hidden></section>
100
- <section id="sessions-page" class="block" aria-labelledby="h-sessions" hidden></section>
98
+ <section id="handoff-page" class="block page" aria-labelledby="h-handoff" hidden></section>
99
+ <section id="tuning-page" class="block page" aria-labelledby="h-tuning" hidden></section>
100
+ <section id="sessions-page" class="block page" aria-labelledby="h-sessions" hidden></section>
101
101
  <section id="accounts-page" class="block" aria-labelledby="h-accounts">
102
102
  <div class="section-head acct-head"><h2 id="h-accounts"><span data-i18n="acct.title">Accounts</span><span id="acct-count" class="muted small"></span></h2><span id="updated" class="muted small" role="status">Loading…</span></div>
103
103
  <div id="toolbar" class="toolbar" hidden></div>
@@ -62,7 +62,12 @@ export interface PanelThemeTokens {
62
62
  warnSoft?: string;
63
63
  fail?: string;
64
64
  failSoft?: string;
65
- /** The sideby mark in the page header. */
65
+ /** Quota bars: normal (the accent by default), running out and used up; `track` is the empty part of a bar. */
66
+ okBar?: string;
67
+ warnBar?: string;
68
+ failBar?: string;
69
+ track?: string;
70
+ /** The sideby mark in the page header; `logoColor` stays the brand blue whatever the Theme unless set. */
66
71
  logoBg?: string;
67
72
  logoColor?: string;
68
73
  logoBorder?: string;
@@ -44,6 +44,10 @@ export const THEME_TOKENS = {
44
44
  warnSoft: '--warn-soft',
45
45
  fail: '--fail',
46
46
  failSoft: '--fail-soft',
47
+ okBar: '--ok-bar',
48
+ warnBar: '--warn-bar',
49
+ failBar: '--fail-bar',
50
+ track: '--track',
47
51
  logoBg: '--logo-bg',
48
52
  logoColor: '--logo-fg',
49
53
  logoBorder: '--logo-line',
@@ -0,0 +1,14 @@
1
+ import type { PanelThemeTokens } from './theme.ts';
2
+ export interface BuiltinTheme {
3
+ id: string;
4
+ name: {
5
+ en: string;
6
+ zh: string;
7
+ };
8
+ /** A few colors for the Theme's card in Settings: page, card, accent tint, main button, dark page. */
9
+ swatches: readonly string[];
10
+ light: PanelThemeTokens;
11
+ dark: PanelThemeTokens;
12
+ }
13
+ export declare const DEFAULT_THEME_ID = "sky";
14
+ export declare const BUILTIN_THEMES: readonly BuiltinTheme[];
@@ -0,0 +1,162 @@
1
+ export const DEFAULT_THEME_ID = 'sky';
2
+ export const BUILTIN_THEMES = [
3
+ {
4
+ id: 'sky',
5
+ name: { en: 'Sky', zh: '晴空' },
6
+ swatches: ['#f2f8fc', '#e5f2fb', '#27658f', '#0e1621'],
7
+ light: {
8
+ bg: '#f2f8fc',
9
+ surface: '#fcfcfa',
10
+ surfaceMuted: '#f6fafd',
11
+ border: '#dce8f0',
12
+ borderStrong: '#c5d7e4',
13
+ text: '#15171c',
14
+ muted: '#555b63',
15
+ faint: '#6b7380',
16
+ hover: '#f0f7fc',
17
+ active: '#e6f1fa',
18
+ accent: '#27658f',
19
+ accentSoft: '#e5f2fb',
20
+ focus: '#3f8fc4',
21
+ primary: '#d9ebf9',
22
+ primaryHover: '#cbe3f7',
23
+ primaryActive: '#cbe3f7',
24
+ onPrimary: '#17588a',
25
+ primaryBorder: '#7eb2dd',
26
+ primaryHoverBorder: '#5f9dd0',
27
+ buttonHoverBorder: '#8fbde3',
28
+ buttonHoverText: '#27658f',
29
+ checkColor: '#3f8fc4',
30
+ ok: '#15803d',
31
+ okSoft: '#e8f7ee',
32
+ warn: '#b45309',
33
+ warnSoft: '#fdf3e2',
34
+ fail: '#c81e1e',
35
+ failSoft: '#fdecec',
36
+ okBar: '#22c55e',
37
+ warnBar: '#f59e0b',
38
+ failBar: '#ef4444',
39
+ track: '#e4edf4',
40
+ logoBg: '#e5f2fb',
41
+ logoBorder: '#dce8f0',
42
+ shadow: '0 1px 2px #10182814',
43
+ },
44
+ dark: {
45
+ bg: '#0e1621',
46
+ surface: '#141e2a',
47
+ surfaceMuted: '#111a25',
48
+ border: '#233244',
49
+ borderStrong: '#30455b',
50
+ text: '#e6edf3',
51
+ muted: '#9aa9b8',
52
+ faint: '#8796a6',
53
+ hover: '#182736',
54
+ active: '#1c2f42',
55
+ accent: '#8cc4ee',
56
+ accentSoft: '#16314a',
57
+ focus: '#5aa7dc',
58
+ primary: '#1a4366',
59
+ primaryHover: '#20507a',
60
+ primaryActive: '#20507a',
61
+ onPrimary: '#dcedfb',
62
+ primaryBorder: '#3d74a3',
63
+ primaryHoverBorder: '#4f86b5',
64
+ buttonHoverBorder: '#4a7fa8',
65
+ buttonHoverText: '#8cc4ee',
66
+ checkColor: '#5aa7dc',
67
+ ok: '#4ade80',
68
+ okSoft: '#13291c',
69
+ warn: '#fbbf24',
70
+ warnSoft: '#2d2410',
71
+ fail: '#f87171',
72
+ failSoft: '#331717',
73
+ okBar: '#22c55e',
74
+ warnBar: '#f59e0b',
75
+ failBar: '#ef4444',
76
+ track: '#1f2c3a',
77
+ logoBg: '#e5f2fb',
78
+ logoBorder: 'transparent',
79
+ shadow: 'none',
80
+ },
81
+ },
82
+ {
83
+ // Colors: Radix Colors (MIT, https://github.com/radix-ui/colors).
84
+ id: 'leaf',
85
+ name: { en: 'New Leaf', zh: '新叶' },
86
+ swatches: ['#f5fbf5', '#e9f6e9', '#2a7e3b', '#0e1511'],
87
+ light: {
88
+ bg: '#f5fbf5',
89
+ surface: '#fcfdfc',
90
+ surfaceMuted: '#f8faf8',
91
+ border: '#d7dad7',
92
+ borderStrong: '#cccfcc',
93
+ text: '#1d211c',
94
+ muted: '#60655f',
95
+ faint: '#60655f',
96
+ hover: '#eff1ef',
97
+ active: '#e7e9e7',
98
+ accent: '#2a7e3b',
99
+ accentSoft: '#e9f6e9',
100
+ focus: '#2a7e3b',
101
+ primary: '#daf1db',
102
+ primaryHover: '#c9e8ca',
103
+ primaryActive: '#c9e8ca',
104
+ onPrimary: '#2a7e3b',
105
+ primaryBorder: '#94ce9a',
106
+ primaryHoverBorder: '#65ba74',
107
+ buttonHoverBorder: '#94ce9a',
108
+ buttonHoverText: '#2a7e3b',
109
+ checkColor: '#46a758',
110
+ ok: '#193b2d',
111
+ okSoft: '#e6f6eb',
112
+ warn: '#4f3422',
113
+ warnSoft: '#fff7c2',
114
+ fail: '#ce2c31',
115
+ failSoft: '#feebec',
116
+ okBar: '#30a46c',
117
+ warnBar: '#ffba18',
118
+ failBar: '#e5484d',
119
+ track: '#e7e9e7',
120
+ logoBg: '#e9f6e9',
121
+ logoBorder: '#c9e8ca',
122
+ shadow: '0 1px 2px #203c2514',
123
+ },
124
+ dark: {
125
+ bg: '#0e1511',
126
+ surface: '#141a15',
127
+ surfaceMuted: '#0e1511',
128
+ border: '#383a36',
129
+ borderStrong: '#454843',
130
+ text: '#eceeec',
131
+ muted: '#afb5ad',
132
+ faint: '#afb5ad',
133
+ hover: '#212220',
134
+ active: '#282a27',
135
+ accent: '#71d083',
136
+ accentSoft: '#1b2a1e',
137
+ focus: '#53b365',
138
+ primary: '#1d3a24',
139
+ primaryHover: '#25482d',
140
+ primaryActive: '#25482d',
141
+ onPrimary: '#c2f0c2',
142
+ primaryBorder: '#2d5736',
143
+ primaryHoverBorder: '#366740',
144
+ buttonHoverBorder: '#2d5736',
145
+ buttonHoverText: '#71d083',
146
+ checkColor: '#46a758',
147
+ ok: '#3dd68c',
148
+ okSoft: '#132d21',
149
+ warn: '#ffca16',
150
+ warnSoft: '#302008',
151
+ fail: '#ff9592',
152
+ failSoft: '#3b1219',
153
+ okBar: '#30a46c',
154
+ warnBar: '#ffc53d',
155
+ failBar: '#e5484d',
156
+ track: '#282a27',
157
+ logoBg: '#e9f6e9',
158
+ logoBorder: 'transparent',
159
+ shadow: 'none',
160
+ },
161
+ },
162
+ ];
@@ -19,7 +19,7 @@ import { fakeHost, withFakeHome } from '../../testing/index.js';
19
19
  import { SHARE_MODES } from '../core/share-mode-names.js';
20
20
  import { BUILTIN_PLUGINS } from '../families/index.js';
21
21
  import { createRuntime } from '../runtime.js';
22
- import { checkTrustedTree, logoProblem, websiteProblem, } from './loader.js';
22
+ import { checkTrustedTree, logoProblem, mainOnlyProblem, websiteProblem, } from './loader.js';
23
23
  import { FAMILY_ID_RE, TODO_MARK } from './scaffold.js';
24
24
  /** Name of the Account the check creates next to the Main Account in its throwaway HOME. */
25
25
  const CHECK_ACCOUNT = 'check';
@@ -300,7 +300,14 @@ export function defProblems(raw) {
300
300
  field('bin', 'bin must be the executable name, without a folder', 'Set `bin` to the command the Host installs on PATH.');
301
301
  if (!nonEmpty(def.installUrl) || !/^https?:\/\/\S+$/.test(def.installUrl))
302
302
  field('installUrl', 'installUrl must be an http(s) link', "Set `installUrl` to the Host's official install page.");
303
- if (!nonEmpty(def.selectVar))
303
+ const mainOnly = def.mainOnly !== undefined;
304
+ const shape = mainOnlyProblem(def);
305
+ if (shape)
306
+ field('mainOnly', shape, 'Leave out `mainOnly` when the Host has a variable that moves its config directory; set `mainOnly: true` and leave out `selectVar` and `layout.account` only when it has none (ADR-0047).');
307
+ else if (mainOnly) {
308
+ // A Main-only Family has neither field to check.
309
+ }
310
+ else if (!nonEmpty(def.selectVar))
304
311
  out.push({
305
312
  code: 'select-var.missing',
306
313
  message: `${at}: selectVar is missing, so every Account would share one config directory`,
@@ -313,9 +320,10 @@ export function defProblems(raw) {
313
320
  const account = layout.account;
314
321
  if (!nonEmpty(main) || !isRelativeInside(main))
315
322
  field('layout', 'layout.main must be a path relative to HOME, without ".."', 'Set `layout.main` such as ".mytool".');
316
- if (!nonEmpty(account) ||
317
- !isRelativeInside(account) ||
318
- !account.split('/')[0].includes('<name>'))
323
+ if (!mainOnly &&
324
+ (!nonEmpty(account) ||
325
+ !isRelativeInside(account) ||
326
+ !account.split('/')[0].includes('<name>')))
319
327
  field('layout', 'layout.account must be relative to HOME, without "..", with <name> in its first segment', 'Set `layout.account` such as ".mytool-<name>".');
320
328
  for (const key of ['hijackVars', 'apiVars']) {
321
329
  const v = def[key];
@@ -400,15 +408,17 @@ async function round(h, builtins, id, problems) {
400
408
  return false;
401
409
  }
402
410
  };
403
- const layoutOk = defProblems(def).every((p) => p.code !== 'field.layout' && p.code !== 'field.bin');
411
+ const layoutOk = defProblems(def).every((p) => p.code !== 'field.layout' && p.code !== 'field.bin' && p.code !== 'field.mainOnly');
404
412
  if (!layoutOk)
405
413
  return;
406
414
  await fakeHost(h, def.bin);
407
415
  await h.mkdir(def.layout.main);
408
416
  for (const item of def.sharedItems)
409
417
  await seed(h, def, item.path, item);
410
- const accountDir = def.layout.account.replace('<name>', CHECK_ACCOUNT);
411
- await h.mkdir(accountDir);
418
+ // A Main-only Family (ADR-0047) has only its Main Account to find.
419
+ const accountDir = def.layout.account?.replace('<name>', CHECK_ACCOUNT);
420
+ if (accountDir)
421
+ await h.mkdir(accountDir);
412
422
  let refs = [];
413
423
  const found = await step('round.discover', 'finding Accounts', async () => {
414
424
  const all = await rt.accounts();
@@ -420,18 +430,22 @@ async function round(h, builtins, id, problems) {
420
430
  }
421
431
  });
422
432
  const ref = `${id}:${CHECK_ACCOUNT}`;
423
- if (found && (!refs.includes(`${id}:main`) || !refs.includes(ref)))
433
+ if (found && (!refs.includes(`${id}:main`) || (accountDir && !refs.includes(ref))))
424
434
  problems.push({
425
435
  code: 'round.discover',
426
- message: `family ${id}: sideby found ${refs.join(', ') || 'no Accounts'} in ~/${def.layout.main} and ~/${accountDir}, not both`,
436
+ message: accountDir
437
+ ? `family ${id}: sideby found ${refs.join(', ') || 'no Accounts'} in ~/${def.layout.main} and ~/${accountDir}, not both`
438
+ : `family ${id}: sideby found no Main Account in ~/${def.layout.main}`,
427
439
  fix: 'Check `layout` and `markers`: an Account directory counts when it holds proxy.env, a marker, or nothing at all.',
428
440
  });
429
- if (refs.includes(ref))
441
+ if (accountDir && def.selectVar && refs.includes(ref)) {
442
+ const selectVar = def.selectVar;
430
443
  await step('round.launch', 'preparing a launch', async () => {
431
444
  const launch = await rt.prepareLaunch(ref, [], 'run');
432
- if (launch.env[def.selectVar] !== h.path(accountDir))
433
- throw new Error(`${def.selectVar} does not point at the Account directory`);
445
+ if (launch.env[selectVar] !== h.path(accountDir))
446
+ throw new Error(`${selectVar} does not point at the Account directory`);
434
447
  });
448
+ }
435
449
  await step('round.doctor', 'doctor', async () => {
436
450
  await rt.doctor({ target: id, persist: false });
437
451
  });
@@ -63,3 +63,14 @@ export declare function loadPlugins(opts: {
63
63
  userPluginsDir: string;
64
64
  home: string;
65
65
  }): Promise<LoadResult>;
66
+ /**
67
+ * What is wrong with how a FamilyDef says where its Accounts live (ADR-0047): either `selectVar` and `layout.account`
68
+ * both set, or `mainOnly: true` with both left out. undefined when it is right.
69
+ */
70
+ export declare function mainOnlyProblem(def: {
71
+ mainOnly?: unknown;
72
+ selectVar?: unknown;
73
+ layout?: {
74
+ account?: unknown;
75
+ } | unknown;
76
+ }): string | undefined;