sideby 0.35.0 → 0.35.2
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/dist/build.json +1 -1
- package/dist/src/cli/commands.js +18 -9
- package/dist/src/cli/json-schemas.js +3 -1
- package/dist/src/cli/main.js +5 -2
- package/dist/src/core/shell-init.d.ts +16 -2
- package/dist/src/core/shell-init.js +67 -12
- package/dist/src/panel/handler.js +26 -0
- package/dist/src/panel/i18n.d.ts +18 -0
- package/dist/src/panel/i18n.js +46 -10
- package/dist/src/panel/page-logic.d.ts +39 -0
- package/dist/src/panel/page-logic.js +32 -0
- package/dist/src/panel/page-script.js +232 -25
- package/dist/src/panel/page-styles.js +499 -462
- package/dist/src/panel/ui/dropdown-menu/dropdown-menu.html.d.ts +48 -0
- package/dist/src/panel/ui/dropdown-menu/dropdown-menu.html.js +38 -0
- package/dist/src/panel/ui/lib/cn.d.ts +4 -0
- package/dist/src/panel/ui/lib/cn.js +6 -0
- package/dist/src/panel/ui-css.d.ts +6 -0
- package/dist/src/panel/ui-css.js +88 -0
- package/dist/src/runtime.d.ts +16 -3
- package/dist/src/runtime.js +40 -13
- package/package.json +1 -1
- package/schemas/alias.json +9 -1
- package/skills/sideby/SKILL.md +3 -2
- package/skills/sideby/references/accounts.md +2 -0
package/dist/build.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"id":"
|
|
1
|
+
{"id":"20261102T095419-2a750b"}
|
package/dist/src/cli/commands.js
CHANGED
|
@@ -518,7 +518,7 @@ export async function cmdNew(a, io) {
|
|
|
518
518
|
for (const e of res.hookErrors)
|
|
519
519
|
io.err(c.red(` ${e.message}`));
|
|
520
520
|
if (res.alias?.added)
|
|
521
|
-
io.out(`${c.green('✓')} short command ${c.bold(res.alias.name)} (
|
|
521
|
+
io.out(`${c.green('✓')} short command ${c.bold(res.alias.name)} (at your next prompt)`);
|
|
522
522
|
else if (res.alias)
|
|
523
523
|
io.out(` ${c.red('✗')} ${res.alias.message}`);
|
|
524
524
|
else if (suggestion?.aliasHint)
|
|
@@ -2166,21 +2166,29 @@ export async function cmdBrowser(a, io) {
|
|
|
2166
2166
|
}
|
|
2167
2167
|
export async function cmdAlias(a, io) {
|
|
2168
2168
|
const [sub, alias, target, ...more] = a.positionals;
|
|
2169
|
-
const usage = 'usage: sideby alias add <short-command> <account> [-- host args] | sideby alias add <short-command> --pick <family> [--yes] | sideby alias rm <short-command> | sideby alias list';
|
|
2169
|
+
const usage = 'usage: sideby alias add <short-command> <account> [-- host args] | sideby alias add <short-command> --pick <family> [--yes] | sideby alias rename <old> <new> | sideby alias rm <short-command> | sideby alias list';
|
|
2170
2170
|
const pick = a.flags.get('pick');
|
|
2171
2171
|
if (sub === 'list' && alias === undefined && pick === undefined)
|
|
2172
2172
|
return aliasList(a, io);
|
|
2173
2173
|
const addPick = sub === 'add' && alias !== undefined && typeof pick === 'string' && target === undefined && !a.rest.length;
|
|
2174
2174
|
const add = sub === 'add' && pick === undefined && alias !== undefined && target !== undefined && more.length === 0;
|
|
2175
2175
|
const rm = sub === 'rm' && pick === undefined && alias !== undefined && target === undefined && a.rest.length === 0;
|
|
2176
|
-
|
|
2176
|
+
const rename = sub === 'rename' &&
|
|
2177
|
+
pick === undefined &&
|
|
2178
|
+
alias !== undefined &&
|
|
2179
|
+
target !== undefined &&
|
|
2180
|
+
!more.length &&
|
|
2181
|
+
!a.rest.length;
|
|
2182
|
+
if (!add && !rm && !addPick && !rename)
|
|
2177
2183
|
throw new UsageError(usage);
|
|
2178
2184
|
const rt = await createRuntime();
|
|
2179
|
-
const res =
|
|
2180
|
-
? await rt.
|
|
2181
|
-
:
|
|
2182
|
-
? await rt.
|
|
2183
|
-
:
|
|
2185
|
+
const res = rename
|
|
2186
|
+
? await rt.renameAlias(alias, target)
|
|
2187
|
+
: addPick
|
|
2188
|
+
? await rt.addPickCommand(alias, pick, { yes: a.flags.has('yes') })
|
|
2189
|
+
: add
|
|
2190
|
+
? await rt.addAlias(alias, target, a.rest)
|
|
2191
|
+
: await rt.removeAlias(alias);
|
|
2184
2192
|
if (a.flags.has('json')) {
|
|
2185
2193
|
json(io, res);
|
|
2186
2194
|
return res.status === 'confirm' ? 10 : res.ok ? 0 : 1;
|
|
@@ -2200,9 +2208,10 @@ export async function cmdAlias(a, io) {
|
|
|
2200
2208
|
: '';
|
|
2201
2209
|
const what = res.kind === 'pick' ? 'pick command' : 'short command';
|
|
2202
2210
|
const said = {
|
|
2203
|
-
added: `${c.green('✓')} ${what} ${c.bold(res.alias)}${starts} (
|
|
2211
|
+
added: `${c.green('✓')} ${what} ${c.bold(res.alias)}${starts} (at your next prompt)`,
|
|
2204
2212
|
exists: `${c.green('✓')} ${what} ${c.bold(res.alias)}${starts} was already in the config`,
|
|
2205
2213
|
removed: `${c.green('✓')} removed ${what} ${c.bold(res.alias)}${starts}`,
|
|
2214
|
+
renamed: `${c.green('✓')} renamed ${what} ${res.renamedFrom} to ${c.bold(res.alias)}${starts} (open terminals pick it up at their next prompt)`,
|
|
2206
2215
|
absent: `${c.dim('·')} no short command ${res.alias} in the config; nothing to remove`,
|
|
2207
2216
|
};
|
|
2208
2217
|
io.out(said[res.status]);
|
|
@@ -865,9 +865,11 @@ export const OUTPUT_SCHEMAS = {
|
|
|
865
865
|
Type.Literal('removed'),
|
|
866
866
|
Type.Literal('absent'),
|
|
867
867
|
Type.Literal('confirm'),
|
|
868
|
+
Type.Literal('renamed'),
|
|
868
869
|
], {
|
|
869
|
-
description: '`confirm` (exit 10): the pick command would hide a command on PATH, so nothing was written; run again with `--yes`.',
|
|
870
|
+
description: '`confirm` (exit 10): the pick command would hide a command on PATH, so nothing was written; run again with `--yes`. `renamed` (`alias rename`): `alias` is the new name.',
|
|
870
871
|
}),
|
|
872
|
+
renamedFrom: Type.Optional(Type.String({ description: 'The old name, for `renamed`.' })),
|
|
871
873
|
kind: Type.Optional(Type.Union([Type.Literal('account'), Type.Literal('pick')], {
|
|
872
874
|
description: '`pick` for a Pick Command (`--pick`), `account` for a short command of one Account.',
|
|
873
875
|
})),
|
package/dist/src/cli/main.js
CHANGED
|
@@ -41,6 +41,7 @@ Next: the user signs in with \`sideby login <account>\` (subscription) or fills
|
|
|
41
41
|
Exit: 0 done; 1 invalid name or alias, directory exists, or partly failed; 2 malformed command line.`,
|
|
42
42
|
alias: `sideby alias add <short> <account> [-- host args] [--json]
|
|
43
43
|
sideby alias add <short> --pick <family> [--yes] [--json]
|
|
44
|
+
sideby alias rename <old> <new> [--json]
|
|
44
45
|
sideby alias rm <short> [--json]
|
|
45
46
|
sideby alias list [--json]
|
|
46
47
|
|
|
@@ -56,10 +57,12 @@ Examples:
|
|
|
56
57
|
sideby alias add cc008 claude:008
|
|
57
58
|
sideby alias add pi-kimi pi:main -- --model kimi-coding/k3
|
|
58
59
|
sideby alias add cc --pick claude # says first if cc hides a command (exit 10)
|
|
60
|
+
sideby alias rename cc-relay relay # same account and arguments, new name
|
|
59
61
|
sideby alias rm cc008
|
|
60
62
|
|
|
61
|
-
Writes: the config \`aliases\` or \`pickCommands
|
|
62
|
-
|
|
63
|
+
Writes: the config \`aliases\` or \`pickCommands\`, every \`shellInitFile\` and the stamp open terminals watch.
|
|
64
|
+
A shell that loads eval "$(sideby shell-init zsh)" (\`sideby shell-init setup\` adds that line once) picks up
|
|
65
|
+
the change at its next prompt; a shell started before this version needs a new terminal once.
|
|
63
66
|
Exit: 0 done (also when it already exists or is absent); 1 invalid, reserved or taken; 2 malformed;
|
|
64
67
|
10 a pick command would hide a command on PATH, run again with --yes.`,
|
|
65
68
|
login: `sideby login <account>
|
|
@@ -9,11 +9,25 @@ export interface ResumeRouteFunction {
|
|
|
9
9
|
bin: string;
|
|
10
10
|
selectVar: string;
|
|
11
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* A short hash of the functions `shell-init` defines for these inputs. sideby writes it to the Shell Init Stamp
|
|
14
|
+
* whenever the short commands change, and a terminal whose script carries another one reloads (spec §3.13).
|
|
15
|
+
*/
|
|
16
|
+
export declare function shellInitGeneration(accounts: readonly Account[], aliases: Readonly<Record<string, unknown>> | undefined, routes?: readonly ResumeRouteFunction[]): string;
|
|
17
|
+
/** Where a terminal looks for the Shell Init Stamp, and which shell it is. */
|
|
18
|
+
export interface ShellInitReload {
|
|
19
|
+
shell: Shell;
|
|
20
|
+
stampFile: string;
|
|
21
|
+
}
|
|
12
22
|
/**
|
|
13
23
|
* The script for one shell, ending in a newline: exactly what `sideby shell-init <shell>` prints. zsh and bash
|
|
14
|
-
* read the same function syntax
|
|
24
|
+
* read the same function syntax; with `reload` the script also carries that shell's reload hook.
|
|
15
25
|
*/
|
|
16
|
-
export declare function shellInitScript(accounts: readonly Account[], aliases: Readonly<Record<string, unknown>> | undefined, routes?: readonly ResumeRouteFunction[]): string;
|
|
26
|
+
export declare function shellInitScript(accounts: readonly Account[], aliases: Readonly<Record<string, unknown>> | undefined, routes?: readonly ResumeRouteFunction[], reload?: ShellInitReload): string;
|
|
27
|
+
/** The Shell Init Stamp: one line, the generation of the short commands sideby wrote last. */
|
|
28
|
+
export declare const shellInitStampFile: (stateDir: string) => string;
|
|
29
|
+
/** Writes the Shell Init Stamp atomically (mode 644): the generation every open terminal compares with its own. */
|
|
30
|
+
export declare function writeShellInitStamp(stampFile: string, gen: string): Promise<void>;
|
|
17
31
|
export interface ShellInitWrite {
|
|
18
32
|
shell: Shell;
|
|
19
33
|
/** The configured path, as written in the config (`~/…` kept). */
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// The shell functions `sideby shell-init` prints, and the optional files (config `shellInitFile`) sideby keeps
|
|
2
2
|
// in sync with them whenever it adds an Account or an alias.
|
|
3
|
+
import { createHash } from 'node:crypto';
|
|
3
4
|
import { mkdir, readFile } from 'node:fs/promises';
|
|
4
|
-
import { dirname } from 'node:path';
|
|
5
|
+
import { dirname, join } from 'node:path';
|
|
5
6
|
import { ALIAS_NAME, aliasProblem, RESERVED_ALIASES } from './config.js';
|
|
6
7
|
import { realpathOrNull, statOrNull, writeFileAtomic } from './fs-safe.js';
|
|
7
8
|
import { expandUserPath } from './paths.js';
|
|
@@ -26,27 +27,81 @@ function resumeRouteFunction(r) {
|
|
|
26
27
|
` command sideby resume ${quote(r.family)} -- "$@"; return;; esac; done; fi; command ${r.bin} "$@"; }`,
|
|
27
28
|
].join('');
|
|
28
29
|
}
|
|
29
|
-
/**
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
/** The function lines `shell-init` defines and their names, without the header or the reload hook. */
|
|
31
|
+
function functionLines(accounts, aliases, routes) {
|
|
32
|
+
const lines = [];
|
|
33
|
+
const names = [];
|
|
34
|
+
for (const acc of accounts) {
|
|
35
|
+
const name = `sideby-${acc.family}-${acc.name}`;
|
|
36
|
+
lines.push(`${name}() { command sideby run ${quote(acc.ref)} -- "$@"; }`);
|
|
37
|
+
names.push(name);
|
|
38
|
+
}
|
|
37
39
|
// An alias function runs the alias itself, so `sideby run` reads its Account and arguments from the config.
|
|
38
40
|
// `function name {`: zsh expands a shell alias of the same name in `name() {` and rejects the whole script, so a
|
|
39
41
|
// user's own `alias cc=…` would leave every function undefined. With this form their alias still wins.
|
|
40
42
|
for (const alias of Object.keys(aliases ?? {}))
|
|
41
|
-
if (!aliasProblem(alias))
|
|
43
|
+
if (!aliasProblem(alias)) {
|
|
42
44
|
lines.push(`function ${alias} { command sideby run ${quote(alias)} -- "$@"; }`);
|
|
45
|
+
names.push(alias);
|
|
46
|
+
}
|
|
43
47
|
// An Alias with the Host's name wins: it already starts a chosen Account.
|
|
44
48
|
for (const r of routes) {
|
|
45
49
|
const fn = aliases && Object.hasOwn(aliases, r.bin) ? null : resumeRouteFunction(r);
|
|
46
|
-
if (fn)
|
|
50
|
+
if (fn) {
|
|
47
51
|
lines.push(fn);
|
|
52
|
+
names.push(r.bin);
|
|
53
|
+
}
|
|
48
54
|
}
|
|
49
|
-
return
|
|
55
|
+
return { lines, names };
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* A short hash of the functions `shell-init` defines for these inputs. sideby writes it to the Shell Init Stamp
|
|
59
|
+
* whenever the short commands change, and a terminal whose script carries another one reloads (spec §3.13).
|
|
60
|
+
*/
|
|
61
|
+
export function shellInitGeneration(accounts, aliases, routes = []) {
|
|
62
|
+
const { lines } = functionLines(accounts, aliases, routes);
|
|
63
|
+
return createHash('sha256').update(lines.join('\n')).digest('hex').slice(0, 12);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* The reload hook: before each prompt the shell reads the stamp with a builtin (no process starts) and, only when it
|
|
67
|
+
* holds a generation this terminal has not loaded, drops the functions it defined and evaluates `sideby shell-init`
|
|
68
|
+
* again. `__sideby_seen` keeps a stamp that matches no script (a config edited by hand) to one reload.
|
|
69
|
+
*/
|
|
70
|
+
function reloadHook(r, gen, names) {
|
|
71
|
+
const hook = r.shell === 'zsh'
|
|
72
|
+
? 'autoload -Uz add-zsh-hook 2>/dev/null && add-zsh-hook precmd __sideby_reload'
|
|
73
|
+
: `case ";\${PROMPT_COMMAND-};" in *";__sideby_reload;"*) ;; *) PROMPT_COMMAND="__sideby_reload\${PROMPT_COMMAND:+;$PROMPT_COMMAND}";; esac`;
|
|
74
|
+
return [
|
|
75
|
+
`__sideby_gen=${quote(gen)}; __sideby_seen=${quote(gen)}; __sideby_fns=${quote(names.join(' '))}`,
|
|
76
|
+
[
|
|
77
|
+
`__sideby_reload() { local g f; { read -r g < ${quote(r.stampFile)}; } 2>/dev/null || return 0;`,
|
|
78
|
+
` [ -z "$g" ] || [ "$g" = "$__sideby_gen" ] || [ "$g" = "$__sideby_seen" ] && return 0;`,
|
|
79
|
+
` __sideby_seen=$g; for f in ${r.shell === 'zsh' ? `\${=__sideby_fns}` : '$__sideby_fns'}; do unset -f "$f" 2>/dev/null; done;`,
|
|
80
|
+
` eval "$(command sideby shell-init ${r.shell} 2>/dev/null)"; __sideby_seen=$g; }`,
|
|
81
|
+
].join(''),
|
|
82
|
+
hook,
|
|
83
|
+
];
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* The script for one shell, ending in a newline: exactly what `sideby shell-init <shell>` prints. zsh and bash
|
|
87
|
+
* read the same function syntax; with `reload` the script also carries that shell's reload hook.
|
|
88
|
+
*/
|
|
89
|
+
export function shellInitScript(accounts, aliases, routes = [], reload) {
|
|
90
|
+
const { lines, names } = functionLines(accounts, aliases, routes);
|
|
91
|
+
const out = [SHELL_INIT_HEADER, ...lines];
|
|
92
|
+
if (reload)
|
|
93
|
+
out.push(...reloadHook(reload, shellInitGeneration(accounts, aliases, routes), names));
|
|
94
|
+
return `${out.join('\n')}\n`;
|
|
95
|
+
}
|
|
96
|
+
/** The Shell Init Stamp: one line, the generation of the short commands sideby wrote last. */
|
|
97
|
+
export const shellInitStampFile = (stateDir) => join(stateDir, 'shell-init.stamp');
|
|
98
|
+
/** Writes the Shell Init Stamp atomically (mode 644): the generation every open terminal compares with its own. */
|
|
99
|
+
export async function writeShellInitStamp(stampFile, gen) {
|
|
100
|
+
await mkdir(dirname(stampFile), { recursive: true });
|
|
101
|
+
const current = await readFile(stampFile, 'utf8').catch(() => null);
|
|
102
|
+
if (current === `${gen}\n`)
|
|
103
|
+
return;
|
|
104
|
+
await writeFileAtomic(stampFile, `${gen}\n`, 0o644);
|
|
50
105
|
}
|
|
51
106
|
/**
|
|
52
107
|
* Writes `content` to the configured file atomically (temp file in the same directory, then rename), keeping its
|
|
@@ -1311,6 +1311,32 @@ export function createPanelHandler(opts) {
|
|
|
1311
1311
|
return rt.removeAlias(name);
|
|
1312
1312
|
},
|
|
1313
1313
|
},
|
|
1314
|
+
// An Alias for one Account: add one, or give one a new name (`replaces`); the page names the Account by ref.
|
|
1315
|
+
'/api/alias/set': {
|
|
1316
|
+
async run(body) {
|
|
1317
|
+
const name = optString(body, 'name')?.trim();
|
|
1318
|
+
const account = optString(body, 'account');
|
|
1319
|
+
const replaces = optString(body, 'replaces');
|
|
1320
|
+
if (!name || !account)
|
|
1321
|
+
throw new HttpError(400, 'enter a name and pick an account');
|
|
1322
|
+
const rt = await getRuntime();
|
|
1323
|
+
const args = Array.isArray(body.args)
|
|
1324
|
+
? body.args.filter((x) => typeof x === 'string')
|
|
1325
|
+
: [];
|
|
1326
|
+
return replaces ? rt.renameAlias(replaces, name) : rt.addAlias(name, account, args);
|
|
1327
|
+
},
|
|
1328
|
+
},
|
|
1329
|
+
'/api/alias/remove': {
|
|
1330
|
+
async run(body) {
|
|
1331
|
+
const name = optString(body, 'name');
|
|
1332
|
+
if (!name)
|
|
1333
|
+
throw new HttpError(400, '"name" is required');
|
|
1334
|
+
const rt = await getRuntime();
|
|
1335
|
+
if (rt.pickCommandFamily(name) !== undefined)
|
|
1336
|
+
throw new HttpError(400, `"${name}" is a pick command`);
|
|
1337
|
+
return rt.removeAlias(name);
|
|
1338
|
+
},
|
|
1339
|
+
},
|
|
1314
1340
|
// `sideby shell-init setup` (ADR-0036): the page has shown the line and the file; undo takes out only that line.
|
|
1315
1341
|
'/api/shell-init/setup': {
|
|
1316
1342
|
async run(body) {
|
package/dist/src/panel/i18n.d.ts
CHANGED
|
@@ -177,10 +177,13 @@ declare const en: {
|
|
|
177
177
|
'tb.family': string;
|
|
178
178
|
'tb.allFamilies': string;
|
|
179
179
|
'tb.sort': string;
|
|
180
|
+
'sort.by': string;
|
|
181
|
+
'sort.button': string;
|
|
180
182
|
'sort.pressure': string;
|
|
181
183
|
'sort.name': string;
|
|
182
184
|
'sort.recent': string;
|
|
183
185
|
'sort.manual': string;
|
|
186
|
+
'sort.notSet': string;
|
|
184
187
|
'order.handle': string;
|
|
185
188
|
'order.moveFamily': string;
|
|
186
189
|
'order.moveAccount': string;
|
|
@@ -726,6 +729,21 @@ declare const en: {
|
|
|
726
729
|
'row.copyRun': string;
|
|
727
730
|
'row.installFirst': string;
|
|
728
731
|
'menu.copyAlias': string;
|
|
732
|
+
'menu.setAlias': string;
|
|
733
|
+
'al.title': string;
|
|
734
|
+
'al.intro': string;
|
|
735
|
+
'al.nameLabel': string;
|
|
736
|
+
'al.namePh': string;
|
|
737
|
+
'al.hint': string;
|
|
738
|
+
'al.copy': string;
|
|
739
|
+
'al.badName': string;
|
|
740
|
+
'al.addAnother': string;
|
|
741
|
+
'al.live': string;
|
|
742
|
+
'al.added': string;
|
|
743
|
+
'al.addedSetup': string;
|
|
744
|
+
'al.renamed': string;
|
|
745
|
+
'al.renamedSetup': string;
|
|
746
|
+
'al.removed': string;
|
|
729
747
|
'menu.copyLogin': string;
|
|
730
748
|
'menu.copyDir': string;
|
|
731
749
|
'menu.copyEmail': string;
|
package/dist/src/panel/i18n.js
CHANGED
|
@@ -179,16 +179,19 @@ const en = {
|
|
|
179
179
|
'tb.family': 'Filter by tool',
|
|
180
180
|
'tb.allFamilies': 'All tools',
|
|
181
181
|
'tb.sort': 'Sort accounts',
|
|
182
|
-
'sort.
|
|
183
|
-
'sort.
|
|
184
|
-
'sort.
|
|
185
|
-
'sort.
|
|
182
|
+
'sort.by': 'Sort by',
|
|
183
|
+
'sort.button': 'Sort: {choice}',
|
|
184
|
+
'sort.pressure': 'Quota used',
|
|
185
|
+
'sort.name': 'Name',
|
|
186
|
+
'sort.recent': 'Last used',
|
|
187
|
+
'sort.manual': 'My order',
|
|
188
|
+
'sort.notSet': 'Not set',
|
|
186
189
|
'order.handle': 'Drag to move, or use the arrow keys',
|
|
187
190
|
'order.moveFamily': 'Move {name}',
|
|
188
191
|
'order.moveAccount': 'Move {name}',
|
|
189
192
|
'order.position': '{name}: place {n} of {total}',
|
|
190
193
|
'order.failed': 'Could not save the order: {msg}. It is back as it was.',
|
|
191
|
-
'sort.arrange': 'Arrange order…',
|
|
194
|
+
'sort.arrange': 'Arrange order and pins…',
|
|
192
195
|
'set.order': 'Account order, pins and hidden',
|
|
193
196
|
'set.orderMine': 'Yours',
|
|
194
197
|
'set.orderDefault': 'Default',
|
|
@@ -728,6 +731,21 @@ const en = {
|
|
|
728
731
|
'row.copyRun': 'Copy the start command: {cmd}',
|
|
729
732
|
'row.installFirst': 'Install {host} first; the start command needs it',
|
|
730
733
|
'menu.copyAlias': 'Copy alias',
|
|
734
|
+
'menu.setAlias': 'Set short command…',
|
|
735
|
+
'al.title': 'Short command for {ref}',
|
|
736
|
+
'al.intro': 'Type a short command in a terminal and it starts {ref}, with the same sign-in and sessions.',
|
|
737
|
+
'al.nameLabel': 'Short command',
|
|
738
|
+
'al.namePh': 'e.g. cc-relay',
|
|
739
|
+
'al.hint': 'Letters, digits, - and _. It becomes a command in your terminal.',
|
|
740
|
+
'al.copy': 'Copy',
|
|
741
|
+
'al.badName': 'Use only letters, digits, - and _, and start with a letter or _.',
|
|
742
|
+
'al.addAnother': 'Add another',
|
|
743
|
+
'al.live': 'Open terminals pick up the change at their next prompt (press Enter once); new ones have it right away.',
|
|
744
|
+
'al.added': 'Added {name}. Press Enter once in an open terminal, then type {name}.',
|
|
745
|
+
'al.addedSetup': 'Added {name}. Add the line shown in the dialog so your terminals load it.',
|
|
746
|
+
'al.renamed': 'Renamed {old} to {name}. Press Enter once in an open terminal, then type {name}.',
|
|
747
|
+
'al.renamedSetup': 'Renamed {old} to {name}. Add the line shown in the dialog so your terminals load it.',
|
|
748
|
+
'al.removed': 'Removed {name}.',
|
|
731
749
|
'menu.copyLogin': 'Copy sign-in command',
|
|
732
750
|
'menu.copyDir': 'Copy folder path',
|
|
733
751
|
'menu.copyEmail': 'Copy email',
|
|
@@ -1787,16 +1805,19 @@ const zh = {
|
|
|
1787
1805
|
'tb.family': '按工具筛选',
|
|
1788
1806
|
'tb.allFamilies': '全部工具',
|
|
1789
1807
|
'tb.sort': '账号排序',
|
|
1790
|
-
'sort.
|
|
1791
|
-
'sort.
|
|
1792
|
-
'sort.
|
|
1793
|
-
'sort.
|
|
1808
|
+
'sort.by': '排序方式',
|
|
1809
|
+
'sort.button': '排序:{choice}',
|
|
1810
|
+
'sort.pressure': '额度用量',
|
|
1811
|
+
'sort.name': '名称',
|
|
1812
|
+
'sort.recent': '最近使用',
|
|
1813
|
+
'sort.manual': '我的顺序',
|
|
1814
|
+
'sort.notSet': '未设置',
|
|
1794
1815
|
'order.handle': '拖动换位置,或用方向键',
|
|
1795
1816
|
'order.moveFamily': '移动 {name}',
|
|
1796
1817
|
'order.moveAccount': '移动 {name}',
|
|
1797
1818
|
'order.position': '{name}:第 {n} 个,共 {total} 个',
|
|
1798
1819
|
'order.failed': '顺序没有保存:{msg}。已恢复原来的顺序。',
|
|
1799
|
-
'sort.arrange': '
|
|
1820
|
+
'sort.arrange': '调整顺序与置顶…',
|
|
1800
1821
|
'set.order': '账号顺序、置顶与隐藏',
|
|
1801
1822
|
'set.orderMine': '已调整',
|
|
1802
1823
|
'set.orderDefault': '默认',
|
|
@@ -2336,6 +2357,21 @@ const zh = {
|
|
|
2336
2357
|
'row.copyRun': '复制启动命令:{cmd}',
|
|
2337
2358
|
'row.installFirst': '先安装 {host},启动命令才能用',
|
|
2338
2359
|
'menu.copyAlias': '复制别名',
|
|
2360
|
+
'menu.setAlias': '设置别名…',
|
|
2361
|
+
'al.title': '{ref} 的别名',
|
|
2362
|
+
'al.intro': '别名是一个短命令:在终端里输入它,就会启动 {ref},登录和会话都不变。',
|
|
2363
|
+
'al.nameLabel': '别名',
|
|
2364
|
+
'al.namePh': '例如 cc-relay',
|
|
2365
|
+
'al.hint': '可用字母、数字、- 和 _,保存后就是终端里的一个命令。',
|
|
2366
|
+
'al.copy': '复制',
|
|
2367
|
+
'al.badName': '只能用字母、数字、- 和 _,并以字母或 _ 开头。',
|
|
2368
|
+
'al.addAnother': '再加一个',
|
|
2369
|
+
'al.live': '已打开的终端在下一次出提示符时生效(按一次回车即可),新开的终端直接可用。',
|
|
2370
|
+
'al.added': '已添加 {name}。在已打开的终端里按一次回车,再输入 {name}。',
|
|
2371
|
+
'al.addedSetup': '已添加 {name}。还需要加一行配置,终端才会加载它,见弹窗里的提示。',
|
|
2372
|
+
'al.renamed': '已把 {old} 改成 {name}。在已打开的终端里按一次回车,再输入 {name}。',
|
|
2373
|
+
'al.renamedSetup': '已把 {old} 改成 {name}。还需要加一行配置,终端才会加载它,见弹窗里的提示。',
|
|
2374
|
+
'al.removed': '已删除 {name}。',
|
|
2339
2375
|
'menu.copyLogin': '复制登录命令',
|
|
2340
2376
|
'menu.copyDir': '复制目录路径',
|
|
2341
2377
|
'menu.copyEmail': '复制邮箱',
|
|
@@ -705,6 +705,22 @@ export declare function askBridge(boot: {
|
|
|
705
705
|
origin: string;
|
|
706
706
|
};
|
|
707
707
|
}): boolean;
|
|
708
|
+
/**
|
|
709
|
+
* Whether a `message` event asks the Panel to read its state again (ADR-0006, 2026-11-02 amendment): the Portal around
|
|
710
|
+
* it changed something the Panel shows (its own Unattended switch, say) and posted
|
|
711
|
+
* `{ type: 'local-tools:refresh', version: 1 }`. Only the frame's own parent at the Panel's own origin counts; a Panel
|
|
712
|
+
* opened on its own has no parent to listen to. The message only triggers a read, never a change.
|
|
713
|
+
*/
|
|
714
|
+
export declare function portalRefresh(event: {
|
|
715
|
+
source: unknown;
|
|
716
|
+
origin: string;
|
|
717
|
+
data: unknown;
|
|
718
|
+
}, win: {
|
|
719
|
+
parent: unknown;
|
|
720
|
+
location: {
|
|
721
|
+
origin: string;
|
|
722
|
+
};
|
|
723
|
+
}): boolean;
|
|
708
724
|
/**
|
|
709
725
|
* The "Attached files" section of a Task Prompt (spec §3.28 "附件"), in `lang` (`zh`, otherwise English): one line
|
|
710
726
|
* per file with its absolute path and kind, plus how to look at a video. Empty without files. `heading` goes before
|
|
@@ -1163,3 +1179,26 @@ export declare function uaWaitingCount(status: {
|
|
|
1163
1179
|
id: string;
|
|
1164
1180
|
on: unknown;
|
|
1165
1181
|
}[]): number;
|
|
1182
|
+
export type SortMenuEntry = {
|
|
1183
|
+
kind: 'label';
|
|
1184
|
+
key: string;
|
|
1185
|
+
} | {
|
|
1186
|
+
kind: 'choice';
|
|
1187
|
+
value: string;
|
|
1188
|
+
key: string;
|
|
1189
|
+
checked: boolean;
|
|
1190
|
+
meta?: string;
|
|
1191
|
+
} | {
|
|
1192
|
+
kind: 'separator';
|
|
1193
|
+
} | {
|
|
1194
|
+
kind: 'action';
|
|
1195
|
+
value: string;
|
|
1196
|
+
key: string;
|
|
1197
|
+
};
|
|
1198
|
+
/**
|
|
1199
|
+
* The toolbar's sort menu (spec §3.25): a "Sort by" label, one radio choice per sort with the current one checked,
|
|
1200
|
+
* then, apart, the action that opens the arrange mode. The action is never a choice, so it can never hold the check.
|
|
1201
|
+
* "My order" says "Not set" while there is no order of one's own, as picking it then opens the arrange mode. A
|
|
1202
|
+
* read-only Panel has no action. Entries carry i18n keys, not words.
|
|
1203
|
+
*/
|
|
1204
|
+
export declare function sortMenu(sorts: readonly string[], current: string, ordered: boolean, readOnly: boolean): SortMenuEntry[];
|
|
@@ -1252,6 +1252,20 @@ export function askBridge(boot, opts, win) {
|
|
|
1252
1252
|
}, win.location.origin);
|
|
1253
1253
|
return true;
|
|
1254
1254
|
}
|
|
1255
|
+
/**
|
|
1256
|
+
* Whether a `message` event asks the Panel to read its state again (ADR-0006, 2026-11-02 amendment): the Portal around
|
|
1257
|
+
* it changed something the Panel shows (its own Unattended switch, say) and posted
|
|
1258
|
+
* `{ type: 'local-tools:refresh', version: 1 }`. Only the frame's own parent at the Panel's own origin counts; a Panel
|
|
1259
|
+
* opened on its own has no parent to listen to. The message only triggers a read, never a change.
|
|
1260
|
+
*/
|
|
1261
|
+
export function portalRefresh(event, win) {
|
|
1262
|
+
if (!win.parent || win.parent === win || event.source !== win.parent)
|
|
1263
|
+
return false;
|
|
1264
|
+
if (event.origin !== win.location.origin)
|
|
1265
|
+
return false;
|
|
1266
|
+
const d = event.data;
|
|
1267
|
+
return Boolean(d && typeof d === 'object' && d.type === 'local-tools:refresh' && d.version === 1);
|
|
1268
|
+
}
|
|
1255
1269
|
/**
|
|
1256
1270
|
* The "Attached files" section of a Task Prompt (spec §3.28 "附件"), in `lang` (`zh`, otherwise English): one line
|
|
1257
1271
|
* per file with its absolute path and kind, plus how to look at a video. Empty without files. `heading` goes before
|
|
@@ -2090,3 +2104,21 @@ export function uaWaitingCount(status, inflight) {
|
|
|
2090
2104
|
return status.pendingIds.filter((id) => !inflight.some((x) => x.id === id)).length;
|
|
2091
2105
|
return Math.max(0, status.pending - inflight.filter((x) => x.on === status).length);
|
|
2092
2106
|
}
|
|
2107
|
+
/**
|
|
2108
|
+
* The toolbar's sort menu (spec §3.25): a "Sort by" label, one radio choice per sort with the current one checked,
|
|
2109
|
+
* then, apart, the action that opens the arrange mode. The action is never a choice, so it can never hold the check.
|
|
2110
|
+
* "My order" says "Not set" while there is no order of one's own, as picking it then opens the arrange mode. A
|
|
2111
|
+
* read-only Panel has no action. Entries carry i18n keys, not words.
|
|
2112
|
+
*/
|
|
2113
|
+
export function sortMenu(sorts, current, ordered, readOnly) {
|
|
2114
|
+
const out = [{ kind: 'label', key: 'sort.by' }];
|
|
2115
|
+
for (const value of sorts) {
|
|
2116
|
+
const choice = { kind: 'choice', value, key: `sort.${value}`, checked: value === current };
|
|
2117
|
+
if (value === 'manual' && !ordered)
|
|
2118
|
+
choice.meta = 'sort.notSet';
|
|
2119
|
+
out.push(choice);
|
|
2120
|
+
}
|
|
2121
|
+
if (!readOnly)
|
|
2122
|
+
out.push({ kind: 'separator' }, { kind: 'action', value: 'arrange', key: 'sort.arrange' });
|
|
2123
|
+
return out;
|
|
2124
|
+
}
|