@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
@@ -0,0 +1,66 @@
1
+ /**
2
+ * The input of `ask_agentic`: its zod schema (what the MCP host sees as the tool's input schema) and the type the
3
+ * call reads it as.
4
+ */
5
+ import { z } from 'zod';
6
+ import { PROMPT_FIELD, WORKSPACE_FIELD } from '../shared/question-fields.js';
7
+ import { THINKING_LEVEL_FIELD } from '../shared/thinking.js';
8
+ export const askAgenticInputSchema = z
9
+ .object({
10
+ prompt: PROMPT_FIELD,
11
+ workspace: WORKSPACE_FIELD,
12
+ model: z
13
+ .string()
14
+ .optional()
15
+ .describe("Model alias ('latest-pro', 'latest-pro-thinking', 'latest-flash') or literal model ID. Defaults to the configured default (GEMINI_CODE_CONTEXT_DEFAULT_MODEL, then the credentials profile, then `latest-pro-thinking`)."),
16
+ includeGlobs: z
17
+ .array(z.string())
18
+ .optional()
19
+ .describe('Additional file extensions or filenames to include. Honoured by the four agentic tools (`list_directory`, `find_files`, `read_file`, `grep`) — the model never sees paths outside these globs. Mirrors the `ask` / `code` semantics so callers (or `ask` → `ask_agentic` fallback in v1.9.0+) get consistent filtering.'),
20
+ excludeGlobs: z
21
+ .array(z.string())
22
+ .optional()
23
+ .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.'),
24
+ thinkingBudget: z.number().int().min(-1).max(65_536).optional(),
25
+ thinkingLevel: THINKING_LEVEL_FIELD,
26
+ maxOutputTokens: z.number().int().min(1).optional(),
27
+ maxIterations: z
28
+ .number()
29
+ .int()
30
+ .min(1)
31
+ .max(50)
32
+ .optional()
33
+ .describe("Hard cap on agentic LOOP iterations (each iteration = one Gemini generateContent + possible tool calls). Default 20. When the loop exhausts this cap without producing final-text, ONE additional non-tool `generateContent` (forced-finalization rescue) runs to synthesise an answer from gathered tool responses. **`structuredContent.apiCalls` is the authoritative total `generateContent` count** (loop iterations + 1 if the rescue dispatched, regardless of outcome). `convergenceForced: true` indicates ONLY that the rescue produced text successfully — an attempted-but-failed rescue increments `apiCalls` without setting `convergenceForced`. Rescue is bounded by `dailyBudgetUsd` and `iterationTimeoutMs`, else the finalization default (600 s per request); see `maxTotalInputTokens` for the cap-overshoot contract. **v1.15.0:** rescue-attempted-but-failed paths additionally surface `structuredContent.rescueErrorCode` (`'TIMEOUT' | 'RATE_LIMIT' | 'INTERNAL' | 'API_ERROR' | 'NETWORK' | 'EMPTY_TEXT'`) + `rescueErrorMessage` (truncated to 500 chars) so wrappers can branch retry behaviour without log scraping. Retry policy: TIMEOUT → raise iterationTimeoutMs; RATE_LIMIT → wait retry-hint window; INTERNAL → investigate code (don't retry blindly); API_ERROR → check status (don't retry 4xx); NETWORK → safe to retry; EMPTY_TEXT → narrow prompt."),
34
+ maxTotalInputTokens: z
35
+ .number()
36
+ .int()
37
+ .min(10_000)
38
+ .optional()
39
+ .describe("Cumulative input-token budget across all iterations. Default 1_000_000. Loop iterations HARD-STOP past this cap (subReason: 'AGENTIC_INPUT_BUDGET_EXCEEDED'). The post-loop forced-finalization rescue is NOT gated on this cap — it may push cumulative tokens past by one call's worth, signalled via `overBudget: true` on the result. Rescue cost remains bounded by `dailyBudgetUsd`; wall-clock by `iterationTimeoutMs`, else the finalization default (600 s per request)."),
40
+ maxFilesRead: z
41
+ .number()
42
+ .int()
43
+ .min(1)
44
+ .max(500)
45
+ .optional()
46
+ .describe('Cap on distinct files opened via `read_file` during this agentic call. Default 40.'),
47
+ iterationTimeoutMs: z
48
+ .number()
49
+ .int()
50
+ .min(1_000)
51
+ .max(1_800_000)
52
+ .optional()
53
+ .describe("Per-iteration wall-clock timeout in ms (1s–30min). Each agentic iteration (its TPM throttle wait, the request, its stream, the path resolution and the tool batch) is bounded by this: a tool batch is ended at this bound, not when it returns. **A single iteration that times out FAILS THE WHOLE agentic call** with `errorCode: 'TIMEOUT'` (the failed iteration's function-call results never came back, leaving the conversation structurally incomplete — continuing with partial state would 400 on the next turn); `timeoutPhase` says where it fired (`tpm-wait`, `opening`, `stream`, `tools`) and `timeoutSource` which bound (`iterationTimeoutMs`, `stallMs`, `default`, or `external` for a timeout no bound of the call raised). A TIMEOUT is `retryable: true` unless tool calls of the iteration still run after a 1 s grace (`retryable: false`, `toolCallsRunning`). The post-loop forced-finalization rescue pass is ALSO bounded by this timeout, but its timeout behaviour DIFFERS: rescue timeouts are caught best-effort and fall through to the original `subReason: 'AGENTIC_MAX_ITERATIONS'` shape with `errorCode: 'UNKNOWN'` (NOT `'TIMEOUT'`; `rescueErrorCode: 'TIMEOUT'`, `timeoutPhase` and `timeoutSource` say what fired) — the rescue is the documented exit path, and surfacing TIMEOUT for it would obscure the underlying maxIterations exhaustion. Operators detect rescue-attempted-but-failed via `apiCalls > iterations` and `convergenceForced` absent. Whole-loop budget is also bounded by `maxIterations` × `maxTotalInputTokens`. When omitted, falls back to env var `GEMINI_CODE_CONTEXT_AGENTIC_ITERATION_TIMEOUT_MS`; when neither is set, each phase has a default bound: 600 s for each request's opening (until its first chunk) and for each request of the forced-finalization pass, 120 s without progress in an iteration's path resolution and tool batch, and 600 s for a silent stream (a `stall`) unless `stallMs` is set."),
54
+ stallMs: z
55
+ .number()
56
+ .int()
57
+ .min(1_000)
58
+ .max(600_000)
59
+ .optional()
60
+ .describe('Per-iteration HEARTBEAT-AWARE stall watchdog in ms (1s–10min). Armed at a stream\'s first chunk and reset on every chunk yielded by `generateContentStream` (text or thought) — fires ONLY when the stream goes silent for this long. Does NOT fire while the model is actively thinking, and bounds neither a request\'s opening (before its first chunk) nor the tool batch: a batch longer than `stallMs` answers. Right knob for "kill dead sockets quickly without penalising deep reasoning." Recommended: `60_000` (60s). Falls back to env var `GEMINI_CODE_CONTEXT_AGENTIC_STALL_MS`; when neither it nor `iterationTimeoutMs` is set, a stream silent for 600 s is a stall. Returns `errorCode: "TIMEOUT"` with `timeoutKind: "stall"`, `timeoutPhase: "stream"` on abort. Independent of `iterationTimeoutMs` — both can be set; whichever fires first wins. **Loop iterations only — the post-loop forced-finalization rescue pass does not stream and has no stall watchdog.**'),
61
+ })
62
+ .refine((data) => !(data.thinkingBudget !== undefined && data.thinkingLevel !== undefined), {
63
+ message: 'Cannot specify both `thinkingBudget` and `thinkingLevel` — mutually exclusive (Gemini rejects).',
64
+ path: [],
65
+ });
66
+ //# sourceMappingURL=input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input.js","sourceRoot":"","sources":["../../../src/tools/agentic/input.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAE7D,MAAM,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SACR,GAAG,EAAE;SACL,GAAG,CAAC,KAAK,CAAC;SACV,GAAG,CAAC,SAAS,CAAC;SACd,QAAQ,EAAE;SACV,QAAQ,CACP,63DAA63D,CAC93D;IACH,OAAO,EAAE,CAAC;SACP,MAAM,EAAE;SACR,GAAG,EAAE;SACL,GAAG,CAAC,KAAK,CAAC;SACV,GAAG,CAAC,OAAO,CAAC;SACZ,QAAQ,EAAE;SACV,QAAQ,CACP,67BAA67B,CAC97B;CACJ,CAAC;KACD,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,KAAK,SAAS,IAAI,IAAI,CAAC,aAAa,KAAK,SAAS,CAAC,EAAE;IAC1F,OAAO,EACL,iGAAiG;IACnG,IAAI,EAAE,EAAE;CACT,CAAC,CAAC"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * What `ask_agentic` sends the model besides the conversation: the system instructions of the loop and of the
3
+ * forced-finalization pass, and the declarations of the four sandboxed tools the loop may call.
4
+ */
5
+ import type { FunctionDeclaration } from '@google/genai';
6
+ export declare const SYSTEM_INSTRUCTION_AGENTIC: string;
7
+ /**
8
+ * Forced-finalization system instruction. Sent on the post-loop synthesis
9
+ * pass when the iteration budget is exhausted. Combined with
10
+ * `toolConfig.functionCallingConfig.mode = NONE`, the model is prohibited
11
+ * from emitting further function calls (per Gemini API spec, NONE mode is
12
+ * "equivalent to sending a request without any function declarations") and
13
+ * must answer with text using the conversation it has already accumulated.
14
+ *
15
+ * Tightened in v1.14.4 after empirical replay (2026-04-30) showed Gemini 3 Pro
16
+ * under HIGH thinking treating the previous "Synthesize the evidence ... in
17
+ * the format the user originally requested" wording as an invitation to
18
+ * narrate its thought process — producing stream-of-consciousness output
19
+ * instead of the structured findings the caller requested. The CRITICAL
20
+ * OUTPUT INSTRUCTIONS block below is authoritative ordering: parse the
21
+ * caller's format spec, synthesize evidence into it, no preamble, no narrative,
22
+ * no apologies. The user's original prompt (with any output-format directive)
23
+ * is preserved across the rescue via `contents[0]`, so the model has the
24
+ * format spec available — the system instruction's job is to enforce
25
+ * compliance.
26
+ *
27
+ * SAFETY: this rescue runs with `mode: NONE` (tools disabled) but still
28
+ * evaluates the FULL conversation history including any malicious payloads
29
+ * surfaced by prior `read_file` / `grep` results (LLM calls are stateless
30
+ * per Gemini API semantics — each turn's output is generated under THAT
31
+ * turn's systemInstruction). The shared `SYSTEM_INSTRUCTION_SAFETY_AGENTIC` block
32
+ * (data-vs-instruction firewall) is therefore prepended below. A 3-of-3
33
+ * cross-reviewer audit on 2026-04-30 (gemini-cli + gemini-chat + grok)
34
+ * flagged the prior absence as an indirect-prompt-injection vector.
35
+ *
36
+ * v1.15.0 (C2): citation directive conditionalised symmetrically with the
37
+ * "Unknown" handling — both gemini-chat (Round-2) and Copilot (Round-1)
38
+ * flagged the v1.14.4 unconditional `Cite specific file:line` as a
39
+ * potential format-break for strict JSON / fixed-shape outputs (e.g., a
40
+ * pure JSON array of strings can't carry `(file:42)` annotations without
41
+ * mutating the data). Now reads "ONLY where the requested format provides
42
+ * a compatible place to put citations".
43
+ */
44
+ export declare const SYSTEM_INSTRUCTION_FINALIZATION: string;
45
+ export declare function buildFunctionDeclarations(): FunctionDeclaration[];
46
+ //# sourceMappingURL=instructions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instructions.d.ts","sourceRoot":"","sources":["../../../src/tools/agentic/instructions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAU,MAAM,eAAe,CAAC;AAmBjE,eAAO,MAAM,0BAA0B,QA0B3B,CAAC;AAEb;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,eAAO,MAAM,+BAA+B,QAYhC,CAAC;AAqFb,wBAAgB,yBAAyB,IAAI,mBAAmB,EAAE,CAOjE"}
@@ -0,0 +1,170 @@
1
+ /**
2
+ * What `ask_agentic` sends the model besides the conversation: the system instructions of the loop and of the
3
+ * forced-finalization pass, and the declarations of the four sandboxed tools the loop may call.
4
+ */
5
+ import { Type as GeminiType } from '@google/genai';
6
+ import { SYSTEM_INSTRUCTION_SAFETY_AGENTIC } from '../shared/system-instruction-safety.js';
7
+ // ---------------------------------------------------------------------------
8
+ // systemInstruction — prompt-injection defence + tool usage guidance
9
+ // ---------------------------------------------------------------------------
10
+ // Safety preamble — moved to `../shared/system-instruction-safety.ts` in v1.15.2
11
+ // so `ask` and `code` can share the same firewall. See that module for the
12
+ // full rationale + threat model. Two variants exist (AGENTIC vs EAGER) because
13
+ // the data-vs-instruction wording must match the file-delivery channel.
14
+ //
15
+ // `ask_agentic` uses the AGENTIC variant (references the four agentic
16
+ // executors that surface file content into `conversation`). The rescue pass
17
+ // uses the same variant — even though tool dispatch is disabled on the
18
+ // rescue, the conversation history still contains tool-response data that
19
+ // could carry adversarial text, so the firewall stays in effect.
20
+ export const SYSTEM_INSTRUCTION_AGENTIC = [
21
+ 'You are a senior code reviewer analysing a user codebase via sandboxed file-access tools.',
22
+ '',
23
+ SYSTEM_INSTRUCTION_SAFETY_AGENTIC,
24
+ '',
25
+ '# TOOLS AVAILABLE',
26
+ '- `list_directory(path)` — list immediate children (files + subdirs) of a workspace-relative path. Start with `"."` to see the root.',
27
+ '- `find_files(pattern)` — recursive glob (`*` any-except-slash, `**` any). Good for locating files by name without reading them.',
28
+ '- `read_file(path, startLine?, endLine?)` — read a file (or slice). Responses are hard-capped at 200 KB; you will see `truncated: true` with `totalLines` metadata — page through large files via startLine/endLine.',
29
+ '- `grep(pattern, pathPrefix?)` — JS RegExp search. Great for finding symbols before opening files.',
30
+ '',
31
+ '# STRATEGY',
32
+ 'Prefer narrow tool calls over wide ones. A typical flow:',
33
+ '1. Scout with `list_directory(".")` or `find_files("**/*.ts")`',
34
+ '2. Locate relevant symbols with `grep`',
35
+ '3. Open only the handful of files that actually bear on the question via `read_file`',
36
+ 'When you have enough context, respond with a plain-text answer and make NO further tool calls.',
37
+ 'Batch your tool calls within a single iteration. If you need to read 5 files, issue all 5 `read_file` calls in ONE turn rather than one-per-iteration across 5 turns — each iteration costs 30-60s of thinking-token latency that you only pay once when calls are batched. The dispatcher runs the batch in parallel (up to 10 concurrent by default). Only batch calls for paths you have already seen in prior tool results (e.g., from `list_directory`, `find_files`, or `grep` output) or that the user provided. Never synthesize or guess additional paths solely to fill a batch — a hallucinated path costs the same iteration latency as the split you were trying to avoid, and the executors will reject it.',
38
+ '',
39
+ '# DECISIVENESS',
40
+ "Be decisive. Once you have read the relevant files and gathered evidence, produce your final answer. Continuing to call tools when you already have an answer is a failure mode — it wastes the user's budget and delays the response.",
41
+ 'When the user provides a complete diff inline, your primary task is reasoning ABOUT the diff. Read each touched file at most once unless a specific concern requires re-reading; do not recursively explore the project tree to verify what the diff already shows.',
42
+ 'A focused investigation typically converges in 3–8 iterations. If you find yourself on iteration 10+ still calling tools, stop and synthesize what you know — state findings as Known / Unknown / Next checks rather than chasing completeness.',
43
+ '',
44
+ '# OUTPUT',
45
+ "Your final response (the one with no function calls) should directly answer the user's prompt. Cite specific `file:line` when referring to code. Be concrete; do not speculate beyond what you read.",
46
+ ].join('\n');
47
+ /**
48
+ * Forced-finalization system instruction. Sent on the post-loop synthesis
49
+ * pass when the iteration budget is exhausted. Combined with
50
+ * `toolConfig.functionCallingConfig.mode = NONE`, the model is prohibited
51
+ * from emitting further function calls (per Gemini API spec, NONE mode is
52
+ * "equivalent to sending a request without any function declarations") and
53
+ * must answer with text using the conversation it has already accumulated.
54
+ *
55
+ * Tightened in v1.14.4 after empirical replay (2026-04-30) showed Gemini 3 Pro
56
+ * under HIGH thinking treating the previous "Synthesize the evidence ... in
57
+ * the format the user originally requested" wording as an invitation to
58
+ * narrate its thought process — producing stream-of-consciousness output
59
+ * instead of the structured findings the caller requested. The CRITICAL
60
+ * OUTPUT INSTRUCTIONS block below is authoritative ordering: parse the
61
+ * caller's format spec, synthesize evidence into it, no preamble, no narrative,
62
+ * no apologies. The user's original prompt (with any output-format directive)
63
+ * is preserved across the rescue via `contents[0]`, so the model has the
64
+ * format spec available — the system instruction's job is to enforce
65
+ * compliance.
66
+ *
67
+ * SAFETY: this rescue runs with `mode: NONE` (tools disabled) but still
68
+ * evaluates the FULL conversation history including any malicious payloads
69
+ * surfaced by prior `read_file` / `grep` results (LLM calls are stateless
70
+ * per Gemini API semantics — each turn's output is generated under THAT
71
+ * turn's systemInstruction). The shared `SYSTEM_INSTRUCTION_SAFETY_AGENTIC` block
72
+ * (data-vs-instruction firewall) is therefore prepended below. A 3-of-3
73
+ * cross-reviewer audit on 2026-04-30 (gemini-cli + gemini-chat + grok)
74
+ * flagged the prior absence as an indirect-prompt-injection vector.
75
+ *
76
+ * v1.15.0 (C2): citation directive conditionalised symmetrically with the
77
+ * "Unknown" handling — both gemini-chat (Round-2) and Copilot (Round-1)
78
+ * flagged the v1.14.4 unconditional `Cite specific file:line` as a
79
+ * potential format-break for strict JSON / fixed-shape outputs (e.g., a
80
+ * pure JSON array of strings can't carry `(file:42)` annotations without
81
+ * mutating the data). Now reads "ONLY where the requested format provides
82
+ * a compatible place to put citations".
83
+ */
84
+ export const SYSTEM_INSTRUCTION_FINALIZATION = [
85
+ SYSTEM_INSTRUCTION_SAFETY_AGENTIC,
86
+ '',
87
+ 'You are wrapping up an investigation. The conversation history above already contains the tool responses you have gathered.',
88
+ 'Your iteration budget is now exhausted. You CANNOT call any more tools — function calling is disabled for this turn.',
89
+ '',
90
+ 'CRITICAL OUTPUT INSTRUCTIONS:',
91
+ "1. PARSE the user's original prompt for exact output format specifications (e.g., markdown headers, JSON shape, tables).",
92
+ '2. STRICTLY follow that requested structure.',
93
+ '3. Synthesize the gathered evidence into the final answer and output it DIRECTLY in the requested structure. Provide NO preamble, NO apologies, NO "Here is the summary", and NO internal thinking or narrative notes.',
94
+ '',
95
+ 'If some details remain unverified, integrate an "Unknown" element ONLY if it is compatible with the parsed output shape (e.g., adds a row to a table, a field to a JSON object, a sub-bullet under a heading); never add extraneous keys or sections that would invalidate the requested format. Cite specific `file:line` for the claims you can support — but ONLY where the requested format provides a compatible place to put citations (e.g., a sub-bullet, an additional column, embedded inside an existing string field); never break the requested structure to add citations.',
96
+ ].join('\n');
97
+ // ---------------------------------------------------------------------------
98
+ // Function declarations — these get serialised and sent to Gemini so the
99
+ // model knows which tools it may invoke + what arguments each takes.
100
+ //
101
+ // Schemas use the SDK's Upper-Case type enum values (`STRING`, `INTEGER`,
102
+ // `OBJECT`). Each declaration is built fresh per call, so no request shares
103
+ // an object with another.
104
+ // ---------------------------------------------------------------------------
105
+ const stringProp = (description) => ({ type: GeminiType.STRING, description });
106
+ const intProp = (description) => ({ type: GeminiType.INTEGER, description });
107
+ function listDirectoryDeclaration() {
108
+ return {
109
+ name: 'list_directory',
110
+ description: 'List the immediate children (files + subdirectories) of a workspace-relative directory path. Does NOT recurse. Excluded directories (node_modules, .git, .next, etc.) and denylisted filenames (lockfiles, .env, etc.) are silently filtered out.',
111
+ parameters: {
112
+ type: GeminiType.OBJECT,
113
+ properties: {
114
+ path: stringProp('Workspace-relative directory path. Use "." for the workspace root. No leading `/`.'),
115
+ },
116
+ required: ['path'],
117
+ },
118
+ };
119
+ }
120
+ function findFilesDeclaration() {
121
+ return {
122
+ name: 'find_files',
123
+ description: 'Recursive glob search for files under the workspace root. Supports `*` (match any character except `/`) and `**` (match any character including `/`). Examples: `**/*.ts`, `src/**/index.*`, `README.md`. Respects the same default excludes as list_directory.',
124
+ parameters: {
125
+ type: GeminiType.OBJECT,
126
+ properties: {
127
+ pattern: stringProp('Glob pattern relative to workspace root. Uses `*` and `**` only (no `?`, no character classes, no `{a,b}`). Match is anchored — the pattern must match the whole relative path.'),
128
+ },
129
+ required: ['pattern'],
130
+ },
131
+ };
132
+ }
133
+ function readFileDeclaration() {
134
+ return {
135
+ name: 'read_file',
136
+ description: 'Read a file from the workspace, optionally a line-range slice. Responses are hard-capped at 200 KB; if the file is larger you get a head-truncated slice with `truncated: true` and `totalLines` metadata. Call again with `startLine` / `endLine` to page through. Rejects binary / non-source extensions.',
137
+ parameters: {
138
+ type: GeminiType.OBJECT,
139
+ properties: {
140
+ path: stringProp('Workspace-relative file path.'),
141
+ startLine: intProp('1-indexed inclusive start line. Omit for line 1.'),
142
+ endLine: intProp('1-indexed inclusive end line. Omit to read until the default or byte cap kicks in.'),
143
+ },
144
+ required: ['path'],
145
+ },
146
+ };
147
+ }
148
+ function grepDeclaration() {
149
+ return {
150
+ name: 'grep',
151
+ description: 'Regular-expression search through source files in the workspace. Pattern is compiled as a JavaScript RegExp (standard metacharacters). Each match line is capped at 500 characters. At most 100 matches per call.',
152
+ parameters: {
153
+ type: GeminiType.OBJECT,
154
+ properties: {
155
+ pattern: stringProp('JavaScript regular-expression pattern (unanchored, no flags).'),
156
+ pathPrefix: stringProp('Optional: limit search to files under this workspace-relative directory prefix.'),
157
+ },
158
+ required: ['pattern'],
159
+ },
160
+ };
161
+ }
162
+ export function buildFunctionDeclarations() {
163
+ return [
164
+ listDirectoryDeclaration(),
165
+ findFilesDeclaration(),
166
+ readFileDeclaration(),
167
+ grepDeclaration(),
168
+ ];
169
+ }
170
+ //# sourceMappingURL=instructions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instructions.js","sourceRoot":"","sources":["../../../src/tools/agentic/instructions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,iCAAiC,EAAE,MAAM,wCAAwC,CAAC;AAE3F,8EAA8E;AAC9E,qEAAqE;AACrE,8EAA8E;AAE9E,iFAAiF;AACjF,2EAA2E;AAC3E,+EAA+E;AAC/E,wEAAwE;AACxE,EAAE;AACF,sEAAsE;AACtE,4EAA4E;AAC5E,uEAAuE;AACvE,0EAA0E;AAC1E,iEAAiE;AAEjE,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,2FAA2F;IAC3F,EAAE;IACF,iCAAiC;IACjC,EAAE;IACF,mBAA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C;SACT;KACZ,CAAC;AACJ,CAAC;AAED,SAAS,oBAAoB;IAC3B,OAAO;QACL,IAAI,EAAE,YAAY;QAClB,WAAW,EACT,iQAAiQ;QACnQ,UAAU,EAAE;YACV,IAAI,EAAE,UAAU,CAAC,MAAM;YACvB,UAAU,EAAE;gBACV,OAAO,EAAE,UAAU,CACjB,iLAAiL,CAClL;aACF;YACD,QAAQ,EAAE,CAAC,SAAS,CAAC;SACZ;KACZ,CAAC;AACJ,CAAC;AAED,SAAS,mBAAmB;IAC1B,OAAO;QACL,IAAI,EAAE,WAAW;QACjB,WAAW,EACT,6SAA6S;QAC/S,UAAU,EAAE;YACV,IAAI,EAAE,UAAU,CAAC,MAAM;YACvB,UAAU,EAAE;gBACV,IAAI,EAAE,UAAU,CAAC,+BAA+B,CAAC;gBACjD,SAAS,EAAE,OAAO,CAAC,kDAAkD,CAAC;gBACtE,OAAO,EAAE,OAAO,CACd,oFAAoF,CACrF;aACF;YACD,QAAQ,EAAE,CAAC,MAAM,CAAC;SACT;KACZ,CAAC;AACJ,CAAC;AAED,SAAS,eAAe;IACtB,OAAO;QACL,IAAI,EAAE,MAAM;QACZ,WAAW,EACT,mNAAmN;QACrN,UAAU,EAAE;YACV,IAAI,EAAE,UAAU,CAAC,MAAM;YACvB,UAAU,EAAE;gBACV,OAAO,EAAE,UAAU,CAAC,+DAA+D,CAAC;gBACpF,UAAU,EAAE,UAAU,CACpB,iFAAiF,CAClF;aACF;YACD,QAAQ,EAAE,CAAC,SAAS,CAAC;SACZ;KACZ,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,yBAAyB;IACvC,OAAO;QACL,wBAAwB,EAAE;QAC1B,oBAAoB,EAAE;QACtB,mBAAmB,EAAE;QACrB,eAAe,EAAE;KAClB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,81 @@
1
+ /**
2
+ * One iteration of the `ask_agentic` loop: one streamed `generateContent` and, when the model asked for function
3
+ * calls, one parallel batch of tool executions whose responses are appended to the conversation. Every phase reads its
4
+ * bound from the pass's clock: each request's opening and its stream through the SDK's abort signal, the tools phase
5
+ * (path resolution and the batch, raced as one) through `abortable`, the workers' check before each call and the
6
+ * executors' checkpoints, which also report their progress to the clock.
7
+ */
8
+ import type { Content, GenerateContentConfig } from '@google/genai';
9
+ import type { MatchConfig } from '../../indexer/globs.js';
10
+ import type { ToolContext } from '../registry.js';
11
+ import { type ToolCall } from './dispatch.js';
12
+ import { type PassCall } from './ledger.js';
13
+ import type { PassClock } from './pass-clock.js';
14
+ import { type UsageCounts } from './response.js';
15
+ export interface IterationResult {
16
+ /** Text from the final model turn (no function calls) — or null when
17
+ * the model requested more function calls. */
18
+ finalText: string | null;
19
+ functionCallCount: number;
20
+ /** Tool-call signatures observed in THIS iteration (for no-progress
21
+ * detection). Empty on a final-text iteration. */
22
+ signatures: ToolCall[];
23
+ usage: UsageCounts;
24
+ thinkingSummary: string | null;
25
+ /** Approximate token count of the tool-response Parts appended to
26
+ * `conversation` after this iteration's `[model fc]` turn. Bytes/4
27
+ * heuristic — over-estimates dense Unicode but bias is intentional
28
+ * (post-loop rescue's TPM/budget reservation needs to over-reserve
29
+ * rather than under-reserve, which would risk a 429 mid-rescue).
30
+ *
31
+ * Used by the rescue's `finalizationEstimate` (P5/v1.15.0): the rescue
32
+ * replays the entire accumulated conversation, so its actual prompt
33
+ * size ≈ `lastIterationPromptTokens` + size of the tool-response Parts
34
+ * appended AFTER that iteration's `generateContent` returned. Pre-P5
35
+ * the estimate omitted the tool-response delta, undershooting by 100k+
36
+ * tokens when the final iter read several large files concurrently
37
+ * (post-v1.15.1 default `TOOL_EXECUTION_CONCURRENCY = 10`; operator
38
+ * override via `GEMINI_CODE_CONTEXT_AGENTIC_TOOL_CONCURRENCY`). */
39
+ toolResponseTokens: number;
40
+ }
41
+ export interface IterationArgs {
42
+ ctx: ToolContext;
43
+ resolvedModel: string;
44
+ conversation: Content[];
45
+ baseConfig: GenerateContentConfig;
46
+ workspaceRoot: string;
47
+ filesReadSet: Set<string>;
48
+ maxFilesRead: number;
49
+ /** The pass's clock: its signal threads into `withNetworkRetry`, the SDK config and the tools phase; each request
50
+ * enters `opening`, and so does a retry's announcement, so the backoff before a request runs under a fresh default;
51
+ * every chunk reaches `recordChunk`; the tools phase is entered the moment the call completed and its executors'
52
+ * progress reaches `recordProgress`. */
53
+ clock: PassClock;
54
+ /** The pass's model call: marked completed once the stream ended, then given the usage read (`completeCall`). */
55
+ call: PassCall;
56
+ /** User glob filters (v1.9.0+). Honoured by all four agentic executors so
57
+ * a fallback from `ask` (which already applies the same globs to its
58
+ * eager scanner) preserves filter semantics — no privacy regression. */
59
+ matchConfig: MatchConfig;
60
+ /** Surface live thought-chunk previews via the MCP progress channel
61
+ * (T33, v1.16.2). Mirrors the ask/code streaming UX. */
62
+ onThoughtChunk: (text: string) => void;
63
+ }
64
+ /** How an iteration ended: with its result, or at the bound of its tools phase. */
65
+ export type IterationOutcome = {
66
+ readonly kind: 'done';
67
+ readonly iteration: IterationResult;
68
+ } | {
69
+ readonly kind: 'tools-timed-out';
70
+ readonly running: number;
71
+ };
72
+ /**
73
+ * Run one iteration. The model's response (including the function calls) is recorded so the next turn has full
74
+ * context — Gemini requires the full call-response pair to stay in the conversation; both turns are appended only when
75
+ * the tools phase answered. The non-capped calls are dispatched in parallel; the concurrency resolves per call from the
76
+ * env override (`GEMINI_CODE_CONTEXT_AGENTIC_TOOL_CONCURRENCY`), default 10. Remaining `null` slots shouldn't happen in
77
+ * practice (every call gets either a short-circuit or a dispatched response), but are skipped rather than sending a
78
+ * malformed turn to Gemini.
79
+ */
80
+ export declare function runAgenticIteration(args: IterationArgs): Promise<IterationOutcome>;
81
+ //# sourceMappingURL=iteration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"iteration.d.ts","sourceRoot":"","sources":["../../../src/tools/agentic/iteration.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAgB,qBAAqB,EAAQ,MAAM,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