@ycodium-ai/agent-claude 0.2.2876 → 0.2.2880

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 (2) hide show
  1. package/dist/index.js +27 -2
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -23528,7 +23528,7 @@ import {
23528
23528
  var CLAUDE_QUOTA_URL = "https://api.anthropic.com/api/oauth/usage";
23529
23529
  var REQUEST_TIMEOUT_MS = 1e4;
23530
23530
  var HOUR_MS = 60 * 60 * 1e3;
23531
- var WINDOWS = [
23531
+ var CLAUDE_QUOTA_WINDOWS = [
23532
23532
  { field: "five_hour", id: "session", labelKey: "usage.window.session", windowMs: 5 * HOUR_MS },
23533
23533
  { field: "seven_day", id: "weekly", labelKey: "usage.window.weekly", windowMs: 7 * 24 * HOUR_MS }
23534
23534
  ];
@@ -23595,7 +23595,7 @@ var toIso = (value) => {
23595
23595
  const parsed = Date.parse(value);
23596
23596
  return Number.isNaN(parsed) ? null : new Date(parsed).toISOString();
23597
23597
  };
23598
- var readWindows = (body) => WINDOWS.flatMap((spec) => {
23598
+ var readWindows = (body) => CLAUDE_QUOTA_WINDOWS.flatMap((spec) => {
23599
23599
  const row = body[spec.field];
23600
23600
  if (!isRecord6(row)) return [];
23601
23601
  const utilization = row["utilization"];
@@ -23686,6 +23686,30 @@ var readClaudeQuota = async (request) => {
23686
23686
  };
23687
23687
  };
23688
23688
 
23689
+ // src/usageRead/rateLimitEvent.ts
23690
+ var isRecord7 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
23691
+ var claudeQuotaFromRateLimitEvent = (message) => {
23692
+ const info = isRecord7(message) ? message["rate_limit_info"] : void 0;
23693
+ if (!isRecord7(info)) return null;
23694
+ const spec = CLAUDE_QUOTA_WINDOWS.find((window2) => window2.field === info["rateLimitType"]);
23695
+ const utilization = info["utilization"];
23696
+ if (spec === void 0 || typeof utilization !== "number" || !Number.isFinite(utilization)) {
23697
+ return null;
23698
+ }
23699
+ const resetsAt = info["resetsAt"];
23700
+ return {
23701
+ windows: [
23702
+ {
23703
+ id: spec.id,
23704
+ label: { key: spec.labelKey },
23705
+ usedPercent: Math.min(100, Math.max(0, utilization * 100)),
23706
+ resetsAt: typeof resetsAt === "number" && Number.isFinite(resetsAt) ? new Date(resetsAt * 1e3).toISOString() : null,
23707
+ windowMs: spec.windowMs
23708
+ }
23709
+ ]
23710
+ };
23711
+ };
23712
+
23689
23713
  // src/usageRead/scanCache.ts
23690
23714
  import * as NodePath11 from "node:path";
23691
23715
 
@@ -24172,6 +24196,7 @@ var createClaudeUsage = (input) => {
24172
24196
  });
24173
24197
  return {
24174
24198
  readQuota: ({ signal }) => readClaudeQuota({ recipe, fetch: host.fetch, signal }),
24199
+ quotaFromRateLimits: claudeQuotaFromRateLimitEvent,
24175
24200
  readTokenUsage: tokens.readTokenUsage
24176
24201
  };
24177
24202
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ycodium-ai/agent-claude",
3
- "version": "0.2.2876",
3
+ "version": "0.2.2880",
4
4
  "description": "Claude executor: Claude Code CLI via @anthropic-ai/claude-agent-sdk.",
5
5
  "keywords": [
6
6
  "ycodium",
@@ -24,9 +24,9 @@
24
24
  "@types/node": "24.12.4",
25
25
  "esbuild": "0.28.1",
26
26
  "vite-plus": "0.2.2",
27
- "@ycodium-ai/plugin-api": "0.2.2876",
28
- "ycodium-jsonl-stream": "0.0.0",
29
- "ycodium-executor-testing": "0.0.0"
27
+ "@ycodium-ai/plugin-api": "0.2.2880",
28
+ "ycodium-executor-testing": "0.0.0",
29
+ "ycodium-jsonl-stream": "0.0.0"
30
30
  },
31
31
  "ycodium": {
32
32
  "plugin": "./dist/index.js",