/** * Z.AI Monitor API client — compatibility delegate (P4-02). * * The Z.AI fetch mechanics moved to * {@link ../providers/zai/monitor-client.js} so the Provider Adapter owns * its transport. This module retains every existing export as a thin * delegate so current imports keep working while command Modules migrate * to the normalized Provider-quota Interface (ADR-0001). * * Distinct from the MCP/coding endpoints: * - Base: https://api.z.ai (no /api/coding/paas/v4 prefix) * - Auth quirk: try `Authorization: ` first; on 401 retry with `Bearer ` */ import { ApiError, AuthError, NetworkError, TimeoutError } from "./errors.js"; export interface ToolUsage { modelCode: string; usage: number; } export interface TimeLimit { type: "TIME_LIMIT"; unit: number; number: number; usage: number; currentValue: number; remaining: number; percentage: number; nextResetTime: number; usageDetails: ToolUsage[]; } export interface TokensLimit { type: "TOKENS_LIMIT"; unit: number; number: number; percentage: number; nextResetTime?: number; } export interface QuotaLimit { level: string; limits: (TimeLimit | TokensLimit)[]; } export interface ModelUsageTotal { totalModelCallCount: number; totalTokensUsage: number; modelSummaryList?: Array<{ modelName: string; totalTokens: number; sortOrder: number; }>; } /** * Back-compat delegate. Resolves the API key through the shared config * accessor and delegates the fetch to the Provider-local monitor client. * * T2a: an optional `env` parameter (defaulting to `process.env`) threads * the resolved credential view into `getApiKey` so file-configured keys * are visible. Source-compatible: existing no-argument callers keep * working against ambient `process.env`. * * T2b — coordinator decision (ticket t2b-credential-raw "Scope * discrepancy"): these two back-compat exports are the SECOND documented * intentional ambient compatibility exception (alongside the load-failure * adapter in `node-command-invocation-adapter.ts`). GitNexus rates each * delegate LOW with zero reported callers/processes, and the live Z.AI * quota path uses `providers/zai/quota.ts` which passes an explicit key * to the Provider-local monitor client. If a caller appears later it * MUST pass env explicitly; for now the ambient default is retained so * the public export signature stays source-compatible. */ export declare function getQuotaLimit(env?: NodeJS.ProcessEnv): Promise; /** * Back-compat delegate for the model-usage endpoint. Unused by commands * today; preserved so the public export surface is unchanged. The * optional `env` parameter (T2a) mirrors {@link getQuotaLimit}. */ export declare function getModelUsage(startTime: string, endTime: string, env?: NodeJS.ProcessEnv): Promise; export declare function getTimeLimit(data: QuotaLimit): TimeLimit | undefined; export declare function getTokensLimit(data: QuotaLimit): TokensLimit | undefined; /** Human-readable "in 4h 23m" / "in 3d" / "now" from epoch-ms timestamp. */ export declare function formatResetTime(epochMs: number): string; export { ApiError, AuthError, NetworkError, TimeoutError }; //# sourceMappingURL=monitor-client.d.ts.map