sideby 0.26.1 → 0.27.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/dist/build.json CHANGED
@@ -1 +1 @@
1
- {"id":"20261027T064256-56957b"}
1
+ {"id":"20261028T040020-d659f5"}
@@ -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;
@@ -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,
@@ -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':
@@ -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
+ }
@@ -455,6 +455,26 @@ declare const en: {
455
455
  'ai.how': string;
456
456
  'ai.ask.api': string;
457
457
  'ai.ask.tool': string;
458
+ 'ai.ask.find': string;
459
+ 'pal.button': string;
460
+ 'pal.title': string;
461
+ 'pal.placeholder': string;
462
+ 'pal.kind.page': string;
463
+ 'pal.kind.setting': string;
464
+ 'pal.kind.action': string;
465
+ 'pal.recent': string;
466
+ 'pal.common': string;
467
+ 'pal.results': string;
468
+ 'pal.more.one': string;
469
+ 'pal.more.other': string;
470
+ 'pal.history': string;
471
+ 'pal.historyHint': string;
472
+ 'pal.none': string;
473
+ 'pal.askAi': string;
474
+ 'pal.askText': string;
475
+ 'pal.readOnly': string;
476
+ 'pal.also': string;
477
+ 'pal.keys': string;
458
478
  'ask.button': string;
459
479
  'ask.title': string;
460
480
  'ask.title.fix': string;
@@ -457,6 +457,26 @@ const en = {
457
457
  'ai.how': 'How',
458
458
  'ai.ask.api': 'Add a DeepSeek API account for me.',
459
459
  'ai.ask.tool': 'Help sideby support a new tool.',
460
+ 'ai.ask.find': 'Where do I change the language of the Panel?',
461
+ 'pal.button': 'Search',
462
+ 'pal.title': 'Search sideby',
463
+ 'pal.placeholder': 'Find a page, setting or action…',
464
+ 'pal.kind.page': 'Page',
465
+ 'pal.kind.setting': 'Setting',
466
+ 'pal.kind.action': 'Action',
467
+ 'pal.recent': 'Recently used',
468
+ 'pal.common': 'Common',
469
+ 'pal.results': 'Features',
470
+ 'pal.more.one': 'Show {n} more',
471
+ 'pal.more.other': 'Show {n} more',
472
+ 'pal.history': 'Search session history for “{q}”',
473
+ 'pal.historyHint': 'Sessions page',
474
+ 'pal.none': 'No matching feature.',
475
+ 'pal.askAi': 'Ask your AI where “{q}” is',
476
+ 'pal.askText': 'Where do I find “{q}” in sideby?',
477
+ 'pal.readOnly': 'Not in a read-only Panel',
478
+ 'pal.also': 'matches “{w}”',
479
+ 'pal.keys': '↑ ↓ to move · Enter to open · Esc to close',
460
480
  'ask.button': 'Let AI do it',
461
481
  'ask.title': 'Let AI do it',
462
482
  'ask.title.fix': 'Let AI fix it',
@@ -1903,6 +1923,26 @@ const zh = {
1903
1923
  'ai.how': '怎么做',
1904
1924
  'ai.ask.api': '帮我加一个 DeepSeek API 账号。',
1905
1925
  'ai.ask.tool': '帮 sideby 支持一个新工具。',
1926
+ 'ai.ask.find': '面板的语言在哪里改?',
1927
+ 'pal.button': '搜索',
1928
+ 'pal.title': '搜索 sideby',
1929
+ 'pal.placeholder': '查找页面、设置或操作…',
1930
+ 'pal.kind.page': '页面',
1931
+ 'pal.kind.setting': '设置',
1932
+ 'pal.kind.action': '操作',
1933
+ 'pal.recent': '最近用过',
1934
+ 'pal.common': '常用',
1935
+ 'pal.results': '功能',
1936
+ 'pal.more.one': '再显示 {n} 项',
1937
+ 'pal.more.other': '再显示 {n} 项',
1938
+ 'pal.history': '在会话历史里搜索“{q}”',
1939
+ 'pal.historyHint': '会话页',
1940
+ 'pal.none': '没有匹配的功能。',
1941
+ 'pal.askAi': '问 AI “{q}”在哪里',
1942
+ 'pal.askText': '在 sideby 里,“{q}”在哪里?',
1943
+ 'pal.readOnly': '只读面板里不能用',
1944
+ 'pal.also': '匹配“{w}”',
1945
+ 'pal.keys': '↑ ↓ 选择 · Enter 打开 · Esc 关闭',
1906
1946
  'ask.button': '让 AI 帮我',
1907
1947
  'ask.title': '让 AI 帮我',
1908
1948
  'ask.title.fix': '让 AI 修复',
@@ -3,9 +3,13 @@
3
3
  import { groupsToAccept } from '../core/inbound.js';
4
4
  import { quotaIsStale } from '../core/quota-levels.js';
5
5
  import { remoteControlTodo } from '../core/remote-control.js';
6
+ import { catalogMatchLevel, catalogNorm, searchCatalog } from '../core/search-catalog.js';
6
7
  import { aiTaskAccounts, aliasArgsOf, aliasIssue, askBridge, askBridged, askCopy, attentionReasons, attentionWhy, autostartNote, bindingWindow, cacheHitRate, canLeaveLocal, categoryOrder, codeSwapOutcome, dotsKeepKeyboard, enableOutcome, fileSize, fixPrompt, foldSkips, foldToolCalls, formatDuration, handoffChangeOf, handoffHintAccount, handoffTaskFacts, hiddenIn, highlightParts, histFilters, historyEmpty, historyWhen, hotkeyFromKey, hotkeyPressKind, inDisplayOrder, loginClusters, loginKey, maskEmail, matchesQuery, mdBlocks, mdInline, menuPlacement, mergeDaily, mergeUsage, messageChip, messageNews, networkTaskFacts, newAccountDir, nextReset, panelFixes, panelHint, panelLang, panelMigration, panelPrefs, passedWindow, pinnedIn, quotaAskable, quotaHighLevel, quotaPressure, radioStep, remoteControlSummary, reorder, rowBadge, runCodeSwap, saveHandoffChange, sendBlock, sendFileProblem, sendResultView, sessionAge, sessionLabelParts, shortCwd, shortSessionLabel, sortAccounts, sortSessions, steadyOrder, stripSecrets, suggestAlias, suggestName, switchFailure, tailInView, taskFindings, updatedAge, widthFollower, widthTier, windowState, withPinned, } from './page-logic.js';
7
8
  const LOGIC = [
8
9
  quotaIsStale,
10
+ catalogNorm,
11
+ catalogMatchLevel,
12
+ searchCatalog,
9
13
  aiTaskAccounts,
10
14
  askBridge,
11
15
  askBridged,
@@ -1146,6 +1150,8 @@ const MAIN = String.raw `
1146
1150
  for (const el of document.querySelectorAll('[data-i18n]')) el.textContent = t(el.getAttribute('data-i18n'))
1147
1151
  $('refresh').setAttribute('aria-label', t('top.refresh'))
1148
1152
  $('ask-ai').setAttribute('aria-label', t('ask.button'))
1153
+ $('search-btn').setAttribute('aria-label', t('pal.button') + ' (' + palKey() + ')')
1154
+ $('search-kbd').textContent = palKey()
1149
1155
  const repo = $('repo')
1150
1156
  for (const k of ['aria-label', 'title']) repo.setAttribute(k, t('top.repo'))
1151
1157
  if (/^https:\/\/github\.com\//.test(BOOT.repoUrl || '')) { repo.href = BOOT.repoUrl; repo.hidden = false }
@@ -1270,13 +1276,13 @@ const MAIN = String.raw `
1270
1276
  const redo = () => { savePrefs(); renderAccounts(); refreshPopover('display') }
1271
1277
  const emails = S.state && S.state.accounts.some((a) => a.identity && a.identity.email)
1272
1278
  return h('div', { class: 'display-panel' },
1273
- h('div', { class: 'dp-row' }, h('span', { class: 'dp-label' }, t('tb.quota')),
1274
- seg(t('tb.quota'), [['used', t('tb.used')], ['left', t('tb.left')]], prefs.quota, (v) => { prefs.quota = v; redo() })),
1275
- h('div', { class: 'dp-row' }, h('span', { class: 'dp-label' }, t('tb.view')),
1276
- seg(t('tb.view'), [['list', [icon('list'), h('span', null, t('tb.list'))], t('tb.list')], ['cards', [icon('grid'), h('span', null, t('tb.cards'))], t('tb.cards')]], prefs.view, (v) => { prefs.view = v; ui.fade = true; redo() })),
1277
- emails ? h('label', { class: 'dp-row dp-check' },
1279
+ fm('quota', h('div', { class: 'dp-row' }, h('span', { class: 'dp-label' }, t('tb.quota')),
1280
+ seg(t('tb.quota'), [['used', t('tb.used')], ['left', t('tb.left')]], prefs.quota, (v) => { prefs.quota = v; redo() }))),
1281
+ fm('view', h('div', { class: 'dp-row' }, h('span', { class: 'dp-label' }, t('tb.view')),
1282
+ seg(t('tb.view'), [['list', [icon('list'), h('span', null, t('tb.list'))], t('tb.list')], ['cards', [icon('grid'), h('span', null, t('tb.cards'))], t('tb.cards')]], prefs.view, (v) => { prefs.view = v; ui.fade = true; redo() }))),
1283
+ emails ? fm('emails', h('label', { class: 'dp-row dp-check' },
1278
1284
  h('input', { type: 'checkbox', checked: prefs.hideEmail, onchange: (e) => { prefs.hideEmail = e.target.checked; redo() } }),
1279
- h('span', null, t('tb.hideEmails'))) : null)
1285
+ h('span', null, t('tb.hideEmails')))) : null)
1280
1286
  }
1281
1287
  function renderFamilyFilter() {
1282
1288
  if (!tb.family) return
@@ -1634,9 +1640,9 @@ const MAIN = String.raw `
1634
1640
  return h('li', { class: 'br-row' },
1635
1641
  h('span', null, h('b', null, profileName(p.name)), p.email ? h('span', { class: 'muted small' }, ' · ' + emailText(p.email)) : null, ' ', h('span', { class: 'muted small mono' }, p.dir), p.changedAt ? h('span', { class: 'muted small' }, ' · ' + t('br.changed', { when: ago(p.changedAt) })) : null),
1636
1642
  h('span', { class: 'br-acts' },
1643
+ h('button', { class: 'btn btn-sm', type: 'button', disabled: Boolean(ui.browserRef), 'aria-busy': busy ? 'true' : null, onclick: () => openBrowser(a, p) }, t('br.openIt')),
1637
1644
  chosen ? h('span', { class: 'tag', title: t('br.chosenHint') }, t('br.chosen'))
1638
- : h('button', { class: 'link-btn small', type: 'button', disabled: br.busy, title: t('br.chooseHint', { ref: a.ref }), onclick: () => brChoose(a, p.dir) }, t('br.choose')),
1639
- h('button', { class: 'btn btn-sm', type: 'button', disabled: Boolean(ui.browserRef), 'aria-busy': busy ? 'true' : null, onclick: () => openBrowser(a, p) }, t('br.openIt'))))
1645
+ : h('button', { class: 'link-btn small', type: 'button', disabled: br.busy, title: t('br.chooseHint', { ref: a.ref }), onclick: () => brChoose(a, p.dir) }, t('br.choose'))))
1640
1646
  }
1641
1647
  // Remembers the person's own choice for this account, or with null lets sideby find it again; sideby's config only.
1642
1648
  async function brChoose(a, dir) {
@@ -2834,7 +2840,8 @@ const MAIN = String.raw `
2834
2840
  // A wide dialog is wide before it opens, so it does not open narrow and then stretch.
2835
2841
  el.classList.toggle('dialog-wide', kind === 'settings' ? el.classList.contains('dialog-wide') : kind === 'history')
2836
2842
  // A dialog that grows as the user adds to it (screenshots, its result) keeps its top edge and grows downward.
2837
- el.classList.toggle('dialog-top', kind === 'send')
2843
+ el.classList.toggle('dialog-top', kind === 'send' || kind === 'palette')
2844
+ el.classList.toggle('dialog-pal', kind === 'palette')
2838
2845
  if (!el.open) { el.showModal(); raiseToasts() }
2839
2846
  }
2840
2847
 
@@ -5761,8 +5768,8 @@ const MAIN = String.raw `
5761
5768
  function lookRows() {
5762
5769
  const secs = settingsSections()
5763
5770
  const out = []
5764
- if (secs.includes('lang')) out.push(setSeg(t('set.lang'), [['en', 'English'], ['zh', '中文']], lang, setLang))
5765
- if (secs.includes('theme')) out.push(setSeg(t('set.theme'), CHOICES.theme.map((v) => [v, t('set.theme.' + v)]), viewPrefs().theme, setTheme))
5771
+ if (secs.includes('lang')) out.push(fm('lang', setSeg(t('set.lang'), [['en', 'English'], ['zh', '中文']], lang, setLang)))
5772
+ if (secs.includes('theme')) out.push(fm('theme', setSeg(t('set.theme'), CHOICES.theme.map((v) => [v, t('set.theme.' + v)]), viewPrefs().theme, setTheme)))
5766
5773
  return out
5767
5774
  }
5768
5775
  function ahLink(leave) {
@@ -5782,33 +5789,33 @@ const MAIN = String.raw `
5782
5789
  function settingsGroups(leave) {
5783
5790
  const secs = settingsSections()
5784
5791
  const link = (...args) => setLink(leave, ...args)
5785
- const general = [...lookRows(), link(t('th.title'), themeLabel(), '', openThemes, true), autostartRow('autostart')]
5786
- if (!BOOT.readOnly) general.push(link(t('term.title'), '', '', openTerminals, true))
5792
+ const general = [...lookRows(), fm('themes', link(t('th.title'), themeLabel(), '', openThemes, true)), fm('autostart', autostartRow('autostart'))]
5793
+ if (!BOOT.readOnly) general.push(fm('terminal', link(t('term.title'), '', '', openTerminals, true)))
5787
5794
  // The menu bar switch shows only where it works (macOS); while its state loads it waits, unseen.
5788
5795
  const bar = []
5789
5796
  if (li.menubar.status && li.menubar.status.supported) {
5790
- bar.push(autostartRow('menubar'))
5797
+ bar.push(fm('menubar', autostartRow('menubar')))
5791
5798
  const mbs = li.menubar.status
5792
5799
  if ((mbs.state === 'on' || mbs.state === 'stale') && mbs.hotkey)
5793
- bar.push(link(t('mb.settings'), mbs.hotkey.enabled ? mbs.hotkey.label : t('hk.unset'), mbs.hotkey.registered === false ? 'chip-warn' : '', openMenubarSettings, true, 'mbset'))
5800
+ bar.push(fm('hotkey', link(t('mb.settings'), mbs.hotkey.enabled ? mbs.hotkey.label : t('hk.unset'), mbs.hotkey.registered === false ? 'chip-warn' : '', openMenubarSettings, true, 'mbset')))
5794
5801
  }
5795
5802
  const acct = []
5796
5803
  // The arrange mode (spec §3.25) has a place here too, where people look for "how do I change this".
5797
5804
  if (secs.includes('order')) {
5798
5805
  const d = displayOf()
5799
5806
  const pins = [d.pinned, d.hidden].some((r) => Object.values(r || {}).some((x) => x.length)) || Boolean(d.hiddenFamilies && d.hiddenFamilies.length)
5800
- acct.push(link(t('set.order'), t(ordered() || pins ? 'set.orderMine' : 'set.orderDefault'), '', () => {
5807
+ acct.push(fm('order', link(t('set.order'), t(ordered() || pins ? 'set.orderMine' : 'set.orderDefault'), '', () => {
5801
5808
  setPage('accounts')
5802
5809
  startArrange()
5803
5810
  const bar = document.querySelector('#accounts .arrange-bar')
5804
5811
  if (bar) bar.scrollIntoView({ behavior: REDUCED ? 'auto' : 'smooth', block: 'center' })
5805
- }))
5812
+ })))
5806
5813
  }
5807
5814
  if (pickFamilies().length) {
5808
5815
  const names = Object.keys(S.state.pickCommands || {})
5809
- acct.push(link(t('pk.title'), names.length ? names.join(', ') : t('pk.noneYet'), names.length ? 'chip-ok' : '', () => openPick(null), true))
5816
+ acct.push(fm('pick', link(t('pk.title'), names.length ? names.join(', ') : t('pk.noneYet'), names.length ? 'chip-ok' : '', () => openPick(null), true)))
5810
5817
  }
5811
- if (secs.includes('rc')) acct.push(rcLink(leave))
5818
+ if (secs.includes('rc')) acct.push(fm('rc', rcLink(leave)))
5812
5819
  // Quota checks that ask the Host (spec §3.26): one switch per Family under one shared explanation.
5813
5820
  const checks = []
5814
5821
  let every = 15
@@ -5816,11 +5823,13 @@ const MAIN = String.raw `
5816
5823
  for (const c of S.state.quotaChecks) {
5817
5824
  every = c.everyMinutes
5818
5825
  const label = t('set.quotaCheck', { host: c.title })
5819
- checks.push(h('div', { class: 'set-row' + (c.blocked ? ' set-check' : '') },
5826
+ // The first row is where the palette takes the user.
5827
+ const mark = checks.length ? (el) => el : (el) => fm('checks', el)
5828
+ checks.push(mark(h('div', { class: 'set-row' + (c.blocked ? ' set-check' : '') },
5820
5829
  h('div', { class: 'set-text' }, h('span', { class: 'set-label' }, c.title), c.blocked ? h('span', { class: 'set-hint' }, c.blocked) : null),
5821
5830
  BOOT.readOnly ? h('span', { class: 'chip chip-sm' + (c.on ? ' chip-ok' : '') }, c.on ? t('ah.on') : t('ah.off'))
5822
5831
  : h('div', { class: 'seg', role: 'group', 'aria-label': label }, [[true, t('ah.on')], [false, t('ah.off')]].map(([v, text]) =>
5823
- h('button', { class: 'seg-btn', type: 'button', 'aria-pressed': String(v === c.on), onclick: () => { if (v !== c.on) { leave(false); setCheck(c.family, v) } } }, text)))))
5832
+ h('button', { class: 'seg-btn', type: 'button', 'aria-pressed': String(v === c.on), onclick: () => { if (v !== c.on) { leave(false); setCheck(c.family, v) } } }, text))))))
5824
5833
  }
5825
5834
  }
5826
5835
  // Network Guard (spec §3.35): its own dialog, with the state on the link.
@@ -5828,10 +5837,10 @@ const MAIN = String.raw `
5828
5837
  if (secs.includes('net')) {
5829
5838
  const n = S.state.network
5830
5839
  const bad = netProblem()
5831
- netItems.push(link(t('net.title'), bad ? t('net.blocked') : n.guard ? t('ah.on') : t('ah.off'), bad ? 'chip-fail' : n.guard ? 'chip-ok' : '', openNet, true))
5840
+ netItems.push(fm('net', link(t('net.title'), bad ? t('net.blocked') : n.guard ? t('ah.on') : t('ah.off'), bad ? 'chip-fail' : n.guard ? 'chip-ok' : '', openNet, true)))
5832
5841
  }
5833
5842
  // Everything here can also be asked of an AI assistant through the sideby skill (spec §3.8).
5834
- const ai = [aiLink(leave), link(t('ask.plugin'), '', '', () => openAsk({ task: 'plugin', context: { version: BOOT.version } }), true)]
5843
+ const ai = [fm('skill', aiLink(leave)), link(t('ask.plugin'), '', '', () => openAsk({ task: 'plugin', context: { version: BOOT.version } }), true)]
5835
5844
  return [
5836
5845
  { id: 'general', title: t('set.g.general'), items: general },
5837
5846
  { id: 'menubar', title: t('set.g.menubar'), items: bar },
@@ -5890,6 +5899,231 @@ const MAIN = String.raw `
5890
5899
  if (dlg.kind === 'settings') renderSettingsDialog()
5891
5900
  }
5892
5901
 
5902
+ // ---------- Command Palette (spec §3.36, ADR-0054) ----------
5903
+ // The Search button and Cmd/Ctrl+K open one list of pages, settings and actions from the Search Catalog that
5904
+ // sideby commands searches too. It finds features, never Sessions: the last row hands the words to Session History.
5905
+ // A setting opens where it lives and lights up; an action only opens its own preview or confirmation.
5906
+ const CATALOG = JSON.parse(document.getElementById('sideby-catalog').textContent)
5907
+ const PAL_RECENT_KEY = 'sideby.palette.recent'
5908
+ const PAL_SHOWN = 8
5909
+ const pal = { q: '', sel: 0, all: false, els: null, opts: [] }
5910
+ function palKey() { return /Mac|iPhone|iPad/.test(navigator.platform || '') ? '⌘K' : 'Ctrl K' }
5911
+ // Marks a row the palette can take the user to; the Search Catalog names it by this id.
5912
+ function fm(id, el) { if (id && el && el.setAttribute) el.setAttribute('data-find', id); return el }
5913
+ // The actions the catalog names. ok: whether this Panel has it now; nav: it goes to a page instead of a dialog.
5914
+ const PALETTE_ACTIONS = {
5915
+ 'new-account': { run: () => openCreate(null), ok: () => Boolean(S.state) },
5916
+ 'remote-control': { run: openRc, ok: () => Boolean(S.state && rcSummary()) },
5917
+ 'handoff-on': { run: () => setPage('handoff'), ok: () => Boolean(ahState()), nav: true },
5918
+ network: { run: openNet, ok: () => Boolean(netState()) },
5919
+ themes: { run: openThemes, ok: () => true },
5920
+ update: { run: openUpdate, ok: () => Boolean(BOOT.updates) },
5921
+ ask: { run: () => openAsk(), ok: () => !askBridged(BOOT, window) },
5922
+ health: { run: palHealth, ok: () => Boolean(S.state && S.state.accounts.length), nav: true },
5923
+ inbound: { run: openInbound, ok: () => Boolean(S.state) },
5924
+ }
5925
+ function palHealth() {
5926
+ setPage('accounts')
5927
+ const box = $('checkup')
5928
+ if (!box) return
5929
+ box.scrollIntoView({ behavior: REDUCED ? 'auto' : 'smooth', block: 'start' })
5930
+ palFlash(box)
5931
+ }
5932
+ function palRecent() {
5933
+ try {
5934
+ const v = JSON.parse(localStorage.getItem(PAL_RECENT_KEY) || '[]')
5935
+ return Array.isArray(v) ? v.filter((x) => typeof x === 'string').slice(0, 5) : []
5936
+ } catch { return [] }
5937
+ }
5938
+ function palRemember(id) {
5939
+ try { localStorage.setItem(PAL_RECENT_KEY, JSON.stringify([id].concat(palRecent().filter((x) => x !== id)).slice(0, 5))) } catch {}
5940
+ }
5941
+ // Which settings rows this Panel shows now (some depend on the machine, the accounts or a read-only Panel).
5942
+ function palFindable() {
5943
+ const found = new Set()
5944
+ for (const g of settingsGroups(() => {})) for (const it of g.items) {
5945
+ const f = it && it.getAttribute && it.getAttribute('data-find')
5946
+ if (f) found.add('s:' + g.id + ':' + f)
5947
+ }
5948
+ if (document.querySelector('#toolbar:not([hidden]) .tb-display'))
5949
+ for (const el of displayPanel().querySelectorAll('[data-find]')) found.add('d:' + el.getAttribute('data-find'))
5950
+ return found
5951
+ }
5952
+ function palAvailable(e, found) {
5953
+ const g = e.target
5954
+ if (g.page) return g.page === 'accounts' ? true : g.page === 'tuning' ? tuningAvailable() : g.page === 'handoff' ? Boolean(ahState()) : Boolean(S.state)
5955
+ if (g.settings) return found.has('s:' + g.settings + ':' + g.find)
5956
+ if (g.display) return found.has('d:' + g.display)
5957
+ const a = PALETTE_ACTIONS[g.action]
5958
+ return Boolean(a && a.ok())
5959
+ }
5960
+ function palWhyOff(e) { return e.target.action && e.target.write && BOOT.readOnly ? t('pal.readOnly') : '' }
5961
+ function openPalette() {
5962
+ if (dlg.el && dlg.el.open) return
5963
+ closeMenu()
5964
+ pal.q = ''
5965
+ pal.sel = 0
5966
+ pal.all = false
5967
+ pal.found = palFindable()
5968
+ showDialog('palette')
5969
+ const input = h('input', { type: 'search', class: 'pal-input', role: 'combobox', 'aria-expanded': 'true', 'aria-controls': 'pal-list', 'aria-autocomplete': 'list', autocomplete: 'off', spellcheck: 'false', placeholder: t('pal.placeholder'), 'aria-label': t('pal.title') })
5970
+ input.addEventListener('input', () => { pal.q = input.value; pal.sel = 0; pal.all = false; drawPalette() })
5971
+ input.addEventListener('keydown', palKeys)
5972
+ const list = h('div', { id: 'pal-list', class: 'pal-list', role: 'listbox', 'aria-label': t('pal.title') })
5973
+ pal.els = { input, list }
5974
+ setKids(dlg.el, [
5975
+ h('h2', { id: 'dlg-title', class: 'sr-only' }, t('pal.title')),
5976
+ h('div', { class: 'pal-head' }, icon('search', 'pal-ic'), input, h('kbd', { class: 'kbd-inline', 'aria-hidden': 'true' }, 'Esc')),
5977
+ list,
5978
+ h('div', { class: 'pal-foot muted small', 'aria-hidden': 'true' }, t('pal.keys')),
5979
+ ])
5980
+ drawPalette()
5981
+ input.focus()
5982
+ }
5983
+ // The title with the words the user typed marked; a match in the other language or a synonym is named under it.
5984
+ function palText(text, raw) {
5985
+ const q = raw ? catalogNorm(raw) : ''
5986
+ const i = q ? text.toLowerCase().indexOf(q) : -1
5987
+ if (i < 0) return [text]
5988
+ return [text.slice(0, i), h('mark', null, text.slice(i, i + q.length)), text.slice(i + q.length)].filter((x) => x !== '')
5989
+ }
5990
+ function palAlso(e, raw) {
5991
+ const q = raw ? catalogNorm(raw) : ''
5992
+ if (!q) return null
5993
+ const shown = e.title[lang] || e.title.en
5994
+ if (catalogNorm(shown).includes(q)) return null
5995
+ const w = [e.title.en, e.title.zh].concat(e.synonyms).find((x) => catalogNorm(x).includes(q))
5996
+ return w ? h('span', { class: 'pal-also' }, tx('pal.also', { w: h('mark', null, w) })) : null
5997
+ }
5998
+ function palRows() {
5999
+ const found = pal.found
6000
+ const ok = (e) => palAvailable(e, found)
6001
+ const byId = (id) => CATALOG.entries.find((e) => e.id === id)
6002
+ const q = pal.q.trim()
6003
+ if (!q) {
6004
+ const recent = palRecent().map(byId).filter((e) => e && ok(e))
6005
+ const common = CATALOG.common.map(byId).filter((e) => e && ok(e) && !recent.includes(e)).slice(0, 4)
6006
+ return { q, groups: [['recent', recent], ['common', common]].filter((g) => g[1].length), more: 0 }
6007
+ }
6008
+ const hits = searchCatalog(q, CATALOG.entries).map((x) => x.entry).filter(ok)
6009
+ const shown = pal.all ? hits : hits.slice(0, PAL_SHOWN)
6010
+ return { q, groups: shown.length ? [['results', shown]] : [], more: hits.length - shown.length }
6011
+ }
6012
+ function drawPalette() {
6013
+ if (!pal.els) return
6014
+ const r = palRows()
6015
+ const opts = []
6016
+ const kids = []
6017
+ const option = (cls, body, run, disabled) => {
6018
+ const i = opts.length
6019
+ const el = h('div', { class: 'pal-opt ' + cls, role: 'option', id: 'pal-opt-' + i, 'aria-selected': 'false', 'aria-disabled': disabled ? 'true' : null })
6020
+ setKids(el, body)
6021
+ el.addEventListener('mousemove', () => { if (pal.sel !== i) { pal.sel = i; palMark() } })
6022
+ el.addEventListener('click', () => { if (!disabled) run() })
6023
+ opts.push({ el, run, disabled })
6024
+ return el
6025
+ }
6026
+ for (const [g, list] of r.groups) {
6027
+ kids.push(h('div', { class: 'pal-group', role: 'presentation' }, t('pal.' + g)))
6028
+ for (const e of list) {
6029
+ const why = palWhyOff(e)
6030
+ kids.push(option('', [
6031
+ h('span', { class: 'pal-kind' }, t('pal.kind.' + e.kind) === 'pal.kind.' + e.kind ? e.kind : t('pal.kind.' + e.kind)),
6032
+ h('span', { class: 'pal-main' }, h('span', { class: 'pal-title' }, palText(e.title[lang] || e.title.en, r.q)), palAlso(e, r.q)),
6033
+ h('span', { class: 'pal-where' }, why || e.panel[lang] || e.panel.en),
6034
+ ], () => palGo(e), Boolean(why)))
6035
+ }
6036
+ }
6037
+ if (r.more > 0) kids.push(option('pal-more', [h('span', { class: 'pal-main' }, tn('pal.more', r.more))], () => { pal.all = true; drawPalette(); pal.els.input.focus() }))
6038
+ if (r.q && !r.groups.length) kids.push(h('p', { class: 'pal-none muted' }, t('pal.none')))
6039
+ if (r.q) {
6040
+ kids.push(option('pal-hist', [icon('search', 'pal-ic'), h('span', { class: 'pal-main' }, h('span', { class: 'pal-title' }, t('pal.history', { q: r.q }))), h('span', { class: 'pal-where' }, t('pal.historyHint'))], () => palHistory(r.q)))
6041
+ if (!r.groups.length && !BOOT.readOnly && PALETTE_ACTIONS.ask.ok())
6042
+ kids.push(option('pal-ai', [icon('bot', 'pal-ic'), h('span', { class: 'pal-main' }, h('span', { class: 'pal-title' }, t('pal.askAi', { q: r.q })))], () => openAsk({ text: t('pal.askText', { q: r.q }) })))
6043
+ }
6044
+ pal.opts = opts
6045
+ if (pal.sel >= opts.length) pal.sel = Math.max(0, opts.length - 1)
6046
+ pal.els.list.replaceChildren(...kids)
6047
+ palMark()
6048
+ }
6049
+ function palMark() {
6050
+ pal.opts.forEach((o, i) => o.el.setAttribute('aria-selected', String(i === pal.sel)))
6051
+ const cur = pal.opts[pal.sel]
6052
+ if (cur) { pal.els.input.setAttribute('aria-activedescendant', cur.el.id); cur.el.scrollIntoView({ block: 'nearest' }) }
6053
+ else pal.els.input.removeAttribute('aria-activedescendant')
6054
+ }
6055
+ function palKeys(e) {
6056
+ const n = pal.opts.length
6057
+ if (e.key === 'ArrowDown' && n) { e.preventDefault(); pal.sel = (pal.sel + 1) % n; palMark() }
6058
+ else if (e.key === 'ArrowUp' && n) { e.preventDefault(); pal.sel = (pal.sel - 1 + n) % n; palMark() }
6059
+ else if (e.key === 'Home' && n && !pal.q) { e.preventDefault(); pal.sel = 0; palMark() }
6060
+ else if (e.key === 'End' && n && !pal.q) { e.preventDefault(); pal.sel = n - 1; palMark() }
6061
+ else if (e.key === 'Enter') {
6062
+ e.preventDefault()
6063
+ const cur = pal.opts[pal.sel]
6064
+ if (cur && !cur.disabled) cur.run()
6065
+ } else if (e.key === 'Escape') {
6066
+ // Escape first empties the box, as the account search does; a second one closes.
6067
+ if (pal.q) { e.preventDefault(); pal.els.input.value = ''; pal.q = ''; pal.sel = 0; drawPalette() }
6068
+ }
6069
+ }
6070
+ function palClose() { pal.els = null; if (dlg.kind === 'palette') dlg.el.close() }
6071
+ // Lights a row up once it is in view, so the eye finds it; none under reduced motion.
6072
+ function palFlash(el) {
6073
+ if (REDUCED || !el) return
6074
+ el.classList.remove('find-flash')
6075
+ void el.offsetWidth
6076
+ el.classList.add('find-flash')
6077
+ setTimeout(() => el.classList.remove('find-flash'), 1300)
6078
+ }
6079
+ function palReveal(root, id) {
6080
+ const el = root && root.querySelector('[data-find="' + id + '"]')
6081
+ if (!el) return
6082
+ el.scrollIntoView({ block: 'nearest', behavior: REDUCED ? 'auto' : 'smooth' })
6083
+ const f = el.matches('button, input, select') ? el : el.querySelector('button[aria-pressed="true"]:not(:disabled), button:not(:disabled), input:not(:disabled), select:not(:disabled)')
6084
+ if (f) f.focus({ preventScroll: true })
6085
+ palFlash(el)
6086
+ }
6087
+ function palGo(e) {
6088
+ palRemember(e.id)
6089
+ const g = e.target
6090
+ pal.els = null
6091
+ if (g.page) { palClose(); setPage(g.page); window.scrollTo({ top: 0, behavior: REDUCED ? 'auto' : 'smooth' }); return }
6092
+ if (g.settings) {
6093
+ // The settings dialog takes the same dialog element, so it opens in place of the palette.
6094
+ openSettingsDialog(g.settings)
6095
+ requestAnimationFrame(() => palReveal(dlg.el, g.find))
6096
+ return
6097
+ }
6098
+ if (g.display) {
6099
+ palClose()
6100
+ setPage('accounts')
6101
+ requestAnimationFrame(() => {
6102
+ const b = document.querySelector('#toolbar .tb-display')
6103
+ if (!b) return
6104
+ if (menu.anchor !== b) b.click()
6105
+ palReveal(menu.el, g.display)
6106
+ })
6107
+ return
6108
+ }
6109
+ const a = PALETTE_ACTIONS[g.action]
6110
+ if (a.nav) palClose()
6111
+ a.run()
6112
+ // An action that opened nothing (such as a task handed to the Portal) leaves no palette behind.
6113
+ if (dlg.kind === 'palette') palClose()
6114
+ }
6115
+ // The words go to Session History's search box, which reads them as it does typed ones.
6116
+ function palHistory(q) {
6117
+ palClose()
6118
+ hs.q = q.trim()
6119
+ hs.mode = 'history'
6120
+ sp.drawn = ''
6121
+ if (hs.els) hs.els.q.value = hs.q
6122
+ if (hs.data || hs.error) historyChanged(false)
6123
+ else saveHistFilters()
6124
+ setPage('sessions')
6125
+ }
6126
+
5893
6127
  // ---------- start at login (spec §3.29, ADR-0029) and the Menu Bar Item (spec §3.31, ADR-0034) ----------
5894
6128
  // Each switch reads its state when the settings open; moving it shows the file and what will run, and only the
5895
6129
  // confirmation writes. A read-only Panel shows the state only. mb.* words override as.* for the menu bar.
@@ -6213,7 +6447,7 @@ const MAIN = String.raw `
6213
6447
  return Boolean(u && u.skillUpdate && u.skillUpdate.installed && u.skillUpdate.installed.length)
6214
6448
  }
6215
6449
  // Example phrases: a click puts one in the Let AI do it box (spec §3.28).
6216
- const AI_ASKS = ['ai.ask.quota', 'ai.ask.pick', 'ai.ask.new', 'ai.ask.api', 'ai.ask.pin', 'ai.ask.hide', 'ai.ask.relogin', 'ai.ask.fix', 'ai.ask.handoff', 'ai.ask.handoffRules', 'ai.ask.session', 'ai.ask.history', 'ai.ask.send', 'ai.ask.inbound', 'ai.ask.menubar', 'ai.ask.rc', 'ai.ask.network', 'ai.ask.theme', 'ai.ask.tool']
6450
+ const AI_ASKS = ['ai.ask.quota', 'ai.ask.pick', 'ai.ask.new', 'ai.ask.api', 'ai.ask.pin', 'ai.ask.hide', 'ai.ask.relogin', 'ai.ask.fix', 'ai.ask.handoff', 'ai.ask.handoffRules', 'ai.ask.session', 'ai.ask.history', 'ai.ask.send', 'ai.ask.inbound', 'ai.ask.menubar', 'ai.ask.rc', 'ai.ask.network', 'ai.ask.theme', 'ai.ask.find', 'ai.ask.tool']
6217
6451
  // Network Guard (spec §3.35): one dialog with the switch, the allowed countries and the newest result per address.
6218
6452
  // Countries are never ticked for the user, the current one included: a wrong network would allow itself.
6219
6453
  const NET_COMMON = ['US', 'JP', 'SG', 'GB', 'DE', 'FR', 'NL', 'CA', 'AU', 'KR', 'TW', 'HK']
@@ -7749,6 +7983,14 @@ const MAIN = String.raw `
7749
7983
  $('ver-top').addEventListener('click', () => openVerPop($('ver-top')))
7750
7984
  $('refresh').addEventListener('click', refreshAll)
7751
7985
  $('ask-ai').addEventListener('click', () => openAsk())
7986
+ $('search-btn').addEventListener('click', () => openPalette())
7987
+ // Cmd/Ctrl+K opens the Command Palette from anywhere and closes it again; / and Cmd/Ctrl+F stay on the account search.
7988
+ document.addEventListener('keydown', (e) => {
7989
+ if (!(e.metaKey || e.ctrlKey) || e.altKey || e.shiftKey || (e.key !== 'k' && e.key !== 'K')) return
7990
+ if (dlg.el && dlg.el.open) { if (dlg.kind === 'palette') { e.preventDefault(); palClose() } return }
7991
+ e.preventDefault()
7992
+ openPalette()
7993
+ })
7752
7994
  // In a Portal that offers AI Tasks itself the Portal has the button; opened on its own, the Panel keeps it.
7753
7995
  $('ask-ai').hidden = askBridged(BOOT, window)
7754
7996
  $('accounts').addEventListener('dragover', onDragOver)
@@ -1294,6 +1294,33 @@ select:is(:hover, :focus) { --chevron: var(--text); }
1294
1294
  .hide-btn .ic { width: 16px; height: 16px; }
1295
1295
  .hide-btn.is-on { color: var(--muted); }
1296
1296
  .hide-btn:disabled { opacity: .4; cursor: not-allowed; }
1297
+
1298
+ /* Command Palette (spec §3.36): a search box over one list; the dialog keeps its top edge while the list changes. */
1299
+ .kbd-inline { font: 11px/16px var(--mono); color: var(--muted); border: 1px solid var(--border); border-radius: 4px; padding: 0 5px; margin-left: 2px; }
1300
+ .dialog.dialog-pal { width: min(620px, calc(100vw - 24px)); flex-direction: column; }
1301
+ .pal-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
1302
+ .pal-ic { flex: none; color: var(--muted); }
1303
+ .dialog .pal-input, .dialog .pal-input:focus, .dialog .pal-input:focus-visible { flex: 1; min-width: 0; height: 32px; padding: 0; border: 0; box-shadow: none; outline: none; background: none; color: var(--text); font: inherit; font-size: var(--large); outline: none; }
1304
+ .pal-input::-webkit-search-cancel-button { display: none; }
1305
+ .pal-list { overflow-y: auto; overscroll-behavior: contain; padding: 6px; display: flex; flex-direction: column; gap: 1px; max-height: min(56vh, 460px); }
1306
+ .pal-group { padding: 8px 10px 4px; font-size: 11px; font-weight: 600; color: var(--muted); }
1307
+ .pal-opt { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 5px 10px; border-radius: calc(var(--ctl-radius) - 2px); color: var(--text); cursor: pointer; transition: background-color .12s ease; }
1308
+ .pal-opt[aria-selected=true] { background: var(--hover); }
1309
+ .pal-opt[aria-disabled=true] { color: var(--faint); cursor: not-allowed; }
1310
+ .pal-kind { flex: none; min-width: 52px; font-size: 11px; line-height: 18px; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 0 7px; text-align: center; }
1311
+ .pal-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
1312
+ .pal-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
1313
+ .pal-also { font-size: 11px; color: var(--muted); }
1314
+ .pal-where { flex: none; max-width: 42%; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
1315
+ .pal-opt mark { background: var(--accent-soft); color: inherit; border-radius: 2px; padding: 0 1px; }
1316
+ .pal-more .pal-main, .pal-hist .pal-title, .pal-ai .pal-title { color: var(--accent); }
1317
+ .pal-hist { margin-top: 4px; }
1318
+ .pal-none { padding: 14px 10px 4px; margin: 0; }
1319
+ .pal-foot { padding: 8px 16px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
1320
+ [data-width=narrow] .pal-where, [data-width=narrow] .pal-foot { display: none; }
1321
+ .find-flash { animation: find-flash 1.2s ease-out; border-radius: var(--ctl-radius); }
1322
+ @keyframes find-flash { 0%, 35% { box-shadow: 0 0 0 6px var(--accent-soft); background: var(--accent-soft); } to { box-shadow: 0 0 0 6px transparent; background: transparent; } }
1323
+ @media (prefers-reduced-motion: reduce) { .find-flash { animation: none; } .pal-opt { transition: none; } }
1297
1324
  @media (prefers-reduced-motion: reduce) {
1298
1325
  .sk, .spin, .hidden-bar, .is-spinning svg, .toast, .toast.bump, .toast.toast-out, .view-in > *, .set-pane.view-in, .row.flash, .sess-row.flash, .sess-msg, .seg-badge, .card.flash, .pulse, .sess-busy .sess-dot, .menu, .menu.float-out, .dialog[open], .dialog[open]::backdrop, .enter, .fade-in, .hist-list.swap-in, .tip-body, .tip-float, .row-run.is-done .ic, .tab[aria-selected=true]::after { animation: none; }
1299
1326
  .bar > span, .chev, .row, .sess-row, .sess-copy, .hist-row, .hist-cont, .hist-proj, .hist-catbody, .hist-opt, .hist-list, .icon-btn, .seg-btn, .menu-item, .set-tab, .link-btn, .tag-btn, .email-btn, .btn, .chip-btn, .set-link .ic, .dialog, .dialog[open], .dialog::backdrop, .tab, .tab::before, .tab .ic, .hp-status { transition: none; }
@@ -5,6 +5,7 @@ import { createHash } from 'node:crypto';
5
5
  import { FAVICON_SVG, MARK_SVG } from '../core/brand-mark.js';
6
6
  import { ALIAS_NAME, RESERVED_ALIASES } from '../core/config.js';
7
7
  import { QUOTA_FAIL_PERCENT, QUOTA_WARN_PERCENT, USAGE_DAYS } from '../core/quota-levels.js';
8
+ import { COMMON_ENTRIES, SEARCH_CATALOG } from '../core/search-catalog.js';
8
9
  import { REPO_URL, SKILL_INSTALL } from '../core/skill-check.js';
9
10
  import { MESSAGES } from './i18n.js';
10
11
  import { widthTier } from './page-logic.js';
@@ -90,6 +91,7 @@ export function renderPage(opts) {
90
91
  </div>
91
92
  <div class="top-actions">
92
93
  <button id="update" class="btn update-btn" type="button" hidden></button>
94
+ <button id="search-btn" class="btn" type="button" aria-haspopup="dialog" aria-label="Search"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M11 18a7 7 0 1 0 0-14 7 7 0 0 0 0 14zM20 20l-4.2-4.2"/></svg><span class="hide-sm" data-i18n="pal.button">Search</span><kbd id="search-kbd" class="kbd-inline hide-sm" aria-hidden="true"></kbd></button>
93
95
  <button id="ask-ai" class="btn" type="button" aria-haspopup="dialog" aria-label="Let AI do it"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M6 9h12a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-6a2 2 0 0 1 2-2zM12 5v4M9.5 13.5v1M14.5 13.5v1"/></svg><span class="hide-sm" data-i18n="ask.button">Let AI do it</span></button>
94
96
  <a id="repo" class="icon-btn repo-link" target="_blank" rel="noopener noreferrer" aria-label="sideby on GitHub" title="sideby on GitHub" hidden><svg viewBox="0 0 24 24" aria-hidden="true"><path d="${GITHUB_MARK}"/></svg></a>
95
97
  <button id="settings" class="btn" type="button" aria-haspopup="dialog" aria-expanded="false"${lang === 'auto' ? '' : ' hidden'}><span data-i18n="set.button">Settings</span></button>
@@ -118,6 +120,7 @@ export function renderPage(opts) {
118
120
  <div id="conn" class="conn" role="status" hidden></div>
119
121
  <div id="toasts" class="toasts" aria-live="polite" popover="manual"></div>
120
122
  <script type="application/json" id="sideby-boot">${boot}</script>
123
+ <script type="application/json" id="sideby-catalog">${jsonForScript({ entries: SEARCH_CATALOG, common: COMMON_ENTRIES })}</script>
121
124
  <script type="application/json" id="sideby-i18n">${jsonForScript(MESSAGES)}</script>
122
125
  <script${nonce}>${PAGE_SCRIPT}</script>
123
126
  </body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sideby",
3
- "version": "0.26.1",
3
+ "version": "0.27.0",
4
4
  "description": "Run work, personal and API-key accounts at the same time, without their configs drifting apart.",
5
5
  "license": "MIT",
6
6
  "author": "Adonis0123 (https://github.com/Adonis0123)",
@@ -0,0 +1,117 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "sideby/commands.json",
4
+ "type": "object",
5
+ "required": [
6
+ "schemaVersion",
7
+ "results"
8
+ ],
9
+ "properties": {
10
+ "schemaVersion": {
11
+ "type": "number",
12
+ "const": 1
13
+ },
14
+ "results": {
15
+ "type": "array",
16
+ "items": {
17
+ "type": "object",
18
+ "required": [
19
+ "id",
20
+ "kind",
21
+ "title",
22
+ "panel",
23
+ "cliCommand"
24
+ ],
25
+ "properties": {
26
+ "id": {
27
+ "type": "string"
28
+ },
29
+ "kind": {
30
+ "type": "string",
31
+ "description": "'page', 'setting' or 'action'; an open set, so tolerate others."
32
+ },
33
+ "title": {
34
+ "type": "string"
35
+ },
36
+ "panel": {
37
+ "type": "string",
38
+ "description": "Where it lives in the Panel, such as \"Settings → General → Language\"."
39
+ },
40
+ "cliCommand": {
41
+ "anyOf": [
42
+ {
43
+ "type": "string"
44
+ },
45
+ {
46
+ "type": "null"
47
+ }
48
+ ]
49
+ }
50
+ }
51
+ }
52
+ },
53
+ "_notice": {
54
+ "type": "object",
55
+ "properties": {
56
+ "update": {
57
+ "type": "object",
58
+ "required": [
59
+ "current",
60
+ "latest",
61
+ "command",
62
+ "message"
63
+ ],
64
+ "properties": {
65
+ "current": {
66
+ "type": "string"
67
+ },
68
+ "latest": {
69
+ "type": "string"
70
+ },
71
+ "command": {
72
+ "type": "string",
73
+ "description": "Run it after the user agrees: it shows the plan and exits 10; then --yes."
74
+ },
75
+ "message": {
76
+ "type": "string"
77
+ }
78
+ }
79
+ },
80
+ "skill": {
81
+ "type": "object",
82
+ "required": [
83
+ "installed",
84
+ "current",
85
+ "command",
86
+ "message"
87
+ ],
88
+ "properties": {
89
+ "installed": {
90
+ "anyOf": [
91
+ {
92
+ "type": "string"
93
+ },
94
+ {
95
+ "type": "null"
96
+ }
97
+ ],
98
+ "description": "The skill's version; null when it has none."
99
+ },
100
+ "current": {
101
+ "type": "string"
102
+ },
103
+ "command": {
104
+ "type": "string",
105
+ "description": "`sideby update`, which updates the skill with sideby: run it after the user agrees; it shows the plan and exits 10, then --yes."
106
+ },
107
+ "message": {
108
+ "type": "string"
109
+ }
110
+ }
111
+ }
112
+ },
113
+ "description": "Not the answer to the task: mention it briefly afterwards and offer to update."
114
+ }
115
+ },
116
+ "title": "sideby commands --json"
117
+ }
@@ -2,7 +2,7 @@
2
2
  name: sideby
3
3
  description: Use when the user runs, or wants to run, several AI coding accounts (Claude Code, Codex, Grok Build, pi) side by side. Covers installing sideby and setting up a new account ("install sideby", "set up another Claude account", "add cc008", "配置一个 cc00x", "再加一个 Codex 账号"), explaining what accounts share and what stays separate ("what do my accounts share?", "这些账号共享了什么"), showing which account a session is ("show [cc001] in the status line", "加上账号标识"), finding a past session of any account ("找一下我上周改登录页的那个会话"), seeing accounts, quota and usage, moving on when one hits its 5-hour or weekly limit, moving the current task to another account ("用 cc008 继续", "交回 cc008"), adding a short command (alias) or a pick command that starts whichever account has the most quota ("加个 cc"), adding an API account from a vendor's docs ("加一个 DeepSeek API 账号"), supporting a new tool, and repairing drifted account directories (skills, hooks, rules or settings not shared, wrong symlinks, credential file permissions). Drives the `sideby` CLI with `--json`; the agent does every step except browser sign-in, filling in secrets and starting interactive sessions, which it hands to the user as one command (inside an Auto Handoff session, `sideby handoff ready --to` moves the task itself).
4
4
  metadata:
5
- version: "0.26.1"
5
+ version: "0.27.0"
6
6
  requires:
7
7
  bins: [sideby, node]
8
8
  cliHelp: sideby --help
@@ -41,6 +41,7 @@ Account refs are `<family>:<name>`; a bare `<name>` works only when it is unique
41
41
  | Install sideby, or set up a new account ("add cc008") | `sideby --version`, `sideby list --json`, `sideby new <family> --next --json` | `references/setup.md` |
42
42
  | Show which account a session is (`[cc001]` in the status line or tab title) | `sideby list --json` for the labels | `references/badge.md` |
43
43
  | Find which session an account is running now ("cc002 现在在干嘛", "which session is cc002 running", "哪个会话在等我"), or copy one for another AI ("复制 cc002 的会话 id", "copy cc002's session for another AI", "把这个会话交给另一个 AI"); which Run (dispatched task) a session works for ("cc002 在哪个任务里", "which run is cc002 working on", "打开它的任务看板") | `sideby sessions [<account>\|<family>] --json`, `sideby sessions copy <account\|id> [--as reference\|id\|resume] --json`, `sideby sessions open-run <account\|id> --json` | `references/sessions.md` |
44
+ | Find where a setting, page or feature of sideby lives ("语言在哪改", "where is the dark mode setting", "远程控制在哪关") — not sessions: for those use `sideby history` | `sideby commands <words> --json` (English or Chinese words), then do it with the `cliCommand` it returns or tell the user the `panel` place | `references/panel.md` |
44
45
  | Find a session from before, in any account ("find a session I had before", "找一下我上周改登录页的那个会话", "sideby 项目最近的会话", "按日期分组看看"), read it, or continue it where it was | `sideby history [<words>...] [--project <name>] [--since today\|7d\|30d] [--group project\|day\|category] --json`, `sideby history show <id> --json`, `sideby history projects --json`; `--tools` also searches tool output | `references/sessions.md` |
45
46
  | Tell another running session something, or send it a screenshot ("告诉 cc002 ……", "把这张截图发给 cc003", "send this to the codex session", "tell cc002 the tests pass"); see what was sent and whether it was read ("cc002 看到我的消息了吗"); let Claude sessions show such messages at once instead of waiting for approval ("消息老要我批准", "让 cc002 直接收消息") | `sideby send <account\|session> "<text>" [--image <path>]... --json`, `sideby messages [--to <account\|session>] --json`, `sideby messages inbound --json`, then `sideby messages inbound accept` (exits 10 with the change; rerun with `--yes` after they agree) | `references/sessions.md` |
46
47
  | See every session from inside Claude Code ("在这里看所有会话", "show my sessions in Claude Code"), or turn off the label line and `/sessions` pane sideby adds to Claude Code ("关掉 sideby 的横带", "turn off the sideby mod") | tell the user to type `/sessions`; `sideby config set claudeMod false --json` (or `true`) | `references/sessions.md` |
@@ -2,6 +2,16 @@
2
2
 
3
3
  Use these commands for the same persistent settings as the Panel. Prefer account refs from `sideby list --json`; commands taking an account also accept its short command. Every JSON response has `schemaVersion: 1`.
4
4
 
5
+ ## Find where something is
6
+
7
+ When the user asks where a setting or feature is ("语言在哪改", "where do I turn off Remote Control"), run
8
+ `sideby commands <words> --json`. It searches the same list as the Panel's Search (Cmd/Ctrl+K), in English or Chinese,
9
+ and returns `{ results: [{ id, kind, title, panel, cliCommand }] }`, best match first. `kind` is `page`, `setting` or
10
+ `action` (tolerate others). Offer to do it with `cliCommand` (keep its preview step; never add `--yes` before the user
11
+ agrees), or tell the user the `panel` place, such as `Settings → General → Language`. An empty `results` exits 0:
12
+ try other words. It finds features only; to find a past session use `sideby history <words> --json`
13
+ (`references/sessions.md`).
14
+
5
15
  ## Pinned Accounts and Display Order
6
16
 
7
17
  - `sideby order --json` returns `display` (saved `families`, `accounts`, `pinned`) and `families` in their effective order. Each family has `accounts` with `name`, `ref`, `pinned`; a family with no accounts has an empty array.