framework
Version:
The (AI) Framework: turnkey, zero-config AI orchestration that wraps a coding-agent CLI (Claude Code) as a black box and takes you from an idea to a running app. Vite for AI.
40 lines • 1.84 kB
TypeScript
import type { DriverQuota } from './types.js';
import type { SpawnLike } from './cli-session.js';
/**
* Parse Claude Code's `/usage` readout (#521).
*
* The agent prints prose, so this is a text parse and a reworded readout is a
* real failure mode. It fails to `unrecognized` rather than to an empty reading:
* a silent zero would read as "nothing used" and let a consumption limit run the
* account dry.
*/
export declare function parseQuotaReadout(text: string): DriverQuota;
/** Options for {@link readClaudeQuota}. */
export interface ReadClaudeQuotaOptions {
/** CLI binary to spawn. Default `"claude"` (resolved on `PATH`). */
bin?: string;
/** Working directory for the child. The read is account-wide, so this is incidental. */
cwd?: string;
/** Environment for the child process. Default `process.env`. */
env?: NodeJS.ProcessEnv;
/** `spawn` override for tests. Default `node:child_process.spawn`. */
spawn?: SpawnLike;
/** Abort the read. */
signal?: AbortSignal;
/** Override the timeout. Default {@link READ_TIMEOUT_MS}. */
timeoutMs?: number;
}
/**
* Ask Claude Code where the account's subscription quota stands (#521).
*
* Runs the CLI's own `/usage` command in print mode. Costs nothing: verified on
* 2.1.210 as `total_cost_usd: 0` across zero turns and zero tokens, because the
* CLI answers it locally rather than by prompting a model. It reaches Anthropic
* itself, with its own credentials, so The Framework never reads or handles the
* user's token.
*
* Never pass `--bare` here: it pins the CLI to API-key auth and never reads the
* OAuth credentials, so the subscription quota this reads would vanish.
*/
export declare function readClaudeQuota(opts?: ReadClaudeQuotaOptions): Promise<DriverQuota>;
//# sourceMappingURL=claude-code-quota.d.ts.map