@omercnet/paseo-omp 5.6.4-next.496.1 → 5.6.4-next.498.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/README.md CHANGED
@@ -35,7 +35,7 @@ Open the **OMP** sidebar to review the provider-profile contract, choose which c
35
35
 
36
36
  Open the **Accounts** tab of the **OMP** sidebar to see the logins in OMP's own credential store with their usage and banked resets, add a login through OMP's own sign-in, sign one out, spend a banked reset, and steer OMP's balancing: prefer a login, keep part of its quota in reserve, and set what OMP does at a limit. Steering is written to OMP's own config. See [OMP accounts](docs/configuration.md#omp-accounts).
37
37
 
38
- The quota popover groups recorded limits by provider and OMP account, showing an available recorded email across that account's windows. Duplicate and unnamed accounts receive numbers in opaque account-key order, so changing usage does not swap their numbers; accounts are still displayed by highest usage. Duplicate-name suffixes stay visible when long emails truncate, and a lone unnamed account needs no heading. Only a server-side SHA-256 hash of the account key reaches the client; account IDs and enterprise hosts are not returned. **CURRENT PROVIDER** identifies the session's provider, not its active account. Provider summary percentages show the highest recorded usage across that provider's accounts.
38
+ The quota popover groups recorded limits by provider and OMP account, showing an available recorded email or, when absent, the Copilot account ID (GitHub username) across that account's windows. Duplicate and unnamed accounts receive numbers in opaque account-key order, so changing usage does not swap their numbers; accounts are still displayed by highest usage. Duplicate-name suffixes stay visible when long emails truncate, and a lone unnamed account needs no heading. Copilot accounts also show **GitHub** or **GHE · host**, using the enterprise URL in OMP's recorded account key; unrecognized keys show neither. Only a server-side SHA-256 hash of the account key reaches the client. **CURRENT PROVIDER** identifies the session's provider, not its active account. Provider summary percentages show the highest recorded usage across that provider's accounts.
39
39
 
40
40
  Open the **MCPs** tab of the **OMP** sidebar to list the MCP servers OMP connects to, add one by URL or command, test, enable, disable or remove it, and sign a remote server in through your browser, like **Accounts** does for logins. See [OMP MCP servers](docs/configuration.md#omp-mcp-servers).
41
41
 
@@ -154,6 +154,13 @@ export function QuotaPopover(props: PluginButtonContentProps) {
154
154
  ) : null}
155
155
  </View>
156
156
  ) : null}
157
+ {account.accountService ? (
158
+ <Text style={styles.detail}>
159
+ {account.accountService === "github"
160
+ ? "GitHub"
161
+ : `GHE · ${account.accountHost}`}
162
+ </Text>
163
+ ) : null}
157
164
  {account.quotas.map((quota) => {
158
165
  const severity = quotaSeverityFromFraction(quota.usedFraction);
159
166
  const color = severityColor(severity);
@@ -94,6 +94,8 @@ export function quotaSeverityForProvider(
94
94
  export type QuotaAccountGroup = {
95
95
  accountKey: string;
96
96
  email: string | null;
97
+ accountService: OmpQuota["accountService"];
98
+ accountHost: string | null;
97
99
  label: string | null;
98
100
  suffix: string | null;
99
101
  quotas: OmpQuota[];
@@ -155,10 +157,15 @@ function quotaAccountGroups(quotas: readonly OmpQuota[]): QuotaAccountGroup[] {
155
157
  );
156
158
  const peakFraction = used.length === 0 ? null : Math.max(...used);
157
159
  const email = accountQuotas.find((quota) => quota.email?.trim())?.email?.trim() ?? null;
160
+ const accountId =
161
+ accountQuotas.find((quota) => quota.accountId?.trim())?.accountId?.trim() ?? null;
162
+ const service = accountQuotas.find((quota) => quota.accountService !== null);
158
163
  return {
159
164
  accountKey,
160
165
  email,
161
- label: email,
166
+ accountService: service?.accountService ?? null,
167
+ accountHost: service?.accountHost ?? null,
168
+ label: email ?? accountId,
162
169
  suffix: null,
163
170
  quotas: [...accountQuotas].sort((a, b) => (b.usedFraction ?? -1) - (a.usedFraction ?? -1)),
164
171
  peakFraction,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omercnet/paseo-omp",
3
- "version": "5.6.4-next.496.1",
3
+ "version": "5.6.4-next.498.1",
4
4
  "type": "module",
5
5
  "description": "Paseo integration for OMP, including its direct provider and workspace tooling.",
6
6
  "license": "MIT",
@@ -1,2 +1,2 @@
1
1
  /** Release Please keeps this bundle-safe constant aligned with package.json. */
2
- export const PASEO_OMP_PACKAGE_VERSION = "5.6.4-next.496.1"; // x-release-please-version
2
+ export const PASEO_OMP_PACKAGE_VERSION = "5.6.4-next.498.1"; // x-release-please-version
package/server/quota.ts CHANGED
@@ -11,6 +11,7 @@ const QuotaRowSchema = z.object({
11
11
  accountKey: z.string(),
12
12
  limitId: z.string(),
13
13
  email: z.string().nullable(),
14
+ accountId: z.string().nullable(),
14
15
  label: z.string(),
15
16
  windowLabel: z.string().nullable(),
16
17
  usedFraction: z.number().min(0).nullable(),
@@ -22,6 +23,29 @@ const QuotaRowSchema = z.object({
22
23
  // Reset-less rows (no resets_at) refresh on every OMP poll, so one this old is an inactive provider.
23
24
  const ABANDONED_AFTER_MS = 30 * 86_400_000;
24
25
 
26
+ type CopilotAccount = Pick<OmpQuota, "accountService" | "accountHost">;
27
+ const UNKNOWN_SERVICE: CopilotAccount = { accountService: null, accountHost: null };
28
+
29
+ /** OMP usageCacheIdentity records enterpriseUrl separately from its opaque credential fingerprint. */
30
+ function copilotAccount(accountKey: string): CopilotAccount {
31
+ if (!accountKey.startsWith("oauth|") && !accountKey.startsWith("api_key|")) {
32
+ return UNKNOWN_SERVICE;
33
+ }
34
+ const enterprise = accountKey.split("|").find((part) => part.startsWith("enterprise:"));
35
+ if (!enterprise) return { accountService: "github", accountHost: null };
36
+ const value = enterprise.slice("enterprise:".length);
37
+ if (!value) return UNKNOWN_SERVICE;
38
+ try {
39
+ const url = new URL(value.includes("://") ? value : `https://${value}`);
40
+ if (!["https:", "http:"].includes(url.protocol) || url.username || url.password) {
41
+ return UNKNOWN_SERVICE;
42
+ }
43
+ return url.hostname ? { accountService: "ghe", accountHost: url.hostname } : UNKNOWN_SERVICE;
44
+ } catch {
45
+ return UNKNOWN_SERVICE;
46
+ }
47
+ }
48
+
25
49
  // Only live windows are returned: a series whose newest row already reset (or never resets and was
26
50
  // abandoned) would otherwise pin the pill at its last exhausted value and bloat the popover.
27
51
  export function listOmpQuotasFrom(path: string, now = Date.now()): OmpQuota[] {
@@ -32,13 +56,17 @@ export function listOmpQuotasFrom(path: string, now = Date.now()): OmpQuota[] {
32
56
  const emailColumn = columns.some((column) => column.name === "email")
33
57
  ? "email"
34
58
  : "NULL AS email";
59
+ const accountIdColumn = columns.some((column) => column.name === "account_id")
60
+ ? "account_id"
61
+ : "NULL AS account_id";
35
62
  const rows = database
36
63
  .prepare(
37
- `SELECT provider, account_key AS accountKey, limit_id AS limitId, email, label,
64
+ `SELECT provider, account_key AS accountKey, limit_id AS limitId, email,
65
+ account_id AS accountId, label,
38
66
  window_label AS windowLabel, used_fraction AS usedFraction,
39
67
  status, resets_at AS resetsAt, recorded_at AS recordedAt
40
68
  FROM (
41
- SELECT provider, account_key, ${emailColumn},
69
+ SELECT provider, account_key, ${emailColumn}, ${accountIdColumn},
42
70
  limit_id, label, window_label, used_fraction, status, resets_at, recorded_at, id,
43
71
  ROW_NUMBER() OVER (
44
72
  PARTITION BY provider, account_key, limit_id
@@ -55,10 +83,14 @@ export function listOmpQuotasFrom(path: string, now = Date.now()): OmpQuota[] {
55
83
  const parsed = QuotaRowSchema.safeParse(row);
56
84
  if (!parsed.success) return [];
57
85
  const quota = parsed.data;
86
+ const copilot = quota.provider === "github-copilot";
58
87
  return [
59
88
  {
60
89
  ...quota,
61
90
  accountKey: createHash("sha256").update(quota.accountKey).digest("hex"),
91
+ // account_id is only known to be a username for Copilot; other providers keep it private.
92
+ accountId: copilot ? quota.accountId : null,
93
+ ...(copilot ? copilotAccount(quota.accountKey) : UNKNOWN_SERVICE),
62
94
  },
63
95
  ];
64
96
  });
package/shared/quota.ts CHANGED
@@ -11,6 +11,11 @@ export const OmpQuotaSchema = z.object({
11
11
  accountKey: z.string(),
12
12
  limitId: z.string(),
13
13
  email: z.string().nullable(),
14
+ accountId: z.string().nullable(),
15
+ /** Copilot login service: public GitHub or a GitHub Enterprise (GHE) host. */
16
+ accountService: z.enum(["github", "ghe"]).nullable(),
17
+ /** GHE hostname; null for public GitHub and every other provider. */
18
+ accountHost: z.string().nullable(),
14
19
  label: z.string(),
15
20
  windowLabel: z.string().nullable(),
16
21
  usedFraction: z.number().min(0).nullable(),