sideby 0.17.0 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/README.md +3 -1
  2. package/ai-tasks.json +90 -0
  3. package/dist/build.json +1 -1
  4. package/dist/src/cli/commands.d.ts +9 -1
  5. package/dist/src/cli/commands.js +349 -14
  6. package/dist/src/cli/json-schemas.js +157 -18
  7. package/dist/src/cli/main.js +56 -7
  8. package/dist/src/core/after-install.d.ts +54 -0
  9. package/dist/src/core/after-install.js +78 -0
  10. package/dist/src/core/ask.d.ts +73 -1
  11. package/dist/src/core/ask.js +106 -6
  12. package/dist/src/core/autostart.d.ts +38 -8
  13. package/dist/src/core/autostart.js +85 -39
  14. package/dist/src/core/brand-mark.d.ts +49 -11
  15. package/dist/src/core/brand-mark.js +116 -38
  16. package/dist/src/core/config.d.ts +5 -0
  17. package/dist/src/core/config.js +11 -1
  18. package/dist/src/core/desktop-app.d.ts +1 -1
  19. package/dist/src/core/desktop-app.js +2 -2
  20. package/dist/src/core/edit-settings.d.ts +24 -0
  21. package/dist/src/core/edit-settings.js +97 -0
  22. package/dist/src/core/handoff-brief.d.ts +4 -2
  23. package/dist/src/core/handoff-brief.js +6 -1
  24. package/dist/src/core/handoff-chain.d.ts +24 -0
  25. package/dist/src/core/handoff-chain.js +2 -0
  26. package/dist/src/core/handoff-run.d.ts +4 -3
  27. package/dist/src/core/handoff-run.js +14 -9
  28. package/dist/src/core/launch.d.ts +2 -0
  29. package/dist/src/core/launch.js +14 -10
  30. package/dist/src/core/local-build.d.ts +12 -5
  31. package/dist/src/core/local-build.js +49 -31
  32. package/dist/src/core/lock.d.ts +30 -0
  33. package/dist/src/core/lock.js +143 -0
  34. package/dist/src/core/quota-levels.d.ts +6 -1
  35. package/dist/src/core/quota-levels.js +16 -5
  36. package/dist/src/core/task-spec.d.ts +95 -0
  37. package/dist/src/core/task-spec.js +209 -0
  38. package/dist/src/core/terminal.js +6 -1
  39. package/dist/src/core/update.d.ts +27 -16
  40. package/dist/src/core/update.js +67 -93
  41. package/dist/src/desktop/icon.js +12 -15
  42. package/dist/src/families/claude/ai-task.d.ts +8 -0
  43. package/dist/src/families/claude/ai-task.js +38 -0
  44. package/dist/src/families/claude/handoff-hook.js +4 -4
  45. package/dist/src/families/claude/index.js +3 -0
  46. package/dist/src/families/codex/handoff-hook.js +4 -4
  47. package/dist/src/families/codex/index.js +9 -0
  48. package/dist/src/families/grok/handoff-hook.js +4 -4
  49. package/dist/src/families/grok/index.js +1 -0
  50. package/dist/src/families/pi/index.js +1 -0
  51. package/dist/src/handoff/hook.js +51 -30
  52. package/dist/src/handoff/levels.d.ts +24 -0
  53. package/dist/src/handoff/levels.js +70 -0
  54. package/dist/src/handoff/messages.d.ts +6 -3
  55. package/dist/src/handoff/messages.js +20 -7
  56. package/dist/src/handoff/reader.d.ts +6 -3
  57. package/dist/src/menubar/agent.d.ts +3 -0
  58. package/dist/src/menubar/agent.js +21 -0
  59. package/dist/src/menubar/script.d.ts +8 -0
  60. package/dist/src/menubar/script.js +457 -0
  61. package/dist/src/menubar/snapshot.d.ts +115 -0
  62. package/dist/src/menubar/snapshot.js +255 -0
  63. package/dist/src/menubar/strings.d.ts +87 -0
  64. package/dist/src/menubar/strings.js +88 -0
  65. package/dist/src/panel/background.js +12 -19
  66. package/dist/src/panel/handler.d.ts +12 -0
  67. package/dist/src/panel/handler.js +80 -80
  68. package/dist/src/panel/i18n.d.ts +33 -0
  69. package/dist/src/panel/i18n.js +66 -0
  70. package/dist/src/panel/page-logic.d.ts +105 -0
  71. package/dist/src/panel/page-logic.js +170 -15
  72. package/dist/src/panel/page-script.js +238 -109
  73. package/dist/src/panel/page-styles.js +42 -13
  74. package/dist/src/panel/page.d.ts +7 -0
  75. package/dist/src/panel/page.js +5 -0
  76. package/dist/src/runtime.d.ts +9 -1
  77. package/dist/src/runtime.js +11 -3
  78. package/dist/src/types.d.ts +14 -0
  79. package/package.json +4 -3
  80. package/schemas/ask-choices.json +168 -0
  81. package/schemas/ask-print.json +87 -0
  82. package/schemas/config.json +17 -1
  83. package/schemas/edit.json +119 -0
  84. package/schemas/error.json +4 -0
  85. package/schemas/families.json +4 -0
  86. package/schemas/list.json +4 -0
  87. package/schemas/local.json +1 -1
  88. package/schemas/menubar-snapshot.json +646 -0
  89. package/schemas/menubar-start.json +112 -0
  90. package/schemas/menubar.json +165 -0
  91. package/skills/sideby/SKILL.md +6 -2
  92. package/skills/sideby/references/ai-tasks.md +10 -0
  93. package/skills/sideby/references/handoff.md +3 -1
  94. package/skills/sideby/references/panel.md +6 -0
  95. package/skills/sideby/references/update.md +1 -1
@@ -2,13 +2,14 @@
2
2
  import { randomBytes, timingSafeEqual } from 'node:crypto';
3
3
  import { aliasesByAccount } from '../core/accounts.js';
4
4
  import { listAppProfiles, openAppProfile, removeAppProfile, } from '../core/app-profiles.js';
5
- import { openLoginInTerminal, pickTaskAccount, previewAttachments, promptForTask, setCustomTerminal, setPreferredTerminal, startAiTask, terminals, tryAccount, } from '../core/ask.js';
5
+ import { openLoginInTerminal, pickTaskAccount, previewAttachments, promptForTask, setCustomTerminal, setPreferredTerminal, startAiTask, taskContext, terminals, tryAccount, } from '../core/ask.js';
6
6
  import { MAX_ATTACHMENTS, MAX_UPLOAD_BYTES, removeStaged, stageUpload } from '../core/attachments.js';
7
- import { applyAutostart, autostartStatus, planAutostart, } from '../core/autostart.js';
7
+ import { applyAutostart, autostartStatus, PANEL_AGENT, planAutostart, } from '../core/autostart.js';
8
8
  import { FAVICON_SVG, ICON_SVG } from '../core/brand-mark.js';
9
9
  import { browserReport, openInBrowser, setBrowserSignIns, } from '../core/browser-profiles.js';
10
10
  import { aliasArgs, aliasRefs, editConfigPanel, editConfigTerminal, editConfigUpdate, } from '../core/config.js';
11
11
  import { openDesktopApp, withDesktopApps } from '../core/desktop-app.js';
12
+ import { editSettings } from '../core/edit-settings.js';
12
13
  import { UserError } from '../core/errors.js';
13
14
  import { planHandoff } from '../core/handoff.js';
14
15
  import { applyHandoffEnable, planHandoffEnable } from '../core/handoff-enable.js';
@@ -23,6 +24,8 @@ import { MIN_CALLS } from '../core/tuning.js';
23
24
  import * as update from '../core/update.js';
24
25
  import { buildId, localBuild, packageVersion } from '../core/version.js';
25
26
  import { HOOK_FAMILIES } from '../handoff/hook.js';
27
+ import { MENUBAR_AGENT } from '../menubar/agent.js';
28
+ import { MENUBAR_SCRIPT } from '../menubar/script.js';
26
29
  import { renderPage } from './page.js';
27
30
  import { AI_TASK_KINDS } from './page-logic.js';
28
31
  import { resolveTheme } from './theme.js';
@@ -30,6 +33,16 @@ export const PANEL_VERSION = packageVersion();
30
33
  export const MAX_BODY_BYTES = 64 * 1024;
31
34
  /** Write requests allowed to wait behind the running one; more get 409. */
32
35
  export const MAX_QUEUED_WRITES = 4;
36
+ function resolveAsk(ask) {
37
+ if (ask === undefined)
38
+ return undefined;
39
+ if (!ask ||
40
+ typeof ask !== 'object' ||
41
+ ask.bridge !== 'postMessage' ||
42
+ Object.keys(ask).length !== 1)
43
+ throw new TypeError('panel ask must be { bridge: "postMessage" } or left out');
44
+ return { bridge: 'postMessage' };
45
+ }
33
46
  const PANEL_LANGS = ['auto', 'en', 'zh'];
34
47
  function resolveLang(lang) {
35
48
  if (lang === undefined)
@@ -60,6 +73,7 @@ function keyFacts(def) {
60
73
  keyVar,
61
74
  ...(def.secretFileMeansApi === false ? { keyAlways: true } : {}),
62
75
  ...(def.probe ? { tryCommand: [def.bin, ...def.probe.args] } : {}),
76
+ ...(def.aiTaskArgs ? { aiTaskSafe: true } : {}),
63
77
  };
64
78
  }
65
79
  let autostartOverride = {};
@@ -74,13 +88,17 @@ export function bindPanelAutostart(ctx) {
74
88
  autostartOverride = before;
75
89
  };
76
90
  }
77
- const autostartCtx = (rt) => ({ home: rt.paths.home, ...autostartOverride });
91
+ const autostartCtx = (rt) => ({
92
+ home: rt.paths.home,
93
+ env: rt.env,
94
+ ...autostartOverride,
95
+ });
78
96
  /**
79
97
  * The start-at-login state as the page shows it (spec §3.29): the agent's path and what it starts, with the home
80
98
  * folder as `~`, and nothing else of the machine.
81
99
  */
82
100
  export function autostartView(s, home) {
83
- const t = (p) => tildify(p, home);
101
+ const t = shownArg(home);
84
102
  return {
85
103
  supported: s.supported,
86
104
  ...(s.reason ? { reason: s.reason } : {}),
@@ -91,12 +109,14 @@ export function autostartView(s, home) {
91
109
  ...(s.missing ? { missing: s.missing.map(t) } : {}),
92
110
  };
93
111
  }
112
+ /** A program argument as the page shows it: the home folder as `~`, and the menu bar script by name only. */
113
+ const shownArg = (home) => (a) => a === MENUBAR_SCRIPT ? '(menu bar script)' : tildify(a, home);
94
114
  function autostartPlanView(p, home) {
95
115
  return {
96
116
  action: p.action,
97
117
  changed: p.changed,
98
118
  path: tildify(p.path, home),
99
- ...(p.programArguments ? { programArguments: p.programArguments.map((a) => tildify(a, home)) } : {}),
119
+ ...(p.programArguments ? { programArguments: p.programArguments.map(shownArg(home)) } : {}),
100
120
  ...(p.blocked ? { blocked: p.blocked } : {}),
101
121
  status: autostartView(p.status, home),
102
122
  };
@@ -480,49 +500,7 @@ async function terminalsView(rt) {
480
500
  const AI_TASKS = AI_TASK_KINDS;
481
501
  /** The `context` of an AI Task body (spec §3.28): only the strings and findings a Task Prompt shows. */
482
502
  function askContext(body) {
483
- const c = body.context;
484
- if (c === undefined || c === null)
485
- return undefined;
486
- if (typeof c !== 'object' || Array.isArray(c))
487
- throw new HttpError(400, '"context" must be an object');
488
- const out = {};
489
- const str = (v, what) => {
490
- if (typeof v !== 'string')
491
- throw new HttpError(400, `${what} must be a string`);
492
- return v;
493
- };
494
- for (const [k, v] of Object.entries(c)) {
495
- if (k === 'account' || k === 'family' || k === 'quotaReason' || k === 'version' || k === 'terminalCustom')
496
- out[k] = str(v, `"context.${k}"`);
497
- else if (k === 'terminals') {
498
- if (!Array.isArray(v) || v.length > 50)
499
- throw new HttpError(400, '"context.terminals" must be a list');
500
- out.terminals = v.map((x) => str(x, 'each of "context.terminals"'));
501
- }
502
- else if (k === 'handoff') {
503
- if (!Array.isArray(v) || v.length > 100)
504
- throw new HttpError(400, '"context.handoff" must be a list');
505
- out.handoff = v.map((x) => str(x, 'each of "context.handoff"'));
506
- }
507
- else if (k === 'findings') {
508
- if (!Array.isArray(v) || v.length > 100)
509
- throw new HttpError(400, '"context.findings" must be a list');
510
- out.findings = v.map((f) => {
511
- if (!f || typeof f !== 'object' || Array.isArray(f) || typeof f.message !== 'string')
512
- throw new HttpError(400, 'each finding needs a "message"');
513
- const one = {
514
- message: f.message,
515
- };
516
- for (const key of ['code', 'account', 'item', 'hint'])
517
- if (f[key] !== undefined && f[key] !== null)
518
- one[key] = str(f[key], `"finding.${key}"`);
519
- return one;
520
- });
521
- }
522
- else
523
- throw new HttpError(400, `unknown context "${k}"`);
524
- }
525
- return out;
503
+ return taskContext(body.context, (message) => new HttpError(400, message));
526
504
  }
527
505
  /** Task, text, context, language and account of an /api/ask body; unknown tasks are refused. */
528
506
  function askInput(body) {
@@ -587,9 +565,38 @@ export function createPanelHandler(opts) {
587
565
  const theme = resolveTheme(opts.theme);
588
566
  const lang = resolveLang(opts.lang);
589
567
  const updates = opts.updates !== false;
568
+ const ask = resolveAsk(opts.ask);
590
569
  const token = randomBytes(32).toString('base64url');
591
570
  const serial = writeQueue();
592
571
  const getRuntime = typeof opts.runtime === 'function' ? opts.runtime : async () => opts.runtime;
572
+ /** The switch of one LaunchAgent sideby writes: the Panel's login item or the Menu Bar Item. */
573
+ const loginItemRoute = (agent) => ({
574
+ writes: (body) => body.confirm === true,
575
+ async run(body) {
576
+ if (typeof body.on !== 'boolean')
577
+ throw new HttpError(400, '"on" must be true or false');
578
+ const rt = await getRuntime();
579
+ const ctx = autostartCtx(rt);
580
+ const home = rt.paths.home;
581
+ const plan = await planAutostart(ctx, body.on ? 'on' : 'off', agent);
582
+ const shown = autostartPlanView(plan, home);
583
+ if (!optBool(body, 'confirm') || plan.blocked)
584
+ return { plan: shown, applied: false };
585
+ const saw = body.programArguments;
586
+ const want = shown.programArguments ?? [];
587
+ if (plan.action === 'on' &&
588
+ (!Array.isArray(saw) || saw.length !== want.length || saw.some((x, i) => x !== want[i])))
589
+ return { plan: shown, applied: false, changedSince: true };
590
+ const r = await applyAutostart(ctx, plan, agent);
591
+ return {
592
+ applied: true,
593
+ changed: r.changed,
594
+ loaded: r.loaded,
595
+ ...(r.note ? { note: r.note.split(home).join('~') } : {}),
596
+ status: autostartView(await autostartStatus(ctx, agent), home),
597
+ };
598
+ },
599
+ });
593
600
  const routes = {
594
601
  // AI Tasks (spec §3.28, ADR-0027). The prompt and the account it would use, read only: for the confirm area,
595
602
  // the copy fallback and the read-only Panel.
@@ -879,6 +886,19 @@ export function createPanelHandler(opts) {
879
886
  };
880
887
  },
881
888
  },
889
+ // Opens the Account's Host settings file with the system's default program (spec §3.30, ADR-0033). It reads none
890
+ // of the file but starts a program, so a read-only Panel refuses it (writes defaults to true).
891
+ '/api/account/edit-settings': {
892
+ async run(body) {
893
+ const account = optString(body, 'account');
894
+ if (!account)
895
+ throw new HttpError(400, '"account" is required');
896
+ const rt = await getRuntime();
897
+ const r = await editSettings(rt, account);
898
+ const home = rt.paths.home;
899
+ return { ...r, path: tildify(r.path, home), ...(r.target ? { target: tildify(r.target, home) } : {}) };
900
+ },
901
+ },
882
902
  // Browser Sign-ins on or off (spec §3.24): config `browser.signIns`, shown first like every config change.
883
903
  '/api/browser/settings': {
884
904
  writes: (body) => body.confirm === true,
@@ -969,7 +989,7 @@ export function createPanelHandler(opts) {
969
989
  const shown = update.shownPlan(plan);
970
990
  if (!optBool(body, 'confirm'))
971
991
  return { ...shown, updated: false };
972
- // The CLI is current and the skill is behind: `skill: true` updates it alone, as `sideby update --yes` does.
992
+ // The CLI is current and the skill is behind: `skill: true` updates it alone, as `sideby update --skill --yes` does.
973
993
  if (optBool(body, 'skill')) {
974
994
  if (plan.available || plan.method.kind === 'local')
975
995
  return { ...shown, updated: false, changed: true };
@@ -986,6 +1006,7 @@ export function createPanelHandler(opts) {
986
1006
  const { backgroundPanelPort } = await import('./background.js');
987
1007
  const r = await update.applyUpdate(rt.paths, plan, rt.env, {
988
1008
  panelPort: () => backgroundPanelPort(rt.paths),
1009
+ skillSync: 'background',
989
1010
  });
990
1011
  if (!r.ok)
991
1012
  throw new UserError(r.message);
@@ -996,6 +1017,7 @@ export function createPanelHandler(opts) {
996
1017
  restartedPanel: r.restartedPanel,
997
1018
  refreshedApp: r.refreshedApp,
998
1019
  ...(r.skillUpdated === undefined ? {} : { skillUpdated: r.skillUpdated }),
1020
+ ...(r.skillSyncStarted === undefined ? {} : { skillSyncStarted: r.skillSyncStarted }),
999
1021
  };
1000
1022
  },
1001
1023
  },
@@ -1106,35 +1128,11 @@ export function createPanelHandler(opts) {
1106
1128
  return { changed: r.changed, panel: r.after ?? {} };
1107
1129
  },
1108
1130
  },
1109
- // Start at login (spec §3.29, ADR-0029). Without `confirm` the plan: the file and what it starts, nothing is
1110
- // written. With it, a fresh plan runs only while it starts what the person saw (`programArguments`).
1111
- '/api/autostart': {
1112
- writes: (body) => body.confirm === true,
1113
- async run(body) {
1114
- if (typeof body.on !== 'boolean')
1115
- throw new HttpError(400, '"on" must be true or false');
1116
- const rt = await getRuntime();
1117
- const ctx = autostartCtx(rt);
1118
- const home = rt.paths.home;
1119
- const plan = await planAutostart(ctx, body.on ? 'on' : 'off');
1120
- const shown = autostartPlanView(plan, home);
1121
- if (!optBool(body, 'confirm') || plan.blocked)
1122
- return { plan: shown, applied: false };
1123
- const saw = body.programArguments;
1124
- const want = shown.programArguments ?? [];
1125
- if (plan.action === 'on' &&
1126
- (!Array.isArray(saw) || saw.length !== want.length || saw.some((x, i) => x !== want[i])))
1127
- return { plan: shown, applied: false, changedSince: true };
1128
- const r = await applyAutostart(ctx, plan);
1129
- return {
1130
- applied: true,
1131
- changed: r.changed,
1132
- loaded: r.loaded,
1133
- ...(r.note ? { note: r.note.split(home).join('~') } : {}),
1134
- status: autostartView(await autostartStatus(ctx), home),
1135
- };
1136
- },
1137
- },
1131
+ // Start at login (spec §3.29, ADR-0029) and the Menu Bar Item (spec §3.31, ADR-0034). Without `confirm` the plan:
1132
+ // the file and what it starts, nothing is written. With it, a fresh plan runs only while it starts what the person
1133
+ // saw (`programArguments`).
1134
+ '/api/autostart': loginItemRoute(PANEL_AGENT),
1135
+ '/api/menubar': loginItemRoute(MENUBAR_AGENT),
1138
1136
  // Undo for the quota setup above; the Runtime turns a teardown that throws into `{ ok: false, message }`.
1139
1137
  '/api/quota/teardown': {
1140
1138
  async run(body) {
@@ -1222,6 +1220,7 @@ export function createPanelHandler(opts) {
1222
1220
  theme,
1223
1221
  lang,
1224
1222
  updates,
1223
+ ...(ask ? { ask } : {}),
1225
1224
  ...(panel ? { panel } : {}),
1226
1225
  }));
1227
1226
  return true;
@@ -1253,9 +1252,10 @@ export function createPanelHandler(opts) {
1253
1252
  return true;
1254
1253
  }
1255
1254
  // Start at login (spec §3.29): its state only; turning it on or off is the POST of the same path.
1256
- if (sub === '/api/autostart') {
1255
+ if (sub === '/api/autostart' || sub === '/api/menubar') {
1257
1256
  const rt = await getRuntime();
1258
- send(res, 200, autostartView(await autostartStatus(autostartCtx(rt)), rt.paths.home));
1257
+ const agent = sub === '/api/menubar' ? MENUBAR_AGENT : PANEL_AGENT;
1258
+ send(res, 200, autostartView(await autostartStatus(autostartCtx(rt), agent), rt.paths.home));
1259
1259
  return true;
1260
1260
  }
1261
1261
  if (sub === '/api/state') {
@@ -21,6 +21,7 @@ declare const en: {
21
21
  'upd.cannot': string;
22
22
  'upd.skillToo': string;
23
23
  'upd.skillDone': string;
24
+ 'upd.skillSyncing': string;
24
25
  'upd.skillManaged': string;
25
26
  'upd.checksOff': string;
26
27
  'upd.latest': string;
@@ -40,6 +41,7 @@ declare const en: {
40
41
  'loc.switching': string;
41
42
  'loc.stuck': string;
42
43
  'loc.reload': string;
44
+ 'loc.unconfirmed': string;
43
45
  'upd.open': string;
44
46
  'upd.autoIsOn': string;
45
47
  'upd.autoIsOff': string;
@@ -57,6 +59,8 @@ declare const en: {
57
59
  'upd.now': string;
58
60
  'upd.updating': string;
59
61
  'upd.done': string;
62
+ 'upd.confirming': string;
63
+ 'upd.unconfirmed': string;
60
64
  'upd.reloading': string;
61
65
  'upd.restartHint': string;
62
66
  'upd.skillLabel': string;
@@ -466,6 +470,7 @@ declare const en: {
466
470
  'ask.terminal': string;
467
471
  'ask.chooseAccount': string;
468
472
  'ask.confirm': string;
473
+ 'ask.safe': string;
469
474
  'ask.open': string;
470
475
  'ask.opening': string;
471
476
  'ask.loading': string;
@@ -559,6 +564,10 @@ declare const en: {
559
564
  'menu.copyDir': string;
560
565
  'menu.copyEmail': string;
561
566
  'menu.check': string;
567
+ 'menu.editSettings': string;
568
+ 'edit.opened': string;
569
+ 'edit.shared': string;
570
+ 'edit.failed': string;
562
571
  'menu.like': string;
563
572
  'menu.tune': string;
564
573
  'menu.model': string;
@@ -892,6 +901,30 @@ declare const en: {
892
901
  'as.doneOn': string;
893
902
  'as.doneOff': string;
894
903
  'as.nextLogin': string;
904
+ 'mb.label': string;
905
+ 'mb.hint': string;
906
+ 'mb.onTitle': string;
907
+ 'mb.offTitle': string;
908
+ 'mb.writes': string;
909
+ 'mb.removes': string;
910
+ 'mb.turnOn': string;
911
+ 'mb.turnOff': string;
912
+ 'mb.hintTitle': string;
913
+ 'mb.hintBody': string;
914
+ 'mb.hintYes': string;
915
+ 'mb.hintNo': string;
916
+ 'mb.noWindow': string;
917
+ 'mb.offNote': string;
918
+ 'mb.alreadyOn': string;
919
+ 'mb.alreadyOff': string;
920
+ 'mb.doneOn': string;
921
+ 'mb.doneOff': string;
922
+ 'mb.nextLogin': string;
923
+ 'mb.stale': string;
924
+ 'mb.other': string;
925
+ 'mb.foreign': string;
926
+ 'mb.unsupported': string;
927
+ 'ai.ask.menubar': string;
895
928
  'as.changedSince': string;
896
929
  'as.block.npx-cache': string;
897
930
  'as.block.temp-dir': string;
@@ -23,6 +23,7 @@ const en = {
23
23
  'upd.cannot': 'sideby cannot update itself here: {why}. Run this yourself:',
24
24
  'upd.skillToo': 'The sideby skill agents read is updated with it.',
25
25
  'upd.skillDone': 'The sideby skill was updated too; agents load it in their next session.',
26
+ 'upd.skillSyncing': 'The sideby skill is updating in the background; agents load it in their next session.',
26
27
  'upd.skillManaged': 'sideby leaves the skill alone ({why}). Update it with:',
27
28
  'upd.checksOff': 'Update checks are off ({why}).',
28
29
  'upd.latest': 'This is the newest version',
@@ -42,6 +43,7 @@ const en = {
42
43
  'loc.switching': 'Switching…',
43
44
  'loc.stuck': 'Switched, but this page still runs the old code. Reload it; a panel started with sideby ui needs a restart.',
44
45
  'loc.reload': 'Reload page',
46
+ 'loc.unconfirmed': 'Could not confirm the switch: this page cannot reach sideby. Reload the page to see which build runs.',
45
47
  'upd.open': 'Update…',
46
48
  'upd.autoIsOn': 'Auto Update: on',
47
49
  'upd.autoIsOff': 'Auto Update: off',
@@ -59,6 +61,8 @@ const en = {
59
61
  'upd.now': 'Update to {v}',
60
62
  'upd.updating': 'Updating…',
61
63
  'upd.done': 'Updated to sideby {v}.',
64
+ 'upd.confirming': 'The connection dropped while sideby {v} was installing; checking whether the update finished…',
65
+ 'upd.unconfirmed': 'Could not confirm the update to sideby {v}: this page cannot reach sideby. Reload the page to see which version runs.',
62
66
  'upd.reloading': 'Waiting for the new version; this page reloads by itself.',
63
67
  'upd.restartHint': 'This page still runs the old version. Restart sideby ui (or reload the page in your portal) to use the new one.',
64
68
  'upd.skillLabel': 'Update skill',
@@ -468,6 +472,7 @@ const en = {
468
472
  'ask.terminal': 'Terminal',
469
473
  'ask.chooseAccount': 'Choose an account',
470
474
  'ask.confirm': 'Opens {terminal} and starts {ref} there.',
475
+ 'ask.safe': 'Its permission checks stay on, so risky actions are checked first.',
471
476
  'ask.open': 'Open in {terminal}',
472
477
  'ask.opening': 'Opening…',
473
478
  'ask.loading': 'Finding an account…',
@@ -561,6 +566,10 @@ const en = {
561
566
  'menu.copyDir': 'Copy folder path',
562
567
  'menu.copyEmail': 'Copy email',
563
568
  'menu.check': 'Check this account',
569
+ 'menu.editSettings': 'Open {file}',
570
+ 'edit.opened': 'Opened {ref}’s {file} with your default program.',
571
+ 'edit.shared': 'This file is shared: a change also applies to {names}.',
572
+ 'edit.failed': 'Could not open {file} for {ref}: {msg}',
564
573
  'menu.like': 'New account like this',
565
574
  'menu.tune': 'Context tuning',
566
575
  'menu.model': 'Model and effort…',
@@ -894,6 +903,30 @@ const en = {
894
903
  'as.doneOn': 'sideby now starts in the background at login.',
895
904
  'as.doneOff': 'sideby no longer starts at login.',
896
905
  'as.nextLogin': 'It takes effect at your next login.',
906
+ 'mb.label': 'Show quota in the menu bar',
907
+ 'mb.hint': 'Shows how much your best account has used, and starts any account in your terminal when clicked.',
908
+ 'mb.onTitle': 'Show quota in the menu bar',
909
+ 'mb.offTitle': 'Hide from the menu bar',
910
+ 'mb.writes': 'sideby will add this login item file so the menu bar item starts now and at each login:',
911
+ 'mb.removes': 'sideby will stop the menu bar item and remove this login item file:',
912
+ 'mb.turnOn': 'Turn on',
913
+ 'mb.turnOff': 'Turn off',
914
+ 'mb.hintTitle': 'See your quota in the menu bar',
915
+ 'mb.hintBody': 'See at a glance whether you have quota to keep working, without opening the panel. Click any account there to start it in your terminal.',
916
+ 'mb.hintYes': 'Show in menu bar',
917
+ 'mb.hintNo': 'No thanks',
918
+ 'mb.noWindow': 'The sideby icon appears in the menu bar now and at each login; nothing else opens.',
919
+ 'mb.offNote': 'The sideby icon disappears from the menu bar now.',
920
+ 'mb.alreadyOn': 'It already runs this sideby in the menu bar; nothing to change.',
921
+ 'mb.alreadyOff': 'It is already off; nothing to change.',
922
+ 'mb.doneOn': 'Look for the sideby icon in the top-right menu bar. If it is hidden, the menu bar may be full: hold ⌘ and drag icons to make room.',
923
+ 'mb.doneOff': 'Removed from the menu bar.',
924
+ 'mb.nextLogin': 'It appears at your next login.',
925
+ 'mb.stale': 'It points to a sideby that is no longer there.',
926
+ 'mb.other': 'It runs another copy of sideby, not this one.',
927
+ 'mb.foreign': 'A login item with the same name was not made by sideby, so sideby leaves it alone.',
928
+ 'mb.unsupported': 'Only on macOS for now.',
929
+ 'ai.ask.menubar': 'Show my quota in the menu bar.',
897
930
  'as.changedSince': 'Something changed since the preview; look at it again.',
898
931
  'as.block.npx-cache': 'sideby runs from the npx cache, which npm may clear, so it cannot start at login from there. Install it first:',
899
932
  'as.block.temp-dir': 'sideby runs from a temporary folder that the system empties. Install it first:',
@@ -945,6 +978,7 @@ const zh = {
945
978
  'upd.cannot': '这种安装方式下 sideby 不能自己更新:{why}。请自己运行:',
946
979
  'upd.skillToo': 'agent 读的 sideby skill 会一起更新。',
947
980
  'upd.skillDone': 'sideby skill 也已更新,agent 下次开会话时生效。',
981
+ 'upd.skillSyncing': 'sideby skill 正在后台更新,agent 下次开会话时生效。',
948
982
  'upd.skillManaged': 'sideby 不会自动更新这个 skill({why})。请用这条命令更新:',
949
983
  'upd.checksOff': '检查更新已关闭({why})。',
950
984
  'upd.latest': '已是最新版本',
@@ -964,6 +998,7 @@ const zh = {
964
998
  'loc.switching': '正在切换…',
965
999
  'loc.stuck': '已经切换,但这个页面还在跑旧代码。刷新页面;用 sideby ui 打开的面板要重启一下。',
966
1000
  'loc.reload': '刷新页面',
1001
+ 'loc.unconfirmed': '没能确认是否已经切换:这个页面连不上 sideby。刷新页面看看现在跑的是哪个版本。',
967
1002
  'upd.open': '更新…',
968
1003
  'upd.autoIsOn': '自动更新:开',
969
1004
  'upd.autoIsOff': '自动更新:关',
@@ -981,6 +1016,8 @@ const zh = {
981
1016
  'upd.now': '更新到 {v}',
982
1017
  'upd.updating': '更新中…',
983
1018
  'upd.done': '已更新到 sideby {v}。',
1019
+ 'upd.confirming': '安装 sideby {v} 时连接断了,正在确认是否已经更新好…',
1020
+ 'upd.unconfirmed': '没能确认是否已更新到 sideby {v}:这个页面连不上 sideby。刷新页面看看现在是哪个版本。',
984
1021
  'upd.reloading': '等待新版本启动,本页会自动刷新。',
985
1022
  'upd.restartHint': '本页仍在运行旧版本。重启 sideby ui(在 Portal 里就刷新页面)后使用新版本。',
986
1023
  'upd.skillLabel': '更新 skill',
@@ -1390,6 +1427,7 @@ const zh = {
1390
1427
  'ask.terminal': '终端',
1391
1428
  'ask.chooseAccount': '选一个账号',
1392
1429
  'ask.confirm': '将打开 {terminal},在里面启动 {ref}。',
1430
+ 'ask.safe': '它的权限检查保持开启,有风险的操作会先经过检查。',
1393
1431
  'ask.open': '在 {terminal} 中打开',
1394
1432
  'ask.opening': '正在打开…',
1395
1433
  'ask.loading': '正在挑选账号…',
@@ -1483,6 +1521,10 @@ const zh = {
1483
1521
  'menu.copyDir': '复制目录路径',
1484
1522
  'menu.copyEmail': '复制邮箱',
1485
1523
  'menu.check': '检查这个账号',
1524
+ 'menu.editSettings': '打开 {file}',
1525
+ 'edit.opened': '已用默认程序打开 {ref} 的 {file}。',
1526
+ 'edit.shared': '这个文件是共用的,改动对 {names} 也生效。',
1527
+ 'edit.failed': '没能打开 {ref} 的 {file}:{msg}',
1486
1528
  'menu.like': '照此新建账号',
1487
1529
  'menu.tune': '上下文调优',
1488
1530
  'menu.model': '模型和 effort…',
@@ -1816,6 +1858,30 @@ const zh = {
1816
1858
  'as.doneOn': '已开启:登录后 sideby 会在后台启动。',
1817
1859
  'as.doneOff': '已关闭:登录后不再启动 sideby。',
1818
1860
  'as.nextLogin': '下次登录时生效。',
1861
+ 'mb.label': '在状态栏显示额度',
1862
+ 'mb.hint': '显示最合适账号的已用额度,点任一账号即可在终端启动。',
1863
+ 'mb.onTitle': '在状态栏显示额度',
1864
+ 'mb.offTitle': '从状态栏隐藏',
1865
+ 'mb.writes': 'sideby 会添加下面这个登录项文件,现在立即显示状态栏图标,并在每次登录时启动:',
1866
+ 'mb.removes': 'sideby 会停止状态栏图标,并删除下面这个登录项文件:',
1867
+ 'mb.turnOn': '开启',
1868
+ 'mb.turnOff': '关闭',
1869
+ 'mb.hintTitle': '在状态栏看额度',
1870
+ 'mb.hintBody': '不用打开面板,看一眼就知道额度够不够继续干活;点一下里面的账号还能直接在终端启动。',
1871
+ 'mb.hintYes': '在状态栏显示',
1872
+ 'mb.hintNo': '不用了',
1873
+ 'mb.noWindow': '额度图标会立刻出现在状态栏,之后每次登录也会自动出现,不会打开其他窗口。',
1874
+ 'mb.offNote': '状态栏里的额度图标会立刻消失。',
1875
+ 'mb.alreadyOn': '状态栏已经在运行这份 sideby,不用改。',
1876
+ 'mb.alreadyOff': '已经是关闭的,不用改。',
1877
+ 'mb.doneOn': '看屏幕右上角状态栏里的 sideby 额度图标。如果没看到,可能是状态栏满了:按住 ⌘ 拖动图标腾出位置。',
1878
+ 'mb.doneOff': '已从状态栏移除。',
1879
+ 'mb.nextLogin': '下次登录时出现。',
1880
+ 'mb.stale': '它指向的 sideby 已经不在了。',
1881
+ 'mb.other': '它运行的是另一份 sideby,不是现在这份。',
1882
+ 'mb.foreign': '同名的登录项不是 sideby 建的,sideby 不动它。',
1883
+ 'mb.unsupported': '目前仅支持 macOS。',
1884
+ 'ai.ask.menubar': '在状态栏显示我的额度。',
1819
1885
  'as.changedSince': '预览之后有变化,请再看一遍。',
1820
1886
  'as.block.npx-cache': 'sideby 现在从 npx 缓存运行,npm 可能清掉它,没法从那里登录后启动。先安装:',
1821
1887
  'as.block.temp-dir': 'sideby 现在从系统会清空的临时文件夹运行。先安装:',
@@ -204,6 +204,44 @@ export declare function switchFailure(e: {
204
204
  network?: boolean;
205
205
  status?: number;
206
206
  }): 'wait' | 'check' | 'fail';
207
+ /**
208
+ * What a request that may swap the server's code (an Update, a Local Build switch; spec §3.23) has done. `failure` is
209
+ * how the request failed (`switchFailure`), null for an answer. `landed` is what a fresh read of the state says
210
+ * (the version runs, the switch is in place), null while the state cannot be read. `waitedOut`: the wait for the new
211
+ * code is over. Without an answer only the state can confirm success; until the wait is over the page keeps reading.
212
+ */
213
+ export declare function codeSwapOutcome(s: {
214
+ failure: 'wait' | 'check' | 'fail' | null;
215
+ landed: boolean | null;
216
+ waitedOut: boolean;
217
+ }): 'done' | 'waiting' | 'failed' | 'unknown';
218
+ /**
219
+ * Runs a request that may swap the server's code (an Update, a Local Build switch; spec §3.23). A background Panel
220
+ * restarting from the new code drops the answer, and a Portal moving to it may answer 5xx: without an answer only a
221
+ * fresh read of the state that shows the change counts as success (`codeSwapOutcome`). Each wait starts when the
222
+ * previous step ended, never before the request (an install can take longer than a wait): `windowMs` to confirm the
223
+ * change, reading every `pollMs` and once more at the end, then `windowMs` for the new build, which `reload`s the
224
+ * page. `done(answer)` returns false to stop after it; `stuck` when no new build came, `fail(error)` when the change
225
+ * did not happen, `unknown` when the state never answered.
226
+ */
227
+ export declare function runCodeSwap(io: {
228
+ send: () => Promise<unknown>;
229
+ /** Reads the state; true when this read answered. */
230
+ readState: () => Promise<boolean>;
231
+ /** What the state just read says: the change is in place (true), is not (false), or cannot tell (null). */
232
+ landed: () => boolean | null;
233
+ newBuild: () => boolean;
234
+ reload: () => void;
235
+ now: () => number;
236
+ pause: (ms: number) => Promise<void>;
237
+ windowMs: number;
238
+ pollMs: number;
239
+ confirming: () => void;
240
+ done: (answer: unknown) => boolean;
241
+ stuck: () => void;
242
+ fail: (error: unknown) => void;
243
+ unknown: () => void;
244
+ }): Promise<void>;
207
245
  export declare function panelFixes(f: {
208
246
  code?: string;
209
247
  }, skillUpdatable: boolean): boolean;
@@ -364,6 +402,50 @@ export declare function askCopy(task: string, has: (key: string) => boolean, fre
364
402
  placeholder: string;
365
403
  chips: string[];
366
404
  };
405
+ /**
406
+ * Whether the Panel hands its AI Tasks to the Portal around it (ADR-0030): createPanelHandler was given
407
+ * `ask: { bridge: 'postMessage' }` and the page sits in a frame. A Panel opened on its own is its own parent; it keeps
408
+ * its header "Let AI do it" button and its own dialog. The page decides this when it loads.
409
+ */
410
+ export declare function askBridged(boot: {
411
+ ask?: {
412
+ bridge?: string;
413
+ } | null;
414
+ }, win: {
415
+ parent: unknown;
416
+ }): boolean;
417
+ /**
418
+ * Hands an AI Task to the Portal around the Panel (ADR-0030) when `askBridged` says so: posts
419
+ * `{ type: 'local-tools:ask', version: 1, preset, native: { task, text, context }, text }` to the parent with the
420
+ * Panel's own origin as the target, and says it did, so the Panel opens no dialog of its own. Otherwise posts nothing
421
+ * and returns false.
422
+ */
423
+ export declare function askBridge(boot: {
424
+ ask?: {
425
+ bridge?: string;
426
+ } | null;
427
+ }, opts: {
428
+ task?: string;
429
+ text?: string;
430
+ context?: object | null;
431
+ } | undefined, win: {
432
+ parent: {
433
+ postMessage(message: unknown, targetOrigin: string): void;
434
+ } | null;
435
+ location: {
436
+ origin: string;
437
+ };
438
+ }): boolean;
439
+ /**
440
+ * The "Attached files" section of a Task Prompt (spec §3.28 "附件"), in `lang` (`zh`, otherwise English): one line
441
+ * per file with its absolute path and kind, plus how to look at a video. Empty without files. `heading` goes before
442
+ * the section title, so a prompt with Markdown headings (`## `, a Task Spec from a Portal) gets one of its level.
443
+ * sideby's own Task Prompts and the ones a Portal hands over (ADR-0030) share it, word for word.
444
+ */
445
+ export declare function attachedSection(files: readonly {
446
+ path: string;
447
+ kind: string;
448
+ }[], lang: string, heading?: string): string;
367
449
  /**
368
450
  * The Task Prompt of an AI Task (spec §3.28), in `lang` (`zh`, otherwise English): what to do, the context given,
369
451
  * the fixed rules, pointers for the task and the invitation to contribute. For `free` the user's `text` is what to
@@ -500,3 +582,26 @@ export declare function handoffTaskFacts(settings: {
500
582
  }[];
501
583
  nextSteps?: readonly string[];
502
584
  } | null): string[];
585
+ /**
586
+ * Whether a click on `target` inside a foldable row leaves the row as it is: a control, a tooltip, or anything in
587
+ * the open details, whose lines (a Same Login row's directories among them) are there to use, not to close the row.
588
+ */
589
+ export declare function foldSkips(target: {
590
+ closest(selector: string): unknown;
591
+ }): boolean;
592
+ /** The Panel's layout bands, widest first; page-styles.ts hangs its narrow-screen rules on them. */
593
+ export type WidthTier = 'wide' | 'medium' | 'narrow' | 'phone';
594
+ /** The layout band for a viewport `width` in CSS pixels: up to 560 phone, up to 760 narrow, up to 1100 medium. */
595
+ export declare function widthTier(width: number): WidthTier;
596
+ /**
597
+ * Follows a viewport width that changes frame by frame (a window being dragged, a Portal's sidebar sliding open
598
+ * around the Panel's frame) and calls `apply` with the new band as soon as the width crosses into one, so the layout
599
+ * moves together with the sliding edge instead of after it. For `settleMs` after that (restarted while the width keeps
600
+ * moving) it only notes further crossings, then applies the band the width came to rest in if that differs, so one
601
+ * gesture changes the layout at most twice and never flickers on every frame. Returns the function to call with each
602
+ * new width.
603
+ */
604
+ export declare function widthFollower<T>(shown: T, tierOf: (width: number) => T, apply: (tier: T) => void, settleMs: number, timers: {
605
+ set: (fn: () => void, ms: number) => unknown;
606
+ clear: (id: unknown) => void;
607
+ }): (width: number) => void;