sideby 0.20.0 → 0.22.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 (73) hide show
  1. package/README.md +1 -0
  2. package/dist/build.json +1 -1
  3. package/dist/src/cli/commands.js +115 -10
  4. package/dist/src/cli/format.js +3 -2
  5. package/dist/src/cli/json-schemas.js +81 -46
  6. package/dist/src/cli/main.js +6 -3
  7. package/dist/src/core/accounts.d.ts +6 -1
  8. package/dist/src/core/accounts.js +16 -3
  9. package/dist/src/core/ask.d.ts +2 -1
  10. package/dist/src/core/ask.js +6 -3
  11. package/dist/src/core/claude-settings-file.d.ts +57 -0
  12. package/dist/src/core/claude-settings-file.js +104 -2
  13. package/dist/src/core/config.d.ts +29 -15
  14. package/dist/src/core/config.js +40 -2
  15. package/dist/src/core/create.js +4 -1
  16. package/dist/src/core/desktop-app.js +5 -1
  17. package/dist/src/core/handoff-overview.d.ts +4 -1
  18. package/dist/src/core/handoff-overview.js +3 -2
  19. package/dist/src/core/handoff-rules.d.ts +34 -0
  20. package/dist/src/core/handoff-rules.js +115 -0
  21. package/dist/src/core/handoff-select.js +45 -28
  22. package/dist/src/core/handoff-status.d.ts +37 -7
  23. package/dist/src/core/handoff-status.js +95 -19
  24. package/dist/src/core/handoff.d.ts +4 -1
  25. package/dist/src/core/handoff.js +8 -5
  26. package/dist/src/core/inbound.d.ts +11 -3
  27. package/dist/src/core/inbound.js +26 -74
  28. package/dist/src/core/launch.js +6 -4
  29. package/dist/src/core/quota-levels.d.ts +6 -0
  30. package/dist/src/core/quota-levels.js +8 -0
  31. package/dist/src/core/remote-control.d.ts +10 -12
  32. package/dist/src/core/remote-control.js +29 -86
  33. package/dist/src/core/tuning-apply.js +12 -20
  34. package/dist/src/families/agy/index.d.ts +8 -0
  35. package/dist/src/families/agy/index.js +53 -0
  36. package/dist/src/families/agy/quota.d.ts +9 -0
  37. package/dist/src/families/agy/quota.js +110 -0
  38. package/dist/src/families/index.js +7 -0
  39. package/dist/src/families/logos.d.ts +10 -0
  40. package/dist/src/families/logos.js +12 -1
  41. package/dist/src/menubar/script.js +26 -3
  42. package/dist/src/menubar/snapshot.d.ts +23 -6
  43. package/dist/src/menubar/snapshot.js +126 -39
  44. package/dist/src/menubar/strings.d.ts +12 -2
  45. package/dist/src/menubar/strings.js +12 -2
  46. package/dist/src/panel/handler.d.ts +2 -1
  47. package/dist/src/panel/handler.js +81 -45
  48. package/dist/src/panel/i18n.d.ts +58 -7
  49. package/dist/src/panel/i18n.js +158 -56
  50. package/dist/src/panel/page-logic.d.ts +52 -19
  51. package/dist/src/panel/page-logic.js +47 -7
  52. package/dist/src/panel/page-script.js +333 -115
  53. package/dist/src/panel/page-styles.js +112 -21
  54. package/dist/src/panel/page.js +3 -3
  55. package/dist/src/plugins/check.js +27 -13
  56. package/dist/src/plugins/loader.d.ts +11 -0
  57. package/dist/src/plugins/loader.js +47 -1
  58. package/dist/src/runtime.d.ts +5 -2
  59. package/dist/src/runtime.js +12 -5
  60. package/dist/src/types.d.ts +35 -5
  61. package/package.json +2 -2
  62. package/schemas/config.json +16 -1
  63. package/schemas/families.json +8 -5
  64. package/schemas/handoff-disable.json +22 -0
  65. package/schemas/handoff-enable.json +22 -0
  66. package/schemas/handoff-rules.json +302 -0
  67. package/schemas/handoff-status.json +26 -0
  68. package/schemas/list.json +5 -0
  69. package/schemas/menubar-snapshot.json +309 -2
  70. package/skills/sideby/SKILL.md +3 -2
  71. package/skills/sideby/references/accounts.md +1 -0
  72. package/skills/sideby/references/handoff.md +7 -3
  73. package/skills/sideby/references/quota.md +2 -0
@@ -27,6 +27,17 @@ export function windowState(w, now, warn, fail) {
27
27
  const level = passed ? 'reset' : pct >= fail ? 'fail' : pct >= warn ? 'warn' : 'ok';
28
28
  return { pct, passed, level };
29
29
  }
30
+ /**
31
+ * The window that binds first among those sharing one column (a model group with a 5-hour and a weekly limit, as
32
+ * Antigravity CLI reports): the most used as the page draws it, the first on a tie. Undefined for none.
33
+ */
34
+ export function bindingWindow(list, now, warn, fail) {
35
+ let best;
36
+ for (const w of list)
37
+ if (!best || windowState(w, now, warn, fail).pct > windowState(best, now, warn, fail).pct)
38
+ best = w;
39
+ return best;
40
+ }
30
41
  /**
31
42
  * A window whose reset time has passed: the numbers on record are from before the reset and nothing newer came
32
43
  * in. `since` is when they were last seen (the Quota's observation time, or the reset itself when that is
@@ -137,6 +148,20 @@ export function inDisplayOrder(items, key, order) {
137
148
  .sort((x, y) => x.r - y.r || x.i - y.i)
138
149
  .map((x) => x.t);
139
150
  }
151
+ /**
152
+ * The categories of the History side list in the order the user dragged them to: the saved ones first, then the
153
+ * others in the order `seen` gives (latest Session first). The empty category (Projects without one) stays last.
154
+ */
155
+ export function categoryOrder(seen, saved) {
156
+ const has = new Set(seen);
157
+ const out = [];
158
+ for (const c of [...saved, ...seen])
159
+ if (c && has.has(c) && !out.includes(c))
160
+ out.push(c);
161
+ if (has.has(''))
162
+ out.push('');
163
+ return out;
164
+ }
140
165
  /**
141
166
  * The Display Order after a drag (spec §3.25). `all` is every key of the list in the current Display Order, hidden
142
167
  * ones included; `shown` is what the screen showed, in its order, as units (one key, or a Same Login group that moves
@@ -806,6 +831,8 @@ export function handoffChangeOf(s, f) {
806
831
  }
807
832
  if (orders.length)
808
833
  c.orders = orders;
834
+ if (f.crossOrganization && f.crossOrganization.join('\n') !== s.crossOrganization.join('\n'))
835
+ c.crossOrganization = f.crossOrganization.slice();
809
836
  return c;
810
837
  }
811
838
  /**
@@ -823,13 +850,6 @@ export function remoteControlSummary(groups, apiRefs) {
823
850
  return 'default';
824
851
  return 'off';
825
852
  }
826
- /**
827
- * The groups that turning Remote Control `to` on or off changes (spec §3.22): those that do not hold it yet, a
828
- * default counting as either. A file that is missing or cannot be read is never changed.
829
- */
830
- export function remoteControlTodo(groups, to) {
831
- return groups.filter((g) => g.state === 'default' || g.state === (to === 'on' ? 'off' : 'on'));
832
- }
833
853
  /**
834
854
  * Where a menu or popover goes next to its anchor, all in viewport pixels. It opens below when its whole height fits
835
855
  * there, else above when it fits there, else on the side with more room, its height capped at that room so it scrolls
@@ -1560,3 +1580,23 @@ export function histFilters(raw) {
1560
1580
  scripts: o.scripts === true,
1561
1581
  };
1562
1582
  }
1583
+ /**
1584
+ * Saves one Auto Handoff change from the Handoff page (spec §3.17 "接力规则"): every change applies at once, and
1585
+ * the toast offers the undo the server read from the config as it was. Undoing offers no undo of its own.
1586
+ */
1587
+ export async function saveHandoffChange(post, change, opts = {}) {
1588
+ const r = await post('/api/handoff/configure', { change, confirm: true });
1589
+ return { undo: opts.noUndo || !r.undo ? null : r.undo };
1590
+ }
1591
+ /**
1592
+ * What the Handoff page shows after confirming the plan that turns Auto Handoff on (ADR-0013): the plan again when
1593
+ * it changed since it was shown (unless nothing is left to do) or is blocked, the first step that failed, or done.
1594
+ */
1595
+ export function enableOutcome(r) {
1596
+ if (r.changed && !r.plan.alreadyOn)
1597
+ return { kind: 'changed', plan: r.plan };
1598
+ if (r.plan.blocked)
1599
+ return { kind: 'blocked', plan: r.plan };
1600
+ const bad = r.results.find((x) => !x.ok);
1601
+ return bad ? { kind: 'failed', step: bad, plan: r.plan } : { kind: 'done' };
1602
+ }