agent-relay-server 0.94.2 → 0.94.3

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/docs/openapi.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "openapi": "3.1.0",
3
3
  "info": {
4
4
  "title": "Agent Relay API",
5
- "version": "0.94.2",
5
+ "version": "0.94.3",
6
6
  "description": "Real-time message bus for inter-agent communication. Agent-first: this spec is designed for machine consumption — agents can self-discover the full API surface via GET /api/spec.",
7
7
  "license": {
8
8
  "name": "MIT",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-relay-server",
3
- "version": "0.94.2",
3
+ "version": "0.94.3",
4
4
  "description": "Lightweight HTTP message relay for inter-agent communication across machines",
5
5
  "module": "src/index.ts",
6
6
  "type": "module",
@@ -34,7 +34,7 @@
34
34
  "CONTRIBUTING.md"
35
35
  ],
36
36
  "dependencies": {
37
- "agent-relay-sdk": "0.2.74",
37
+ "agent-relay-sdk": "0.2.75",
38
38
  "ajv": "^8.20.0"
39
39
  },
40
40
  "scripts": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "agent-relay-runner",
3
3
  "description": "Thin Agent Relay runner bridge for Claude Code",
4
- "version": "0.94.2",
4
+ "version": "0.94.3",
5
5
  "agentRelayContracts": {
6
6
  "providerPluginProtocol": 1
7
7
  }
@@ -1,7 +1,7 @@
1
1
  import { readFile } from "node:fs/promises";
2
2
  import { homedir } from "node:os";
3
3
  import { join } from "node:path";
4
- import { credentialAccountKey } from "agent-relay-sdk/provider-quota";
4
+ import { resolveStableCodexQuotaIdentity } from "agent-relay-sdk/provider-quota";
5
5
  import { quotaStateFromProbeMetrics } from "agent-relay-sdk/context-probe";
6
6
  import { errMessage, isRecord, stringValue } from "agent-relay-sdk";
7
7
  import { codexWhamQuotaEnabled } from "./config";
@@ -119,11 +119,12 @@ async function readCodexWhamAuth(path: string): Promise<CodexWhamAuth | undefine
119
119
  const tokens = isRecord(parsed) && isRecord(parsed.tokens) ? parsed.tokens : undefined;
120
120
  const accessToken = stringValue(tokens?.access_token);
121
121
  const accountId = stringValue(tokens?.account_id);
122
- if (!accessToken || !accountId) return undefined;
122
+ const identity = resolveStableCodexQuotaIdentity({ authPayload: parsed });
123
+ if (!accessToken || !accountId || !identity) return undefined;
123
124
  return {
124
125
  accessToken,
125
126
  accountId,
126
- accountKey: credentialAccountKey(accountId),
127
+ accountKey: identity.accountKey,
127
128
  };
128
129
  } catch {
129
130
  return undefined;
@@ -1,4 +1,5 @@
1
1
  import { DAY_MS, QUOTA_HISTORY_RETENTION_MS } from "../config";
2
+ import { credentialAccountKey } from "agent-relay-sdk/provider-quota";
2
3
  import { parseJson } from "../utils";
3
4
  import { getDb } from "./connection.ts";
4
5
  import { deriveProviderQuotaBurn } from "./provider-quota-burn.ts";
@@ -98,6 +99,7 @@ function quotaRowsForProvider(provider: string): ProviderQuotaRow[] {
98
99
  function supersededAccountKeys(provider: string, accountKey: string, rawAccountKey: string, sourceAgentId: string | undefined): string[] {
99
100
  const candidates = new Set<string>();
100
101
  if (rawAccountKey && rawAccountKey !== accountKey) candidates.add(rawAccountKey);
102
+ if (provider === "codex" && accountKey.startsWith("account:")) candidates.add(credentialAccountKey(accountKey.slice("account:".length)));
101
103
  const host = hostFromAccountKey(accountKey) ?? sourceAgentHost(sourceAgentId);
102
104
  if (host) {
103
105
  candidates.add(`host:${host}:${provider}`);
@@ -607,9 +609,7 @@ export function normalizeProviderQuotaAccountKeys(now = Date.now()): number {
607
609
  let changes = 0;
608
610
  for (const row of getDb().query("SELECT * FROM provider_quotas").all() as ProviderQuotaRow[]) {
609
611
  const accountKey = canonicalProviderQuotaAccountKey(row.provider, row.account_key);
610
- if (accountKey !== row.account_key) {
611
- changes += mergeProviderQuotaRows(row.provider, accountKey, [row.account_key], now);
612
- }
612
+ changes += mergeProviderQuotaRows(row.provider, accountKey, accountKey === row.account_key ? supersededAccountKeys(row.provider, accountKey, row.account_key, undefined) : [row.account_key], now);
613
613
  }
614
614
  changes += pruneUnstableProviderQuotaRecords();
615
615
  changes += pruneProviderQuotaRecords(undefined, undefined, now - DAY_MS);