@genesislcap/ai-assistant 15.22.2 → 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.
@@ -1205,6 +1205,7 @@ var SUPPORTED_GEMINI_MODEL_IDS = [
1205
1205
  "gemini-2.5-pro",
1206
1206
  "gemini-2.5-flash",
1207
1207
  "gemini-2.5-flash-lite",
1208
+ "gemini-3.8-flash",
1208
1209
  "gemini-3.5-flash",
1209
1210
  "gemini-3.1-flash-lite",
1210
1211
  "gemini-3.1-pro-preview"
@@ -1307,6 +1308,22 @@ var GEMINI_PRICING = {
1307
1308
  rate: { promptPerMillion: 0.25, candidatePerMillion: 1.5 }
1308
1309
  },
1309
1310
  "gemini-3.5-flash": { kind: "flat", rate: { promptPerMillion: 1.5, candidatePerMillion: 9 } },
1311
+ // INTRODUCTORY RATE, and the only dated entry in this file. Google publishes
1312
+ // $0.75 / $3.75 per MTok **through 2026-12-31**, rising to $1.50 / $7.50 on 2027-01-01 —
1313
+ // so today this model is CHEAPER than gemini-3.5-flash above and in January it is not.
1314
+ //
1315
+ // The listed figure is the one in force, not the one coming. That is the lesson the
1316
+ // `claude-sonnet-5` entry records from the other direction: charging a scheduled future
1317
+ // rate early over-billed every request by 50% for as long as nobody noticed. A rate that
1318
+ // has not taken effect is not a price, and `GeminiPricing` deliberately has no time
1319
+ // dimension to express one — flip these two numbers on 2027-01-01 instead.
1320
+ //
1321
+ // That flip is ENFORCED, not remembered: `token-cost.test.ts` carries a dated assertion that
1322
+ // turns the build red on 2027-01-01 and names the three-line edit (these two rates, plus the
1323
+ // now-false `< gemini-3.5-flash` comparison in that same test — both models are $1.50 input
1324
+ // from that date). There is no ticket to lose.
1325
+ // https://ai.google.dev/gemini-api/docs/pricing
1326
+ "gemini-3.8-flash": { kind: "flat", rate: { promptPerMillion: 0.75, candidatePerMillion: 3.75 } },
1310
1327
  "gemini-3.1-pro-preview": {
1311
1328
  kind: "tiered",
1312
1329
  standard: { promptPerMillion: 2, candidatePerMillion: 12 },
@@ -2793,6 +2810,7 @@ var GEMINI_CONTEXT_LIMITS = {
2793
2810
  "gemini-2.5-pro": 1048576,
2794
2811
  "gemini-2.5-flash": 1048576,
2795
2812
  "gemini-2.5-flash-lite": 1048576,
2813
+ "gemini-3.8-flash": 1048576,
2796
2814
  "gemini-3.5-flash": 1048576,
2797
2815
  "gemini-3.1-flash-lite": 1048576,
2798
2816
  "gemini-3.1-pro-preview": 1048576
@@ -2817,6 +2835,10 @@ var GEMINI_MODEL_WARNINGS = {
2817
2835
  "gemini-2.5-flash": "GeminiTransport: using gemini-2.5-flash \u2014 higher cost than flash-lite; use for harder reasoning or agent tasks.",
2818
2836
  "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.",
2819
2837
  "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.",
2838
+ // Warns despite currently costing LESS than gemini-3.5-flash, because that is temporary: the
2839
+ // rate doubles on 2027-01-01 (see GEMINI_PRICING). A caller that picks this tier on today's
2840
+ // price and never revisits the choice gets twice the bill in January without changing a line.
2841
+ "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.",
2820
2842
  "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."
2821
2843
  };
2822
2844
  var GEMINI_THINKING_DISABLEABLE = [
@@ -2824,15 +2846,32 @@ var GEMINI_THINKING_DISABLEABLE = [
2824
2846
  "gemini-2.5-flash-lite"
2825
2847
  ];
2826
2848
  var GEMINI_MEDIA_RESOLUTION_TIERS = [
2849
+ "gemini-3.8-flash",
2827
2850
  "gemini-3.5-flash",
2828
2851
  "gemini-3.1-flash-lite",
2829
2852
  "gemini-3.1-pro-preview"
2830
2853
  ];
2831
- var GEMINI_THINKING_LEVEL_TIERS = [
2832
- "gemini-3.5-flash",
2833
- "gemini-3.1-flash-lite",
2834
- "gemini-3.1-pro-preview"
2835
- ];
2854
+ var GEMINI_LEVEL_LADDER = ["minimal", "low", "medium", "high"];
2855
+ var GEMINI_THINKING_LEVELS = {
2856
+ "gemini-3.8-flash": ["low", "medium", "high"],
2857
+ "gemini-3.5-flash": ["minimal", "low", "medium", "high"],
2858
+ "gemini-3.1-flash-lite": ["minimal", "low", "medium", "high"],
2859
+ "gemini-3.1-pro-preview": ["low", "medium", "high"]
2860
+ };
2861
+ function clampThinkingLevel(supported, level) {
2862
+ if (!(supported === null || supported === void 0 ? void 0 : supported.length) || supported.includes(level)) {
2863
+ return level;
2864
+ }
2865
+ const target = GEMINI_LEVEL_LADDER.indexOf(level);
2866
+ const distance = (candidate) => Math.abs(GEMINI_LEVEL_LADDER.indexOf(candidate) - target);
2867
+ let best = supported[0];
2868
+ for (const candidate of supported) {
2869
+ if (distance(candidate) <= distance(best)) {
2870
+ best = candidate;
2871
+ }
2872
+ }
2873
+ return best;
2874
+ }
2836
2875
  var GEMINI_THINKING_LEVEL = {
2837
2876
  minimal: "minimal",
2838
2877
  low: "low",
@@ -2840,25 +2879,16 @@ var GEMINI_THINKING_LEVEL = {
2840
2879
  high: "high",
2841
2880
  max: "high"
2842
2881
  };
2843
- var GEMINI_COARSE_LEVEL_TIERS = [
2844
- "gemini-3.5-flash",
2845
- "gemini-3.1-flash-lite",
2846
- "gemini-3.1-pro-preview"
2847
- ];
2848
- var GEMINI_COARSE_LEVEL = {
2849
- minimal: "low",
2850
- low: "low",
2851
- medium: "high",
2852
- high: "high"
2853
- };
2854
2882
  var isGradedLevel = (p) => p !== void 0 && p !== "auto" && p !== "off";
2855
2883
  function geminiThinkingConfig(model, policy) {
2856
- if (isGradedLevel(policy) && GEMINI_THINKING_LEVEL_TIERS.includes(model)) {
2857
- const level = GEMINI_THINKING_LEVEL[policy];
2858
- return {
2859
- includeThoughts: true,
2860
- thinkingLevel: GEMINI_COARSE_LEVEL_TIERS.includes(model) ? GEMINI_COARSE_LEVEL[level] : level
2861
- };
2884
+ if (isGradedLevel(policy)) {
2885
+ const accepted = GEMINI_THINKING_LEVELS[model];
2886
+ if (accepted) {
2887
+ return {
2888
+ includeThoughts: true,
2889
+ thinkingLevel: clampThinkingLevel(accepted, GEMINI_THINKING_LEVEL[policy])
2890
+ };
2891
+ }
2862
2892
  }
2863
2893
  if (policy === "off" && GEMINI_THINKING_DISABLEABLE.includes(model)) {
2864
2894
  return { includeThoughts: false, thinkingBudget: 0 };
@@ -2899,7 +2929,7 @@ var GeminiTransport = class _GeminiTransport {
2899
2929
  /**
2900
2930
  * Warn once when a requested policy cannot be honoured on this model — a *cost* decision the
2901
2931
  * caller made that the wire silently reversed, so they hear about it, but only once, not per
2902
- * turn. Two shapes reach here (the Anthropic twin warns on the same two):
2932
+ * turn. Three shapes reach here (the Anthropic twin warns on the first two):
2903
2933
  *
2904
2934
  * - `'off'` on a tier that can't disable thinking — only the flash tiers accept a zero thinking
2905
2935
  * budget; everything else keeps paying for reasoning it was told to stop. (`'auto'` is NOT this
@@ -2909,6 +2939,12 @@ var GeminiTransport = class _GeminiTransport {
2909
2939
  * not the Gemini 3 `thinkingLevel` enum, so the level is dropped and the turn runs at the
2910
2940
  * default posture. Without this, a caller asking for `high` on `gemini-2.5-pro` and quietly
2911
2941
  * getting the default is left to wonder why.
2942
+ * - A graded depth whose DIALECT a Gemini 3 tier speaks but whose particular value it does not
2943
+ * accept — `minimal` on `gemini-3.8-flash` or `gemini-3.1-pro-preview`, the two tiers that
2944
+ * reject it outright. Nothing is dropped here; `clampThinkingLevel` MOVES the level onto the
2945
+ * nearest one the tier takes, and since ties resolve upward the move is usually to something
2946
+ * DEARER than the caller chose. A cost decision reversed on the wire in the expensive
2947
+ * direction is exactly what this warning exists for — without it the only trace is the bill.
2912
2948
  */
2913
2949
  warnIfThinkingUnclampable(policy) {
2914
2950
  if (this.warnedThinkingClamped) {
@@ -2919,9 +2955,19 @@ var GeminiTransport = class _GeminiTransport {
2919
2955
  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.`);
2920
2956
  return;
2921
2957
  }
2922
- if (isGradedLevel(policy) && !GEMINI_THINKING_LEVEL_TIERS.includes(this.model)) {
2923
- this.warnedThinkingClamped = true;
2924
- 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.`);
2958
+ if (isGradedLevel(policy)) {
2959
+ const accepted = GEMINI_THINKING_LEVELS[this.model];
2960
+ if (!accepted) {
2961
+ this.warnedThinkingClamped = true;
2962
+ 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.`);
2963
+ return;
2964
+ }
2965
+ const requested = GEMINI_THINKING_LEVEL[policy];
2966
+ const sent = clampThinkingLevel(accepted, requested);
2967
+ if (sent !== requested) {
2968
+ this.warnedThinkingClamped = true;
2969
+ 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.`);
2970
+ }
2925
2971
  }
2926
2972
  }
2927
2973
  constructor(config = {}) {