@qmediat.io/gemini-code-context-mcp 1.24.0 → 1.25.1

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 (189) hide show
  1. package/CHANGELOG.md +110 -1
  2. package/README.md +1 -1
  3. package/dist/cache/cache-manager.d.ts +23 -34
  4. package/dist/cache/cache-manager.d.ts.map +1 -1
  5. package/dist/cache/cache-manager.js +324 -272
  6. package/dist/cache/cache-manager.js.map +1 -1
  7. package/dist/cache/caching-mode.d.ts +5 -3
  8. package/dist/cache/caching-mode.d.ts.map +1 -1
  9. package/dist/cache/caching-mode.js +6 -4
  10. package/dist/cache/caching-mode.js.map +1 -1
  11. package/dist/cache/ttl-watcher.d.ts.map +1 -1
  12. package/dist/cache/ttl-watcher.js +7 -1
  13. package/dist/cache/ttl-watcher.js.map +1 -1
  14. package/dist/cache/ttl.d.ts +8 -0
  15. package/dist/cache/ttl.d.ts.map +1 -0
  16. package/dist/cache/ttl.js +10 -0
  17. package/dist/cache/ttl.js.map +1 -0
  18. package/dist/manifest/db.d.ts.map +1 -1
  19. package/dist/manifest/db.js +2 -1
  20. package/dist/manifest/db.js.map +1 -1
  21. package/dist/tools/agentic/dispatch.d.ts +68 -0
  22. package/dist/tools/agentic/dispatch.d.ts.map +1 -0
  23. package/dist/tools/agentic/dispatch.js +167 -0
  24. package/dist/tools/agentic/dispatch.js.map +1 -0
  25. package/dist/tools/agentic/input.d.ts +28 -0
  26. package/dist/tools/agentic/input.d.ts.map +1 -0
  27. package/dist/tools/agentic/input.js +66 -0
  28. package/dist/tools/agentic/input.js.map +1 -0
  29. package/dist/tools/agentic/instructions.d.ts +46 -0
  30. package/dist/tools/agentic/instructions.d.ts.map +1 -0
  31. package/dist/tools/agentic/instructions.js +170 -0
  32. package/dist/tools/agentic/instructions.js.map +1 -0
  33. package/dist/tools/agentic/iteration.d.ts +81 -0
  34. package/dist/tools/agentic/iteration.d.ts.map +1 -0
  35. package/dist/tools/agentic/iteration.js +317 -0
  36. package/dist/tools/agentic/iteration.js.map +1 -0
  37. package/dist/tools/agentic/ledger.d.ts +64 -0
  38. package/dist/tools/agentic/ledger.d.ts.map +1 -0
  39. package/dist/tools/agentic/ledger.js +110 -0
  40. package/dist/tools/agentic/ledger.js.map +1 -0
  41. package/dist/tools/agentic/loop.d.ts +10 -0
  42. package/dist/tools/agentic/loop.d.ts.map +1 -0
  43. package/dist/tools/agentic/loop.js +179 -0
  44. package/dist/tools/agentic/loop.js.map +1 -0
  45. package/dist/tools/agentic/no-progress.d.ts +90 -0
  46. package/dist/tools/agentic/no-progress.d.ts.map +1 -0
  47. package/dist/tools/agentic/no-progress.js +107 -0
  48. package/dist/tools/agentic/no-progress.js.map +1 -0
  49. package/dist/tools/agentic/pass-clock.d.ts +85 -0
  50. package/dist/tools/agentic/pass-clock.d.ts.map +1 -0
  51. package/dist/tools/agentic/pass-clock.js +162 -0
  52. package/dist/tools/agentic/pass-clock.js.map +1 -0
  53. package/dist/tools/agentic/phase-defaults.d.ts +29 -0
  54. package/dist/tools/agentic/phase-defaults.d.ts.map +1 -0
  55. package/dist/tools/agentic/phase-defaults.js +23 -0
  56. package/dist/tools/agentic/phase-defaults.js.map +1 -0
  57. package/dist/tools/agentic/rescue.d.ts +69 -0
  58. package/dist/tools/agentic/rescue.d.ts.map +1 -0
  59. package/dist/tools/agentic/rescue.js +203 -0
  60. package/dist/tools/agentic/rescue.js.map +1 -0
  61. package/dist/tools/agentic/response.d.ts +16 -0
  62. package/dist/tools/agentic/response.d.ts.map +1 -0
  63. package/dist/tools/agentic/response.js +25 -0
  64. package/dist/tools/agentic/response.js.map +1 -0
  65. package/dist/tools/agentic/results.d.ts +76 -0
  66. package/dist/tools/agentic/results.d.ts.map +1 -0
  67. package/dist/tools/agentic/results.js +228 -0
  68. package/dist/tools/agentic/results.js.map +1 -0
  69. package/dist/tools/agentic/run.d.ts +130 -0
  70. package/dist/tools/agentic/run.d.ts.map +1 -0
  71. package/dist/tools/agentic/run.js +128 -0
  72. package/dist/tools/agentic/run.js.map +1 -0
  73. package/dist/tools/agentic/sandbox.d.ts +13 -2
  74. package/dist/tools/agentic/sandbox.d.ts.map +1 -1
  75. package/dist/tools/agentic/sandbox.js +127 -111
  76. package/dist/tools/agentic/sandbox.js.map +1 -1
  77. package/dist/tools/agentic/workspace-tools.d.ts +30 -27
  78. package/dist/tools/agentic/workspace-tools.d.ts.map +1 -1
  79. package/dist/tools/agentic/workspace-tools.js +324 -385
  80. package/dist/tools/agentic/workspace-tools.js.map +1 -1
  81. package/dist/tools/ask/answer.d.ts +9 -0
  82. package/dist/tools/ask/answer.d.ts.map +1 -0
  83. package/dist/tools/ask/answer.js +28 -0
  84. package/dist/tools/ask/answer.js.map +1 -0
  85. package/dist/tools/ask/attachments.d.ts +25 -0
  86. package/dist/tools/ask/attachments.d.ts.map +1 -0
  87. package/dist/tools/ask/attachments.js +85 -0
  88. package/dist/tools/ask/attachments.js.map +1 -0
  89. package/dist/tools/ask/call.d.ts +61 -0
  90. package/dist/tools/ask/call.d.ts.map +1 -0
  91. package/dist/tools/ask/call.js +6 -0
  92. package/dist/tools/ask/call.js.map +1 -0
  93. package/dist/tools/ask/guard.d.ts +24 -0
  94. package/dist/tools/ask/guard.d.ts.map +1 -0
  95. package/dist/tools/ask/guard.js +79 -0
  96. package/dist/tools/ask/guard.js.map +1 -0
  97. package/dist/tools/ask/input.d.ts +45 -0
  98. package/dist/tools/ask/input.d.ts.map +1 -0
  99. package/dist/tools/ask/input.js +93 -0
  100. package/dist/tools/ask/input.js.map +1 -0
  101. package/dist/tools/ask/instruction.d.ts +8 -0
  102. package/dist/tools/ask/instruction.d.ts.map +1 -0
  103. package/dist/tools/ask/instruction.js +13 -0
  104. package/dist/tools/ask/instruction.js.map +1 -0
  105. package/dist/tools/ask/request.d.ts +14 -0
  106. package/dist/tools/ask/request.d.ts.map +1 -0
  107. package/dist/tools/ask/request.js +38 -0
  108. package/dist/tools/ask/request.js.map +1 -0
  109. package/dist/tools/ask/results.d.ts +23 -0
  110. package/dist/tools/ask/results.d.ts.map +1 -0
  111. package/dist/tools/ask/results.js +107 -0
  112. package/dist/tools/ask/results.js.map +1 -0
  113. package/dist/tools/ask/setup.d.ts +22 -0
  114. package/dist/tools/ask/setup.d.ts.map +1 -0
  115. package/dist/tools/ask/setup.js +57 -0
  116. package/dist/tools/ask/setup.js.map +1 -0
  117. package/dist/tools/ask/sizing.d.ts +10 -0
  118. package/dist/tools/ask/sizing.d.ts.map +1 -0
  119. package/dist/tools/ask/sizing.js +33 -0
  120. package/dist/tools/ask/sizing.js.map +1 -0
  121. package/dist/tools/ask/thinking.d.ts +54 -0
  122. package/dist/tools/ask/thinking.d.ts.map +1 -0
  123. package/dist/tools/ask/thinking.js +69 -0
  124. package/dist/tools/ask/thinking.js.map +1 -0
  125. package/dist/tools/ask-agentic-fallback.d.ts +33 -0
  126. package/dist/tools/ask-agentic-fallback.d.ts.map +1 -0
  127. package/dist/tools/ask-agentic-fallback.js +113 -0
  128. package/dist/tools/ask-agentic-fallback.js.map +1 -0
  129. package/dist/tools/ask-agentic.tool.d.ts +11 -44
  130. package/dist/tools/ask-agentic.tool.d.ts.map +1 -1
  131. package/dist/tools/ask-agentic.tool.js +139 -1618
  132. package/dist/tools/ask-agentic.tool.js.map +1 -1
  133. package/dist/tools/ask.tool.d.ts +3 -41
  134. package/dist/tools/ask.tool.d.ts.map +1 -1
  135. package/dist/tools/ask.tool.js +46 -944
  136. package/dist/tools/ask.tool.js.map +1 -1
  137. package/dist/tools/code.tool.d.ts.map +1 -1
  138. package/dist/tools/code.tool.js +376 -514
  139. package/dist/tools/code.tool.js.map +1 -1
  140. package/dist/tools/reindex.tool.d.ts.map +1 -1
  141. package/dist/tools/reindex.tool.js +19 -22
  142. package/dist/tools/reindex.tool.js.map +1 -1
  143. package/dist/tools/shared/abort-timeout.d.ts +43 -5
  144. package/dist/tools/shared/abort-timeout.d.ts.map +1 -1
  145. package/dist/tools/shared/abort-timeout.js +111 -102
  146. package/dist/tools/shared/abort-timeout.js.map +1 -1
  147. package/dist/tools/shared/call-ledger.d.ts +27 -12
  148. package/dist/tools/shared/call-ledger.d.ts.map +1 -1
  149. package/dist/tools/shared/call-ledger.js +57 -39
  150. package/dist/tools/shared/call-ledger.js.map +1 -1
  151. package/dist/tools/shared/continuation.d.ts +1 -1
  152. package/dist/tools/shared/continuation.d.ts.map +1 -1
  153. package/dist/tools/shared/eager-answer.d.ts +78 -0
  154. package/dist/tools/shared/eager-answer.d.ts.map +1 -0
  155. package/dist/tools/shared/eager-answer.js +130 -0
  156. package/dist/tools/shared/eager-answer.js.map +1 -0
  157. package/dist/tools/shared/eager-call.d.ts +114 -0
  158. package/dist/tools/shared/eager-call.d.ts.map +1 -0
  159. package/dist/tools/shared/eager-call.js +95 -0
  160. package/dist/tools/shared/eager-call.js.map +1 -0
  161. package/dist/tools/shared/eager-steps.d.ts +114 -0
  162. package/dist/tools/shared/eager-steps.d.ts.map +1 -0
  163. package/dist/tools/shared/eager-steps.js +152 -0
  164. package/dist/tools/shared/eager-steps.js.map +1 -0
  165. package/dist/tools/shared/question-fields.d.ts +10 -0
  166. package/dist/tools/shared/question-fields.d.ts.map +1 -0
  167. package/dist/tools/shared/question-fields.js +13 -0
  168. package/dist/tools/shared/question-fields.js.map +1 -0
  169. package/dist/tools/shared/service-tier.d.ts +9 -0
  170. package/dist/tools/shared/service-tier.d.ts.map +1 -1
  171. package/dist/tools/shared/service-tier.js +15 -0
  172. package/dist/tools/shared/service-tier.js.map +1 -1
  173. package/dist/tools/shared/settle-call.d.ts +11 -6
  174. package/dist/tools/shared/settle-call.d.ts.map +1 -1
  175. package/dist/tools/shared/settle-call.js +14 -10
  176. package/dist/tools/shared/settle-call.js.map +1 -1
  177. package/dist/tools/shared/thinking.d.ts +9 -0
  178. package/dist/tools/shared/thinking.d.ts.map +1 -1
  179. package/dist/tools/shared/thinking.js +10 -0
  180. package/dist/tools/shared/thinking.js.map +1 -1
  181. package/dist/tools/shared/throttle.d.ts +7 -0
  182. package/dist/tools/shared/throttle.d.ts.map +1 -1
  183. package/dist/tools/shared/throttle.js +18 -0
  184. package/dist/tools/shared/throttle.js.map +1 -1
  185. package/dist/tools/shared/workspace-refusal.d.ts +13 -0
  186. package/dist/tools/shared/workspace-refusal.d.ts.map +1 -0
  187. package/dist/tools/shared/workspace-refusal.js +23 -0
  188. package/dist/tools/shared/workspace-refusal.js.map +1 -0
  189. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -7,6 +7,113 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.25.1] - 2026-11-18
11
+
12
+ ### Fixed
13
+
14
+ - `ask` and `code` with `cachingMode: 'explicit'`: when Gemini created a Context Cache without a name, the question went
15
+ with neither the cache nor the workspace files; the files now go inline, as after any failed cache build, and the
16
+ warning says a cache without a usable name may stay billed on Google's side until its TTL. A cache id an earlier
17
+ release stored empty reads as none: the next rebuild no longer sends a delete for an empty name.
18
+ - `ask` and `code` with `cachingMode: 'explicit'`: with `GEMINI_CODE_CONTEXT_CACHE_TTL_SECONDS` below 60, the Context
19
+ Cache was created for 60 s but recorded as expiring at the shorter TTL, so the next call rebuilt a cache that was
20
+ still alive; the recorded expiry is now the TTL the cache was created with, and the TTL watcher refreshes the cache
21
+ with that TTL too.
22
+ - `ask` and `code` with `cachingMode: 'explicit'`: when the Context Cache was created but recording it in the manifest
23
+ failed, the cache stayed on Google's side, billed until its TTL, and the warning said the cache build had failed; the
24
+ new cache is now deleted, the warning names the manifest write, the response's `cachingModeNote` says the cache
25
+ could not be built or recorded, and the files go inline as before.
26
+ - `ask` and `code` with `cachingMode: 'explicit'`: when rebuilding the Context Cache failed, the previous cache stayed on
27
+ Google's side, unreachable and billed until its TTL; it is now deleted, as after a successful rebuild.
28
+
29
+ ## [1.25.0] - 2026-11-17
30
+
31
+ ### Changed
32
+
33
+ - `ask_agentic`: every phase of a pass now has a bound. A phase that could hang forever now ends with `TIMEOUT` after
34
+ its default: 600 s for each request's opening (until its first chunk; a request sent again after a network failure
35
+ gets the whole 600 s, and so does the backoff before it), 600 s for a stream that sends nothing (a `stall`), 120 s
36
+ without progress in an iteration's path resolution and tool batch — the executors report progress at every directory,
37
+ file and read, so a long healthy `grep` batch over a large workspace runs on — and 600 s for each request of the
38
+ forced-finalization pass (`rescueErrorCode: 'TIMEOUT'`). A default applies only where no knob bounds the phase:
39
+ `iterationTimeoutMs` (or `GEMINI_CODE_CONTEXT_AGENTIC_ITERATION_TIMEOUT_MS`) bounds every phase of an iteration,
40
+ `stallMs` (or `GEMINI_CODE_CONTEXT_AGENTIC_STALL_MS`) the gaps of a stream only. The TPM wait keeps the throttle's own
41
+ delay. Before, with neither knob set — and with only `stallMs` for everything but a stream's gaps — such a phase never
42
+ ended and held the pass's daily-budget and TPM reservations.
43
+ - `ask_agentic`: `iterationTimeoutMs` ends a tool batch at the bound, not when the batch returns; no queued tool call
44
+ starts once a bound fired, the executors get the abort signal, and a late result is dropped. A `TIMEOUT` is
45
+ `retryable: false` when tool calls still run 1 s after the bound (`toolCallsRunning` says how many).
46
+ - `ask`'s fallback to `ask_agentic` (`onWorkspaceTooLarge: 'fallback-to-agentic'`) forwards `stallMs` as the loop's
47
+ `stallMs`, no longer as a per-iteration wall clock: a healthy stream or a tool batch longer than `stallMs` answers.
48
+ With only `stallMs` set a pass has no wall clock — a stream that keeps sending ends at the model's output cap, a tool
49
+ batch that keeps reporting progress when its walk ends; a caller who wants a wall clock per iteration sets
50
+ `iterationTimeoutMs` (`timeoutMs` on `ask`).
51
+ `timeoutMs` still becomes `iterationTimeoutMs`. `iterTimeoutSource` is now always `'timeoutMs'` (the values
52
+ `'stallMs'` and `'min(timeoutMs,stallMs)'` are gone), and the result reports the forwarded `stallMs`.
53
+ - `ask_agentic`'s timeout messages no longer say "default disabled"; a bound that fired at its default names the
54
+ default and the knob that sets it.
55
+
56
+ ### Added
57
+
58
+ - `ask_agentic`: a `TIMEOUT` result carries `timeoutPhase` (`tpm-wait`, `opening`, `stream`, `tools`) and
59
+ `timeoutSource` (`iterationTimeoutMs`, `stallMs`, `default`, or `external` — a timeout the SDK raised itself: the
60
+ message quotes it and names no bound of the call); `timeoutKind` keeps its two values (`stall` is a stream's gap
61
+ only). The forced-finalization pass's `AGENTIC_MAX_ITERATIONS` with `rescueErrorCode: 'TIMEOUT'` carries
62
+ `timeoutPhase` (`tpm-wait`, `finalization`) and `timeoutSource` too, and its message names the knob that raises the
63
+ bound. `ask`'s fallback lifts both to the top of its result, beside `timeoutKind`.
64
+
65
+ ### Fixed
66
+
67
+ - `ask_agentic`: a tool batch longer than `stallMs` no longer ends the call as a false `stall`; the stall watchdog
68
+ watches the stream only.
69
+ - `ask_agentic`: a tool batch, or a path resolution at the `maxFilesRead` cap, that never returns no longer hangs the
70
+ call: it ends at `iterationTimeoutMs`, else after 120 s without progress, with the pass booked.
71
+ - `ask`'s fallback to `ask_agentic` uses `ask`'s knobs as `ask` resolved them — per call, else
72
+ `GEMINI_CODE_CONTEXT_ASK_TIMEOUT_MS` / `GEMINI_CODE_CONTEXT_ASK_STALL_MS` (the env vars were ignored) — stops `ask`'s
73
+ own timer at the hand-off, and its timeout messages name `timeoutMs` / `stallMs`, not `iterationTimeoutMs`. Where
74
+ `ask` set no knob of a kind, `GEMINI_CODE_CONTEXT_AGENTIC_ITERATION_TIMEOUT_MS` / `_STALL_MS` still bound the loop,
75
+ and the message names that variable, not an `ask` one that set nothing.
76
+ - `ask_agentic`: a 429 on a loop iteration seeds the throttle's retry hint once, not twice. `ask`, `code` and
77
+ `ask_agentic` seed the hint through one function, once per error.
78
+ - `ask_agentic`: a loop iteration whose response carries no `usageMetadata` is booked and released at its estimate
79
+ (50,000 input tokens), as the forced-finalization pass already was: it used to book 0 USD against the daily budget
80
+ and release its TPM reservation at 0 tokens, so later calls were throttled as if it had sent nothing.
81
+ - `ask_agentic` without a daily budget (`GEMINI_DAILY_BUDGET_USD` unset) writes a usage row for each pass that
82
+ reached the model, as `ask` and `code` do: `status` (`spentTodayUsd`) counted none of its spend.
83
+ - `ask_agentic`: a loop iteration whose model call completed and which then failed — a timeout in its tool batch, a
84
+ response that could not be read — is booked at what it billed; it used to book nothing against the daily budget.
85
+ The error result of a pass booked before it failed (the loop iteration's `TIMEOUT` or `UNKNOWN`, the forced pass's
86
+ `AGENTIC_MAX_ITERATIONS`) carries that pass's `cachedTokens`, `uncachedTokens`, `outputTokens`, `thinkingTokens`
87
+ and `costEstimateUsd`.
88
+ - `ask_agentic`: the message of an iteration `TIMEOUT` whose pass was booked says it is booked at the result's token
89
+ and cost fields; it used to say the request was booked 0 beside those fields.
90
+ - `ask_agentic`: a pass whose usage could not be read (the read threw after its model call completed) is booked at
91
+ its whole reservation — the input estimate plus the reserved output and thinking tokens; it used to be booked at
92
+ the input estimate alone.
93
+ - Docs and timeout messages: whether Google bills a request aborted after its stream opened is not measured; the server
94
+ books it 0, so for such a request the daily budget and the TPM window are not a bound. `docs/cost-model.md` names
95
+ this and the `ask_agentic` iteration's fixed 50,000-token estimate (*What the daily budget does not bound*); the
96
+ phrases "true upper bound" / "true cap" are gone.
97
+ - `ask` and `code`: an answer whose usage row cannot be written (a busy or failing database) is returned, and the
98
+ failed write is logged; the paid answer used to be lost behind an error.
99
+
100
+ ### Security
101
+
102
+ - `ask_agentic`: `list_directory`, `find_files` and `grep` no longer show a file on the secret denylist that `read_file`
103
+ refuses — a basename such as `.env`, `.env.local`, `credentials.json`, `secrets.yaml` or `service-account.json`, or a
104
+ name ending in `.pem`, `.key` or another secret extension, in any case. Before, since these tools shipped with
105
+ `ask_agentic`, `list_directory` listed such files with their sizes, `find_files` listed those its source rules admit
106
+ (`credentials.json`, `secrets.json`, `secrets.yaml`, …), and `grep` returned their matching lines. The three tools and
107
+ `read_file` now read one denylist.
108
+
109
+ ### Notes
110
+
111
+ - Minor release. `errorCode`, `timeoutKind` and every result field that existed keep their values and meaning. What an
112
+ existing caller can observe: an `ask_agentic` call that hung with no knob set now ends with `TIMEOUT` at a default; a
113
+ `TIMEOUT` can be `retryable: false` (tool calls of the iteration still run); on `ask`'s fallback `stallMs` no longer
114
+ ends a healthy iteration, and `iterTimeoutSource` no longer takes the values `'stallMs'` and
115
+ `'min(timeoutMs,stallMs)'`; `list_directory`, `find_files` and `grep` no longer show a file on the secret denylist.
116
+
10
117
  ## [1.24.0] - 2026-11-17
11
118
 
12
119
  ### Added
@@ -1868,7 +1975,9 @@ Integration-test-surfaced and review-surfaced fixes landed before the v1.0.0 rel
1868
1975
  - MIME type simplified to `text/plain` for all files.
1869
1976
  - 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).
1870
1977
 
1871
- [Unreleased]: https://github.com/qmediat/gemini-code-context-mcp/compare/v1.24.0...HEAD
1978
+ [Unreleased]: https://github.com/qmediat/gemini-code-context-mcp/compare/v1.25.1...HEAD
1979
+ [1.25.1]: https://github.com/qmediat/gemini-code-context-mcp/compare/v1.25.0...v1.25.1
1980
+ [1.25.0]: https://github.com/qmediat/gemini-code-context-mcp/compare/v1.24.0...v1.25.0
1872
1981
  [1.24.0]: https://github.com/qmediat/gemini-code-context-mcp/compare/v1.23.1...v1.24.0
1873
1982
  [1.23.1]: https://github.com/qmediat/gemini-code-context-mcp/compare/v1.23.0...v1.23.1
1874
1983
  [1.23.0]: https://github.com/qmediat/gemini-code-context-mcp/compare/v1.22.1...v1.23.0
package/README.md CHANGED
@@ -35,7 +35,7 @@ Use gemini-code-context.ask to summarize this codebase
35
35
  | `reindex` | Scan the workspace again |
36
36
  | `clear` | Delete this workspace's cache |
37
37
 
38
- ## Supports · version 1.24.0
38
+ ## Supports · version 1.25.1
39
39
 
40
40
  | | |
41
41
  |---|---|
@@ -2,9 +2,9 @@
2
2
  * Build / reuse / invalidate Gemini Context Caches keyed by workspace state.
3
3
  *
4
4
  * Cache key = `(workspaceRoot, filesHash, model, systemPromptHash)`. When any
5
- * component changes, we rebuild. When the same key is requested concurrently
6
- * (two ask() calls in parallel), we coalesce via a per-workspace in-process
7
- * mutex so only one cache is created.
5
+ * component changes, we rebuild. Concurrent calls with the same whole call
6
+ * fingerprint (`inFlightKey`: the cache key plus the caching options) coalesce
7
+ * onto one in-process build, so only one cache is created for them.
8
8
  *
9
9
  * Inline fallback path: for small workspaces or `noCache:true`, we skip the
10
10
  * Files API upload entirely and embed file text inline. This avoids unnecessary
@@ -62,41 +62,30 @@ export interface BuildOptions {
62
62
  emitter: ProgressEmitter;
63
63
  allowCaching: boolean;
64
64
  /**
65
- * Optional abort signal (v1.12.1+). When fired, the upload pool stops
66
- * QUEUEING new per-file work and the post-pool abort check throws
67
- * `signal.reason` so the caller's `timeoutMs` budget surfaces as a
68
- * proper TIMEOUT errorCode. Already-flying `client.files.upload`
69
- * calls complete on their own — the SDK doesn't expose abort plumbing
70
- * on `files.upload`, so the abort honours user intent best-effort
71
- * (stops scheduling new work, propagates the abort error after the
72
- * in-flight tasks settle).
73
- *
74
- * Pre-v1.12.1 the upload phase ignored aborts entirely — the signal
75
- * was only threaded into `generateContent`, so a 30s `timeoutMs`
76
- * against a workspace whose upload took 90s would burn 60s of
77
- * bandwidth before the abort took effect at `generateContent`-call
78
- * time. The fix bounds the worst case to "in-flight pool size × max
79
- * upload duration" instead of "total file count × max upload duration".
65
+ * Optional abort signal. When fired, the upload pool stops QUEUEING new
66
+ * per-file work and the post-pool abort check throws `signal.reason` so the
67
+ * caller's `timeoutMs` budget surfaces as a proper TIMEOUT errorCode.
68
+ * Already-flying `client.files.upload` calls complete on their own — the SDK
69
+ * doesn't expose abort plumbing on `files.upload` — so the time an abort
70
+ * waits is bounded by "in-flight pool size × max upload duration", never by
71
+ * "total file count × max upload duration".
80
72
  */
81
73
  signal?: AbortSignal;
82
74
  /**
83
- * Caching mode (v1.13.0+). Controls whether `prepareContext` builds
84
- * an explicit Gemini Context Cache (`caches.create`) or falls through
85
- * to the inline path and relies on Gemini's automatic implicit
86
- * caching for Gemini 2.5+/3 models.
75
+ * Caching mode. Controls whether `prepareContext` builds an explicit Gemini
76
+ * Context Cache (`caches.create`) or falls through to the inline path and
77
+ * relies on Gemini's automatic implicit caching for Gemini 2.5+/3 models.
87
78
  *
88
- * - `'explicit'` (today's behaviour): build + reuse a Context Cache
89
- * for the workspace. Hard ~75 % discount on cached input. Pays
90
- * 60–180 s `caches.create` cost on file change.
91
- * - `'implicit'` (v1.13.0+ opt-in): skip `caches.create` entirely;
92
- * send file content inline every call. Gemini's automatic implicit
93
- * caching applies a discount when the prefix matches across calls
94
- * (4 096-token minimum, no guarantee). No rebuild wait on file
95
- * change. **Best fit for review→edit→review workflows** where
96
- * files change between queries.
97
- * - `undefined`: caller doesn't care; behave as `'explicit'` (the
98
- * v1.12.x default; flip planned for v1.14.0 pending dogfood
99
- * telemetry).
79
+ * - `'explicit'`: build + reuse a Context Cache for the workspace. Hard
80
+ * ~75 % discount on cached input. Pays 60–180 s `caches.create` cost on
81
+ * file change.
82
+ * - `'implicit'`: skip `caches.create` entirely; send file content inline
83
+ * every call. Gemini's automatic implicit caching applies a discount when
84
+ * the prefix matches across calls (4 096-token minimum, no guarantee). No
85
+ * rebuild wait on file change. **Best fit for review→edit→review
86
+ * workflows** where files change between queries.
87
+ * - `undefined`: behaves as `'explicit'`; the tools pass the mode they
88
+ * resolved from the call and the configuration.
100
89
  */
101
90
  cachingMode?: 'explicit' | 'implicit';
102
91
  }
@@ -1 +1 @@
1
- {"version":3,"file":"cache-manager.d.ts","sourceRoot":"","sources":["../../src/cache/cache-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAQ,MAAM,eAAe,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,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