refactor: remove dead exports and orphan modules

Delete exported symbols that nothing in src/, setup/, scripts/ or
runners/ references (and no test exercises), iterated to a fixed point:
service-routing lease/failover helpers, paired-workspace-manager
fingerprint/registration helpers, message-runtime-rules trigger helpers,
utils.fetchWithTimeout, detectPnpmStorePath, isCodexMainService,
isDeltaHandoffEnabledForGroup with the unused DELTA_HANDOFF config, the
deprecated db/schema.applySchemaMigrations alias, unused db wrappers
(memories, router state, sessions-by-agent-type, room skill override
writes, recent chat/turn-output queries) and a few unused type aliases.

Orphan files: src/dashboard.ts + src/dashboard-status-content.ts (only
referenced each other), src/restart-context-cli.ts (never invoked) and
the unused src/config/index.ts barrel.

Service-handoff / channel-owner-lease code is left for a later batch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Codex
2026-10-01 19:04:03 +09:00
parent 02ea212be0
commit a9fe9dac54
40 changed files with 1 additions and 1101 deletions

View File

@@ -14,11 +14,7 @@ import {
} from './claude-credentials-path.js';
import { DATA_DIR } from './config.js';
import { logger } from './logger.js';
import {
getAllTokens,
getConfiguredClaudeTokens,
getCurrentToken,
} from './token-rotation.js';
import { getAllTokens, getConfiguredClaudeTokens } from './token-rotation.js';
import { readJsonFile, writeJsonFile } from './utils.js';
const USAGE_CACHE_FILE = path.join(DATA_DIR, 'claude-usage-cache.json');
@@ -423,27 +419,6 @@ async function fetchUsageForToken(
}
}
/**
* Fetch Claude usage via the OAuth API.
* Uses the current active token from rotation.
*/
export async function fetchClaudeUsage(): Promise<ClaudeUsageData | null> {
// Prefer the access token in credentials.json when present. The static .env
// token (CLAUDE_CODE_OAUTH_TOKEN) was issued before the `user:profile` scope
// was required for /api/oauth/usage and so always 403s. The credentials file
// is the canonical source written by `claude auth login` and kept fresh by
// token-refresh.ts — its accessToken carries the full scope set.
const credsToken = readCredentialsAccessToken(0);
const token =
credsToken || getCurrentToken() || getConfiguredClaudeTokens()[0];
if (!token) {
logger.debug('No Claude OAuth token available for usage check');
return null;
}
// Pass accountIndex=0 so 401/403 → forceRefreshToken retry path engages.
return (await fetchUsageForToken(token, 0)).usage;
}
export interface ClaudeAccountProfile {
email: string;
planType: string; // "max", "pro", "free"
@@ -634,6 +609,3 @@ export async function fetchAllClaudeUsage(): Promise<ClaudeAccountUsage[]> {
}
return results;
}
// Legacy alias
export const fetchClaudeUsageViaCli = fetchClaudeUsage;