sideby 0.27.0 → 0.27.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ai-tasks.json +14 -0
- package/dist/build.json +1 -1
- package/dist/src/core/ask.js +2 -1
- package/dist/src/core/egress.d.ts +5 -2
- package/dist/src/core/egress.js +7 -4
- package/dist/src/core/skill-check.d.ts +5 -0
- package/dist/src/core/skill-check.js +7 -1
- package/dist/src/core/update.d.ts +2 -3
- package/dist/src/core/update.js +39 -40
- package/dist/src/core/version.d.ts +8 -0
- package/dist/src/core/version.js +34 -0
- package/dist/src/panel/i18n.d.ts +7 -0
- package/dist/src/panel/i18n.js +14 -0
- package/dist/src/panel/page-logic.d.ts +3 -1
- package/dist/src/panel/page-logic.js +12 -0
- package/dist/src/panel/page-script.js +16 -3
- package/package.json +1 -1
- package/skills/sideby/SKILL.md +1 -1
- package/skills/sideby/references/ai-tasks.md +1 -1
- package/skills/sideby/references/update.md +3 -2
package/ai-tasks.json
CHANGED
|
@@ -142,6 +142,20 @@
|
|
|
142
142
|
{ "en": "Allow only my Japan and Singapore nodes", "zh": "只允许日本和新加坡节点" },
|
|
143
143
|
{ "en": "A message was blocked; help me check the proxy", "zh": "消息被拦了,帮我查查代理" }
|
|
144
144
|
]
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"id": "update",
|
|
148
|
+
"native": true,
|
|
149
|
+
"title": { "en": "Let AI fix the update", "zh": "让 AI 帮我更新" },
|
|
150
|
+
"placeholder": {
|
|
151
|
+
"en": "Anything to add? For example: I use a proxy",
|
|
152
|
+
"zh": "想补充什么?比如:我要走代理才能上网"
|
|
153
|
+
},
|
|
154
|
+
"examples": [
|
|
155
|
+
{ "en": "I am behind a proxy", "zh": "我上网要走代理" },
|
|
156
|
+
{ "en": "Use a registry mirror in China", "zh": "在国内,帮我换成镜像源" },
|
|
157
|
+
{ "en": "It says it cannot update itself here", "zh": "提示这里不能自己更新" }
|
|
158
|
+
]
|
|
145
159
|
}
|
|
146
160
|
]
|
|
147
161
|
}
|
package/dist/build.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"id":"
|
|
1
|
+
{"id":"20261028T124158-a7e186"}
|
package/dist/src/core/ask.js
CHANGED
|
@@ -266,7 +266,8 @@ export function taskContext(c, fail) {
|
|
|
266
266
|
k === 'quotaReason' ||
|
|
267
267
|
k === 'version' ||
|
|
268
268
|
k === 'terminalCustom' ||
|
|
269
|
-
k === 'theme'
|
|
269
|
+
k === 'theme' ||
|
|
270
|
+
k === 'updateError')
|
|
270
271
|
out[k] = str(v, `"context.${k}"`);
|
|
271
272
|
else if (k === 'terminals') {
|
|
272
273
|
if (!Array.isArray(v) || v.length > 50)
|
|
@@ -50,8 +50,11 @@ export declare function parseTrace(text: string): {
|
|
|
50
50
|
ip?: string;
|
|
51
51
|
loc?: string;
|
|
52
52
|
};
|
|
53
|
-
/**
|
|
54
|
-
|
|
53
|
+
/**
|
|
54
|
+
* One GET of an `https://` `url`, directly or through an `http://` proxy (CONNECT), as the Host would send it. The
|
|
55
|
+
* Update Check uses it too, since Node's own `fetch` does not follow the proxy variables.
|
|
56
|
+
*/
|
|
57
|
+
export declare const fetchTrace: (url: string, env: Env, timeoutMs: number, userAgent?: string) => Promise<string>;
|
|
55
58
|
export declare function readEntry(dir: string, key: string): Promise<EgressEntry | null>;
|
|
56
59
|
/** Whether `loc` passes `allow`; without a country the check could not tell. */
|
|
57
60
|
export declare function judge(entry: EgressEntry, allow: readonly string[]): EgressStatus;
|
package/dist/src/core/egress.js
CHANGED
|
@@ -79,8 +79,11 @@ export function parseTrace(text) {
|
|
|
79
79
|
}
|
|
80
80
|
return out;
|
|
81
81
|
}
|
|
82
|
-
/**
|
|
83
|
-
|
|
82
|
+
/**
|
|
83
|
+
* One GET of an `https://` `url`, directly or through an `http://` proxy (CONNECT), as the Host would send it. The
|
|
84
|
+
* Update Check uses it too, since Node's own `fetch` does not follow the proxy variables.
|
|
85
|
+
*/
|
|
86
|
+
export const fetchTrace = (url, env, timeoutMs, userAgent = 'sideby-network-guard') => new Promise((resolve, reject) => {
|
|
84
87
|
const target = new URL(url);
|
|
85
88
|
const proxy = proxyFor(url, env);
|
|
86
89
|
let done = false;
|
|
@@ -112,9 +115,9 @@ export const fetchTrace = (url, env, timeoutMs) => new Promise((resolve, reject)
|
|
|
112
115
|
const get = (socket) => {
|
|
113
116
|
const req = httpsRequest({
|
|
114
117
|
host: target.hostname,
|
|
115
|
-
path: target.pathname,
|
|
118
|
+
path: target.pathname + target.search,
|
|
116
119
|
method: 'GET',
|
|
117
|
-
headers: { 'user-agent': '
|
|
120
|
+
headers: { 'user-agent': userAgent, accept: 'application/json, text/plain' },
|
|
118
121
|
...(socket ? { createConnection: () => socket } : {}),
|
|
119
122
|
}, read);
|
|
120
123
|
req.on('error', (e) => finish(e));
|
|
@@ -32,6 +32,11 @@ export declare function installedSkills(home: string): Promise<{
|
|
|
32
32
|
version: string | null;
|
|
33
33
|
}[]>;
|
|
34
34
|
/** The command `sideby update` runs to update an installed sideby skill: it keeps the agents it was installed for. */
|
|
35
|
+
/**
|
|
36
|
+
* An installed skill for `installed` (null: from before skills had a version) is behind `target`. A skill for a newer
|
|
37
|
+
* sideby is not: `npx skills update` brings the newest skill, so it is the CLI that is behind (spec §3.23).
|
|
38
|
+
*/
|
|
39
|
+
export declare const skillIsBehind: (installed: string | null, target: string) => boolean;
|
|
35
40
|
export declare const SKILL_UPDATE: readonly ['npx', '-y', 'skills', 'update', 'sideby', '-g', '-y'];
|
|
36
41
|
/**
|
|
37
42
|
* Checks, for each given Family, the sideby skill its Host reads: `<main>/skills/sideby`, and for Codex also
|
|
@@ -5,6 +5,7 @@ import { readFile, realpath, stat } from 'node:fs/promises';
|
|
|
5
5
|
import { dirname, join } from 'node:path';
|
|
6
6
|
import { mainDirOf } from './accounts.js';
|
|
7
7
|
import { tildify } from './paths.js';
|
|
8
|
+
import { compareVersions } from './version.js';
|
|
8
9
|
export const SKILL_SOURCE = 'Adonis0123/sideby';
|
|
9
10
|
/** sideby's repository, linked from the Panel's header. */
|
|
10
11
|
export const REPO_URL = `https://github.com/${SKILL_SOURCE}`;
|
|
@@ -81,6 +82,11 @@ export async function installedSkills(home) {
|
|
|
81
82
|
return out;
|
|
82
83
|
}
|
|
83
84
|
/** The command `sideby update` runs to update an installed sideby skill: it keeps the agents it was installed for. */
|
|
85
|
+
/**
|
|
86
|
+
* An installed skill for `installed` (null: from before skills had a version) is behind `target`. A skill for a newer
|
|
87
|
+
* sideby is not: `npx skills update` brings the newest skill, so it is the CLI that is behind (spec §3.23).
|
|
88
|
+
*/
|
|
89
|
+
export const skillIsBehind = (installed, target) => installed !== target && compareVersions(installed ?? '', target) !== 1;
|
|
84
90
|
export const SKILL_UPDATE = ['npx', '-y', 'skills', 'update', 'sideby', '-g', '-y'];
|
|
85
91
|
/**
|
|
86
92
|
* Checks, for each given Family, the sideby skill its Host reads: `<main>/skills/sideby`, and for Codex also
|
|
@@ -109,7 +115,7 @@ export async function checkInstalledSkills(home, families, version) {
|
|
|
109
115
|
}
|
|
110
116
|
seen.add(`${family.id}\0${real}`);
|
|
111
117
|
const found = skillVersionOf(text);
|
|
112
|
-
if (found
|
|
118
|
+
if (!skillIsBehind(found, version))
|
|
113
119
|
continue;
|
|
114
120
|
const where = tildify(path, home);
|
|
115
121
|
// `sideby update` brings the skill along, except one a git repository owns (a dotfiles clone, say).
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Env } from '../types.ts';
|
|
2
2
|
import type { Paths } from './paths.ts';
|
|
3
3
|
export { isZombieStat } from './lock.ts';
|
|
4
|
+
export { compareVersions } from './version.ts';
|
|
4
5
|
export declare const DEFAULT_REGISTRY = "https://registry.npmjs.org";
|
|
5
6
|
export declare const CHECK_INTERVAL_MS: number;
|
|
6
7
|
export declare const NOTICE_INTERVAL_MS: number;
|
|
@@ -114,8 +115,6 @@ export declare const runProgram: UpdateDeps['exec'];
|
|
|
114
115
|
export declare const updateMachine: () => UpdateDeps;
|
|
115
116
|
/** The lock every install shares (`update-install.lock`), so a Local Build switch never races an Update. */
|
|
116
117
|
export declare const takeInstallLock: (paths: Paths) => Promise<(() => Promise<void>) | null>;
|
|
117
|
-
/** -1, 0 or 1 like a sort comparator; a prerelease sorts before its release. Null when either is not a version. */
|
|
118
|
-
export declare function compareVersions(a: string, b: string): number | null;
|
|
119
118
|
/** `latest` is newer than `current`. */
|
|
120
119
|
export declare const isNewer: (latest: string | undefined, current: string) => latest is string;
|
|
121
120
|
/**
|
|
@@ -280,7 +279,7 @@ export declare function shownPlan(plan: UpdatePlan): {
|
|
|
280
279
|
export interface SkillUpdatePlan {
|
|
281
280
|
/** Versions of the installed skills (`null`: one without a version). */
|
|
282
281
|
installed: (string | null)[];
|
|
283
|
-
/** Some installed skill is for
|
|
282
|
+
/** Some installed skill is for an older version than the one sideby will run (a newer one is not outdated). */
|
|
284
283
|
outdated: boolean;
|
|
285
284
|
command: string;
|
|
286
285
|
/** False when sideby must not run it; `reason` says why and the user runs `command` where it belongs. */
|
package/dist/src/core/update.js
CHANGED
|
@@ -6,11 +6,13 @@ import { access, constants, mkdir, readdir, readFile, realpath, rm } from 'node:
|
|
|
6
6
|
import { dirname, join, sep } from 'node:path';
|
|
7
7
|
import { fileURLToPath } from 'node:url';
|
|
8
8
|
import { afterInstall, runSkillUpdate } from './after-install.js';
|
|
9
|
+
import { fetchTrace, proxyFor } from './egress.js';
|
|
9
10
|
import { writeFileAtomic } from './fs-safe.js';
|
|
10
11
|
import { processAlive, takeFileLock } from './lock.js';
|
|
11
|
-
import { installedSkills, REPO_URL, SKILL_UPDATE, SKILL_UPDATE_SHOWN, skillOwnerRepo } from './skill-check.js';
|
|
12
|
-
import { localBuild, packageVersion, parseLocalBuild } from './version.js';
|
|
12
|
+
import { installedSkills, REPO_URL, SKILL_UPDATE, SKILL_UPDATE_SHOWN, skillIsBehind, skillOwnerRepo, } from './skill-check.js';
|
|
13
|
+
import { compareVersions, localBuild, packageVersion, parseLocalBuild, parseVersion } from './version.js';
|
|
13
14
|
export { isZombieStat } from './lock.js';
|
|
15
|
+
export { compareVersions } from './version.js';
|
|
14
16
|
export const DEFAULT_REGISTRY = 'https://registry.npmjs.org';
|
|
15
17
|
export const CHECK_INTERVAL_MS = 24 * 60 * 60 * 1000;
|
|
16
18
|
export const NOTICE_INTERVAL_MS = 24 * 60 * 60 * 1000;
|
|
@@ -51,8 +53,38 @@ async function ownPackageDir() {
|
|
|
51
53
|
}
|
|
52
54
|
return realpath(join(here, '../..'));
|
|
53
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* Node's `fetch` ignores `HTTPS_PROXY` and the like, so on a network that only reaches npm through a proxy the check
|
|
58
|
+
* would time out. An `https://` registry the proxy variables cover is asked through that proxy, as npm itself would.
|
|
59
|
+
*/
|
|
60
|
+
async function registryFetch(input, init) {
|
|
61
|
+
const url = String(input instanceof Request ? input.url : input);
|
|
62
|
+
if (!url.startsWith('https://') || !proxyFor(url, process.env))
|
|
63
|
+
return fetch(input, init);
|
|
64
|
+
try {
|
|
65
|
+
const body = await fetchTrace(url, process.env, FETCH_TIMEOUT_MS, 'sideby-update-check');
|
|
66
|
+
return new Response(body, { status: 200, headers: { 'content-type': 'application/json' } });
|
|
67
|
+
}
|
|
68
|
+
catch (err) {
|
|
69
|
+
const e = err;
|
|
70
|
+
const status = /^HTTP (\d{3})$/.exec(e.message ?? '');
|
|
71
|
+
if (status)
|
|
72
|
+
return new Response(null, { status: Number(status[1]) });
|
|
73
|
+
// Plain words that never carry the proxy address or its password.
|
|
74
|
+
const why = e.message === 'timeout'
|
|
75
|
+
? Object.assign(new Error('timed out'), { name: 'TimeoutError' })
|
|
76
|
+
: e.code === 'ECONNREFUSED'
|
|
77
|
+
? new Error('the proxy in HTTPS_PROXY refused the connection; is it running?')
|
|
78
|
+
: e.code === 'ENOTFOUND' || e.code === 'EAI_AGAIN'
|
|
79
|
+
? new Error('the address could not be looked up; offline?')
|
|
80
|
+
: new Error(e.message?.startsWith('the proxy') || e.message?.startsWith('a ')
|
|
81
|
+
? `${e.message} (HTTPS_PROXY)`
|
|
82
|
+
: 'the request through the proxy in HTTPS_PROXY failed');
|
|
83
|
+
throw why;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
54
86
|
const realDeps = {
|
|
55
|
-
fetch:
|
|
87
|
+
fetch: registryFetch,
|
|
56
88
|
now: () => new Date(),
|
|
57
89
|
packageDir: ownPackageDir,
|
|
58
90
|
writable: (dir) => access(dir, constants.W_OK).then(() => true, () => false),
|
|
@@ -148,40 +180,7 @@ export const runProgram = (file, args, opts) => deps().exec(file, args, opts);
|
|
|
148
180
|
export const updateMachine = () => deps();
|
|
149
181
|
/** The lock every install shares (`update-install.lock`), so a Local Build switch never races an Update. */
|
|
150
182
|
export const takeInstallLock = (paths) => takeLock(paths, 'update-install.lock').catch(() => null);
|
|
151
|
-
//
|
|
152
|
-
const VERSION = /^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/;
|
|
153
|
-
function parseVersion(v) {
|
|
154
|
-
const m = VERSION.exec(v.trim());
|
|
155
|
-
return m ? { core: [Number(m[1]), Number(m[2]), Number(m[3])], pre: m[4] ? m[4].split('.') : [] } : null;
|
|
156
|
-
}
|
|
157
|
-
/** Semver precedence of two prerelease identifiers: numbers compare as numbers and sort before words. */
|
|
158
|
-
function comparePre(a, b) {
|
|
159
|
-
const na = /^\d+$/.test(a);
|
|
160
|
-
const nb = /^\d+$/.test(b);
|
|
161
|
-
if (na && nb)
|
|
162
|
-
return Math.sign(Number(a) - Number(b));
|
|
163
|
-
if (na !== nb)
|
|
164
|
-
return na ? -1 : 1;
|
|
165
|
-
return a < b ? -1 : a > b ? 1 : 0;
|
|
166
|
-
}
|
|
167
|
-
/** -1, 0 or 1 like a sort comparator; a prerelease sorts before its release. Null when either is not a version. */
|
|
168
|
-
export function compareVersions(a, b) {
|
|
169
|
-
const pa = parseVersion(a);
|
|
170
|
-
const pb = parseVersion(b);
|
|
171
|
-
if (!pa || !pb)
|
|
172
|
-
return null;
|
|
173
|
-
for (let i = 0; i < 3; i++)
|
|
174
|
-
if (pa.core[i] !== pb.core[i])
|
|
175
|
-
return pa.core[i] < pb.core[i] ? -1 : 1;
|
|
176
|
-
if (!pa.pre.length || !pb.pre.length)
|
|
177
|
-
return Math.sign(pb.pre.length - pa.pre.length);
|
|
178
|
-
for (let i = 0; i < Math.min(pa.pre.length, pb.pre.length); i++) {
|
|
179
|
-
const c = comparePre(pa.pre[i], pb.pre[i]);
|
|
180
|
-
if (c)
|
|
181
|
-
return c;
|
|
182
|
-
}
|
|
183
|
-
return Math.sign(pa.pre.length - pb.pre.length);
|
|
184
|
-
}
|
|
183
|
+
// ---- versions
|
|
185
184
|
/** `latest` is newer than `current`. */
|
|
186
185
|
export const isNewer = (latest, current) => latest !== undefined && compareVersions(latest, current) === 1;
|
|
187
186
|
/**
|
|
@@ -331,7 +330,7 @@ export async function fetchLatest(env) {
|
|
|
331
330
|
}
|
|
332
331
|
catch (err) {
|
|
333
332
|
const why = err.name === 'TimeoutError' ? 'timed out' : err.message;
|
|
334
|
-
throw new Error(`could not reach ${shown} (${why}); check the connection, or set SIDEBY_UPDATE_REGISTRY to a mirror`);
|
|
333
|
+
throw new Error(`could not reach ${shown} (${why}); check the connection (and HTTPS_PROXY if you use a proxy), or set SIDEBY_UPDATE_REGISTRY to a mirror`);
|
|
335
334
|
}
|
|
336
335
|
if (!res.ok)
|
|
337
336
|
throw new Error(`${shown} answered ${res.status} for sideby's versions; try again later, or set SIDEBY_UPDATE_REGISTRY`);
|
|
@@ -412,7 +411,7 @@ export function skillAutoLine(cache) {
|
|
|
412
411
|
}
|
|
413
412
|
/** The skill part of a `SkillUpdatePlan` toward the running version, as `afterCommandPlan` takes it. */
|
|
414
413
|
export const skillBehind = (plan, current) => plan?.outdated
|
|
415
|
-
? { installed: plan.installed.find((v) => v
|
|
414
|
+
? { installed: plan.installed.find((v) => skillIsBehind(v, current)) ?? null, canRun: plan.canRun }
|
|
416
415
|
: null;
|
|
417
416
|
/**
|
|
418
417
|
* The line about a skill behind this version the CLI may print now (spec §3.23), or null: once a day per CLI version,
|
|
@@ -680,7 +679,7 @@ export async function skillUpdatePlan(home, target) {
|
|
|
680
679
|
const installed = skills.map((s) => s.version);
|
|
681
680
|
const plan = {
|
|
682
681
|
installed,
|
|
683
|
-
outdated: installed.some((v) => v
|
|
682
|
+
outdated: installed.some((v) => skillIsBehind(v, target)),
|
|
684
683
|
command: SKILL_UPDATE.join(' '),
|
|
685
684
|
canRun: true,
|
|
686
685
|
};
|
|
@@ -18,3 +18,11 @@ export interface LocalBuild {
|
|
|
18
18
|
export declare function parseLocalBuild(data: unknown): LocalBuild | null;
|
|
19
19
|
/** The running code's Local Build, or null when it was published or runs from source. */
|
|
20
20
|
export declare function localBuild(): LocalBuild | null;
|
|
21
|
+
type Parsed = {
|
|
22
|
+
core: [number, number, number];
|
|
23
|
+
pre: string[];
|
|
24
|
+
};
|
|
25
|
+
export declare function parseVersion(v: string): Parsed | null;
|
|
26
|
+
/** -1, 0 or 1 like a sort comparator; a prerelease sorts before its release. Null when either is not a version. */
|
|
27
|
+
export declare function compareVersions(a: string, b: string): number | null;
|
|
28
|
+
export {};
|
package/dist/src/core/version.js
CHANGED
|
@@ -70,3 +70,37 @@ export function localBuild() {
|
|
|
70
70
|
}
|
|
71
71
|
return cachedLocal;
|
|
72
72
|
}
|
|
73
|
+
// Build metadata is limited to what semver allows, so a version never carries a terminal escape into the notice.
|
|
74
|
+
const VERSION = /^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/;
|
|
75
|
+
export function parseVersion(v) {
|
|
76
|
+
const m = VERSION.exec(v.trim());
|
|
77
|
+
return m ? { core: [Number(m[1]), Number(m[2]), Number(m[3])], pre: m[4] ? m[4].split('.') : [] } : null;
|
|
78
|
+
}
|
|
79
|
+
/** Semver precedence of two prerelease identifiers: numbers compare as numbers and sort before words. */
|
|
80
|
+
function comparePre(a, b) {
|
|
81
|
+
const na = /^\d+$/.test(a);
|
|
82
|
+
const nb = /^\d+$/.test(b);
|
|
83
|
+
if (na && nb)
|
|
84
|
+
return Math.sign(Number(a) - Number(b));
|
|
85
|
+
if (na !== nb)
|
|
86
|
+
return na ? -1 : 1;
|
|
87
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
88
|
+
}
|
|
89
|
+
/** -1, 0 or 1 like a sort comparator; a prerelease sorts before its release. Null when either is not a version. */
|
|
90
|
+
export function compareVersions(a, b) {
|
|
91
|
+
const pa = parseVersion(a);
|
|
92
|
+
const pb = parseVersion(b);
|
|
93
|
+
if (!pa || !pb)
|
|
94
|
+
return null;
|
|
95
|
+
for (let i = 0; i < 3; i++)
|
|
96
|
+
if (pa.core[i] !== pb.core[i])
|
|
97
|
+
return pa.core[i] < pb.core[i] ? -1 : 1;
|
|
98
|
+
if (!pa.pre.length || !pb.pre.length)
|
|
99
|
+
return Math.sign(pb.pre.length - pa.pre.length);
|
|
100
|
+
for (let i = 0; i < Math.min(pa.pre.length, pb.pre.length); i++) {
|
|
101
|
+
const c = comparePre(pa.pre[i], pb.pre[i]);
|
|
102
|
+
if (c)
|
|
103
|
+
return c;
|
|
104
|
+
}
|
|
105
|
+
return Math.sign(pa.pre.length - pb.pre.length);
|
|
106
|
+
}
|
package/dist/src/panel/i18n.d.ts
CHANGED
|
@@ -64,6 +64,7 @@ declare const en: {
|
|
|
64
64
|
'upd.unconfirmed': string;
|
|
65
65
|
'upd.reloading': string;
|
|
66
66
|
'upd.restartHint': string;
|
|
67
|
+
'upd.askAi': string;
|
|
67
68
|
'upd.skillLabel': string;
|
|
68
69
|
'upd.skillLater': string;
|
|
69
70
|
'upd.skillLabelLong': string;
|
|
@@ -665,6 +666,12 @@ declare const en: {
|
|
|
665
666
|
'th.removeSure': string;
|
|
666
667
|
'th.removed': string;
|
|
667
668
|
'ask.title.theme': string;
|
|
669
|
+
'ask.task.update': string;
|
|
670
|
+
'ask.title.update': string;
|
|
671
|
+
'ask.ph.update': string;
|
|
672
|
+
'ask.ex.update.1': string;
|
|
673
|
+
'ask.ex.update.2': string;
|
|
674
|
+
'ask.ex.update.3': string;
|
|
668
675
|
'ask.title.network': string;
|
|
669
676
|
'ask.task.network': string;
|
|
670
677
|
'ask.ph.network': string;
|
package/dist/src/panel/i18n.js
CHANGED
|
@@ -66,6 +66,7 @@ const en = {
|
|
|
66
66
|
'upd.unconfirmed': 'Could not confirm the update to sideby {v}: this page cannot reach sideby. Reload the page to see which version runs.',
|
|
67
67
|
'upd.reloading': 'Waiting for the new version; this page reloads by itself.',
|
|
68
68
|
'upd.restartHint': 'This page still runs the old version. Restart sideby ui (or reload the page in your portal) to use the new one.',
|
|
69
|
+
'upd.askAi': 'Not sure why? Let AI fix it',
|
|
69
70
|
'upd.skillLabel': 'Update skill',
|
|
70
71
|
'upd.skillLater': 'Once the new version is installed, open this again to bring the sideby skill agents read along.',
|
|
71
72
|
'upd.skillLabelLong': 'The sideby skill agents read is for {s}; this sideby is {cur}. Click to update it.',
|
|
@@ -667,6 +668,12 @@ const en = {
|
|
|
667
668
|
'th.removeSure': 'Remove for good?',
|
|
668
669
|
'th.removed': 'Removed {name}',
|
|
669
670
|
'ask.title.theme': 'Let AI pick your colors',
|
|
671
|
+
'ask.task.update': 'AI checks why the update failed (network, proxy, how sideby is installed), shows you the fix and updates sideby after you agree.',
|
|
672
|
+
'ask.title.update': 'Let AI fix the update',
|
|
673
|
+
'ask.ph.update': 'Anything to add? For example: I use a proxy',
|
|
674
|
+
'ask.ex.update.1': 'I am behind a proxy',
|
|
675
|
+
'ask.ex.update.2': 'Use a registry mirror in China',
|
|
676
|
+
'ask.ex.update.3': 'It says it cannot update itself here',
|
|
670
677
|
'ask.title.network': 'Let AI help',
|
|
671
678
|
'ask.task.network': 'AI asks which countries your requests may leave from, shows the change, and turns the check on only after you agree.',
|
|
672
679
|
'ask.ph.network': 'Where are you, and which proxy nodes do you use? Or paste what was blocked.',
|
|
@@ -1532,6 +1539,7 @@ const zh = {
|
|
|
1532
1539
|
'upd.unconfirmed': '没能确认是否已更新到 sideby {v}:这个页面连不上 sideby。刷新页面看看现在是哪个版本。',
|
|
1533
1540
|
'upd.reloading': '等待新版本启动,本页会自动刷新。',
|
|
1534
1541
|
'upd.restartHint': '本页仍在运行旧版本。重启 sideby ui(在 Portal 里就刷新页面)后使用新版本。',
|
|
1542
|
+
'upd.askAi': '不知道怎么办?让 AI 帮我修',
|
|
1535
1543
|
'upd.skillLabel': '更新 skill',
|
|
1536
1544
|
'upd.skillLater': '装好新版本后,再打开这里把 agent 用的 sideby skill 一起更新。',
|
|
1537
1545
|
'upd.skillLabelLong': 'agent 用的 sideby skill 还是 {s},当前 sideby 是 {cur}。点击更新。',
|
|
@@ -2133,6 +2141,12 @@ const zh = {
|
|
|
2133
2141
|
'th.removeSure': '确定删除?',
|
|
2134
2142
|
'th.removed': '已删除「{name}」',
|
|
2135
2143
|
'ask.title.theme': '让 AI 帮我配色',
|
|
2144
|
+
'ask.task.update': 'AI 会查更新为什么失败(网络、代理、安装方式),先给你看怎么修,你同意后再更新 sideby。',
|
|
2145
|
+
'ask.title.update': '让 AI 帮我更新',
|
|
2146
|
+
'ask.ph.update': '想补充什么?比如:我要走代理才能上网',
|
|
2147
|
+
'ask.ex.update.1': '我上网要走代理',
|
|
2148
|
+
'ask.ex.update.2': '在国内,帮我换成镜像源',
|
|
2149
|
+
'ask.ex.update.3': '提示这里不能自己更新',
|
|
2136
2150
|
'ask.title.network': '让 AI 帮我',
|
|
2137
2151
|
'ask.task.network': 'AI 会问你允许哪些地区,先给你看改动,你同意后才打开检查。',
|
|
2138
2152
|
'ask.ph.network': '你在哪里、用哪些代理节点?或者贴上被拦下的提示。',
|
|
@@ -559,7 +559,7 @@ export declare function networkTaskFacts(n: {
|
|
|
559
559
|
}[];
|
|
560
560
|
}): string[];
|
|
561
561
|
/** The kinds of AI Task (spec §3.28); anything else is refused. */
|
|
562
|
-
export declare const AI_TASK_KINDS: readonly ['free', 'fix', 'quota', 'account', 'host', 'plugin', 'terminal', 'theme', 'handoff', 'menubar', 'hotkey', 'network'];
|
|
562
|
+
export declare const AI_TASK_KINDS: readonly ['free', 'fix', 'quota', 'account', 'host', 'plugin', 'terminal', 'theme', 'handoff', 'menubar', 'hotkey', 'network', 'update'];
|
|
563
563
|
export type AiTaskKind = (typeof AI_TASK_KINDS)[number];
|
|
564
564
|
/**
|
|
565
565
|
* The message keys of the AI dialog for `task` (spec §3.28 "每个入口的提示"): its title, the text box placeholder and
|
|
@@ -647,6 +647,8 @@ export declare function taskPrompt(input: {
|
|
|
647
647
|
handoff?: readonly string[];
|
|
648
648
|
/** Network Guard facts, one per line, as `networkTaskFacts` gives them (`network` task, spec §3.35). */
|
|
649
649
|
network?: readonly string[];
|
|
650
|
+
/** The error the last Update Check or Update showed (`update` task, spec §3.23). */
|
|
651
|
+
updateError?: string;
|
|
650
652
|
};
|
|
651
653
|
/** Files saved for the task (spec §3.28 "附件"): absolute paths and their kind. */
|
|
652
654
|
attachments?: readonly {
|
|
@@ -996,6 +996,7 @@ export const AI_TASK_KINDS = [
|
|
|
996
996
|
'menubar',
|
|
997
997
|
'hotkey',
|
|
998
998
|
'network',
|
|
999
|
+
'update',
|
|
999
1000
|
];
|
|
1000
1001
|
/**
|
|
1001
1002
|
* The message keys of the AI dialog for `task` (spec §3.28 "每个入口的提示"): its title, the text box placeholder and
|
|
@@ -1104,6 +1105,9 @@ export function taskPrompt(input, strip) {
|
|
|
1104
1105
|
cHandoff: '自动接力现在的设置(来自 `sideby handoff status --json`):',
|
|
1105
1106
|
network: '帮我设置 sideby 的网络检查:请求要从我没允许的国家或地区发出时(比如代理断了、节点切错了),拦下 Claude 和 Codex。',
|
|
1106
1107
|
cNetwork: '网络检查现在的情况(来自 `sideby network --json`):',
|
|
1108
|
+
update: '帮我把 sideby 和它的 skill 更新到最新版:面板检查更新或更新时出错了,请找出原因并修好。',
|
|
1109
|
+
cUpdate: '面板上的报错:',
|
|
1110
|
+
pUpdate: '先运行 `sideby update --json`,看它能不能连上 npm、最新版是多少、是哪种安装方式(`canRun`)。连不上时先查网络:要走代理的话,看启动 sideby 的终端里有没有 `HTTPS_PROXY`、代理开没开;在中国大陆可以用镜像 `SIDEBY_UPDATE_REGISTRY=https://registry.npmmirror.com`,要写进 shell 配置文件前先问我。能更新时,`sideby update --json` 已经给出预览(退出码 10),我同意后再跑 `sideby update --yes --json`。`canRun` 为 `false` 时(npx、项目依赖、没有写权限的全局目录),把输出里的 `command` 给我,告诉我在哪里运行。skill 比 sideby 新不是问题,更新 sideby 就好。最后再跑一次 `sideby update --json`,确认 sideby 和 skill 都已是最新。',
|
|
1107
1111
|
pNetwork: '先运行 `sideby network check --json`,告诉我现在每个地址的请求从哪里发出。问我允许哪些国家或地区;不要替我决定,也不要因为现在在哪就把它加进去(网络不对时那正是错的地区)。我说了以后,先不加 `--yes` 跑 `sideby network allow <代码>... --json` 和 `sideby network on --json` 给我看预览,我同意后再加 `--yes`。告诉我:只检查 sideby 启动的会话;Codex 要在 `/hooks` 里信任一次 `network-hook`;临时跳过一次用 `sideby run <账号> --ignore-network`。被拦过的话,先帮我查代理(开没开、哪个节点),再跑 `sideby network check --json` 确认。它只防代理出意外,不会让在不支持的地区使用变得合规;不要帮我隐藏所在地(时区、指纹之类)。',
|
|
1108
1112
|
pHandoff: '先运行 `sideby handoff status --json` 和 `sideby quota --json`,看清每个账号的额度来源和用量。只用 `sideby handoff enable …` 或 `sideby config set handoff.<键> <值>` 改设置;先不加 `--yes` 给我看预览,我同意后再加 `--yes`。没有额度数据的账号排在顺序后面,并告诉我怎么让它显示额度。',
|
|
1109
1113
|
cAccount: '账号:',
|
|
@@ -1153,6 +1157,9 @@ export function taskPrompt(input, strip) {
|
|
|
1153
1157
|
cHandoff: 'Auto Handoff now (from `sideby handoff status --json`):',
|
|
1154
1158
|
network: "Help me set up sideby's network check: stop Claude and Codex when my requests would leave from a country I did not allow (for example when the proxy stopped or a node in the wrong country is picked).",
|
|
1155
1159
|
cNetwork: 'Network check now (from `sideby network --json`):',
|
|
1160
|
+
update: 'Bring sideby and its skill up to date: the Panel showed an error while checking for or installing an update. Find out why and fix it.',
|
|
1161
|
+
cUpdate: 'The error the Panel showed: ',
|
|
1162
|
+
pUpdate: 'Run `sideby update --json` first to see whether it reaches npm, the latest version and how sideby is installed (`canRun`). When it cannot reach npm, check the network: behind a proxy, whether the terminal that starts sideby has `HTTPS_PROXY` and the proxy is on; in mainland China the mirror `SIDEBY_UPDATE_REGISTRY=https://registry.npmmirror.com` helps, but ask me before writing it into a shell config file. When it can update, `sideby update --json` already shows the change (exit 10); run `sideby update --yes --json` after I agree. When `canRun` is false (npx, a project dependency, a global folder I cannot write), give me the `command` from its output and tell me where to run it. A skill newer than sideby is fine: updating sideby is enough. Finish with `sideby update --json` again to confirm sideby and the skill are current.',
|
|
1156
1163
|
pNetwork: "Run `sideby network check --json` first and tell me where each address's requests leave from now. Ask me which countries to allow; never decide for me, and never add the current country because it is current (on a wrong network that is the wrong one). Once I say, run `sideby network allow <codes>... --json` and `sideby network on --json` without `--yes` to show me the change, and add `--yes` after I agree. Tell me: only sessions sideby starts are checked; in Codex I trust `network-hook` once in `/hooks`; `sideby run <account> --ignore-network` skips it once. If something was blocked, help me check the proxy (is it on, which node) first, then run `sideby network check --json` to confirm. It guards against proxy accidents; it does not make use from an unsupported region allowed, and never help hide where I am (time zone, fingerprints).",
|
|
1157
1164
|
pHandoff: 'Run `sideby handoff status --json` and `sideby quota --json` first to see where each account gets its quota and how much is used. Change settings only with `sideby handoff enable …` or `sideby config set handoff.<key> <value>`; show me the preview without `--yes` first, and add `--yes` only after I agree. Put accounts without quota data last in the order, and tell me how to make them show it.',
|
|
1158
1165
|
cAccount: 'Account: ',
|
|
@@ -1228,6 +1235,11 @@ export function taskPrompt(input, strip) {
|
|
|
1228
1235
|
if (lines.length)
|
|
1229
1236
|
facts.push('- ' + L.cNetwork, ...lines.map((l) => ' - ' + l));
|
|
1230
1237
|
}
|
|
1238
|
+
if (task === 'update') {
|
|
1239
|
+
const err = clean(c.updateError);
|
|
1240
|
+
if (err)
|
|
1241
|
+
facts.push('- ' + L.cUpdate + err);
|
|
1242
|
+
}
|
|
1231
1243
|
const version = clean(c.version);
|
|
1232
1244
|
if (version)
|
|
1233
1245
|
facts.push('- ' + L.cVersion + version);
|
|
@@ -7608,7 +7608,14 @@ const MAIN = String.raw `
|
|
|
7608
7608
|
const skillOld = (u) => !!(u && !u.available && !isLocal(u) && u.skillUpdate && u.skillUpdate.outdated)
|
|
7609
7609
|
const skillDue = (u) => skillOld(u) && u.skillUpdate.canRun
|
|
7610
7610
|
function skillFor(u) {
|
|
7611
|
-
|
|
7611
|
+
// Only a skill for an older sideby is behind; one for a newer sideby means the CLI is the one to update.
|
|
7612
|
+
const older = (a, b) => {
|
|
7613
|
+
const p = (x) => String(x).split(/[.+-]/).slice(0, 3).map(Number)
|
|
7614
|
+
const x = p(a), y = p(b)
|
|
7615
|
+
for (let i = 0; i < 3; i++) if (x[i] !== y[i]) return x[i] < y[i]
|
|
7616
|
+
return false
|
|
7617
|
+
}
|
|
7618
|
+
const v = u.skillUpdate.installed.find((x) => x !== u.current && (x === null || older(x, u.current)))
|
|
7612
7619
|
return v ? v : t('upd.skillNoVer')
|
|
7613
7620
|
}
|
|
7614
7621
|
// Why sideby cannot do something itself, in the viewer's language; the English reason when the code is unknown.
|
|
@@ -7714,6 +7721,12 @@ const MAIN = String.raw `
|
|
|
7714
7721
|
openPopover(anchor, 'version', t('upd.title'), verPopKids)
|
|
7715
7722
|
}
|
|
7716
7723
|
function renderVerPop() { refreshPopover('version') }
|
|
7724
|
+
// Where an update fails (spec §3.28): the AI checks the network, the proxy and the install method, and fixes them.
|
|
7725
|
+
function updAskKids(err) {
|
|
7726
|
+
if (BOOT.readOnly) return []
|
|
7727
|
+
const go = () => { closeMenu(); if (dlg.el && dlg.el.open) dlg.el.close(); openAsk({ task: 'update', context: { updateError: err.message, version: BOOT.version } }) }
|
|
7728
|
+
return [h('p', { class: 'small', 'data-enter': 'upd-ai' }, h('button', { class: 'link-btn small', type: 'button', onclick: go }, icon('bot'), ' ', t('upd.askAi')))]
|
|
7729
|
+
}
|
|
7717
7730
|
// A Local Build (ADR-0024) names its commit, with + when the working tree had changes, so the viewer can tell
|
|
7718
7731
|
// which code they are looking at.
|
|
7719
7732
|
function verLabel() {
|
|
@@ -7745,7 +7758,7 @@ const MAIN = String.raw `
|
|
|
7745
7758
|
kids.push(h('div', { class: 'popover-actions' }, h('button', { class: 'btn btn-sm', type: 'button', disabled: vp.checking, 'aria-busy': vp.checking ? 'true' : null, onclick: verPopCheck },
|
|
7746
7759
|
vp.checking ? spinner() : icon('refresh'), vp.checking ? t('upd.checking') : t('upd.check'))))
|
|
7747
7760
|
}
|
|
7748
|
-
if (vp.error) kids.push(errorNote(vp.error, null))
|
|
7761
|
+
if (vp.error) kids.push(errorNote(vp.error, null), ...updAskKids(vp.error))
|
|
7749
7762
|
const sw = localSwitchKids(u)
|
|
7750
7763
|
if (sw) kids.push(sw)
|
|
7751
7764
|
if (u && !BOOT.readOnly && !isLocal(u))
|
|
@@ -7963,7 +7976,7 @@ const MAIN = String.raw `
|
|
|
7963
7976
|
h('button', { class: 'btn btn-sm btn-primary', type: 'button', disabled: up.autoBusy, onclick: updAutoSave }, t('upd.save'))))
|
|
7964
7977
|
}
|
|
7965
7978
|
if (BOOT.readOnly) body.push(h('p', { class: 'note' }, t('banner.readOnly')))
|
|
7966
|
-
if (up.error) body.push(errorNote(up.error, null))
|
|
7979
|
+
if (up.error) body.push(errorNote(up.error, null), ...updAskKids(up.error))
|
|
7967
7980
|
const foot = [h('button', { class: 'btn', type: 'button', disabled: up.busy, onclick: () => dlg.el.close() }, t('btn.close'))]
|
|
7968
7981
|
const primary = (label, run) => h('button', { class: 'btn btn-primary', type: 'button', disabled: up.busy, 'aria-busy': up.busy ? 'true' : null, onclick: run }, up.busy ? spinner() : null, up.busy ? t('upd.updating') : label)
|
|
7969
7982
|
if (up.unknown || (u.available && isLocal(u) && (vs.stuck || vs.unknown))) foot.push(h('button', { class: 'btn btn-primary', type: 'button', onclick: () => location.reload() }, icon('refresh'), t('loc.reload')))
|
package/package.json
CHANGED
package/skills/sideby/SKILL.md
CHANGED
|
@@ -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.27.
|
|
5
|
+
version: "0.27.1"
|
|
6
6
|
requires:
|
|
7
7
|
bins: [sideby, node]
|
|
8
8
|
cliHelp: sideby --help
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# AI Tasks
|
|
2
2
|
|
|
3
|
-
An AI Task is a session of the user's own Host that sideby started for them, with a Task Prompt as its first message. The user starts it from the Panel ("Let AI do it", a Finding, a quota cell, the new-account dialog, "Other tool…", "Let AI write a plugin", "Not sure how? Let AI set it up" in the Preferred terminal dialog, "Let AI tune it" on the Auto Handoff page) or with `sideby ask` in a terminal (`--task free|fix|quota|account|host|plugin|terminal|handoff|theme|menubar|hotkey|network`; "Let AI help" in the Panel's Network check dialog and on its wrong-network banner starts `network`, see `references/network.md`; "Let AI pick my colors" in the Panel's Theme dialog starts `theme`, see `references/themes.md`; "Let AI check it" in the Panel's Menu bar icon dialog starts `menubar`, and "Not sure which? Let AI pick one" under its shortcut starts `hotkey`). The prompt says what to do and gives facts sideby already knows (account refs, Family, Finding codes, the quota reason, the Panel language, the sideby version). How to do it is on this page.
|
|
3
|
+
An AI Task is a session of the user's own Host that sideby started for them, with a Task Prompt as its first message. The user starts it from the Panel ("Let AI do it", a Finding, a quota cell, the new-account dialog, "Other tool…", "Let AI write a plugin", "Not sure how? Let AI set it up" in the Preferred terminal dialog, "Let AI tune it" on the Auto Handoff page) or with `sideby ask` in a terminal (`--task free|fix|quota|account|host|plugin|terminal|handoff|theme|menubar|hotkey|network|update`; "Let AI help" in the Panel's Network check dialog and on its wrong-network banner starts `network`, see `references/network.md`; "Let AI pick my colors" in the Panel's Theme dialog starts `theme`, see `references/themes.md`; "Let AI check it" in the Panel's Menu bar icon dialog starts `menubar`, and "Not sure which? Let AI pick one" under its shortcut starts `hotkey`; "Not sure why? Let AI fix it" under an error in the Panel's update dialog starts `update`, see `references/update.md`). The prompt says what to do and gives facts sideby already knows (account refs, Family, Finding codes, the quota reason, the Panel language, the sideby version). How to do it is on this page.
|
|
4
4
|
|
|
5
5
|
You are inside such a session when the first message came from sideby and names a task. Work in the directory the session started in (sideby's own `ai/` folder) unless the user names another one.
|
|
6
6
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Every `--json` output can carry `_notice` (it comes from sideby's daily Update Check and the installed skill, and reads no network itself):
|
|
4
4
|
|
|
5
5
|
- `_notice.update`: `{ current, latest, command: "sideby update", message }`, a newer sideby is out.
|
|
6
|
-
- `_notice.skill`: `{ installed, current, command: "sideby update", message }`, the sideby skill agents read here is for
|
|
6
|
+
- `_notice.skill`: `{ installed, current, command: "sideby update", message }`, the sideby skill agents read here is for an older version (`installed: null` when it has no version), so it may describe commands this CLI does not have.
|
|
7
7
|
|
|
8
8
|
What to do:
|
|
9
9
|
|
|
@@ -13,7 +13,8 @@ What to do:
|
|
|
13
13
|
- Run `sideby update --json`. It shows the version, the install method and the command it would run, and exits `10`. Show that to the user; after their yes, run `sideby update --yes --json`.
|
|
14
14
|
- If it exits `1` with `canRun: false` (npx, Volta, a project dependency, a source checkout, a Local Build), sideby cannot update itself: give the user the `command` it printed as one line to run.
|
|
15
15
|
- The same command updates the installed sideby skill (`skillUpdate` in the plan, `skillUpdated` in the result), so do not run a skill command yourself. With sideby already current and only the skill old (`_notice.skill`), `sideby update` updates the skill alone, after the same preview. To update only the skill and never the CLI, even when a newer sideby is out, run `sideby update --skill --json` (preview, exit `10`), then `--skill --yes --json`. When `skillUpdate.canRun` is false (the skill lives in a git repository the skills tool did not install it into), tell the user `reason` and give them `command`. Tell them that sessions already running keep the old version until they start again.
|
|
16
|
-
4.
|
|
16
|
+
4. When `sideby update --json` cannot reach the registry (the `update` AI Task, started from an error in the Panel's update dialog, brings that error): behind a proxy, check that the terminal or app that starts sideby has `HTTPS_PROXY` (sideby follows it, as npm does) and that the proxy is on; in mainland China, `SIDEBY_UPDATE_REGISTRY=https://registry.npmmirror.com` uses a mirror. Ask before writing either into a shell config file. A skill for a newer sideby than the CLI is not a problem: update the CLI.
|
|
17
|
+
5. The user can turn notices off with `SIDEBY_NO_UPDATE_NOTIFIER=1` (or config `update.check: false`); set it for one command when a script needs JSON without `_notice`. A Local Build (`pnpm local`) never has one.
|
|
17
18
|
|
|
18
19
|
## Auto Update
|
|
19
20
|
|