agent-relay-orchestrator 0.78.7 → 0.78.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-relay-orchestrator",
3
- "version": "0.78.7",
3
+ "version": "0.78.8",
4
4
  "description": "Agent Relay orchestrator — manages agent lifecycle across hosts",
5
5
  "type": "module",
6
6
  "bin": {
@@ -16,7 +16,7 @@
16
16
  "test": "bun test"
17
17
  },
18
18
  "dependencies": {
19
- "agent-relay-sdk": "0.2.57"
19
+ "agent-relay-sdk": "0.2.58"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@types/bun": "latest",
@@ -1,5 +1,5 @@
1
1
  import { homedir } from "node:os";
2
- import { existsSync, readFileSync, readdirSync } from "node:fs";
2
+ import { existsSync, readdirSync } from "node:fs";
3
3
  import { createServer } from "node:net";
4
4
  import { join } from "node:path";
5
5
  import {
@@ -7,14 +7,10 @@ import {
7
7
  QUOTA_FAILURE_LOG_INTERVAL_MS,
8
8
  QUOTA_FAST_RETRY_MS,
9
9
  QuotaCollectionError,
10
- collectClaudeQuotaSample,
11
10
  collectCodexQuotaSample,
12
- credentialAccountKey,
13
11
  normalizeProviderQuotaConfig,
14
12
  providerQuotaErrorFromCollectorError,
15
13
  quotaRetryAfterMs,
16
- readClaudeOAuthAccessToken,
17
- resolveStableClaudeQuotaIdentity,
18
14
  resolveStableCodexQuotaIdentityFromHome,
19
15
  type ProviderQuotaIdentity,
20
16
  type ProviderQuotaSample,
@@ -177,11 +173,6 @@ export class OrchestratorQuotaPoller {
177
173
  // A disabled provider (#605) is collected from at all: no discovery → no
178
174
  // polling/API calls, leases released by releaseRemovedCandidates, and no
179
175
  // skip-marker row (disabled is intentional, not a credential failure).
180
- if (this.config.providers.includes("claude") && this.configFor("claude").enabled) {
181
- const found = await this.discoverClaudeCandidates();
182
- candidates.push(...found.candidates);
183
- if (found.skipReason) skips.push({ provider: "claude", reason: found.skipReason });
184
- }
185
176
  if (this.config.providers.includes("codex") && this.configFor("codex").enabled) {
186
177
  const found = await this.discoverCodexCandidates();
187
178
  candidates.push(...found.candidates);
@@ -194,33 +185,6 @@ export class OrchestratorQuotaPoller {
194
185
  return { candidates: [...deduped.values()], skips };
195
186
  }
196
187
 
197
- private async discoverClaudeCandidates(): Promise<{ candidates: QuotaCandidate[]; skipReason?: string }> {
198
- const credentialsPaths = [
199
- join(this.config.env.CLAUDE_CONFIG_DIR || process.env.CLAUDE_CONFIG_DIR || join(homedir(), ".claude"), ".credentials.json"),
200
- ...providerHomeCredentialPaths("claude", ".credentials.json"),
201
- ];
202
- const candidates: QuotaCandidate[] = [];
203
- for (const accessToken of [
204
- this.config.env.CLAUDE_CODE_OAUTH_TOKEN,
205
- process.env.CLAUDE_CODE_OAUTH_TOKEN,
206
- ...claudeSetupTokenEnvPaths(this.config).map((path) => readEnvFileValue(path, "CLAUDE_CODE_OAUTH_TOKEN")),
207
- ]) {
208
- if (accessToken) candidates.push(claudeBearerCandidate(accessToken));
209
- }
210
- for (const credentialsPath of credentialsPaths) {
211
- const accessToken = await readClaudeOAuthAccessToken(credentialsPath);
212
- if (!accessToken) continue;
213
- const identity = await resolveStableClaudeQuotaIdentity({ credentialsPath });
214
- candidates.push({ ...(identity ?? claudeBearerCandidate(accessToken)), credentialsPath, accessToken });
215
- }
216
- if (candidates.length === 0) {
217
- const reason = "no usable Claude bearer token on this host";
218
- this.logOnce("claude:no-usable-bearer", `quota refresh skipped for claude: ${reason}`);
219
- return { candidates, skipReason: reason };
220
- }
221
- return { candidates };
222
- }
223
-
224
188
  private async discoverCodexCandidates(): Promise<{ candidates: QuotaCandidate[]; skipReason?: string }> {
225
189
  const homes = [
226
190
  this.config.env.CODEX_HOME || process.env.CODEX_HOME || join(homedir(), ".codex"),
@@ -355,14 +319,6 @@ export class OrchestratorQuotaPoller {
355
319
  }
356
320
 
357
321
  private async collect(candidate: QuotaCandidate): Promise<ProviderQuotaSample> {
358
- if (candidate.provider === "claude") {
359
- return collectClaudeQuotaSample({
360
- agentId: this.sourceAgentId(),
361
- accessToken: candidate.accessToken,
362
- credentialsPath: candidate.credentialsPath,
363
- fetchImpl: this.options.fetchImpl,
364
- });
365
- }
366
322
  if (candidate.provider === "codex") {
367
323
  return collectCodexQuotaSample({
368
324
  agentId: this.sourceAgentId(),
@@ -497,49 +453,6 @@ function providerHomeConfigDirs(provider: "claude" | "codex", markerFile: string
497
453
  return dirs;
498
454
  }
499
455
 
500
- function providerHomeCredentialPaths(provider: "claude", markerFile: string): string[] {
501
- return providerHomeConfigDirs(provider, markerFile).map((dir) => join(dir, markerFile));
502
- }
503
-
504
- function claudeSetupTokenEnvPaths(config: OrchestratorConfig): string[] {
505
- const configDir = config.env.CLAUDE_CONFIG_DIR || process.env.CLAUDE_CONFIG_DIR || join(homedir(), ".claude");
506
- return [
507
- join(configDir, "setup-token.env"),
508
- ...providerHomeConfigDirs("claude", "setup-token.env").map((dir) => join(dir, "setup-token.env")),
509
- ];
510
- }
511
-
512
- function claudeBearerCandidate(accessToken: string): QuotaCandidate {
513
- return {
514
- provider: "claude",
515
- accountKey: credentialAccountKey(accessToken),
516
- accessToken,
517
- };
518
- }
519
-
520
- function readEnvFileValue(path: string, key: string): string | undefined {
521
- try {
522
- for (const line of readFileSync(path, "utf8").split(/\r?\n/)) {
523
- const match = new RegExp(`^\\s*(?:export\\s+)?${key}\\s*=\\s*(.*)\\s*$`).exec(line);
524
- if (!match) continue;
525
- return cleanEnvValue(match[1] ?? "");
526
- }
527
- } catch {
528
- return undefined;
529
- }
530
- return undefined;
531
- }
532
-
533
- function cleanEnvValue(value: string): string | undefined {
534
- let cleaned = value.trim();
535
- if (!cleaned) return undefined;
536
- const quote = cleaned[0];
537
- if ((quote === "'" || quote === "\"") && cleaned.endsWith(quote)) {
538
- cleaned = cleaned.slice(1, -1);
539
- }
540
- return cleaned.trim() || undefined;
541
- }
542
-
543
456
  function safeReadDir(path: string): string[] {
544
457
  try {
545
458
  return readdirSync(path, { withFileTypes: true })