tuxevil-rotator 3.5.0 → 3.6.0

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/src/types.ts CHANGED
@@ -142,8 +142,8 @@ export interface Config {
142
142
  streamRecoveryMaxRetries?: number;
143
143
  // Prompt compression mode ("off" | "lite" | "rtk" | "rtk+lite").
144
144
  compressionMode?: "off" | "lite" | "rtk" | "rtk+lite";
145
- // Override per-model specs used by the compat layer. Keys are model id substrings
146
- // matched case-insensitively. When set, replaces the bundled defaults entirely.
145
+ // Partially override per-model specs used by the compat layer. Keys are model id
146
+ // substrings matched case-insensitively; omitted fields inherit effective defaults.
147
147
  modelSpecs?: Record<string, ModelSpecConfig>;
148
148
  // Override model-id aliases used to translate the operator-facing name
149
149
  // (e.g. "gemini-3.1-pro-high") to the upstream Antigravity name
@@ -224,9 +224,11 @@ export interface GoogleQuotaResponse {
224
224
  // Per-model thinking/output spec used by the compat layer.
225
225
  // Operators can override defaults via the `modelSpecs` field in accounts.json.
226
226
  export interface ModelSpecConfig {
227
- maxOutputTokens: number;
228
- thinkingBudget: number; // -1 = adaptive (model decides), >=0 = fixed
229
- isThinking: boolean;
227
+ maxOutputTokens?: number;
228
+ thinkingBudget?: number; // -1 = adaptive (model decides), >=0 = fixed
229
+ minThinkingBudget?: number;
230
+ isThinking?: boolean;
231
+ contextWindow?: number;
230
232
  }
231
233
 
232
234
  // Per-model quota info for an account
@@ -454,7 +456,22 @@ export interface PersistedSafetyState {
454
456
  }>;
455
457
  }
456
458
 
459
+ export interface PersistedDynamicModelOwnership {
460
+ scopedModels: string[];
461
+ accounts: Record<
462
+ string,
463
+ {
464
+ credentialGenerationFingerprint: string;
465
+ models: string[];
466
+ }
467
+ >;
468
+ }
469
+
457
470
  export interface PersistedState {
471
+ // Historical dynamic model IDs mapped to their shared quota pools.
472
+ dynamicModelQuotaPools?: Record<string, string>;
473
+ // Exact account ownership for dynamically discovered model IDs.
474
+ dynamicModelOwnership?: PersistedDynamicModelOwnership;
458
475
  // Per-model active account index
459
476
  modelAccounts: Record<string, number>;
460
477
  // Per-model request count on the active account
@@ -849,11 +866,28 @@ export function getModelPricing(model: string): ModelPricing | undefined {
849
866
  if (MODEL_PRICING[model]) return MODEL_PRICING[model];
850
867
  const lower = model.toLowerCase();
851
868
  if (MODEL_PRICING[lower]) return MODEL_PRICING[lower];
852
- // Dynamic family fallbacks for unseen future models:
853
- if (lower.includes("opus")) return MODEL_PRICING["claude-opus-4-6-thinking"];
854
- if (lower.includes("sonnet")) return MODEL_PRICING["claude-sonnet-4-6"];
855
- if (lower.includes("flash")) return MODEL_PRICING["gemini-3.8-flash-high"] ?? MODEL_PRICING["gemini-3.7-flash-tiered"];
856
- if (lower.includes("pro")) return MODEL_PRICING["gemini-3.1-pro"];
869
+ // Dynamic family fallbacks for unseen future models. Keep provider and
870
+ // version checks explicit so an unrelated model containing "flash" cannot
871
+ // inherit Gemini pricing.
872
+ if (lower.includes("claude") && lower.includes("opus")) {
873
+ return MODEL_PRICING["claude-opus-4-6-thinking"];
874
+ }
875
+ if (lower.includes("claude") && lower.includes("sonnet")) {
876
+ return MODEL_PRICING["claude-sonnet-4-6"];
877
+ }
878
+ if (lower.includes("gemini")) {
879
+ if (lower.includes("3.8") && lower.includes("flash")) {
880
+ return MODEL_PRICING["gemini-3.8-flash-high"];
881
+ }
882
+ if (lower.includes("3.7") && lower.includes("flash")) {
883
+ return MODEL_PRICING["gemini-3.7-flash-tiered"];
884
+ }
885
+ if (lower.includes("3.6") && lower.includes("flash")) {
886
+ return MODEL_PRICING["gemini-3.6-flash-high"];
887
+ }
888
+ if (lower.includes("flash")) return MODEL_PRICING["gemini-3-flash"];
889
+ if (lower.includes("pro")) return MODEL_PRICING["gemini-3.1-pro"];
890
+ }
857
891
  if (lower.includes("gpt-oss")) return MODEL_PRICING["gpt-oss-120b-medium"];
858
892
  return undefined;
859
893
  }
package/src/validators.ts CHANGED
@@ -173,9 +173,15 @@ export function validateConfig(value: unknown): ValidationResult<Config> {
173
173
  if (spec.thinkingBudget !== undefined && (typeof spec.thinkingBudget !== "number" || !Number.isFinite(spec.thinkingBudget))) {
174
174
  errors.push(`config.modelSpecs.${key}.thinkingBudget must be a number`);
175
175
  }
176
+ if (spec.minThinkingBudget !== undefined && !isNonNegativeNumber(spec.minThinkingBudget)) {
177
+ errors.push(`config.modelSpecs.${key}.minThinkingBudget must be a non-negative number`);
178
+ }
176
179
  if (spec.isThinking !== undefined && typeof spec.isThinking !== "boolean") {
177
180
  errors.push(`config.modelSpecs.${key}.isThinking must be a boolean`);
178
181
  }
182
+ if (spec.contextWindow !== undefined && !isPositiveNumber(spec.contextWindow)) {
183
+ errors.push(`config.modelSpecs.${key}.contextWindow must be a positive number`);
184
+ }
179
185
  }
180
186
  }
181
187
  }