sideby 0.26.1 → 0.27.1
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/ai-tasks.json +14 -0
- package/dist/build.json +1 -1
- package/dist/src/cli/commands.d.ts +5 -0
- package/dist/src/cli/commands.js +28 -0
- package/dist/src/cli/json-schemas.js +14 -0
- package/dist/src/cli/main.js +18 -2
- package/dist/src/core/ask.js +2 -1
- package/dist/src/core/egress.d.ts +5 -2
- package/dist/src/core/egress.js +7 -4
- package/dist/src/core/search-catalog.d.ts +54 -0
- package/dist/src/core/search-catalog.js +357 -0
- package/dist/src/core/skill-check.d.ts +5 -0
- package/dist/src/core/skill-check.js +7 -1
- package/dist/src/core/update.d.ts +2 -3
- package/dist/src/core/update.js +39 -40
- package/dist/src/core/version.d.ts +8 -0
- package/dist/src/core/version.js +34 -0
- package/dist/src/panel/i18n.d.ts +27 -0
- package/dist/src/panel/i18n.js +54 -0
- package/dist/src/panel/page-logic.d.ts +3 -1
- package/dist/src/panel/page-logic.js +12 -0
- package/dist/src/panel/page-script.js +282 -27
- package/dist/src/panel/page-styles.js +27 -0
- package/dist/src/panel/page.js +3 -0
- package/package.json +1 -1
- package/schemas/commands.json +117 -0
- package/skills/sideby/SKILL.md +2 -1
- package/skills/sideby/references/ai-tasks.md +1 -1
- package/skills/sideby/references/panel.md +10 -0
- package/skills/sideby/references/update.md +3 -2
package/ai-tasks.json
CHANGED
|
@@ -142,6 +142,20 @@
|
|
|
142
142
|
{ "en": "Allow only my Japan and Singapore nodes", "zh": "只允许日本和新加坡节点" },
|
|
143
143
|
{ "en": "A message was blocked; help me check the proxy", "zh": "消息被拦了,帮我查查代理" }
|
|
144
144
|
]
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"id": "update",
|
|
148
|
+
"native": true,
|
|
149
|
+
"title": { "en": "Let AI fix the update", "zh": "让 AI 帮我更新" },
|
|
150
|
+
"placeholder": {
|
|
151
|
+
"en": "Anything to add? For example: I use a proxy",
|
|
152
|
+
"zh": "想补充什么?比如:我要走代理才能上网"
|
|
153
|
+
},
|
|
154
|
+
"examples": [
|
|
155
|
+
{ "en": "I am behind a proxy", "zh": "我上网要走代理" },
|
|
156
|
+
{ "en": "Use a registry mirror in China", "zh": "在国内,帮我换成镜像源" },
|
|
157
|
+
{ "en": "It says it cannot update itself here", "zh": "提示这里不能自己更新" }
|
|
158
|
+
]
|
|
145
159
|
}
|
|
146
160
|
]
|
|
147
161
|
}
|
package/dist/build.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"id":"
|
|
1
|
+
{"id":"20261028T124158-a7e186"}
|
|
@@ -153,3 +153,8 @@ export declare function cmdTheme(a: ParsedArgs, io: Io): Promise<number>;
|
|
|
153
153
|
* `network` after a preview (exit 10 without `--yes`).
|
|
154
154
|
*/
|
|
155
155
|
export declare function cmdNetwork(a: ParsedArgs, io: Io): Promise<number>;
|
|
156
|
+
/**
|
|
157
|
+
* `sideby commands <words>` (spec §3.36, ADR-0054): the Search Catalog the Panel's Command Palette searches, read-only.
|
|
158
|
+
* Titles and places are in English, as every other command prints; the words may be English or Chinese.
|
|
159
|
+
*/
|
|
160
|
+
export declare function cmdCommands(a: ParsedArgs, io: Io): number;
|
package/dist/src/cli/commands.js
CHANGED
|
@@ -20,6 +20,7 @@ import { accountModel, setAccountModel } from '../core/model-choice.js';
|
|
|
20
20
|
import { resolvePaths, tildify } from '../core/paths.js';
|
|
21
21
|
import { USAGE_DAYS } from '../core/quota-levels.js';
|
|
22
22
|
import { groupsToUndo, remoteControlNothingToDo, remoteControlTodo, } from '../core/remote-control.js';
|
|
23
|
+
import { SEARCH_CATALOG, searchCatalog } from '../core/search-catalog.js';
|
|
23
24
|
import { SHELLS } from '../core/shell-init.js';
|
|
24
25
|
import { MODEL_NAME } from '../families/shared/model-args.js';
|
|
25
26
|
import { AI_TASK_KINDS, hiddenIn, inDisplayOrder, pinnedIn, suggestAlias, suggestName, withPinned, } from '../panel/page-logic.js';
|
|
@@ -3897,3 +3898,30 @@ export async function cmdNetwork(a, io) {
|
|
|
3897
3898
|
io.out(c.dim('Sessions started without sideby (running `claude` or `codex` directly) are not checked.'));
|
|
3898
3899
|
return 0;
|
|
3899
3900
|
}
|
|
3901
|
+
/**
|
|
3902
|
+
* `sideby commands <words>` (spec §3.36, ADR-0054): the Search Catalog the Panel's Command Palette searches, read-only.
|
|
3903
|
+
* Titles and places are in English, as every other command prints; the words may be English or Chinese.
|
|
3904
|
+
*/
|
|
3905
|
+
export function cmdCommands(a, io) {
|
|
3906
|
+
const query = a.positionals.join(' ').trim();
|
|
3907
|
+
if (!query)
|
|
3908
|
+
throw new UsageError('usage: sideby commands <words> [--json], for example: sideby commands language');
|
|
3909
|
+
const results = searchCatalog(query, SEARCH_CATALOG).map(({ entry }) => ({
|
|
3910
|
+
id: entry.id,
|
|
3911
|
+
kind: entry.kind,
|
|
3912
|
+
title: entry.title.en,
|
|
3913
|
+
panel: entry.panel.en,
|
|
3914
|
+
cliCommand: entry.cliCommand,
|
|
3915
|
+
}));
|
|
3916
|
+
if (a.flags.has('json')) {
|
|
3917
|
+
json(io, { results });
|
|
3918
|
+
return 0;
|
|
3919
|
+
}
|
|
3920
|
+
if (!results.length) {
|
|
3921
|
+
io.out(`No feature of sideby matches "${query}".`);
|
|
3922
|
+
io.out(c.dim(`Try other words (English or Chinese), \`sideby history ${query}\` to find a past session, or ask your AI.`));
|
|
3923
|
+
return 0;
|
|
3924
|
+
}
|
|
3925
|
+
io.out(table(results.map((r) => [r.title, r.kind, r.panel, r.cliCommand ?? c.dim('Panel only')]), ['Feature', 'Kind', 'In the Panel', 'Command']));
|
|
3926
|
+
return 0;
|
|
3927
|
+
}
|
|
@@ -840,6 +840,20 @@ export const OUTPUT_SCHEMAS = {
|
|
|
840
840
|
errors: Type.Array(PluginError),
|
|
841
841
|
}, { title: 'sideby plugins --json' }),
|
|
842
842
|
families: Type.Object({ schemaVersion: Version, families: Type.Array(FamilyDetail) }, { title: 'sideby families --json' }),
|
|
843
|
+
commands: Type.Object({
|
|
844
|
+
schemaVersion: Version,
|
|
845
|
+
results: Type.Array(Type.Object({
|
|
846
|
+
id: Str,
|
|
847
|
+
kind: Type.String({
|
|
848
|
+
description: "'page', 'setting' or 'action'; an open set, so tolerate others.",
|
|
849
|
+
}),
|
|
850
|
+
title: Str,
|
|
851
|
+
panel: Type.String({
|
|
852
|
+
description: 'Where it lives in the Panel, such as "Settings → General → Language".',
|
|
853
|
+
}),
|
|
854
|
+
cliCommand: Type.Union([Str, Type.Null()]),
|
|
855
|
+
})),
|
|
856
|
+
}, { title: 'sideby commands --json' }),
|
|
843
857
|
'app-install': Type.Object({
|
|
844
858
|
schemaVersion: Version,
|
|
845
859
|
platform: AppPlatform,
|
package/dist/src/cli/main.js
CHANGED
|
@@ -29,6 +29,8 @@ Usage:
|
|
|
29
29
|
sideby quota check <family> on|off turn quota fetching on or off
|
|
30
30
|
sideby update --auto on|off set Auto Update without running an update
|
|
31
31
|
sideby update --skill [--yes] update only the installed sideby skill to this version
|
|
32
|
+
sideby commands <words> find where a page, setting or action lives in the Panel,
|
|
33
|
+
and the command that does the same (read-only)
|
|
32
34
|
sideby families [family] what each host's accounts share with the main account,
|
|
33
35
|
where they live and how they sign in
|
|
34
36
|
sideby alias add <short> <account> [-- args]
|
|
@@ -132,9 +134,9 @@ Usage:
|
|
|
132
134
|
|
|
133
135
|
Options:
|
|
134
136
|
--json machine-readable output (list, new, next, alias, doctor, quota, tune, model, remote-control, handoff,
|
|
135
|
-
families, plugins, app, desktop, sessions, history, send, messages, edit, browser, update, local, ask,
|
|
137
|
+
families, commands, plugins, app, desktop, sessions, history, send, messages, edit, browser, update, local, ask,
|
|
136
138
|
terminal, key, try, autostart, menubar, config)
|
|
137
|
-
-h, --help show this help; \`sideby <command> --help\` for new, alias, login, doctor, families, desktop, edit, browser,
|
|
139
|
+
-h, --help show this help; \`sideby <command> --help\` for new, alias, login, doctor, families, commands, desktop, edit, browser,
|
|
138
140
|
autostart, menubar, config, sessions, history, send, messages
|
|
139
141
|
-v, --version show the version
|
|
140
142
|
|
|
@@ -493,6 +495,17 @@ Examples:
|
|
|
493
495
|
sideby browser set codex:main "Profile 7"
|
|
494
496
|
Exit: 0 shown, changed, chosen or opened; 1 not macOS, Chrome not installed, no or several browser users to choose from, or
|
|
495
497
|
Chrome did not open; 10 --enable/--disable without --yes; 2 malformed command line.`,
|
|
498
|
+
commands: `sideby commands <words>... [--json]
|
|
499
|
+
|
|
500
|
+
Find a feature of sideby by name, in English or Chinese: a page of the Panel, a setting or an action. Each result
|
|
501
|
+
says where it lives in the Panel (Settings → General → Language) and the command that does the same, when there is
|
|
502
|
+
one. The Panel's Search (Cmd/Ctrl+K) searches the same list. It finds features, not sessions: for those use
|
|
503
|
+
\`sideby history <words>\`.
|
|
504
|
+
|
|
505
|
+
Examples:
|
|
506
|
+
sideby commands language
|
|
507
|
+
sideby commands 深色 --json
|
|
508
|
+
Exit: 0, also when nothing matches; 2 no words given or malformed command line.`,
|
|
496
509
|
families: `sideby families [family] [--json]
|
|
497
510
|
|
|
498
511
|
For each host (built in or from a plugin): where its accounts live, the variable that selects one, how to sign
|
|
@@ -562,6 +575,7 @@ const COMMANDS = {
|
|
|
562
575
|
'shell-init': { flags: ['write', 'yes', 'undo', 'json'] },
|
|
563
576
|
plugins: { flags: ['json'] },
|
|
564
577
|
families: { flags: ['json'] },
|
|
578
|
+
commands: { flags: ['json'] },
|
|
565
579
|
update: { flags: ['json', 'yes', 'skill'], valued: ['auto'] },
|
|
566
580
|
local: { flags: ['json', 'yes'] },
|
|
567
581
|
'update-check': { flags: [] },
|
|
@@ -837,6 +851,8 @@ async function dispatch(cmd, parsed, io, cmds) {
|
|
|
837
851
|
return await cmds.cmdPlugins(parsed, io);
|
|
838
852
|
case 'families':
|
|
839
853
|
return await cmds.cmdFamilies(parsed, io);
|
|
854
|
+
case 'commands':
|
|
855
|
+
return cmds.cmdCommands(parsed, io);
|
|
840
856
|
case 'update':
|
|
841
857
|
return await cmds.cmdUpdate(parsed, io);
|
|
842
858
|
case 'update-check':
|
package/dist/src/core/ask.js
CHANGED
|
@@ -266,7 +266,8 @@ export function taskContext(c, fail) {
|
|
|
266
266
|
k === 'quotaReason' ||
|
|
267
267
|
k === 'version' ||
|
|
268
268
|
k === 'terminalCustom' ||
|
|
269
|
-
k === 'theme'
|
|
269
|
+
k === 'theme' ||
|
|
270
|
+
k === 'updateError')
|
|
270
271
|
out[k] = str(v, `"context.${k}"`);
|
|
271
272
|
else if (k === 'terminals') {
|
|
272
273
|
if (!Array.isArray(v) || v.length > 50)
|
|
@@ -50,8 +50,11 @@ export declare function parseTrace(text: string): {
|
|
|
50
50
|
ip?: string;
|
|
51
51
|
loc?: string;
|
|
52
52
|
};
|
|
53
|
-
/**
|
|
54
|
-
|
|
53
|
+
/**
|
|
54
|
+
* One GET of an `https://` `url`, directly or through an `http://` proxy (CONNECT), as the Host would send it. The
|
|
55
|
+
* Update Check uses it too, since Node's own `fetch` does not follow the proxy variables.
|
|
56
|
+
*/
|
|
57
|
+
export declare const fetchTrace: (url: string, env: Env, timeoutMs: number, userAgent?: string) => Promise<string>;
|
|
55
58
|
export declare function readEntry(dir: string, key: string): Promise<EgressEntry | null>;
|
|
56
59
|
/** Whether `loc` passes `allow`; without a country the check could not tell. */
|
|
57
60
|
export declare function judge(entry: EgressEntry, allow: readonly string[]): EgressStatus;
|
package/dist/src/core/egress.js
CHANGED
|
@@ -79,8 +79,11 @@ export function parseTrace(text) {
|
|
|
79
79
|
}
|
|
80
80
|
return out;
|
|
81
81
|
}
|
|
82
|
-
/**
|
|
83
|
-
|
|
82
|
+
/**
|
|
83
|
+
* One GET of an `https://` `url`, directly or through an `http://` proxy (CONNECT), as the Host would send it. The
|
|
84
|
+
* Update Check uses it too, since Node's own `fetch` does not follow the proxy variables.
|
|
85
|
+
*/
|
|
86
|
+
export const fetchTrace = (url, env, timeoutMs, userAgent = 'sideby-network-guard') => new Promise((resolve, reject) => {
|
|
84
87
|
const target = new URL(url);
|
|
85
88
|
const proxy = proxyFor(url, env);
|
|
86
89
|
let done = false;
|
|
@@ -112,9 +115,9 @@ export const fetchTrace = (url, env, timeoutMs) => new Promise((resolve, reject)
|
|
|
112
115
|
const get = (socket) => {
|
|
113
116
|
const req = httpsRequest({
|
|
114
117
|
host: target.hostname,
|
|
115
|
-
path: target.pathname,
|
|
118
|
+
path: target.pathname + target.search,
|
|
116
119
|
method: 'GET',
|
|
117
|
-
headers: { 'user-agent': '
|
|
120
|
+
headers: { 'user-agent': userAgent, accept: 'application/json, text/plain' },
|
|
118
121
|
...(socket ? { createConnection: () => socket } : {}),
|
|
119
122
|
}, read);
|
|
120
123
|
req.on('error', (e) => finish(e));
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export type SearchKind = 'page' | 'setting' | 'action';
|
|
2
|
+
export type PanelPage = 'accounts' | 'sessions' | 'tuning' | 'handoff';
|
|
3
|
+
/** Where the Panel takes the user. Internal: the CLI shows `panel`, never this. */
|
|
4
|
+
export type SearchTarget =
|
|
5
|
+
/** A page of its own (the tabs under the header). */
|
|
6
|
+
{
|
|
7
|
+
page: PanelPage;
|
|
8
|
+
}
|
|
9
|
+
/** A row of the Settings dialog: its section, and the `fm('<find>', …)` mark on the row. */
|
|
10
|
+
| {
|
|
11
|
+
settings: string;
|
|
12
|
+
find: string;
|
|
13
|
+
}
|
|
14
|
+
/** A row of the Accounts page's Display popover, marked the same way. */
|
|
15
|
+
| {
|
|
16
|
+
display: string;
|
|
17
|
+
}
|
|
18
|
+
/** One of the page's PALETTE_ACTIONS; `write` ones are disabled in a read-only Panel. */
|
|
19
|
+
| {
|
|
20
|
+
action: string;
|
|
21
|
+
write: boolean;
|
|
22
|
+
};
|
|
23
|
+
export interface Words {
|
|
24
|
+
en: string;
|
|
25
|
+
zh: string;
|
|
26
|
+
}
|
|
27
|
+
export interface SearchEntry {
|
|
28
|
+
id: string;
|
|
29
|
+
kind: SearchKind;
|
|
30
|
+
title: Words;
|
|
31
|
+
/** Other words people use for it, in either language. */
|
|
32
|
+
synonyms: string[];
|
|
33
|
+
/** Where it lives, as the user reads it ("Settings → General → Language"). */
|
|
34
|
+
panel: Words;
|
|
35
|
+
target: SearchTarget;
|
|
36
|
+
cliCommand: string | null;
|
|
37
|
+
}
|
|
38
|
+
/** The catalog; a row of the Settings dialog or the Display popover names itself at the end of its place. */
|
|
39
|
+
export declare const SEARCH_CATALOG: readonly SearchEntry[];
|
|
40
|
+
/** Shown on an empty query after the recently used ones (spec §3.36). */
|
|
41
|
+
export declare const COMMON_ENTRIES: readonly string[];
|
|
42
|
+
export interface SearchHit {
|
|
43
|
+
entry: SearchEntry;
|
|
44
|
+
/** 0 exact, 1 prefix, 2 contains (title before synonym at each level). */
|
|
45
|
+
rank: number;
|
|
46
|
+
}
|
|
47
|
+
export declare function catalogNorm(s: string): string;
|
|
48
|
+
/** How well one text matches: 0 exact, 1 starts with it, 2 a word starts with it, 3 contains it, -1 not at all. */
|
|
49
|
+
export declare function catalogMatchLevel(text: string, q: string): number;
|
|
50
|
+
/**
|
|
51
|
+
* Entries matching `query`, best first: exact before prefix before contains, titles before synonyms, then the
|
|
52
|
+
* catalog's own order. Both languages are searched whatever the Panel shows. An empty query matches nothing.
|
|
53
|
+
*/
|
|
54
|
+
export declare function searchCatalog(query: string, catalog: readonly SearchEntry[]): SearchHit[];
|
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
// The Search Catalog (spec §3.36, ADR-0054): every page, setting and action of the Panel that the Command Palette
|
|
2
|
+
// finds, in English and Chinese, with where it lives and the command that does the same. The Panel embeds it and
|
|
3
|
+
// `sideby commands` searches it, so both find the same things. It names features only, never Accounts or Sessions.
|
|
4
|
+
const SET = { en: 'Settings', zh: '设置' };
|
|
5
|
+
const at = (...parts) => ({
|
|
6
|
+
en: parts.map((p) => p.en).join(' → '),
|
|
7
|
+
zh: parts.map((p) => p.zh).join(' → '),
|
|
8
|
+
});
|
|
9
|
+
const GENERAL = { en: 'General', zh: '通用' };
|
|
10
|
+
const MENUBAR = { en: 'Menu bar', zh: '状态栏' };
|
|
11
|
+
const ACCOUNTS = { en: 'Accounts', zh: '账号' };
|
|
12
|
+
const QUOTA = { en: 'Quota checks', zh: '额度查询' };
|
|
13
|
+
const AI = { en: 'Let AI help', zh: '让 AI 帮我' };
|
|
14
|
+
const DISPLAY = at({ en: 'Accounts', zh: '账号' }, { en: 'Display', zh: '显示' });
|
|
15
|
+
const HEADER = { en: 'Header', zh: '顶栏' };
|
|
16
|
+
const ENTRIES = [
|
|
17
|
+
{
|
|
18
|
+
id: 'page.accounts',
|
|
19
|
+
kind: 'page',
|
|
20
|
+
title: { en: 'Accounts', zh: '账号' },
|
|
21
|
+
synonyms: ['quota', 'usage', 'list', 'limit', '额度', '用量', '列表'],
|
|
22
|
+
panel: { en: 'Accounts page', zh: '账号页' },
|
|
23
|
+
target: { page: 'accounts' },
|
|
24
|
+
cliCommand: 'sideby list',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
id: 'page.sessions',
|
|
28
|
+
kind: 'page',
|
|
29
|
+
title: { en: 'Sessions', zh: '会话' },
|
|
30
|
+
synonyms: ['session history', 'live sessions', 'past sessions', 'history', '历史', '会话记录', '运行中'],
|
|
31
|
+
panel: { en: 'Sessions page', zh: '会话页' },
|
|
32
|
+
target: { page: 'sessions' },
|
|
33
|
+
cliCommand: 'sideby history',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
id: 'page.tuning',
|
|
37
|
+
kind: 'page',
|
|
38
|
+
title: { en: 'Context tuning', zh: '上下文调优' },
|
|
39
|
+
synonyms: [
|
|
40
|
+
'auto-compact',
|
|
41
|
+
'autocompact',
|
|
42
|
+
'compaction threshold',
|
|
43
|
+
'context window',
|
|
44
|
+
'tune',
|
|
45
|
+
'自动压缩',
|
|
46
|
+
'压缩阈值',
|
|
47
|
+
'上下文窗口',
|
|
48
|
+
],
|
|
49
|
+
panel: { en: 'Context tuning page', zh: '上下文调优页' },
|
|
50
|
+
target: { page: 'tuning' },
|
|
51
|
+
cliCommand: 'sideby tune',
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
id: 'page.handoff',
|
|
55
|
+
kind: 'page',
|
|
56
|
+
title: { en: 'Auto Handoff', zh: '自动接力' },
|
|
57
|
+
synonyms: [
|
|
58
|
+
'handoff',
|
|
59
|
+
'switch account',
|
|
60
|
+
'out of quota',
|
|
61
|
+
'limit reached',
|
|
62
|
+
'接力',
|
|
63
|
+
'换号',
|
|
64
|
+
'额度用完',
|
|
65
|
+
'切换账号',
|
|
66
|
+
],
|
|
67
|
+
panel: { en: 'Auto Handoff page', zh: '自动接力页' },
|
|
68
|
+
target: { page: 'handoff' },
|
|
69
|
+
cliCommand: 'sideby handoff',
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
id: 'setting.language',
|
|
73
|
+
kind: 'setting',
|
|
74
|
+
title: { en: 'Language', zh: '语言' },
|
|
75
|
+
synonyms: ['english', 'chinese', '中文', '英文', 'lang'],
|
|
76
|
+
panel: at(SET, GENERAL),
|
|
77
|
+
target: { settings: 'general', find: 'lang' },
|
|
78
|
+
cliCommand: 'sideby config set panel.language zh',
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
id: 'setting.light-dark',
|
|
82
|
+
kind: 'setting',
|
|
83
|
+
title: { en: 'Light or dark', zh: '明暗' },
|
|
84
|
+
synonyms: ['dark mode', 'light mode', 'appearance', 'night', '深色', '浅色', '暗色模式', '外观'],
|
|
85
|
+
panel: at(SET, GENERAL),
|
|
86
|
+
target: { settings: 'general', find: 'theme' },
|
|
87
|
+
cliCommand: 'sideby config set panel.theme dark',
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
id: 'setting.theme',
|
|
91
|
+
kind: 'setting',
|
|
92
|
+
title: { en: 'Theme', zh: '主题' },
|
|
93
|
+
synonyms: ['colors', 'colours', 'accent', 'look', '配色', '颜色', '皮肤'],
|
|
94
|
+
panel: at(SET, GENERAL),
|
|
95
|
+
target: { settings: 'general', find: 'themes' },
|
|
96
|
+
cliCommand: 'sideby theme',
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
id: 'setting.autostart',
|
|
100
|
+
kind: 'setting',
|
|
101
|
+
title: { en: 'Start sideby at login', zh: '登录后启动 sideby' },
|
|
102
|
+
synonyms: ['autostart', 'launch at login', 'background', 'startup', '开机启动', '自启动', '后台'],
|
|
103
|
+
panel: at(SET, GENERAL),
|
|
104
|
+
target: { settings: 'general', find: 'autostart' },
|
|
105
|
+
cliCommand: 'sideby autostart on',
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
id: 'setting.terminal',
|
|
109
|
+
kind: 'setting',
|
|
110
|
+
title: { en: 'Preferred terminal', zh: '首选终端' },
|
|
111
|
+
synonyms: ['terminal app', 'iterm', 'ghostty', 'warp', '终端'],
|
|
112
|
+
panel: at(SET, GENERAL),
|
|
113
|
+
target: { settings: 'general', find: 'terminal' },
|
|
114
|
+
cliCommand: 'sideby terminal',
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
id: 'setting.menubar',
|
|
118
|
+
kind: 'setting',
|
|
119
|
+
title: { en: 'Show quota in the menu bar', zh: '在状态栏显示额度' },
|
|
120
|
+
synonyms: ['menu bar', 'menubar', 'tray', 'status bar', '菜单栏', '状态栏'],
|
|
121
|
+
panel: at(SET, MENUBAR),
|
|
122
|
+
target: { settings: 'menubar', find: 'menubar' },
|
|
123
|
+
cliCommand: 'sideby menubar on',
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
id: 'setting.hotkey',
|
|
127
|
+
kind: 'setting',
|
|
128
|
+
title: { en: 'Menu bar shortcut', zh: '状态栏快捷键' },
|
|
129
|
+
synonyms: ['hotkey', 'keyboard shortcut', 'menu bar icon', '快捷键', '热键'],
|
|
130
|
+
panel: at(SET, MENUBAR),
|
|
131
|
+
target: { settings: 'menubar', find: 'hotkey' },
|
|
132
|
+
cliCommand: 'sideby menubar hotkey',
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
id: 'setting.order',
|
|
136
|
+
kind: 'setting',
|
|
137
|
+
title: { en: 'Account order, pins and hidden', zh: '账号顺序、置顶与隐藏' },
|
|
138
|
+
synonyms: ['sort', 'pin', 'hide', 'arrange', 'reorder', '排序', '置顶', '隐藏'],
|
|
139
|
+
panel: at(SET, ACCOUNTS),
|
|
140
|
+
target: { settings: 'accounts', find: 'order' },
|
|
141
|
+
cliCommand: 'sideby order',
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
id: 'setting.pick',
|
|
145
|
+
kind: 'setting',
|
|
146
|
+
title: { en: 'Start the account with the most quota left', zh: '自动启动剩余额度最多的账号' },
|
|
147
|
+
synonyms: ['pick command', 'alias', 'short command', 'next', '挑选命令', '短命令', '别名'],
|
|
148
|
+
panel: at(SET, ACCOUNTS),
|
|
149
|
+
target: { settings: 'accounts', find: 'pick' },
|
|
150
|
+
cliCommand: 'sideby alias add <short> --pick <family>',
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
id: 'setting.remote-control',
|
|
154
|
+
kind: 'setting',
|
|
155
|
+
title: { en: 'Remote Control', zh: '远程控制' },
|
|
156
|
+
synonyms: ['phone', 'web', 'continue on phone', 'remote', '手机', '网页', '远控'],
|
|
157
|
+
panel: at(SET, ACCOUNTS),
|
|
158
|
+
target: { settings: 'accounts', find: 'rc' },
|
|
159
|
+
cliCommand: 'sideby remote-control',
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
id: 'setting.quota-checks',
|
|
163
|
+
kind: 'setting',
|
|
164
|
+
title: { en: 'Quota checks', zh: '额度查询' },
|
|
165
|
+
synonyms: ['fetch quota', 'ask host', 'quota refresh', '查询额度', '刷新额度'],
|
|
166
|
+
panel: at(SET, QUOTA),
|
|
167
|
+
target: { settings: 'quota', find: 'checks' },
|
|
168
|
+
cliCommand: 'sideby quota check <family> on|off',
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
id: 'setting.network',
|
|
172
|
+
kind: 'setting',
|
|
173
|
+
title: { en: 'Network check', zh: '网络检查' },
|
|
174
|
+
synonyms: ['network guard', 'proxy', 'vpn', 'country', 'region', '网络守卫', '代理', '地区', '国家'],
|
|
175
|
+
panel: at(SET, { en: 'Network check', zh: '网络检查' }),
|
|
176
|
+
target: { settings: 'network', find: 'net' },
|
|
177
|
+
cliCommand: 'sideby network',
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
id: 'setting.skill',
|
|
181
|
+
kind: 'setting',
|
|
182
|
+
title: { en: 'Ask your AI to do it', zh: '让 AI 帮你操作' },
|
|
183
|
+
synonyms: ['skill', 'agent skill', 'install skill', 'claude code', 'codex', '技能', '安装技能'],
|
|
184
|
+
panel: at(SET, AI),
|
|
185
|
+
target: { settings: 'ai', find: 'skill' },
|
|
186
|
+
cliCommand: 'sideby update --skill',
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
id: 'setting.quota-as',
|
|
190
|
+
kind: 'setting',
|
|
191
|
+
title: { en: 'Show quota as used or left', zh: '额度显示:已用或剩余' },
|
|
192
|
+
synonyms: ['used', 'left', 'remaining', 'percent', '已用', '剩余', '百分比'],
|
|
193
|
+
panel: DISPLAY,
|
|
194
|
+
target: { display: 'quota' },
|
|
195
|
+
cliCommand: null,
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
id: 'setting.view',
|
|
199
|
+
kind: 'setting',
|
|
200
|
+
title: { en: 'List or cards', zh: '列表或卡片' },
|
|
201
|
+
synonyms: ['view', 'layout', 'grid', '视图', '布局', '网格'],
|
|
202
|
+
panel: DISPLAY,
|
|
203
|
+
target: { display: 'view' },
|
|
204
|
+
cliCommand: null,
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
id: 'setting.hide-emails',
|
|
208
|
+
kind: 'setting',
|
|
209
|
+
title: { en: 'Hide emails', zh: '隐藏邮箱' },
|
|
210
|
+
synonyms: ['privacy', 'screenshot', 'email', '隐私', '截图', '邮箱'],
|
|
211
|
+
panel: DISPLAY,
|
|
212
|
+
target: { display: 'emails' },
|
|
213
|
+
cliCommand: null,
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
id: 'action.new-account',
|
|
217
|
+
kind: 'action',
|
|
218
|
+
title: { en: 'New account', zh: '新建账号' },
|
|
219
|
+
synonyms: ['add account', 'create account', 'api account', 'sign in', '添加账号', '加账号', '登录'],
|
|
220
|
+
panel: at(ACCOUNTS, { en: 'New account', zh: '新建账号' }),
|
|
221
|
+
target: { action: 'new-account', write: true },
|
|
222
|
+
cliCommand: 'sideby new <family> --next',
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
id: 'action.remote-control-off',
|
|
226
|
+
kind: 'action',
|
|
227
|
+
title: { en: 'Turn Remote Control off', zh: '关闭远程控制' },
|
|
228
|
+
synonyms: ['disable remote control', '关掉远程控制'],
|
|
229
|
+
panel: at(SET, ACCOUNTS, { en: 'Remote Control', zh: '远程控制' }),
|
|
230
|
+
target: { action: 'remote-control', write: true },
|
|
231
|
+
cliCommand: 'sideby remote-control off',
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
id: 'action.handoff-on',
|
|
235
|
+
kind: 'action',
|
|
236
|
+
title: { en: 'Turn on Auto Handoff', zh: '开启自动接力' },
|
|
237
|
+
synonyms: ['handoff setup', 'enable handoff', '设置接力', '打开接力'],
|
|
238
|
+
panel: { en: 'Auto Handoff page', zh: '自动接力页' },
|
|
239
|
+
target: { action: 'handoff-on', write: true },
|
|
240
|
+
cliCommand: 'sideby handoff enable',
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
id: 'action.network-guard',
|
|
244
|
+
kind: 'action',
|
|
245
|
+
title: { en: 'Turn the network check on or off', zh: '开关网络检查' },
|
|
246
|
+
synonyms: ['network guard on', 'block country', '网络守卫开关'],
|
|
247
|
+
panel: at(SET, { en: 'Network check', zh: '网络检查' }),
|
|
248
|
+
target: { action: 'network', write: true },
|
|
249
|
+
cliCommand: 'sideby network on|off',
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
id: 'action.themes',
|
|
253
|
+
kind: 'action',
|
|
254
|
+
title: { en: 'Choose a theme', zh: '选择主题' },
|
|
255
|
+
synonyms: ['import theme', 'theme preview', '导入主题', '换主题'],
|
|
256
|
+
panel: at(SET, GENERAL, { en: 'Theme', zh: '主题' }),
|
|
257
|
+
target: { action: 'themes', write: false },
|
|
258
|
+
cliCommand: 'sideby theme use <name>',
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
id: 'action.update',
|
|
262
|
+
kind: 'action',
|
|
263
|
+
title: { en: 'Update sideby', zh: '更新 sideby' },
|
|
264
|
+
synonyms: ['upgrade', 'new version', 'auto update', '升级', '新版本', '自动更新'],
|
|
265
|
+
panel: at(HEADER, { en: 'Version', zh: '版本' }),
|
|
266
|
+
target: { action: 'update', write: true },
|
|
267
|
+
cliCommand: 'sideby update',
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
id: 'action.ask-ai',
|
|
271
|
+
kind: 'action',
|
|
272
|
+
title: { en: 'Let AI do it', zh: '让 AI 帮我' },
|
|
273
|
+
synonyms: ['ask ai', 'assistant', 'help', '问 AI', '助手', '帮助'],
|
|
274
|
+
panel: at(HEADER, { en: 'Let AI do it', zh: '让 AI 帮我' }),
|
|
275
|
+
target: { action: 'ask', write: true },
|
|
276
|
+
cliCommand: 'sideby ask',
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
id: 'action.health-check',
|
|
280
|
+
kind: 'action',
|
|
281
|
+
title: { en: 'Health check and fixes', zh: '健康检查与修复' },
|
|
282
|
+
synonyms: [
|
|
283
|
+
'doctor',
|
|
284
|
+
'fix',
|
|
285
|
+
'repair',
|
|
286
|
+
'broken',
|
|
287
|
+
'symlink',
|
|
288
|
+
'permissions',
|
|
289
|
+
'修复',
|
|
290
|
+
'诊断',
|
|
291
|
+
'权限',
|
|
292
|
+
'软链接',
|
|
293
|
+
],
|
|
294
|
+
panel: at(ACCOUNTS, { en: 'Health check', zh: '健康检查' }),
|
|
295
|
+
target: { action: 'health', write: false },
|
|
296
|
+
cliCommand: 'sideby doctor --fix',
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
id: 'action.inbound',
|
|
300
|
+
kind: 'action',
|
|
301
|
+
title: { en: 'Receiving messages', zh: '接收消息' },
|
|
302
|
+
synonyms: ['send to session', 'inbound', 'cross-session', 'accept messages', '发消息', '跨会话'],
|
|
303
|
+
panel: at({ en: 'Sessions', zh: '会话' }, { en: 'Receiving messages', zh: '接收消息' }),
|
|
304
|
+
target: { action: 'inbound', write: false },
|
|
305
|
+
cliCommand: 'sideby messages inbound accept',
|
|
306
|
+
},
|
|
307
|
+
];
|
|
308
|
+
/** The catalog; a row of the Settings dialog or the Display popover names itself at the end of its place. */
|
|
309
|
+
export const SEARCH_CATALOG = ENTRIES.map((e) => 'settings' in e.target || 'display' in e.target ? { ...e, panel: at(e.panel, e.title) } : e);
|
|
310
|
+
/** Shown on an empty query after the recently used ones (spec §3.36). */
|
|
311
|
+
export const COMMON_ENTRIES = [
|
|
312
|
+
'action.new-account',
|
|
313
|
+
'setting.language',
|
|
314
|
+
'setting.light-dark',
|
|
315
|
+
'page.sessions',
|
|
316
|
+
];
|
|
317
|
+
export function catalogNorm(s) {
|
|
318
|
+
return s.toLowerCase().normalize('NFKC').replace(/\s+/g, ' ').trim();
|
|
319
|
+
}
|
|
320
|
+
/** How well one text matches: 0 exact, 1 starts with it, 2 a word starts with it, 3 contains it, -1 not at all. */
|
|
321
|
+
export function catalogMatchLevel(text, q) {
|
|
322
|
+
const s = catalogNorm(text);
|
|
323
|
+
if (s === q)
|
|
324
|
+
return 0;
|
|
325
|
+
if (s.startsWith(q))
|
|
326
|
+
return 1;
|
|
327
|
+
if (s.split(/[\s,→()/-]+/).some((w) => w && w.startsWith(q)))
|
|
328
|
+
return 2;
|
|
329
|
+
return s.includes(q) ? 3 : -1;
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Entries matching `query`, best first: exact before prefix before contains, titles before synonyms, then the
|
|
333
|
+
* catalog's own order. Both languages are searched whatever the Panel shows. An empty query matches nothing.
|
|
334
|
+
*/
|
|
335
|
+
export function searchCatalog(query, catalog) {
|
|
336
|
+
const q = catalogNorm(query);
|
|
337
|
+
if (!q)
|
|
338
|
+
return [];
|
|
339
|
+
const hits = [];
|
|
340
|
+
catalog.forEach((entry, order) => {
|
|
341
|
+
let best = -1;
|
|
342
|
+
for (const title of [entry.title.en, entry.title.zh]) {
|
|
343
|
+
const l = catalogMatchLevel(title, q);
|
|
344
|
+
if (l >= 0 && (best < 0 || l * 2 < best))
|
|
345
|
+
best = l * 2;
|
|
346
|
+
}
|
|
347
|
+
for (const syn of entry.synonyms) {
|
|
348
|
+
const l = catalogMatchLevel(syn, q);
|
|
349
|
+
if (l >= 0 && (best < 0 || l * 2 + 1 < best))
|
|
350
|
+
best = l * 2 + 1;
|
|
351
|
+
}
|
|
352
|
+
if (best >= 0)
|
|
353
|
+
hits.push({ entry, rank: best, order });
|
|
354
|
+
});
|
|
355
|
+
hits.sort((a, b) => a.rank - b.rank || a.order - b.order);
|
|
356
|
+
return hits.map(({ entry, rank }) => ({ entry, rank }));
|
|
357
|
+
}
|
|
@@ -32,6 +32,11 @@ export declare function installedSkills(home: string): Promise<{
|
|
|
32
32
|
version: string | null;
|
|
33
33
|
}[]>;
|
|
34
34
|
/** The command `sideby update` runs to update an installed sideby skill: it keeps the agents it was installed for. */
|
|
35
|
+
/**
|
|
36
|
+
* An installed skill for `installed` (null: from before skills had a version) is behind `target`. A skill for a newer
|
|
37
|
+
* sideby is not: `npx skills update` brings the newest skill, so it is the CLI that is behind (spec §3.23).
|
|
38
|
+
*/
|
|
39
|
+
export declare const skillIsBehind: (installed: string | null, target: string) => boolean;
|
|
35
40
|
export declare const SKILL_UPDATE: readonly ['npx', '-y', 'skills', 'update', 'sideby', '-g', '-y'];
|
|
36
41
|
/**
|
|
37
42
|
* Checks, for each given Family, the sideby skill its Host reads: `<main>/skills/sideby`, and for Codex also
|
|
@@ -5,6 +5,7 @@ import { readFile, realpath, stat } from 'node:fs/promises';
|
|
|
5
5
|
import { dirname, join } from 'node:path';
|
|
6
6
|
import { mainDirOf } from './accounts.js';
|
|
7
7
|
import { tildify } from './paths.js';
|
|
8
|
+
import { compareVersions } from './version.js';
|
|
8
9
|
export const SKILL_SOURCE = 'Adonis0123/sideby';
|
|
9
10
|
/** sideby's repository, linked from the Panel's header. */
|
|
10
11
|
export const REPO_URL = `https://github.com/${SKILL_SOURCE}`;
|
|
@@ -81,6 +82,11 @@ export async function installedSkills(home) {
|
|
|
81
82
|
return out;
|
|
82
83
|
}
|
|
83
84
|
/** The command `sideby update` runs to update an installed sideby skill: it keeps the agents it was installed for. */
|
|
85
|
+
/**
|
|
86
|
+
* An installed skill for `installed` (null: from before skills had a version) is behind `target`. A skill for a newer
|
|
87
|
+
* sideby is not: `npx skills update` brings the newest skill, so it is the CLI that is behind (spec §3.23).
|
|
88
|
+
*/
|
|
89
|
+
export const skillIsBehind = (installed, target) => installed !== target && compareVersions(installed ?? '', target) !== 1;
|
|
84
90
|
export const SKILL_UPDATE = ['npx', '-y', 'skills', 'update', 'sideby', '-g', '-y'];
|
|
85
91
|
/**
|
|
86
92
|
* Checks, for each given Family, the sideby skill its Host reads: `<main>/skills/sideby`, and for Codex also
|
|
@@ -109,7 +115,7 @@ export async function checkInstalledSkills(home, families, version) {
|
|
|
109
115
|
}
|
|
110
116
|
seen.add(`${family.id}\0${real}`);
|
|
111
117
|
const found = skillVersionOf(text);
|
|
112
|
-
if (found
|
|
118
|
+
if (!skillIsBehind(found, version))
|
|
113
119
|
continue;
|
|
114
120
|
const where = tildify(path, home);
|
|
115
121
|
// `sideby update` brings the skill along, except one a git repository owns (a dotfiles clone, say).
|