sideby 0.17.0 → 0.19.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.
- package/README.md +11 -1
- package/ai-tasks.json +90 -0
- package/dist/build.json +1 -1
- package/dist/src/cli/commands.d.ts +9 -1
- package/dist/src/cli/commands.js +507 -26
- package/dist/src/cli/json-schemas.js +196 -19
- package/dist/src/cli/main.js +79 -13
- package/dist/src/core/after-install.d.ts +54 -0
- package/dist/src/core/after-install.js +78 -0
- package/dist/src/core/ask.d.ts +87 -1
- package/dist/src/core/ask.js +122 -7
- package/dist/src/core/autostart.d.ts +38 -8
- package/dist/src/core/autostart.js +85 -39
- package/dist/src/core/brand-mark.d.ts +49 -11
- package/dist/src/core/brand-mark.js +116 -38
- package/dist/src/core/browser-profiles.js +7 -32
- package/dist/src/core/config.d.ts +19 -0
- package/dist/src/core/config.js +75 -2
- package/dist/src/core/desktop-app.d.ts +1 -1
- package/dist/src/core/desktop-app.js +2 -2
- package/dist/src/core/edit-settings.d.ts +24 -0
- package/dist/src/core/edit-settings.js +97 -0
- package/dist/src/core/handoff-brief.d.ts +4 -2
- package/dist/src/core/handoff-brief.js +6 -1
- package/dist/src/core/handoff-chain.d.ts +24 -0
- package/dist/src/core/handoff-chain.js +2 -0
- package/dist/src/core/handoff-run.d.ts +4 -3
- package/dist/src/core/handoff-run.js +14 -9
- package/dist/src/core/launch.d.ts +2 -0
- package/dist/src/core/launch.js +14 -10
- package/dist/src/core/local-build.d.ts +12 -5
- package/dist/src/core/local-build.js +49 -31
- package/dist/src/core/lock.d.ts +30 -0
- package/dist/src/core/lock.js +143 -0
- package/dist/src/core/pick-commands.d.ts +42 -0
- package/dist/src/core/pick-commands.js +44 -0
- package/dist/src/core/quota-levels.d.ts +6 -1
- package/dist/src/core/quota-levels.js +16 -5
- package/dist/src/core/shell-init.js +3 -1
- package/dist/src/core/shell-setup.d.ts +40 -0
- package/dist/src/core/shell-setup.js +54 -0
- package/dist/src/core/skill-check.d.ts +2 -0
- package/dist/src/core/skill-check.js +2 -0
- package/dist/src/core/task-spec.d.ts +95 -0
- package/dist/src/core/task-spec.js +209 -0
- package/dist/src/core/terminal.d.ts +21 -4
- package/dist/src/core/terminal.js +155 -10
- package/dist/src/core/update.d.ts +27 -16
- package/dist/src/core/update.js +69 -95
- package/dist/src/core/windows-dirs.d.ts +19 -0
- package/dist/src/core/windows-dirs.js +39 -0
- package/dist/src/desktop/icon.js +12 -15
- package/dist/src/families/claude/ai-task.d.ts +8 -0
- package/dist/src/families/claude/ai-task.js +38 -0
- package/dist/src/families/claude/handoff-hook.js +4 -4
- package/dist/src/families/claude/index.js +3 -0
- package/dist/src/families/codex/handoff-hook.js +4 -4
- package/dist/src/families/codex/index.js +9 -0
- package/dist/src/families/grok/handoff-hook.js +4 -4
- package/dist/src/families/grok/index.js +1 -0
- package/dist/src/families/pi/index.js +1 -0
- package/dist/src/handoff/hook.js +51 -30
- package/dist/src/handoff/levels.d.ts +24 -0
- package/dist/src/handoff/levels.js +70 -0
- package/dist/src/handoff/messages.d.ts +6 -3
- package/dist/src/handoff/messages.js +20 -7
- package/dist/src/handoff/reader.d.ts +6 -3
- package/dist/src/menubar/agent.d.ts +3 -0
- package/dist/src/menubar/agent.js +21 -0
- package/dist/src/menubar/script.d.ts +8 -0
- package/dist/src/menubar/script.js +457 -0
- package/dist/src/menubar/snapshot.d.ts +115 -0
- package/dist/src/menubar/snapshot.js +255 -0
- package/dist/src/menubar/strings.d.ts +87 -0
- package/dist/src/menubar/strings.js +88 -0
- package/dist/src/panel/background.js +12 -19
- package/dist/src/panel/handler.d.ts +30 -0
- package/dist/src/panel/handler.js +148 -80
- package/dist/src/panel/i18n.d.ts +72 -0
- package/dist/src/panel/i18n.js +144 -0
- package/dist/src/panel/page-logic.d.ts +105 -0
- package/dist/src/panel/page-logic.js +170 -15
- package/dist/src/panel/page-script.js +419 -111
- package/dist/src/panel/page-styles.js +45 -13
- package/dist/src/panel/page.d.ts +7 -0
- package/dist/src/panel/page.js +11 -1
- package/dist/src/runtime.d.ts +44 -2
- package/dist/src/runtime.js +107 -6
- package/dist/src/types.d.ts +14 -0
- package/package.json +4 -3
- package/schemas/alias-list.json +119 -0
- package/schemas/alias.json +27 -1
- package/schemas/ask-choices.json +168 -0
- package/schemas/ask-print.json +87 -0
- package/schemas/config.json +28 -1
- package/schemas/edit.json +119 -0
- package/schemas/error.json +4 -0
- package/schemas/families.json +4 -0
- package/schemas/list.json +4 -0
- package/schemas/local.json +1 -1
- package/schemas/menubar-snapshot.json +646 -0
- package/schemas/menubar-start.json +112 -0
- package/schemas/menubar.json +165 -0
- package/schemas/new.json +19 -0
- package/schemas/shell-init-setup.json +124 -0
- package/skills/sideby/SKILL.md +11 -4
- package/skills/sideby/references/accounts.md +10 -0
- package/skills/sideby/references/ai-tasks.md +10 -0
- package/skills/sideby/references/handoff.md +3 -1
- package/skills/sideby/references/panel.md +6 -0
- package/skills/sideby/references/setup.md +1 -1
- 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, openPickInTerminal, 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) => ({
|
|
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 = (
|
|
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((
|
|
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
|
};
|
|
@@ -362,6 +382,14 @@ async function buildState(rt, opts) {
|
|
|
362
382
|
};
|
|
363
383
|
});
|
|
364
384
|
const handoff = handoffByFamily(rt, list, ctx.now);
|
|
385
|
+
const pickOffers = {};
|
|
386
|
+
for (const f of families) {
|
|
387
|
+
const offer = await rt.pickSuggestion(f.id, accounts).catch(() => null);
|
|
388
|
+
if (offer && !offer.exists)
|
|
389
|
+
pickOffers[f.id] = { name: offer.name, ...(offer.shadows ? { shadows: offer.shadows } : {}) };
|
|
390
|
+
}
|
|
391
|
+
const { setupBlock, shellSetupStatus, userShell } = await import('../core/shell-setup.js');
|
|
392
|
+
const shellSt = await shellSetupStatus(userShell(rt.env), ctx.home, rt.env, rt.config.shellInitFile);
|
|
365
393
|
const browser = await browserReport(rt, accounts).catch(() => undefined);
|
|
366
394
|
const showBrowser = browser && (browser.families.matched.length || browser.families.openOnly.length);
|
|
367
395
|
return {
|
|
@@ -381,6 +409,9 @@ async function buildState(rt, opts) {
|
|
|
381
409
|
quotaSetups,
|
|
382
410
|
...(history ? { history } : {}),
|
|
383
411
|
...(rt.config.aliases ? { configAliases: aliasRefs(rt.config.aliases) } : {}),
|
|
412
|
+
...(rt.config.pickCommands ? { pickCommands: { ...rt.config.pickCommands } } : {}),
|
|
413
|
+
...(Object.keys(pickOffers).length ? { pickOffers } : {}),
|
|
414
|
+
shellSetup: { ...shellSt, rc: tildify(shellSt.rc, ctx.home), block: setupBlock(shellSt.shell) },
|
|
384
415
|
...(Object.keys(handoff).length ? { handoff } : {}),
|
|
385
416
|
...(remoteControl.length ? { remoteControl: rcView(remoteControl, ctx.home) } : {}),
|
|
386
417
|
...(appProfiles.length
|
|
@@ -480,49 +511,7 @@ async function terminalsView(rt) {
|
|
|
480
511
|
const AI_TASKS = AI_TASK_KINDS;
|
|
481
512
|
/** The `context` of an AI Task body (spec §3.28): only the strings and findings a Task Prompt shows. */
|
|
482
513
|
function askContext(body) {
|
|
483
|
-
|
|
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;
|
|
514
|
+
return taskContext(body.context, (message) => new HttpError(400, message));
|
|
526
515
|
}
|
|
527
516
|
/** Task, text, context, language and account of an /api/ask body; unknown tasks are refused. */
|
|
528
517
|
function askInput(body) {
|
|
@@ -587,9 +576,38 @@ export function createPanelHandler(opts) {
|
|
|
587
576
|
const theme = resolveTheme(opts.theme);
|
|
588
577
|
const lang = resolveLang(opts.lang);
|
|
589
578
|
const updates = opts.updates !== false;
|
|
579
|
+
const ask = resolveAsk(opts.ask);
|
|
590
580
|
const token = randomBytes(32).toString('base64url');
|
|
591
581
|
const serial = writeQueue();
|
|
592
582
|
const getRuntime = typeof opts.runtime === 'function' ? opts.runtime : async () => opts.runtime;
|
|
583
|
+
/** The switch of one LaunchAgent sideby writes: the Panel's login item or the Menu Bar Item. */
|
|
584
|
+
const loginItemRoute = (agent) => ({
|
|
585
|
+
writes: (body) => body.confirm === true,
|
|
586
|
+
async run(body) {
|
|
587
|
+
if (typeof body.on !== 'boolean')
|
|
588
|
+
throw new HttpError(400, '"on" must be true or false');
|
|
589
|
+
const rt = await getRuntime();
|
|
590
|
+
const ctx = autostartCtx(rt);
|
|
591
|
+
const home = rt.paths.home;
|
|
592
|
+
const plan = await planAutostart(ctx, body.on ? 'on' : 'off', agent);
|
|
593
|
+
const shown = autostartPlanView(plan, home);
|
|
594
|
+
if (!optBool(body, 'confirm') || plan.blocked)
|
|
595
|
+
return { plan: shown, applied: false };
|
|
596
|
+
const saw = body.programArguments;
|
|
597
|
+
const want = shown.programArguments ?? [];
|
|
598
|
+
if (plan.action === 'on' &&
|
|
599
|
+
(!Array.isArray(saw) || saw.length !== want.length || saw.some((x, i) => x !== want[i])))
|
|
600
|
+
return { plan: shown, applied: false, changedSince: true };
|
|
601
|
+
const r = await applyAutostart(ctx, plan, agent);
|
|
602
|
+
return {
|
|
603
|
+
applied: true,
|
|
604
|
+
changed: r.changed,
|
|
605
|
+
loaded: r.loaded,
|
|
606
|
+
...(r.note ? { note: r.note.split(home).join('~') } : {}),
|
|
607
|
+
status: autostartView(await autostartStatus(ctx, agent), home),
|
|
608
|
+
};
|
|
609
|
+
},
|
|
610
|
+
});
|
|
593
611
|
const routes = {
|
|
594
612
|
// AI Tasks (spec §3.28, ADR-0027). The prompt and the account it would use, read only: for the confirm area,
|
|
595
613
|
// the copy fallback and the read-only Panel.
|
|
@@ -734,6 +752,63 @@ export function createPanelHandler(opts) {
|
|
|
734
752
|
return rt.createAccount(family, name, { api, ...(alias ? { alias } : {}) });
|
|
735
753
|
},
|
|
736
754
|
},
|
|
755
|
+
// Pick Commands (spec §3.13, ADR-0035): start the Account with the most room in the Preferred Terminal, add one
|
|
756
|
+
// (a name that hides a command on PATH comes back as `confirm` until the page sends confirm: true), remove one.
|
|
757
|
+
'/api/pick/start': {
|
|
758
|
+
async run(body) {
|
|
759
|
+
const name = optString(body, 'name');
|
|
760
|
+
if (!name)
|
|
761
|
+
throw new HttpError(400, '"name" is required');
|
|
762
|
+
const rt = await getRuntime();
|
|
763
|
+
const { family, choice } = await rt.pickChoice(name);
|
|
764
|
+
if (choice.ref === null)
|
|
765
|
+
throw new UserError(choice.earliestReset
|
|
766
|
+
? `Every ${family} account is at its limit; ${choice.earliestReset.ref} is back first.`
|
|
767
|
+
: `No ${family} account can be used now; sign one in first.`, { code: 'none-usable' });
|
|
768
|
+
// The terminal runs the Pick Command itself, so it picks again as it starts and prints which and why.
|
|
769
|
+
const r = opened(await openPickInTerminal(rt, name));
|
|
770
|
+
return {
|
|
771
|
+
...r,
|
|
772
|
+
name,
|
|
773
|
+
family,
|
|
774
|
+
picked: choice.ref,
|
|
775
|
+
reason: choice.reason,
|
|
776
|
+
...('pressure' in choice ? { pressure: choice.pressure } : {}),
|
|
777
|
+
};
|
|
778
|
+
},
|
|
779
|
+
},
|
|
780
|
+
'/api/pick/add': {
|
|
781
|
+
async run(body) {
|
|
782
|
+
const name = optString(body, 'name')?.trim();
|
|
783
|
+
const family = optString(body, 'family');
|
|
784
|
+
if (!name || !family)
|
|
785
|
+
throw new HttpError(400, 'enter a name and pick a family');
|
|
786
|
+
const rt = await getRuntime();
|
|
787
|
+
return rt.addPickCommand(name, family, { yes: optBool(body, 'confirm') });
|
|
788
|
+
},
|
|
789
|
+
},
|
|
790
|
+
'/api/pick/remove': {
|
|
791
|
+
async run(body) {
|
|
792
|
+
const name = optString(body, 'name');
|
|
793
|
+
if (!name)
|
|
794
|
+
throw new HttpError(400, '"name" is required');
|
|
795
|
+
const rt = await getRuntime();
|
|
796
|
+
if (rt.pickCommandFamily(name) === undefined)
|
|
797
|
+
throw new HttpError(400, `no pick command "${name}"`);
|
|
798
|
+
return rt.removeAlias(name);
|
|
799
|
+
},
|
|
800
|
+
},
|
|
801
|
+
// `sideby shell-init setup` (ADR-0036): the page has shown the line and the file; undo takes out only that line.
|
|
802
|
+
'/api/shell-init/setup': {
|
|
803
|
+
async run(body) {
|
|
804
|
+
const rt = await getRuntime();
|
|
805
|
+
const { applyShellSetup, userShell } = await import('../core/shell-setup.js');
|
|
806
|
+
const r = await applyShellSetup(userShell(rt.env), rt.paths.home, rt.env, rt.config.shellInitFile, {
|
|
807
|
+
undo: optBool(body, 'undo'),
|
|
808
|
+
});
|
|
809
|
+
return { status: r.status, shell: r.shell, rc: tildify(r.rc, rt.paths.home) };
|
|
810
|
+
},
|
|
811
|
+
},
|
|
737
812
|
'/api/quota/setup': {
|
|
738
813
|
writes: (body) => body.confirm === true,
|
|
739
814
|
async run(body) {
|
|
@@ -879,6 +954,19 @@ export function createPanelHandler(opts) {
|
|
|
879
954
|
};
|
|
880
955
|
},
|
|
881
956
|
},
|
|
957
|
+
// Opens the Account's Host settings file with the system's default program (spec §3.30, ADR-0033). It reads none
|
|
958
|
+
// of the file but starts a program, so a read-only Panel refuses it (writes defaults to true).
|
|
959
|
+
'/api/account/edit-settings': {
|
|
960
|
+
async run(body) {
|
|
961
|
+
const account = optString(body, 'account');
|
|
962
|
+
if (!account)
|
|
963
|
+
throw new HttpError(400, '"account" is required');
|
|
964
|
+
const rt = await getRuntime();
|
|
965
|
+
const r = await editSettings(rt, account);
|
|
966
|
+
const home = rt.paths.home;
|
|
967
|
+
return { ...r, path: tildify(r.path, home), ...(r.target ? { target: tildify(r.target, home) } : {}) };
|
|
968
|
+
},
|
|
969
|
+
},
|
|
882
970
|
// Browser Sign-ins on or off (spec §3.24): config `browser.signIns`, shown first like every config change.
|
|
883
971
|
'/api/browser/settings': {
|
|
884
972
|
writes: (body) => body.confirm === true,
|
|
@@ -969,7 +1057,7 @@ export function createPanelHandler(opts) {
|
|
|
969
1057
|
const shown = update.shownPlan(plan);
|
|
970
1058
|
if (!optBool(body, 'confirm'))
|
|
971
1059
|
return { ...shown, updated: false };
|
|
972
|
-
// The CLI is current and the skill is behind: `skill: true` updates it alone, as `sideby update --yes` does.
|
|
1060
|
+
// The CLI is current and the skill is behind: `skill: true` updates it alone, as `sideby update --skill --yes` does.
|
|
973
1061
|
if (optBool(body, 'skill')) {
|
|
974
1062
|
if (plan.available || plan.method.kind === 'local')
|
|
975
1063
|
return { ...shown, updated: false, changed: true };
|
|
@@ -986,6 +1074,7 @@ export function createPanelHandler(opts) {
|
|
|
986
1074
|
const { backgroundPanelPort } = await import('./background.js');
|
|
987
1075
|
const r = await update.applyUpdate(rt.paths, plan, rt.env, {
|
|
988
1076
|
panelPort: () => backgroundPanelPort(rt.paths),
|
|
1077
|
+
skillSync: 'background',
|
|
989
1078
|
});
|
|
990
1079
|
if (!r.ok)
|
|
991
1080
|
throw new UserError(r.message);
|
|
@@ -996,6 +1085,7 @@ export function createPanelHandler(opts) {
|
|
|
996
1085
|
restartedPanel: r.restartedPanel,
|
|
997
1086
|
refreshedApp: r.refreshedApp,
|
|
998
1087
|
...(r.skillUpdated === undefined ? {} : { skillUpdated: r.skillUpdated }),
|
|
1088
|
+
...(r.skillSyncStarted === undefined ? {} : { skillSyncStarted: r.skillSyncStarted }),
|
|
999
1089
|
};
|
|
1000
1090
|
},
|
|
1001
1091
|
},
|
|
@@ -1106,35 +1196,11 @@ export function createPanelHandler(opts) {
|
|
|
1106
1196
|
return { changed: r.changed, panel: r.after ?? {} };
|
|
1107
1197
|
},
|
|
1108
1198
|
},
|
|
1109
|
-
// Start at login (spec §3.29, ADR-0029). Without `confirm` the plan:
|
|
1110
|
-
// written. With it, a fresh plan runs only while it starts what the person
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
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
|
-
},
|
|
1199
|
+
// Start at login (spec §3.29, ADR-0029) and the Menu Bar Item (spec §3.31, ADR-0034). Without `confirm` the plan:
|
|
1200
|
+
// the file and what it starts, nothing is written. With it, a fresh plan runs only while it starts what the person
|
|
1201
|
+
// saw (`programArguments`).
|
|
1202
|
+
'/api/autostart': loginItemRoute(PANEL_AGENT),
|
|
1203
|
+
'/api/menubar': loginItemRoute(MENUBAR_AGENT),
|
|
1138
1204
|
// Undo for the quota setup above; the Runtime turns a teardown that throws into `{ ok: false, message }`.
|
|
1139
1205
|
'/api/quota/teardown': {
|
|
1140
1206
|
async run(body) {
|
|
@@ -1222,6 +1288,7 @@ export function createPanelHandler(opts) {
|
|
|
1222
1288
|
theme,
|
|
1223
1289
|
lang,
|
|
1224
1290
|
updates,
|
|
1291
|
+
...(ask ? { ask } : {}),
|
|
1225
1292
|
...(panel ? { panel } : {}),
|
|
1226
1293
|
}));
|
|
1227
1294
|
return true;
|
|
@@ -1253,9 +1320,10 @@ export function createPanelHandler(opts) {
|
|
|
1253
1320
|
return true;
|
|
1254
1321
|
}
|
|
1255
1322
|
// 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') {
|
|
1323
|
+
if (sub === '/api/autostart' || sub === '/api/menubar') {
|
|
1257
1324
|
const rt = await getRuntime();
|
|
1258
|
-
|
|
1325
|
+
const agent = sub === '/api/menubar' ? MENUBAR_AGENT : PANEL_AGENT;
|
|
1326
|
+
send(res, 200, autostartView(await autostartStatus(autostartCtx(rt), agent), rt.paths.home));
|
|
1259
1327
|
return true;
|
|
1260
1328
|
}
|
|
1261
1329
|
if (sub === '/api/state') {
|
package/dist/src/panel/i18n.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export type PanelLang = 'en' | 'zh';
|
|
|
2
2
|
declare const en: {
|
|
3
3
|
'top.tagline': string;
|
|
4
4
|
'top.refresh': string;
|
|
5
|
+
'top.repo': string;
|
|
5
6
|
'top.loading': string;
|
|
6
7
|
'top.refreshing': string;
|
|
7
8
|
'top.updated': string;
|
|
@@ -21,6 +22,7 @@ declare const en: {
|
|
|
21
22
|
'upd.cannot': string;
|
|
22
23
|
'upd.skillToo': string;
|
|
23
24
|
'upd.skillDone': string;
|
|
25
|
+
'upd.skillSyncing': string;
|
|
24
26
|
'upd.skillManaged': string;
|
|
25
27
|
'upd.checksOff': string;
|
|
26
28
|
'upd.latest': string;
|
|
@@ -40,6 +42,7 @@ declare const en: {
|
|
|
40
42
|
'loc.switching': string;
|
|
41
43
|
'loc.stuck': string;
|
|
42
44
|
'loc.reload': string;
|
|
45
|
+
'loc.unconfirmed': string;
|
|
43
46
|
'upd.open': string;
|
|
44
47
|
'upd.autoIsOn': string;
|
|
45
48
|
'upd.autoIsOff': string;
|
|
@@ -57,6 +60,8 @@ declare const en: {
|
|
|
57
60
|
'upd.now': string;
|
|
58
61
|
'upd.updating': string;
|
|
59
62
|
'upd.done': string;
|
|
63
|
+
'upd.confirming': string;
|
|
64
|
+
'upd.unconfirmed': string;
|
|
60
65
|
'upd.reloading': string;
|
|
61
66
|
'upd.restartHint': string;
|
|
62
67
|
'upd.skillLabel': string;
|
|
@@ -407,6 +412,7 @@ declare const en: {
|
|
|
407
412
|
'ai.examples': string;
|
|
408
413
|
'ai.copy': string;
|
|
409
414
|
'ai.ask.quota': string;
|
|
415
|
+
'ai.ask.pick': string;
|
|
410
416
|
'ai.ask.new': string;
|
|
411
417
|
'ai.ask.pin': string;
|
|
412
418
|
'ai.ask.fix': string;
|
|
@@ -466,6 +472,7 @@ declare const en: {
|
|
|
466
472
|
'ask.terminal': string;
|
|
467
473
|
'ask.chooseAccount': string;
|
|
468
474
|
'ask.confirm': string;
|
|
475
|
+
'ask.safe': string;
|
|
469
476
|
'ask.open': string;
|
|
470
477
|
'ask.opening': string;
|
|
471
478
|
'ask.loading': string;
|
|
@@ -503,6 +510,43 @@ declare const en: {
|
|
|
503
510
|
'ask.otherTool': string;
|
|
504
511
|
'ask.otherToolSub': string;
|
|
505
512
|
'ask.plugin': string;
|
|
513
|
+
'pk.title': string;
|
|
514
|
+
'pk.intro': string;
|
|
515
|
+
'pk.none': string;
|
|
516
|
+
'pk.noneYet': string;
|
|
517
|
+
'pk.exists': string;
|
|
518
|
+
'pk.start': string;
|
|
519
|
+
'pk.startTip': string;
|
|
520
|
+
'pk.remove': string;
|
|
521
|
+
'pk.removed': string;
|
|
522
|
+
'pk.nameLabel': string;
|
|
523
|
+
'pk.hint': string;
|
|
524
|
+
'pk.shadows': string;
|
|
525
|
+
'pk.add': string;
|
|
526
|
+
'pk.addAnyway': string;
|
|
527
|
+
'pk.added': string;
|
|
528
|
+
'pk.newShell': string;
|
|
529
|
+
'pk.offerShort': string;
|
|
530
|
+
'pk.offerMore': string;
|
|
531
|
+
'pk.rename': string;
|
|
532
|
+
'pk.addedSetup': string;
|
|
533
|
+
'pk.renamedSetup': string;
|
|
534
|
+
'ss.title': string;
|
|
535
|
+
'ss.body': string;
|
|
536
|
+
'ss.add': string;
|
|
537
|
+
'ss.adding': string;
|
|
538
|
+
'ss.added': string;
|
|
539
|
+
'ss.undo': string;
|
|
540
|
+
'ss.removed': string;
|
|
541
|
+
'pk.save': string;
|
|
542
|
+
'pk.renamed': string;
|
|
543
|
+
'pk.fileFailed': string;
|
|
544
|
+
'pk.why.othersFull': string;
|
|
545
|
+
'pk.offerNoName': string;
|
|
546
|
+
'pk.namePh': string;
|
|
547
|
+
'pk.started': string;
|
|
548
|
+
'pk.why.room': string;
|
|
549
|
+
'pk.why.noData': string;
|
|
506
550
|
'login.opened': string;
|
|
507
551
|
'login.failed': string;
|
|
508
552
|
'login.automation': string;
|
|
@@ -559,6 +603,10 @@ declare const en: {
|
|
|
559
603
|
'menu.copyDir': string;
|
|
560
604
|
'menu.copyEmail': string;
|
|
561
605
|
'menu.check': string;
|
|
606
|
+
'menu.editSettings': string;
|
|
607
|
+
'edit.opened': string;
|
|
608
|
+
'edit.shared': string;
|
|
609
|
+
'edit.failed': string;
|
|
562
610
|
'menu.like': string;
|
|
563
611
|
'menu.tune': string;
|
|
564
612
|
'menu.model': string;
|
|
@@ -892,6 +940,30 @@ declare const en: {
|
|
|
892
940
|
'as.doneOn': string;
|
|
893
941
|
'as.doneOff': string;
|
|
894
942
|
'as.nextLogin': string;
|
|
943
|
+
'mb.label': string;
|
|
944
|
+
'mb.hint': string;
|
|
945
|
+
'mb.onTitle': string;
|
|
946
|
+
'mb.offTitle': string;
|
|
947
|
+
'mb.writes': string;
|
|
948
|
+
'mb.removes': string;
|
|
949
|
+
'mb.turnOn': string;
|
|
950
|
+
'mb.turnOff': string;
|
|
951
|
+
'mb.hintTitle': string;
|
|
952
|
+
'mb.hintBody': string;
|
|
953
|
+
'mb.hintYes': string;
|
|
954
|
+
'mb.hintNo': string;
|
|
955
|
+
'mb.noWindow': string;
|
|
956
|
+
'mb.offNote': string;
|
|
957
|
+
'mb.alreadyOn': string;
|
|
958
|
+
'mb.alreadyOff': string;
|
|
959
|
+
'mb.doneOn': string;
|
|
960
|
+
'mb.doneOff': string;
|
|
961
|
+
'mb.nextLogin': string;
|
|
962
|
+
'mb.stale': string;
|
|
963
|
+
'mb.other': string;
|
|
964
|
+
'mb.foreign': string;
|
|
965
|
+
'mb.unsupported': string;
|
|
966
|
+
'ai.ask.menubar': string;
|
|
895
967
|
'as.changedSince': string;
|
|
896
968
|
'as.block.npx-cache': string;
|
|
897
969
|
'as.block.temp-dir': string;
|