@bubblebrain-ai/bubble 0.0.60 → 0.0.61

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.
@@ -88,6 +88,9 @@ const ANTHROPIC_CHAT_LEVELS = ["off"];
88
88
  // Grok 4.5 exposes low/medium/high effort with no "off" (thinking always on);
89
89
  // the composer model declares no effort support at all.
90
90
  const GROK_45_LEVELS = ["low", "medium", "high"];
91
+ // Gemini 4 documents only low/medium (default)/high. Verified live on
92
+ // 2026-10-13: thinkingLevel=minimal returns 400, so there is no off/minimal.
93
+ const GEMINI_4_LEVELS = ["low", "medium", "high"];
91
94
  const GEMINI_3_LEVELS = ["low", "medium", "high"];
92
95
  const GEMINI_3_FLASH_LEVELS = ["minimal", "low", "medium", "high"];
93
96
  // Verified against the native API on 2026-09-02: Gemini 3.7/3.8 Flash reject
@@ -149,6 +152,9 @@ export const BUILTIN_MODELS = [
149
152
  // list via fetchGeminiModels (GET /v1beta/models, newest five). Gemini 3
150
153
  // thinking support varies by release: 3.7/3.8 Flash support off/low/medium/high
151
154
  // while older Flash releases expose minimal/low/medium/high.
155
+ // Gemini 4 Argon: 1,048,576-token window shared by input, thinking and output.
156
+ // https://ai.google.dev/gemini-api/docs/models/gemini-4-argon
157
+ { id: "gemini-4-argon", name: "Gemini 4 Argon", providerId: "google", tier: "strong", reasoningLevels: GEMINI_4_LEVELS, defaultReasoningLevel: "medium", contextWindow: 1048576 },
152
158
  { id: "gemini-3.8-flash", name: "Gemini 3.8 Flash", providerId: "google", tier: "fast", reasoningLevels: GEMINI_37_38_FLASH_LEVELS, contextWindow: 1048576 },
153
159
  { id: "gemini-3.7-flash", name: "Gemini 3.7 Flash", providerId: "google", tier: "fast", reasoningLevels: GEMINI_37_38_FLASH_LEVELS, contextWindow: 1048576 },
154
160
  { id: "gemini-3.5-flash", name: "Gemini 3.5 Flash", providerId: "google", tier: "fast", reasoningLevels: GEMINI_3_FLASH_LEVELS, contextWindow: 1048576 },
@@ -64,6 +64,23 @@ export const MODEL_PRICING_OVERRIDES = [
64
64
  outputPerMillion: 7.5,
65
65
  },
66
66
  })),
67
+ // Gemini 4 Argon introductory pricing through 2026-11-30; standard rates from
68
+ // 2026-12-01. Implicit caching only (95% off input), so no cache-write rate.
69
+ // https://ai.google.dev/gemini-api/docs/pricing
70
+ {
71
+ providerId: "google",
72
+ modelId: "gemini-4-argon",
73
+ currency: "USD",
74
+ inputCacheHitPerMillion: 0.1,
75
+ inputCacheMissPerMillion: 2,
76
+ outputPerMillion: 10,
77
+ effectiveUntil: "2026-12-01T00:00:00Z",
78
+ original: {
79
+ inputCacheHitPerMillion: 0.2,
80
+ inputCacheMissPerMillion: 4,
81
+ outputPerMillion: 20,
82
+ },
83
+ },
67
84
  {
68
85
  providerId: "deepseek",
69
86
  modelId: "deepseek-flash",
@@ -50,7 +50,8 @@ export declare function fetchGeminiModels(options: {
50
50
  }): Promise<GeminiModelDescriptor[]>;
51
51
  /**
52
52
  * Ranking: one entry per (version, tier) family — GA ids beat dated previews —
53
- * then newest version first, pro before flash before flash-lite, top N.
53
+ * then newest version first, flagship (pro/argon) before flash before
54
+ * flash-lite, top N.
54
55
  */
55
56
  export declare function selectLatestGeminiModels(entries: GeminiModelListEntry[], limit?: number): GeminiModelDescriptor[];
56
57
  /** Mirrors the static catalog's per-family thinking support. */
@@ -137,17 +137,23 @@ function buildCallOptions(messages, chatOptions, providerOptions) {
137
137
  };
138
138
  }
139
139
  /**
140
- * Gemini 3 models take a graded thinking_level; 2.5-era models take a token
140
+ * Gemini 3+ models take a graded thinking_level; 2.5-era models take a token
141
141
  * budget. "off" (budget 0) is only offered in the catalog for models that
142
142
  * accept it (2.5 Flash); xhigh/max/ultra clamp to high.
143
143
  */
144
144
  function buildGoogleThinkingOptions(modelId, level) {
145
145
  if (!level)
146
146
  return undefined;
147
+ const version = geminiVersion(modelId);
148
+ // Gemini 4 accepts only low/medium/high: MINIMAL is a 400 and thinkingBudget
149
+ // is undocumented. Side calls (titles, compaction) request "off" by default,
150
+ // so floor those at low rather than sending a value the API rejects.
151
+ if (version >= 4 && (level === "off" || level === "minimal"))
152
+ level = "low";
147
153
  if (level === "off")
148
154
  return { thinkingConfig: { thinkingBudget: 0 } };
149
155
  const clamped = level === "xhigh" || level === "max" || level === "ultra" ? "high" : level;
150
- if (modelId.includes("gemini-3")) {
156
+ if (version >= 3) {
151
157
  return { thinkingConfig: { thinkingLevel: clamped, includeThoughts: true } };
152
158
  }
153
159
  const budgets = { minimal: 512, low: 2048, medium: 8192, high: 24576 };
@@ -459,10 +465,13 @@ export async function fetchGeminiModels(options) {
459
465
  }
460
466
  /**
461
467
  * Ranking: one entry per (version, tier) family — GA ids beat dated previews —
462
- * then newest version first, pro before flash before flash-lite, top N.
468
+ * then newest version first, flagship (pro/argon) before flash before
469
+ * flash-lite, top N.
463
470
  */
464
471
  export function selectLatestGeminiModels(entries, limit = 5) {
465
- const TIER_RANK = { pro: 0, flash: 1, "flash-lite": 2 };
472
+ // Gemini 4 introduced named flagship tiers (gemini-4-argon). Unknown names
473
+ // stay excluded rather than guessing whether they are text models.
474
+ const TIER_RANK = { argon: 0, pro: 0, flash: 1, "flash-lite": 2 };
466
475
  const candidates = [];
467
476
  for (const entry of entries) {
468
477
  const id = (entry.name ?? "").replace(/^models\//, "");
@@ -472,21 +481,23 @@ export function selectLatestGeminiModels(entries, limit = 5) {
472
481
  continue;
473
482
  if (entry.supportedGenerationMethods && !entry.supportedGenerationMethods.includes("generateContent"))
474
483
  continue;
475
- const match = /^gemini-(\d+(?:\.\d+)?)-(pro|flash)(-lite)?/.exec(id);
484
+ const match = /^gemini-(\d+(?:\.\d+)?)-(argon|pro|flash)(-lite)?/.exec(id);
476
485
  if (!match)
477
486
  continue;
487
+ const tier = `${match[2]}${match[3] ?? ""}`;
478
488
  candidates.push({
479
489
  id,
480
490
  entry,
481
491
  version: Number.parseFloat(match[1]),
482
- tierRank: TIER_RANK[`${match[2]}${match[3] ?? ""}`] ?? 3,
492
+ tier,
493
+ tierRank: TIER_RANK[tier] ?? 3,
483
494
  isPreview: id.includes("preview") || id.includes("exp"),
484
495
  });
485
496
  }
486
497
  // One winner per family: GA over preview, then the shortest (least-suffixed) id.
487
498
  const families = new Map();
488
499
  for (const candidate of candidates) {
489
- const key = `${candidate.version}-${candidate.tierRank}`;
500
+ const key = `${candidate.version}-${candidate.tier}`;
490
501
  const current = families.get(key);
491
502
  if (!current
492
503
  || (current.isPreview && !candidate.isPreview)
@@ -502,13 +513,19 @@ export function selectLatestGeminiModels(entries, limit = 5) {
502
513
  name: candidate.entry.displayName || candidate.id,
503
514
  contextWindow: Number.isFinite(candidate.entry.inputTokenLimit) ? candidate.entry.inputTokenLimit : undefined,
504
515
  reasoningLevels: geminiReasoningLevels(candidate.id),
505
- ...(candidate.tierRank === 0 ? { defaultReasoningLevel: "high" } : {}),
516
+ // Argon defaults to Google's recommended medium via the catalog.
517
+ ...(candidate.tier === "pro" ? { defaultReasoningLevel: "high" } : {}),
506
518
  }));
507
519
  }
520
+ function geminiVersion(modelId) {
521
+ return Number.parseFloat(/^gemini-(\d+(?:\.\d+)?)/.exec(modelId)?.[1] ?? "0");
522
+ }
508
523
  /** Mirrors the static catalog's per-family thinking support. */
509
524
  export function geminiReasoningLevels(modelId) {
510
- const version = Number.parseFloat(/^gemini-(\d+(?:\.\d+)?)/.exec(modelId)?.[1] ?? "0");
525
+ const version = geminiVersion(modelId);
511
526
  const isPro = modelId.includes("-pro");
527
+ if (version >= 4)
528
+ return ["low", "medium", "high"];
512
529
  // Live probes show 3.7 and 3.8 Flash share this newer ladder. Keep the
513
530
  // exception bounded to verified releases instead of guessing for 3.9+.
514
531
  if (!isPro && (version === 3.7 || version === 3.8)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bubblebrain-ai/bubble",
3
- "version": "0.0.60",
3
+ "version": "0.0.61",
4
4
  "description": "A terminal coding agent",
5
5
  "type": "module",
6
6
  "engines": {