sideby 0.35.8 → 0.35.9

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":"20261110T025220-5f0ccd"}
1
+ {"id":"20261110T040509-f565d3"}
@@ -1,4 +1,4 @@
1
- import { SKILL_UPDATE } from './skill-check.js';
1
+ import { SKILL_INSTALL, SKILL_UPDATE } from './skill-check.js';
2
2
  /**
3
3
  * The skill step the new code runs by name. `--skill` updates only the installed skill: it never installs the CLI,
4
4
  * even when the registry has moved on since the user confirmed.
@@ -12,9 +12,16 @@ export async function runSkillUpdate(m, plan, env, onOutput) {
12
12
  const r = await m
13
13
  .exec(file, args, { env, ...(onOutput ? { onOutput } : {}) })
14
14
  .catch((e) => ({ code: 1, output: e instanceof Error ? e.message : String(e) }));
15
- return r.code === 0
16
- ? { ok: true, message: 'updated the sideby skill' }
17
- : { ok: false, message: `\`${plan.command}\` failed (exit ${r.code}); run it yourself to see why` };
15
+ if (r.code !== 0)
16
+ return { ok: false, message: `\`${plan.command}\` failed (exit ${r.code}); run it yourself to see why` };
17
+ // The skills tool exits 0 when its install record does not list the skill: it changed nothing, and the skill is
18
+ // as old as before.
19
+ if (/No installed skills found/i.test(r.output))
20
+ return {
21
+ ok: false,
22
+ message: `the skills tool does not list the sideby skill as one it installed, so it updated nothing; run \`${SKILL_INSTALL}\` to install the current one`,
23
+ };
24
+ return { ok: true, message: 'updated the sideby skill' };
18
25
  }
19
26
  async function autostartByName(m, home, env) {
20
27
  // Never created here: only a login item `sideby autostart on` wrote is refreshed (ADR-0029).
@@ -62,7 +62,12 @@ export declare function taskStateDir(dir: string): Promise<string>;
62
62
  * `<promptArg>=<prompt>` instead, since its Host refuses a positional prompt.
63
63
  */
64
64
  export declare function taskHostArgs(rt: Runtime, task: TaskFile): Promise<string[]>;
65
- /** `env` with the HOME and XDG folders the task was written under, so the Runtime sees what the Panel saw. */
65
+ /**
66
+ * `env` with the HOME and XDG folders the task was written under, so the Runtime sees what the Panel saw. A folder at
67
+ * its default place under that HOME gets no variable (paths.ts reads an unset one as the default): the whole session
68
+ * inherits this, and other tools change where they keep their files once an XDG variable is set. Only a value the
69
+ * terminal already has for that same folder stays.
70
+ */
66
71
  export declare function taskEnv(task: TaskFile, env: Env): Env;
67
72
  export declare function readTask(id: string, paths?: Pick<Paths, 'stateDir'>): Promise<TaskFile>;
68
73
  export declare function terminals(rt: Runtime): Promise<{
@@ -2,7 +2,7 @@ import { randomBytes } from 'node:crypto';
2
2
  import { constants } from 'node:fs';
3
3
  import { lstat, mkdtemp, open, readdir, realpath, rm, stat, unlink } from 'node:fs/promises';
4
4
  import { userInfo } from 'node:os';
5
- import { dirname, isAbsolute, join, sep } from 'node:path';
5
+ import { dirname, isAbsolute, join, resolve, sep } from 'node:path';
6
6
  import { MODEL_NAME, takeFlag } from '../families/shared/model-args.js';
7
7
  import { AI_TASK_KINDS, stripSecrets, taskPrompt } from '../panel/page-logic.js';
8
8
  import { checkAttachmentFiles, copyAttachments, MAX_ATTACHMENTS, privateDir, removeOldAttachments, stagedAttachments, takeStaged, } from './attachments.js';
@@ -155,15 +155,26 @@ export async function taskHostArgs(rt, task) {
155
155
  const prompt = task.prompt ?? '';
156
156
  return [...images, family?.promptArg ? `${family.promptArg}=${prompt}` : prompt];
157
157
  }
158
- /** `env` with the HOME and XDG folders the task was written under, so the Runtime sees what the Panel saw. */
158
+ /**
159
+ * `env` with the HOME and XDG folders the task was written under, so the Runtime sees what the Panel saw. A folder at
160
+ * its default place under that HOME gets no variable (paths.ts reads an unset one as the default): the whole session
161
+ * inherits this, and other tools change where they keep their files once an XDG variable is set. Only a value the
162
+ * terminal already has for that same folder stays.
163
+ */
159
164
  export function taskEnv(task, env) {
160
165
  if (!task.home || !task.configDir || !task.stateDir)
161
166
  return env;
167
+ const { XDG_CONFIG_HOME: config, XDG_STATE_HOME: state, ...rest } = env;
168
+ const configBase = dirname(task.configDir);
169
+ const stateBase = dirname(task.stateDir);
170
+ // The same folder however the terminal spells it (`…/state/`, `…/./state`), not the same string.
171
+ const sameDir = (a, b) => isAbsolute(a) && resolve(a) === resolve(b);
172
+ const named = (dir, byDefault, had) => !sameDir(byDefault, dir) || (had !== undefined && sameDir(had, dir));
162
173
  return {
163
- ...env,
174
+ ...rest,
164
175
  HOME: task.home,
165
- XDG_CONFIG_HOME: dirname(task.configDir),
166
- XDG_STATE_HOME: dirname(task.stateDir),
176
+ ...(named(configBase, join(task.home, '.config'), config) ? { XDG_CONFIG_HOME: configBase } : {}),
177
+ ...(named(stateBase, join(task.home, '.local', 'state'), state) ? { XDG_STATE_HOME: stateBase } : {}),
167
178
  };
168
179
  }
169
180
  export async function readTask(id, paths = resolvePaths()) {
@@ -12,9 +12,10 @@ export declare const pkgDir: (d: LocalDirs) => string;
12
12
  export declare const globalPkg: (d: LocalDirs) => string;
13
13
  export declare const devDir: (env: Env) => string;
14
14
  /**
15
- * The environment to ask npm for its global prefix in. A pnpm script gets pnpm's own `--dir` (`pnpm -C <dir> …`) as
16
- * `npm_config_dir` and `npm_config_prefix`, and npm would answer with that directory; npm reads the user's real
17
- * setting from its config files and from `NPM_CONFIG_PREFIX` without them.
15
+ * The environment to ask npm for its global prefix in, and to install a global package in. A pnpm script gets pnpm's
16
+ * own `--dir` (`pnpm -C <dir> …`) as `npm_config_dir` and `npm_config_prefix`, and npm would answer with, and install
17
+ * into, that directory; npm reads the user's real setting from its config files and from `NPM_CONFIG_PREFIX` without
18
+ * them.
18
19
  */
19
20
  export declare function npmEnv(env: Env): Env;
20
21
  /** Where the switch works, with npm's global prefix from `npm prefix -g`; null when npm cannot be asked. */
@@ -16,9 +16,10 @@ export const globalPkg = (d) => join(d.prefix, 'lib', 'node_modules', 'sideby');
16
16
  const globalBin = (d) => join(d.prefix, 'bin', 'sideby');
17
17
  export const devDir = (env) => join(env.XDG_DATA_HOME || join(env.HOME || homedir(), '.local', 'share'), 'sideby-dev');
18
18
  /**
19
- * The environment to ask npm for its global prefix in. A pnpm script gets pnpm's own `--dir` (`pnpm -C <dir> …`) as
20
- * `npm_config_dir` and `npm_config_prefix`, and npm would answer with that directory; npm reads the user's real
21
- * setting from its config files and from `NPM_CONFIG_PREFIX` without them.
19
+ * The environment to ask npm for its global prefix in, and to install a global package in. A pnpm script gets pnpm's
20
+ * own `--dir` (`pnpm -C <dir> …`) as `npm_config_dir` and `npm_config_prefix`, and npm would answer with, and install
21
+ * into, that directory; npm reads the user's real setting from its config files and from `NPM_CONFIG_PREFIX` without
22
+ * them.
22
23
  */
23
24
  export function npmEnv(env) {
24
25
  if (!env.npm_config_user_agent?.startsWith('pnpm/'))
@@ -203,8 +204,9 @@ export async function switchLocal(paths, d, to, env, opts = {}) {
203
204
  else {
204
205
  const want = latest ?? 'latest';
205
206
  await rm(globalPkg(d), { force: true });
207
+ // Without pnpm's `--dir`: from `pnpm -C <checkout> local --off` npm would install into the checkout.
206
208
  const r = await runProgram('npm', ['install', '-g', `sideby@${want}`], {
207
- env,
209
+ env: npmEnv(env),
208
210
  ...(opts.onOutput ? { onOutput: opts.onOutput } : {}),
209
211
  });
210
212
  if (r.code !== 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sideby",
3
- "version": "0.35.8",
3
+ "version": "0.35.9",
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)",
@@ -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 ("找一下我上周改登录页的那个会话"), telling another running session something, in any account ("告诉 cc002 ……", "给跑构建的那个会话发消息"; Claude Code's own SendMessage reaches only sessions of the same 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.35.8"
5
+ version: "0.35.9"
6
6
  requires:
7
7
  bins: [sideby, node]
8
8
  cliHelp: sideby --help