@omercnet/paseo-omp 5.7.0-next.512.1 → 5.7.0-next.518.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
@@ -33,9 +33,9 @@ paseo plugin ls paseo-omp
33
33
 
34
34
  Open the **OMP** sidebar to review the provider-profile contract, choose which composer pills appear, browse and edit native scalar settings, manage OMP-native plugins, verify runtime health, and generate a bounded support report under **Help**. The same tabs, including Accounts, MCPs, and Composer, are available in the workspace OMP panel, which adds a workspace-only Security tab. Then create an agent and select **OMP Plugin**; on a new install, [enable it](#plugin-provider-opt-in) and restart the daemon first. Its optional **MCP** composer control runs OMP-native management commands in the current session; setup questions and authorization stay in that chat timeline, where OAuth can open in a workspace-scoped Paseo Browser or on the current device. While OMP subagents run, a row under each `task` card in the conversation lets you steer or stop one of them; this needs OMP 18.4.9 or newer. Composer pill preferences are shared by clients connected to the same host; normal use requires no other plugin-specific settings.
35
35
 
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).
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. Each login shows plan and organization badges from its usage report, such as **Business**, **Pro Lite**, **Personal** or an organization name, and the label drops OMP's parenthesized organization once a badge shows it. 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 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.
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. Badges beside each account name show the plan (such as **Business** or **Pro Lite**) and organization name from OMP's cached usage report for that account; an Anthropic organization named after the account's email shows as **Personal**, and accounts without a cached plan or organization show no badge. 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. Reset countdowns a day or more away show days and hours, such as **resets 14d 21h**.
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
 
@@ -191,9 +191,26 @@ function AccountCard({
191
191
  return (
192
192
  <View style={styles.card}>
193
193
  <View style={styles.cardHeader}>
194
- <Text numberOfLines={1} style={[styles.cardTitle, { flexShrink: 1 }]}>
195
- {account.label}
196
- </Text>
194
+ <View
195
+ style={{
196
+ flexDirection: "row",
197
+ alignItems: "center",
198
+ flexWrap: "wrap",
199
+ gap: 6,
200
+ flexShrink: 1,
201
+ }}
202
+ >
203
+ <Text numberOfLines={1} style={[styles.cardTitle, { flexShrink: 1 }]}>
204
+ {account.label}
205
+ </Text>
206
+ {account.tags.map((tag) => (
207
+ <View key={tag} style={styles.chip}>
208
+ <Text numberOfLines={1} style={styles.chipText}>
209
+ {tag}
210
+ </Text>
211
+ </View>
212
+ ))}
213
+ </View>
197
214
  {account.resets ? (
198
215
  <View style={styles.chip}>
199
216
  <Text style={styles.chipText}>{resetsLabel(account.resets)}</Text>
@@ -85,7 +85,7 @@ export function QuotaPopover(props: PluginButtonContentProps) {
85
85
  },
86
86
  detail: { color: theme.colors.foregroundMuted, fontSize: 11 },
87
87
  account: { gap: 6, paddingTop: 4 },
88
- accountHeading: { flexDirection: "row" as const, alignItems: "baseline" as const },
88
+ accountHeading: { flexDirection: "row" as const, alignItems: "center" as const },
89
89
  accountLabel: {
90
90
  color: theme.colors.foregroundMuted,
91
91
  fontSize: 11,
@@ -93,6 +93,29 @@ export function QuotaPopover(props: PluginButtonContentProps) {
93
93
  minWidth: 0,
94
94
  },
95
95
  accountSuffix: { color: theme.colors.foregroundMuted, fontSize: 11, flexShrink: 0 },
96
+ // Badges may shrink (each ellipsized) so a long organization never pushes the name out.
97
+ tags: { flexDirection: "row" as const, gap: 4, flexShrink: 1, minWidth: 0 },
98
+ headingTags: {
99
+ flexDirection: "row" as const,
100
+ gap: 4,
101
+ flexShrink: 1,
102
+ minWidth: 0,
103
+ marginLeft: 6,
104
+ },
105
+ tag: {
106
+ color: theme.colors.foregroundMuted,
107
+ fontSize: 10,
108
+ fontWeight: "600" as const,
109
+ paddingHorizontal: 6,
110
+ paddingVertical: 1,
111
+ borderRadius: 999,
112
+ borderWidth: 1,
113
+ borderColor: theme.colors.border,
114
+ overflow: "hidden" as const,
115
+ flexShrink: 1,
116
+ minWidth: 0,
117
+ maxWidth: 160,
118
+ },
96
119
  }),
97
120
  [layout.compact, theme],
98
121
  );
@@ -141,9 +164,9 @@ export function QuotaPopover(props: PluginButtonContentProps) {
141
164
  {account.label ? (
142
165
  <View
143
166
  accessibilityRole="header"
144
- accessibilityLabel={
145
- account.suffix ? `${account.label} · ${account.suffix}` : account.label
146
- }
167
+ accessibilityLabel={[account.label, account.suffix, ...account.tags]
168
+ .filter(Boolean)
169
+ .join(" · ")}
147
170
  style={styles.accountHeading}
148
171
  >
149
172
  <Text numberOfLines={1} ellipsizeMode="middle" style={styles.accountLabel}>
@@ -152,6 +175,23 @@ export function QuotaPopover(props: PluginButtonContentProps) {
152
175
  {account.suffix ? (
153
176
  <Text style={styles.accountSuffix}>{` · ${account.suffix}`}</Text>
154
177
  ) : null}
178
+ {account.tags.length > 0 ? (
179
+ <View style={styles.headingTags}>
180
+ {account.tags.map((tag) => (
181
+ <Text key={tag} numberOfLines={1} style={styles.tag}>
182
+ {tag}
183
+ </Text>
184
+ ))}
185
+ </View>
186
+ ) : null}
187
+ </View>
188
+ ) : account.tags.length > 0 ? (
189
+ <View style={styles.tags}>
190
+ {account.tags.map((tag) => (
191
+ <Text key={tag} numberOfLines={1} style={styles.tag}>
192
+ {tag}
193
+ </Text>
194
+ ))}
155
195
  </View>
156
196
  ) : null}
157
197
  {account.accountService ? (
@@ -1,3 +1,4 @@
1
+ import { accountTags } from "../shared/account-tags";
1
2
  import type { OmpQuota } from "../shared/quota";
2
3
  import { isOmpProvider } from "./omp-store-state";
3
4
 
@@ -97,6 +98,8 @@ export type QuotaAccountGroup = {
97
98
  accountService: OmpQuota["accountService"];
98
99
  accountHost: string | null;
99
100
  label: string | null;
101
+ /** Plan and organization badges, e.g. "Business", "Personal" or an organization name. */
102
+ tags: string[];
100
103
  suffix: string | null;
101
104
  quotas: OmpQuota[];
102
105
  peakFraction: number | null;
@@ -143,6 +146,14 @@ export function quotaProviderGroups(
143
146
  return groups;
144
147
  }
145
148
 
149
+ function quotaAccountTags(quotas: readonly OmpQuota[], email: string | null): string[] {
150
+ return accountTags({
151
+ plan: quotas.find((quota) => quota.plan)?.plan ?? null,
152
+ organization: quotas.find((quota) => quota.organization)?.organization ?? null,
153
+ email,
154
+ });
155
+ }
156
+
146
157
  function quotaAccountGroups(quotas: readonly OmpQuota[]): QuotaAccountGroup[] {
147
158
  const byAccount = new Map<string, OmpQuota[]>();
148
159
  for (const quota of quotas) {
@@ -165,6 +176,7 @@ function quotaAccountGroups(quotas: readonly OmpQuota[]): QuotaAccountGroup[] {
165
176
  email,
166
177
  accountService: service?.accountService ?? null,
167
178
  accountHost: service?.accountHost ?? null,
179
+ tags: quotaAccountTags(accountQuotas, email),
168
180
  label: email ?? accountId,
169
181
  suffix: null,
170
182
  quotas: [...accountQuotas].sort((a, b) => (b.usedFraction ?? -1) - (a.usedFraction ?? -1)),
@@ -207,9 +219,10 @@ function quotaAccountGroups(quotas: readonly OmpQuota[]): QuotaAccountGroup[] {
207
219
  export function quotaResetLabel(resetsAtMs: number | null, nowMs: number = Date.now()): string {
208
220
  if (resetsAtMs === null) return "";
209
221
  const remainingMs = Math.max(0, resetsAtMs - nowMs);
210
- const hours = Math.floor(remainingMs / 3_600_000);
222
+ const totalHours = Math.floor(remainingMs / 3_600_000);
211
223
  const minutes = Math.floor((remainingMs % 3_600_000) / 60_000);
212
- return hours > 0 ? `resets ${hours}h ${minutes}m` : `resets ${minutes}m`;
224
+ if (totalHours >= 24) return `resets ${Math.floor(totalHours / 24)}d ${totalHours % 24}h`;
225
+ return totalHours > 0 ? `resets ${totalHours}h ${minutes}m` : `resets ${minutes}m`;
213
226
  }
214
227
 
215
228
  export function quotaRecordedLabel(recordedAtMs: number, nowMs: number = Date.now()): string {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omercnet/paseo-omp",
3
- "version": "5.7.0-next.512.1",
3
+ "version": "5.7.0-next.518.1",
4
4
  "type": "module",
5
5
  "description": "Paseo integration for OMP, including its direct provider and workspace tooling.",
6
6
  "license": "MIT",
@@ -64,8 +64,8 @@
64
64
  "@getpaseo/client": "0.16.0-beta.2",
65
65
  "@getpaseo/plugin": "0.16.0-beta.2",
66
66
  "@getpaseo/server": "0.16.0-beta.2",
67
- "@oh-my-pi/pi-agent-core": "18.20.2",
68
- "@oh-my-pi/pi-coding-agent": "18.20.2",
67
+ "@oh-my-pi/pi-agent-core": "18.22.2",
68
+ "@oh-my-pi/pi-coding-agent": "18.22.2",
69
69
  "@tanstack/react-query": "^5.102.3",
70
70
  "@types/node": "^24.10.1",
71
71
  "@types/react": "^19.2.18",
@@ -3,6 +3,7 @@ import { randomUUID } from "node:crypto";
3
3
  import { tmpdir } from "node:os";
4
4
  import { createInterface } from "node:readline";
5
5
  import { z } from "zod";
6
+ import { accountTags } from "../shared/account-tags";
6
7
  import {
7
8
  OMP_ACCOUNTS_SETTING_PATHS,
8
9
  type OmpAccount,
@@ -118,7 +119,16 @@ const UsageReportSchema = z.object({
118
119
  amount: z.object({ usedFraction: UsedFraction.nullish() }).nullish(),
119
120
  }),
120
121
  ).nullish(),
121
- metadata: z.object({ accountId: z.string().nullish(), orgId: z.string().nullish() }).nullish(),
122
+ metadata: z
123
+ .object({
124
+ accountId: z.string().nullish(),
125
+ orgId: z.string().nullish(),
126
+ email: z.string().nullish(),
127
+ plan: z.string().nullish(),
128
+ planType: z.string().nullish(),
129
+ orgName: z.string().nullish(),
130
+ })
131
+ .nullish(),
122
132
  });
123
133
  type UsageReport = z.infer<typeof UsageReportSchema>;
124
134
  const UsageSchema = z.object({ reports: entries(UsageReportSchema).nullish() });
@@ -578,6 +588,7 @@ export function joinAccounts(
578
588
  credentialId: login.credentialId,
579
589
  oauth: false,
580
590
  label: login.label,
591
+ tags: [],
581
592
  limits: [],
582
593
  usageAt: null,
583
594
  usageIsRecorded: false,
@@ -608,7 +619,7 @@ export function joinAccounts(
608
619
  provider: login.provider,
609
620
  credentialId: login.credentialId,
610
621
  oauth: true,
611
- label: login.label,
622
+ ...labelWithTags(login.label, report),
612
623
  limits: recorded?.limits ?? live,
613
624
  usageAt: recorded?.at ?? report?.fetchedAt ?? null,
614
625
  usageIsRecorded: recorded !== null,
@@ -621,6 +632,30 @@ export function joinAccounts(
621
632
  );
622
633
  }
623
634
 
635
+ /**
636
+ * Plan and organization badges from the login's usage report. OMP appends the organization to the
637
+ * label in parentheses (`email (org)`); once a badge shows it, the suffix only repeats it.
638
+ */
639
+ function labelWithTags(
640
+ label: string,
641
+ report: UsageReport | undefined,
642
+ ): Pick<OmpAccount, "label" | "tags"> {
643
+ const metadata = report?.metadata;
644
+ const orgName = metadata?.orgName?.trim() || null;
645
+ const tags = accountTags({
646
+ // A blank planType must not hide a plan the report names, as in the quota popover.
647
+ plan: metadata?.planType?.trim() || metadata?.plan?.trim() || null,
648
+ organization: orgName,
649
+ email: metadata?.email?.trim() || null,
650
+ });
651
+ const suffix = orgName ? ` (${orgName})` : null;
652
+ return {
653
+ label:
654
+ tags.length > 0 && suffix && label.endsWith(suffix) ? label.slice(0, -suffix.length) : label,
655
+ tags,
656
+ };
657
+ }
658
+
624
659
  /** Where new sessions would go right now, by OMP's own balancer. */
625
660
  async function previewBalance(
626
661
  command: OmpCommand,
@@ -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.7.0-next.512.1"; // x-release-please-version
2
+ export const PASEO_OMP_PACKAGE_VERSION = "5.7.0-next.518.1"; // x-release-please-version
package/server/quota.ts CHANGED
@@ -46,6 +46,79 @@ function copilotAccount(accountKey: string): CopilotAccount {
46
46
  }
47
47
  }
48
48
 
49
+ const CachedReportSchema = z.object({
50
+ value: z.object({
51
+ provider: z.string(),
52
+ fetchedAt: z.number(),
53
+ metadata: z
54
+ .object({
55
+ plan: z.string().nullish(),
56
+ planType: z.string().nullish(),
57
+ orgName: z.string().nullish(),
58
+ })
59
+ .nullish(),
60
+ }),
61
+ });
62
+
63
+ type AccountTags = Pick<OmpQuota, "plan" | "organization">;
64
+ type CachedReport = AccountTags & { key: string; provider: string; fetchedAt: number };
65
+
66
+ /** OMP's usage cache; missing on older OMP versions, so any failure yields no tags. */
67
+ function readCachedReports(database: DatabaseSync): CachedReport[] {
68
+ let rows: Record<string, unknown>[];
69
+ try {
70
+ // A key range on the primary key (";" follows ":"), where LIKE would scan the whole cache.
71
+ rows = database
72
+ .prepare(
73
+ "SELECT key, value FROM cache WHERE key >= 'usage_cache:report:' AND key < 'usage_cache:report;'",
74
+ )
75
+ .all();
76
+ } catch {
77
+ return [];
78
+ }
79
+ return rows.flatMap(({ key, value }) => {
80
+ if (typeof key !== "string" || typeof value !== "string") return [];
81
+ let json: unknown;
82
+ try {
83
+ json = JSON.parse(value);
84
+ } catch {
85
+ return [];
86
+ }
87
+ const parsed = CachedReportSchema.safeParse(json);
88
+ if (!parsed.success) return [];
89
+ const { provider, fetchedAt, metadata } = parsed.data.value;
90
+ // A blank planType must not hide a plan the report names.
91
+ const plan = metadata?.planType?.trim() || metadata?.plan?.trim() || null;
92
+ const organization = metadata?.orgName?.trim() || null;
93
+ return [
94
+ {
95
+ key,
96
+ provider,
97
+ fetchedAt,
98
+ plan,
99
+ // Codex reports its plan as the organization name too; that is not an organization.
100
+ organization: organization?.toLowerCase() === plan?.toLowerCase() ? null : organization,
101
+ },
102
+ ];
103
+ });
104
+ }
105
+
106
+ /**
107
+ * OMP caches each report under a key that ends with the account_key usage_history records. Both
108
+ * tags come from the newest report naming either, so two reports are never mixed into one badge row.
109
+ */
110
+ function accountTags(
111
+ reports: readonly CachedReport[],
112
+ provider: string,
113
+ accountKey: string,
114
+ ): AccountTags {
115
+ const best = reports
116
+ .filter((report) => report.provider === provider && report.key.endsWith(`:${accountKey}`))
117
+ .sort((a, b) => b.fetchedAt - a.fetchedAt)
118
+ .find((report) => report.plan || report.organization);
119
+ return { plan: best?.plan ?? null, organization: best?.organization ?? null };
120
+ }
121
+
49
122
  // Only live windows are returned: a series whose newest row already reset (or never resets and was
50
123
  // abandoned) would otherwise pin the pill at its last exhausted value and bloat the popover.
51
124
  export function listOmpQuotasFrom(path: string, now = Date.now()): OmpQuota[] {
@@ -79,6 +152,7 @@ export function listOmpQuotasFrom(path: string, now = Date.now()): OmpQuota[] {
79
152
  ORDER BY COALESCE(usedFraction, -1) DESC, provider, label, accountKey, limitId`,
80
153
  )
81
154
  .all(now, now - ABANDONED_AFTER_MS);
155
+ const reports = readCachedReports(database);
82
156
  return rows.flatMap((row) => {
83
157
  const parsed = QuotaRowSchema.safeParse(row);
84
158
  if (!parsed.success) return [];
@@ -91,6 +165,7 @@ export function listOmpQuotasFrom(path: string, now = Date.now()): OmpQuota[] {
91
165
  // account_id is only known to be a username for Copilot; other providers keep it private.
92
166
  accountId: copilot ? quota.accountId : null,
93
167
  ...(copilot ? copilotAccount(quota.accountKey) : UNKNOWN_SERVICE),
168
+ ...accountTags(reports, quota.provider, quota.accountKey),
94
169
  },
95
170
  ];
96
171
  });
@@ -0,0 +1,44 @@
1
+ const PLAN_LABELS: Record<string, string> = {
2
+ free: "Free",
3
+ go: "Go",
4
+ plus: "Plus",
5
+ pro: "Pro",
6
+ prolite: "Pro Lite",
7
+ max: "Max",
8
+ team: "Team",
9
+ business: "Business",
10
+ self_serve_business_prolite: "Business",
11
+ self_serve_business_usage_based: "Business",
12
+ enterprise: "Enterprise",
13
+ enterprise_cbp_automation: "Enterprise",
14
+ enterprise_cbp_usage_based: "Enterprise",
15
+ edu: "Edu",
16
+ };
17
+
18
+ /**
19
+ * Plan and organization badges for one login, e.g. ["Business", "Example Team"] or ["Personal"].
20
+ * `plan` is the raw plan OMP's usage report names (Codex `planType`, Copilot `plan`).
21
+ */
22
+ export function accountTags(input: {
23
+ plan: string | null;
24
+ organization: string | null;
25
+ email: string | null;
26
+ }): string[] {
27
+ const { plan, organization, email } = input;
28
+ const tags: string[] = [];
29
+ if (plan) {
30
+ // An own-property lookup: a plan named like an Object member ("constructor") is still a plan.
31
+ const key = plan.toLowerCase();
32
+ tags.push(
33
+ Object.hasOwn(PLAN_LABELS, key)
34
+ ? PLAN_LABELS[key]
35
+ : plan.charAt(0).toUpperCase() + plan.slice(1),
36
+ );
37
+ }
38
+ // Codex reports its plan as the organization name too; that is not an organization.
39
+ if (organization && organization.toLowerCase() !== plan?.toLowerCase()) {
40
+ // Anthropic names a personal account's default organization after its email.
41
+ tags.push(email && organization === `${email}'s Organization` ? "Personal" : organization);
42
+ }
43
+ return [...new Set(tags)];
44
+ }
@@ -46,6 +46,8 @@ export const OmpAccountSchema = z.object({
46
46
  /** OAuth logins have usage and resets; API keys have neither. */
47
47
  oauth: z.boolean(),
48
48
  label: z.string(),
49
+ /** Plan and organization badges from OMP's usage report, e.g. "Business" or "Personal". */
50
+ tags: z.array(z.string()).default([]),
49
51
  limits: z.array(OmpAccountLimitSchema),
50
52
  /** When OMP read the limits shown (epoch ms); null when it has no reading for this login. */
51
53
  usageAt: z.number().int().nullable(),
package/shared/quota.ts CHANGED
@@ -16,6 +16,10 @@ export const OmpQuotaSchema = z.object({
16
16
  accountService: z.enum(["github", "ghe"]).nullable(),
17
17
  /** GHE hostname; null for public GitHub and every other provider. */
18
18
  accountHost: z.string().nullable(),
19
+ /** Raw plan OMP's cached usage report names (Codex `planType`, Copilot `plan`). */
20
+ plan: z.string().nullable().default(null),
21
+ /** Organization name from OMP's cached usage report, when it is not just the plan. */
22
+ organization: z.string().nullable().default(null),
19
23
  label: z.string(),
20
24
  windowLabel: z.string().nullable(),
21
25
  usedFraction: z.number().min(0).nullable(),