@oh-my-pi/pi-ai 14.0.5 → 14.1.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/CHANGELOG.md CHANGED
@@ -2,6 +2,20 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [14.1.0] - 2026-04-11
6
+ ### Added
7
+
8
+ - Added `accountId` to usage report metadata
9
+
10
+ ### Changed
11
+
12
+ - Changed usage parsing to emit a usage report with available fields when parsing fails, rather than returning null
13
+
14
+ ### Fixed
15
+
16
+ - Fixed `planType` resolution to fall back to the raw payload `plan_type` when parsed value is absent
17
+ - Fixed usage metadata `raw` fallback to preserve the original payload when parsed raw output is missing
18
+
5
19
  ## [14.0.5] - 2026-04-11
6
20
 
7
21
  ### Changed
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@oh-my-pi/pi-ai",
4
- "version": "14.0.5",
4
+ "version": "14.1.0",
5
5
  "description": "Unified LLM API with automatic model discovery and provider configuration",
6
6
  "homepage": "https://github.com/can1357/oh-my-pi",
7
7
  "author": "Can Boluk",
@@ -45,7 +45,7 @@
45
45
  "@aws-sdk/client-bedrock-runtime": "^3",
46
46
  "@bufbuild/protobuf": "^2.11",
47
47
  "@google/genai": "^1.43",
48
- "@oh-my-pi/pi-utils": "14.0.5",
48
+ "@oh-my-pi/pi-utils": "14.1.0",
49
49
  "@sinclair/typebox": "^0.34",
50
50
  "@smithy/node-http-handler": "^4.4",
51
51
  "ajv": "^8.18",
@@ -308,31 +308,30 @@ export const openaiCodexUsageProvider: UsageProvider = {
308
308
  }
309
309
 
310
310
  const parsed = parseUsagePayload(payload);
311
- if (!parsed) {
312
- ctx.logger?.warn("Codex usage response invalid", { provider: params.provider });
313
- return null;
314
- }
311
+ const planType =
312
+ parsed?.planType ??
313
+ (isRecord(payload) && typeof payload.plan_type === "string" ? payload.plan_type : undefined);
315
314
 
316
315
  const limits: UsageLimit[] = [];
317
- if (parsed.primary) {
316
+ if (parsed?.primary) {
318
317
  limits.push(
319
318
  buildUsageLimit({
320
319
  key: "primary",
321
320
  window: parsed.primary,
322
321
  accountId,
323
- planType: parsed.planType,
322
+ planType,
324
323
  limitReached: parsed.limitReached,
325
324
  nowMs,
326
325
  }),
327
326
  );
328
327
  }
329
- if (parsed.secondary) {
328
+ if (parsed?.secondary) {
330
329
  limits.push(
331
330
  buildUsageLimit({
332
331
  key: "secondary",
333
332
  window: parsed.secondary,
334
333
  accountId,
335
- planType: parsed.planType,
334
+ planType,
336
335
  limitReached: parsed.limitReached,
337
336
  nowMs,
338
337
  }),
@@ -344,12 +343,13 @@ export const openaiCodexUsageProvider: UsageProvider = {
344
343
  fetchedAt: nowMs,
345
344
  limits,
346
345
  metadata: {
347
- planType: parsed.planType,
348
- allowed: parsed.allowed,
349
- limitReached: parsed.limitReached,
346
+ planType,
347
+ allowed: parsed?.allowed,
348
+ limitReached: parsed?.limitReached,
350
349
  email,
350
+ accountId,
351
351
  },
352
- raw: parsed.raw,
352
+ raw: parsed?.raw ?? payload,
353
353
  };
354
354
 
355
355
  return report;