sideby 0.21.0 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/ai-tasks.json +14 -0
- package/dist/build.json +1 -1
- package/dist/src/cli/commands.d.ts +7 -0
- package/dist/src/cli/commands.js +441 -31
- package/dist/src/cli/format.js +3 -2
- package/dist/src/cli/json-schemas.js +157 -47
- package/dist/src/cli/main.js +38 -7
- package/dist/src/core/accounts.d.ts +6 -1
- package/dist/src/core/accounts.js +16 -3
- package/dist/src/core/ask.d.ts +2 -1
- package/dist/src/core/ask.js +12 -4
- package/dist/src/core/claude-settings-file.d.ts +57 -0
- package/dist/src/core/claude-settings-file.js +104 -2
- package/dist/src/core/config.d.ts +34 -16
- package/dist/src/core/config.js +58 -5
- package/dist/src/core/create.js +4 -1
- package/dist/src/core/desktop-app.js +5 -1
- package/dist/src/core/handoff-overview.d.ts +4 -1
- package/dist/src/core/handoff-overview.js +3 -2
- package/dist/src/core/handoff-rules.d.ts +34 -0
- package/dist/src/core/handoff-rules.js +115 -0
- package/dist/src/core/handoff-select.js +45 -28
- package/dist/src/core/handoff-status.d.ts +37 -7
- package/dist/src/core/handoff-status.js +95 -19
- package/dist/src/core/handoff.d.ts +4 -1
- package/dist/src/core/handoff.js +8 -5
- package/dist/src/core/inbound.d.ts +11 -3
- package/dist/src/core/inbound.js +26 -74
- package/dist/src/core/launch.js +6 -4
- package/dist/src/core/quota-levels.d.ts +13 -2
- package/dist/src/core/quota-levels.js +21 -3
- package/dist/src/core/remote-control.d.ts +10 -12
- package/dist/src/core/remote-control.js +29 -86
- package/dist/src/core/themes.d.ts +107 -0
- package/dist/src/core/themes.js +463 -0
- package/dist/src/core/tuning-apply.js +12 -20
- package/dist/src/families/agy/index.d.ts +8 -0
- package/dist/src/families/agy/index.js +53 -0
- package/dist/src/families/agy/quota.d.ts +9 -0
- package/dist/src/families/agy/quota.js +110 -0
- package/dist/src/families/index.js +7 -0
- package/dist/src/families/logos.d.ts +10 -0
- package/dist/src/families/logos.js +12 -1
- package/dist/src/menubar/script.js +26 -3
- package/dist/src/menubar/snapshot.d.ts +33 -6
- package/dist/src/menubar/snapshot.js +138 -43
- package/dist/src/menubar/strings.d.ts +18 -2
- package/dist/src/menubar/strings.js +18 -2
- package/dist/src/panel/handler.d.ts +4 -1
- package/dist/src/panel/handler.js +206 -46
- package/dist/src/panel/i18n.d.ts +106 -7
- package/dist/src/panel/i18n.js +260 -62
- package/dist/src/panel/page-logic.d.ts +67 -20
- package/dist/src/panel/page-logic.js +74 -7
- package/dist/src/panel/page-script.js +522 -124
- package/dist/src/panel/page-styles.d.ts +2 -0
- package/dist/src/panel/page-styles.js +157 -34
- package/dist/src/panel/page.js +3 -3
- package/dist/src/panel/theme.d.ts +6 -1
- package/dist/src/panel/theme.js +4 -0
- package/dist/src/panel/themes.d.ts +14 -0
- package/dist/src/panel/themes.js +162 -0
- package/dist/src/plugins/check.js +27 -13
- package/dist/src/plugins/loader.d.ts +11 -0
- package/dist/src/plugins/loader.js +47 -1
- package/dist/src/runtime.d.ts +9 -2
- package/dist/src/runtime.js +12 -5
- package/dist/src/types.d.ts +35 -5
- package/package.json +2 -2
- package/schemas/config.json +45 -2
- package/schemas/families.json +13 -5
- package/schemas/handoff-disable.json +22 -0
- package/schemas/handoff-enable.json +22 -0
- package/schemas/handoff-rules.json +302 -0
- package/schemas/handoff-status.json +26 -0
- package/schemas/hide.json +157 -0
- package/schemas/list.json +15 -0
- package/schemas/menubar-snapshot.json +309 -2
- package/schemas/order.json +26 -1
- package/schemas/pin.json +17 -0
- package/schemas/theme-check.json +140 -0
- package/schemas/theme-export.json +86 -0
- package/schemas/theme-import.json +92 -0
- package/schemas/theme-preview.json +86 -0
- package/schemas/theme-remove.json +87 -0
- package/schemas/theme-use.json +88 -0
- package/schemas/theme.json +137 -0
- package/schemas/unhide.json +157 -0
- package/schemas/unpin.json +17 -0
- package/skills/sideby/SKILL.md +5 -2
- package/skills/sideby/references/accounts.md +1 -0
- package/skills/sideby/references/ai-tasks.md +1 -1
- package/skills/sideby/references/handoff.md +7 -3
- package/skills/sideby/references/panel.md +9 -0
- package/skills/sideby/references/quota.md +3 -1
- package/skills/sideby/references/themes.md +47 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { HandoffSettings } from '../core/config.ts';
|
|
1
2
|
/** The parts of a PanelAccount the helpers read. */
|
|
2
3
|
export interface LogicAccount {
|
|
3
4
|
family: string;
|
|
@@ -60,6 +61,14 @@ export declare function windowState(w: {
|
|
|
60
61
|
passed: boolean;
|
|
61
62
|
level: string;
|
|
62
63
|
};
|
|
64
|
+
/**
|
|
65
|
+
* The window that binds first among those sharing one column (a model group with a 5-hour and a weekly limit, as
|
|
66
|
+
* Antigravity CLI reports): the most used as the page draws it, the first on a tie. Undefined for none.
|
|
67
|
+
*/
|
|
68
|
+
export declare function bindingWindow<W extends {
|
|
69
|
+
usedPercent: number;
|
|
70
|
+
resetsAt: string;
|
|
71
|
+
}>(list: W[], now: number, warn: number, fail: number): W | undefined;
|
|
63
72
|
/**
|
|
64
73
|
* A window whose reset time has passed: the numbers on record are from before the reset and nothing newer came
|
|
65
74
|
* in. `since` is when they were last seen (the Quota's observation time, or the reset itself when that is
|
|
@@ -81,6 +90,11 @@ export declare function attentionReasons(a: LogicAccount, health: {
|
|
|
81
90
|
fail: number;
|
|
82
91
|
warn: number;
|
|
83
92
|
} | null, now: number, warn: number): string[];
|
|
93
|
+
/**
|
|
94
|
+
* How serious an Account's `quota-high` is: `fail` once its fullest live window reaches `fail` (the bar turns red),
|
|
95
|
+
* else `warn`, so a running-low label takes the same color as the bar it speaks about.
|
|
96
|
+
*/
|
|
97
|
+
export declare function quotaHighLevel(a: LogicAccount, now: number, fail: number): 'warn' | 'fail';
|
|
84
98
|
/**
|
|
85
99
|
* The one status badge an account row shows after its name (spec §3.27), most important first: `health-fail`
|
|
86
100
|
* (needs fixing), `quota-high` (running low), the other attention labels (`signed-out`, `not-installed`,
|
|
@@ -132,6 +146,18 @@ export declare function pinnedIn(a: {
|
|
|
132
146
|
name: string;
|
|
133
147
|
sameLogin?: readonly string[];
|
|
134
148
|
}, pinned: readonly string[]): boolean;
|
|
149
|
+
/**
|
|
150
|
+
* Whether an Account is Hidden (spec §3.25): its Family is in `hiddenFamilies`, or its name is in `hidden.<family>`,
|
|
151
|
+
* or, for a Same Login, the name of any of its directories, so the login is hidden as a whole.
|
|
152
|
+
*/
|
|
153
|
+
export declare function hiddenIn(a: {
|
|
154
|
+
family: string;
|
|
155
|
+
name: string;
|
|
156
|
+
sameLogin?: readonly string[];
|
|
157
|
+
}, display: {
|
|
158
|
+
hiddenFamilies?: readonly string[];
|
|
159
|
+
hidden?: Record<string, readonly string[]>;
|
|
160
|
+
}): boolean;
|
|
135
161
|
/**
|
|
136
162
|
* Pinned Accounts first (spec §3.25): the names in `pinned`, in that order, then the rest in the order they came.
|
|
137
163
|
* A Same Login follows any of its pinned directories, so it stays together. Names no longer there are simply not met.
|
|
@@ -434,18 +460,8 @@ export declare function handoffHintAccount(accounts: readonly LogicAccount[], se
|
|
|
434
460
|
ref: string;
|
|
435
461
|
pressure: number;
|
|
436
462
|
} | null;
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
sameFamily: boolean;
|
|
440
|
-
prepareAt: number;
|
|
441
|
-
threshold: number;
|
|
442
|
-
waitIfResetWithinMinutes: number;
|
|
443
|
-
countdownSeconds: number;
|
|
444
|
-
families: Record<string, {
|
|
445
|
-
policy: string;
|
|
446
|
-
order: string[];
|
|
447
|
-
}>;
|
|
448
|
-
}
|
|
463
|
+
/** The settings `/api/handoff/*` sends, as `sideby handoff --json` prints them. */
|
|
464
|
+
export type HandoffSettingsView = HandoffSettings;
|
|
449
465
|
export interface HandoffForm {
|
|
450
466
|
auto: boolean;
|
|
451
467
|
sameFamily: boolean;
|
|
@@ -457,6 +473,8 @@ export interface HandoffForm {
|
|
|
457
473
|
policy: string;
|
|
458
474
|
order: string[];
|
|
459
475
|
}>;
|
|
476
|
+
/** Left out: unchanged. */
|
|
477
|
+
crossOrganization?: string[];
|
|
460
478
|
}
|
|
461
479
|
/** What the Panel's Auto Handoff form changed, as the `change` /api/handoff/configure takes; {} when nothing. */
|
|
462
480
|
export declare function handoffChangeOf(s: HandoffSettingsView, f: HandoffForm): Record<string, unknown>;
|
|
@@ -469,13 +487,6 @@ export declare function remoteControlSummary(groups: readonly {
|
|
|
469
487
|
accounts: readonly string[];
|
|
470
488
|
state: string;
|
|
471
489
|
}[], apiRefs: readonly string[]): 'on' | 'default' | 'off' | null;
|
|
472
|
-
/**
|
|
473
|
-
* The groups that turning Remote Control `to` on or off changes (spec §3.22): those that do not hold it yet, a
|
|
474
|
-
* default counting as either. A file that is missing or cannot be read is never changed.
|
|
475
|
-
*/
|
|
476
|
-
export declare function remoteControlTodo<G extends {
|
|
477
|
-
state: string;
|
|
478
|
-
}>(groups: readonly G[], to: 'on' | 'off'): G[];
|
|
479
490
|
/**
|
|
480
491
|
* Where a menu or popover goes next to its anchor, all in viewport pixels. It opens below when its whole height fits
|
|
481
492
|
* there, else above when it fits there, else on the side with more room, its height capped at that room so it scrolls
|
|
@@ -517,7 +528,7 @@ export declare function stripSecrets(text: string): {
|
|
|
517
528
|
removed: boolean;
|
|
518
529
|
};
|
|
519
530
|
/** The kinds of AI Task (spec §3.28); anything else is refused. */
|
|
520
|
-
export declare const AI_TASK_KINDS: readonly ['free', 'fix', 'quota', 'account', 'host', 'plugin', 'terminal', 'handoff', 'menubar', 'hotkey'];
|
|
531
|
+
export declare const AI_TASK_KINDS: readonly ['free', 'fix', 'quota', 'account', 'host', 'plugin', 'terminal', 'theme', 'handoff', 'menubar', 'hotkey'];
|
|
521
532
|
export type AiTaskKind = (typeof AI_TASK_KINDS)[number];
|
|
522
533
|
/**
|
|
523
534
|
* The message keys of the AI dialog for `task` (spec §3.28 "每个入口的提示"): its title, the text box placeholder and
|
|
@@ -597,6 +608,8 @@ export declare function taskPrompt(input: {
|
|
|
597
608
|
version?: string;
|
|
598
609
|
/** The custom terminal command saved now (`terminal` task). */
|
|
599
610
|
terminalCustom?: string;
|
|
611
|
+
/** The Theme in use, for `theme`. */
|
|
612
|
+
theme?: string;
|
|
600
613
|
/** Names of the supported terminals installed on this computer (`terminal` task). */
|
|
601
614
|
terminals?: readonly string[];
|
|
602
615
|
/** Auto Handoff facts, one per line, as `handoffTaskFacts` gives them (`handoff` task). */
|
|
@@ -852,3 +865,37 @@ export type HistFilters = {
|
|
|
852
865
|
};
|
|
853
866
|
/** The History filters saved before a reload, each dropped back to its default when it is missing or malformed. */
|
|
854
867
|
export declare function histFilters(raw: unknown): HistFilters;
|
|
868
|
+
/**
|
|
869
|
+
* Saves one Auto Handoff change from the Handoff page (spec §3.17 "接力规则"): every change applies at once, and
|
|
870
|
+
* the toast offers the undo the server read from the config as it was. Undoing offers no undo of its own.
|
|
871
|
+
*/
|
|
872
|
+
export declare function saveHandoffChange(post: (path: string, body: object) => Promise<{
|
|
873
|
+
undo?: Record<string, unknown>;
|
|
874
|
+
}>, change: Record<string, unknown>, opts?: {
|
|
875
|
+
noUndo?: boolean;
|
|
876
|
+
}): Promise<{
|
|
877
|
+
undo: Record<string, unknown> | null;
|
|
878
|
+
}>;
|
|
879
|
+
/**
|
|
880
|
+
* What the Handoff page shows after confirming the plan that turns Auto Handoff on (ADR-0013): the plan again when
|
|
881
|
+
* it changed since it was shown (unless nothing is left to do) or is blocked, the first step that failed, or done.
|
|
882
|
+
*/
|
|
883
|
+
export declare function enableOutcome<P extends {
|
|
884
|
+
alreadyOn?: boolean;
|
|
885
|
+
blocked?: unknown;
|
|
886
|
+
}, S extends {
|
|
887
|
+
ok: boolean;
|
|
888
|
+
}>(r: {
|
|
889
|
+
changed?: boolean;
|
|
890
|
+
plan: P;
|
|
891
|
+
results: S[];
|
|
892
|
+
}): {
|
|
893
|
+
kind: 'changed' | 'blocked';
|
|
894
|
+
plan: P;
|
|
895
|
+
} | {
|
|
896
|
+
kind: 'failed';
|
|
897
|
+
step: S;
|
|
898
|
+
plan: P;
|
|
899
|
+
} | {
|
|
900
|
+
kind: 'done';
|
|
901
|
+
};
|
|
@@ -27,6 +27,17 @@ export function windowState(w, now, warn, fail) {
|
|
|
27
27
|
const level = passed ? 'reset' : pct >= fail ? 'fail' : pct >= warn ? 'warn' : 'ok';
|
|
28
28
|
return { pct, passed, level };
|
|
29
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* The window that binds first among those sharing one column (a model group with a 5-hour and a weekly limit, as
|
|
32
|
+
* Antigravity CLI reports): the most used as the page draws it, the first on a tie. Undefined for none.
|
|
33
|
+
*/
|
|
34
|
+
export function bindingWindow(list, now, warn, fail) {
|
|
35
|
+
let best;
|
|
36
|
+
for (const w of list)
|
|
37
|
+
if (!best || windowState(w, now, warn, fail).pct > windowState(best, now, warn, fail).pct)
|
|
38
|
+
best = w;
|
|
39
|
+
return best;
|
|
40
|
+
}
|
|
30
41
|
/**
|
|
31
42
|
* A window whose reset time has passed: the numbers on record are from before the reset and nothing newer came
|
|
32
43
|
* in. `since` is when they were last seen (the Quota's observation time, or the reset itself when that is
|
|
@@ -87,6 +98,25 @@ export function attentionReasons(a, health, now, warn) {
|
|
|
87
98
|
out.push('health-warn');
|
|
88
99
|
return out;
|
|
89
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* How serious an Account's `quota-high` is: `fail` once its fullest live window reaches `fail` (the bar turns red),
|
|
103
|
+
* else `warn`, so a running-low label takes the same color as the bar it speaks about.
|
|
104
|
+
*/
|
|
105
|
+
export function quotaHighLevel(a, now, fail) {
|
|
106
|
+
const q = a.quota;
|
|
107
|
+
if (!q || q.status !== 'ok' || !q.windows || q.from)
|
|
108
|
+
return 'warn';
|
|
109
|
+
for (const w of q.windows) {
|
|
110
|
+
if (w.name)
|
|
111
|
+
continue;
|
|
112
|
+
const reset = Date.parse(w.resetsAt);
|
|
113
|
+
if (Number.isFinite(reset) && reset <= now)
|
|
114
|
+
continue;
|
|
115
|
+
if ((Number(w.usedPercent) || 0) >= fail)
|
|
116
|
+
return 'fail';
|
|
117
|
+
}
|
|
118
|
+
return 'warn';
|
|
119
|
+
}
|
|
90
120
|
/**
|
|
91
121
|
* The one status badge an account row shows after its name (spec §3.27), most important first: `health-fail`
|
|
92
122
|
* (needs fixing), `quota-high` (running low), the other attention labels (`signed-out`, `not-installed`,
|
|
@@ -217,6 +247,16 @@ export function sortAccounts(list, mode, now, order) {
|
|
|
217
247
|
export function pinnedIn(a, pinned) {
|
|
218
248
|
return (pinned.includes(a.name) || (a.sameLogin ?? []).some((r) => pinned.includes(r.slice(r.indexOf(':') + 1))));
|
|
219
249
|
}
|
|
250
|
+
/**
|
|
251
|
+
* Whether an Account is Hidden (spec §3.25): its Family is in `hiddenFamilies`, or its name is in `hidden.<family>`,
|
|
252
|
+
* or, for a Same Login, the name of any of its directories, so the login is hidden as a whole.
|
|
253
|
+
*/
|
|
254
|
+
export function hiddenIn(a, display) {
|
|
255
|
+
if (display.hiddenFamilies?.includes(a.family))
|
|
256
|
+
return true;
|
|
257
|
+
const names = display.hidden?.[a.family] ?? [];
|
|
258
|
+
return (names.includes(a.name) || (a.sameLogin ?? []).some((r) => names.includes(r.slice(r.indexOf(':') + 1))));
|
|
259
|
+
}
|
|
220
260
|
/**
|
|
221
261
|
* Pinned Accounts first (spec §3.25): the names in `pinned`, in that order, then the rest in the order they came.
|
|
222
262
|
* A Same Login follows any of its pinned directories, so it stays together. Names no longer there are simply not met.
|
|
@@ -820,6 +860,8 @@ export function handoffChangeOf(s, f) {
|
|
|
820
860
|
}
|
|
821
861
|
if (orders.length)
|
|
822
862
|
c.orders = orders;
|
|
863
|
+
if (f.crossOrganization && f.crossOrganization.join('\n') !== s.crossOrganization.join('\n'))
|
|
864
|
+
c.crossOrganization = f.crossOrganization.slice();
|
|
823
865
|
return c;
|
|
824
866
|
}
|
|
825
867
|
/**
|
|
@@ -837,13 +879,6 @@ export function remoteControlSummary(groups, apiRefs) {
|
|
|
837
879
|
return 'default';
|
|
838
880
|
return 'off';
|
|
839
881
|
}
|
|
840
|
-
/**
|
|
841
|
-
* The groups that turning Remote Control `to` on or off changes (spec §3.22): those that do not hold it yet, a
|
|
842
|
-
* default counting as either. A file that is missing or cannot be read is never changed.
|
|
843
|
-
*/
|
|
844
|
-
export function remoteControlTodo(groups, to) {
|
|
845
|
-
return groups.filter((g) => g.state === 'default' || g.state === (to === 'on' ? 'off' : 'on'));
|
|
846
|
-
}
|
|
847
882
|
/**
|
|
848
883
|
* Where a menu or popover goes next to its anchor, all in viewport pixels. It opens below when its whole height fits
|
|
849
884
|
* there, else above when it fits there, else on the side with more room, its height capped at that room so it scrolls
|
|
@@ -910,6 +945,7 @@ export const AI_TASK_KINDS = [
|
|
|
910
945
|
'host',
|
|
911
946
|
'plugin',
|
|
912
947
|
'terminal',
|
|
948
|
+
'theme',
|
|
913
949
|
'handoff',
|
|
914
950
|
'menubar',
|
|
915
951
|
'hotkey',
|
|
@@ -1012,6 +1048,7 @@ export function taskPrompt(input, strip) {
|
|
|
1012
1048
|
host: '帮我给 sideby 加一个它还不支持的 AI 编程工具(宿主),先做成本机的 Family 插件。',
|
|
1013
1049
|
plugin: '帮我写一个 sideby 插件或 hook。',
|
|
1014
1050
|
terminal: '帮我让 sideby 能在我用的终端里打开 AI 任务:写一条自定义终端命令。',
|
|
1051
|
+
theme: '帮我给 sideby 面板配一套颜色(主题)。',
|
|
1015
1052
|
handoff: '帮我调好 sideby 的自动接力:根据我的账号推荐什么时候接力(阈值)和接力的顺序。',
|
|
1016
1053
|
menubar: 'sideby 的状态栏额度图标在 macOS 顶栏里看不到,请帮我找出原因并让它显示出来。',
|
|
1017
1054
|
hotkey: '帮我给 sideby 的状态栏菜单挑一个单手按着顺手、又没被别的程序占用的快捷键,并替我设好。',
|
|
@@ -1024,6 +1061,7 @@ export function taskPrompt(input, strip) {
|
|
|
1024
1061
|
cFindings: '体检发现:',
|
|
1025
1062
|
cQuota: '额度原因:',
|
|
1026
1063
|
cVersion: 'sideby 版本:',
|
|
1064
|
+
cTheme: '现在的主题:',
|
|
1027
1065
|
cCustom: '现在的自定义终端命令:',
|
|
1028
1066
|
cTerminals: '本机装了的、sideby 支持的终端:',
|
|
1029
1067
|
cNoTerminals: '本机没找到 sideby 支持的终端',
|
|
@@ -1036,6 +1074,7 @@ export function taskPrompt(input, strip) {
|
|
|
1036
1074
|
pAccount: '地址、模型名、环境变量以厂商的官方文档为准。账号建好后,让我用 `sideby key <账号>` 输入密钥,再用 `sideby try <账号>` 试一次。订阅账号要登录时,让我点面板上的「登录」,或者自己运行 `sideby login <账号>`。',
|
|
1037
1075
|
pHost: '用 `sideby plugins new <id>` 生成插件骨架;收集事实时写明宿主的版本和日期;用 `sideby plugins check <id>` 检查,并在演示 HOME 里试一遍。',
|
|
1038
1076
|
pPlugin: '照 sideby 仓库的插件指南 docs/guide/plugins.zh-CN.md 写;写完用 `sideby plugins check <id>` 检查。',
|
|
1077
|
+
pTheme: '先跑 `sideby theme --json` 看现有主题和正在用的那套,再问我想要的感觉;我给了截图、网址或品牌色,就从里面取色。写一个主题文件(JSON,只放颜色,不放代码):`{"schemaVersion":1,"name":"…","base":"sky" 或 "leaf","accent":"#rrggbb","light":{…},"dark":{…}}`;多数时候给 `base` 和 `accent` 就够了,`light` / `dark` 只写要改的 token(`sideby theme export sky` 能看到全部 token)。先放在当前目录,跑 `sideby theme check <文件>`,有不达标的就按建议值改到全部通过;再跑 `sideby theme preview <文件>` 让我在面板里看一眼。我满意后才 `sideby theme import <文件>` 和 `sideby theme use <名字>`;不满意就接着改。随时可以用 `sideby theme use --undo` 换回去。',
|
|
1039
1078
|
pTerminal: "先问我用的是什么终端。只看这个终端的官方文档和它的 `--help`,找出「在指定目录新开一个窗口运行一条命令」的写法,写明你看的版本。写成一个模板:`{cmd}` 是要运行的命令,`{cwd}` 是文件夹,sideby 按参数填入,不经过 shell。保存要用 `sideby terminal --custom '<模板>'`,它会改 sideby 的设置,先问我。保存后让我在面板上点一次「让 AI 帮我」试一下,打不开就一起看错误再改。",
|
|
1040
1079
|
share: '做好之后,问我愿不愿意把这次的改进分享给 sideby。我同意后,按 sideby 仓库的 CONTRIBUTING.md 提一个 pull request,提交前去掉我自己的账号名、路径和邮箱。',
|
|
1041
1080
|
shareTerminal: '跑通之后,问我愿不愿意把这个终端做成 sideby 的内置终端。我同意后,在 sideby 仓库 src/core/terminal.ts 的终端表里加一行并补上测试,按 CONTRIBUTING.md 提一个 pull request,提交前去掉我自己的账号名、路径和邮箱。',
|
|
@@ -1054,6 +1093,7 @@ export function taskPrompt(input, strip) {
|
|
|
1054
1093
|
'account to sideby (a subscription, or an API address).',
|
|
1055
1094
|
host: 'Help me add an AI coding tool (Host) that sideby does not support yet, first as a local Family Plugin.',
|
|
1056
1095
|
plugin: 'Help me write a sideby plugin or hook.',
|
|
1096
|
+
theme: 'Help me pick a set of colors (a Theme) for the sideby Panel.',
|
|
1057
1097
|
terminal: 'Help sideby open AI Tasks in the terminal I use: write a custom terminal command.',
|
|
1058
1098
|
handoff: "Help me tune sideby's Auto Handoff: from my accounts, recommend when to hand over (the threshold) and in what order.",
|
|
1059
1099
|
menubar: "I can't see sideby's quota icon in the macOS menu bar. Find out why and make it show.",
|
|
@@ -1067,6 +1107,7 @@ export function taskPrompt(input, strip) {
|
|
|
1067
1107
|
cFindings: 'Health check findings:',
|
|
1068
1108
|
cQuota: 'Quota reason: ',
|
|
1069
1109
|
cVersion: 'sideby version: ',
|
|
1110
|
+
cTheme: 'Theme now: ',
|
|
1070
1111
|
cCustom: 'Custom terminal command now: ',
|
|
1071
1112
|
cTerminals: 'Supported terminals installed here: ',
|
|
1072
1113
|
cNoTerminals: 'No supported terminal is installed here',
|
|
@@ -1079,6 +1120,7 @@ export function taskPrompt(input, strip) {
|
|
|
1079
1120
|
pAccount: "Take addresses, model names and variables from the vendor's official docs. When the account exists, have me enter the key with `sideby key <account>`, then try it with `sideby try <account>`. For a subscription sign-in, have me click Sign in in the Panel or run `sideby login <account>` myself.",
|
|
1080
1121
|
pHost: 'Start with `sideby plugins new <id>`; note the Host version and the date with every fact you gather; check it with `sideby plugins check <id>` and try it in a demo HOME.',
|
|
1081
1122
|
pPlugin: 'Follow the plugins guide in the sideby repository (docs/guide/plugins.md); check it with `sideby plugins check <id>`.',
|
|
1123
|
+
pTheme: 'Run `sideby theme --json` first to see the Themes and the one in use, then ask me what feel I want; if I give you a screenshot, a website or a brand color, take the colors from it. Write a Theme File (JSON, colors only, never code): `{"schemaVersion":1,"name":"…","base":"sky" or "leaf","accent":"#rrggbb","light":{…},"dark":{…}}`; usually `base` and `accent` are enough, and `light` / `dark` hold only the tokens to change (`sideby theme export sky` shows them all). Keep it in the current folder, run `sideby theme check <file>` and change what fails to the suggested values until every pair passes, then run `sideby theme preview <file>` so I can look at it in the Panel. Only when I like it, run `sideby theme import <file>` and `sideby theme use <name>`; otherwise keep changing it. `sideby theme use --undo` goes back at any time.',
|
|
1082
1124
|
pTerminal: "Ask me which terminal I use first. Read only that terminal's official docs and its `--help` to find how it opens a new window that runs one command in a given folder, and note the version you read. Write it as a template: `{cmd}` is the command and `{cwd}` the folder; sideby fills them in as separate arguments, no shell runs it. Save it with `sideby terminal --custom '<template>'`, which changes sideby's settings, so ask me first. Then have me click Let AI do it in the Panel once to try it; if it does not open, look at the error with me and fix the template.",
|
|
1083
1125
|
share: 'When it works, ask me whether to share the improvement with sideby. Only with my yes, follow the CONTRIBUTING.md of the sideby repository to open a pull request, and first remove my own account names, paths and emails.',
|
|
1084
1126
|
shareTerminal: 'When it works, ask me whether to make this terminal built into sideby. Only with my yes, add a row to the terminal table in src/core/terminal.ts of the sideby repository with tests, follow its CONTRIBUTING.md to open a pull request, and first remove my own account names, paths and emails.',
|
|
@@ -1118,6 +1160,11 @@ export function taskPrompt(input, strip) {
|
|
|
1118
1160
|
const terms = (c.terminals || []).map(clean).filter(Boolean);
|
|
1119
1161
|
facts.push('- ' + (terms.length ? L.cTerminals + terms.join(', ') : L.cNoTerminals));
|
|
1120
1162
|
}
|
|
1163
|
+
if (task === 'theme') {
|
|
1164
|
+
const now = clean(c.theme);
|
|
1165
|
+
if (now)
|
|
1166
|
+
facts.push('- ' + L.cTheme + now);
|
|
1167
|
+
}
|
|
1121
1168
|
if (task === 'handoff') {
|
|
1122
1169
|
const lines = (c.handoff || []).map(clean).filter(Boolean);
|
|
1123
1170
|
if (lines.length)
|
|
@@ -1574,3 +1621,23 @@ export function histFilters(raw) {
|
|
|
1574
1621
|
scripts: o.scripts === true,
|
|
1575
1622
|
};
|
|
1576
1623
|
}
|
|
1624
|
+
/**
|
|
1625
|
+
* Saves one Auto Handoff change from the Handoff page (spec §3.17 "接力规则"): every change applies at once, and
|
|
1626
|
+
* the toast offers the undo the server read from the config as it was. Undoing offers no undo of its own.
|
|
1627
|
+
*/
|
|
1628
|
+
export async function saveHandoffChange(post, change, opts = {}) {
|
|
1629
|
+
const r = await post('/api/handoff/configure', { change, confirm: true });
|
|
1630
|
+
return { undo: opts.noUndo || !r.undo ? null : r.undo };
|
|
1631
|
+
}
|
|
1632
|
+
/**
|
|
1633
|
+
* What the Handoff page shows after confirming the plan that turns Auto Handoff on (ADR-0013): the plan again when
|
|
1634
|
+
* it changed since it was shown (unless nothing is left to do) or is blocked, the first step that failed, or done.
|
|
1635
|
+
*/
|
|
1636
|
+
export function enableOutcome(r) {
|
|
1637
|
+
if (r.changed && !r.plan.alreadyOn)
|
|
1638
|
+
return { kind: 'changed', plan: r.plan };
|
|
1639
|
+
if (r.plan.blocked)
|
|
1640
|
+
return { kind: 'blocked', plan: r.plan };
|
|
1641
|
+
const bad = r.results.find((x) => !x.ok);
|
|
1642
|
+
return bad ? { kind: 'failed', step: bad, plan: r.plan } : { kind: 'done' };
|
|
1643
|
+
}
|