sideby 0.34.0 → 0.35.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":"20261101T024154-fb1cda"}
1
+ {"id":"20261101T124822-834cc8"}
@@ -57,6 +57,8 @@ export interface NewSuggestion {
57
57
  alias?: string;
58
58
  /** Why the alias the pattern suggests was left out (taken, reserved); the Account is created without it. */
59
59
  aliasProblem?: string;
60
+ /** No short command was suggested, and how to get one (an API Account without `--vendor`, or no prefix to use). */
61
+ aliasHint?: string;
60
62
  }
61
63
  export declare function cmdNew(a: ParsedArgs, io: Io): Promise<number>;
62
64
  export declare function cmdRun(a: ParsedArgs, io: Io, command: 'run' | 'login'): Promise<number>;
@@ -27,7 +27,7 @@ import { SEARCH_CATALOG, searchCatalog } from '../core/search-catalog.js';
27
27
  import { SHELLS } from '../core/shell-init.js';
28
28
  import { clockText, daysText } from '../core/unattended-state.js';
29
29
  import { MODEL_NAME } from '../families/shared/model-args.js';
30
- import { AI_TASK_KINDS, hiddenIn, inDisplayOrder, pinnedIn, resetWhen, suggestAlias, suggestName, withPinned, } from '../panel/page-logic.js';
30
+ import { AI_TASK_KINDS, hiddenIn, inDisplayOrder, pinnedIn, resetWhen, suggestAlias, suggestName, vendorAlias, withPinned, } from '../panel/page-logic.js';
31
31
  import { createRuntime, UnknownFamilyError } from '../runtime.js';
32
32
  import { UsageError } from './args.js';
33
33
  import { c, clock, compactNumber, quotaText, table, truncate, tuningLines, usageText } from './format.js';
@@ -422,22 +422,44 @@ export async function cmdList(a, io) {
422
422
  return 0;
423
423
  }
424
424
  /**
425
- * `new --next`: the next name of a Family, and a short command following the pattern of its existing aliases,
426
- * from the same helpers the Panel uses (spec §3.16).
425
+ * `new --next` and `new --vendor`: the name (the next one of the Family with `--next`), and a short command from the
426
+ * same helpers the Panel uses (spec §3.16). A Subscription Account follows the pattern of the Family's aliases
427
+ * (`cc008`); an API Account is named after its Vendor (`cc-ds`) and never gets a numbered one.
427
428
  */
428
- async function suggestNew(rt, family, alias) {
429
+ async function suggestNew(rt, family, opts) {
429
430
  if (!(await rt.familyInfo()).some((f) => f.id === family))
430
431
  throw new UnknownFamilyError(`unknown family "${family}"; run \`sideby families\` to see them`);
431
432
  const all = await rt.accounts();
432
433
  const mine = all.filter((x) => x.family === family);
433
- const name = suggestName(mine.map((x) => x.name));
434
- if (alias !== undefined)
434
+ const name = opts.name ?? suggestName(mine.map((x) => x.name));
435
+ if (opts.alias !== undefined)
435
436
  return { name };
436
437
  const byRef = aliasesByAccount(aliasRefs(rt.config.aliases), all);
437
- const offer = suggestAlias(mine.map((x) => ({ family: x.family, name: x.name, ref: x.ref, aliases: byRef.get(x.ref) ?? [] })), family, name);
438
+ const logic = mine.map((x) => ({
439
+ family: x.family,
440
+ name: x.name,
441
+ ref: x.ref,
442
+ aliases: byRef.get(x.ref) ?? [],
443
+ }));
444
+ const ref = `${family}:${name}`;
445
+ if (opts.api && opts.vendor === undefined) {
446
+ const example = vendorAlias(logic, family, '<slug>');
447
+ return example
448
+ ? {
449
+ name,
450
+ aliasHint: `API accounts get a short command named after their vendor: add \`--vendor <slug>\` for ${example}, or run \`sideby alias add ${example} ${ref}\` later`,
451
+ }
452
+ : { name };
453
+ }
454
+ const offer = opts.api ? vendorAlias(logic, family, opts.vendor ?? '') : suggestAlias(logic, family, name);
438
455
  if (!offer)
439
- return { name };
440
- const problem = rt.aliasProblem(offer, `${family}:${name}`);
456
+ return opts.api
457
+ ? {
458
+ name,
459
+ aliasHint: `your ${family} short commands show no prefix to put before ${opts.vendor}: add one with \`sideby alias add <short> ${ref}\``,
460
+ }
461
+ : { name };
462
+ const problem = rt.aliasProblem(offer, ref);
441
463
  return problem ? { name, aliasProblem: `${offer}: ${problem}` } : { name, alias: offer };
442
464
  }
443
465
  export async function cmdNew(a, io) {
@@ -445,12 +467,23 @@ export async function cmdNew(a, io) {
445
467
  const next = a.flags.has('next');
446
468
  if (!family || (next ? given !== undefined : !given) || a.positionals.length > 2)
447
469
  throw new UsageError(next
448
- ? 'usage: sideby new <family> --next [--api] [--alias <short-command>]; --next picks the name, so leave it out'
449
- : 'usage: sideby new <family> <name> [--api] [--alias <short-command>], or `--next` instead of <name>');
470
+ ? 'usage: sideby new <family> --next [--api [--vendor <slug>]] [--alias <short-command>]; --next picks the name, so leave it out'
471
+ : 'usage: sideby new <family> <name> [--api [--vendor <slug>]] [--alias <short-command>], or `--next` instead of <name>');
450
472
  const givenAlias = a.flags.get('alias');
473
+ const givenVendor = a.flags.get('vendor');
474
+ const vendor = typeof givenVendor === 'string' ? givenVendor.trim() : undefined;
475
+ if (vendor !== undefined && !a.flags.has('api'))
476
+ throw new UsageError('--vendor names the vendor an API account calls; add --api (usage: sideby new <family> --next --api --vendor <slug>)');
477
+ if (vendor === '')
478
+ throw new UsageError('--vendor needs a short name for the vendor, such as ds (DeepSeek)');
451
479
  const rt = await createRuntime();
452
- const suggestion = next
453
- ? await suggestNew(rt, family, typeof givenAlias === 'string' ? givenAlias : undefined)
480
+ const suggestion = next || vendor !== undefined
481
+ ? await suggestNew(rt, family, {
482
+ ...(next ? {} : { name: given }),
483
+ ...(typeof givenAlias === 'string' ? { alias: givenAlias } : {}),
484
+ api: a.flags.has('api'),
485
+ ...(vendor !== undefined ? { vendor } : {}),
486
+ })
454
487
  : undefined;
455
488
  const name = suggestion?.name ?? given;
456
489
  const alias = typeof givenAlias === 'string' ? givenAlias : suggestion?.alias;
@@ -488,6 +521,8 @@ export async function cmdNew(a, io) {
488
521
  io.out(`${c.green('✓')} short command ${c.bold(res.alias.name)} (in a new shell)`);
489
522
  else if (res.alias)
490
523
  io.out(` ${c.red('✗')} ${res.alias.message}`);
524
+ else if (suggestion?.aliasHint)
525
+ io.out(` ${c.dim('·')} no short command yet. ${suggestion.aliasHint[0]?.toUpperCase()}${suggestion.aliasHint.slice(1)}`);
491
526
  printShellInitWrites(io, res.shellInitFiles ?? [], home);
492
527
  io.out('\nNext:');
493
528
  for (const n of res.nextSteps)
@@ -843,8 +843,13 @@ export const OUTPUT_SCHEMAS = {
843
843
  nextSteps: Type.Array(Str),
844
844
  alias: Type.Optional(Type.Object({ name: Str, added: Type.Boolean(), message: Type.Optional(Str) }, { description: 'The `--alias` short command; `added: false` means the Account exists without it.' })),
845
845
  shellInitFiles: Type.Optional(ShellInitFiles),
846
- suggestion: Type.Optional(Type.Object({ name: Str, alias: Type.Optional(Str), aliasProblem: Type.Optional(Str) }, {
847
- description: 'Only with `--next`: the picked name, the short command that follows the existing pattern, or why that short command was left out.',
846
+ suggestion: Type.Optional(Type.Object({
847
+ name: Str,
848
+ alias: Type.Optional(Str),
849
+ aliasProblem: Type.Optional(Str),
850
+ aliasHint: Type.Optional(Str),
851
+ }, {
852
+ description: 'Only with `--next` or `--vendor`: the name, the short command suggested for it (the existing pattern, `cc008`, for a subscription account; the prefix and the vendor, `cc-ds`, for an API account with `--vendor`), why that short command was left out (`aliasProblem`), or, when none was suggested, how to get one (`aliasHint`, such as an API account without `--vendor`).',
848
853
  })),
849
854
  pickCommandOffer: Type.Optional(Type.Object({ name: Str, command: Str, shadows: Type.Optional(Str) }, {
850
855
  description: 'Set once, when this is the Family’s second subscription account and it has no pick command: the command that adds one.',
@@ -16,21 +16,25 @@ const COMMAND_HELP = {
16
16
  key: 'sideby key <account> [--var <NAME>] [--json]\nEnter an API key without echo. Run in a terminal or use the Panel key box.',
17
17
  try: 'sideby try <account> [--model <model>] [--yes] [--json]\nSend a short request through the Host. This spends a few tokens. Exit 10 waits for --yes.\n<account> may be a short command; its arguments apply as in sideby run. --model tries another model once.',
18
18
  plugins: 'sideby plugins [--json]\nsideby plugins new <id> [--json]\nsideby plugins check <id|path> [--json]\nPlugins run as you, with your permissions. Only load plugins you trust.',
19
- new: `sideby new <family> <name> [--api] [--alias <short>] [--json]
20
- sideby new <family> --next [--api] [--alias <short>] [--json]
19
+ new: `sideby new <family> <name> [--api [--vendor <slug>]] [--alias <short>] [--json]
20
+ sideby new <family> --next [--api [--vendor <slug>]] [--alias <short>] [--json]
21
21
 
22
22
  Create an account directory (~/.claude-<name>, ~/.codex-<name>, ~/.grok-<name>, ~/.pi-<name>/agent) and link or
23
23
  copy the main account's shared items into it. \`sideby families <family>\` lists them.
24
24
 
25
25
  --next pick the name: the next number after the highest numbered account (001…007 → 008), else work;
26
26
  without --alias, also add a short command that follows your existing ones (cc007 → cc008)
27
- --api API account: also writes an empty proxy.env template (mode 600) for the user to fill in
27
+ --api API account: also writes an empty proxy.env template (mode 600) for the user to fill in;
28
+ it gets no numbered short command
29
+ --vendor <slug> with --api: the vendor it calls, in a few letters (ds, kimi, glm); without --alias, the short
30
+ command is your prefix and the vendor (cc-ds), so it says what it calls
28
31
  --alias <short> add a short command for it to the config (it becomes a shell function)
29
32
 
30
33
  Examples:
31
34
  sideby new claude --next --json # ~/.claude-008 plus cc008 when cc001…cc007 exist
32
35
  sideby new claude work # ~/.claude-work
33
36
  sideby new claude deepseek --api # then the user fills in ~/.claude-deepseek/proxy.env
37
+ sideby new claude --next --api --vendor ds --json # ~/.claude-009 plus cc-ds when cc001… exist
34
38
 
35
39
  Writes: the account directory; the config \`aliases\` and every \`shellInitFile\` when a short command is added.
36
40
  Next: the user signs in with \`sideby login <account>\` (subscription) or fills in proxy.env (API).
@@ -462,7 +466,7 @@ const COMMANDS = {
462
466
  flags: ['json', 'all', 'slot-end'],
463
467
  valued: ['for', 'until', 'days', 'from', 'to', 'name', 'at'],
464
468
  },
465
- new: { flags: ['api', 'json', 'next'], valued: ['alias'] },
469
+ new: { flags: ['api', 'json', 'next'], valued: ['alias', 'vendor'] },
466
470
  alias: { flags: ['json', 'yes'], valued: ['pick'] },
467
471
  doctor: { flags: ['fix', 'force', 'json'] },
468
472
  quota: { flags: ['json', 'yes', 'refresh'] },
@@ -41,8 +41,8 @@ export const CLI_COMMANDS = [
41
41
  {
42
42
  id: 'new',
43
43
  group: 'accounts',
44
- usage: 'sideby new <family> <name>|--next [--api] [--alias <short>]',
45
- help: 'create an account (families: claude, codex, grok, pi); --next picks the next name and short command (cc008); --alias also adds a short command such as cc008',
44
+ usage: 'sideby new <family> <name>|--next [--api [--vendor <slug>]] [--alias <short>]',
45
+ help: "create an account (families: claude, codex, grok, pi); --next picks the next name and short command (cc008); --api --vendor ds names an API account's short command after its vendor (cc-ds); --alias also adds a short command such as cc008",
46
46
  summary: { en: 'Create an account; --next picks the name for you', zh: '新建账号;--next 自动起名' },
47
47
  example: 'sideby new claude --next',
48
48
  common: 4,
@@ -265,6 +265,7 @@ declare const en: {
265
265
  'group.attentionShow': string;
266
266
  'acct.alias': string;
267
267
  'acct.aliasArgs': string;
268
+ 'acct.titleAlias': string;
268
269
  'acct.api': string;
269
270
  'acct.model': string;
270
271
  'acct.signedOut': string;
@@ -1239,6 +1240,12 @@ declare const en: {
1239
1240
  'nf.aliasPh': string;
1240
1241
  'nf.aliasHint': string;
1241
1242
  'nf.aliasSuggested': string;
1243
+ 'nf.aliasVendor': string;
1244
+ 'nf.aliasVendorTip': string;
1245
+ 'nf.vendor': string;
1246
+ 'nf.vendorPh': string;
1247
+ 'nf.vendorHint': string;
1248
+ 'nf.vendorWord': string;
1242
1249
  'nf.aliasBad': string;
1243
1250
  'nf.aliasReserved': string;
1244
1251
  'nf.aliasTaken': string;
@@ -267,6 +267,7 @@ const en = {
267
267
  'group.attentionShow': 'Show {name}',
268
268
  'acct.alias': 'Alias',
269
269
  'acct.aliasArgs': 'Alias, starts this account with {args}',
270
+ 'acct.titleAlias': '{alias} starts {ref}',
270
271
  'acct.api': 'API',
271
272
  'acct.model': 'Model',
272
273
  'acct.signedOut': 'Signed out',
@@ -1241,6 +1242,12 @@ const en = {
1241
1242
  'nf.aliasPh': 'none',
1242
1243
  'nf.aliasHint': 'A shell command that starts this account. Leave it empty for none.',
1243
1244
  'nf.aliasSuggested': 'Follows the short commands of your other {host} accounts.',
1245
+ 'nf.aliasVendor': 'Named after the vendor, so you can tell your API accounts apart.',
1246
+ 'nf.aliasVendorTip': 'Fill in the vendor above to get {example}.',
1247
+ 'nf.vendor': 'Vendor',
1248
+ 'nf.vendorPh': 'ds, kimi, glm…',
1249
+ 'nf.vendorHint': 'Who this key is from, in a few letters. It names the short command.',
1250
+ 'nf.vendorWord': 'vendor',
1244
1251
  'nf.aliasBad': 'Use letters, digits, "_" or "-", starting with a letter or "_".',
1245
1252
  'nf.aliasReserved': '"{alias}" is a shell keyword or builtin. Pick another.',
1246
1253
  'nf.aliasTaken': '{alias} already starts {ref}.',
@@ -1868,6 +1875,7 @@ const zh = {
1868
1875
  'group.attentionShow': '定位到 {name}',
1869
1876
  'acct.alias': '别名',
1870
1877
  'acct.aliasArgs': '别名,启动这个账号并附加 {args}',
1878
+ 'acct.titleAlias': '{alias} 启动 {ref}',
1871
1879
  'acct.api': 'API',
1872
1880
  'acct.model': '模型',
1873
1881
  'acct.signedOut': '未登录',
@@ -2842,6 +2850,12 @@ const zh = {
2842
2850
  'nf.aliasPh': '不设置',
2843
2851
  'nf.aliasHint': '在终端里启动这个账号的命令。留空表示不设置。',
2844
2852
  'nf.aliasSuggested': '按你其他 {host} 账号的短命令规律填入。',
2853
+ 'nf.aliasVendor': '按厂商命名,几个 API 账号一眼就能分清。',
2854
+ 'nf.aliasVendorTip': '在上面填厂商,就会得到 {example}。',
2855
+ 'nf.vendor': '厂商',
2856
+ 'nf.vendorPh': 'ds、kimi、glm…',
2857
+ 'nf.vendorHint': '这个 key 是哪家的,写几个字母就行。短命令按它命名。',
2858
+ 'nf.vendorWord': '厂商',
2845
2859
  'nf.aliasBad': '只能用字母、数字、“_”或“-”,并以字母或“_”开头。',
2846
2860
  'nf.aliasReserved': '“{alias}”是 shell 关键字或内置命令,请换一个。',
2847
2861
  'nf.aliasTaken': '{alias} 已用于启动 {ref}。',
@@ -352,13 +352,41 @@ export declare function fixPrompt(findings: readonly {
352
352
  check: string;
353
353
  }): string;
354
354
  /**
355
- * A short command to offer for a new Account `name` of a Family, from the config aliases of its existing Accounts:
356
- * an alias that is a prefix plus its Account's name (`cc001` for `claude:001`) gives the prefix, the most common
357
- * one wins (then the longer, then the first alphabetically), and the offer is that prefix plus `name` (`cc008`).
358
- * Aliases that do not end in their Account's name (`codex001` for `codex:main`) are ignored. Empty when no
359
- * pattern shows, or without a name. The caller still checks the result like any alias.
355
+ * The prefix a Family's short commands put before their Account's name, from the config aliases of its Accounts: an
356
+ * alias that is a prefix plus its Account's name (`cc001` for `claude:001`) gives the prefix, and the most common one
357
+ * wins (then the longer, then the first alphabetically). Aliases that do not end in their Account's name (`codex001`
358
+ * for `codex:main`, `cc-ds` for `claude:011`) are ignored. Empty when no pattern shows.
359
+ */
360
+ export declare function aliasPrefix(accounts: LogicAccount[], family: string): string;
361
+ /**
362
+ * A short command to offer for a new Subscription Account `name` of a Family: its alias prefix (`aliasPrefix`) plus
363
+ * `name` (`cc008`). Empty when no pattern shows, or without a name. The caller still checks the result like any alias.
360
364
  */
361
365
  export declare function suggestAlias(accounts: LogicAccount[], family: string, name: string): string;
366
+ /**
367
+ * A short command to offer for a new API Account of a Family that calls `vendor` (its Vendor Slug, used as given): the
368
+ * Family's alias prefix, a dash and the slug (`cc-ds`), so the name says what the Account calls rather than a number.
369
+ * A prefix that already ends in a dash or underscore (`cc-` from `cc-001`) gets no second one. Empty without a slug,
370
+ * or when the Family's short commands show no prefix: sideby never invents one. The caller still checks the result
371
+ * like any alias (an invalid or taken slug fails there).
372
+ */
373
+ export declare function vendorAlias(accounts: LogicAccount[], family: string, vendor: string): string;
374
+ /**
375
+ * An Account's short commands in the order the Panel lists them: those that only start it (`pi001`) first, then those
376
+ * that add Host arguments (`pi-glm`, `pi-kimi`), each group in name order.
377
+ */
378
+ export declare function orderedAliases(a: LogicAccount): string[];
379
+ /**
380
+ * What names an Account in its row or card. An API Account with a short command that adds no arguments is named by
381
+ * it (`cc-kimi`): the short command says which Vendor it calls, its name is only a number, and its ref stays in the
382
+ * line under the title. Every other Account keeps its name. `aliases`: the short commands shown after the title, in
383
+ * `orderedAliases` order.
384
+ */
385
+ export declare function accountTitle(a: LogicAccount): {
386
+ title: string;
387
+ byAlias: boolean;
388
+ aliases: string[];
389
+ };
362
390
  /**
363
391
  * Why `alias` cannot become the short command of `ref`, by the config rules: `pattern` (not a shell-safe name,
364
392
  * matched against the config's own pattern source), `reserved` (a shell keyword, builtin or `sideby`), `taken`
@@ -702,15 +702,12 @@ export function fixPrompt(findings, words) {
702
702
  return [words.lead, items.join('\n\n'), ...tail].join('\n\n');
703
703
  }
704
704
  /**
705
- * A short command to offer for a new Account `name` of a Family, from the config aliases of its existing Accounts:
706
- * an alias that is a prefix plus its Account's name (`cc001` for `claude:001`) gives the prefix, the most common
707
- * one wins (then the longer, then the first alphabetically), and the offer is that prefix plus `name` (`cc008`).
708
- * Aliases that do not end in their Account's name (`codex001` for `codex:main`) are ignored. Empty when no
709
- * pattern shows, or without a name. The caller still checks the result like any alias.
705
+ * The prefix a Family's short commands put before their Account's name, from the config aliases of its Accounts: an
706
+ * alias that is a prefix plus its Account's name (`cc001` for `claude:001`) gives the prefix, and the most common one
707
+ * wins (then the longer, then the first alphabetically). Aliases that do not end in their Account's name (`codex001`
708
+ * for `codex:main`, `cc-ds` for `claude:011`) are ignored. Empty when no pattern shows.
710
709
  */
711
- export function suggestAlias(accounts, family, name) {
712
- if (!name)
713
- return '';
710
+ export function aliasPrefix(accounts, family) {
714
711
  const counts = {};
715
712
  for (const a of accounts) {
716
713
  if (a.family !== family)
@@ -721,8 +718,52 @@ export function suggestAlias(accounts, family, name) {
721
718
  counts[prefix] = (counts[prefix] || 0) + 1;
722
719
  }
723
720
  }
724
- const best = Object.keys(counts).sort((x, y) => (counts[y] || 0) - (counts[x] || 0) || y.length - x.length || (x < y ? -1 : x > y ? 1 : 0))[0];
725
- return best ? best + name : '';
721
+ return (Object.keys(counts).sort((x, y) => (counts[y] || 0) - (counts[x] || 0) || y.length - x.length || (x < y ? -1 : x > y ? 1 : 0))[0] || '');
722
+ }
723
+ /**
724
+ * A short command to offer for a new Subscription Account `name` of a Family: its alias prefix (`aliasPrefix`) plus
725
+ * `name` (`cc008`). Empty when no pattern shows, or without a name. The caller still checks the result like any alias.
726
+ */
727
+ export function suggestAlias(accounts, family, name) {
728
+ if (!name)
729
+ return '';
730
+ const prefix = aliasPrefix(accounts, family);
731
+ return prefix ? prefix + name : '';
732
+ }
733
+ /**
734
+ * A short command to offer for a new API Account of a Family that calls `vendor` (its Vendor Slug, used as given): the
735
+ * Family's alias prefix, a dash and the slug (`cc-ds`), so the name says what the Account calls rather than a number.
736
+ * A prefix that already ends in a dash or underscore (`cc-` from `cc-001`) gets no second one. Empty without a slug,
737
+ * or when the Family's short commands show no prefix: sideby never invents one. The caller still checks the result
738
+ * like any alias (an invalid or taken slug fails there).
739
+ */
740
+ export function vendorAlias(accounts, family, vendor) {
741
+ const slug = String(vendor || '').trim();
742
+ if (!slug)
743
+ return '';
744
+ const prefix = aliasPrefix(accounts, family).replace(/[-_]+$/, '');
745
+ return prefix ? prefix + '-' + slug : '';
746
+ }
747
+ /**
748
+ * An Account's short commands in the order the Panel lists them: those that only start it (`pi001`) first, then those
749
+ * that add Host arguments (`pi-glm`, `pi-kimi`), each group in name order.
750
+ */
751
+ export function orderedAliases(a) {
752
+ const all = (a.aliases || []).slice().sort((x, y) => (x < y ? -1 : x > y ? 1 : 0));
753
+ return all.filter((x) => !aliasArgsOf(a, x)).concat(all.filter((x) => aliasArgsOf(a, x)));
754
+ }
755
+ /**
756
+ * What names an Account in its row or card. An API Account with a short command that adds no arguments is named by
757
+ * it (`cc-kimi`): the short command says which Vendor it calls, its name is only a number, and its ref stays in the
758
+ * line under the title. Every other Account keeps its name. `aliases`: the short commands shown after the title, in
759
+ * `orderedAliases` order.
760
+ */
761
+ export function accountTitle(a) {
762
+ const all = orderedAliases(a);
763
+ const plain = a.kind === 'api' ? all.filter((x) => !aliasArgsOf(a, x))[0] : undefined;
764
+ if (plain)
765
+ return { title: plain, byAlias: true, aliases: all.filter((x) => x !== plain) };
766
+ return { title: a.name, byAlias: false, aliases: all };
726
767
  }
727
768
  /**
728
769
  * Why `alias` cannot become the short command of `ref`, by the config rules: `pattern` (not a shell-safe name,
@@ -5,7 +5,7 @@ import { groupsToAccept } from '../core/inbound.js';
5
5
  import { quotaIsStale } from '../core/quota-levels.js';
6
6
  import { remoteControlTodo } from '../core/remote-control.js';
7
7
  import { catalogMatchLevel, catalogNorm, searchCatalog } from '../core/search-catalog.js';
8
- import { aiTaskAccounts, aliasArgsOf, aliasIssue, askBridge, askBridged, askCopy, attentionReasons, attentionWhy, autostartNote, bindingWindow, cacheHitRate, canLeaveLocal, categoryOrder, codeSwapOutcome, dotsKeepKeyboard, enableOutcome, 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, panelFixes, panelHint, panelLang, panelMigration, panelPrefs, passedWindow, pinnedIn, quotaAskable, quotaHighLevel, quotaPressure, radioStep, reloadForBuild, remoteControlSummary, reorder, resetWhen, rowBadge, runCodeSwap, saveHandoffChange, sendBlock, sendFileProblem, sendResultView, sessionAge, sessionLabelParts, sessionRowShape, shortCwd, shortSessionLabel, sortAccounts, sortSessions, steadyOrder, stripSecrets, suggestAlias, suggestName, switchFailure, tailInView, taskFindings, uaDayRuns, uaGroupPending, uaOnChoices, uaParseClock, uaPickTime, uaSameSlot, uaShouldRead, uaSlotNight, uaStatusParts, uaStepClock, uaToggleDay, uaWaitingCount, uaWhen, updatedAge, widthFollower, widthTier, windowState, withPinned, } from './page-logic.js';
8
+ import { accountTitle, aiTaskAccounts, aliasArgsOf, aliasIssue, aliasPrefix, askBridge, askBridged, askCopy, attentionReasons, attentionWhy, autostartNote, bindingWindow, cacheHitRate, canLeaveLocal, categoryOrder, codeSwapOutcome, dotsKeepKeyboard, enableOutcome, 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, orderedAliases, panelFixes, panelHint, panelLang, panelMigration, panelPrefs, passedWindow, pinnedIn, quotaAskable, quotaHighLevel, quotaPressure, radioStep, reloadForBuild, remoteControlSummary, reorder, resetWhen, rowBadge, runCodeSwap, saveHandoffChange, sendBlock, sendFileProblem, sendResultView, sessionAge, sessionLabelParts, sessionRowShape, shortCwd, shortSessionLabel, sortAccounts, 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
9
  const LOGIC = [
10
10
  quotaIsStale,
11
11
  catalogNorm,
@@ -21,6 +21,10 @@ const LOGIC = [
21
21
  taskFindings,
22
22
  aliasArgsOf,
23
23
  aliasIssue,
24
+ aliasPrefix,
25
+ orderedAliases,
26
+ accountTitle,
27
+ vendorAlias,
24
28
  attentionReasons,
25
29
  attentionWhy,
26
30
  quotaHighLevel,
@@ -1516,12 +1520,12 @@ const MAIN = String.raw `
1516
1520
  if (k === 'api') return h('span', { class: 'tag tag-warn', title: t('tip.api.body') }, t('acct.api'))
1517
1521
  return null
1518
1522
  }
1519
- // The short command, as quiet text after the name; every alias and its arguments are on hover.
1520
- function aliasText(a) {
1521
- const all = a.aliases || []
1522
- if (!all.length) return null
1523
- const lines = all.map((x) => { const args = aliasArgsOf(a, x); return x + ' · ' + (args ? t('acct.aliasArgs', { args: args.join(' ') }) : t('acct.alias')) })
1524
- return h('span', { class: 'alias', title: lines.join('\n') }, all[0])
1523
+ // An Account's short commands, as quiet text after its title: those that only start it first, then those with Host
1524
+ // arguments; each says on hover what it adds. A card too narrow for all of them ends in an ellipsis.
1525
+ function aliasText(a, list) {
1526
+ if (!list.length) return null
1527
+ const line = (x) => { const args = aliasArgsOf(a, x); return x + ' · ' + (args ? t('acct.aliasArgs', { args: args.join(' ') }) : t('acct.alias')) }
1528
+ return h('span', { class: 'aliases', title: list.map(line).join('\n') }, list.map((x) => h('span', { class: 'alias', title: line(x) }, x)))
1525
1529
  }
1526
1530
  // A Same Login row (spec §3.21) gets a link mark after the name; what it means is on hover.
1527
1531
  function loginMark(members) {
@@ -1533,11 +1537,13 @@ const MAIN = String.raw `
1533
1537
  // opts.linked: the directories a card marks as one login without speaking for them (its badge stays its own).
1534
1538
  function nameLine(a, members, opts) {
1535
1539
  const o = opts || {}
1540
+ // An API Account with a short command is named by it (cc-kimi); its ref is in the line under it.
1541
+ const named = accountTitle(a)
1536
1542
  return h('div', { class: 'ident-name' },
1537
1543
  pinSlot(a),
1538
- h('span', { class: 'name', title: a.name }, a.name),
1544
+ h('span', { class: 'name', title: named.byAlias ? t('acct.titleAlias', { alias: named.title, ref: a.ref }) : a.name }, named.title),
1539
1545
  loginMark(o.linked || members),
1540
- aliasText(a),
1546
+ aliasText(a, named.aliases),
1541
1547
  hiddenMark(isHidden(a) && !famHidden(a.family)),
1542
1548
  statusBadge(a, members))
1543
1549
  }
@@ -4845,7 +4851,7 @@ const MAIN = String.raw `
4845
4851
  const ready = fams.filter((f) => familyStatus(f) === 'ready')
4846
4852
  const pick = prefill && ready.some((f) => f.id === prefill.family) ? prefill.family : prefs.family && ready.some((f) => f.id === prefs.family) ? prefs.family : ready.length ? ready[0].id : ''
4847
4853
  // name / alias: what the user typed, or null while the field shows the suggestion (an emptied alias stays empty).
4848
- nf = { fams, family: pick, api: Boolean(prefill && prefill.api), name: null, alias: null, creating: false, result: null, error: null, els: {} }
4854
+ nf = { fams, family: pick, api: Boolean(prefill && prefill.api), vendor: '', name: null, alias: null, creating: false, result: null, error: null, els: {} }
4849
4855
  showDialog('create')
4850
4856
  renderCreate()
4851
4857
  if (nf.els.name) { nf.els.name.focus(); nf.els.name.select() }
@@ -4861,10 +4867,13 @@ const MAIN = String.raw `
4861
4867
  if (S.state && S.state.accounts.some((a) => a.ref === nf.family + ':' + name)) return t('nf.exists', { ref: nf.family + ':' + name })
4862
4868
  return ''
4863
4869
  }
4864
- // The short command offered for the typed name: the Family's alias pattern (cc001… gives cc008), if it is usable.
4870
+ // The short command offered for the typed name: for an API account the Family's prefix and the Vendor (cc-ds), shown
4871
+ // even when it cannot be used so the error under it says why; otherwise the Family's alias pattern (cc001… gives
4872
+ // cc008), if it is usable. An API account never gets a numbered one.
4865
4873
  function aliasSuggestion() {
4866
4874
  const name = nf.els.name.value.trim()
4867
4875
  if (!nf.family || !name || nameProblem()) return ''
4876
+ if (nf.api) return vendorAlias(S.state.accounts, nf.family, nf.vendor)
4868
4877
  const sug = suggestAlias(S.state.accounts, nf.family, name)
4869
4878
  return sug && !aliasIssue(sug, BOOT.aliasPattern, BOOT.reservedAliases, S.state.configAliases, nf.family + ':' + name) ? sug : ''
4870
4879
  }
@@ -4891,18 +4900,31 @@ const MAIN = String.raw `
4891
4900
  e.alias = h('input', { id: 'nf-alias', name: 'alias', type: 'text', autocomplete: 'off', autocapitalize: 'none', spellcheck: 'false', placeholder: t('nf.aliasPh'), maxlength: '64', 'aria-describedby': 'nf-alias-hint nf-alias-err', 'aria-invalid': 'false' })
4892
4901
  e.aliasHint = h('p', { class: 'field-hint', id: 'nf-alias-hint' })
4893
4902
  e.aliasErr = h('p', { class: 'field-error', id: 'nf-alias-err', role: 'alert' })
4894
- e.api = h('input', { id: 'nf-api', type: 'checkbox', 'aria-label': t('nf.api') })
4903
+ e.api = h('input', { id: 'nf-api', type: 'checkbox', 'aria-label': t('nf.api'), 'aria-controls': 'nf-vendor-field' })
4895
4904
  e.api.checked = nf.api
4905
+ e.vendor = h('input', { id: 'nf-vendor', name: 'vendor', type: 'text', autocomplete: 'off', autocapitalize: 'none', spellcheck: 'false', placeholder: t('nf.vendorPh'), maxlength: '32', 'aria-describedby': 'nf-vendor-hint' })
4906
+ e.vendor.value = nf.vendor
4907
+ // Grows in under "API key" when it is ticked; inert while folded, so Tab skips it.
4908
+ e.vendorField = h('div', { class: 'reveal' + (nf.api ? ' is-open' : ''), id: 'nf-vendor-field', inert: nf.api ? undefined : true },
4909
+ h('div', { class: 'reveal-in' }, h('div', { class: 'field' },
4910
+ h('label', { class: 'field', for: 'nf-vendor' }, h('span', null, t('nf.vendor')), e.vendor),
4911
+ h('p', { class: 'field-hint', id: 'nf-vendor-hint' }, t('nf.vendorHint')))))
4896
4912
  e.suggest = h('p', { class: 'field-hint', id: 'nf-sug' })
4897
4913
  e.error = h('p', { class: 'field-error', id: 'nf-err', role: 'alert' })
4898
4914
  e.preview = h('dl', { class: 'preview' })
4899
4915
  e.submit = h('button', { class: 'btn btn-primary', type: 'submit', form: 'nf-form', 'aria-label': t('nf.create') }, t('nf.create'))
4900
4916
  e.name.addEventListener('input', () => { nf.name = e.name.value; followAlias(); validateCreate(); renderPreview() })
4901
4917
  e.alias.addEventListener('input', () => { nf.alias = e.alias.value; validateCreate(); renderPreview() })
4918
+ e.vendor.addEventListener('input', () => { nf.vendor = e.vendor.value; followAlias(); validateCreate(); renderPreview() })
4902
4919
  e.api.addEventListener('change', () => {
4903
4920
  nf.api = e.api.checked
4921
+ e.vendorField.classList.toggle('is-open', nf.api)
4922
+ e.vendorField.inert = !nf.api
4904
4923
  // A refusal was about the old choice; the hint under it no longer applies.
4905
4924
  if (e.errNote) { e.errNote.remove(); e.errNote = null; nf.error = null }
4925
+ followAlias()
4926
+ validateCreate()
4927
+ renderPreview()
4906
4928
  })
4907
4929
  const cards = nf.fams.map((f) => {
4908
4930
  const st = familyStatus(f)
@@ -4930,10 +4952,13 @@ const MAIN = String.raw `
4930
4952
  h('span', { class: 'fam-text' }, h('span', { class: 'fam-title' }, t('ask.otherTool')), h('span', { class: 'fam-sub' }, t('ask.otherToolSub')))))),
4931
4953
  h('div', { class: 'field' }, h('label', { class: 'field', for: 'nf-name' }, h('span', null, t('nf.name')), e.name), e.suggest),
4932
4954
  // The first screen asks only for the tool and a name; the rest waits behind "More options".
4955
+ // "API key" comes before the short command: its Vendor names the short command (cc-ds).
4933
4956
  h('details', { class: 'more-opts', open: nf.api || Boolean(nf.alias) || Boolean(nf.error) || undefined },
4934
4957
  h('summary', null, t('nf.more')),
4958
+ h('div', null,
4959
+ h('div', { class: 'check-row' }, h('label', { class: 'check' }, e.api, h('span', null, h('b', null, t('nf.api')), h('span', { class: 'muted small' }, t('nf.apiHint')))), tip('api')),
4960
+ e.vendorField),
4935
4961
  h('div', { class: 'field' }, h('label', { class: 'field', for: 'nf-alias' }, h('span', null, t('nf.alias'), ' ', h('span', { class: 'muted small' }, t('nf.optional'))), e.alias), e.aliasHint, e.aliasErr),
4936
- h('div', { class: 'check-row' }, h('label', { class: 'check' }, e.api, h('span', null, h('b', null, t('nf.api')), h('span', { class: 'muted small' }, t('nf.apiHint')))), tip('api')),
4937
4962
  e.preview),
4938
4963
  e.error,
4939
4964
  e.errNote = nf.error ? errorNote(nf.error, create, nf.error.code === 'create-refused' && !nf.api ? t('nf.refusedApi') : null) : null,
@@ -4962,10 +4987,19 @@ const MAIN = String.raw `
4962
4987
  e.alias.classList.toggle('invalid', Boolean(aliasMsg))
4963
4988
  e.alias.setAttribute('aria-invalid', String(Boolean(aliasMsg)))
4964
4989
  e.aliasErr.textContent = aliasMsg
4965
- e.aliasHint.textContent = alias && alias === aliasSuggestion() ? t('nf.aliasSuggested', { host: family(nf.family).title }) : t('nf.aliasHint')
4990
+ e.aliasHint.textContent = aliasHintText(alias)
4966
4991
  if (!nf.creating) e.submit.disabled = Boolean(msg) || Boolean(aliasMsg) || !name || !nf.family
4967
4992
  return msg || aliasMsg
4968
4993
  }
4994
+ // What the line under the short command says: where a suggestion came from, or, for an API account without a
4995
+ // Vendor yet, that typing one gives cc-<vendor>.
4996
+ function aliasHintText(alias) {
4997
+ const host = nf.family ? family(nf.family).title : ''
4998
+ if (alias && alias === aliasSuggestion()) return t(nf.api ? 'nf.aliasVendor' : 'nf.aliasSuggested', { host })
4999
+ const example = nf.api && nf.family ? vendorAlias(S.state.accounts, nf.family, '<' + t('nf.vendorWord') + '>') : ''
5000
+ if (example && !alias && !nf.vendor.trim()) return t('nf.aliasVendorTip', { example })
5001
+ return t('nf.aliasHint')
5002
+ }
4969
5003
  function renderPreview() {
4970
5004
  const name = nf.els.name.value.trim()
4971
5005
  const ok = name && !nameProblem() && nf.family
@@ -317,6 +317,9 @@ code, .mono { font-family: var(--mono); font-size: 0.92em; }
317
317
  .ident-name { display: flex; align-items: center; gap: 6px; min-width: 0; flex-wrap: wrap; row-gap: 3px; }
318
318
  .ident-name .name { font-weight: var(--strong-weight); font-size: var(--font-size); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
319
319
  .ident-name .alias { color: var(--muted); font-family: var(--mono); font-size: 12px; white-space: nowrap; }
320
+ /* Every short command of an Account, in one line that ends in an ellipsis when a card is too narrow. */
321
+ .ident-name .aliases { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-family: var(--mono); font-size: 12px; }
322
+ .ident-name .aliases .alias + .alias { margin-left: 6px; }
320
323
  .ident-email { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
321
324
  .email-btn, .model-btn { all: unset; cursor: pointer; border-radius: 4px; }
322
325
  .model-btn:hover { color: var(--text); text-decoration: underline dotted; }
@@ -752,6 +755,14 @@ select:is(:hover, :focus) { --chevron: var(--text); }
752
755
  .check-row { display: flex; align-items: flex-start; gap: 8px; }
753
756
  .check-row .check { flex: 1; }
754
757
  .check-row .tip { margin-top: 12px; }
758
+ /* A field that belongs to a choice above it (the Vendor under "API key"): it grows in when the choice is made and
759
+ folds away when it is undone, instead of snapping the dialog. */
760
+ .reveal { display: grid; grid-template-rows: 0fr; opacity: 0; visibility: hidden; transition: grid-template-rows .18s ease, opacity .18s ease, visibility 0s .18s; }
761
+ .reveal.is-open { grid-template-rows: 1fr; opacity: 1; visibility: visible; transition: grid-template-rows .18s ease, opacity .18s ease; }
762
+ /* The side and bottom padding keep a focused input's outline inside the clipped box. */
763
+ .reveal > .reveal-in { min-height: 0; overflow: hidden; margin: 0 -4px; padding: 0 4px 4px; }
764
+ .reveal > .reveal-in > .field { padding-top: 12px; }
765
+ @media (prefers-reduced-motion: reduce) { .reveal, .reveal.is-open { transition: none; } }
755
766
  .check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--ctl-radius); transition: border-color .12s, background-color .12s; }
756
767
  .check:hover { border-color: var(--btn-hover-border); }
757
768
  .check:has(input:checked) { background: var(--accent-soft); border-color: transparent; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sideby",
3
- "version": "0.34.0",
3
+ "version": "0.35.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)",
package/schemas/new.json CHANGED
@@ -190,9 +190,12 @@
190
190
  },
191
191
  "aliasProblem": {
192
192
  "type": "string"
193
+ },
194
+ "aliasHint": {
195
+ "type": "string"
193
196
  }
194
197
  },
195
- "description": "Only with `--next`: the picked name, the short command that follows the existing pattern, or why that short command was left out."
198
+ "description": "Only with `--next` or `--vendor`: the name, the short command suggested for it (the existing pattern, `cc008`, for a subscription account; the prefix and the vendor, `cc-ds`, for an API account with `--vendor`), why that short command was left out (`aliasProblem`), or, when none was suggested, how to get one (`aliasHint`, such as an API account without `--vendor`)."
196
199
  },
197
200
  "pickCommandOffer": {
198
201
  "type": "object",
@@ -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.34.0"
5
+ version: "0.35.0"
6
6
  requires:
7
7
  bins: [sideby, node]
8
8
  cliHelp: sideby --help
@@ -68,7 +68,7 @@ Account refs are `<family>:<name>`; a bare `<name>` works only when it is unique
68
68
  | Short commands say "command not found" in a new terminal ("cc 用不了", "短命令不生效") | `sideby shell-init setup --json` (exit 10 first) | `references/setup.md` |
69
69
  | Do something in sideby as an AI Task (the first message came from sideby or the Panel's "Let AI do it") | follow the task it names | `references/ai-tasks.md` |
70
70
  | A Portal starts AI Tasks through sideby, or one of its tasks failed (`spec-version`, `bad-cwd`, "which account would it use?") | `sideby ask --choices --json`, `sideby ask --spec - --print --json` (read only) | `references/ai-tasks.md` |
71
- | Add an API account from a vendor's address or docs link, enter its key, check it works (also with a given model: "用 glm-5.3 试一下 pi") | `sideby new <family> --next --api --json`, then the user runs `sideby key <ref>`; `sideby try <ref|short command> [--model <m>] --json` (exit 10 first) | `references/ai-tasks.md` |
71
+ | Add an API account from a vendor's address or docs link, enter its key, check it works (also with a given model: "用 glm-5.3 试一下 pi") | `sideby new <family> --next --api --vendor <slug> --json` (short command named after the vendor, `cc-ds`), then the user runs `sideby key <ref>`; `sideby try <ref|short command> [--model <m>] --json` (exit 10 first) | `references/ai-tasks.md` |
72
72
  | Support a tool sideby does not list yet, or write a plugin | `sideby plugins new <id> --json`, `sideby plugins check <id> --json` | `references/ai-tasks.md` |
73
73
  | Choose the terminal the Panel opens for AI Tasks and sign-in | `sideby terminal --json`, `sideby terminal --set <id> --json` | — |
74
74
  | Tune the auto-compact threshold ("which compaction setting costs the fewest tokens"), use the suggestion or undo it | `sideby tune --json`, `sideby tune apply` (exit 10 first), `sideby tune undo` | `references/diagnose.md` |
@@ -7,11 +7,21 @@ Check the name first: `^[a-z0-9][a-z0-9-]{0,31}$`, and not already taken (`sideb
7
7
  ```sh
8
8
  sideby new claude work # subscription account: ~/.claude-work
9
9
  sideby new claude deepseek --api # API account: ~/.claude-deepseek with a proxy.env template (mode 600)
10
+ sideby new claude --next --api --vendor ds # API account 009 with the short command cc-ds (cc001… exist)
10
11
  sideby new claude 008 --alias cc008 # also adds the short command cc008 to config aliases
11
12
  ```
12
13
 
13
14
  Only pass `--alias` when the user wants a short command. To continue their numbering (`cc001`…`cc007` for `claude:001`…`claude:007`), use `sideby new claude --next --json` instead of a name: it picks `008` and `cc008` the same way the panel does (see `setup.md`). An invalid, reserved or taken alias is refused before anything is created (error `code: "alias-invalid"`). If `alias.added` is false in `--json`, the account exists but the alias is missing: tell the user the message, do not edit the config by hand.
14
15
 
16
+ ### API accounts: name the short command after the vendor
17
+
18
+ An API account's short command says which vendor it calls (`cc-ds`, `cc-kimi`), not a number: the user tells them apart by vendor, and the name stays right when the model changes. The account name stays numbered (`claude:009`).
19
+
20
+ - Find the Vendor: from the user's words or the docs link they gave; ask only when neither says.
21
+ - Pass it as `--vendor <slug>` with `--api`. Use these slugs: `ds` (DeepSeek), `glm` (Zhipu GLM / Z.ai), `kimi` (Moonshot Kimi), `qwen` (Alibaba Qwen / Bailian), `api` (the Host's own official API, such as Anthropic's for Claude Code), `relay` (a gateway or relay in front of several vendors). Another vendor: a short lowercase name the user would recognise (`minimax`, `doubao`).
22
+ - Name by vendor, not model: `cc-kimi`, not `cc-k3`. Several models of one vendor are one account with extra short commands that pass `--model` (below, `pi-kimi`), not more accounts.
23
+ - `sideby new` builds the short command from the prefix of the user's numbered ones (`cc` from `cc001`) and the slug. Read `suggestion`: `alias` is what it added; `aliasProblem` means it was taken or invalid (a second DeepSeek account: offer `cc-ds2` with `sideby alias add`); `aliasHint` means none was added (no `--vendor`, or no prefix to build from) and says how to add one. Never invent a prefix.
24
+
15
25
  Then:
16
26
 
17
27
  - **Subscription account**: tell the user to run `sideby login claude:work` in their own terminal (for pi, `sideby login pi:<name>` starts pi; then they type `/login`). Do not run it for them.
@@ -57,7 +57,7 @@ The prompt names the account and the reason. Run `sideby quota <ref> --json` and
57
57
  sideby ships no list of vendors, addresses or model names. Take every fact from the vendor's own documentation and the Host's own docs or `--help`, and tell the user which page you used. Do not use blog posts, other tools' preset lists or your memory for an address or a model name.
58
58
 
59
59
  1. From the docs (or the link the user gave), find: the address for the Family's API format (Claude Code needs an Anthropic-compatible address, Codex an OpenAI-compatible one), the variable the key goes in, and the model names, if the Host needs one.
60
- 2. `sideby new <family> --next --api --json`. It creates `proxy.env` (mode 600) in the new account.
60
+ 2. `sideby new <family> --next --api --vendor <slug> --json`, with the vendor's slug from `accounts.md` ("API accounts": `ds`, `glm`, `kimi`, `qwen`, `api`, `relay`). It creates `proxy.env` (mode 600) in the new account and the short command `<prefix>-<slug>` (`cc-ds`); read `suggestion` for why there is none.
61
61
  3. Set every variable except the key: show the user the lines you will add to `proxy.env` and add them after they agree. Do not read the file's other lines, and never write a key into it.
62
62
  4. Tell the user to run `sideby key <ref>` in their own terminal (or click **Enter key** in the Panel). Add `--var <NAME>` when the key belongs in a variable other than the Family's default. Wait until they say it is done.
63
63
  5. Offer `sideby try <ref> --json`: it exits 10 and says which command it runs and that it costs a few tokens. After they agree, run it with `--yes`. Exit 0 means the Host answered. On 1, read the Host's message it shows and check the mistakes below.
@@ -9,7 +9,7 @@ For "install sideby", "set up another Claude account", "add cc008", "配置一
9
9
  5. **Create.**
10
10
  - The user gave no name, or said "cc00x" / "the next one": `sideby new <family> --next --json`. It picks the next number (`008` after `001`…`007`) and, when existing short commands show a pattern (`cc007` for `claude:007`), adds the next one (`cc008`). Read `suggestion`: `aliasProblem` means that short command was taken and left out; tell the user.
11
11
  - The user gave a name: `sideby new <family> <name> --json`; a short command they named: add `--alias <short>`.
12
- - An API account (DeepSeek, a gateway, …): add `--api`.
12
+ - An API account (DeepSeek, a gateway, …): add `--api --vendor <slug>`. Its short command is named after the vendor (`cc-ds`), never numbered. Take the vendor from the user's words or docs link, ask only if neither says, and use the slugs in `accounts.md` ("API accounts"): `ds`, `glm`, `kimi`, `qwen`, `api` for the Host's own official API, `relay` for a gateway. Without `--vendor` no short command is added (`suggestion.aliasHint` says so).
13
13
  - A short command the user did not ask for and no pattern suggests: none. Do not invent a prefix.
14
14
  6. **user: sign in or fill in the key.**
15
15
  - Subscription account: `sideby login <ref>`. It opens the Host's sign-in in their browser. For pi it starts pi; they type `/login`.