sideby 0.36.1 → 0.38.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/build.json CHANGED
@@ -1 +1 @@
1
- {"id":"20261113T091614-584b60"}
1
+ {"id":"20261115T154125-919503"}
@@ -1471,11 +1471,15 @@ function resetWindowLine(w, now) {
1471
1471
  * it. A spend that got no final answer fails with the `operationId` to retry.
1472
1472
  */
1473
1473
  export async function cmdQuotaReset(a, io, runtime) {
1474
- const usage = 'usage: sideby quota reset <account> [--yes] [--operation <id>] [--open] [--json]';
1474
+ const usage = 'usage: sideby quota reset <account> [--yes] [--operation <id>] [--open [--profile <browser user>]] [--json]';
1475
1475
  const ref = a.positionals[1];
1476
1476
  if (!ref || a.positionals.length !== 2 || a.rest.length || a.flags.has('refresh'))
1477
1477
  throw new UsageError(usage);
1478
1478
  const operation = a.flags.get('operation');
1479
+ // Which Chrome browser user `--open` opens the page in (folder, name or Google account); without it, the Account's own.
1480
+ const profile = a.flags.get('profile');
1481
+ if (profile !== undefined && !a.flags.has('open'))
1482
+ throw new UsageError(`--profile chooses the browser user that --open opens the page in; add --open\n${usage}`);
1479
1483
  const asJson = a.flags.has('json');
1480
1484
  const rt = runtime ?? (await createRuntime());
1481
1485
  const now = rt.readContext().now;
@@ -1492,7 +1496,7 @@ export async function cmdQuotaReset(a, io, runtime) {
1492
1496
  long: QUOTA_LONG_WARN_PERCENT,
1493
1497
  });
1494
1498
  const tight = quota.status === 'ok' ? (offer?.tight ?? []).map((i) => quota.windows[i]) : [];
1495
- const opened = a.flags.has('open') ? await openVendorPage(rt, account) : undefined;
1499
+ const opened = a.flags.has('open') ? await openVendorPage(rt, account, profile) : undefined;
1496
1500
  const who = st.identity?.email;
1497
1501
  const message = `${f.title} cannot use a limit reset from the command line: it is used on the vendor's page, and then applies to ${f.title} too. sideby cannot see whether ${account.ref} holds one.`;
1498
1502
  if (asJson) {
@@ -1532,7 +1536,7 @@ export async function cmdQuotaReset(a, io, runtime) {
1532
1536
  if (!f.limitReset?.vendorPage)
1533
1537
  throw new UserError(`--open is for an account whose limit reset is used on the vendor's page (Claude Code); for ${account.ref} run \`sideby quota reset ${account.ref}\``, { code: 'no-vendor-page' });
1534
1538
  // A Family whose Host can use one and that has a vendor page too: `--open` only opens the page, and uses nothing.
1535
- const opened = await openVendorPage(rt, account);
1539
+ const opened = await openVendorPage(rt, account, profile);
1536
1540
  const message = `Opened ${opened.url}${opened.profile ? ` in the browser user ${opened.profile.name}` : ' in your browser'}: the vendor's page for the limit resets of ${account.ref}. Nothing was used from here; to use one through ${f.title} itself, run \`sideby quota reset ${account.ref}\`.`;
1537
1541
  if (asJson)
1538
1542
  json(io, {
@@ -3724,7 +3728,7 @@ export async function cmdSessions(a, io, runtime) {
3724
3728
  if (more.length || a.rest.length)
3725
3729
  throw new UsageError('usage: sideby sessions [<account>|<family>] | sideby sessions copy <account|session-id> | sideby sessions open-run <account|session-id>');
3726
3730
  const rt = runtime ?? (await createRuntime());
3727
- const { listLiveSessions, sessionLabel } = await import('../core/live-sessions.js');
3731
+ const { listLiveSessions, sessionLabel, startedFromName } = await import('../core/live-sessions.js');
3728
3732
  const { withRuns } = await import('../core/run-link.js');
3729
3733
  const { readHandoffChains, withHandoffs } = await import('../core/session-handoffs.js');
3730
3734
  const r = await listLiveSessions(rt, first ? { only: first } : {});
@@ -3748,8 +3752,10 @@ export async function cmdSessions(a, io, runtime) {
3748
3752
  // A long title (often in Chinese, two columns a character) is cut so the table stays readable.
3749
3753
  // The RUN column shows only when an orchestrator's Session Index ties a Session to a Run (spec §3.32 step 2b).
3750
3754
  const anyRun = sessions.some((s) => s.run);
3755
+ // Where a Session was started from, when not a plain terminal (Started From, spec §3.32): `· Orca`.
3751
3756
  const rows = sessions.map((s) => [
3752
- c.bold(sessionLabel(s.accountLabel, truncate(s.title, 40), s.sessionId)),
3757
+ c.bold(sessionLabel(s.accountLabel, truncate(s.title, 40), s.sessionId)) +
3758
+ (s.startedFrom ? c.dim(` · ${startedFromName(s.startedFrom)}`) : ''),
3753
3759
  sessionStatusText(s),
3754
3760
  s.cwd ? tildify(s.cwd, home) : '',
3755
3761
  s.startedAt ? clock(s.startedAt, now) : '',
@@ -1189,6 +1189,9 @@ export const OUTPUT_SCHEMAS = {
1189
1189
  description: "True when sideby could not tie a running program to the session and took the account's newest one (Codex, pi).",
1190
1190
  }),
1191
1191
  transcript: Type.Optional(Type.String({ description: "Path of the session's record." })),
1192
+ startedFrom: Type.Optional(Type.String({
1193
+ description: "Started From: the app the session was started from, as the host's own record says (Claude Code's `entrypoint`). `orca`, `claude-desktop`, `script` (`claude -p`, scripts, the Agent SDK) or the host's value with only letters, digits and `._-`, at most 24 characters. Left out for a plain terminal and for hosts that do not say (Codex, Grok, pi).",
1194
+ })),
1192
1195
  reference: Type.String({
1193
1196
  description: 'The Session Reference in English: one sentence that points another AI at the session and its record.',
1194
1197
  }),
@@ -481,7 +481,7 @@ const COMMANDS = {
481
481
  new: { flags: ['api', 'json', 'next'], valued: ['alias', 'vendor'] },
482
482
  alias: { flags: ['json', 'yes'], valued: ['pick'] },
483
483
  doctor: { flags: ['fix', 'force', 'json'] },
484
- quota: { flags: ['json', 'yes', 'refresh', 'open'], valued: ['operation'] },
484
+ quota: { flags: ['json', 'yes', 'refresh', 'open'], valued: ['operation', 'profile'] },
485
485
  tune: { flags: ['json', 'yes'] },
486
486
  model: { flags: ['json', 'yes'], valued: ['effort'] },
487
487
  'remote-control': { flags: ['json', 'yes'] },
@@ -74,10 +74,12 @@ export interface VendorPageOpen {
74
74
  }
75
75
  /**
76
76
  * Opens the page where a Limit Reset of `account` is spent (`FamilyDef.limitReset.vendorPage`, ADR-0072): in the
77
- * Browser Profile the user chose for the Account, or the only one found signed in to it, else in the default browser.
78
- * sideby never reads which login that browser has. The url passed the loader's https check; no other is opened.
77
+ * Browser Profile given (folder, name or Google account), else the one the user chose for the Account, or the only one
78
+ * found signed in to it, else in the default browser. A `profile` that cannot be opened is an error, never a silent
79
+ * fall back to another browser. sideby never reads which login that browser has. The url passed the loader's https
80
+ * check; no other is opened.
79
81
  */
80
- export declare function openVendorPage(rt: Runtime, account: Account): Promise<VendorPageOpen>;
82
+ export declare function openVendorPage(rt: Runtime, account: Account, profile?: string): Promise<VendorPageOpen>;
81
83
  export interface BrowserChoice {
82
84
  ref: string;
83
85
  /** The browser user now chosen, or null when sideby finds it again by itself. */
@@ -348,10 +348,12 @@ export async function openInBrowser(rt, account, profile) {
348
348
  }
349
349
  /**
350
350
  * Opens the page where a Limit Reset of `account` is spent (`FamilyDef.limitReset.vendorPage`, ADR-0072): in the
351
- * Browser Profile the user chose for the Account, or the only one found signed in to it, else in the default browser.
352
- * sideby never reads which login that browser has. The url passed the loader's https check; no other is opened.
351
+ * Browser Profile given (folder, name or Google account), else the one the user chose for the Account, or the only one
352
+ * found signed in to it, else in the default browser. A `profile` that cannot be opened is an error, never a silent
353
+ * fall back to another browser. sideby never reads which login that browser has. The url passed the loader's https
354
+ * check; no other is opened.
353
355
  */
354
- export async function openVendorPage(rt, account) {
356
+ export async function openVendorPage(rt, account, profile) {
355
357
  const url = account.kind === 'api' ? undefined : rt.families.get(account.family)?.limitReset?.vendorPage;
356
358
  if (!url)
357
359
  throw new UserError(`${account.ref} has no page for limit resets; check the vendor's own usage page`, {
@@ -359,11 +361,36 @@ export async function openVendorPage(rt, account) {
359
361
  });
360
362
  const deps = depsFor(rt);
361
363
  const run = async (cmd, args) => (await deps.exec(cmd, args)).code === 0;
364
+ const canPick = deps.platform === 'darwin' || Boolean(deps.wslMount);
365
+ if (profile) {
366
+ // The user named the browser user: it opens there or says why not, with the address to open by hand.
367
+ if (!canPick)
368
+ throw new UserError(`opening a browser user works on macOS and WSL only for now (this is ${deps.platform}); open ${url} yourself`, { code: 'unsupported' });
369
+ const problems = [];
370
+ const launch = await chromeLauncher(deps, problems);
371
+ if (!launch)
372
+ throw new UserError(`${CHROME.title} is not installed; get it from ${CHROME_DOWNLOAD}, or open ${url} yourself`, { code: 'not-installed' });
373
+ const entries = (await profileEntries(launch.userData ?? chromeUserData(rt.paths.home), problems)) ?? [];
374
+ if (!entries.length)
375
+ throw new UserError(`${CHROME.title} has no browser users yet; open it once, then try again`, {
376
+ code: 'no-profiles',
377
+ });
378
+ const pick = findProfile(entries, profile);
379
+ const [cmd, ...args] = launch.command(`--profile-directory=${pick.dir}`, url);
380
+ if (!(await run(cmd, args)))
381
+ throw new UserError(`could not open ${CHROME.title}; open ${url} yourself`, { code: 'open-failed' });
382
+ return {
383
+ ref: account.ref,
384
+ url,
385
+ profile: { dir: pick.dir, name: pick.name },
386
+ command: [cmd, ...args],
387
+ };
388
+ }
362
389
  // The Account's own Browser Profile, when one is known without asking; any problem falls back to the default browser.
363
390
  // Nothing of a browser is read unless the user chose a Browser Profile for this Account or turned Browser Sign-ins on.
364
391
  const chosen = rt.config.browser?.choices?.[account.ref];
365
392
  const findIt = rt.config.browser?.signIns === true;
366
- if ((deps.platform === 'darwin' || deps.wslMount) && (chosen || findIt)) {
393
+ if (canPick && (chosen || findIt)) {
367
394
  const problems = [];
368
395
  const launch = await chromeLauncher(deps, problems).catch(() => null);
369
396
  const entries = launch
@@ -28,6 +28,11 @@ export interface LiveSession {
28
28
  guessed: boolean;
29
29
  /** Path of the Session's record (transcript), when known. */
30
30
  transcript?: string;
31
+ /**
32
+ * The app the Session was started from (Started From, spec §3.32), as a stable id: `orca`, `claude-desktop`,
33
+ * `script`, or the Host's own value cleaned. Left out for a plain terminal. Claude Code only for now.
34
+ */
35
+ startedFrom?: string;
31
36
  /** The command that resumes the Session in the Account that holds it. */
32
37
  resumeCommand: string;
33
38
  /** The Session Reference in English, as `sessionCopyText(s, 'reference', 'en')` gives it. */
@@ -46,6 +51,8 @@ export type SessionCopyAs = 'reference' | 'id' | 'resume';
46
51
  export declare const shortId: (id: string) => string;
47
52
  /** `<accountLabel> · <title> · <first 8 of id>`; a Session without a title leaves its part out. */
48
53
  export declare const sessionLabel: (accountLabel: string, title: string, id: string) => string;
54
+ /** The name a Started From id is shown by in English text output. */
55
+ export declare const startedFromName: (id: string) => string;
49
56
  /** The key that names a Session across Accounts: the same id in two Accounts is two Sessions. */
50
57
  export declare const liveKey: (account: string, sessionId: string) => string;
51
58
  /** The Host arguments that resume Session `id` of a Family. */
@@ -9,6 +9,15 @@ import { MESSAGES_LOOKED_AT, readAttention, withStatus, } from './session-status
9
9
  export const shortId = (id) => id.slice(0, 8);
10
10
  /** `<accountLabel> · <title> · <first 8 of id>`; a Session without a title leaves its part out. */
11
11
  export const sessionLabel = (accountLabel, title, id) => [accountLabel, title, shortId(id)].filter(Boolean).join(' · ');
12
+ /** Display names of the Started From ids sideby knows; any other id is shown as it is. */
13
+ const STARTED_FROM_NAMES = {
14
+ orca: 'Orca',
15
+ 'claude-desktop': 'Claude Desktop',
16
+ 'claude-vscode': 'VS Code',
17
+ script: 'Script',
18
+ };
19
+ /** The name a Started From id is shown by in English text output. */
20
+ export const startedFromName = (id) => Object.hasOwn(STARTED_FROM_NAMES, id) ? STARTED_FROM_NAMES[id] : id;
12
21
  /** The key that names a Session across Accounts: the same id in two Accounts is two Sessions. */
13
22
  export const liveKey = (account, sessionId) => `${account}\0${sessionId}`;
14
23
  /** The Host arguments that resume Session `id` of a Family. */
@@ -55,6 +64,7 @@ export function toLiveSession(account, accountLabel, raw) {
55
64
  ...(raw.updatedAt ? { updatedAt: raw.updatedAt } : {}),
56
65
  guessed: raw.guessed,
57
66
  ...(raw.transcript ? { transcript: raw.transcript } : {}),
67
+ ...(raw.startedFrom ? { startedFrom: raw.startedFrom } : {}),
58
68
  resumeCommand: resumeCommandFor(account.family, account.ref, raw.sessionId),
59
69
  };
60
70
  return { ...s, reference: referenceText(s, 'en') };
@@ -2,6 +2,13 @@ import type { LiveSessionStatus } from '../../core/live-sessions.ts';
2
2
  import type { LiveSessionReader } from '../live-sessions.ts';
3
3
  /** Claude Code's `status`: `busy` and `shell` run, `idle` waits for a prompt, a blocked one waits for the user. */
4
4
  export declare function claudeStatus(s: unknown): LiveSessionStatus;
5
+ /**
6
+ * Where Claude Code says a session was started from (Started From, spec §3.32): its record's `entrypoint`, which the
7
+ * launcher sets through `CLAUDE_CODE_ENTRYPOINT`, so it is any text (seen with Claude Code 2.1.325 on 2026-11-15:
8
+ * `cli`, `orca`, `claude-desktop`, `sdk-cli`). A plain terminal (`cli`, or none) gives undefined; every `sdk-*` is a
9
+ * script; anything else keeps only letters, digits and `._-`, at most 24 characters.
10
+ */
11
+ export declare function claudeStartedFrom(v: unknown): string | undefined;
5
12
  /** The transcript Claude Code writes for a session: `projects/<cwd with every other character as ->/<id>.jsonl`. */
6
13
  export declare const claudeTranscript: (dir: string, cwd: string, id: string) => string;
7
14
  /**
@@ -19,6 +19,22 @@ export function claudeStatus(s) {
19
19
  return 'needs-you';
20
20
  return 'unknown';
21
21
  }
22
+ /**
23
+ * Where Claude Code says a session was started from (Started From, spec §3.32): its record's `entrypoint`, which the
24
+ * launcher sets through `CLAUDE_CODE_ENTRYPOINT`, so it is any text (seen with Claude Code 2.1.325 on 2026-11-15:
25
+ * `cli`, `orca`, `claude-desktop`, `sdk-cli`). A plain terminal (`cli`, or none) gives undefined; every `sdk-*` is a
26
+ * script; anything else keeps only letters, digits and `._-`, at most 24 characters.
27
+ */
28
+ export function claudeStartedFrom(v) {
29
+ if (typeof v !== 'string')
30
+ return undefined;
31
+ const raw = v.trim();
32
+ if (!raw || raw === 'cli')
33
+ return undefined;
34
+ if (raw.startsWith('sdk-'))
35
+ return 'script';
36
+ return raw.replace(/[^A-Za-z0-9._-]/g, '').slice(0, 24) || undefined;
37
+ }
22
38
  const num = (v) => (typeof v === 'number' && Number.isFinite(v) ? v : undefined);
23
39
  const str = (v) => (typeof v === 'string' && v ? v : undefined);
24
40
  /** The transcript Claude Code writes for a session: `projects/<cwd with every other character as ->/<id>.jsonl`. */
@@ -98,6 +114,7 @@ export const claudeLiveSessions = {
98
114
  const named = rec.nameSource !== 'derived' ? str(rec.name) : undefined;
99
115
  const aiTitle = named || !transcript ? undefined : await claudeAiTitle(transcript).catch(() => undefined);
100
116
  const title = named ?? aiTitle ?? str(rec.name) ?? (cwd ? basename(cwd) : undefined);
117
+ const startedFrom = claudeStartedFrom(rec.entrypoint);
101
118
  out.push({
102
119
  sessionId,
103
120
  ...(title ? { title } : {}),
@@ -110,6 +127,7 @@ export const claudeLiveSessions = {
110
127
  : {}),
111
128
  guessed: false,
112
129
  ...(transcript ? { transcript } : {}),
130
+ ...(startedFrom ? { startedFrom } : {}),
113
131
  });
114
132
  }
115
133
  return out;
@@ -13,6 +13,8 @@ export interface RawLiveSession {
13
13
  updatedAt?: string;
14
14
  guessed: boolean;
15
15
  transcript?: string;
16
+ /** The app the Session was started from (Started From), as the Host's own record says; Claude only. */
17
+ startedFrom?: string;
16
18
  }
17
19
  export interface LiveSessionReader {
18
20
  family: string;
@@ -8,14 +8,19 @@ export interface PanelPidFile {
8
8
  startedAt: string;
9
9
  /** Random id the Panel also returns on `/api/health`. */
10
10
  instance: string;
11
- /** `ps -o lstart=` of the process, when `ps` gave one; a reused pid has another. */
11
+ /** When the process started (`processStartTime`), when it could be read; a reused pid has another. */
12
12
  processStart?: string;
13
13
  }
14
14
  export declare const pidFilePath: (p: Paths) => string;
15
15
  export declare const logFilePath: (p: Paths) => string;
16
16
  export declare function readPidFile(p: Paths): Promise<PanelPidFile | undefined>;
17
- /** When `pid` started, as `ps` prints it; with the pid it names one process, which a reused pid does not match. */
18
- export declare const processStartTime: (pid: number) => Promise<string | undefined>;
17
+ /**
18
+ * When `pid` started; with the pid it names one process, which a reused pid does not match. On Linux it is the start
19
+ * in clock ticks since boot from `/proc/<pid>/stat` (`ticks:<n>`): `ps -o lstart` adds that to the boot time, which
20
+ * moves when the system clock is adjusted (under WSL by seconds within minutes), so the same process would stop
21
+ * matching its own pid file. Elsewhere it is `ps -o lstart`.
22
+ */
23
+ export declare function processStartTime(pid: number): Promise<string | undefined>;
19
24
  /** The port of this state directory's background Panel when it runs and answers as itself, else null. */
20
25
  export declare function backgroundPanelPort(p: Paths): Promise<number | null>;
21
26
  /** URL of a running background Panel, or of any sideby Panel on `port`; removes a stale pid file. */
@@ -43,8 +43,40 @@ function psField(pid, field) {
43
43
  execFile('ps', ['-ww', '-o', `${field}=`, '-p', String(pid)], { timeout: 3000, env: { ...process.env, LC_ALL: 'C' } }, (err, stdout) => resolve(err ? undefined : stdout.trim() || undefined));
44
44
  });
45
45
  }
46
- /** When `pid` started, as `ps` prints it; with the pid it names one process, which a reused pid does not match. */
47
- export const processStartTime = (pid) => psField(pid, 'lstart');
46
+ /**
47
+ * When `pid` started; with the pid it names one process, which a reused pid does not match. On Linux it is the start
48
+ * in clock ticks since boot from `/proc/<pid>/stat` (`ticks:<n>`): `ps -o lstart` adds that to the boot time, which
49
+ * moves when the system clock is adjusted (under WSL by seconds within minutes), so the same process would stop
50
+ * matching its own pid file. Elsewhere it is `ps -o lstart`.
51
+ */
52
+ export async function processStartTime(pid) {
53
+ if (process.platform === 'linux') {
54
+ try {
55
+ const stat = await readFile(`/proc/${pid}/stat`, 'utf8');
56
+ // Fields after the command name, which is in parentheses and may hold spaces; starttime is field 22.
57
+ const ticks = stat.slice(stat.lastIndexOf(')') + 2).split(' ')[19];
58
+ if (ticks && /^\d+$/.test(ticks))
59
+ return `ticks:${ticks}`;
60
+ }
61
+ catch {
62
+ // gone, or no /proc: fall back to ps
63
+ }
64
+ }
65
+ return psField(pid, 'lstart');
66
+ }
67
+ /**
68
+ * Whether a pid file's start time names this process. One written in another form (an older sideby wrote `ps -o lstart`
69
+ * on Linux too) cannot be compared and is not held against it; the command line and the Panel's answer still have to
70
+ * match.
71
+ */
72
+ async function sameStart(pid, recorded) {
73
+ const now = await processStartTime(pid);
74
+ if (!now)
75
+ return false;
76
+ if (now.startsWith('ticks:') !== recorded.startsWith('ticks:'))
77
+ return true;
78
+ return now === recorded;
79
+ }
48
80
  /**
49
81
  * Checks that the pid file names a live detached Panel: the process is alive, started when the pid file says,
50
82
  * runs `ui --serve-detached`, and the Panel on the recorded port answers with the same instance id and pid.
@@ -55,7 +87,7 @@ async function checkPanel(rec) {
55
87
  return stale('it names no panel instance');
56
88
  if (!alive(rec.pid))
57
89
  return stale(`process ${rec.pid} is not running`);
58
- if (rec.processStart && (await processStartTime(rec.pid)) !== rec.processStart)
90
+ if (rec.processStart && !(await sameStart(rec.pid, rec.processStart)))
59
91
  return stale(`process ${rec.pid} is not the one that wrote it`);
60
92
  const cmd = await psField(rec.pid, 'command');
61
93
  if (!(cmd && / ui( |$)/.test(cmd) && cmd.includes(`--${DETACHED_FLAG}`)))
@@ -2274,15 +2274,16 @@ export function createPanelHandler(opts) {
2274
2274
  return { result: await rt.limitResetUse(account, operationId) };
2275
2275
  },
2276
2276
  },
2277
- // Opens the vendor's page where a Limit Reset is spent (Claude Code, ADR-0072), in the Account's Browser Profile
2278
- // when one is known, else the default browser. It starts a program, so a read-only Panel refuses it.
2277
+ // Opens the vendor's page where a Limit Reset is spent (Claude Code, ADR-0072): in the Browser Profile the page
2278
+ // names, else the Account's own when one is known, else the default browser. It starts a program, so a read-only
2279
+ // Panel refuses it.
2279
2280
  '/api/quota/reset/open': {
2280
2281
  async run(body) {
2281
2282
  const ref = optString(body, 'account');
2282
2283
  if (!ref)
2283
2284
  throw new HttpError(400, '"account" is required');
2284
2285
  const rt = await getRuntime();
2285
- const r = await openVendorPage(rt, await rt.resolve(ref));
2286
+ const r = await openVendorPage(rt, await rt.resolve(ref), optString(body, 'profile'));
2286
2287
  return { ref: r.ref, url: r.url, ...(r.profile ? { profile: r.profile } : {}) };
2287
2288
  },
2288
2289
  },
@@ -336,6 +336,14 @@ declare const en: {
336
336
  'reset.page.opened': string;
337
337
  'reset.page.openedIn': string;
338
338
  'reset.page.failed': string;
339
+ 'reset.in.hint': string;
340
+ 'reset.in.pick': string;
341
+ 'reset.in.pickHint': string;
342
+ 'reset.in.default': string;
343
+ 'reset.in.defaultHint': string;
344
+ 'reset.in.title': string;
345
+ 'reset.in.intro': string;
346
+ 'reset.in.useDefault': string;
339
347
  'reset.title': string;
340
348
  'reset.peers': string;
341
349
  'reset.reading': string;
@@ -1027,6 +1035,10 @@ declare const en: {
1027
1035
  'spage.decisionTip': string;
1028
1036
  'spage.guessed': string;
1029
1037
  'spage.guessedTip': string;
1038
+ 'spage.from': string;
1039
+ 'spage.fromScript': string;
1040
+ 'spage.fromTip': string;
1041
+ 'spage.fromOrcaTip': string;
1030
1042
  'spage.run': string;
1031
1043
  'spage.runTip': string;
1032
1044
  'spage.runTipLane': string;
@@ -338,6 +338,14 @@ const en = {
338
338
  'reset.page.opened': 'Opened {site} in your browser. Check that it is signed in as {who} before you use a reset.',
339
339
  'reset.page.openedIn': 'Opened {site} in the browser user {name}. Check that it is signed in as {who} before you use a reset.',
340
340
  'reset.page.failed': 'Could not open the page: {msg}. Open {url} yourself.',
341
+ 'reset.in.hint': 'Opens {site} in the Chrome browser user {name}. Click to open it in another one.',
342
+ 'reset.in.pick': 'Choose browser',
343
+ 'reset.in.pickHint': "sideby is not sure which Chrome browser user is this account's. Choose the one to open {site} in.",
344
+ 'reset.in.default': 'Default browser',
345
+ 'reset.in.defaultHint': 'Opens {site} in your default browser. Click to choose a Chrome browser user instead.',
346
+ 'reset.in.title': 'Use a reset: which browser',
347
+ 'reset.in.intro': 'A reset counts for the login of the page. Open {site} in the browser user that is signed in as {who}.',
348
+ 'reset.in.useDefault': 'Use my default browser',
341
349
  'reset.title': 'Use a limit reset',
342
350
  'reset.peers': 'Same login as {names}: one reset applies to all of them.',
343
351
  'reset.reading': 'Reading the numbers from {host}…',
@@ -1029,6 +1037,10 @@ const en = {
1029
1037
  'spage.decisionTip': 'Open Unattended to see what it asked and mark it done.',
1030
1038
  'spage.guessed': 'newest session (guessed)',
1031
1039
  'spage.guessedTip': 'sideby could not tell which session this account is running, so it shows the newest one.',
1040
+ 'spage.from': 'Started from {app}',
1041
+ 'spage.fromScript': 'Started from a script',
1042
+ 'spage.fromTip': 'Where this session was started, as Claude Code records it.',
1043
+ 'spage.fromOrcaTip': "Orca picks the account for its Chat panes itself. To use a certain account, open a terminal pane in Orca and run that account's short command.",
1032
1044
  'spage.run': 'Task: {title}',
1033
1045
  'spage.runTip': 'Open the task board of this session.',
1034
1046
  'spage.runTipLane': 'Open the task board of this session. Its part: {lane}.',
@@ -2075,6 +2087,14 @@ const zh = {
2075
2087
  'reset.page.opened': '已在浏览器打开 {site}。使用重置前,请确认网页登录的是 {who}。',
2076
2088
  'reset.page.openedIn': '已在浏览器用户 {name} 里打开 {site}。使用重置前,请确认网页登录的是 {who}。',
2077
2089
  'reset.page.failed': '打不开页面:{msg}。请自己打开 {url}。',
2090
+ 'reset.in.hint': '会在 Chrome 浏览器用户 {name} 里打开 {site}。点这里换一个。',
2091
+ 'reset.in.pick': '选浏览器',
2092
+ 'reset.in.pickHint': 'sideby 拿不准这个账号对应哪个 Chrome 浏览器用户。选一个来打开 {site}。',
2093
+ 'reset.in.default': '默认浏览器',
2094
+ 'reset.in.defaultHint': '会在默认浏览器里打开 {site}。点这里改用某个 Chrome 浏览器用户。',
2095
+ 'reset.in.title': '使用重置:在哪个浏览器打开',
2096
+ 'reset.in.intro': '重置算在网页登录的那个账号上。请在登录了 {who} 的浏览器用户里打开 {site}。',
2097
+ 'reset.in.useDefault': '用默认浏览器打开',
2078
2098
  'reset.title': '使用一次重置',
2079
2099
  'reset.peers': '与 {names} 是同一登录:用一次重置,这些账号都生效。',
2080
2100
  'reset.reading': '正在向 {host} 读取最新数字…',
@@ -2766,6 +2786,10 @@ const zh = {
2766
2786
  'spage.decisionTip': '打开「无人值守」页,看它问了什么,处理完标为已完成。',
2767
2787
  'spage.guessed': '最新会话(推测)',
2768
2788
  'spage.guessedTip': 'sideby 没法确定这个账号正在跑哪个会话,先显示它最新的一个。',
2789
+ 'spage.from': '启动自 {app}',
2790
+ 'spage.fromScript': '启动自脚本',
2791
+ 'spage.fromTip': 'Claude Code 记下的这个会话是从哪里启动的。',
2792
+ 'spage.fromOrcaTip': 'Orca 的 Chat 面板由 Orca 自己选账号。要用某个账号,在 Orca 里打开终端面板,运行这个账号的短命令。',
2769
2793
  'spage.run': '任务:{title}',
2770
2794
  'spage.runTip': '打开这个会话的任务看板。',
2771
2795
  'spage.runTipLane': '打开这个会话的任务看板。它负责:{lane}。',
@@ -454,10 +454,22 @@ export declare function sessionRowShape(s: LogicSession & {
454
454
  copy?: unknown;
455
455
  orca?: unknown;
456
456
  run?: unknown;
457
+ startedFrom?: string;
457
458
  }, msg?: {
458
459
  status: string;
459
460
  needsApproval?: boolean;
460
461
  }): unknown[];
462
+ /**
463
+ * How a Session's Started From id is shown (spec §3.32): the message key of the whole chip text for a name the page
464
+ * translates, else the name.
465
+ * The reader already cleans the id; it is cleaned again here, so the page never shows more than 24 letters, digits
466
+ * and `._-`, and the caller puts it in as text only. Null when there is nothing to show.
467
+ */
468
+ export declare function startedFromView(id: unknown): {
469
+ key?: string;
470
+ name: string;
471
+ orca: boolean;
472
+ } | null;
461
473
  /** How long ago a Session was last active, as a message key and count; null when it has no time at all. */
462
474
  export declare function sessionAge(s: LogicSession, now: number): {
463
475
  key: string;
@@ -880,9 +880,29 @@ export function sessionRowShape(s, msg) {
880
880
  s.copy,
881
881
  Boolean(s.orca),
882
882
  s.run || null,
883
+ s.startedFrom || '',
883
884
  msg ? msg.status + (msg.needsApproval ? '+approve' : '') : '',
884
885
  ];
885
886
  }
887
+ /**
888
+ * How a Session's Started From id is shown (spec §3.32): the message key of the whole chip text for a name the page
889
+ * translates, else the name.
890
+ * The reader already cleans the id; it is cleaned again here, so the page never shows more than 24 letters, digits
891
+ * and `._-`, and the caller puts it in as text only. Null when there is nothing to show.
892
+ */
893
+ export function startedFromView(id) {
894
+ if (typeof id !== 'string')
895
+ return null;
896
+ if (id === 'script')
897
+ return { key: 'spage.fromScript', name: id, orca: false };
898
+ const names = {
899
+ orca: 'Orca',
900
+ 'claude-desktop': 'Claude Desktop',
901
+ 'claude-vscode': 'VS Code',
902
+ };
903
+ const name = Object.hasOwn(names, id) ? names[id] : id.replace(/[^A-Za-z0-9._-]/g, '').slice(0, 24);
904
+ return name ? { name, orca: id === 'orca' } : null;
905
+ }
886
906
  /** How long ago a Session was last active, as a message key and count; null when it has no time at all. */
887
907
  export function sessionAge(s, now) {
888
908
  const ts = Date.parse(s.updatedAt || s.startedAt || '');
@@ -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, dotsKeepKeyboard, enableOutcome, expiredLogins, fileSize, fixPrompt, foldSkips, foldToolCalls, formatDuration, handoffChangeOf, handoffHintAccount, handoffTaskFacts, hiddenIn, highlightParts, histFilters, historyEmpty, historyWhen, 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, steadyOrder, stripSecrets, suggestAlias, suggestName, switchFailure, tailInView, taskFindings, uaDayRuns, 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, dotsKeepKeyboard, enableOutcome, expiredLogins, fileSize, fixPrompt, foldSkips, foldToolCalls, formatDuration, handoffChangeOf, handoffHintAccount, handoffTaskFacts, hiddenIn, highlightParts, histFilters, historyEmpty, historyWhen, 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, uaDayRuns, 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';
@@ -106,6 +106,7 @@ const LOGIC = [
106
106
  shortCwd,
107
107
  shortSessionLabel,
108
108
  sortAccounts,
109
+ startedFromView,
109
110
  sortSessions,
110
111
  steadyOrder,
111
112
  histFilters,
@@ -1635,9 +1636,14 @@ const MAIN = String.raw `
1635
1636
  const offer = kind ? limitResetOffer(q, kind, now, { short: WARN, long: LONG.warn }) : null
1636
1637
  if (!offer) { noteClass(a.ref + ':resetbtn', '', false); return null }
1637
1638
  const busy = ui.resetRef === a.ref
1638
- const cls = noteClass(a.ref + ':resetbtn', 'btn btn-sm q-reset-btn', true)
1639
- if (kind === 'page')
1640
- return h('button', { class: cls, type: 'button', disabled: busy, 'aria-busy': busy ? 'true' : null, title: resetPageHint(a, q, offer), onclick: (e) => { e.stopPropagation(); openResetPage(a) } }, busy ? spinner() : icon('globe'), t('reset.usePage', { site: resetSite(a) }))
1639
+ const cls = noteClass(a.ref + ':resetbtn', kind === 'page' ? 'q-reset' : 'btn btn-sm q-reset-btn', true)
1640
+ if (kind === 'page') {
1641
+ // One quiet line: the link that opens the page, then the browser user it opens in, which is also where to change it.
1642
+ const where = resetWhere(a)
1643
+ return h('span', { class: cls },
1644
+ h('button', { class: 'link-btn q-reset-go', type: 'button', disabled: busy, 'aria-busy': busy ? 'true' : null, title: resetPageHint(a, q, offer), onclick: (e) => { e.stopPropagation(); openResetPage(a) } }, busy ? spinner() : icon('refresh'), t('reset.usePage', { site: resetSite(a) })),
1645
+ where ? h('button', { class: 'email-btn br-btn q-reset-in', type: 'button', title: where.hint, 'aria-label': where.hint, onclick: (e) => { e.stopPropagation(); openBrowserDialog(a, 'reset') } }, icon('globe', 'br-ico'), h('span', { class: 'br-name' }, where.label), icon('chevron', 'br-ico')) : null)
1646
+ }
1641
1647
  const why = [offer.tight.length ? t('reset.page.tight', { list: offer.tight.map((i) => resetWindowName(q.windows[i]) + ' ' + Math.round(q.windows[i].usedPercent) + '%').join(', ') }) : '', offer.expiring && q.limitResets.nextExpiresAt ? t('reset.expires', { at: clock(q.limitResets.nextExpiresAt) }) : '', t('reset.useHint')].filter(Boolean).join('\n')
1642
1648
  return h('button', { class: cls, type: 'button', disabled: busy, title: why, onclick: (e) => { e.stopPropagation(); openReset(a) } }, t('reset.use'))
1643
1649
  }
@@ -1651,14 +1657,40 @@ const MAIN = String.raw `
1651
1657
  if (q && q.limitResets && !(q.limitResets.available > 0)) return null
1652
1658
  return { icon: 'refresh', label: t('reset.useMenu'), hint: q && q.limitResets ? tn('reset.count', q.limitResets.available) : '', run: () => openReset(a) }
1653
1659
  }
1660
+ // The browser user the vendor's page opens in when nobody is asked: the one chosen for the account, else the only
1661
+ // one found signed in to it. Null: not known (the default browser, or the user picks).
1662
+ function resetBrowser(a) {
1663
+ const info = browserFor(a)
1664
+ if (!info) return null
1665
+ const chosen = browserChosen(a)
1666
+ if (chosen) return info.b.profiles.find((p) => p.dir === chosen) || { dir: chosen, name: chosen }
1667
+ return info.found.length === 1 ? info.found[0] : null
1668
+ }
1669
+ // Whether a click asks which browser user first: Chrome's are known here, and none of them is this account's for sure.
1670
+ function resetAsks(a) {
1671
+ const info = browserFor(a)
1672
+ return Boolean(info && info.b.enabled && info.b.found && info.b.profiles.length && !resetBrowser(a))
1673
+ }
1674
+ // Next to the link: where the page will open, and the way to change it. Nothing where sideby cannot pick a browser user.
1675
+ function resetWhere(a) {
1676
+ if (!browserFor(a)) return null
1677
+ const p = resetBrowser(a)
1678
+ if (p) return { label: profileLabel(p), hint: t('reset.in.hint', { name: profileLabel(p), site: resetSite(a) }) }
1679
+ return resetAsks(a) ? { label: t('reset.in.pick'), hint: t('reset.in.pickHint', { site: resetSite(a) }) } : { label: t('reset.in.default'), hint: t('reset.in.defaultHint', { site: resetSite(a) }) }
1680
+ }
1654
1681
  // After the jump to the vendor's page: when the user is back on this page, that account's quota is asked once.
1655
1682
  const resetJump = { ref: null, away: false }
1656
- async function openResetPage(a) {
1683
+ // p: the browser user picked in the dialog. direct: do not ask, open where sideby would by itself.
1684
+ async function openResetPage(a, p, direct) {
1657
1685
  if (ui.resetRef) return
1686
+ if (!p && !direct && resetAsks(a)) { openBrowserDialog(a, 'reset'); return }
1687
+ const inDialog = Boolean(dlg.el && dlg.el.open)
1658
1688
  ui.resetRef = a.ref
1659
1689
  renderAccounts()
1690
+ if (dlg.kind === 'browser') renderBrowser()
1660
1691
  try {
1661
- const r = await api('/api/quota/reset/open', { account: a.ref })
1692
+ const r = await api('/api/quota/reset/open', { account: a.ref, ...(p ? { profile: p.dir } : {}) })
1693
+ if (inDialog && dlg.el.open) dlg.el.close()
1662
1694
  resetJump.ref = a.ref
1663
1695
  resetJump.away = document.visibilityState !== 'visible' || !document.hasFocus()
1664
1696
  const who = a.identity && a.identity.email ? emailText(a.identity.email) : a.ref
@@ -1666,6 +1698,7 @@ const MAIN = String.raw `
1666
1698
  } catch (e) { toast(t('reset.page.failed', { url: family(a.family).limitResetPage || '', msg: e.message }), { kind: 'fail' }) }
1667
1699
  ui.resetRef = null
1668
1700
  renderAccounts()
1701
+ if (dlg.kind === 'browser') renderBrowser()
1669
1702
  }
1670
1703
  function resetLeft() { if (resetJump.ref) resetJump.away = true }
1671
1704
  async function resetReturned() {
@@ -1796,7 +1829,7 @@ const MAIN = String.raw `
1796
1829
  const q = a.quota && a.quota.status === 'ok' ? a.quota : null
1797
1830
  const page = resetKind(a) === 'page'
1798
1831
  const peers = (a.sameLogin || []).map(refName)
1799
- return h('li', null, h('button', { class: 'rs-pick-btn', type: 'button', onclick: () => { if (page) { dlg.el.close(); openResetPage(a) } else openReset(a) } },
1832
+ return h('li', null, h('button', { class: 'rs-pick-btn', type: 'button', onclick: () => { if (page) openResetPage(a); else openReset(a) } },
1800
1833
  badge(a.family, 'sm'),
1801
1834
  h('span', { class: 'rs-pick-main' }, h('b', null, a.ref), peers.length ? h('span', { class: 'muted small' }, ' = ' + peers.join(', ')) : null,
1802
1835
  h('span', { class: 'rs-pick-sub' }, page ? t('reset.usePage', { site: resetSite(a) }) : q && q.limitResets ? tn('reset.count', q.limitResets.available) : t('reset.pick.unknown'))),
@@ -2103,8 +2136,9 @@ const MAIN = String.raw `
2103
2136
  if (dlg.kind === 'browser') renderBrowser()
2104
2137
  }
2105
2138
  let br = null
2106
- function openBrowserDialog(a) {
2107
- br = { ref: a.ref, busy: false, error: null }
2139
+ // mode 'reset': the same choice, for the page where a Limit Reset is used; "Open" opens that page.
2140
+ function openBrowserDialog(a, mode) {
2141
+ br = { ref: a.ref, busy: false, error: null, mode: mode || null }
2108
2142
  showDialog('browser')
2109
2143
  // Rows skip background renders while a dialog is open; turning the finding on changes what they show.
2110
2144
  dlg.onClose = () => renderAccounts()
@@ -2126,12 +2160,13 @@ const MAIN = String.raw `
2126
2160
  renderBrowser()
2127
2161
  }
2128
2162
  function brProfileRow(a, p) {
2129
- const busy = ui.browserRef === a.ref
2163
+ const reset = br.mode === 'reset'
2164
+ const busy = (reset ? ui.resetRef : ui.browserRef) === a.ref
2130
2165
  const chosen = browserChosen(a) === p.dir
2131
2166
  return h('li', { class: 'br-row' },
2132
2167
  h('span', null, h('b', null, profileName(p.name)), p.email ? h('span', { class: 'muted small' }, ' · ' + emailText(p.email)) : null, ' ', h('span', { class: 'muted small mono' }, p.dir), p.changedAt ? h('span', { class: 'muted small' }, ' · ' + t('br.changed', { when: ago(p.changedAt) })) : null),
2133
2168
  h('span', { class: 'br-acts' },
2134
- h('button', { class: 'btn btn-sm', type: 'button', disabled: Boolean(ui.browserRef), 'aria-busy': busy ? 'true' : null, onclick: () => openBrowser(a, p) }, t('br.openIt')),
2169
+ h('button', { class: 'btn btn-sm', type: 'button', disabled: Boolean(ui.browserRef || ui.resetRef), 'aria-busy': busy ? 'true' : null, onclick: () => (reset ? openResetPage(a, p) : openBrowser(a, p)) }, t('br.openIt')),
2135
2170
  chosen ? h('span', { class: 'tag', title: t('br.chosenHint') }, t('br.chosen'))
2136
2171
  : h('button', { class: 'link-btn small', type: 'button', disabled: br.busy, title: t('br.chooseHint', { ref: a.ref }), onclick: () => brChoose(a, p.dir) }, t('br.choose'))))
2137
2172
  }
@@ -2154,8 +2189,15 @@ const MAIN = String.raw `
2154
2189
  const info = a && browserFor(a)
2155
2190
  if (!info) { dlg.el.close(); return }
2156
2191
  const url = siteOf(info.b, a.family)
2192
+ const reset = br.mode === 'reset'
2157
2193
  const body = []
2158
2194
  const foot = [h('button', { class: 'btn', type: 'button', disabled: br.busy, onclick: () => dlg.el.close() }, t('btn.close'))]
2195
+ if (reset) {
2196
+ // A reset belongs to the login of the page, so the dialog says who to look for, and keeps the plain way open.
2197
+ const who = a.identity && a.identity.email ? emailText(a.identity.email) : a.ref
2198
+ body.push(h('p', null, t('reset.in.intro', { site: resetSite(a), who })))
2199
+ if (!resetBrowser(a)) foot.push(h('button', { class: 'btn', type: 'button', disabled: br.busy || Boolean(ui.resetRef), onclick: () => openResetPage(a, null, true) }, t('reset.in.useDefault')))
2200
+ }
2159
2201
  if (!info.b.enabled) {
2160
2202
  body.push(h('p', null, t('br.offIntro', { ref: a.ref, url })))
2161
2203
  body.push(h('p', { class: 'small' }, t('br.reads')), h('ul', { class: 'small' }, ['br.read1', 'br.read2', 'br.read3'].map((k) => h('li', null, t(k)))))
@@ -2175,7 +2217,7 @@ const MAIN = String.raw `
2175
2217
  foot.unshift(h('button', { class: 'btn', type: 'button', disabled: br.busy, onclick: () => brSwitch(false) }, t('br.disable')))
2176
2218
  }
2177
2219
  if (br.error) body.push(errorNote(br.error, null))
2178
- setKids(dlg.el, dialogFrame(t('br.title') + ' · ' + a.ref, a.family, body, foot))
2220
+ setKids(dlg.el, dialogFrame(t(reset ? 'reset.in.title' : 'br.title') + ' · ' + a.ref, a.family, body, foot))
2179
2221
  }
2180
2222
  // How to get a Host that cannot run: the sentence, then on its own line the install command to copy (with the
2181
2223
  // install page next to it) when the Family has one; without a command the sentence ends with the page's link.
@@ -4029,6 +4071,13 @@ const MAIN = String.raw `
4029
4071
  h('span', { class: 'sess-run-title' }, t('spage.run', { title: run.title })),
4030
4072
  others.length ? h('span', { class: 'sess-run-more' }, '+' + others.length) : null)
4031
4073
  }
4074
+ // Where the Session was started from (Started From, spec §3.32), as text only. An Orca Session says why it may run
4075
+ // in an Account the user did not pick: Orca chooses it for its Chat panes.
4076
+ function startedFromChip(s) {
4077
+ const v = startedFromView(s.startedFrom)
4078
+ if (!v) return null
4079
+ return h('span', { class: 'chip sess-from', tabindex: '0', 'data-tip': v.orca ? t('spage.fromOrcaTip') : t('spage.fromTip') }, v.key ? t(v.key) : t('spage.from', { app: v.name }))
4080
+ }
4032
4081
  function sessionRow(s) {
4033
4082
  const p = sessionLabelParts(s)
4034
4083
  const copied = (sp.copied[s.sessionId] || 0) > Date.now()
@@ -4063,6 +4112,7 @@ const MAIN = String.raw `
4063
4112
  s.reason === 'pending-decision' && status === 'needs-you' ? h('button', { class: 'chip chip-sm chip-warn chip-btn sess-decision', type: 'button', 'data-key': 'sess-decision-' + s.sessionId, 'data-tip': t('spage.decisionTip'), onclick: () => setPage('unattended') }, t('spage.decision'), icon('chevron')) : null,
4064
4113
  chip ? msgChip(chip, msg, s) : null,
4065
4114
  s.guessed ? h('span', { class: 'chip sess-guessed', tabindex: '0', 'data-tip': t('spage.guessedTip') }, t('spage.guessed')) : null,
4115
+ startedFromChip(s),
4066
4116
  runChip(s),
4067
4117
  h('span', { class: 'sess-cwd' + (cwd ? ' mono' : ''), title: s.cwd && cwd !== s.cwd ? s.cwd : null }, cwd || t('spage.noCwd')),
4068
4118
  h('span', { class: 'sess-age', 'data-age': s.sessionId }, sessAgeText(s)))),
@@ -237,6 +237,10 @@ code, .mono { font-family: var(--mono); font-size: 12px; }
237
237
  .q-asof .ic, .q-resets .ic { width: 11px; height: 11px; }
238
238
  .q-reset-btn { height: 22px; padding: 0 8px; gap: 4px; font-size: 11px; }
239
239
  .q-reset-btn .ic, .q-reset-btn .spin { width: 11px; height: 11px; }
240
+ .q-reset { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 2px 10px; min-width: 0; max-width: 100%; }
241
+ .q-reset-go { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; white-space: nowrap; }
242
+ .q-reset-go .ic, .q-reset-go .spin { width: 11px; height: 11px; }
243
+ .q-reset-in { font-size: 11px; }
240
244
  /* While a reset is being used or the quota is asked after the vendor's page: the old bars stay and breathe. */
241
245
  .quota.is-resetting .bar > span, .rs-win.is-busy .bar > span { animation: rs-wait 1.2s var(--ease-out) infinite alternate; }
242
246
  @keyframes rs-wait { from { opacity: 1; } to { opacity: .45; } }
@@ -689,7 +693,7 @@ a.btn:hover { text-decoration: none; }
689
693
  .sess-busy .sess-dot { background: var(--ok-bar); animation: pulse 1.4s ease-in-out infinite; }
690
694
  .sess-unknown .sess-dot { background: transparent; border: 1px solid var(--faint); }
691
695
  .sess-cwd { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
692
- .sess-guessed { cursor: help; }
696
+ .sess-guessed, .sess-from { cursor: help; }
693
697
  .sess-run { flex: 0 1 auto; min-width: 0; max-width: 24em; }
694
698
  .sess-run-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
695
699
  .sess-run-more { flex: none; font-weight: 600; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sideby",
3
- "version": "0.36.1",
3
+ "version": "0.38.0",
4
4
  "description": "Run work, personal and API-key accounts at the same time, without their configs drifting apart.",
5
5
  "license": "MIT",
6
6
  "author": "Adonis0123 (https://github.com/Adonis0123)",
@@ -123,6 +123,10 @@
123
123
  "type": "string",
124
124
  "description": "Path of the session's record."
125
125
  },
126
+ "startedFrom": {
127
+ "type": "string",
128
+ "description": "Started From: the app the session was started from, as the host's own record says (Claude Code's `entrypoint`). `orca`, `claude-desktop`, `script` (`claude -p`, scripts, the Agent SDK) or the host's value with only letters, digits and `._-`, at most 24 characters. Left out for a plain terminal and for hosts that do not say (Codex, Grok, pi)."
129
+ },
126
130
  "reference": {
127
131
  "type": "string",
128
132
  "description": "The Session Reference in English: one sentence that points another AI at the session and its record."
@@ -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.36.1"
5
+ version: "0.38.0"
6
6
  requires:
7
7
  bins: [sideby, node]
8
8
  cliHelp: sideby --help
@@ -40,7 +40,7 @@ Account refs are `<family>:<name>`; a bare `<name>` works only when it is unique
40
40
  |---|---|---|
41
41
  | Install sideby, or set up a new account ("add cc008") | `sideby --version`, `sideby list --json`, `sideby new <family> --next --json` | `references/setup.md` |
42
42
  | Show which account a session is (`[cc001]` in the status line or tab title) | `sideby list --json` for the labels | `references/badge.md` |
43
- | Find which session an account is running now ("cc002 现在在干嘛", "which session is cc002 running", "哪个会话在等我"), or copy one for another AI ("复制 cc002 的会话 id", "copy cc002's session for another AI", "把这个会话交给另一个 AI"); which Run (dispatched task) a session works for ("cc002 在哪个任务里", "which run is cc002 working on", "打开它的任务看板") | `sideby sessions [<account>\|<family>] --json`, `sideby sessions copy <account\|id> [--as reference\|id\|resume] --json`, `sideby sessions open-run <account\|id> --json` | `references/sessions.md` |
43
+ | Find which session an account is running now ("cc002 现在在干嘛", "which session is cc002 running", "哪个会话在等我"), or copy one for another AI ("复制 cc002 的会话 id", "copy cc002's session for another AI", "把这个会话交给另一个 AI"); which Run (dispatched task) a session works for ("cc002 在哪个任务里", "which run is cc002 working on", "打开它的任务看板"); which account an Orca chat or another app's session runs in ("这个 Orca 对话用的是哪个账号", "which account is this Orca chat using") | `sideby sessions [<account>\|<family>] --json`, `sideby sessions copy <account\|id> [--as reference\|id\|resume] --json`, `sideby sessions open-run <account\|id> --json` | `references/sessions.md` |
44
44
  | Find where a setting, page or feature of sideby lives ("语言在哪改", "where is the dark mode setting", "远程控制在哪关") — not sessions: for those use `sideby history` | `sideby commands <words> --json` (English or Chinese words), then do it with the `cliCommand` it returns or tell the user the `panel` place | `references/panel.md` |
45
45
  | See which commands sideby has ("有哪些命令", "which commands exist", "sideby 有哪些和额度有关的命令", "what can I type in a terminal") | `sideby commands --json` (no words): every command by task with `usage`, `description` and a runnable `example`, the `common` ones first | `references/panel.md` |
46
46
  | Find a session from before, in any account ("find a session I had before", "找一下我上周改登录页的那个会话", "sideby 项目最近的会话", "按日期分组看看"), read it, or continue it where it was | `sideby history [<words>...] [--project <name>] [--since today\|7d\|30d] [--group project\|day\|category] --json`, `sideby history show <id> --json`, `sideby history projects --json`; `--tools` also searches tool output | `references/sessions.md` |
@@ -53,7 +53,7 @@ Account refs are `<family>:<name>`; a bare `<name>` works only when it is unique
53
53
  | Hide or show a tool or an account in the lists ("too many shown", "hide pi") | `sideby hide <family\|ref> --json`, `sideby unhide <family\|ref> --json`, `sideby list --all` | `references/panel.md` |
54
54
  | Turn quota checks on or off, or fix outdated Codex/Grok quota | `sideby quota check <family> on|off --json`, `sideby quota [family] --refresh --json` | `references/quota.md` |
55
55
  | See whether an account holds a limit reset ("do I have a reset?", "有没有重置次数", "还能重置几次"), or how old a quota number is | `sideby quota [family] --json` (`quota.limitResets`, each window's `observedAt`) | `references/quota.md` |
56
- | Use a limit reset ("use a reset", "reset my Codex quota", "用一次重置", "把额度重置一下", "去 claude.ai 用重置") | `sideby quota reset <ref> --json` (exit 10: the plan; show it and ask the user), then `sideby quota reset <ref> --yes --operation <operationId> --json`; Claude: `sideby quota reset <ref> --open` | `references/quota.md` |
56
+ | Use a limit reset ("use a reset", "reset my Codex quota", "用一次重置", "把额度重置一下", "去 claude.ai 用重置") | `sideby quota reset <ref> --json` (exit 10: the plan; show it and ask the user), then `sideby quota reset <ref> --yes --operation <operationId> --json`; Claude: `sideby quota reset <ref> --open [--profile <browser user>]` | `references/quota.md` |
57
57
  | Set the model, effort, Remote Control or the Advisor | `sideby model <ref> --json`, `sideby remote-control --json`, `sideby advisor --json` | `references/panel.md` |
58
58
  | Start sideby at login ("开机启动", "start the panel when I log in") | `sideby autostart --json`, `sideby autostart on --json` (exit 10 first) | `references/panel.md` |
59
59
  | Show quota in the macOS menu bar ("状态栏显示额度", "menu bar"), its icon is missing ("状态栏没有图标"), or change its shortcut ("换个快捷键", "帮我挑个顺手的快捷键") | `sideby menubar --json`, `sideby menubar on --json` (exit 10 first), `sideby menubar snapshot --json`, `sideby menubar hotkey [<keys>] --json` | `references/panel.md` |
@@ -34,7 +34,7 @@ Using a limit reset cannot be undone. **Never add `--yes` on your own**: not to
34
34
 
35
35
  sideby never changes the count or the bars itself: report only what `quota` says.
36
36
 
37
- **Claude Code** (only Claude's website can use one): `sideby quota reset <ref> --json` answers `outcome: "open-vendor-page"` with `url` (`https://claude.ai/settings/usage`), `identity` (the account's email) and `tight` (the windows at their warning level). sideby cannot see whether the account holds a reset. Tell the user to use it on that page, signed in as that email; `sideby quota reset <ref> --open` opens the page in the account's browser profile (ask first: it opens a window). Afterwards `sideby quota <ref> --refresh --json` reads the new numbers. Which limit it restores is Anthropic's rule: a Fable reset gives back the Fable share of the week, and a 5-hour reset restores that window whole.
37
+ **Claude Code** (only Claude's website can use one): `sideby quota reset <ref> --json` answers `outcome: "open-vendor-page"` with `url` (`https://claude.ai/settings/usage`), `identity` (the account's email) and `tight` (the windows at their warning level). sideby cannot see whether the account holds a reset. Tell the user to use it on that page, signed in as that email; `sideby quota reset <ref> --open` opens the page in the account's browser profile (ask first: it opens a window); add `--profile <name>` to open it in another Chrome browser user (a folder, name or Google account from `sideby browser --json`), for example when the user says which browser is signed in as that account. Afterwards `sideby quota <ref> --refresh --json` reads the new numbers. Which limit it restores is Anthropic's rule: a Fable reset gives back the Fable share of the week, and a 5-hour reset restores that window whole.
38
38
 
39
39
  Any other tool answers `code: "no-limit-reset"`: say sideby cannot use one there and point to the vendor's own usage page.
40
40
 
@@ -1,6 +1,6 @@
1
1
  # Sessions: which session each account runs, finding one from before, handing one to another AI, and telling it something
2
2
 
3
- For "which session is cc002 running", "cc002 现在在干嘛", "cc002 在哪个任务里", "哪个会话在等我", "copy cc002's session id for another AI", "复制 cc002 的会话给另一个 AI", "告诉 cc002 ……", "把这张截图发给 cc003", "send this to the codex session"; for past sessions, "find a session I had before", "找一下我上周改登录页的那个会话", "sideby 项目最近的会话".
3
+ For "which session is cc002 running", "cc002 现在在干嘛", "cc002 在哪个任务里", "这个 Orca 对话用的是哪个账号", "哪个会话在等我", "copy cc002's session id for another AI", "复制 cc002 的会话给另一个 AI", "告诉 cc002 ……", "把这张截图发给 cc003", "send this to the codex session"; for past sessions, "find a session I had before", "找一下我上周改登录页的那个会话", "sideby 项目最近的会话".
4
4
 
5
5
  ## See them
6
6
 
@@ -9,6 +9,7 @@ Run `sideby sessions --json` (or `sideby sessions <account|family> --json` for o
9
9
  - `label` is the Session Label, `<account> · <the host's own title> · <first 8 of the id>`, as in `cc002 · knip cleanup · 61230c3d`. Use it when you name a session to the user; sideby never invents the title.
10
10
  - `status`: `needs-you` (the user has to act on it: tell the user first), `busy`, `idle`, or `unknown` where the host does not say. Sessions that need the user come first. With `needs-you`, `reason` says why, so tell the user what to do: `host-waits` (it waits in its terminal for a permission or an answer), `pending-decision` (it asked something while Unattended Mode was on: show it with `sideby unattended pending --json`, see `unattended.md`), `message-to-approve` (a Message to it waits for the user to approve it in its terminal) or `message-to-paste` (a Message to it waits to be pasted: `sideby messages --to <session-id> --json` gives the line, see "Tell a session something" below).
11
11
  - `cwd`, `startedAt`, `updatedAt`, `transcript` (the path of its record), `resumeCommand`.
12
+ - `startedFrom` (Claude sessions only): the app the session was started from, as Claude Code records it: `orca`, `claude-desktop`, `script` (`claude -p`, a script or the Agent SDK), or another app's own name such as `claude-vscode` (VS Code). No `startedFrom` means a plain terminal, or a host that does not say. For "which account is this Orca chat using" / "这个 Orca 对话用的是哪个账号", find the session with `startedFrom: "orca"` (match its `cwd` or title with what the user sees) and answer with its `accountLabel`. If it is not the account they want, explain that Orca picks the account for its Chat panes itself, not through sideby; to use a certain account, they open a terminal pane in Orca and run that account's short command (for example `ccw`).
12
13
  - `guessed: true` means sideby could not tie a running Codex or pi program to a session and shows that account's newest session instead. Say "probably" when you report it.
13
14
 
14
15
  - `run` (only some sessions): the Run a local orchestrator such as the `agent-dispatch` skill gave this session, `{ title, laneTitle, role, board, url, others }`. For "cc002 在哪个任务里" / "which run is cc002 working on", answer with `title` (and `laneTitle`, the part it does; `others` lists further Runs it also works for) and give `board`, the Run Board's file on this computer; to open it for the user ("打开它的任务看板", "open cc002's run report"), run `sideby sessions open-run <account|session-id> --json` yourself: it opens the board with the default program, as the chip on the Panel's Sessions page does, and returns `{ opened, board, sessionId, label }`. It exits 1 with code `no-run` when the session is in no Run (or its board file is gone: ask the coordinating AI to show the board again), `board-changed` when the file changed while sideby checked it, and `several-sessions` like `copy` below. No `run` means no orchestrator claims the session, not an error.