@qmediat.io/gemini-code-context-mcp 1.22.0 → 1.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.
Files changed (51) hide show
  1. package/CHANGELOG.md +93 -1
  2. package/dist/cache/caching-mode.d.ts +2 -2
  3. package/dist/cache/caching-mode.d.ts.map +1 -1
  4. package/dist/cache/caching-mode.js +2 -2
  5. package/dist/cache/caching-mode.js.map +1 -1
  6. package/dist/gemini/model-registry.d.ts.map +1 -1
  7. package/dist/gemini/model-registry.js +14 -4
  8. package/dist/gemini/model-registry.js.map +1 -1
  9. package/dist/gemini/model-taxonomy.d.ts +8 -0
  10. package/dist/gemini/model-taxonomy.d.ts.map +1 -1
  11. package/dist/gemini/model-taxonomy.js +29 -7
  12. package/dist/gemini/model-taxonomy.js.map +1 -1
  13. package/dist/tools/ask-agentic.tool.d.ts +11 -61
  14. package/dist/tools/ask-agentic.tool.d.ts.map +1 -1
  15. package/dist/tools/ask-agentic.tool.js +18 -15
  16. package/dist/tools/ask-agentic.tool.js.map +1 -1
  17. package/dist/tools/ask.tool.d.ts +29 -82
  18. package/dist/tools/ask.tool.d.ts.map +1 -1
  19. package/dist/tools/ask.tool.js +7 -5
  20. package/dist/tools/ask.tool.js.map +1 -1
  21. package/dist/tools/clear.tool.d.ts +1 -5
  22. package/dist/tools/clear.tool.d.ts.map +1 -1
  23. package/dist/tools/code.tool.d.ts +24 -76
  24. package/dist/tools/code.tool.d.ts.map +1 -1
  25. package/dist/tools/code.tool.js +11 -5
  26. package/dist/tools/code.tool.js.map +1 -1
  27. package/dist/tools/registry.d.ts +11 -11
  28. package/dist/tools/registry.d.ts.map +1 -1
  29. package/dist/tools/registry.js +32 -12
  30. package/dist/tools/registry.js.map +1 -1
  31. package/dist/tools/reindex.tool.d.ts +1 -7
  32. package/dist/tools/reindex.tool.d.ts.map +1 -1
  33. package/dist/tools/shared/abort-timeout.d.ts +6 -0
  34. package/dist/tools/shared/abort-timeout.d.ts.map +1 -1
  35. package/dist/tools/shared/abort-timeout.js +12 -5
  36. package/dist/tools/shared/abort-timeout.js.map +1 -1
  37. package/dist/tools/shared/thinking.d.ts +25 -3
  38. package/dist/tools/shared/thinking.d.ts.map +1 -1
  39. package/dist/tools/shared/thinking.js +25 -3
  40. package/dist/tools/shared/thinking.js.map +1 -1
  41. package/dist/tools/status.tool.d.ts +1 -5
  42. package/dist/tools/status.tool.d.ts.map +1 -1
  43. package/dist/utils/cost-estimator.d.ts +58 -4
  44. package/dist/utils/cost-estimator.d.ts.map +1 -1
  45. package/dist/utils/cost-estimator.js +206 -78
  46. package/dist/utils/cost-estimator.js.map +1 -1
  47. package/dist/utils/pricing-overrides.d.ts +10 -0
  48. package/dist/utils/pricing-overrides.d.ts.map +1 -0
  49. package/dist/utils/pricing-overrides.js +104 -0
  50. package/dist/utils/pricing-overrides.js.map +1 -0
  51. package/package.json +2 -3
package/CHANGELOG.md CHANGED
@@ -7,6 +7,96 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.23.0] - 2026-11-14
11
+
12
+ ### Changed
13
+
14
+ - **What the aliases resolve to, when your key lists the new models.** `latest-pro` and `latest-pro-thinking` (the
15
+ server's default) → `gemini-4-carbon` (was `gemini-4-argon`); `latest-flash` → `gemini-4-hydrogen` (was
16
+ `gemini-3.8-flash`). What that changes for a call that names no model:
17
+ - Carbon and Hydrogen think without being asked (Argon and a default `ask` did not): more output tokens are billed
18
+ and a call takes longer. Bound it with `thinkingLevel`.
19
+ - Hydrogen costs 1.5 / 7.5 USD per 1M against 3.8 Flash's 0.75 / 3.75 through 2026-12-31 (the same from
20
+ 2027-01-01), and offers implicit caching only — `cachingMode: 'explicit'` runs implicit on it, as on Argon and
21
+ Carbon, and says so.
22
+ - Pass a model id (`gemini-4-argon`, `gemini-3.8-flash`) to keep the previous one.
23
+ - Among Gemini 4 models of one version an alias takes the codename Google shipped last (a declared order:
24
+ argon, carbon, hydrogen) — a point release (`gemini-4.1-argon`) outranks any codename of the older version.
25
+ - A call that stops at the output cap with no answer is an error that names the cause (the model's thinking used
26
+ `maxOutputTokens`) and the remedy, on `ask` and `code` — it used to come back as an empty success. The call is
27
+ billed either way.
28
+ - The fast tier's price bound is Hydrogen's: `gemini-flash-latest` and a fast-tier id the table does not price are
29
+ estimated at 1.5 / 7.5 USD per 1M (was 3.8 Flash's 0.75 / 3.75) — the dearest row of the category, as before,
30
+ although Google serves `gemini-3.8-flash` under that alias today.
31
+
32
+ ### Added
33
+
34
+ - Gemini 4 Carbon and Gemini 4 Hydrogen (GA 2026-11-10 and 2026-11-12): `gemini-4-carbon` is a premium reasoning
35
+ model like Argon, `gemini-4-hydrogen` the fast tier. Until now both were `unknown`: no alias picked them and an
36
+ explicit id failed the category check of `ask` / `code`. A codename id with another product's suffix
37
+ (`gemini-4-carbon-computer-use-preview`) stays `unknown`.
38
+ - `thinkingLevel: "XHIGH"` — the level Google added with Gemini 4 Hydrogen, the one model that takes it (`ask`,
39
+ `ask_agentic`; Argon, Carbon and the 3.x models answer it with a 400, so `code`, which runs reasoning-tier
40
+ models only, refuses it up front with the reason and the way out). One description of the field serves the three tools.
41
+ - Rates: `gemini-4-carbon` 2 / 10 / 0.1 USD per 1M input / output / cached tokens through 2026-11-30 and 4 / 20 / 0.2
42
+ from 2026-12-01 (Argon's row); `gemini-4-hydrogen` 1.5 / 7.5 / 0.075, flat (pricing page read 2026-11-14).
43
+ - `gemini-nano-banana-2.1` classifies as image generation (the family's ids carry the `gemini-` prefix since 2.1).
44
+
45
+ ### Security
46
+
47
+ - `zod` 4.6.7 (was 3.25): GHSA-mrhx-c7xc-m3w5, memory exhaustion while validating oversized constrained collections.
48
+ The tool schemas are written to `tools/list` by Zod's own `z.toJSONSchema` — the `zod-to-json-schema` dependency is
49
+ gone as a direct dependency (the MCP SDK still installs it) — and the published `inputSchema` of every tool is
50
+ unchanged, held by a test against the 1.22.1 output. Two things a caller can see do change with Zod 4: the wording
51
+ of an `Invalid arguments` error (`prompt: Invalid input: expected string, received undefined`, was `prompt:
52
+ Required`; an enum now reads `Invalid option: expected one of …`), and an integer above 2^53 − 1 is refused.
53
+ Dependabot proposes Zod majors again.
54
+ - Transitive dependencies brought past their advisories (`body-parser`, `hono`, `@hono/node-server`, `fast-uri`,
55
+ `ip-address`, `qs`): `npm audit --omit=dev --audit-level=high` is clean again.
56
+
57
+ ## [1.22.1] - 2026-10-16
58
+
59
+ ### Fixed
60
+
61
+ - The cost estimate and the recorded spend use the rates of Google's pricing page (read 2026-10-16, Standard tier) with
62
+ the dates they take effect, instead of a "conservative" later rate booked today: a row may carry `next` rates from a
63
+ UTC date on. A settled call is priced at the rate in force when it settles; a daily-budget reservation at the dearer
64
+ of the rates in force when it is made and when the call's timeout ends (each `ask_agentic` iteration on its own, with
65
+ its iteration timeout; a call without a timeout at each component's dearest rate in force from now on, overrides
66
+ included), so a call that crosses a price change
67
+ never settles above its reservation.
68
+ `gemini-4-argon` bills 2 / 10 / 0.1 USD per 1M input / output / cached tokens through 2026-11-30 and 4 / 20 / 0.2 from
69
+ 2026-12-01 — this corrects 1.22.0's row, which booked the December rate from the start.
70
+ - Rows brought up to the page: `gemini-3.1-pro-preview` and `gemini-3-pro-preview` 4 / 18 / 0.4 (the > 200k-token tier;
71
+ the estimator does not see the prompt's size, so the dearer tier is the row), `gemini-2.5-pro` 2.5 / 15 / 0.25
72
+ (its > 200k tier), `gemini-3-flash-preview` 0.5 / 3 / 0.05, `gemini-3.1-flash-image-preview` 0.5 / 3, `gemini-2.5-flash`
73
+ cached 0.03, `gemini-2.5-flash-lite` cached 0.01.
74
+ - New rows: `gemini-3.8-flash`, `gemini-3.7-flash`, `gemini-3.6-flash` at 0.75 / 3.75 / 0.075 through 2026-12-31 and
75
+ 1.5 / 7.5 / 0.15 from 2027-01-01; `gemini-3.5-flash-lite` at 0.3 / 2.5 / 0.03; `gemini-3.1-flash-lite` at 0.25 / 1.5 /
76
+ 0.025, and `gemini-3.1-flash-lite-preview` at the same rates (the page prices the model once; it was 0.1 / 0.4).
77
+ `gemini-3.5-flash` has no row — the page does not list it — and prices at the `text-fast` bound.
78
+ - The rolling aliases are no longer priced as the 2.5 line, as 1.22.0's entry had it: on 2026-10-16 the response's
79
+ `modelVersion` showed `gemini-pro-latest` serving `gemini-3.1-pro-preview`, `gemini-flash-latest` `gemini-3.8-flash`
80
+ and `gemini-flash-lite-latest` `gemini-3.5-flash-lite`. See Changed for how an alias is priced now.
81
+
82
+ ### Changed
83
+
84
+ - A rolling alias prices at the dearest rate of its measured target's category (Google may move an alias to a dearer
85
+ model between two measurements), never as a row of its own; an override keyed by the alias id wins, then an override
86
+ of its target.
87
+ - `GEMINI_PRICING_OVERRIDES` entries are validated when first read: an entry with a rate that is not a finite number
88
+ ≥ 0, or a `next` without a `YYYY-MM-DD` `from` or without all three rates, is dropped with a warning naming the model
89
+ and the reason — a `from` that is not a real calendar day (`2026-13-01`) included, and a key `__proto__`
90
+ (until now it was taken as it came and could price every call at the later rate or book `NaN`); an
91
+ unparseable value is said, not ignored silently. A model id named like an Object prototype member (`constructor`) is
92
+ priced by the fallback instead of `NaN`.
93
+ - The bound for an unpriced text model or an alias is computed over the table with the overrides on top, so an override
94
+ that adds a dearer model of the category lifts it.
95
+ - The bound for an unpriced text model is the dearest rate its category has in force on the day, so the new rows raise
96
+ it: an unpriced `text-fast` model is priced at 0.75 / 3.75 (1.5 / 7.5 from 2027-01-01; was 0.3 / 2.5), an unpriced
97
+ `text-lite` one at 0.3 / 2.5 (was 0.1 / 0.4), an unpriced `text-reasoning` one at 4 / 18 / 0.4 (4 / 20 / 0.4 from
98
+ 2026-12-01; was 4 / 20 / 0.875).
99
+
10
100
  ## [1.22.0] - 2026-10-16
11
101
 
12
102
  ### Added
@@ -1687,7 +1777,9 @@ Integration-test-surfaced and review-surfaced fixes landed before the v1.0.0 rel
1687
1777
  - MIME type simplified to `text/plain` for all files.
1688
1778
  - Unit test coverage gaps for cache-manager / files-uploader / ttl-watcher / profile-loader / parseEdits tracked in [`docs/FOLLOW-UP-PRS.md`](docs/FOLLOW-UP-PRS.md).
1689
1779
 
1690
- [Unreleased]: https://github.com/qmediat/gemini-code-context-mcp/compare/v1.22.0...HEAD
1780
+ [Unreleased]: https://github.com/qmediat/gemini-code-context-mcp/compare/v1.23.0...HEAD
1781
+ [1.23.0]: https://github.com/qmediat/gemini-code-context-mcp/compare/v1.22.1...v1.23.0
1782
+ [1.22.1]: https://github.com/qmediat/gemini-code-context-mcp/compare/v1.22.0...v1.22.1
1691
1783
  [1.22.0]: https://github.com/qmediat/gemini-code-context-mcp/compare/v1.21.0...v1.22.0
1692
1784
  [1.21.0]: https://github.com/qmediat/gemini-code-context-mcp/compare/v1.20.0...v1.21.0
1693
1785
  [1.0.0]: https://github.com/qmediat/gemini-code-context-mcp/releases/tag/v1.0.0
@@ -5,7 +5,7 @@
5
5
  import type { ResolvedModel } from '../types.js';
6
6
  import type { ProgressEmitter } from '../utils/progress.js';
7
7
  /** What `'explicit'` turns into when it cannot be honoured — appended to `ask` / `code`'s `cachingMode` description. */
8
- export declare const CACHING_MODE_FALLBACK_DESCRIPTION = " A model without `createCachedContent` (`gemini-4-argon`) runs `'explicit'` as `'implicit'`, and a failed `caches.create` sends the files without a cache; either way the response says what ran in `cachingMode` and why in `cachingModeNote`.";
8
+ export declare const CACHING_MODE_FALLBACK_DESCRIPTION = " A model without `createCachedContent` (the Gemini 4 models: `gemini-4-argon`, `gemini-4-carbon`, `gemini-4-hydrogen`) runs `'explicit'` as `'implicit'`, and a failed `caches.create` sends the files without a cache; either way the response says what ran in `cachingMode` and why in `cachingModeNote`.";
9
9
  /** The caching mode a call runs with, and why it differs from the one requested. */
10
10
  export interface CachingModeChoice {
11
11
  readonly mode: 'explicit' | 'implicit';
@@ -14,7 +14,7 @@ export interface CachingModeChoice {
14
14
  }
15
15
  /**
16
16
  * The caching mode a call actually runs with. A model that does not accept
17
- * `caches.create` (no `createCachedContent` in its actions — `gemini-4-argon`)
17
+ * `caches.create` (no `createCachedContent` in its actions — the Gemini 4 models)
18
18
  * runs an `explicit` request as `implicit`: the files go inline and Gemini's
19
19
  * implicit cache applies, with no upload and no create attempt that can only fail.
20
20
  */
@@ -1 +1 @@
1
- {"version":3,"file":"caching-mode.d.ts","sourceRoot":"","sources":["../../src/cache/caching-mode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,wHAAwH;AACxH,eAAO,MAAM,iCAAiC,oPACqM,CAAC;AAEpP,oFAAoF;AACpF,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU,CAAC;IACvC,yFAAyF;IACzF,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,SAAS,EAAE,UAAU,GAAG,UAAU,EAClC,KAAK,EAAE,aAAa,EACpB,OAAO,EAAE,eAAe,GACvB,iBAAiB,CAMnB;AAED,iFAAiF;AACjF,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,UAAU,GAAG,QAAQ,CAAC;AAEhE,qEAAqE;AACrE,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAKD;;;;;;GAMG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAA;CAAE,EACvE,MAAM,EAAE,iBAAiB,GACxB,UAAU,CAMZ"}
1
+ {"version":3,"file":"caching-mode.d.ts","sourceRoot":"","sources":["../../src/cache/caching-mode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,wHAAwH;AACxH,eAAO,MAAM,iCAAiC,iTACkQ,CAAC;AAEjT,oFAAoF;AACpF,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU,CAAC;IACvC,yFAAyF;IACzF,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,SAAS,EAAE,UAAU,GAAG,UAAU,EAClC,KAAK,EAAE,aAAa,EACpB,OAAO,EAAE,eAAe,GACvB,iBAAiB,CAMnB;AAED,iFAAiF;AACjF,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,UAAU,GAAG,QAAQ,CAAC;AAEhE,qEAAqE;AACrE,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAKD;;;;;;GAMG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAA;CAAE,EACvE,MAAM,EAAE,iBAAiB,GACxB,UAAU,CAMZ"}
@@ -4,10 +4,10 @@
4
4
  */
5
5
  import { logger } from '../utils/logger.js';
6
6
  /** What `'explicit'` turns into when it cannot be honoured — appended to `ask` / `code`'s `cachingMode` description. */
7
- export const CACHING_MODE_FALLBACK_DESCRIPTION = " A model without `createCachedContent` (`gemini-4-argon`) runs `'explicit'` as `'implicit'`, and a failed `caches.create` sends the files without a cache; either way the response says what ran in `cachingMode` and why in `cachingModeNote`.";
7
+ export const CACHING_MODE_FALLBACK_DESCRIPTION = " A model without `createCachedContent` (the Gemini 4 models: `gemini-4-argon`, `gemini-4-carbon`, `gemini-4-hydrogen`) runs `'explicit'` as `'implicit'`, and a failed `caches.create` sends the files without a cache; either way the response says what ran in `cachingMode` and why in `cachingModeNote`.";
8
8
  /**
9
9
  * The caching mode a call actually runs with. A model that does not accept
10
- * `caches.create` (no `createCachedContent` in its actions — `gemini-4-argon`)
10
+ * `caches.create` (no `createCachedContent` in its actions — the Gemini 4 models)
11
11
  * runs an `explicit` request as `implicit`: the files go inline and Gemini's
12
12
  * implicit cache applies, with no upload and no create attempt that can only fail.
13
13
  */
@@ -1 +1 @@
1
- {"version":3,"file":"caching-mode.js","sourceRoot":"","sources":["../../src/cache/caching-mode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAG5C,wHAAwH;AACxH,MAAM,CAAC,MAAM,iCAAiC,GAC5C,iPAAiP,CAAC;AASpP;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAC5B,SAAkC,EAClC,KAAoB,EACpB,OAAwB;IAExB,IAAI,SAAS,KAAK,UAAU,IAAI,KAAK,CAAC,eAAe;QAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAC9F,MAAM,IAAI,GAAG,+CAA+C,KAAK,CAAC,QAAQ,8FAA8F,CAAC;IACzK,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACnB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAClB,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;AACpC,CAAC;AAWD,MAAM,kBAAkB,GACtB,0JAA0J,CAAC;AAE7J;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CACxB,IAAuE,EACvE,MAAyB;IAEzB,IAAI,IAAI,CAAC,OAAO,KAAK,IAAI;Q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IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;IAC1E,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;QACpB,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;IACzF,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,kBAAkB,EAAE,CAAC;AACxD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"model-registry.d.ts","sourceRoot":"","sources":["../../src/gemini/model-registry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAS,MAAM,eAAe,CAAC;AA+ExD,MAAM,WAAW,SAAS;IACxB,yDAAyD;IACzD,EAAE,EAAE,MAAM,CAAC;IACX,2EAA2E;IAC3E,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,gBAAgB,EAAE,OAAO,CAAC;IAC1B,oFAAoF;IACpF,mBAAmB,EAAE,OAAO,CAAC;IAC7B;;;OAGG;IACH,eAAe,EAAE,OAAO,CAAC;CAC1B;AA8BD,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,WAAW,EACnB,EAAE,KAAK,EAAE,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAO,GAClC,OAAO,CAAC,SAAS,EAAE,CAAC,CAoBtB;AAED,iEAAiE;AACjE,wBAAgB,oBAAoB,IAAI,IAAI,CAG3C"}
1
+ {"version":3,"file":"model-registry.d.ts","sourceRoot":"","sources":["../../src/gemini/model-registry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAS,MAAM,eAAe,CAAC;AA4FxD,MAAM,WAAW,SAAS;IACxB,yDAAyD;IACzD,EAAE,EAAE,MAAM,CAAC;IACX,2EAA2E;IAC3E,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,gBAAgB,EAAE,OAAO,CAAC;IAC1B,oFAAoF;IACpF,mBAAmB,EAAE,OAAO,CAAC;IAC7B;;;OAGG;IACH,eAAe,EAAE,OAAO,CAAC;CAC1B;AA8BD,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,WAAW,EACnB,EAAE,KAAK,EAAE,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAO,GAClC,OAAO,CAAC,SAAS,EAAE,CAAC,CAoBtB;AAED,iEAAiE;AACjE,wBAAgB,oBAAoB,IAAI,IAAI,CAG3C"}
@@ -5,12 +5,13 @@
5
5
  * tool call can force a refresh if the user upgrades their API tier mid-session.
6
6
  */
7
7
  import { logger } from '../utils/logger.js';
8
- import { categorizeModel, costTierOf, } from './model-taxonomy.js';
8
+ import { categorizeModel, codenameRank, costTierOf, } from './model-taxonomy.js';
9
9
  /**
10
10
  * Google's unversioned `-latest` ids (`gemini-pro-latest`, `gemini-flash-latest`,
11
- * `gemini-flash-lite-latest`) are rolling aliases whose target is older than the
12
- * newest versioned id (`gemini-pro-latest` points at `gemini-2.5-pro`); the
13
- * `latest-*` aliases here must pick a versioned model, so these rank after it.
11
+ * `gemini-flash-lite-latest`) are rolling aliases whose target is never newer than
12
+ * the newest versioned id (the measured targets: `ALIAS_TARGET` in
13
+ * `utils/cost-estimator.ts`); the `latest-*` aliases here must pick a versioned
14
+ * model, so these rank after it.
14
15
  * An id that carries a version digit is a versioned model whatever its suffix.
15
16
  */
16
17
  function isRollingAlias(id) {
@@ -42,6 +43,8 @@ function rankKey(id) {
42
43
  tier: TIER_RANK[costTierOf(id)],
43
44
  rolling: Number(isRollingAlias(id)),
44
45
  base,
46
+ version: /^gemini-(\d+(?:\.\d+)?)-/i.exec(base)?.[1] ?? '',
47
+ codename: codenameRank(base),
45
48
  preview: Number(base !== id),
46
49
  };
47
50
  }
@@ -61,6 +64,13 @@ function compareListing(ka, kb) {
61
64
  return ka.tier - kb.tier;
62
65
  if (ka.rolling !== kb.rolling)
63
66
  return ka.rolling - kb.rolling;
67
+ if (ka.codename !== 0 && kb.codename !== 0) {
68
+ const byVersion = kb.version.localeCompare(ka.version, undefined, { numeric: true });
69
+ if (byVersion !== 0)
70
+ return byVersion;
71
+ if (ka.codename !== kb.codename)
72
+ return kb.codename - ka.codename;
73
+ }
64
74
  const byBase = kb.base.localeCompare(ka.base, undefined, { numeric: true });
65
75
  if (byBase !== 0)
66
76
  return byBase;
@@ -1 +1 @@
1
- {"version":3,"file":"model-registry.js","sourceRoot":"","sources":["../../src/gemini/model-registry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAGL,eAAe,EACf,UAAU,GACX,MAAM,qBAAqB,CAAC;AAE7B;;;;;;GAMG;AACH,SAAS,cAAc,CAAC,EAAU;IAChC,OAAO,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAChD,CAAC;AAED,8EAA8E;AAC9E,MAAM,aAAa,GAA4C;IAC7D,gBAAgB,EAAE,CAAC;IACnB,WAAW,EAAE,CAAC;IACd,WAAW,EAAE,CAAC;IACd,KAAK,EAAE,CAAC;IACR,kBAAkB,EAAE,CAAC;IACrB,kBAAkB,EAAE,CAAC;IACrB,kBAAkB,EAAE,CAAC;IACrB,SAAS,EAAE,CAAC;IACZ,OAAO,EAAE,CAAC;CACX,CAAC;AAEF,iFAAiF;AACjF,MAAM,SAAS,GAA0D;IACvE,OAAO,EAAE,C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AE/D,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;IACzC,MAAM,GAAG,GAAgB,EAAE,CAAC;IAC5B,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,KAAK,EAAE,CAAC;QAChC,MAAM,IAAI,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC;QAChC,IAAI,IAAI;YAAE,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;IAED,oGAAoG;IACpG,MAAM,MAAM,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IACpE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACpD,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAEzC,MAAM,GAAG,MAAM,CAAC;IAChB,QAAQ,GAAG,GAAG,CAAC;IACf,MAAM,CAAC,KAAK,CAAC,0BAA0B,MAAM,CAAC,MAAM,SAAS,CAAC,CAAC;IAC/D,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,iEAAiE;AACjE,MAAM,UAAU,oBAAoB;IAClC,MAAM,GAAG,IAAI,CAAC;IACd,QAAQ,GAAG,CAAC,CAAC;AACf,CAAC"}
@@ -42,6 +42,14 @@ export interface CapabilityFlags {
42
42
  /** `premium` (pro-tier), `standard` (flash), `budget` (lite). */
43
43
  readonly costTier: 'premium' | 'standard' | 'budget' | 'unknown';
44
44
  }
45
+ /**
46
+ * The Gemini 4 codenames in the order Google shipped them within a tier (argon 2026-10-13, carbon 2026-11-10;
47
+ * hydrogen 2026-11-12). Among ids of the same version the LATER codename ranks first in the listing — an alias
48
+ * (`latest-pro`) resolves to it — by this declared order, never by the alphabet. A new codename is added here.
49
+ */
50
+ export declare const GEMINI_4_CODENAMES: readonly string[];
51
+ /** The listing rank a codename gives an id (0 for an id without one): a later codename ranks higher. */
52
+ export declare function codenameRank(modelId: string): number;
45
53
  /**
46
54
  * Classify a model by ID. Returns `unknown` for any ID that doesn't match
47
55
  * an explicit rule — the resolver then refuses to bind this model to any
@@ -1 +1 @@
1
- {"version":3,"file":"model-taxonomy.d.ts","sourceRoot":"","sources":["../../src/gemini/model-taxonomy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH;;;;GAIG;AACH,MAAM,MAAM,aAAa,GACrB,gBAAgB,GAChB,WAAW,GACX,WAAW,GACX,kBAAkB,GAClB,kBAAkB,GAClB,kBAAkB,GAClB,WAAW,GACX,OAAO,GACP,SAAS,CAAC;AAEd;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;IACnC,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC,QAAQ,CAAC,qBAAqB,EAAE,OAAO,CAAC;IACxC,iEAAiE;IACjE,QAAQ,CAAC,QAAQ,EAAE,SAAS,GAAG,UAAU,GAAG,QAAQ,GAAG,SAAS,CAAC;CAClE;AAoGD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,CAM9D;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,CAAC,UAAU,CAAC,CAKvE;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,MAAM,EACf,WAAW,EAAE;IAAE,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAA;CAAE,GAClD,eAAe,CAuBjB;AAED;;;;;;;;GAQG;A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,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,CAAC,UAAU,CAAC,CAKvE;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,MAAM,EACf,WAAW,EAAE;IAAE,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAA;CAAE,GAClD,eAAe,CAuBjB;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,aAAa,GAAG,OAAO,CAElE;AAED;;;;;;GAMG;AACH,qBAAa,0BAA2B,SAAQ,KAAK;IACnD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,cAAc,EAAE,aAAa,CAAC;IACvC,QAAQ,CAAC,gBAAgB,EAAE,SAAS,aAAa,EAAE,CAAC;IAEpD,YAAY,OAAO,EAAE;QACnB,OAAO,EAAE,MAAM,CAAC;QAChB,cAAc,EAAE,aAAa,CAAC;QAC9B,gBAAgB,EAAE,SAAS,aAAa,EAAE,CAAC;KAC5C,EAUA;CACF"}
@@ -24,12 +24,29 @@
24
24
  * categorisation to catch any bugs that would let a mis-categorised model
25
25
  * through. Shouldn't fire in practice.
26
26
  */
27
+ /**
28
+ * The Gemini 4 codenames in the order Google shipped them within a tier (argon 2026-10-13, carbon 2026-11-10;
29
+ * hydrogen 2026-11-12). Among ids of the same version the LATER codename ranks first in the listing — an alias
30
+ * (`latest-pro`) resolves to it — by this declared order, never by the alphabet. A new codename is added here.
31
+ */
32
+ export const GEMINI_4_CODENAMES = ['argon', 'carbon', 'hydrogen'];
33
+ /** A Gemini 4 id that is exactly `gemini-4[.N]-<codename>` or its `-preview` twin. */
34
+ function codenameId(names) {
35
+ return new RegExp(`^gemini-4(?:\\.\\d+)?-(?:${names.join('|')})(?:-preview)?$`, 'i');
36
+ }
37
+ /** The listing rank a codename gives an id (0 for an id without one): a later codename ranks higher. */
38
+ export function codenameRank(modelId) {
39
+ const found = /^gemini-4(?:\.\d+)?-([a-z]+)/i.exec(modelId);
40
+ return found ? GEMINI_4_CODENAMES.indexOf((found[1] ?? '').toLowerCase()) + 1 : 0;
41
+ }
27
42
  const CATEGORY_RULES = [
28
43
  // === Image generation — MUST come before pro/flash text rules ===
29
44
  // `nano-banana-*` is Google's image-gen family (pro/flash tiers), IDs
30
45
  // like `nano-banana-pro-preview`. Shares the `pro` token with text models
31
46
  // but bills at the image tier (~10× text rates).
32
47
  { pattern: /^nano-banana/i, category: 'image-generation', costTier: 'premium' },
48
+ // Since 2.1 the family carries the `gemini-` prefix (`gemini-nano-banana-2.1`).
49
+ { pattern: /^gemini-nano-banana(?:-|$)/i, category: 'image-generation', costTier: 'premium' },
33
50
  // `*-image` suffix (e.g. `gemini-3-pro-image`) identifies Gemini's native
34
51
  // image-output variants.
35
52
  { pattern: /-image(?:-|$)/i, category: 'image-generation', costTier: 'premium' },
@@ -86,13 +103,18 @@ const CATEGORY_RULES = [
86
103
  // Flash (standard speed tier).
87
104
  { pattern: /^gemini-.*-flash/i, category: 'text-fast', costTier: 'standard' },
88
105
  { pattern: /-flash(?:-|$)/i, category: 'text-fast', costTier: 'standard' },
89
- // Gemini 4 frontier models ship under a codename with no pro/flash token
90
- // (`gemini-4-argon`, a later `gemini-4.1-argon`). Argon is the reasoning
91
- // tier: thinking, 2 / 10 USD per 1M tokens — premium. Placed after every
92
- // specialisation and after the lite / flash rules, so an `-image` / `-tts` /
93
- // `-live` variant keeps its specialised category and an `-argon-lite` /
94
- // `-argon-flash` variant its tier: the more specific tier wins.
95
- { pattern: /^gemini-4(?:\.\d+)?-argon(?:-|$)/i, category: 'text-reasoning', costTier: 'premium' },
106
+ // Gemini 4 models ship under a codename with no pro/flash token
107
+ // (`gemini-4-argon`, a later `gemini-4.1-argon`). Carbon and Argon are the
108
+ // reasoning tier: thinking, 2 / 10 USD per 1M tokens — premium. Hydrogen is
109
+ // the fast tier (Google's successor of 3.8 Flash, 1.5 / 7.5 USD) — standard.
110
+ // Placed after every specialisation and after the lite / flash rules, so an
111
+ // `-image` / `-tts` / `-live` variant keeps its specialised category and a
112
+ // `-<codename>-lite` / `-<codename>-flash` variant its tier: the more
113
+ // specific tier wins. A codename this list does not name stays `unknown`.
114
+ // A bare codename id or its `-preview` twin only: `gemini-4-carbon-computer-use-preview` is another product
115
+ // and stays `unknown` until a rule names it.
116
+ { pattern: codenameId(['argon', 'carbon']), category: 'text-reasoning', costTier: 'premium' },
117
+ { pattern: codenameId(['hydrogen']), category: 'text-fast', costTier: 'standard' },
96
118
  // Pro (reasoning / premium tier). Only reaches here if no specialisation
97
119
  // above claimed the model. The `^gemini-pro` rule previously at the end
98
120
  // of this list was unreachable because `/-pro(?:-|$)/i` already matches
@@ -1 +1 @@
1
- {"version":3,"file":"model-taxonomy.js","sourceRoot":"","sources":["../../src/gemini/model-taxonomy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AA6CH,MAAM,cAAc,GAA4B;IAC9C,mEAAmE;IACnE,sEAAsE;IACtE,0EAA0E;IAC1E,iDAAiD;IACjD,EAAE,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,kBAAkB,EAAE,QAAQ,EAAE,SAAS,EAAE;IAC/E,0EAA0E;IAC1E,yBAAyB;IACzB,EAAE,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,kBAAkB,EAAE,QAAQ,EAAE,SAAS,EAAE;IAChF,uDAAuD;IACvD,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,kBAAkB,EAAE,QAAQ,EAAE,SAAS,EAAE;IAE3E,2BAA2B;IAC3B,yEAAyE;IACzE,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,kBAAkB,EAAE,QAAQ,EAAE,SAAS,EAAE;IAC1E,yEAAyE;IACzE,qEAAqE;IACrE,EAAE,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAAE,kBAAkB,EAAE,QAAQ,EAAE,UAAU,EAAE;IACrF,EAAE,OAAO,EAAE,+B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import { type ToolDefinition } from './registry.js';
32
- export declare const askAgenticInputSchema: z.ZodEffects<z.ZodObject<{
32
+ export declare const askAgenticInputSchema: z.ZodObject<{
33
33
  prompt: z.ZodString;
34
34
  workspace: z.ZodOptional<z.ZodString>;
35
35
  model: z.ZodOptional<z.ZodString>;
36
- includeGlobs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
37
- excludeGlobs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
36
+ includeGlobs: z.ZodOptional<z.ZodArray<z.ZodString>>;
37
+ excludeGlobs: z.ZodOptional<z.ZodArray<z.ZodString>>;
38
38
  thinkingBudget: z.ZodOptional<z.ZodNumber>;
39
- thinkingLevel: z.ZodOptional<z.ZodEnum<["MINIMAL", "LOW", "MEDIUM", "HIGH"]>>;
39
+ thinkingLevel: z.ZodOptional<z.ZodEnum<{
40
+ HIGH: "HIGH";
41
+ LOW: "LOW";
42
+ MEDIUM: "MEDIUM";
43
+ MINIMAL: "MINIMAL";
44
+ XHIGH: "XHIGH";
45
+ }>>;
40
46
  maxOutputTokens: z.ZodOptional<z.ZodNumber>;
41
47
  maxIterations: z.ZodOptional<z.ZodNumber>;
42
48
  maxTotalInputTokens: z.ZodOptional<z.ZodNumber>;
43
49
  maxFilesRead: z.ZodOptional<z.ZodNumber>;
44
50
  iterationTimeoutMs: z.ZodOptional<z.ZodNumber>;
45
51
  stallMs: z.ZodOptional<z.ZodNumber>;
46
- }, "strip", z.ZodTypeAny, {
47
- prompt: string;
48
- workspace?: string | undefined;
49
- model?: string | undefined;
50
- includeGlobs?: string[] | undefined;
51
- excludeGlobs?: string[] | undefined;
52
- thinkingBudget?: number | undefined;
53
- thinkingLevel?: "HIGH" | "LOW" | "MEDIUM" | "MINIMAL" | undefined;
54
- maxOutputTokens?: number | undefined;
55
- maxIterations?: number | undefined;
56
- maxTotalInputTokens?: number | undefined;
57
- maxFilesRead?: number | undefined;
58
- iterationTimeoutMs?: number | undefined;
59
- stallMs?: number | undefined;
60
- }, {
61
- prompt: string;
62
- workspace?: string | undefined;
63
- model?: string | undefined;
64
- includeGlobs?: string[] | undefined;
65
- excludeGlobs?: string[] | undefined;
66
- thinkingBudget?: number | undefined;
67
- thinkingLevel?: "HIGH" | "LOW" | "MEDIUM" | "MINIMAL" | undefined;
68
- maxOutputTokens?: number | undefined;
69
- maxIterations?: number | undefined;
70
- maxTotalInputTokens?: number | undefined;
71
- maxFilesRead?: number | undefined;
72
- iterationTimeoutMs?: number | undefined;
73
- stallMs?: number | undefined;
74
- }>, {
75
- prompt: string;
76
- workspace?: string | undefined;
77
- model?: string | undefined;
78
- includeGlobs?: string[] | undefined;
79
- excludeGlobs?: string[] | undefined;
80
- thinkingBudget?: number | undefined;
81
- thinkingLevel?: "HIGH" | "LOW" | "MEDIUM" | "MINIMAL" | undefined;
82
- maxOutputTokens?: number | undefined;
83
- maxIterations?: number | undefined;
84
- maxTotalInputTokens?: number | undefined;
85
- maxFilesRead?: number | undefined;
86
- iterationTimeoutMs?: number | undefined;
87
- stallMs?: number | undefined;
88
- }, {
89
- prompt: string;
90
- workspace?: string | undefined;
91
- model?: string | undefined;
92
- includeGlobs?: string[] | undefined;
93
- excludeGlobs?: string[] | undefined;
94
- thinkingBudget?: number | undefined;
95
- thinkingLevel?: "HIGH" | "LOW" | "MEDIUM" | "MINIMAL" | undefined;
96
- maxOutputTokens?: number | undefined;
97
- maxIterations?: number | undefined;
98
- maxTotalInputTokens?: number | undefined;
99
- maxFilesRead?: number | undefined;
100
- iterationTimeoutMs?: number | undefined;
101
- stallMs?: number | undefined;
102
- }>;
52
+ }, z.core.$strip>;
103
53
  export type AskAgenticInput = z.infer<typeof askAgenticInputSchema>;
104
54
  /** Read + clamp the tool-execution concurrency at dispatch time.
105
55
  *
@@ -1 +1 @@
1
- {"version":3,"file":"ask-agentic.tool.d.ts","sourceRoot":"","sources":["../../src/tools/ask-agentic.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAaH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAkBxB,OAAO,EAAE,KAAK,cAAc,EAA2B,MAAM,eAAe,CAAC;AAW7E,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6E9B,CAAC;AAEL,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AA8BpE;;;;;;;;;;;;;;;;;qEAiBqE;AACrE,wBAAgB,+BAA+B,IAAI,MAAM,CAUxD;AA0VD,eAAO,MAAM,cAAc,EAAE,cAAc,CAAC,eAAe,CAa1D,CAAC"}
1
+ {"version":3,"file":"ask-agentic.tool.d.ts","sourceRoot":"","sources":["../../src/tools/ask-agentic.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAaH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAkBxB,OAAO,EAAE,KAAK,cAAc,EAA2B,MAAM,eAAe,CAAC;AAgB7E,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;iBA6E9B,CAAC;AAEL,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AA8BpE;;;;;;;;;;;;;;;;;qEAiBqE;AACrE,wBAAgB,+BAA+B,IAAI,MAAM,CAUxD;AA0VD,eAAO,MAAM,cAAc,EAAE,cAAc,CAAC,eAAe,CAa1D,CAAC"}
@@ -34,16 +34,16 @@ import { resolveModel } from '../gemini/models.js';
34
34
  import { abortableSleep, withNetworkRetry } from '../gemini/retry.js';
35
35
  import { defaultMatchConfig } from '../indexer/globs.js';
36
36
  import { WorkspaceValidationError, validateWorkspacePath, } from '../indexer/workspace-validation.js';
37
- import { estimateCostUsd, toMicrosUsd } from '../utils/cost-estimator.js';
37
+ import { estimateCostUsd, estimateReservationUsd, toMicrosUsd } from '../utils/cost-estimator.js';
38
38
  import { logger, safeForLog } from '../utils/logger.js';
39
39
  import { createProgressEmitter } from '../utils/progress.js';
40
40
  import { SandboxError, resolveInsideWorkspace, resolveWorkspaceRoot } from './agentic/sandbox.js';
41
41
  import { findFilesExecutor, grepExecutor, listDirectoryExecutor, readFileExecutor, } from './agentic/workspace-tools.js';
42
42
  import { errorResult, textResult } from './registry.js';
43
- import { createTimeoutController, getTimeoutKind, isTimeoutAbort } from './shared/abort-timeout.js';
43
+ import { createTimeoutController, getTimeoutKind, isTimeoutAbort, resolveTotalTimeoutMs, } from './shared/abort-timeout.js';
44
44
  import { collectStream } from './shared/stream-collector.js';
45
45
  import { SYSTEM_INSTRUCTION_SAFETY_AGENTIC } from './shared/system-instruction-safety.js';
46
- import { THINKING_LEVELS } from './shared/thinking.js';
46
+ import { THINKING_LEVEL_FIELD } from './shared/thinking.js';
47
47
  import { isGemini429, parseRetryDelayMs } from './shared/throttle.js';
48
48
  // ---------------------------------------------------------------------------
49
49
  // Schema
@@ -68,7 +68,7 @@ export const askAgenticInputSchema = z
68
68
  .optional()
69
69
  .describe('Additional patterns to exclude. Same three shapes as `ask` / `code`: (1) directory names or path prefixes (`node_modules`, `src/vendor`, `./dist/`, `.vercel/`), (2) literal filenames exact-match including bare dot-prefixed names (`pr27-diff.txt`, `foo.bar.baz`, `.env`, `.tsbuildinfo`), (3) extension globs that match via endsWith (`*.tsbuildinfo`, `*.map`). Bare dot-prefixed names like `.env` are treated as exact filename literals — write `*.env` for extension semantics. Paths are POSIX-normalised. Case-insensitive. No mid-string `*` / `**` / `?`. **Privacy-relevant:** when `ask` falls back to `ask_agentic` on `WORKSPACE_TOO_LARGE`, the user-supplied excludes here are honoured by every executor: `read_file` rejects with `EXCLUDED_FILE` (generic message — does NOT echo the excluded path, so the error string cannot be used as a path-existence oracle); `list_directory` and `grep` reject the requested directory / `pathPrefix` itself with `EXCLUDED_DIR` when it matches an exclude (top-level gate, not just child filtering); `find_files` skips the dir during walk; child entries inside an unexcluded parent are still hidden when they themselves match an exclude.'),
70
70
  thinkingBudget: z.number().int().min(-1).max(65_536).optional(),
71
- thinkingLevel: z.enum(THINKING_LEVELS).optional(),
71
+ thinkingLevel: THINKING_LEVEL_FIELD,
72
72
  maxOutputTokens: z.number().int().min(1).optional(),
73
73
  maxIterations: z
74
74
  .number()
@@ -596,17 +596,26 @@ async function executeAskAgenticBody(input, ctx, rawWorkspaceRoot, model, starte
596
596
  // review by Grok (P0: budget bypass on agentic path).
597
597
  const PER_ITERATION_INPUT_TOKENS = 50_000;
598
598
  const PER_ITERATION_OUTPUT_TOKENS = typeof input.maxOutputTokens === 'number' ? input.maxOutputTokens : 4096;
599
- const perIterationCostUsd = estimateCostUsd({
600
- model: resolved.resolved,
601
- uncachedInputTokens: PER_ITERATION_INPUT_TOKENS,
599
+ // The longest an iteration (or the finalization pass) can run: the window
600
+ // each reservation covers.
601
+ const iterationCoverMs = resolveTotalTimeoutMs(input.iterationTimeoutMs, 'GEMINI_CODE_CONTEXT_AGENTIC_ITERATION_TIMEOUT_MS');
602
+ /** One pass's reservation, at the rates in force from now until its timeout. */
603
+ const reservedModel = resolved.resolved;
604
+ const passReservationUsd = (inputTokens) => estimateReservationUsd({
605
+ model: reservedModel,
606
+ uncachedInputTokens: inputTokens,
602
607
  cachedInputTokens: 0,
603
608
  outputTokens: PER_ITERATION_OUTPUT_TOKENS,
604
609
  thinkingTokens: PER_ITERATION_OUTPUT_TOKENS,
605
- });
610
+ }, iterationCoverMs);
606
611
  const dailyBudgetEnforced = Number.isFinite(ctx.config.dailyBudgetUsd);
607
612
  const tpmEnforced = ctx.config.tpmThrottleLimit > 0;
608
613
  while (iterations < maxIterations) {
609
614
  iterations += 1;
615
+ // Priced per iteration, covering the rates in force until its timeout: a
616
+ // loop that crosses a price change reserves at the new rate, so each
617
+ // reservation stays an upper bound of what its settlement books.
618
+ const perIterationCostUsd = passReservationUsd(PER_ITERATION_INPUT_TOKENS);
610
619
  // Per-iteration budget reservation (mirrors ask.tool.ts). Each
611
620
  // iteration is an independent generateContent billable, so each
612
621
  // gets its own reservation/finalize pair. Budget ledger stays
@@ -1063,13 +1072,7 @@ async function executeAskAgenticBody(input, ctx, rawWorkspaceRoot, model, starte
1063
1072
  const finalizationEstimate = lastIterationPromptTokens > 0
1064
1073
  ? lastIterationPromptTokens + lastToolResponseTokens + 5_000
1065
1074
  : PER_ITERATION_INPUT_TOKENS;
1066
- const finalizationCostUsd = estimateCostUsd({
1067
- model: resolved.resolved,
1068
- uncachedInputTokens: finalizationEstimate,
1069
- cachedInputTokens: 0,
1070
- outputTokens: PER_ITERATION_OUTPUT_TOKENS,
1071
- thinkingTokens: PER_ITERATION_OUTPUT_TOKENS,
1072
- });
1075
+ const finalizationCostUsd = passReservationUsd(finalizationEstimate);
1073
1076
  if (dailyBudgetEnforced) {
1074
1077
  const reserve = ctx.manifest.reserveBudget({
1075
1078
  workspaceRoot,