sideby 0.23.1 → 0.25.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 +2 -1
- package/dist/build.json +1 -1
- package/dist/src/cli/commands.js +9 -6
- package/dist/src/cli/json-schemas.js +1 -0
- package/dist/src/cli/main.js +6 -5
- package/dist/src/core/ask.d.ts +10 -6
- package/dist/src/core/ask.js +47 -9
- package/dist/src/core/config.js +7 -1
- package/dist/src/core/themes.d.ts +2 -2
- package/dist/src/core/themes.js +10 -6
- package/dist/src/families/agy/index.js +4 -1
- package/dist/src/families/claude/index.js +4 -1
- package/dist/src/families/codex/index.js +8 -1
- package/dist/src/families/grok/index.js +4 -1
- package/dist/src/families/pi/index.js +4 -1
- package/dist/src/panel/handler.js +1 -1
- package/dist/src/panel/i18n.d.ts +0 -2
- package/dist/src/panel/i18n.js +0 -4
- package/dist/src/panel/page-logic.d.ts +11 -0
- package/dist/src/panel/page-logic.js +27 -2
- package/dist/src/panel/page-script.js +36 -10
- package/dist/src/panel/page-styles.js +35 -25
- package/dist/src/panel/page.js +6 -0
- package/dist/src/panel/theme.d.ts +3 -1
- package/dist/src/panel/theme.js +1 -0
- package/dist/src/panel/themes.d.ts +4 -2
- package/dist/src/panel/themes.js +378 -140
- package/dist/src/types.d.ts +7 -0
- package/package.json +2 -2
- package/schemas/config.json +1 -1
- package/schemas/try.json +4 -0
- package/skills/sideby/SKILL.md +2 -2
- package/skills/sideby/references/ai-tasks.md +1 -0
- package/skills/sideby/references/themes.md +6 -6
package/README.md
CHANGED
|
@@ -92,7 +92,8 @@ cc-switch's docs describe that switch: it writes the live settings file ([README
|
|
|
92
92
|
| Find the cheapest auto-compact size from your own sessions, and use it in one click | `sideby tune` (or the panel's Context tuning tab) | [Context tuning](docs/guide/usage.md#context-tuning) |
|
|
93
93
|
| See each account's model and effort, and set them per account | `sideby model <account>` (or click the model in the panel) | [Model and effort](docs/guide/usage.md#model-and-effort) |
|
|
94
94
|
| Choose whether Claude sessions connect to claude.ai by themselves (Remote Control), for every account at once | `sideby remote-control off` or `on` (or the panel's Settings) | [Remote Control](docs/guide/usage.md#remote-control) |
|
|
95
|
-
| Pin the accounts you use most
|
|
95
|
+
| Pin the accounts you use most, put tools and accounts in your own order, and hide the ones you never use | `sideby pin claude:work`, `sideby order`, `sideby hide grok` (or the panel's Settings) | [Your own order](docs/guide/usage.md#your-own-order) |
|
|
96
|
+
| Give the panel other colors: five built-in Themes, your own color, or one your AI writes | **Settings › Theme** in the panel, or `sideby theme use leaf` | [Themes](docs/guide/panel.md#themes) |
|
|
96
97
|
| Move on when an account hits its limit | `sideby next claude` | [Handoff](docs/guide/usage.md#when-an-account-hits-its-limit) |
|
|
97
98
|
| Let a running task move to the next account by itself when quota runs low (off by default; see the risk) | `sideby handoff enable` (or the panel) | [Auto Handoff](docs/guide/usage.md#auto-handoff) |
|
|
98
99
|
| Short commands such as `ccw` | `sideby alias add ccw claude:work` | [Shell functions](docs/guide/configuration.md#shell-functions) |
|
package/dist/build.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"id":"
|
|
1
|
+
{"id":"20261026T102043-565ca8"}
|
package/dist/src/cli/commands.js
CHANGED
|
@@ -2429,19 +2429,21 @@ export async function cmdKey(a, io, runtime) {
|
|
|
2429
2429
|
export async function cmdTry(a, io) {
|
|
2430
2430
|
const { tryAccount, tryPreview } = await import('../core/ask.js');
|
|
2431
2431
|
if (a.positionals.length !== 1 || a.rest.length)
|
|
2432
|
-
throw new UsageError('Use sideby try <account> [--yes] [--json].');
|
|
2432
|
+
throw new UsageError('Use sideby try <account> [--model <model>] [--yes] [--json].');
|
|
2433
|
+
const model = a.flags.get('model');
|
|
2433
2434
|
const rt = await createRuntime();
|
|
2434
|
-
const
|
|
2435
|
+
const ref = a.positionals[0];
|
|
2436
|
+
const { account, command } = await tryPreview(rt, ref, model);
|
|
2435
2437
|
if (!a.flags.has('yes')) {
|
|
2436
2438
|
if (a.flags.has('json'))
|
|
2437
|
-
json(io, { account: account.ref, command, confirmed: false });
|
|
2439
|
+
json(io, { account: account.ref, ...(model === undefined ? {} : { model }), command, confirmed: false });
|
|
2438
2440
|
else
|
|
2439
2441
|
io.out(`This spends a few tokens: ${command.map((v) => JSON.stringify(v)).join(' ')}. Run again with --yes to continue.`);
|
|
2440
2442
|
return 10;
|
|
2441
2443
|
}
|
|
2442
|
-
const { account:
|
|
2444
|
+
const { account: done, command: _command, ...result } = await tryAccount(rt, ref, undefined, model);
|
|
2443
2445
|
if (a.flags.has('json'))
|
|
2444
|
-
json(io, { account:
|
|
2446
|
+
json(io, { account: done, confirmed: true, ...result });
|
|
2445
2447
|
else
|
|
2446
2448
|
io.out(result.ok ? 'OK' : result.output || 'The Host did not reply; check the account and try again.');
|
|
2447
2449
|
return result.ok ? 0 : 1;
|
|
@@ -3596,6 +3598,7 @@ async function messagesInbound(a, args, io, runtime) {
|
|
|
3596
3598
|
export async function cmdTheme(a, io) {
|
|
3597
3599
|
const t = await import('../core/themes.js');
|
|
3598
3600
|
const { loadConfig } = await import('../core/config.js');
|
|
3601
|
+
const { DEFAULT_THEME_ID } = await import('../panel/themes.js');
|
|
3599
3602
|
const [sub = 'list', target, ...more] = a.positionals;
|
|
3600
3603
|
const wantJson = a.flags.has('json');
|
|
3601
3604
|
const paths = resolvePaths();
|
|
@@ -3603,7 +3606,7 @@ export async function cmdTheme(a, io) {
|
|
|
3603
3606
|
if (more.length)
|
|
3604
3607
|
throw new UsageError(usage);
|
|
3605
3608
|
const active = async () => (await loadConfig(paths.configFile).catch(() => ({}))).panel
|
|
3606
|
-
?.colorTheme ??
|
|
3609
|
+
?.colorTheme ?? DEFAULT_THEME_ID;
|
|
3607
3610
|
// A name, or a path to a Theme File not yet in the themes folder.
|
|
3608
3611
|
const load = async (ref) => {
|
|
3609
3612
|
if (t.THEME_ID_RE.test(ref) && !ref.endsWith('.json'))
|
|
@@ -1285,6 +1285,7 @@ export const OUTPUT_SCHEMAS = {
|
|
|
1285
1285
|
try: Type.Object({
|
|
1286
1286
|
schemaVersion: Version,
|
|
1287
1287
|
account: Str,
|
|
1288
|
+
model: Type.Optional(Type.String({ description: 'The model `--model` chose, when given.' })),
|
|
1288
1289
|
confirmed: Type.Boolean(),
|
|
1289
1290
|
command: Type.Optional(Type.Array(Str)),
|
|
1290
1291
|
ok: Type.Optional(Type.Boolean()),
|
package/dist/src/cli/main.js
CHANGED
|
@@ -10,7 +10,7 @@ Usage:
|
|
|
10
10
|
sideby ask [<text>] [--print] let your AI handle a sideby task
|
|
11
11
|
sideby terminal [--set <id>|--custom <t>|--unset] choose your terminal
|
|
12
12
|
sideby key <account> [--var <NAME>] enter an API key without echo
|
|
13
|
-
sideby try <account> [--
|
|
13
|
+
sideby try <account> [--model <m>] try the Host with a short paid request
|
|
14
14
|
sideby list accounts (same as \`sideby list\`)
|
|
15
15
|
sideby list --all also list hidden families and accounts
|
|
16
16
|
sideby run <account> [-- args] start the host CLI for one account
|
|
@@ -153,7 +153,7 @@ const COMMAND_HELP = {
|
|
|
153
153
|
ask: 'sideby ask [<text>] [--task free|fix|quota|account|host|plugin|terminal|handoff|theme|menubar|hotkey] [--account <ref>] [--terminal <id>] [--attach <file>]... [--print] [--json]\nsideby ask --run <id> [--state-dir <dir>]\nsideby ask --spec - [--print] --json\nsideby ask --choices --json\nOpen a task in your terminal. --spec reads a Task Spec (one JSON object, at most 1 MB) from stdin, as a Portal sends it; --choices lists the accounts and terminals a task can use. --attach adds an image (PNG, JPEG, GIF, WebP; up to 20 MB) or a video (MP4, MOV, WebM; up to 200 MB), at most 5. --print prints only the prompt. If opening fails, paste the command into a terminal.',
|
|
154
154
|
terminal: "sideby terminal [--set <id>|--custom '<program> … {cwd} … {cmd}'|--unset] [--json]\nList terminals or save your preference; --custom saves and selects your own launch command.",
|
|
155
155
|
key: 'sideby key <account> [--var <NAME>] [--json]\nEnter an API key without echo. Run in a terminal or use the Panel key box.',
|
|
156
|
-
try: 'sideby try <account> [--yes] [--json]\nSend a short request through the Host. This spends a few tokens. Exit 10 waits for --yes.',
|
|
156
|
+
try: 'sideby try <account> [--model <model>] [--yes] [--json]\nSend a short request through the Host. This spends a few tokens. Exit 10 waits for --yes.\n<account> may be a short command; its arguments apply as in sideby run. --model tries another model once.',
|
|
157
157
|
plugins: 'sideby plugins [--json]\nsideby plugins new <id> [--json]\nsideby plugins check <id|path> [--json]\nPlugins run as you, with your permissions. Only load plugins you trust.',
|
|
158
158
|
new: `sideby new <family> <name> [--api] [--alias <short>] [--json]
|
|
159
159
|
sideby new <family> --next [--api] [--alias <short>] [--json]
|
|
@@ -407,8 +407,9 @@ sideby theme import <file> [--id <name>] [--yes] [--json]
|
|
|
407
407
|
sideby theme export <name> [--out <file>] [--json]
|
|
408
408
|
sideby theme remove <name> [--yes] [--json]
|
|
409
409
|
|
|
410
|
-
The Panel's colors. Built-in Themes:
|
|
411
|
-
|
|
410
|
+
The Panel's colors. Built-in Themes: teal (default), leaf, celeste, claude and codex. A Theme File is JSON in
|
|
411
|
+
<config>/themes/<name>.json:
|
|
412
|
+
{"schemaVersion": 1, "name": "My blue", "base": "celeste", "accent": "#2f7fbf", "light": {...}, "dark": {...}}
|
|
412
413
|
base and accent are optional; light and dark take the same tokens as a Portal Theme. Files hold colors only, never code.
|
|
413
414
|
check reports text and control contrast in light and dark with a value that would pass (exit 1 when any fails); the
|
|
414
415
|
Panel moves failing colors itself. preview shows a Theme once in the running Panel without switching. Exit 10: import
|
|
@@ -492,7 +493,7 @@ const COMMANDS = {
|
|
|
492
493
|
},
|
|
493
494
|
terminal: { flags: ['json', 'unset'], valued: ['set', 'custom'] },
|
|
494
495
|
key: { flags: ['json'], valued: ['var'] },
|
|
495
|
-
try: { flags: ['json', 'yes'] },
|
|
496
|
+
try: { flags: ['json', 'yes'], valued: ['model'] },
|
|
496
497
|
autostart: { flags: ['json', 'yes', 'refresh'] },
|
|
497
498
|
menubar: { flags: ['json', 'yes', 'refresh'], valued: ['lang', 'hotkey', 'hotkey-label', 'icon'] },
|
|
498
499
|
config: { flags: ['json', 'yes'] },
|
package/dist/src/core/ask.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { taskPrompt } from '../panel/page-logic.ts';
|
|
2
2
|
import type { Runtime } from '../runtime.ts';
|
|
3
|
-
import type { Account, Env } from '../types.ts';
|
|
3
|
+
import type { Account, Env, FamilyDef } from '../types.ts';
|
|
4
4
|
import { type Attachment } from './attachments.ts';
|
|
5
5
|
import { UserError } from './errors.ts';
|
|
6
6
|
import { type Paths } from './paths.ts';
|
|
@@ -213,12 +213,14 @@ export declare function openPickInTerminal(rt: Runtime, name: string): Promise<{
|
|
|
213
213
|
detail?: string | undefined;
|
|
214
214
|
}>;
|
|
215
215
|
/**
|
|
216
|
-
* What `try` will run for an Account, computed as `sideby run` would (Family defaults, config arguments
|
|
217
|
-
* reading its Secret File or running `launch.before` hooks: nothing runs before the
|
|
216
|
+
* What `try` will run for an Account, computed as `sideby run` would (Family defaults, config arguments, a short
|
|
217
|
+
* command's arguments) but without reading its Secret File or running `launch.before` hooks: nothing runs before the
|
|
218
|
+
* user agrees. `model` replaces the model those arguments choose.
|
|
218
219
|
*/
|
|
219
|
-
export declare function tryPreview(rt: Runtime, ref: string): Promise<{
|
|
220
|
+
export declare function tryPreview(rt: Runtime, ref: string, model?: string): Promise<{
|
|
220
221
|
account: Account;
|
|
221
|
-
family:
|
|
222
|
+
family: FamilyDef;
|
|
223
|
+
probe: string[];
|
|
222
224
|
command: string[];
|
|
223
225
|
}>;
|
|
224
226
|
/**
|
|
@@ -226,12 +228,14 @@ export declare function tryPreview(rt: Runtime, ref: string): Promise<{
|
|
|
226
228
|
* folder under the task directory that is removed afterwards. The caller has already said it spends a few tokens. The
|
|
227
229
|
* launch is prepared once here, so `launch.before` hooks run once, and the command returned is what actually ran.
|
|
228
230
|
* `spawn` replaces the process start (tests); by default the Host runs with stdin ignored and is killed at the timeout.
|
|
231
|
+
* `ref` may be a short command, whose arguments apply as in `sideby run`; `model` replaces the model they choose.
|
|
229
232
|
*/
|
|
230
|
-
export declare function tryAccount(rt: Runtime, ref: string, spawn?: ProbeDeps['spawn']): Promise<{
|
|
233
|
+
export declare function tryAccount(rt: Runtime, ref: string, spawn?: ProbeDeps['spawn'], model?: string): Promise<{
|
|
231
234
|
ok: boolean;
|
|
232
235
|
exitCode: number | null;
|
|
233
236
|
output: string;
|
|
234
237
|
timedOut: boolean;
|
|
235
238
|
account: string;
|
|
239
|
+
model?: string | undefined;
|
|
236
240
|
command: string[];
|
|
237
241
|
}>;
|
package/dist/src/core/ask.js
CHANGED
|
@@ -3,6 +3,7 @@ import { constants } from 'node:fs';
|
|
|
3
3
|
import { lstat, mkdtemp, open, readdir, realpath, rm, stat, unlink } from 'node:fs/promises';
|
|
4
4
|
import { userInfo } from 'node:os';
|
|
5
5
|
import { dirname, isAbsolute, join, sep } from 'node:path';
|
|
6
|
+
import { MODEL_NAME, takeFlag } from '../families/shared/model-args.js';
|
|
6
7
|
import { AI_TASK_KINDS, stripSecrets, taskPrompt } from '../panel/page-logic.js';
|
|
7
8
|
import { checkAttachmentFiles, copyAttachments, MAX_ATTACHMENTS, privateDir, removeOldAttachments, stagedAttachments, takeStaged, } from './attachments.js';
|
|
8
9
|
import { editConfigAsk, editConfigTerminal } from './config.js';
|
|
@@ -454,33 +455,70 @@ export async function openPickInTerminal(rt, name) {
|
|
|
454
455
|
throw new UserError(`No short command "${name}" picks an account; add one in the Panel or with \`sideby alias add ${name} --pick <family>\`.`);
|
|
455
456
|
return openTask(rt, { kind: 'run', account: name, cwd: rt.paths.home });
|
|
456
457
|
}
|
|
458
|
+
/** The probe arguments for `model`, or the plain probe; refuses a model the Family cannot choose or a malformed name. */
|
|
459
|
+
function probeArgs(family, model) {
|
|
460
|
+
const probe = family.probe;
|
|
461
|
+
if (model === undefined)
|
|
462
|
+
return probe.args;
|
|
463
|
+
if (!probe.model)
|
|
464
|
+
throw new UserError(`${family.title} cannot be tried with another model; leave out --model.`, {
|
|
465
|
+
code: 'no-model-choice',
|
|
466
|
+
});
|
|
467
|
+
if (!MODEL_NAME.test(model))
|
|
468
|
+
throw new UserError('A model name uses letters, digits and ._:/[]- only (at most 100); check the name.', {
|
|
469
|
+
code: 'model-invalid',
|
|
470
|
+
});
|
|
471
|
+
return probe.model.args(model);
|
|
472
|
+
}
|
|
473
|
+
/**
|
|
474
|
+
* With `--model`, the model options of the arguments before the probe's (the Account's and the short command's) are
|
|
475
|
+
* taken out, so the Host gets one model. Arguments a hook added around them stay; if the probe's own arguments
|
|
476
|
+
* cannot be found, nothing changes.
|
|
477
|
+
*/
|
|
478
|
+
function oneModel(args, probe, family, model) {
|
|
479
|
+
if (model === undefined || !family.probe?.model)
|
|
480
|
+
return args;
|
|
481
|
+
for (let at = args.length - probe.length; at >= 0; at--)
|
|
482
|
+
if (probe.every((v, i) => args[at + i] === v))
|
|
483
|
+
return [...takeFlag(args.slice(0, at), family.probe.model.flags).rest, ...args.slice(at)];
|
|
484
|
+
return args;
|
|
485
|
+
}
|
|
457
486
|
/**
|
|
458
|
-
* What `try` will run for an Account, computed as `sideby run` would (Family defaults, config arguments
|
|
459
|
-
* reading its Secret File or running `launch.before` hooks: nothing runs before the
|
|
487
|
+
* What `try` will run for an Account, computed as `sideby run` would (Family defaults, config arguments, a short
|
|
488
|
+
* command's arguments) but without reading its Secret File or running `launch.before` hooks: nothing runs before the
|
|
489
|
+
* user agrees. `model` replaces the model those arguments choose.
|
|
460
490
|
*/
|
|
461
|
-
export async function tryPreview(rt, ref) {
|
|
491
|
+
export async function tryPreview(rt, ref, model) {
|
|
462
492
|
const account = await rt.resolve(ref);
|
|
463
493
|
const family = rt.families.get(account.family);
|
|
464
494
|
if (!family?.probe)
|
|
465
495
|
throw new UserError(`This tool cannot be tried; use \`sideby run ${account.ref}\` instead.`, {
|
|
466
496
|
code: 'no-probe',
|
|
467
497
|
});
|
|
468
|
-
const
|
|
469
|
-
|
|
498
|
+
const probe = probeArgs(family, model);
|
|
499
|
+
const { bin, args } = await rt.launchCommand(ref, probe, 'run');
|
|
500
|
+
return { account, family, probe, command: [bin, ...oneModel(args, probe, family, model)] };
|
|
470
501
|
}
|
|
471
502
|
/**
|
|
472
503
|
* `sideby try` and the Panel (spec §3.28): runs the Family's probe once the way Launch starts the Host, in a temp
|
|
473
504
|
* folder under the task directory that is removed afterwards. The caller has already said it spends a few tokens. The
|
|
474
505
|
* launch is prepared once here, so `launch.before` hooks run once, and the command returned is what actually ran.
|
|
475
506
|
* `spawn` replaces the process start (tests); by default the Host runs with stdin ignored and is killed at the timeout.
|
|
507
|
+
* `ref` may be a short command, whose arguments apply as in `sideby run`; `model` replaces the model they choose.
|
|
476
508
|
*/
|
|
477
|
-
export async function tryAccount(rt, ref, spawn = spawnProbe) {
|
|
478
|
-
const { account, family } = await tryPreview(rt, ref);
|
|
479
|
-
const
|
|
509
|
+
export async function tryAccount(rt, ref, spawn = spawnProbe, model) {
|
|
510
|
+
const { account, family, probe } = await tryPreview(rt, ref, model);
|
|
511
|
+
const prepared = await rt.prepareLaunch(ref, probe, 'run');
|
|
512
|
+
const launch = { ...prepared, args: oneModel(prepared.args, probe, family, model) };
|
|
480
513
|
const cwd = await mkdtemp(join(await taskWorkDir(rt.paths), 'probe-'));
|
|
481
514
|
try {
|
|
482
515
|
const result = await runProbe(account, { family, baseEnv: rt.env, cwd, launch, spawn });
|
|
483
|
-
return {
|
|
516
|
+
return {
|
|
517
|
+
account: account.ref,
|
|
518
|
+
...(model === undefined ? {} : { model }),
|
|
519
|
+
command: [launch.bin, ...launch.args],
|
|
520
|
+
...result,
|
|
521
|
+
};
|
|
484
522
|
}
|
|
485
523
|
finally {
|
|
486
524
|
await rm(cwd, { recursive: true, force: true });
|
package/dist/src/core/config.js
CHANGED
|
@@ -2,6 +2,7 @@ import { mkdir, readFile } from 'node:fs/promises';
|
|
|
2
2
|
import { dirname } from 'node:path';
|
|
3
3
|
import { Type } from 'typebox';
|
|
4
4
|
import { Value } from 'typebox/value';
|
|
5
|
+
import { RENAMED_THEMES } from '../panel/themes.js';
|
|
5
6
|
import { UserError } from './errors.js';
|
|
6
7
|
import { lstatOrNull, parseJsonSafely, realpathOrNull, sha256, writeIfUnchanged } from './fs-safe.js';
|
|
7
8
|
import { SHARE_MODES } from './share-mode-names.js';
|
|
@@ -124,7 +125,7 @@ export const ConfigSchema = Type.Object({
|
|
|
124
125
|
})),
|
|
125
126
|
colorTheme: Type.Optional(Type.String({
|
|
126
127
|
pattern: '^[a-z0-9][a-z0-9-]{0,39}$',
|
|
127
|
-
description: 'Panel Theme: a Built-in Theme (
|
|
128
|
+
description: 'Panel Theme: a Built-in Theme (teal, the default, leaf, celeste, claude or codex; the old sky reads as celeste) or a Theme File in <config>/themes (spec §3.34).',
|
|
128
129
|
})),
|
|
129
130
|
}, { additionalProperties: false, description: 'How the Panel looks (spec §3.29).' })),
|
|
130
131
|
menubar: Type.Optional(Type.Object({
|
|
@@ -299,6 +300,11 @@ export async function loadConfig(file) {
|
|
|
299
300
|
const shortProblem = shortCommandProblem(data);
|
|
300
301
|
if (shortProblem)
|
|
301
302
|
throw new ConfigError(`${file}: ${shortProblem}`);
|
|
303
|
+
// Built-in Themes renamed with the design system (sky is now celeste): an old name reads as the new one,
|
|
304
|
+
// so a Panel set up before keeps a Theme instead of falling back.
|
|
305
|
+
const color = data.panel?.colorTheme;
|
|
306
|
+
if (color && Object.hasOwn(RENAMED_THEMES, color))
|
|
307
|
+
data.panel = { ...data.panel, colorTheme: RENAMED_THEMES[color] };
|
|
302
308
|
return data;
|
|
303
309
|
}
|
|
304
310
|
/** A Pick Command whose name is unsafe in a shell or also an Alias (they share one namespace), or null. */
|
|
@@ -27,7 +27,7 @@ export interface ResolvedColors {
|
|
|
27
27
|
dark: PanelThemeTokens;
|
|
28
28
|
/** How many colors were moved to pass the contrast check. */
|
|
29
29
|
adjusted: number;
|
|
30
|
-
/** Set when the chosen Theme could not be used and
|
|
30
|
+
/** Set when the chosen Theme could not be used and the Default Theme stands in. */
|
|
31
31
|
fallback?: string;
|
|
32
32
|
}
|
|
33
33
|
export declare const themesDir: (paths: Paths) => string;
|
|
@@ -54,7 +54,7 @@ export declare function themeColors(theme: ThemeFile): {
|
|
|
54
54
|
light: PanelThemeTokens;
|
|
55
55
|
dark: PanelThemeTokens;
|
|
56
56
|
};
|
|
57
|
-
/** The colors for a Theme id (Built-in or file), with failing pairs moved until they pass. Unknown or broken:
|
|
57
|
+
/** The colors for a Theme id (Built-in or file), with failing pairs moved until they pass. Unknown or broken: the Default Theme. */
|
|
58
58
|
export declare function resolveColors(paths: Paths, id: string | undefined): Promise<ResolvedColors>;
|
|
59
59
|
/** A 12-step scale around one color: step 9 is the color, the others follow the template's lightness. */
|
|
60
60
|
export declare function accentScale(hex: string, dark: boolean): string[];
|
package/dist/src/core/themes.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
// Themes (spec §3.34, ADR-0050): the
|
|
1
|
+
// Themes (spec §3.34, ADR-0050): the Built-in Themes plus the user's Theme Files in <config>/themes/<id>.json.
|
|
2
2
|
// A Theme File is data only: a base Built-in Theme, an optional accent that regenerates the accent roles, and token
|
|
3
3
|
// overrides checked like a Portal Theme's. This module lists, checks, resolves and switches them; it never runs code.
|
|
4
4
|
import { lstat, mkdir, readdir, readFile, rm } from 'node:fs/promises';
|
|
5
5
|
import { join } from 'node:path';
|
|
6
6
|
import { THEME_TOKENS, themeValueProblem } from '../panel/theme.js';
|
|
7
|
-
import { BUILTIN_THEMES, DEFAULT_THEME_ID } from '../panel/themes.js';
|
|
7
|
+
import { BUILTIN_THEMES, DEFAULT_THEME_ID, RENAMED_THEMES } from '../panel/themes.js';
|
|
8
8
|
import { editConfigPanel, loadConfig } from './config.js';
|
|
9
9
|
import { writeFileAtomic } from './fs-safe.js';
|
|
10
10
|
export const THEME_ID_RE = /^[a-z0-9][a-z0-9-]{0,39}$/;
|
|
@@ -13,7 +13,8 @@ const HEX_RE = /^#[0-9a-fA-F]{6}$/;
|
|
|
13
13
|
export const themesDir = (paths) => join(paths.configDir, 'themes');
|
|
14
14
|
const undoFile = (paths) => join(paths.stateDir, 'theme-undo.json');
|
|
15
15
|
const previewFile = (paths) => join(paths.stateDir, 'theme-preview.json');
|
|
16
|
-
|
|
16
|
+
/** A Built-in Theme by id; a renamed one's old id (sky) finds the Theme it became. */
|
|
17
|
+
const builtin = (id) => BUILTIN_THEMES.find((t) => t.id === (Object.hasOwn(RENAMED_THEMES, id) ? RENAMED_THEMES[id] : id));
|
|
17
18
|
/**
|
|
18
19
|
* The name `sideby theme use` takes for "no Theme chosen": the Panel then shows the Default Theme on its own and,
|
|
19
20
|
* inside a Portal, the Portal's colors. It names no Theme File.
|
|
@@ -160,12 +161,12 @@ export function themeColors(theme) {
|
|
|
160
161
|
dark: { ...base.dark, ...accent.dark, ...theme.dark },
|
|
161
162
|
};
|
|
162
163
|
}
|
|
163
|
-
/** The colors for a Theme id (Built-in or file), with failing pairs moved until they pass. Unknown or broken:
|
|
164
|
+
/** The colors for a Theme id (Built-in or file), with failing pairs moved until they pass. Unknown or broken: the Default Theme. */
|
|
164
165
|
export async function resolveColors(paths, id) {
|
|
165
166
|
const want = id === undefined || id === NO_THEME ? DEFAULT_THEME_ID : id;
|
|
166
167
|
const b = builtin(want);
|
|
167
168
|
if (b)
|
|
168
|
-
return { id:
|
|
169
|
+
return { id: b.id, light: { ...b.light }, dark: { ...b.dark }, adjusted: 0 };
|
|
169
170
|
if (!THEME_ID_RE.test(want))
|
|
170
171
|
return { ...defaults(), fallback: `${want} is not a Theme name; using ${DEFAULT.name.en}` };
|
|
171
172
|
const r = await readThemeFile(join(themesDir(paths), `${want}.json`));
|
|
@@ -279,12 +280,14 @@ export function accentTokens(hex) {
|
|
|
279
280
|
},
|
|
280
281
|
};
|
|
281
282
|
}
|
|
282
|
-
// Text pairs need 4.5:1; the main button (bold text, ADR-0050) and the focus outline need 3:1.
|
|
283
|
+
// Text pairs need 4.5:1 (faint too: the Panel uses it for captions, units and reset times people read); the main button (bold text, ADR-0050) and the focus outline need 3:1.
|
|
283
284
|
const PAIRS = [
|
|
284
285
|
['text', 'bg', 4.5],
|
|
285
286
|
['text', 'surface', 4.5],
|
|
286
287
|
['muted', 'bg', 4.5],
|
|
287
288
|
['muted', 'surface', 4.5],
|
|
289
|
+
['faint', 'bg', 4.5],
|
|
290
|
+
['faint', 'surface', 4.5],
|
|
288
291
|
['accent', 'bg', 4.5],
|
|
289
292
|
['accent', 'surface', 4.5],
|
|
290
293
|
['ok', 'okSoft', 4.5],
|
|
@@ -324,6 +327,7 @@ function passing(fg, bg, min) {
|
|
|
324
327
|
// ---- Switching
|
|
325
328
|
/** Sets `panel.colorTheme`, keeping what it was so `undo` can put it back. */
|
|
326
329
|
export async function useTheme(paths, id) {
|
|
330
|
+
id = builtin(id)?.id ?? id;
|
|
327
331
|
if (id !== NO_THEME) {
|
|
328
332
|
const entry = (await listThemes(paths)).find((t) => t.id === id);
|
|
329
333
|
if (!entry)
|
|
@@ -28,7 +28,10 @@ export const agyFamily = {
|
|
|
28
28
|
],
|
|
29
29
|
apiVars: [],
|
|
30
30
|
// `-p` is one non-interactive prompt (agy 1.4.4 --help, 2026-10-21).
|
|
31
|
-
probe: {
|
|
31
|
+
probe: {
|
|
32
|
+
args: ['-p', 'Reply with OK'],
|
|
33
|
+
model: { flags: ['--model'], args: (m) => ['--model', m, '-p', 'Reply with OK'] },
|
|
34
|
+
},
|
|
32
35
|
// agy reads a prompt only from -p, -i or stdin: "unexpected argument" otherwise (agy 1.4.4, 2026-10-21).
|
|
33
36
|
promptArg: '--prompt-interactive',
|
|
34
37
|
aiTaskArgs: (args) => args.includes(SKIP_PERMISSIONS) ? args.filter((a) => a !== SKIP_PERMISSIONS) : [...args],
|
|
@@ -108,7 +108,10 @@ export const claudeFamily = {
|
|
|
108
108
|
apiVars: ['ANTHROPIC_BASE_URL', 'ANTHROPIC_AUTH_TOKEN', 'ANTHROPIC_MODEL'],
|
|
109
109
|
secretVar: 'ANTHROPIC_AUTH_TOKEN',
|
|
110
110
|
// `-p` is one non-interactive prompt (Claude Code 2.1.301 --help, 2026-10-17).
|
|
111
|
-
probe: {
|
|
111
|
+
probe: {
|
|
112
|
+
args: ['-p', 'Reply with OK'],
|
|
113
|
+
model: { flags: ['--model'], args: (m) => ['--model', m, '-p', 'Reply with OK'] },
|
|
114
|
+
},
|
|
112
115
|
aiTaskArgs: claudeAiTaskArgs,
|
|
113
116
|
settingsFile: 'settings.json',
|
|
114
117
|
sharedItems: [
|
|
@@ -36,7 +36,14 @@ export const codexFamily = {
|
|
|
36
36
|
secretVar: 'OPENAI_API_KEY',
|
|
37
37
|
// `exec` refuses to run outside a git repo unless this flag is set (Codex 0.163.0 --help:
|
|
38
38
|
// allow running outside a Git repository). The probe's cwd is a temp directory.
|
|
39
|
-
probe: {
|
|
39
|
+
probe: {
|
|
40
|
+
args: ['exec', '--skip-git-repo-check', 'Reply with OK'],
|
|
41
|
+
// `exec` reads its own `-m`; a `-m` before the subcommand does not reach it.
|
|
42
|
+
model: {
|
|
43
|
+
flags: ['-m', '--model'],
|
|
44
|
+
args: (m) => ['exec', '--skip-git-repo-check', '-m', m, 'Reply with OK'],
|
|
45
|
+
},
|
|
46
|
+
},
|
|
40
47
|
// `-i, --image <FILE>...` takes several values (Codex 0.163.0 --help); AI Tasks pass `--image=<path>`, one value
|
|
41
48
|
// per flag, so the prompt after it stays a positional argument.
|
|
42
49
|
imageArg: '--image',
|
|
@@ -51,7 +51,10 @@ export const grokFamily = {
|
|
|
51
51
|
apiVars: ['GROK_MODELS_BASE_URL', 'XAI_API_KEY'],
|
|
52
52
|
secretVar: 'XAI_API_KEY',
|
|
53
53
|
// `-p` is one non-interactive prompt (Grok Build 1.0.60 --help, 2026-10-17).
|
|
54
|
-
probe: {
|
|
54
|
+
probe: {
|
|
55
|
+
args: ['-p', 'Reply with OK'],
|
|
56
|
+
model: { flags: ['-m', '--model'], args: (m) => ['--model', m, '-p', 'Reply with OK'] },
|
|
57
|
+
},
|
|
55
58
|
settingsFile: 'config.toml',
|
|
56
59
|
sharedItems: [
|
|
57
60
|
{ path: 'skills', mode: 'link' },
|
|
@@ -44,7 +44,10 @@ export const piFamily = {
|
|
|
44
44
|
// First key in the proxy.env template `new --api` writes. The OpenAI key is still set with `--var`.
|
|
45
45
|
secretVar: 'ANTHROPIC_API_KEY',
|
|
46
46
|
// `-p` is one non-interactive prompt (pi 1.3.0 --help, 2026-10-17).
|
|
47
|
-
probe: {
|
|
47
|
+
probe: {
|
|
48
|
+
args: ['-p', 'Reply with OK'],
|
|
49
|
+
model: { flags: ['--model'], args: (m) => ['--model', m, '-p', 'Reply with OK'] },
|
|
50
|
+
},
|
|
48
51
|
settingsFile: 'settings.json',
|
|
49
52
|
sharedItems: [
|
|
50
53
|
{ path: 'AGENTS.md', mode: 'link' },
|
|
@@ -1081,7 +1081,7 @@ export function createPanelHandler(opts) {
|
|
|
1081
1081
|
const account = optString(body, 'account');
|
|
1082
1082
|
if (!account)
|
|
1083
1083
|
throw new HttpError(400, '"account" is required');
|
|
1084
|
-
return tryAccount(await getRuntime(), account);
|
|
1084
|
+
return tryAccount(await getRuntime(), account, undefined, optString(body, 'model'));
|
|
1085
1085
|
},
|
|
1086
1086
|
},
|
|
1087
1087
|
// Themes (spec §3.34): `use` a Theme, `undo` the last switch, `accent` saves and uses the Theme File custom.json
|
package/dist/src/panel/i18n.d.ts
CHANGED
package/dist/src/panel/i18n.js
CHANGED
|
@@ -629,8 +629,6 @@ const en = {
|
|
|
629
629
|
'th.title': 'Theme',
|
|
630
630
|
'th.intro': 'The colors of this Panel. Warnings and errors stay easy to read in every Theme.',
|
|
631
631
|
'th.loading': 'Reading Themes…',
|
|
632
|
-
'th.inUse': 'In use',
|
|
633
|
-
'th.mine': 'Your Theme',
|
|
634
632
|
'th.switched': 'Switched to {name}.',
|
|
635
633
|
'th.custom': 'Your color',
|
|
636
634
|
'th.undo': 'Undo',
|
|
@@ -2024,8 +2022,6 @@ const zh = {
|
|
|
2024
2022
|
'th.title': '主题',
|
|
2025
2023
|
'th.intro': '这个面板的颜色。每套主题里,提醒和报错都看得清。',
|
|
2026
2024
|
'th.loading': '正在读取主题…',
|
|
2027
|
-
'th.inUse': '使用中',
|
|
2028
|
-
'th.mine': '你的主题',
|
|
2029
2025
|
'th.switched': '已换成「{name}」。',
|
|
2030
2026
|
'th.custom': '自选颜色',
|
|
2031
2027
|
'th.undo': '撤销',
|
|
@@ -511,6 +511,17 @@ export declare function menuPlacement(anchor: {
|
|
|
511
511
|
maxHeight: number;
|
|
512
512
|
above: boolean;
|
|
513
513
|
};
|
|
514
|
+
/**
|
|
515
|
+
* The option a key moves to in a row of radio buttons (WAI-ARIA radio group): the arrows step and wrap around, Home
|
|
516
|
+
* and End go to the ends. -1 for any other key, or an empty row.
|
|
517
|
+
*/
|
|
518
|
+
export declare function radioStep(count: number, index: number, key: string): number;
|
|
519
|
+
/**
|
|
520
|
+
* Whether arrow-key use of a row of radio dots carries into the next render, which puts focus back on the dot in use.
|
|
521
|
+
* `focus` is where focus is before the render: nowhere in particular (the page or the dialog, as when a busy render
|
|
522
|
+
* disabled the dots), on a dot, or on another control. Once the user has moved to another control, keyboard use ends.
|
|
523
|
+
*/
|
|
524
|
+
export declare function dotsKeepKeyboard(focus: 'none' | 'dot' | 'other'): boolean;
|
|
514
525
|
/** The key a Same Login group keeps its folded state under: its members, in a fixed order. */
|
|
515
526
|
export declare function loginKey(refs: readonly string[]): string;
|
|
516
527
|
/**
|
|
@@ -902,6 +902,31 @@ export function menuPlacement(anchor, size, view, align, gap = 4, margin = 8, mi
|
|
|
902
902
|
return { left, top: anchor.bottom + gap, maxHeight: below, above: false };
|
|
903
903
|
return { left, top: margin, maxHeight: above, above: true };
|
|
904
904
|
}
|
|
905
|
+
/**
|
|
906
|
+
* The option a key moves to in a row of radio buttons (WAI-ARIA radio group): the arrows step and wrap around, Home
|
|
907
|
+
* and End go to the ends. -1 for any other key, or an empty row.
|
|
908
|
+
*/
|
|
909
|
+
export function radioStep(count, index, key) {
|
|
910
|
+
if (count < 1)
|
|
911
|
+
return -1;
|
|
912
|
+
if (key === 'ArrowRight' || key === 'ArrowDown')
|
|
913
|
+
return (index + 1) % count;
|
|
914
|
+
if (key === 'ArrowLeft' || key === 'ArrowUp')
|
|
915
|
+
return (index - 1 + count) % count;
|
|
916
|
+
if (key === 'Home')
|
|
917
|
+
return 0;
|
|
918
|
+
if (key === 'End')
|
|
919
|
+
return count - 1;
|
|
920
|
+
return -1;
|
|
921
|
+
}
|
|
922
|
+
/**
|
|
923
|
+
* Whether arrow-key use of a row of radio dots carries into the next render, which puts focus back on the dot in use.
|
|
924
|
+
* `focus` is where focus is before the render: nowhere in particular (the page or the dialog, as when a busy render
|
|
925
|
+
* disabled the dots), on a dot, or on another control. Once the user has moved to another control, keyboard use ends.
|
|
926
|
+
*/
|
|
927
|
+
export function dotsKeepKeyboard(focus) {
|
|
928
|
+
return focus !== 'other';
|
|
929
|
+
}
|
|
905
930
|
/** The key a Same Login group keeps its folded state under: its members, in a fixed order. */
|
|
906
931
|
export function loginKey(refs) {
|
|
907
932
|
return `login:${[...refs].sort().join(',')}`;
|
|
@@ -1074,7 +1099,7 @@ export function taskPrompt(input, strip) {
|
|
|
1074
1099
|
pAccount: '地址、模型名、环境变量以厂商的官方文档为准。账号建好后,让我用 `sideby key <账号>` 输入密钥,再用 `sideby try <账号>` 试一次。订阅账号要登录时,让我点面板上的「登录」,或者自己运行 `sideby login <账号>`。',
|
|
1075
1100
|
pHost: '用 `sideby plugins new <id>` 生成插件骨架;收集事实时写明宿主的版本和日期;用 `sideby plugins check <id>` 检查,并在演示 HOME 里试一遍。',
|
|
1076
1101
|
pPlugin: '照 sideby 仓库的插件指南 docs/guide/plugins.zh-CN.md 写;写完用 `sideby plugins check <id>` 检查。',
|
|
1077
|
-
pTheme: '先跑 `sideby theme --json` 看现有主题和正在用的那套,再问我想要的感觉;我给了截图、网址或品牌色,就从里面取色。写一个主题文件(JSON,只放颜色,不放代码):`{"schemaVersion":1,"name":"…","base":"
|
|
1102
|
+
pTheme: '先跑 `sideby theme --json` 看现有主题和正在用的那套,再问我想要的感觉;我给了截图、网址或品牌色,就从里面取色。写一个主题文件(JSON,只放颜色,不放代码):`{"schemaVersion":1,"name":"…","base":"teal"、"leaf"、"celeste"、"claude" 或 "codex","accent":"#rrggbb","light":{…},"dark":{…}}`;多数时候给 `base` 和 `accent` 就够了,`light` / `dark` 只写要改的 token(`sideby theme export teal` 能看到全部 token)。先放在当前目录,跑 `sideby theme check <文件>`,有不达标的就按建议值改到全部通过;再跑 `sideby theme preview <文件>` 让我在面板里看一眼。我满意后才 `sideby theme import <文件>` 和 `sideby theme use <名字>`;不满意就接着改。随时可以用 `sideby theme use --undo` 换回去。',
|
|
1078
1103
|
pTerminal: "先问我用的是什么终端。只看这个终端的官方文档和它的 `--help`,找出「在指定目录新开一个窗口运行一条命令」的写法,写明你看的版本。写成一个模板:`{cmd}` 是要运行的命令,`{cwd}` 是文件夹,sideby 按参数填入,不经过 shell。保存要用 `sideby terminal --custom '<模板>'`,它会改 sideby 的设置,先问我。保存后让我在面板上点一次「让 AI 帮我」试一下,打不开就一起看错误再改。",
|
|
1079
1104
|
share: '做好之后,问我愿不愿意把这次的改进分享给 sideby。我同意后,按 sideby 仓库的 CONTRIBUTING.md 提一个 pull request,提交前去掉我自己的账号名、路径和邮箱。',
|
|
1080
1105
|
shareTerminal: '跑通之后,问我愿不愿意把这个终端做成 sideby 的内置终端。我同意后,在 sideby 仓库 src/core/terminal.ts 的终端表里加一行并补上测试,按 CONTRIBUTING.md 提一个 pull request,提交前去掉我自己的账号名、路径和邮箱。',
|
|
@@ -1120,7 +1145,7 @@ export function taskPrompt(input, strip) {
|
|
|
1120
1145
|
pAccount: "Take addresses, model names and variables from the vendor's official docs. When the account exists, have me enter the key with `sideby key <account>`, then try it with `sideby try <account>`. For a subscription sign-in, have me click Sign in in the Panel or run `sideby login <account>` myself.",
|
|
1121
1146
|
pHost: 'Start with `sideby plugins new <id>`; note the Host version and the date with every fact you gather; check it with `sideby plugins check <id>` and try it in a demo HOME.',
|
|
1122
1147
|
pPlugin: 'Follow the plugins guide in the sideby repository (docs/guide/plugins.md); check it with `sideby plugins check <id>`.',
|
|
1123
|
-
pTheme: 'Run `sideby theme --json` first to see the Themes and the one in use, then ask me what feel I want; if I give you a screenshot, a website or a brand color, take the colors from it. Write a Theme File (JSON, colors only, never code): `{"schemaVersion":1,"name":"…","base":"
|
|
1148
|
+
pTheme: 'Run `sideby theme --json` first to see the Themes and the one in use, then ask me what feel I want; if I give you a screenshot, a website or a brand color, take the colors from it. Write a Theme File (JSON, colors only, never code): `{"schemaVersion":1,"name":"…","base":"teal", "leaf", "celeste", "claude" or "codex","accent":"#rrggbb","light":{…},"dark":{…}}`; usually `base` and `accent` are enough, and `light` / `dark` hold only the tokens to change (`sideby theme export teal` shows them all). Keep it in the current folder, run `sideby theme check <file>` and change what fails to the suggested values until every pair passes, then run `sideby theme preview <file>` so I can look at it in the Panel. Only when I like it, run `sideby theme import <file>` and `sideby theme use <name>`; otherwise keep changing it. `sideby theme use --undo` goes back at any time.',
|
|
1124
1149
|
pTerminal: "Ask me which terminal I use first. Read only that terminal's official docs and its `--help` to find how it opens a new window that runs one command in a given folder, and note the version you read. Write it as a template: `{cmd}` is the command and `{cwd}` the folder; sideby fills them in as separate arguments, no shell runs it. Save it with `sideby terminal --custom '<template>'`, which changes sideby's settings, so ask me first. Then have me click Let AI do it in the Panel once to try it; if it does not open, look at the error with me and fix the template.",
|
|
1125
1150
|
share: 'When it works, ask me whether to share the improvement with sideby. Only with my yes, follow the CONTRIBUTING.md of the sideby repository to open a pull request, and first remove my own account names, paths and emails.',
|
|
1126
1151
|
shareTerminal: 'When it works, ask me whether to make this terminal built into sideby. Only with my yes, add a row to the terminal table in src/core/terminal.ts of the sideby repository with tests, follow its CONTRIBUTING.md to open a pull request, and first remove my own account names, paths and emails.',
|