sideby 0.42.0 → 0.42.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/dist/build.json CHANGED
@@ -1 +1 @@
1
- {"id":"20261121T033317-cb060f"}
1
+ {"id":"20261121T042926-e2cf4d"}
@@ -214,6 +214,9 @@ const FamilyDetail = Type.Intersect([
214
214
  }),
215
215
  ]);
216
216
  const PluginError = Type.Object({ where: Str, message: Str });
217
+ const FindingParams = Type.Record(Type.String(), Type.Union([Type.String(), Type.Number()]), {
218
+ description: 'Names and counts the Panel puts into its own translated sentence for `code`; `form` picks a variant of it. The `message` says the same in English.',
219
+ });
217
220
  const Finding = Type.Object({
218
221
  level: Level,
219
222
  account: Str,
@@ -221,6 +224,7 @@ const Finding = Type.Object({
221
224
  code: Str,
222
225
  message: Str,
223
226
  hint: Type.Optional(Str),
227
+ params: Type.Optional(FindingParams),
224
228
  source: Str,
225
229
  fixable: Type.Boolean(),
226
230
  });
@@ -693,7 +697,14 @@ export const OUTPUT_SCHEMAS = {
693
697
  findings: Type.Array(Finding),
694
698
  })),
695
699
  general: Type.Array(Finding),
696
- fixes: Type.Array(Type.Object({ account: Str, item: Str, code: Str, ok: Type.Boolean(), message: Str })),
700
+ fixes: Type.Array(Type.Object({
701
+ account: Str,
702
+ item: Str,
703
+ code: Str,
704
+ ok: Type.Boolean(),
705
+ message: Str,
706
+ params: Type.Optional(FindingParams),
707
+ })),
697
708
  }, { title: 'sideby doctor --json' }),
698
709
  'tune-change': Type.Object({
699
710
  schemaVersion: Version,
@@ -61,22 +61,32 @@ export type Trash = (path: string) => Promise<TrashResult>;
61
61
  export declare function systemTrash(env: Env, stateDir: string, now: () => Date): Trash;
62
62
  /** Moves `path` into `<state>/memory/trash/<time>-<name>`; the folder is the user's own (700). */
63
63
  export declare function keepInState(path: string, stateDir: string, at: Date): Promise<TrashResult>;
64
- /** The working folders of an Account's Live Sessions, or why sideby cannot tell which run. */
65
- export type LiveCwds = {
66
- cwds: string[];
64
+ /** One Live Session of an Account: where it works, and what sideby shows for it. */
65
+ export interface LiveRun {
66
+ cwd: string;
67
+ sessionId: string;
68
+ /** The session's title as `sideby sessions` shows it (`claudeSessionTitle`). */
69
+ title?: string;
70
+ }
71
+ /** An Account's Live Sessions, or why sideby cannot tell which run. */
72
+ export type LiveRuns = {
73
+ runs: LiveRun[];
67
74
  } | {
68
75
  unknown: string;
69
76
  };
70
77
  /**
71
- * The working folders of a Claude Account's Live Sessions, from Claude Code's `sessions/<pid>.json` files and the
72
- * process list. It fails closed: a record of a running process that cannot be read (one Claude Code is rewriting),
78
+ * A Claude Account's Live Sessions (working folder, session id, title), from Claude Code's `sessions/<pid>.json` files
79
+ * and the process list. It fails closed: a record of a running process that cannot be read (one Claude Code is rewriting),
73
80
  * lacks its session id, working folder or start time, or a process list that cannot be read, means sideby cannot
74
81
  * tell which Projects are in use, so the Fix moves nothing of that Account. Only a record whose process is gone, or
75
82
  * whose pid now belongs to another process (its start time differs), counts as ended.
76
83
  */
77
- export declare function claudeLiveCwds(account: Account, procs: ProcessView): Promise<LiveCwds>;
78
- /** The names of the session folders a Live Session in each of `cwds` uses for memory (its Project, and itself). */
79
- export declare function liveProjects(cwds: readonly string[]): Promise<Set<string>>;
84
+ export declare function claudeLiveRuns(account: Account, procs: ProcessView): Promise<LiveRuns>;
85
+ /**
86
+ * The session folders each Live Session uses for memory (its Project, its own folder and that folder's real path),
87
+ * each with the sessions that work there.
88
+ */
89
+ export declare function liveProjects(runs: readonly LiveRun[]): Promise<Map<string, LiveRun[]>>;
80
90
  /** What folding one Project did. */
81
91
  export interface FoldOutcome {
82
92
  project: string;
@@ -155,8 +165,10 @@ export declare function readFolds(stateDir: string): Promise<FoldRecord[]>;
155
165
  export interface MemoryDoctorContext {
156
166
  mainDir: string;
157
167
  stateDir: string;
158
- /** The working folders of the Account's Live Sessions, or why sideby cannot tell (`claudeLiveCwds`). */
159
- liveCwds: (account: Account) => Promise<LiveCwds>;
168
+ /** The Account's Live Sessions, or why sideby cannot tell (`claudeLiveRuns`). Read again by every check and Fix. */
169
+ liveRuns: (account: Account) => Promise<LiveRuns>;
170
+ /** The Session Label of one of them (`cc002 · knip cleanup · 61230c3d`). */
171
+ label: (account: Account, run: LiveRun) => string;
160
172
  trash: Trash;
161
173
  now: () => Date;
162
174
  /** Shortens a path for a message (`~/…`). */
@@ -164,7 +176,11 @@ export interface MemoryDoctorContext {
164
176
  }
165
177
  /** Every Project of `account` with memory of its own, folded unless a Live Session of the Account works in it. */
166
178
  export declare function foldAccount(ctx: MemoryDoctorContext, account: Account): Promise<FixResult>;
167
- /** Doctor's check of one Claude Account that is not the Main Account (only while config `claude.shareMemory` is on). */
179
+ /**
180
+ * Doctor's check of one Claude Account that is not the Main Account (only while config `claude.shareMemory` is on).
181
+ * It reads the Account's Live Sessions to say which Projects wait for one, and offers no Fix when every Project waits
182
+ * or when it cannot tell which sessions run: the Fix would move nothing then.
183
+ */
168
184
  export declare function memoryFindings(ctx: MemoryDoctorContext, account: Account): Promise<CheckResult[]>;
169
185
  /** The memory files an index links to (`memoryLink`); links to anything else are left out. */
170
186
  export declare function indexTargets(text: string): string[];
@@ -13,6 +13,7 @@ import { link, lstat, mkdir, open, readdir, realpath, rename, rm, rmdir, unlink,
13
13
  import { userInfo } from 'node:os';
14
14
  import { basename, dirname, extname, join, posix } from 'node:path';
15
15
  import { claudeProjectDirName } from '../families/claude/layout.js';
16
+ import { claudeSessionTitle } from '../families/claude/live-sessions.js';
16
17
  import { readSessionRecord, recordRunsOn, recordStart } from '../families/claude/session-files.js';
17
18
  import { trustRoot } from './claude-trust.js';
18
19
  import { assertInside, lstatOrNull, ownedFolder, readSmallFile, sha256, writeFileAtomic, writeIfUnchanged, } from './fs-safe.js';
@@ -186,13 +187,13 @@ export async function keepInState(path, stateDir, at) {
186
187
  }
187
188
  const PID_FILE = /^(\d+)\.json$/;
188
189
  /**
189
- * The working folders of a Claude Account's Live Sessions, from Claude Code's `sessions/<pid>.json` files and the
190
- * process list. It fails closed: a record of a running process that cannot be read (one Claude Code is rewriting),
190
+ * A Claude Account's Live Sessions (working folder, session id, title), from Claude Code's `sessions/<pid>.json` files
191
+ * and the process list. It fails closed: a record of a running process that cannot be read (one Claude Code is rewriting),
191
192
  * lacks its session id, working folder or start time, or a process list that cannot be read, means sideby cannot
192
193
  * tell which Projects are in use, so the Fix moves nothing of that Account. Only a record whose process is gone, or
193
194
  * whose pid now belongs to another process (its start time differs), counts as ended.
194
195
  */
195
- export async function claudeLiveCwds(account, procs) {
196
+ export async function claudeLiveRuns(account, procs) {
196
197
  const root = join(account.dir, 'sessions');
197
198
  let names;
198
199
  try {
@@ -200,19 +201,19 @@ export async function claudeLiveCwds(account, procs) {
200
201
  }
201
202
  catch (err) {
202
203
  if (err.code === 'ENOENT')
203
- return { cwds: [] };
204
+ return { runs: [] };
204
205
  return { unknown: `${root} cannot be read` };
205
206
  }
206
207
  const files = names.filter((n) => PID_FILE.test(n)).sort();
207
208
  if (!files.length)
208
- return { cwds: [] };
209
+ return { runs: [] };
209
210
  try {
210
211
  await procs.list();
211
212
  }
212
213
  catch (err) {
213
214
  return { unknown: `the running programs cannot be listed (${err.message})` };
214
215
  }
215
- const cwds = [];
216
+ const runs = [];
216
217
  for (const name of files) {
217
218
  const proc = await procs.get(Number(PID_FILE.exec(name)[1]));
218
219
  if (!proc)
@@ -230,21 +231,32 @@ export async function claudeLiveCwds(account, procs) {
230
231
  const id = typeof rec.sessionId === 'string' && rec.sessionId ? rec.sessionId : undefined;
231
232
  if (!cwd || !id)
232
233
  return { unknown: `${file} does not say which ${cwd ? 'session' : 'folder'} it runs` };
233
- cwds.push(cwd);
234
+ // Only for showing which session holds a Project: a title that cannot be read is left out.
235
+ const { title } = await claudeSessionTitle(account.dir, rec, id).catch(() => ({ title: undefined }));
236
+ runs.push({ cwd, sessionId: id, ...(title ? { title } : {}) });
234
237
  }
235
- return { cwds };
238
+ return { runs };
236
239
  }
237
- /** The names of the session folders a Live Session in each of `cwds` uses for memory (its Project, and itself). */
238
- export async function liveProjects(cwds) {
239
- const out = new Set();
240
- for (const cwd of cwds) {
241
- out.add(claudeProjectDirName(cwd));
242
- const real = await realpath(cwd).catch(() => null);
240
+ /**
241
+ * The session folders each Live Session uses for memory (its Project, its own folder and that folder's real path),
242
+ * each with the sessions that work there.
243
+ */
244
+ export async function liveProjects(runs) {
245
+ const out = new Map();
246
+ const add = (name, run) => {
247
+ const list = out.get(name) ?? [];
248
+ if (!list.includes(run))
249
+ list.push(run);
250
+ out.set(name, list);
251
+ };
252
+ for (const run of runs) {
253
+ add(claudeProjectDirName(run.cwd), run);
254
+ const real = await realpath(run.cwd).catch(() => null);
243
255
  if (real)
244
- out.add(claudeProjectDirName(real));
245
- const root = await trustRoot(cwd);
256
+ add(claudeProjectDirName(real), run);
257
+ const root = await trustRoot(run.cwd);
246
258
  if (root.kind !== 'unclear')
247
- out.add(claudeProjectDirName(root.path));
259
+ add(claudeProjectDirName(root.path), run);
248
260
  }
249
261
  return out;
250
262
  }
@@ -640,21 +652,41 @@ async function recordFolds(stateDir, add) {
640
652
  const folds = [...(await readFolds(stateDir)), ...add].slice(-MAX_RECORDS);
641
653
  await writeFileAtomic(join(dir, RECORDS), `${JSON.stringify({ version: 1, folds }, null, 2)}\n`, 0o600);
642
654
  }
655
+ const count = (n, word) => `${n} ${word}${n === 1 ? '' : 's'}`;
656
+ /** The first three of a list, then `…`. */
657
+ const firstOf = (xs) => `${xs.slice(0, 3).join(', ')}${xs.length > 3 ? ', …' : ''}`;
658
+ /** Which of `projects` wait for a Live Session of `account`, each as `<project> (<Session Label>, …)`; or why unknown. */
659
+ async function waitingProjects(ctx, account, projects) {
660
+ const running = await ctx
661
+ .liveRuns(account)
662
+ .catch((err) => ({ unknown: err.message || 'an error' }));
663
+ if ('unknown' in running)
664
+ return running;
665
+ const live = await liveProjects(running.runs);
666
+ const waiting = new Map();
667
+ for (const p of projects) {
668
+ const runs = live.get(p);
669
+ if (runs)
670
+ waiting.set(p, `${p} (${runs.map((r) => ctx.label(account, r)).join(', ')})`);
671
+ }
672
+ return { waiting };
673
+ }
643
674
  /** Every Project of `account` with memory of its own, folded unless a Live Session of the Account works in it. */
644
675
  export async function foldAccount(ctx, account) {
645
676
  const { list } = await accountMemories(account.dir);
646
677
  if (!list.length)
647
678
  return { ok: true, message: `${account.ref} keeps no memory of its own now` };
648
- const running = await ctx.liveCwds(account);
649
- if ('unknown' in running)
679
+ // Read again here, never taken from the check: a session may have started or ended since.
680
+ const live = await waitingProjects(ctx, account, list.map((m) => m.project));
681
+ if ('unknown' in live)
650
682
  return {
651
683
  ok: false,
652
- message: `sideby cannot tell which sessions of ${account.ref} are running (${ctx.show(running.unknown)}), so it moved nothing of ${account.ref}; run the fix again in a moment`,
684
+ message: `sideby cannot tell which sessions of ${account.ref} are running (${ctx.show(live.unknown)}), so it moved nothing of ${account.ref}; run the fix again in a moment`,
685
+ params: { form: 'unknown' },
653
686
  };
654
- const live = await liveProjects(running.cwds);
655
687
  const outcomes = [];
656
688
  for (const m of list) {
657
- if (live.has(m.project)) {
689
+ if (live.waiting.has(m.project)) {
658
690
  outcomes.push({
659
691
  project: m.project,
660
692
  status: 'skipped',
@@ -677,27 +709,41 @@ export async function foldAccount(ctx, account) {
677
709
  }))).catch(() => { });
678
710
  const parts = [];
679
711
  if (done.length)
680
- parts.push(`moved ${account.ref}'s memory of ${done.length} ${done.length === 1 ? 'project' : 'projects'} into the main account`);
712
+ parts.push(`moved ${account.ref}'s memory of ${count(done.length, 'project')} into the main account`);
681
713
  const kept = outcomes.flatMap((o) => o.renamed);
682
714
  if (kept.length)
683
- parts.push(`kept ${kept.length} ${kept.length === 1 ? 'file' : 'files'} that differed under a new name (${kept
684
- .slice(0, 3)
685
- .map((r) => r.to)
686
- .join(', ')}${kept.length > 3 ? ', …' : ''})`);
715
+ parts.push(`kept ${count(kept.length, 'file')} that differed under a new name (${firstOf(kept.map((r) => r.to))})`);
687
716
  const where = [...new Set(done.map((o) => o.trashed).filter((t) => !!t))];
688
717
  if (where.length)
689
- parts.push(`the emptied folders went to ${where.map((w) => ctx.show(w)).join(', ')}`);
690
- const skipped = outcomes.filter((o) => o.status === 'skipped');
691
- if (skipped.length)
692
- parts.push(`left ${skipped.length} ${skipped.length === 1 ? 'project' : 'projects'} while a session of ${account.ref} works there (${skipped
693
- .map((o) => o.project)
694
- .join(', ')}); run the fix again once it ends`);
718
+ parts.push(`the moved files went to ${where.map((w) => ctx.show(w)).join(', ')}`);
719
+ const waits = [...live.waiting.values()];
720
+ if (waits.length)
721
+ parts.push(`left ${count(waits.length, 'project')} while a session of ${account.ref} works there: ${waits.join(', ')}; run the fix again once it ends`);
695
722
  const failed = outcomes.filter((o) => o.status === 'failed' || o.status === 'partial');
696
723
  for (const f of failed)
697
724
  parts.push(`${f.project}: ${ctx.show(f.why ?? 'not moved')}`);
698
- return { ok: failed.length === 0, message: parts.join('; ') || `nothing to move for ${account.ref}` };
725
+ const message = parts.join('; ') || `nothing to move for ${account.ref}`;
726
+ if (failed.length)
727
+ return {
728
+ ok: false,
729
+ message,
730
+ params: {
731
+ form: 'some',
732
+ n: list.length,
733
+ moved: done.length - failed.filter((f) => f.status === 'partial').length,
734
+ left: firstOf(outcomes.filter((o) => o.status !== 'moved' && o.status !== 'merged').map((o) => o.project)),
735
+ },
736
+ };
737
+ // Every Project waits for a session: nothing was fixed, and the Panel says which sessions to wait for.
738
+ if (!done.length && waits.length)
739
+ return { ok: false, message, params: { form: 'waiting', waiting: waits.join(', ') } };
740
+ return { ok: true, message };
699
741
  }
700
- /** Doctor's check of one Claude Account that is not the Main Account (only while config `claude.shareMemory` is on). */
742
+ /**
743
+ * Doctor's check of one Claude Account that is not the Main Account (only while config `claude.shareMemory` is on).
744
+ * It reads the Account's Live Sessions to say which Projects wait for one, and offers no Fix when every Project waits
745
+ * or when it cannot tell which sessions run: the Fix would move nothing then.
746
+ */
701
747
  export async function memoryFindings(ctx, account) {
702
748
  if (account.family !== 'claude' || account.isMain)
703
749
  return [];
@@ -706,15 +752,44 @@ export async function memoryFindings(ctx, account) {
706
752
  if (list.length) {
707
753
  const files = list.reduce((n, m) => n + m.files, 0);
708
754
  const names = list.map((m) => m.project);
709
- out.push({
710
- level: 'warn',
711
- item: 'projects/*/memory',
712
- code: 'memory.unfolded',
713
- message: `${account.ref} keeps its own memory for ${list.length} ${list.length === 1 ? 'project' : 'projects'} (${files} ${files === 1 ? 'file' : 'files'}) that your other Claude accounts do not see: ${names.slice(0, 3).join(', ')}${names.length > 3 ? ', …' : ''}`,
714
- hint: `\`sideby doctor ${account.ref} --fix\` moves it into the main account (shared memory is on); a file that differs is kept beside the main one under a new name, and emptied folders go to the trash`,
715
- fixable: true,
716
- fix: () => foldAccount(ctx, account),
717
- });
755
+ const n = list.length;
756
+ const base = `${account.ref} keeps its own memory for ${count(n, 'project')} (${count(files, 'file')}) that your other Claude accounts do not see`;
757
+ const finding = { level: 'warn', item: 'projects/*/memory', code: 'memory.unfolded' };
758
+ const live = await waitingProjects(ctx, account, names);
759
+ if ('unknown' in live)
760
+ out.push({
761
+ ...finding,
762
+ message: `${base}: ${firstOf(names)}; sideby cannot tell which sessions of ${account.ref} are running right now (${ctx.show(live.unknown)}), so it offers no fix yet`,
763
+ hint: `check again in a moment (\`sideby doctor ${account.ref}\`); sideby moves the memory once it can tell which sessions run. Do not move memory files by hand`,
764
+ params: { form: 'unknown', n, projects: firstOf(names) },
765
+ fixable: false,
766
+ });
767
+ else if (live.waiting.size === n) {
768
+ const waits = [...live.waiting.values()].join(', ');
769
+ out.push({
770
+ ...finding,
771
+ message: `${base}, but a session of ${account.ref} works in ${n === 1 ? 'it' : 'each of them'}: ${waits}; it moves once ${n === 1 ? 'that session ends' : 'those sessions end'}`,
772
+ hint: `wait until ${n === 1 ? 'that session ends' : 'those sessions end'}, then run \`sideby doctor ${account.ref} --fix\` (or Fix all in the Panel); do not move memory files by hand`,
773
+ params: { form: 'waiting', n, waiting: waits },
774
+ fixable: false,
775
+ });
776
+ }
777
+ else {
778
+ const ready = n - live.waiting.size;
779
+ const waits = [...live.waiting.values()].join(', ');
780
+ out.push({
781
+ ...finding,
782
+ message: live.waiting.size
783
+ ? `${base}: ${firstOf(names)}; the fix moves ${count(ready, 'project')} now, and these wait until their session ends: ${waits}`
784
+ : `${base}: ${firstOf(names)}`,
785
+ hint: `\`sideby doctor ${account.ref} --fix\` moves it into the main account (shared memory is on); a file that differs is kept beside the main one under a new name, and the moved files go to the trash${live.waiting.size ? '; run it again for the projects that wait once their session ends' : ''}`,
786
+ params: live.waiting.size
787
+ ? { form: 'some', n, ready, waiting: waits }
788
+ : { n, projects: firstOf(names) },
789
+ fixable: true,
790
+ fix: () => foldAccount(ctx, account),
791
+ });
792
+ }
718
793
  }
719
794
  for (const l of links)
720
795
  out.push({
@@ -723,6 +798,7 @@ export async function memoryFindings(ctx, account) {
723
798
  code: 'memory.link',
724
799
  message: `${ctx.show(l)} is a link; Claude Code refuses memory writes through a link, and sideby does not follow it`,
725
800
  hint: 'replace the link with a real folder (move its files into the main account first), then run `sideby doctor --fix`',
801
+ params: { path: ctx.show(l) },
726
802
  fixable: false,
727
803
  });
728
804
  return out;
@@ -868,6 +944,7 @@ export async function mainMemoryFindings(ctx, accounts) {
868
944
  code: 'memory.index',
869
945
  message: `the memory index (MEMORY.md) of ${bad.length} ${bad.length === 1 ? 'project' : 'projects'} in the main account does not match its files: ${bad.slice(0, 3).map(say).join(', ')}${bad.length > 3 ? ', …' : ''}`,
870
946
  hint: 'Claude reads only what MEMORY.md lists. Ask Claude in that project to tidy its memory index, or edit MEMORY.md in that folder; two accounts writing at the same moment can overwrite it',
947
+ params: { n: bad.length, projects: firstOf(bad.map((p) => p.project)) },
871
948
  source: 'core',
872
949
  fixable: false,
873
950
  });
@@ -882,6 +959,7 @@ export async function mainMemoryFindings(ctx, accounts) {
882
959
  code: 'memory.name-mismatch',
883
960
  message: `Claude Code named the folder of ${ctx.show(first.cwd)} "${first.folder}" (${first.account}), but sideby would name it "${first.derived}"${odd.length > 1 ? ` (and ${odd.length - 1} more)` : ''}: Claude Code may have changed how it names project folders, so shared memory may land in another folder than Claude Code's own`,
884
961
  hint: 'turn shared memory off with `sideby memory off --yes` until sideby is updated (`sideby update`); the memory already in the main account stays',
962
+ params: { path: ctx.show(first.cwd), folder: first.folder, derived: first.derived },
885
963
  source: 'core',
886
964
  fixable: false,
887
965
  });
@@ -1,5 +1,5 @@
1
1
  import type { HookBus } from '../plugins/bus.ts';
2
- import type { Account, CheckResult, FamilyDef, Finding, LoginProblem } from '../types.ts';
2
+ import type { Account, CheckResult, FamilyDef, Finding, FindingParams, LoginProblem } from '../types.ts';
3
3
  export interface AccountReport {
4
4
  ref: string;
5
5
  family: string;
@@ -19,6 +19,7 @@ export interface FixOutcome {
19
19
  code: string;
20
20
  ok: boolean;
21
21
  message: string;
22
+ params?: FindingParams;
22
23
  }
23
24
  export interface DoctorReport {
24
25
  status: 'ok' | 'issues';
@@ -1,5 +1,6 @@
1
1
  import type { LiveSessionStatus } from '../../core/live-sessions.ts';
2
2
  import type { LiveSessionReader } from '../live-sessions.ts';
3
+ import { type SessionRecord } from './session-files.ts';
3
4
  /** Claude Code's `status`: `busy` and `shell` run, `idle` waits for a prompt, a blocked one waits for the user. */
4
5
  export declare function claudeStatus(s: unknown): LiveSessionStatus;
5
6
  /**
@@ -17,4 +18,12 @@ export declare const claudeTranscript: (dir: string, cwd: string, id: string) =>
17
18
  * into a result. Remembered until the file changes.
18
19
  */
19
20
  export declare function claudeAiTitle(transcript: string): Promise<string | undefined>;
21
+ /**
22
+ * A running session's transcript (when it is there) and the title sideby shows for it: a name the user gave (`/rename`,
23
+ * `-n`), else Claude Code's own title, else a derived name (`<dir>-3f`), else the folder's name. Never throws.
24
+ */
25
+ export declare function claudeSessionTitle(accountDir: string, rec: SessionRecord, sessionId: string): Promise<{
26
+ title?: string;
27
+ transcript?: string;
28
+ }>;
20
29
  export declare const claudeLiveSessions: LiveSessionReader;
@@ -6,7 +6,7 @@ import { basename, join } from 'node:path';
6
6
  import { statOrNull } from '../../core/fs-safe.js';
7
7
  import { isoOf } from '../../core/live-sessions-procs.js';
8
8
  import { claudeProjectDirName } from './layout.js';
9
- import { readSessionRecord, recordRunsOn, recordStart, tailLinesWith } from './session-files.js';
9
+ import { readSessionRecord, recordRunsOn, recordStart, tailLinesWith, } from './session-files.js';
10
10
  const PID_FILE = /^(\d+)\.json$/;
11
11
  /** Claude Code's `status`: `busy` and `shell` run, `idle` waits for a prompt, a blocked one waits for the user. */
12
12
  export function claudeStatus(s) {
@@ -69,6 +69,19 @@ export async function claudeAiTitle(transcript) {
69
69
  titleMemo.set(transcript, { sig, title });
70
70
  return title;
71
71
  }
72
+ /**
73
+ * A running session's transcript (when it is there) and the title sideby shows for it: a name the user gave (`/rename`,
74
+ * `-n`), else Claude Code's own title, else a derived name (`<dir>-3f`), else the folder's name. Never throws.
75
+ */
76
+ export async function claudeSessionTitle(accountDir, rec, sessionId) {
77
+ const cwd = str(rec.cwd);
78
+ const candidate = cwd ? claudeTranscript(accountDir, cwd, sessionId) : undefined;
79
+ const transcript = candidate && (await statOrNull(candidate).catch(() => null)) ? candidate : undefined;
80
+ const named = rec.nameSource !== 'derived' ? str(rec.name) : undefined;
81
+ const aiTitle = named || !transcript ? undefined : await claudeAiTitle(transcript).catch(() => undefined);
82
+ const title = named ?? aiTitle ?? str(rec.name) ?? (cwd ? basename(cwd) : undefined);
83
+ return { ...(title ? { title } : {}), ...(transcript ? { transcript } : {}) };
84
+ }
72
85
  export const claudeLiveSessions = {
73
86
  family: 'claude',
74
87
  async read(account, procs, problems) {
@@ -109,12 +122,7 @@ export const claudeLiveSessions = {
109
122
  if (!recordRunsOn(rec, proc))
110
123
  continue;
111
124
  const cwd = str(rec.cwd);
112
- const candidate = cwd ? claudeTranscript(account.dir, cwd, sessionId) : undefined;
113
- const transcript = candidate && (await statOrNull(candidate)) ? candidate : undefined;
114
- // A name the user gave (`/rename`, `-n`) wins; a derived one (`<dir>-3f`) loses to Claude Code's own title.
115
- const named = rec.nameSource !== 'derived' ? str(rec.name) : undefined;
116
- const aiTitle = named || !transcript ? undefined : await claudeAiTitle(transcript).catch(() => undefined);
117
- const title = named ?? aiTitle ?? str(rec.name) ?? (cwd ? basename(cwd) : undefined);
125
+ const { title, transcript } = await claudeSessionTitle(account.dir, rec, sessionId);
118
126
  const startedFrom = claudeStartedFrom(rec.entrypoint);
119
127
  out.push({
120
128
  sessionId,
@@ -432,6 +432,21 @@ declare const en: {
432
432
  'finding.extra-check.error': string;
433
433
  'finding.fixHint': string;
434
434
  'finding.raw': string;
435
+ 'finding.memory.unfolded.one': string;
436
+ 'finding.memory.unfolded.other': string;
437
+ 'finding.memory.unfolded.some': string;
438
+ 'finding.memory.unfolded.waiting.one': string;
439
+ 'finding.memory.unfolded.waiting.other': string;
440
+ 'finding.memory.unfolded.unknown.one': string;
441
+ 'finding.memory.unfolded.unknown.other': string;
442
+ 'finding.memory.link': string;
443
+ 'finding.memory.index.one': string;
444
+ 'finding.memory.index.other': string;
445
+ 'finding.memory.name-mismatch': string;
446
+ 'fixres.memory.unfolded.unknown': string;
447
+ 'fixres.memory.unfolded.waiting': string;
448
+ 'fixres.memory.unfolded.some.one': string;
449
+ 'fixres.memory.unfolded.some.other': string;
435
450
  'win.5h': string;
436
451
  'win.7d': string;
437
452
  'win.5h.short': string;
@@ -434,6 +434,21 @@ const en = {
434
434
  'finding.extra-check.error': 'An extra check could not finish.',
435
435
  'finding.fixHint': 'Click Fix all to fix it.',
436
436
  'finding.raw': 'Details',
437
+ 'finding.memory.unfolded.one': 'This account keeps its own memory for 1 project that your other Claude accounts do not see: {projects}.',
438
+ 'finding.memory.unfolded.other': 'This account keeps its own memory for {n} projects that your other Claude accounts do not see: {projects}.',
439
+ 'finding.memory.unfolded.some': 'This account keeps its own memory for {n} projects. Fix all moves {ready} of them into the main account now; these wait until their session ends: {waiting}.',
440
+ 'finding.memory.unfolded.waiting.one': 'This account keeps its own memory for 1 project, but a session of this account is working there. Fix it after that session ends: {waiting}.',
441
+ 'finding.memory.unfolded.waiting.other': 'This account keeps its own memory for {n} projects, but sessions of this account are working in each of them. Fix them after those sessions end: {waiting}.',
442
+ 'finding.memory.unfolded.unknown.one': 'This account keeps its own memory for 1 project ({projects}), but sideby cannot tell right now which of its sessions are running, so it does not move it yet. Run the check again in a moment.',
443
+ 'finding.memory.unfolded.unknown.other': 'This account keeps its own memory for {n} projects ({projects}), but sideby cannot tell right now which of its sessions are running, so it does not move them yet. Run the check again in a moment.',
444
+ 'finding.memory.link': '{path} is a link. Claude Code does not write memory through a link, and sideby does not follow it; replace it with a real folder.',
445
+ 'finding.memory.index.one': 'The memory index (MEMORY.md) of 1 project in the main account does not match its files: {projects}. Claude reads only what MEMORY.md lists; ask Claude in that project to tidy its memory index.',
446
+ 'finding.memory.index.other': 'The memory index (MEMORY.md) of {n} projects in the main account does not match their files: {projects}. Claude reads only what MEMORY.md lists; ask Claude in each project to tidy its memory index.',
447
+ 'finding.memory.name-mismatch': 'Claude Code named the project folder of {path} "{folder}", but sideby would name it "{derived}". Claude Code may have changed how it names project folders; turn shared memory off until you update sideby.',
448
+ 'fixres.memory.unfolded.unknown': 'sideby cannot tell which sessions of this account are running, so it moved nothing. Try again in a moment.',
449
+ 'fixres.memory.unfolded.waiting': 'Nothing moved: sessions of this account are still working in these projects. Fix them after those sessions end: {waiting}.',
450
+ 'fixres.memory.unfolded.some.one': 'The project could not be moved fully into the main account and stays in this account for now: {left}.',
451
+ 'fixres.memory.unfolded.some.other': 'Moved {moved} of {n} projects into the main account; these stay in this account for now: {left}.',
437
452
  'win.5h': '5-hour',
438
453
  'win.7d': 'Weekly',
439
454
  'win.5h.short': '5-hour',
@@ -2266,6 +2281,21 @@ const zh = {
2266
2281
  'finding.extra-check.error': '有一项额外检查没能完成。',
2267
2282
  'finding.fixHint': '点「全部修复」就能修好。',
2268
2283
  'finding.raw': '详情',
2284
+ 'finding.memory.unfolded.one': '这个账号有 1 个项目的记忆只存在自己这里,其他 Claude 账号看不到:{projects}。',
2285
+ 'finding.memory.unfolded.other': '这个账号有 {n} 个项目的记忆只存在自己这里,其他 Claude 账号看不到:{projects}。',
2286
+ 'finding.memory.unfolded.some': '这个账号有 {n} 个项目的记忆还没移进主账号。「全部修复」现在移 {ready} 个;这些要等会话结束后再修复:{waiting}。',
2287
+ 'finding.memory.unfolded.waiting.one': '这个账号有 1 个项目的记忆还没移进主账号,但这个账号有会话正在里面运行。等这些会话结束后再修复:{waiting}。',
2288
+ 'finding.memory.unfolded.waiting.other': '这个账号有 {n} 个项目的记忆还没移进主账号,但这个账号有会话正在这些项目里运行。等这些会话结束后再修复:{waiting}。',
2289
+ 'finding.memory.unfolded.unknown.one': '这个账号有 1 个项目的记忆还没移进主账号({projects}),但 sideby 现在看不出这个账号有哪些会话在运行,所以先不移。稍后再运行检查。',
2290
+ 'finding.memory.unfolded.unknown.other': '这个账号有 {n} 个项目的记忆还没移进主账号({projects}),但 sideby 现在看不出这个账号有哪些会话在运行,所以先不移。稍后再运行检查。',
2291
+ 'finding.memory.link': '{path} 是一个链接。Claude Code 不会通过链接写记忆,sideby 也不会跟着链接走;请把它换成真正的文件夹。',
2292
+ 'finding.memory.index.one': '主账号里 1 个项目的记忆索引(MEMORY.md)和文件对不上:{projects}。Claude 只读 MEMORY.md 里列出的记忆;可以在那个项目里让 Claude 整理记忆索引。',
2293
+ 'finding.memory.index.other': '主账号里 {n} 个项目的记忆索引(MEMORY.md)和文件对不上:{projects}。Claude 只读 MEMORY.md 里列出的记忆;可以在这些项目里让 Claude 整理记忆索引。',
2294
+ 'finding.memory.name-mismatch': 'Claude Code 给 {path} 起的项目文件夹名是「{folder}」,但 sideby 会起名为「{derived}」。Claude Code 可能改了起名方式;更新 sideby 之前先关掉共享记忆。',
2295
+ 'fixres.memory.unfolded.unknown': 'sideby 看不出这个账号有哪些会话在运行,所以什么都没移。稍后再试。',
2296
+ 'fixres.memory.unfolded.waiting': '什么都没移:这个账号还有会话在这些项目里运行。等这些会话结束后再修复:{waiting}。',
2297
+ 'fixres.memory.unfolded.some.one': '这个项目没能完整移进主账号,暂时留在这个账号:{left}。',
2298
+ 'fixres.memory.unfolded.some.other': '{n} 个项目里已有 {moved} 个移进主账号;这些暂时留在这个账号:{left}。',
2269
2299
  'win.5h': '5 小时额度',
2270
2300
  'win.7d': '每周额度',
2271
2301
  'win.5h.short': '5 小时',
@@ -342,6 +342,18 @@ export declare function runCodeSwap(io: {
342
342
  fail: (error: unknown) => void;
343
343
  unknown: () => void;
344
344
  }): Promise<void>;
345
+ /**
346
+ * The plain sentence the Panel shows for a Finding, or for a Fix result with `prefix` `fixres.`: the message of
347
+ * `<prefix><code>`, `.<params.form>` added when the check names a variant and `.one`/`.other` by `params.n` when the
348
+ * message has both, in `table` (the Panel's language) or else in English, with `{item}` and every param put in. Empty
349
+ * when English has no message for it, or the Finding lacks a value the message needs (one saved by an older sideby):
350
+ * the check's own text is shown then.
351
+ */
352
+ export declare function findingSentence(f: {
353
+ code: string;
354
+ item?: string;
355
+ params?: Record<string, string | number>;
356
+ }, table: Record<string, string>, en: Record<string, string>, prefix?: string): string;
345
357
  export declare function panelFixes(f: {
346
358
  code?: string;
347
359
  }, skillUpdatable: boolean): boolean;
@@ -698,6 +698,30 @@ export async function runCodeSwap(io) {
698
698
  await io.readState();
699
699
  }
700
700
  }
701
+ /**
702
+ * The plain sentence the Panel shows for a Finding, or for a Fix result with `prefix` `fixres.`: the message of
703
+ * `<prefix><code>`, `.<params.form>` added when the check names a variant and `.one`/`.other` by `params.n` when the
704
+ * message has both, in `table` (the Panel's language) or else in English, with `{item}` and every param put in. Empty
705
+ * when English has no message for it, or the Finding lacks a value the message needs (one saved by an older sideby):
706
+ * the check's own text is shown then.
707
+ */
708
+ export function findingSentence(f, table, en, prefix = 'finding.') {
709
+ const params = f.params || {};
710
+ const base = prefix + f.code + (params.form ? `.${params.form}` : '');
711
+ const key = Object.hasOwn(en, `${base}.one`) ? `${base}.${Number(params.n) === 1 ? 'one' : 'other'}` : base;
712
+ if (!Object.hasOwn(en, key))
713
+ return '';
714
+ const text = Object.hasOwn(table, key) ? table[key] : en[key];
715
+ const vars = { item: f.item ?? '', ...params };
716
+ let missing = false;
717
+ const out = text.replace(/\{(\w+)\}/g, (m, k) => {
718
+ if (Object.hasOwn(vars, k))
719
+ return String(vars[k]);
720
+ missing = true;
721
+ return m;
722
+ });
723
+ return missing ? '' : out;
724
+ }
701
725
  export function panelFixes(f, skillUpdatable) {
702
726
  return skillUpdatable && f.code === 'skill.outdated';
703
727
  }
@@ -6,7 +6,7 @@ import { groupsToAccept } from '../core/inbound.js';
6
6
  import { limitResetOffer, quotaAge, quotaIsStale, windowAge } from '../core/quota-levels.js';
7
7
  import { remoteControlTodo } from '../core/remote-control.js';
8
8
  import { catalogMatchLevel, catalogNorm, searchCatalog } from '../core/search-catalog.js';
9
- import { accountTitle, advisorPick, advisorSummary, aiTaskAccounts, aliasArgsOf, aliasIssue, aliasPrefix, askBridge, askBridged, askCopy, askPermissionNote, attentionReasons, attentionWhy, autostartNote, bindingWindow, cacheHitRate, canLeaveLocal, categoryOrder, codeSwapOutcome, dateFormatter, dotsKeepKeyboard, enableOutcome, expiredLogins, fileSize, fixPrompt, foldSkips, foldToolCalls, formatDuration, handoffChangeOf, handoffHintAccount, handoffTaskFacts, hiddenIn, highlightParts, histFilters, historyEmpty, historyRowSig, historyWhen, historyWhenNext, hotkeyFromKey, hotkeyPressKind, inDisplayOrder, loginClusters, loginKey, longWindow, maskEmail, matchesQuery, mdBlocks, mdInline, menuPlacement, mergeDaily, mergeUsage, messageChip, messageNews, messageToCheck, networkTaskFacts, newAccountDir, nextReset, openBridge, openBridged, orderedAliases, panelFixes, panelHint, panelLang, panelMigration, panelPrefs, passedWindow, pinnedIn, portalRefresh, quotaAskable, quotaHighLevel, quotaPressure, radioStep, reloadForBuild, remoteControlSummary, reorder, resetWhen, rowBadge, runCodeSwap, saveHandoffChange, sendBlock, sendFileProblem, sendResultView, sessionAge, sessionLabelParts, sessionRowShape, shortCwd, shortSessionLabel, sortAccounts, sortMenu, sortSessions, startedFromView, steadyOrder, stripSecrets, suggestAlias, suggestName, switchFailure, tailInView, taskFindings, toastMerge, uaDayRuns, uaGroupByProject, uaGroupPending, uaOnChoices, uaParseClock, uaPickTime, uaSameSlot, uaShouldRead, uaSlotNight, uaStatusParts, uaStepClock, uaToggleDay, uaWaitingCount, uaWhen, updatedAge, vendorAlias, widthFollower, widthTier, windowState, withPinned, } from './page-logic.js';
9
+ import { accountTitle, advisorPick, advisorSummary, aiTaskAccounts, aliasArgsOf, aliasIssue, aliasPrefix, askBridge, askBridged, askCopy, askPermissionNote, attentionReasons, attentionWhy, autostartNote, bindingWindow, cacheHitRate, canLeaveLocal, categoryOrder, codeSwapOutcome, dateFormatter, dotsKeepKeyboard, enableOutcome, expiredLogins, fileSize, findingSentence, fixPrompt, foldSkips, foldToolCalls, formatDuration, handoffChangeOf, handoffHintAccount, handoffTaskFacts, hiddenIn, highlightParts, histFilters, historyEmpty, historyRowSig, historyWhen, historyWhenNext, hotkeyFromKey, hotkeyPressKind, inDisplayOrder, loginClusters, loginKey, longWindow, maskEmail, matchesQuery, mdBlocks, mdInline, menuPlacement, mergeDaily, mergeUsage, messageChip, messageNews, messageToCheck, networkTaskFacts, newAccountDir, nextReset, openBridge, openBridged, orderedAliases, panelFixes, panelHint, panelLang, panelMigration, panelPrefs, passedWindow, pinnedIn, portalRefresh, quotaAskable, quotaHighLevel, quotaPressure, radioStep, reloadForBuild, remoteControlSummary, reorder, resetWhen, rowBadge, runCodeSwap, saveHandoffChange, sendBlock, sendFileProblem, sendResultView, sessionAge, sessionLabelParts, sessionRowShape, shortCwd, shortSessionLabel, sortAccounts, sortMenu, sortSessions, startedFromView, steadyOrder, stripSecrets, suggestAlias, suggestName, switchFailure, tailInView, taskFindings, toastMerge, uaDayRuns, uaGroupByProject, uaGroupPending, uaOnChoices, uaParseClock, uaPickTime, uaSameSlot, uaShouldRead, uaSlotNight, uaStatusParts, uaStepClock, uaToggleDay, uaWaitingCount, uaWhen, updatedAge, vendorAlias, widthFollower, widthTier, windowState, withPinned, } from './page-logic.js';
10
10
  // The component library's dropdown menu, copied by the brand repo's add script (--html into ui/); do not edit it.
11
11
  import { CHECK, menuItem, menuScript } from './ui/dropdown-menu/dropdown-menu.html.js';
12
12
  import { cn, esc } from './ui/lib/cn.js';
@@ -82,6 +82,7 @@ const LOGIC = [
82
82
  dateFormatter,
83
83
  runCodeSwap,
84
84
  switchFailure,
85
+ findingSentence,
85
86
  panelFixes,
86
87
  panelHint,
87
88
  panelLang,
@@ -3286,9 +3287,9 @@ const MAIN = String.raw `
3286
3287
  // A Finding in plain words (its code's sentence); the check's own text goes under "Details".
3287
3288
  function findingRow(f) {
3288
3289
  const own = panelFixes(f, skillFixable())
3289
- const key = 'finding.' + f.code
3290
- const plain = Object.hasOwn(MESSAGES.en, key) ? t(key, { item: f.item }) : ''
3291
- const fixHere = plain && f.fixable && !BOOT.readOnly && !own
3290
+ const plain = findingSentence(f, MESSAGES[lang] || {}, MESSAGES.en)
3291
+ // A finding whose sentence says some of it waits (Shared Project Memory) already says what Fix all does now.
3292
+ const fixHere = plain && f.fixable && !BOOT.readOnly && !own && !(f.params && f.params.waiting)
3292
3293
  return h('li', { class: 'finding lvl-' + f.level },
3293
3294
  h('span', { class: 'dot', title: f.level }),
3294
3295
  h('div', { class: 'finding-body' },
@@ -3305,6 +3306,12 @@ const MAIN = String.raw `
3305
3306
  // The check's own words (and any command to run) stay one click away.
3306
3307
  plain ? h('details', { class: 'finding-raw' }, h('summary', null, t('finding.raw')), h('p', { class: 'mono small' }, f.message), f.hint ? h('p', { class: 'mono small' }, f.hint) : null) : null))
3307
3308
  }
3309
+ // A Fix that did not fix: its plain sentence when the check gave one, the check's own words one click away.
3310
+ function fixLine(f) {
3311
+ const plain = findingSentence(f, MESSAGES[lang] || {}, MESSAGES.en, 'fixres.')
3312
+ return h('li', null, h('b', null, f.account + ' · ' + f.item + colon()), plain || f.message,
3313
+ plain ? h('details', { class: 'finding-raw' }, h('summary', null, t('finding.raw')), h('p', { class: 'mono small' }, f.message)) : null)
3314
+ }
3308
3315
  function renderCheckup() {
3309
3316
  const box = $('checkup')
3310
3317
  // With no account there is nothing to check: the empty state is the only thing to do.
@@ -3347,7 +3354,7 @@ const MAIN = String.raw `
3347
3354
  const failed = S.fixes.filter((f) => !f.ok)
3348
3355
  out.push(h('div', { class: 'fix-result ' + (failed.length ? 'is-warn' : 'is-ok'), role: 'status' },
3349
3356
  S.fixes.length ? t('fix.result', { ok: S.fixes.length - failed.length, n: S.fixes.length }) : t('fix.nothing'),
3350
- failed.length ? h('ul', null, failed.map((f) => h('li', null, h('b', null, f.account + ' · ' + f.item + colon()), f.message))) : null))
3357
+ failed.length ? h('ul', null, failed.map(fixLine)) : null))
3351
3358
  }
3352
3359
  if (!findings) {
3353
3360
  if (busy || !S.state) out.push(h('span', { class: 'sk sk-line w70' }), h('span', { class: 'sk sk-line w50' }))
@@ -1,6 +1,6 @@
1
1
  import { type AccountRefError } from './core/accounts.ts';
2
2
  import { type AdvisorChange, type AdvisorChoice, type AdvisorSeen, type AdvisorStatus } from './core/advisor.ts';
3
- import { type FoldRecord, type LiveCwds, type MemoryStatus, type Trash } from './core/claude-memory.ts';
3
+ import { type FoldRecord, type LiveRuns, type MemoryStatus, type Trash } from './core/claude-memory.ts';
4
4
  import { type TrustStatus, type UndoItem } from './core/claude-trust.ts';
5
5
  import { type Config, type DisplayConfig, type HandoffSettings } from './core/config.ts';
6
6
  import { type CreateResult } from './core/create.ts';
@@ -572,7 +572,7 @@ export declare function createRuntime(opts?: {
572
572
  * memory folder it emptied (spec §3.44). Omitted, the Claude session files with `ps`, and the system trash.
573
573
  */
574
574
  memory?: {
575
- liveCwds?: (account: Account) => Promise<LiveCwds>;
575
+ liveRuns?: (account: Account) => Promise<LiveRuns>;
576
576
  trash?: Trash;
577
577
  };
578
578
  }): Promise<Runtime>;
@@ -1,7 +1,7 @@
1
1
  // The one service layer the CLI and the Panel share. Frozen contract for v0.1 (plan: 审核修订).
2
2
  import { aliasesByAccount, discoverAccounts, mainDirOf, resolveRef, startArgsOf, } from './core/accounts.js';
3
3
  import { advisorStatus, checkAdvisorAccount, setAdvisor, setAdvisorUnlock, undoAdvisor, } from './core/advisor.js';
4
- import { claudeLiveCwds, mainMemoryFindings, memoryFindings, memoryHookPart, memorySettingsLine, memorySkipLine, memoryStatus, memoryTarget, readFolds, systemTrash, } from './core/claude-memory.js';
4
+ import { claudeLiveRuns, mainMemoryFindings, memoryFindings, memoryHookPart, memorySettingsLine, memorySkipLine, memoryStatus, memoryTarget, readFolds, systemTrash, } from './core/claude-memory.js';
5
5
  import { carryLine, carryTrust, trustStatus, undoCarries, } from './core/claude-trust.js';
6
6
  import { addConfigAlias, addConfigPickCommand, aiTaskPermissions, aliasAccount, aliasArgs, aliasProblem, aliasRefs, editConfigClaude, editConfigDisplay, editConfigQuotaCheck, handoffSettings, loadConfig, removeConfigAlias, removeConfigPickCommand, } from './core/config.js';
7
7
  import { createAccount } from './core/create.js';
@@ -230,18 +230,23 @@ export async function createRuntime(opts = {}) {
230
230
  return memoryHookPart(t.dir);
231
231
  };
232
232
  /** What Doctor's Shared Project Memory check and Fix use (spec §3.44, ADR-0081). */
233
- const memoryCtx = () => ({
234
- mainDir: claudeMainDir(),
235
- stateDir: paths.stateDir,
236
- liveCwds: opts.memory?.liveCwds ??
237
- (async (a) => {
238
- const { processView, systemDeps } = await import('./core/live-sessions-procs.js');
239
- return claudeLiveCwds(a, processView(systemDeps(env)));
240
- }),
241
- trash: opts.memory?.trash ?? systemTrash(env, paths.stateDir, now),
242
- now,
243
- show: (p) => p.split(`${paths.home}/`).join('~/'),
244
- });
233
+ const memoryCtx = async () => {
234
+ const { accountLabels, sessionLabel } = await import('./core/live-sessions.js');
235
+ const labels = accountLabels(rt, await accounts());
236
+ return {
237
+ mainDir: claudeMainDir(),
238
+ stateDir: paths.stateDir,
239
+ liveRuns: opts.memory?.liveRuns ??
240
+ (async (a) => {
241
+ const { processView, systemDeps } = await import('./core/live-sessions-procs.js');
242
+ return claudeLiveRuns(a, processView(systemDeps(env)));
243
+ }),
244
+ label: (a, run) => sessionLabel(labels.get(a.ref) ?? a.ref, run.title ?? '', run.sessionId),
245
+ trash: opts.memory?.trash ?? systemTrash(env, paths.stateDir, now),
246
+ now,
247
+ show: (p) => p.split(`${paths.home}/`).join('~/'),
248
+ };
249
+ };
245
250
  /** Puts every session hook into the Launch's arguments: one `--settings` for Claude, `-c hooks.*` for Codex. */
246
251
  const addSessionHooks = async (p, list) => {
247
252
  const parts = list.filter((x) => x !== null);
@@ -836,7 +841,7 @@ export async function createRuntime(opts = {}) {
836
841
  if (freshMemory)
837
842
  config.claude = freshMemory.claude;
838
843
  const memoryOn = config.claude?.shareMemory === true && fams.has('claude');
839
- const mctx = memoryOn ? memoryCtx() : null;
844
+ const mctx = memoryOn ? await memoryCtx() : null;
840
845
  const input = {
841
846
  home: paths.home,
842
847
  families: fams,
@@ -660,7 +660,11 @@ export type FindingLevel = 'ok' | 'warn' | 'fail';
660
660
  export interface FixResult {
661
661
  ok: boolean;
662
662
  message: string;
663
+ /** Values for the Panel's own sentence for this Fix's Finding code (`params.form` picks a variant); never a secret. */
664
+ params?: FindingParams;
663
665
  }
666
+ /** Values a Finding or a Fix gives the Panel to put into its translated sentence: names and counts only. */
667
+ export type FindingParams = Record<string, string | number>;
664
668
  export interface Finding {
665
669
  level: FindingLevel;
666
670
  /** Account ref the Finding is about. */
@@ -672,6 +676,8 @@ export interface Finding {
672
676
  message: string;
673
677
  /** What the user should do; never contains credential values. */
674
678
  hint?: string;
679
+ /** Values for the Panel's translated sentence of `code` (`params.form` picks a variant); never a secret. */
680
+ params?: FindingParams;
675
681
  /** `core` or the Plugin name. */
676
682
  source: string;
677
683
  fixable: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sideby",
3
- "version": "0.42.0",
3
+ "version": "0.42.1",
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)",
@@ -128,6 +128,22 @@
128
128
  "hint": {
129
129
  "type": "string"
130
130
  },
131
+ "params": {
132
+ "type": "object",
133
+ "patternProperties": {
134
+ "^.*$": {
135
+ "anyOf": [
136
+ {
137
+ "type": "string"
138
+ },
139
+ {
140
+ "type": "number"
141
+ }
142
+ ]
143
+ }
144
+ },
145
+ "description": "Names and counts the Panel puts into its own translated sentence for `code`; `form` picks a variant of it. The `message` says the same in English."
146
+ },
131
147
  "source": {
132
148
  "type": "string"
133
149
  },
@@ -185,6 +201,22 @@
185
201
  "hint": {
186
202
  "type": "string"
187
203
  },
204
+ "params": {
205
+ "type": "object",
206
+ "patternProperties": {
207
+ "^.*$": {
208
+ "anyOf": [
209
+ {
210
+ "type": "string"
211
+ },
212
+ {
213
+ "type": "number"
214
+ }
215
+ ]
216
+ }
217
+ },
218
+ "description": "Names and counts the Panel puts into its own translated sentence for `code`; `form` picks a variant of it. The `message` says the same in English."
219
+ },
188
220
  "source": {
189
221
  "type": "string"
190
222
  },
@@ -220,6 +252,22 @@
220
252
  },
221
253
  "message": {
222
254
  "type": "string"
255
+ },
256
+ "params": {
257
+ "type": "object",
258
+ "patternProperties": {
259
+ "^.*$": {
260
+ "anyOf": [
261
+ {
262
+ "type": "string"
263
+ },
264
+ {
265
+ "type": "number"
266
+ }
267
+ ]
268
+ }
269
+ },
270
+ "description": "Names and counts the Panel puts into its own translated sentence for `code`; `form` picks a variant of it. The `message` says the same in English."
223
271
  }
224
272
  }
225
273
  }
@@ -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.42.0"
5
+ version: "0.42.1"
6
6
  requires:
7
7
  bins: [sideby, node]
8
8
  cliHelp: sideby --help
@@ -32,7 +32,7 @@ sideby memory off --yes --json # stops passing the folder; memory in t
32
32
  Before turning it on, tell the user in one line each:
33
33
  - Interactive Claude sessions sideby starts in an account other than the main one (`sideby run`, short commands, pick commands, `sideby next`, Auto Handoff, AI Tasks) get the main account's folder for the project (`~/.claude/projects/<project>/memory`) as `autoMemoryDirectory` in sideby's own `--settings` file. Nothing is linked: Claude Code refuses memory writes through a link.
34
34
  - The project is the git repository's main checkout (worktrees and subfolders share it), elsewhere the folder itself, named the way Claude Code names it. Where sideby cannot tell (a submodule, a separate git folder), the session keeps the account's own memory and the launch says so.
35
- - Sessions started with plain `claude`, by an app that picks the account itself, a headless run (`-p`) and a session given its own `--settings` keep writing the account's own memory. `sideby doctor --fix` moves that into the main account later: a project the main account lacks moves whole, a file that differs is kept as `<name>.<account>.md`, `MEMORY.md` gets the lines it lacks, and the moved files go to the trash in one folder (a file that changes meanwhile waits for the next fix). A project where a session of that account is running waits until it ends.
35
+ - Sessions started with plain `claude`, by an app that picks the account itself, a headless run (`-p`) and a session given its own `--settings` keep writing the account's own memory. `sideby doctor --fix` moves that into the main account later: a project the main account lacks moves whole, a file that differs is kept as `<name>.<account>.md`, `MEMORY.md` gets the lines it lacks, and the moved files go to the trash in one folder (a file that changes meanwhile waits for the next fix). A project where a session of that account is running waits until it ends: Doctor names it and the session (Session Label), and does not offer the fix when every project waits; run `sideby doctor --fix` again after that session ends.
36
36
  - Two accounts writing the same project at the same moment can overwrite `MEMORY.md`; Doctor's `memory.index` warning names the project. A `memory.name-mismatch` warning means Claude Code changed how it names project folders: suggest `sideby memory off --yes` and `sideby update`.
37
37
  - In the Panel it is **Settings › Shared memory**.
38
38