@thelioo/opencode-balancer 0.1.8 → 0.2.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.
Files changed (176) hide show
  1. package/INSTALL.txt +53 -25
  2. package/README.md +95 -51
  3. package/dist/core/accounts.ts +404 -0
  4. package/dist/core/database.ts +67 -0
  5. package/dist/core/events.ts +75 -0
  6. package/dist/core/native-auth-suppression.ts +36 -0
  7. package/dist/core/native-connect.ts +31 -0
  8. package/dist/core/path.ts +34 -0
  9. package/dist/core/pending.ts +351 -0
  10. package/dist/core/priority.ts +193 -0
  11. package/dist/core/schema.ts +439 -0
  12. package/dist/core/time.ts +3 -0
  13. package/dist/core/types.ts +72 -0
  14. package/dist/core/usage/index.ts +23 -0
  15. package/dist/core/usage/providers/copilot.ts +243 -0
  16. package/dist/core/usage/providers/openai.ts +179 -0
  17. package/dist/core/usage/redact.ts +80 -0
  18. package/dist/core/usage/store.ts +66 -0
  19. package/dist/core/usage/types.ts +24 -0
  20. package/dist/index.js +173 -4
  21. package/dist/index.js.map +1 -1
  22. package/dist/server/auth-watcher.ts +318 -0
  23. package/dist/server/commands.ts +58 -0
  24. package/dist/server/fetch-patch.ts +162 -0
  25. package/dist/server/index.ts +134 -0
  26. package/dist/server/native.ts +49 -0
  27. package/dist/server/request-balancer.ts +67 -0
  28. package/dist/tui/actions.ts +176 -112
  29. package/dist/tui/balancer-bar-sync.ts +55 -45
  30. package/dist/tui/components/alias-dialog.tsx +71 -56
  31. package/dist/tui/components/dashboard.tsx +530 -358
  32. package/dist/tui/components/priority-screen.tsx +389 -267
  33. package/dist/tui/components/provider-model-dialog.tsx +71 -64
  34. package/dist/tui/components/rename-dialog.tsx +35 -28
  35. package/dist/tui/components/sidebar.tsx +103 -79
  36. package/dist/tui/components/status-indicator.tsx +78 -59
  37. package/dist/tui/components/usage-bar.tsx +18 -7
  38. package/dist/tui/components/usage-display.tsx +32 -16
  39. package/dist/tui/connect.ts +104 -73
  40. package/dist/tui/dashboard-keys.ts +53 -41
  41. package/dist/tui/native-model-apply.ts +45 -36
  42. package/dist/tui/priority-keys.ts +44 -36
  43. package/dist/tui/provider-models.ts +32 -25
  44. package/dist/tui/responsive.ts +10 -7
  45. package/dist/tui/selected-account-bar-sync.ts +23 -23
  46. package/dist/tui/selection-colors.ts +38 -30
  47. package/dist/tui/state.ts +61 -44
  48. package/dist/tui/status-format.ts +24 -20
  49. package/dist/tui/tui.js +165 -153
  50. package/dist/tui/tui.js.map +1 -1
  51. package/dist/tui/tui.tsx +194 -144
  52. package/dist/tui/usage-auto-refresh.ts +52 -45
  53. package/dist/tui/usage-format.ts +9 -9
  54. package/package.json +61 -52
  55. package/dist/core/accounts.d.ts +0 -14
  56. package/dist/core/accounts.js +0 -260
  57. package/dist/core/accounts.js.map +0 -1
  58. package/dist/core/database.d.ts +0 -4
  59. package/dist/core/database.js +0 -69
  60. package/dist/core/database.js.map +0 -1
  61. package/dist/core/events.d.ts +0 -18
  62. package/dist/core/events.js +0 -39
  63. package/dist/core/events.js.map +0 -1
  64. package/dist/core/native-auth-suppression.d.ts +0 -3
  65. package/dist/core/native-auth-suppression.js +0 -19
  66. package/dist/core/native-auth-suppression.js.map +0 -1
  67. package/dist/core/native-connect.d.ts +0 -4
  68. package/dist/core/native-connect.js +0 -19
  69. package/dist/core/native-connect.js.map +0 -1
  70. package/dist/core/path.d.ts +0 -4
  71. package/dist/core/path.js +0 -26
  72. package/dist/core/path.js.map +0 -1
  73. package/dist/core/pending.d.ts +0 -9
  74. package/dist/core/pending.js +0 -237
  75. package/dist/core/pending.js.map +0 -1
  76. package/dist/core/priority.d.ts +0 -20
  77. package/dist/core/priority.js +0 -120
  78. package/dist/core/priority.js.map +0 -1
  79. package/dist/core/schema.d.ts +0 -2
  80. package/dist/core/schema.js +0 -265
  81. package/dist/core/schema.js.map +0 -1
  82. package/dist/core/time.d.ts +0 -1
  83. package/dist/core/time.js +0 -4
  84. package/dist/core/time.js.map +0 -1
  85. package/dist/core/types.d.ts +0 -59
  86. package/dist/core/types.js +0 -2
  87. package/dist/core/types.js.map +0 -1
  88. package/dist/core/usage/index.d.ts +0 -4
  89. package/dist/core/usage/index.js +0 -16
  90. package/dist/core/usage/index.js.map +0 -1
  91. package/dist/core/usage/providers/copilot.d.ts +0 -2
  92. package/dist/core/usage/providers/copilot.js +0 -169
  93. package/dist/core/usage/providers/copilot.js.map +0 -1
  94. package/dist/core/usage/providers/openai.d.ts +0 -2
  95. package/dist/core/usage/providers/openai.js +0 -133
  96. package/dist/core/usage/providers/openai.js.map +0 -1
  97. package/dist/core/usage/redact.d.ts +0 -3
  98. package/dist/core/usage/redact.js +0 -67
  99. package/dist/core/usage/redact.js.map +0 -1
  100. package/dist/core/usage/store.d.ts +0 -4
  101. package/dist/core/usage/store.js +0 -31
  102. package/dist/core/usage/store.js.map +0 -1
  103. package/dist/core/usage/types.d.ts +0 -21
  104. package/dist/core/usage/types.js +0 -2
  105. package/dist/core/usage/types.js.map +0 -1
  106. package/dist/index.d.ts +0 -5
  107. package/dist/server/auth-watcher.d.ts +0 -32
  108. package/dist/server/auth-watcher.js +0 -227
  109. package/dist/server/auth-watcher.js.map +0 -1
  110. package/dist/server/commands.d.ts +0 -2
  111. package/dist/server/commands.js +0 -46
  112. package/dist/server/commands.js.map +0 -1
  113. package/dist/server/fetch-patch.d.ts +0 -3
  114. package/dist/server/fetch-patch.js +0 -118
  115. package/dist/server/fetch-patch.js.map +0 -1
  116. package/dist/server/index.d.ts +0 -8
  117. package/dist/server/index.js +0 -94
  118. package/dist/server/index.js.map +0 -1
  119. package/dist/server/native.d.ts +0 -6
  120. package/dist/server/native.js +0 -35
  121. package/dist/server/native.js.map +0 -1
  122. package/dist/server/request-balancer.d.ts +0 -16
  123. package/dist/server/request-balancer.js +0 -43
  124. package/dist/server/request-balancer.js.map +0 -1
  125. package/dist/tui/actions.d.ts +0 -41
  126. package/dist/tui/actions.js +0 -92
  127. package/dist/tui/actions.js.map +0 -1
  128. package/dist/tui/balancer-bar-sync.d.ts +0 -19
  129. package/dist/tui/balancer-bar-sync.js +0 -45
  130. package/dist/tui/balancer-bar-sync.js.map +0 -1
  131. package/dist/tui/components/alias-dialog.d.ts +0 -4
  132. package/dist/tui/components/dashboard.d.ts +0 -12
  133. package/dist/tui/components/priority-screen.d.ts +0 -9
  134. package/dist/tui/components/provider-model-dialog.d.ts +0 -14
  135. package/dist/tui/components/rename-dialog.d.ts +0 -4
  136. package/dist/tui/components/sidebar.d.ts +0 -10
  137. package/dist/tui/components/status-indicator.d.ts +0 -9
  138. package/dist/tui/components/usage-bar.d.ts +0 -8
  139. package/dist/tui/components/usage-display.d.ts +0 -10
  140. package/dist/tui/connect.d.ts +0 -30
  141. package/dist/tui/connect.js +0 -75
  142. package/dist/tui/connect.js.map +0 -1
  143. package/dist/tui/dashboard-keys.d.ts +0 -45
  144. package/dist/tui/dashboard-keys.js +0 -44
  145. package/dist/tui/dashboard-keys.js.map +0 -1
  146. package/dist/tui/native-model-apply.d.ts +0 -21
  147. package/dist/tui/native-model-apply.js +0 -53
  148. package/dist/tui/native-model-apply.js.map +0 -1
  149. package/dist/tui/priority-keys.d.ts +0 -40
  150. package/dist/tui/priority-keys.js +0 -38
  151. package/dist/tui/priority-keys.js.map +0 -1
  152. package/dist/tui/provider-models.d.ts +0 -19
  153. package/dist/tui/provider-models.js +0 -17
  154. package/dist/tui/provider-models.js.map +0 -1
  155. package/dist/tui/responsive.d.ts +0 -9
  156. package/dist/tui/responsive.js +0 -13
  157. package/dist/tui/responsive.js.map +0 -1
  158. package/dist/tui/selected-account-bar-sync.d.ts +0 -10
  159. package/dist/tui/selected-account-bar-sync.js +0 -26
  160. package/dist/tui/selected-account-bar-sync.js.map +0 -1
  161. package/dist/tui/selection-colors.d.ts +0 -10
  162. package/dist/tui/selection-colors.js +0 -38
  163. package/dist/tui/selection-colors.js.map +0 -1
  164. package/dist/tui/state.d.ts +0 -14
  165. package/dist/tui/state.js +0 -46
  166. package/dist/tui/state.js.map +0 -1
  167. package/dist/tui/status-format.d.ts +0 -15
  168. package/dist/tui/status-format.js +0 -17
  169. package/dist/tui/status-format.js.map +0 -1
  170. package/dist/tui/tui.d.ts +0 -7
  171. package/dist/tui/usage-auto-refresh.d.ts +0 -16
  172. package/dist/tui/usage-auto-refresh.js +0 -46
  173. package/dist/tui/usage-auto-refresh.js.map +0 -1
  174. package/dist/tui/usage-format.d.ts +0 -2
  175. package/dist/tui/usage-format.js +0 -17
  176. package/dist/tui/usage-format.js.map +0 -1
@@ -1,36 +1,43 @@
1
1
  type ProviderLike = {
2
- id: string;
3
- name?: string;
4
- models?: Record<string, ModelLike>;
2
+ id: string;
3
+ name?: string;
4
+ models?: Record<string, ModelLike>;
5
5
  };
6
6
 
7
7
  type ModelLike = {
8
- id?: string;
9
- name?: string;
10
- status?: string;
11
- release_date?: string;
8
+ id?: string;
9
+ name?: string;
10
+ status?: string;
11
+ release_date?: string;
12
12
  };
13
13
 
14
14
  export type ProviderModelOption = {
15
- providerID: string;
16
- providerName: string;
17
- modelID: string;
18
- title: string;
15
+ providerID: string;
16
+ providerName: string;
17
+ modelID: string;
18
+ title: string;
19
19
  };
20
20
 
21
- export function providerModelOptions(providers: readonly ProviderLike[], providerID: string): ProviderModelOption[] {
22
- const provider = providers.find((item) => item.id === providerID);
23
- if (!provider?.models) return [];
21
+ export function providerModelOptions(
22
+ providers: readonly ProviderLike[],
23
+ providerID: string,
24
+ ): ProviderModelOption[] {
25
+ const provider = providers.find((item) => item.id === providerID);
26
+ if (!provider?.models) return [];
24
27
 
25
- return Object.entries(provider.models)
26
- .filter(([, model]) => model.status !== "deprecated")
27
- .map(([modelID, model]) => ({
28
- providerID: provider.id,
29
- providerName: provider.name ?? provider.id,
30
- modelID: model.id ?? modelID,
31
- title: model.name ?? model.id ?? modelID,
32
- releaseDate: model.release_date ?? "",
33
- }))
34
- .sort((a, b) => b.releaseDate.localeCompare(a.releaseDate) || a.title.localeCompare(b.title))
35
- .map(({ releaseDate: _releaseDate, ...option }) => option);
28
+ return Object.entries(provider.models)
29
+ .filter(([, model]) => model.status !== "deprecated")
30
+ .map(([modelID, model]) => ({
31
+ modelID: model.id ?? modelID,
32
+ providerID: provider.id,
33
+ providerName: provider.name ?? provider.id,
34
+ releaseDate: model.release_date ?? "",
35
+ title: model.name ?? model.id ?? modelID,
36
+ }))
37
+ .sort(
38
+ (a, b) =>
39
+ b.releaseDate.localeCompare(a.releaseDate) ||
40
+ a.title.localeCompare(b.title),
41
+ )
42
+ .map(({ releaseDate: _releaseDate, ...option }) => option);
36
43
  }
@@ -1,16 +1,19 @@
1
1
  export type LayoutMode = "compact" | "full";
2
2
 
3
- export function dashboardLayoutMode(size: { width?: number; height?: number }): LayoutMode {
4
- const width = size.width ?? 999;
5
- const height = size.height ?? 999;
6
- return width < 100 || height < 26 ? "compact" : "full";
3
+ export function dashboardLayoutMode(size: {
4
+ width?: number;
5
+ height?: number;
6
+ }): LayoutMode {
7
+ const width = size.width ?? 999;
8
+ const height = size.height ?? 999;
9
+ return width < 100 || height < 26 ? "compact" : "full";
7
10
  }
8
11
 
9
12
  export function visibleRecentEventLimit(mode: LayoutMode): number {
10
- return mode === "compact" ? 5 : 10;
13
+ return mode === "compact" ? 5 : 10;
11
14
  }
12
15
 
13
16
  export function dashboardContentHeight(size: { height?: number }): number {
14
- const height = size.height ?? 28;
15
- return Math.max(6, height - 8);
17
+ const height = size.height ?? 28;
18
+ return Math.max(6, height - 8);
16
19
  }
@@ -1,32 +1,32 @@
1
1
  export type SelectedAccountBarSyncDeps = {
2
- dialogOpen: () => boolean;
3
- selectedProvider: () => string | undefined;
4
- currentProvider: () => string | undefined;
5
- applyProvider: (providerID: string) => Promise<boolean>;
2
+ dialogOpen: () => boolean;
3
+ selectedProvider: () => string | undefined;
4
+ currentProvider: () => string | undefined;
5
+ applyProvider: (providerID: string) => Promise<boolean>;
6
6
  };
7
7
 
8
8
  export function createSelectedAccountBarSync(deps: SelectedAccountBarSyncDeps) {
9
- let applying = false;
10
- let appliedProvider: string | undefined;
9
+ let applying = false;
10
+ let appliedProvider: string | undefined;
11
11
 
12
- const currentProvider = () => appliedProvider ?? deps.currentProvider();
12
+ const currentProvider = () => appliedProvider ?? deps.currentProvider();
13
13
 
14
- return {
15
- currentProvider,
16
- maybeSync: async () => {
17
- if (applying || deps.dialogOpen()) return false;
14
+ return {
15
+ currentProvider,
16
+ maybeSync: async () => {
17
+ if (applying || deps.dialogOpen()) return false;
18
18
 
19
- const selected = deps.selectedProvider();
20
- if (!selected || selected === currentProvider()) return false;
19
+ const selected = deps.selectedProvider();
20
+ if (!selected || selected === currentProvider()) return false;
21
21
 
22
- applying = true;
23
- try {
24
- const applied = await deps.applyProvider(selected);
25
- if (applied) appliedProvider = selected;
26
- return applied;
27
- } finally {
28
- applying = false;
29
- }
30
- },
31
- };
22
+ applying = true;
23
+ try {
24
+ const applied = await deps.applyProvider(selected);
25
+ if (applied) appliedProvider = selected;
26
+ return applied;
27
+ } finally {
28
+ applying = false;
29
+ }
30
+ },
31
+ };
32
32
  }
@@ -1,45 +1,53 @@
1
1
  export function selectedRowColors<TColor>(theme: {
2
- text: TColor;
3
- textMuted?: TColor;
4
- backgroundElement: TColor;
5
- background?: TColor;
6
- accent?: TColor;
2
+ text: TColor;
3
+ textMuted?: TColor;
4
+ backgroundElement: TColor;
5
+ background?: TColor;
6
+ accent?: TColor;
7
7
  }) {
8
- const bg = theme.backgroundElement;
9
- const textContrast = contrast(theme.text, bg);
10
- const backgroundContrast = theme.background === undefined ? undefined : contrast(theme.background, bg);
11
- const fg = backgroundContrast !== undefined && backgroundContrast > textContrast ? theme.background : theme.text;
12
- return { fg, bg };
8
+ const bg = theme.backgroundElement;
9
+ const textContrast = contrast(theme.text, bg);
10
+ const backgroundContrast =
11
+ theme.background === undefined ? undefined : contrast(theme.background, bg);
12
+ const fg =
13
+ backgroundContrast !== undefined && backgroundContrast > textContrast
14
+ ? theme.background
15
+ : theme.text;
16
+ return { bg, fg };
13
17
  }
14
18
 
15
19
  function contrast<TColor>(a: TColor, b: TColor) {
16
- const ca = channels(a);
17
- const cb = channels(b);
18
- if (!ca || !cb) return 0;
19
- const la = luminance(ca);
20
- const lb = luminance(cb);
21
- const lighter = Math.max(la, lb);
22
- const darker = Math.min(la, lb);
23
- return (lighter + 0.05) / (darker + 0.05);
20
+ const ca = channels(a);
21
+ const cb = channels(b);
22
+ if (!ca || !cb) return 0;
23
+ const la = luminance(ca);
24
+ const lb = luminance(cb);
25
+ const lighter = Math.max(la, lb);
26
+ const darker = Math.min(la, lb);
27
+ return (lighter + 0.05) / (darker + 0.05);
24
28
  }
25
29
 
26
30
  function channels(value: unknown) {
27
- if (!value || typeof value !== "object") return undefined;
28
- const color = value as Record<string, unknown>;
29
- const r = numberChannel(color.r ?? color.red);
30
- const g = numberChannel(color.g ?? color.green);
31
- const b = numberChannel(color.b ?? color.blue);
32
- return r === undefined || g === undefined || b === undefined ? undefined : { r, g, b };
31
+ if (!value || typeof value !== "object") return undefined;
32
+ const color = value as Record<string, unknown>;
33
+ const r = numberChannel(color.r ?? color.red);
34
+ const g = numberChannel(color.g ?? color.green);
35
+ const b = numberChannel(color.b ?? color.blue);
36
+ return r === undefined || g === undefined || b === undefined
37
+ ? undefined
38
+ : { b, g, r };
33
39
  }
34
40
 
35
41
  function numberChannel(value: unknown) {
36
- return typeof value === "number" && Number.isFinite(value) ? Math.max(0, Math.min(255, value)) : undefined;
42
+ return typeof value === "number" && Number.isFinite(value)
43
+ ? Math.max(0, Math.min(255, value))
44
+ : undefined;
37
45
  }
38
46
 
39
47
  function luminance(color: { r: number; g: number; b: number }) {
40
- const [r, g, b] = [color.r, color.g, color.b].map((channel) => {
41
- const value = channel / 255;
42
- return value <= 0.03928 ? value / 12.92 : ((value + 0.055) / 1.055) ** 2.4;
43
- });
44
- return 0.2126 * r + 0.7152 * g + 0.0722 * b;
48
+ const [r, g, b] = [color.r, color.g, color.b].map((channel) => {
49
+ const value = channel / 255;
50
+ return value <= 0.03928 ? value / 12.92 : ((value + 0.055) / 1.055) ** 2.4;
51
+ });
52
+ return 0.2126 * r + 0.7152 * g + 0.0722 * b;
45
53
  }
package/dist/tui/state.ts CHANGED
@@ -3,63 +3,80 @@ import { createSignal, onCleanup } from "solid-js";
3
3
  import { listAccounts } from "../core/accounts";
4
4
  import { closeBalancerDatabase, openBalancerDatabase } from "../core/database";
5
5
  import { listEvents } from "../core/events";
6
- import { listPendingConnections } from "../core/pending";
7
6
  import { storePath } from "../core/path";
7
+ import { listPendingConnections } from "../core/pending";
8
8
  import { migrate } from "../core/schema";
9
9
  import type { Account, BalancerEvent, PendingConnection } from "../core/types";
10
10
 
11
11
  export type BalancerTuiState = {
12
- db: Database;
13
- version: () => number;
14
- refresh: () => void;
15
- accounts: () => Account[];
16
- pending: () => PendingConnection[];
17
- events: () => BalancerEvent[];
18
- removeAccountView: (providerID: string, alias: string) => void;
19
- removePendingView: (pendingID: string) => void;
20
- dispose: () => void;
12
+ db: Database;
13
+ version: () => number;
14
+ refresh: () => void;
15
+ accounts: () => Account[];
16
+ pending: () => PendingConnection[];
17
+ events: () => BalancerEvent[];
18
+ removeAccountView: (providerID: string, alias: string) => void;
19
+ removePendingView: (pendingID: string) => void;
20
+ dispose: () => void;
21
21
  };
22
22
 
23
23
  export function createBalancerTuiState(): BalancerTuiState {
24
- const dbPath = storePath();
25
- const db = openBalancerDatabase(dbPath);
26
- migrate(db);
24
+ const dbPath = storePath();
25
+ const db = openBalancerDatabase(dbPath);
26
+ migrate(db);
27
27
 
28
- const [version, setVersion] = createSignal(0);
29
- const [accounts, setAccounts] = createSignal<Account[]>([]);
30
- const [pending, setPending] = createSignal<PendingConnection[]>([]);
31
- const [events, setEvents] = createSignal<BalancerEvent[]>([]);
28
+ const [version, setVersion] = createSignal(0);
29
+ const [accounts, setAccounts] = createSignal<Account[]>([]);
30
+ const [pending, setPending] = createSignal<PendingConnection[]>([]);
31
+ const [events, setEvents] = createSignal<BalancerEvent[]>([]);
32
32
 
33
- const refresh = () => {
34
- setAccounts(listAccounts(db));
35
- setPending(listPendingConnections(db));
36
- setEvents(listEvents(db, 10));
37
- setVersion((current) => current + 1);
38
- };
39
- const removeAccountView = (providerID: string, alias: string) => {
40
- setAccounts((current) => current.filter((account) => account.providerID !== providerID || account.alias !== alias));
41
- setVersion((current) => current + 1);
42
- };
43
- const removePendingView = (pendingID: string) => {
44
- setPending((current) => current.filter((pending) => pending.id !== pendingID));
45
- setVersion((current) => current + 1);
46
- };
33
+ const refresh = () => {
34
+ setAccounts(listAccounts(db));
35
+ setPending(listPendingConnections(db));
36
+ setEvents(listEvents(db, 10));
37
+ setVersion((current) => current + 1);
38
+ };
39
+ const removeAccountView = (providerID: string, alias: string) => {
40
+ setAccounts((current) =>
41
+ current.filter(
42
+ (account) =>
43
+ account.providerID !== providerID || account.alias !== alias,
44
+ ),
45
+ );
46
+ setVersion((current) => current + 1);
47
+ };
48
+ const removePendingView = (pendingID: string) => {
49
+ setPending((current) =>
50
+ current.filter((pending) => pending.id !== pendingID),
51
+ );
52
+ setVersion((current) => current + 1);
53
+ };
47
54
 
48
- let interval: ReturnType<typeof setInterval> | undefined;
49
- let disposed = false;
55
+ let interval: ReturnType<typeof setInterval> | undefined;
56
+ let disposed = false;
50
57
 
51
- const dispose = () => {
52
- if (disposed) return;
53
- disposed = true;
54
- if (interval) clearInterval(interval);
55
- interval = undefined;
56
- closeBalancerDatabase(dbPath);
57
- };
58
+ const dispose = () => {
59
+ if (disposed) return;
60
+ disposed = true;
61
+ if (interval) clearInterval(interval);
62
+ interval = undefined;
63
+ closeBalancerDatabase(dbPath);
64
+ };
58
65
 
59
- refresh();
66
+ refresh();
60
67
 
61
- interval = setInterval(refresh, 1000);
62
- onCleanup(dispose);
68
+ interval = setInterval(refresh, 1000);
69
+ onCleanup(dispose);
63
70
 
64
- return { db, version, refresh, accounts, pending, events, removeAccountView, removePendingView, dispose };
71
+ return {
72
+ accounts,
73
+ db,
74
+ dispose,
75
+ events,
76
+ pending,
77
+ refresh,
78
+ removeAccountView,
79
+ removePendingView,
80
+ version,
81
+ };
65
82
  }
@@ -1,29 +1,33 @@
1
1
  export type StatusAccount = {
2
- providerID: string;
3
- alias: string;
2
+ providerID: string;
3
+ alias: string;
4
4
  };
5
5
 
6
6
  export function formatBalancerStatus(input: {
7
- selected?: StatusAccount;
8
- sessionActive?: StatusAccount;
9
- sessionProviderID?: string;
10
- balancing?: { providerID: string; alias?: string; modelID: string };
11
- usage?: string;
7
+ selected?: StatusAccount;
8
+ sessionActive?: StatusAccount;
9
+ sessionProviderID?: string;
10
+ balancing?: { providerID: string; alias?: string; modelID: string };
11
+ usage?: string;
12
12
  }) {
13
- const withUsage = (value: string) => (input.usage ? `${value} · ${input.usage}` : value);
13
+ const withUsage = (value: string) =>
14
+ input.usage ? `${value} · ${input.usage}` : value;
14
15
 
15
- if (input.balancing) {
16
- const account = input.balancing.alias
17
- ? `${input.balancing.providerID}/${input.balancing.alias}`
18
- : input.balancing.providerID;
19
- return withUsage(account);
20
- }
16
+ if (input.balancing) {
17
+ const account = input.balancing.alias
18
+ ? `${input.balancing.providerID}/${input.balancing.alias}`
19
+ : input.balancing.providerID;
20
+ return withUsage(account);
21
+ }
21
22
 
22
- if (!input.selected) {
23
- if (input.sessionProviderID) return withUsage(`${input.sessionProviderID}/${input.sessionActive?.alias ?? "none"}`);
24
- return withUsage("balancer");
25
- }
23
+ if (!input.selected) {
24
+ if (input.sessionProviderID)
25
+ return withUsage(
26
+ `${input.sessionProviderID}/${input.sessionActive?.alias ?? "none"}`,
27
+ );
28
+ return withUsage("balancer");
29
+ }
26
30
 
27
- const selected = `${input.selected.providerID}/${input.selected.alias}`;
28
- return withUsage(selected);
31
+ const selected = `${input.selected.providerID}/${input.selected.alias}`;
32
+ return withUsage(selected);
29
33
  }