sideby 0.34.0 → 0.35.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/build.json +1 -1
- package/dist/src/cli/commands.d.ts +2 -0
- package/dist/src/cli/commands.js +66 -22
- package/dist/src/cli/json-schemas.js +10 -3
- package/dist/src/cli/main.js +13 -6
- package/dist/src/core/cli-commands.js +2 -2
- package/dist/src/core/shell-init.d.ts +16 -2
- package/dist/src/core/shell-init.js +67 -12
- package/dist/src/panel/handler.js +26 -0
- package/dist/src/panel/i18n.d.ts +25 -0
- package/dist/src/panel/i18n.js +60 -10
- package/dist/src/panel/page-logic.d.ts +56 -5
- package/dist/src/panel/page-logic.js +69 -10
- package/dist/src/panel/page-script.js +270 -38
- package/dist/src/panel/page-styles.js +507 -459
- package/dist/src/panel/ui/dropdown-menu/dropdown-menu.html.d.ts +48 -0
- package/dist/src/panel/ui/dropdown-menu/dropdown-menu.html.js +38 -0
- package/dist/src/panel/ui/lib/cn.d.ts +4 -0
- package/dist/src/panel/ui/lib/cn.js +6 -0
- package/dist/src/panel/ui-css.d.ts +6 -0
- package/dist/src/panel/ui-css.js +88 -0
- package/dist/src/runtime.d.ts +16 -3
- package/dist/src/runtime.js +40 -13
- package/package.json +1 -1
- package/schemas/alias.json +9 -1
- package/schemas/new.json +4 -1
- package/skills/sideby/SKILL.md +4 -3
- package/skills/sideby/references/accounts.md +12 -0
- package/skills/sideby/references/ai-tasks.md +1 -1
- package/skills/sideby/references/setup.md +1 -1
|
@@ -352,13 +352,41 @@ export declare function fixPrompt(findings: readonly {
|
|
|
352
352
|
check: string;
|
|
353
353
|
}): string;
|
|
354
354
|
/**
|
|
355
|
-
*
|
|
356
|
-
*
|
|
357
|
-
*
|
|
358
|
-
*
|
|
359
|
-
|
|
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`
|
|
@@ -1135,3 +1163,26 @@ export declare function uaWaitingCount(status: {
|
|
|
1135
1163
|
id: string;
|
|
1136
1164
|
on: unknown;
|
|
1137
1165
|
}[]): number;
|
|
1166
|
+
export type SortMenuEntry = {
|
|
1167
|
+
kind: 'label';
|
|
1168
|
+
key: string;
|
|
1169
|
+
} | {
|
|
1170
|
+
kind: 'choice';
|
|
1171
|
+
value: string;
|
|
1172
|
+
key: string;
|
|
1173
|
+
checked: boolean;
|
|
1174
|
+
meta?: string;
|
|
1175
|
+
} | {
|
|
1176
|
+
kind: 'separator';
|
|
1177
|
+
} | {
|
|
1178
|
+
kind: 'action';
|
|
1179
|
+
value: string;
|
|
1180
|
+
key: string;
|
|
1181
|
+
};
|
|
1182
|
+
/**
|
|
1183
|
+
* The toolbar's sort menu (spec §3.25): a "Sort by" label, one radio choice per sort with the current one checked,
|
|
1184
|
+
* then, apart, the action that opens the arrange mode. The action is never a choice, so it can never hold the check.
|
|
1185
|
+
* "My order" says "Not set" while there is no order of one's own, as picking it then opens the arrange mode. A
|
|
1186
|
+
* read-only Panel has no action. Entries carry i18n keys, not words.
|
|
1187
|
+
*/
|
|
1188
|
+
export declare function sortMenu(sorts: readonly string[], current: string, ordered: boolean, readOnly: boolean): SortMenuEntry[];
|
|
@@ -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
|
-
*
|
|
706
|
-
*
|
|
707
|
-
*
|
|
708
|
-
*
|
|
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
|
|
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
|
-
|
|
725
|
-
|
|
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,
|
|
@@ -2049,3 +2090,21 @@ export function uaWaitingCount(status, inflight) {
|
|
|
2049
2090
|
return status.pendingIds.filter((id) => !inflight.some((x) => x.id === id)).length;
|
|
2050
2091
|
return Math.max(0, status.pending - inflight.filter((x) => x.on === status).length);
|
|
2051
2092
|
}
|
|
2093
|
+
/**
|
|
2094
|
+
* The toolbar's sort menu (spec §3.25): a "Sort by" label, one radio choice per sort with the current one checked,
|
|
2095
|
+
* then, apart, the action that opens the arrange mode. The action is never a choice, so it can never hold the check.
|
|
2096
|
+
* "My order" says "Not set" while there is no order of one's own, as picking it then opens the arrange mode. A
|
|
2097
|
+
* read-only Panel has no action. Entries carry i18n keys, not words.
|
|
2098
|
+
*/
|
|
2099
|
+
export function sortMenu(sorts, current, ordered, readOnly) {
|
|
2100
|
+
const out = [{ kind: 'label', key: 'sort.by' }];
|
|
2101
|
+
for (const value of sorts) {
|
|
2102
|
+
const choice = { kind: 'choice', value, key: `sort.${value}`, checked: value === current };
|
|
2103
|
+
if (value === 'manual' && !ordered)
|
|
2104
|
+
choice.meta = 'sort.notSet';
|
|
2105
|
+
out.push(choice);
|
|
2106
|
+
}
|
|
2107
|
+
if (!readOnly)
|
|
2108
|
+
out.push({ kind: 'separator' }, { kind: 'action', value: 'arrange', key: 'sort.arrange' });
|
|
2109
|
+
return out;
|
|
2110
|
+
}
|