@genesislcap/ai-assistant 15.22.1 → 15.23.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.
@@ -1134,6 +1134,7 @@ var SUPPORTED_GEMINI_MODEL_IDS = [
1134
1134
  "gemini-2.5-pro",
1135
1135
  "gemini-2.5-flash",
1136
1136
  "gemini-2.5-flash-lite",
1137
+ "gemini-3.8-flash",
1137
1138
  "gemini-3.5-flash",
1138
1139
  "gemini-3.1-flash-lite",
1139
1140
  "gemini-3.1-pro-preview"
@@ -1236,6 +1237,22 @@ var GEMINI_PRICING = {
1236
1237
  rate: { promptPerMillion: 0.25, candidatePerMillion: 1.5 }
1237
1238
  },
1238
1239
  "gemini-3.5-flash": { kind: "flat", rate: { promptPerMillion: 1.5, candidatePerMillion: 9 } },
1240
+ // INTRODUCTORY RATE, and the only dated entry in this file. Google publishes
1241
+ // $0.75 / $3.75 per MTok **through 2026-12-31**, rising to $1.50 / $7.50 on 2027-01-01 —
1242
+ // so today this model is CHEAPER than gemini-3.5-flash above and in January it is not.
1243
+ //
1244
+ // The listed figure is the one in force, not the one coming. That is the lesson the
1245
+ // `claude-sonnet-5` entry records from the other direction: charging a scheduled future
1246
+ // rate early over-billed every request by 50% for as long as nobody noticed. A rate that
1247
+ // has not taken effect is not a price, and `GeminiPricing` deliberately has no time
1248
+ // dimension to express one — flip these two numbers on 2027-01-01 instead.
1249
+ //
1250
+ // That flip is ENFORCED, not remembered: `token-cost.test.ts` carries a dated assertion that
1251
+ // turns the build red on 2027-01-01 and names the three-line edit (these two rates, plus the
1252
+ // now-false `< gemini-3.5-flash` comparison in that same test — both models are $1.50 input
1253
+ // from that date). There is no ticket to lose.
1254
+ // https://ai.google.dev/gemini-api/docs/pricing
1255
+ "gemini-3.8-flash": { kind: "flat", rate: { promptPerMillion: 0.75, candidatePerMillion: 3.75 } },
1239
1256
  "gemini-3.1-pro-preview": {
1240
1257
  kind: "tiered",
1241
1258
  standard: { promptPerMillion: 2, candidatePerMillion: 12 },
@@ -2722,6 +2739,7 @@ var GEMINI_CONTEXT_LIMITS = {
2722
2739
  "gemini-2.5-pro": 1048576,
2723
2740
  "gemini-2.5-flash": 1048576,
2724
2741
  "gemini-2.5-flash-lite": 1048576,
2742
+ "gemini-3.8-flash": 1048576,
2725
2743
  "gemini-3.5-flash": 1048576,
2726
2744
  "gemini-3.1-flash-lite": 1048576,
2727
2745
  "gemini-3.1-pro-preview": 1048576
@@ -2746,6 +2764,10 @@ var GEMINI_MODEL_WARNINGS = {
2746
2764
  "gemini-2.5-flash": "GeminiTransport: using gemini-2.5-flash \u2014 higher cost than flash-lite; use for harder reasoning or agent tasks.",
2747
2765
  "gemini-2.5-pro": "GeminiTransport: using gemini-2.5-pro \u2014 significantly higher, prompt-size-tiered cost; reserve for tasks where flash reliability is insufficient.",
2748
2766
  "gemini-3.5-flash": "GeminiTransport: using gemini-3.5-flash \u2014 frontier model, materially higher cost than flash-lite; use for harder reasoning or agent tasks.",
2767
+ // Warns despite currently costing LESS than gemini-3.5-flash, because that is temporary: the
2768
+ // rate doubles on 2027-01-01 (see GEMINI_PRICING). A caller that picks this tier on today's
2769
+ // price and never revisits the choice gets twice the bill in January without changing a line.
2770
+ "gemini-3.8-flash": "GeminiTransport: using gemini-3.8-flash \u2014 frontier model, materially higher cost than flash-lite. Its $0.75/$3.75 per-MTok rate is introductory and DOUBLES to $1.50/$7.50 on 2027-01-01; re-check this tier choice before then.",
2749
2771
  "gemini-3.1-pro-preview": "GeminiTransport: using gemini-3.1-pro-preview \u2014 PREVIEW model (no stability guarantee, may be withdrawn) with significantly higher, prompt-size-tiered cost; reserve for tasks where flash reliability is insufficient."
2750
2772
  };
2751
2773
  var GEMINI_THINKING_DISABLEABLE = [
@@ -2753,15 +2775,32 @@ var GEMINI_THINKING_DISABLEABLE = [
2753
2775
  "gemini-2.5-flash-lite"
2754
2776
  ];
2755
2777
  var GEMINI_MEDIA_RESOLUTION_TIERS = [
2778
+ "gemini-3.8-flash",
2756
2779
  "gemini-3.5-flash",
2757
2780
  "gemini-3.1-flash-lite",
2758
2781
  "gemini-3.1-pro-preview"
2759
2782
  ];
2760
- var GEMINI_THINKING_LEVEL_TIERS = [
2761
- "gemini-3.5-flash",
2762
- "gemini-3.1-flash-lite",
2763
- "gemini-3.1-pro-preview"
2764
- ];
2783
+ var GEMINI_LEVEL_LADDER = ["minimal", "low", "medium", "high"];
2784
+ var GEMINI_THINKING_LEVELS = {
2785
+ "gemini-3.8-flash": ["low", "medium", "high"],
2786
+ "gemini-3.5-flash": ["minimal", "low", "medium", "high"],
2787
+ "gemini-3.1-flash-lite": ["minimal", "low", "medium", "high"],
2788
+ "gemini-3.1-pro-preview": ["low", "medium", "high"]
2789
+ };
2790
+ function clampThinkingLevel(supported, level) {
2791
+ if (!(supported === null || supported === void 0 ? void 0 : supported.length) || supported.includes(level)) {
2792
+ return level;
2793
+ }
2794
+ const target = GEMINI_LEVEL_LADDER.indexOf(level);
2795
+ const distance = (candidate) => Math.abs(GEMINI_LEVEL_LADDER.indexOf(candidate) - target);
2796
+ let best = supported[0];
2797
+ for (const candidate of supported) {
2798
+ if (distance(candidate) <= distance(best)) {
2799
+ best = candidate;
2800
+ }
2801
+ }
2802
+ return best;
2803
+ }
2765
2804
  var GEMINI_THINKING_LEVEL = {
2766
2805
  minimal: "minimal",
2767
2806
  low: "low",
@@ -2769,25 +2808,16 @@ var GEMINI_THINKING_LEVEL = {
2769
2808
  high: "high",
2770
2809
  max: "high"
2771
2810
  };
2772
- var GEMINI_COARSE_LEVEL_TIERS = [
2773
- "gemini-3.5-flash",
2774
- "gemini-3.1-flash-lite",
2775
- "gemini-3.1-pro-preview"
2776
- ];
2777
- var GEMINI_COARSE_LEVEL = {
2778
- minimal: "low",
2779
- low: "low",
2780
- medium: "high",
2781
- high: "high"
2782
- };
2783
2811
  var isGradedLevel = (p) => p !== void 0 && p !== "auto" && p !== "off";
2784
2812
  function geminiThinkingConfig(model, policy) {
2785
- if (isGradedLevel(policy) && GEMINI_THINKING_LEVEL_TIERS.includes(model)) {
2786
- const level = GEMINI_THINKING_LEVEL[policy];
2787
- return {
2788
- includeThoughts: true,
2789
- thinkingLevel: GEMINI_COARSE_LEVEL_TIERS.includes(model) ? GEMINI_COARSE_LEVEL[level] : level
2790
- };
2813
+ if (isGradedLevel(policy)) {
2814
+ const accepted = GEMINI_THINKING_LEVELS[model];
2815
+ if (accepted) {
2816
+ return {
2817
+ includeThoughts: true,
2818
+ thinkingLevel: clampThinkingLevel(accepted, GEMINI_THINKING_LEVEL[policy])
2819
+ };
2820
+ }
2791
2821
  }
2792
2822
  if (policy === "off" && GEMINI_THINKING_DISABLEABLE.includes(model)) {
2793
2823
  return { includeThoughts: false, thinkingBudget: 0 };
@@ -2828,7 +2858,7 @@ var GeminiTransport = class _GeminiTransport {
2828
2858
  /**
2829
2859
  * Warn once when a requested policy cannot be honoured on this model — a *cost* decision the
2830
2860
  * caller made that the wire silently reversed, so they hear about it, but only once, not per
2831
- * turn. Two shapes reach here (the Anthropic twin warns on the same two):
2861
+ * turn. Three shapes reach here (the Anthropic twin warns on the first two):
2832
2862
  *
2833
2863
  * - `'off'` on a tier that can't disable thinking — only the flash tiers accept a zero thinking
2834
2864
  * budget; everything else keeps paying for reasoning it was told to stop. (`'auto'` is NOT this
@@ -2838,6 +2868,12 @@ var GeminiTransport = class _GeminiTransport {
2838
2868
  * not the Gemini 3 `thinkingLevel` enum, so the level is dropped and the turn runs at the
2839
2869
  * default posture. Without this, a caller asking for `high` on `gemini-2.5-pro` and quietly
2840
2870
  * getting the default is left to wonder why.
2871
+ * - A graded depth whose DIALECT a Gemini 3 tier speaks but whose particular value it does not
2872
+ * accept — `minimal` on `gemini-3.8-flash` or `gemini-3.1-pro-preview`, the two tiers that
2873
+ * reject it outright. Nothing is dropped here; `clampThinkingLevel` MOVES the level onto the
2874
+ * nearest one the tier takes, and since ties resolve upward the move is usually to something
2875
+ * DEARER than the caller chose. A cost decision reversed on the wire in the expensive
2876
+ * direction is exactly what this warning exists for — without it the only trace is the bill.
2841
2877
  */
2842
2878
  warnIfThinkingUnclampable(policy) {
2843
2879
  if (this.warnedThinkingClamped) {
@@ -2848,9 +2884,19 @@ var GeminiTransport = class _GeminiTransport {
2848
2884
  logger.warn(`GeminiTransport: thinkingPolicy 'off' ignored \u2014 ${this.model} runs its default thinking posture and takes no budget we can safely set. Reasoning tokens are still billed at the candidate rate; use a flash tier if you need them gone.`);
2849
2885
  return;
2850
2886
  }
2851
- if (isGradedLevel(policy) && !GEMINI_THINKING_LEVEL_TIERS.includes(this.model)) {
2852
- this.warnedThinkingClamped = true;
2853
- logger.warn(`GeminiTransport: thinkingPolicy '${policy}' ignored \u2014 ${this.model} takes a numeric thinking budget, not the graded 'thinkingLevel' the Gemini 3 tiers use, so this turn runs at its default reasoning posture. Use a Gemini 3 tier to set reasoning depth.`);
2887
+ if (isGradedLevel(policy)) {
2888
+ const accepted = GEMINI_THINKING_LEVELS[this.model];
2889
+ if (!accepted) {
2890
+ this.warnedThinkingClamped = true;
2891
+ logger.warn(`GeminiTransport: thinkingPolicy '${policy}' ignored \u2014 ${this.model} takes a numeric thinking budget, not the graded 'thinkingLevel' the Gemini 3 tiers use, so this turn runs at its default reasoning posture. Use a Gemini 3 tier to set reasoning depth.`);
2892
+ return;
2893
+ }
2894
+ const requested = GEMINI_THINKING_LEVEL[policy];
2895
+ const sent = clampThinkingLevel(accepted, requested);
2896
+ if (sent !== requested) {
2897
+ this.warnedThinkingClamped = true;
2898
+ logger.warn(`GeminiTransport: thinkingPolicy '${policy}' sent as thinkingLevel '${sent}' \u2014 ${this.model} does not accept '${requested}' (it takes ${accepted.join("/")}). Reasoning bills at the candidate rate, so an upward clamp costs more than you asked for.`);
2899
+ }
2854
2900
  }
2855
2901
  }
2856
2902
  constructor(config = {}) {