@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,113 @@
1
+ /**
2
+ * `ask`'s fallback to `ask_agentic` (`onWorkspaceTooLarge: 'fallback-to-agentic'`): the workspace exceeds the eager
3
+ * path's window, so the question goes to the agentic loop and its result is wrapped for `ask`'s caller.
4
+ *
5
+ * The knobs (`docs/DESIGN-agentic-time-bounds.md`, "Target, `ask` fallback"): `ask` resolved its own once — per call,
6
+ * else `GEMINI_CODE_CONTEXT_ASK_TIMEOUT_MS` / `_STALL_MS`, the values its controller holds — and forwards them:
7
+ * `timeoutMs` → `iterationTimeoutMs` (a per-iteration cap: the agentic call can run `maxIterations × timeoutMs`), and
8
+ * `stallMs` → `stallMs` (the same heartbeat watchdog on the loop's streams). `ask`'s own controller is disposed at the
9
+ * hand-off; the agentic call keeps its own clocks, and its timeout messages name `ask`'s knobs.
10
+ */
11
+ import { logger } from '../utils/logger.js';
12
+ import { runAskAgentic } from './ask-agentic.tool.js';
13
+ import { TOOL_TIMEOUT_ENV } from './shared/abort-timeout.js';
14
+ /** The knobs a fallback's timeout message names: `ask`'s, which became the agentic call's. */
15
+ export const ASK_KNOB_NAMES = Object.freeze({
16
+ totalMs: 'timeoutMs',
17
+ totalEnv: TOOL_TIMEOUT_ENV.ask.totalEnvVar,
18
+ stallMs: 'stallMs',
19
+ stallEnv: TOOL_TIMEOUT_ENV.ask.stallEnvVar,
20
+ });
21
+ /** The agentic input: the question, its filters and thinking config, and `ask`'s resolved knobs. */
22
+ function agenticInputOf(input, timeout) {
23
+ return {
24
+ prompt: input.prompt,
25
+ ...(input.workspace !== undefined ? { workspace: input.workspace } : {}),
26
+ ...(input.model !== undefined ? { model: input.model } : {}),
27
+ ...(input.includeGlobs !== undefined ? { includeGlobs: input.includeGlobs } : {}),
28
+ ...(input.excludeGlobs !== undefined ? { excludeGlobs: input.excludeGlobs } : {}),
29
+ ...(input.thinkingBudget !== undefined ? { thinkingBudget: input.thinkingBudget } : {}),
30
+ ...(input.thinkingLevel !== undefined ? { thinkingLevel: input.thinkingLevel } : {}),
31
+ ...(input.maxOutputTokens !== undefined ? { maxOutputTokens: input.maxOutputTokens } : {}),
32
+ ...(timeout.timeoutMs !== null ? { iterationTimeoutMs: timeout.timeoutMs } : {}),
33
+ ...(timeout.stallMs !== null ? { stallMs: timeout.stallMs } : {}),
34
+ };
35
+ }
36
+ /** The knobs the fallback forwarded, as its result reports them; nothing when `ask` had none. */
37
+ function forwardedKnobs(timeout) {
38
+ return {
39
+ ...(timeout.timeoutMs !== null
40
+ ? { iterTimeoutMs: timeout.timeoutMs, iterTimeoutSource: 'timeoutMs' }
41
+ : {}),
42
+ ...(timeout.stallMs !== null ? { stallMs: timeout.stallMs } : {}),
43
+ };
44
+ }
45
+ /** A timeout's kind as the agentic result reports it, when it is one a caller knows (`total` | `stall`). */
46
+ const isTimeoutKind = (value) => value === 'total' || value === 'stall';
47
+ /**
48
+ * The agentic error's fields `ask`'s caller reads at the top level: `errorCode` and `retryable` (retry policies switch
49
+ * on them), and a timeout's `timeoutKind`, `timeoutPhase`, `timeoutSource`. Nothing when the agentic call answered.
50
+ */
51
+ function liftedError(isError, agentic) {
52
+ if (!isError)
53
+ return {};
54
+ const pick = (key, keep) => keep(agentic[key]) ? { [key]: agentic[key] } : {};
55
+ const isString = (value) => typeof value === 'string';
56
+ return {
57
+ ...pick('errorCode', isString),
58
+ ...pick('retryable', (value) => typeof value === 'boolean'),
59
+ ...pick('timeoutKind', isTimeoutKind),
60
+ ...pick('timeoutPhase', isString),
61
+ ...pick('timeoutSource', isString),
62
+ };
63
+ }
64
+ /** The prose the agentic call returned: its `responseText`, else its first text content. */
65
+ function responseTextOf(result, agentic) {
66
+ if (typeof agentic.responseText === 'string')
67
+ return agentic.responseText;
68
+ const first = result.content?.[0];
69
+ return first?.type === 'text' ? first.text : '';
70
+ }
71
+ /**
72
+ * The wrapped result: the agentic prose verbatim, `structuredContent` enriched with the fallback's trail (why, the
73
+ * preflight's estimate, the forwarded knobs), the lifted error fields, the agentic result whole under
74
+ * `agenticResult`, and `responseText` written LAST so no nested key of that name clobbers it. `isError` stays at the
75
+ * root of the result, as MCP has it.
76
+ */
77
+ function wrappedResult(fallback, result) {
78
+ const agentic = result.structuredContent ?? {};
79
+ const { preflight } = fallback;
80
+ const structured = {
81
+ fallbackApplied: 'ask_agentic',
82
+ serviceTier: 'standard', // ask_agentic has no tier: the fallback runs standard whatever was asked
83
+ ...(fallback.serviceTier === 'flex' ? { serviceTierDowngraded: 'flex' } : {}),
84
+ fallbackReason: 'WORKSPACE_TOO_LARGE',
85
+ preflightEstimate: {
86
+ tokens: preflight.effectiveTokens,
87
+ threshold: fallback.threshold,
88
+ source: preflight.method,
89
+ cacheHit: preflight.cacheHit,
90
+ rawTokens: preflight.rawTokens,
91
+ },
92
+ ...forwardedKnobs(fallback.timeout),
93
+ ...liftedError(result.isError === true, agentic),
94
+ ...(Object.keys(agentic).length > 0 ? { agenticResult: agentic } : {}),
95
+ responseText: responseTextOf(result, agentic),
96
+ };
97
+ return { ...result, structuredContent: structured };
98
+ }
99
+ /** Run the question through `ask_agentic` with `ask`'s knobs and wrap the result. */
100
+ export async function fallBackToAgentic(fallback) {
101
+ const { input, emitter, timeout } = fallback;
102
+ if (fallback.serviceTier === 'flex') {
103
+ const note = 'ask: the ask_agentic fallback has no service tier — this call runs standard, not flex';
104
+ emitter.emit(note);
105
+ logger.warn(note);
106
+ }
107
+ logger.warn(`ask: WORKSPACE_TOO_LARGE (${fallback.preflight.effectiveTokens} > ${fallback.threshold}); falling back to ask_agentic per onWorkspaceTooLarge='fallback-to-agentic' (iterationTimeoutMs ${timeout.timeoutMs ?? 'unset'}, stallMs ${timeout.stallMs ?? 'unset'})`);
108
+ const agenticInput = agenticInputOf(input, timeout);
109
+ timeout.dispose();
110
+ const result = await runAskAgentic(agenticInput, fallback.ctx, ASK_KNOB_NAMES);
111
+ return wrappedResult(fallback, result);
112
+ }
113
+ //# sourceMappingURL=ask-agentic-fallback.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ask-agentic-fallback.js","sourceRoot":"","sources":["../../src/tools/ask-agentic-fallback.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAG5C,OAAO,EAAwB,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAG5E,OAAO,EAAE,gBAAgB,EAA0B,MAAM,2BAA2B,CAAC;AAErF,8FAA8F;AAC9F,MAAM,CAAC,MAAM,cAAc,GAAc,MAAM,CAAC,MAAM,CAAC;IACrD,OAAO,EAAE,WAAW;IACpB,QAAQ,EAAE,gBAAgB,CAAC,GAAG,CAAC,WAAW;IAC1C,OAAO,EAAE,SAAS;IAClB,QAAQ,EAAE,gBAAgB,CAAC,GAAG,CAAC,WAAW;CAC3C,CAAC,CAAC;AAeH,oGAAoG;AACpG,SAAS,cAAc,CAAC,KAAe,EAAE,OAA0B;IACjE,OAAO;QACL,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,GAAG,CAAC,KAAK,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACxE,GAAG,CAAC,KAAK,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5D,GAAG,CAAC,KAAK,CAAC,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,EA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AQ,CAAC;IAC7C,IAAI,QAAQ,CAAC,WAAW,KAAK,MAAM,EAAE,CAAC;QACpC,MAAM,IAAI,GACR,uFAAuF,CAAC;QAC1F,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;IACD,MAAM,CAAC,IAAI,CACT,6BAA6B,QAAQ,CAAC,SAAS,CAAC,eAAe,MAAM,QAAQ,CAAC,SAAS,oGAAoG,OAAO,CAAC,SAAS,IAAI,OAAO,aAAa,OAAO,CAAC,OAAO,IAAI,OAAO,GAAG,CAClQ,CAAC;IACF,MAAM,YAAY,GAAG,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACpD,OAAO,CAAC,OAAO,EAAE,CAAC;IAClB,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,YAAY,EAAE,QAAQ,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;IAC/E,OAAO,aAAa,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;AACzC,CAAC"}
@@ -21,54 +21,21 @@
21
21
  * - Hard byte limits on tool responses (executors enforce)
22
22
  * - `realpath` + root jail (sandbox module)
23
23
  * - Prompt-injection defence in `systemInstruction`
24
- * - No-progress detection (same call signature 3× → partial answer)
24
+ * - No-progress detection (a call signature repeated with no new file read → partial answer)
25
25
  * - Parallel tool execution with concurrency cap
26
26
  * - Recoverable-error via `functionResponse.error`; hard-fail for
27
27
  * security / budget / timeouts
28
28
  * - `notifications/progress` per iteration for UX
29
29
  */
30
- import { z } from 'zod';
31
- import { type ToolDefinition } from './registry.js';
32
- export declare const askAgenticInputSchema: z.ZodObject<{
33
- prompt: z.ZodString;
34
- workspace: z.ZodOptional<z.ZodString>;
35
- model: z.ZodOptional<z.ZodString>;
36
- includeGlobs: z.ZodOptional<z.ZodArray<z.ZodString>>;
37
- excludeGlobs: z.ZodOptional<z.ZodArray<z.ZodString>>;
38
- thinkingBudget: z.ZodOptional<z.ZodNumber>;
39
- thinkingLevel: z.ZodOptional<z.ZodEnum<{
40
- HIGH: "HIGH";
41
- LOW: "LOW";
42
- MEDIUM: "MEDIUM";
43
- MINIMAL: "MINIMAL";
44
- XHIGH: "XHIGH";
45
- }>>;
46
- maxOutputTokens: z.ZodOptional<z.ZodNumber>;
47
- maxIterations: z.ZodOptional<z.ZodNumber>;
48
- maxTotalInputTokens: z.ZodOptional<z.ZodNumber>;
49
- maxFilesRead: z.ZodOptional<z.ZodNumber>;
50
- iterationTimeoutMs: z.ZodOptional<z.ZodNumber>;
51
- stallMs: z.ZodOptional<z.ZodNumber>;
52
- }, z.core.$strip>;
53
- export type AskAgenticInput = z.infer<typeof askAgenticInputSchema>;
54
- /** Read + clamp the tool-execution concurrency at dispatch time.
55
- *
56
- * Why a function not a top-level const: env vars can change between calls
57
- * within a long-lived MCP-server process (operator ctrl-Cs and re-launches
58
- * with a different value mid-session). Resolving per-call keeps behaviour
59
- * predictable. Cost: one env-read per iter; negligible vs the
60
- * `generateContent` round-trip dominating wall-clock.
61
- *
62
- * Clamps numeric inputs to `[1, 50]`. Only NaN / unset / empty falls back
63
- * to default. 50 cap prevents pathological "concurrency: 99999" misconfig
64
- * from spawning ~unbounded `read_file` Promise chains. 0 / negative inputs
65
- * clamp UP to 1 (= serial dispatch) — operators setting `0` or `-3` mean
66
- * "minimise parallelism", not "use the default" (the v1.15.1 PR-Round-1
67
- * 2-of-2 cross-reviewer correction: gemini-cli F2 + grok F1 flagged that
68
- * silently mapping operator-supplied `0` back to 10× was the opposite of
69
- * intent and a confusing UX on resource-constrained CI / Windows hosts).
70
- *
71
- * Exported for unit testing — not part of the public MCP surface. */
72
- export declare function resolveToolExecutionConcurrency(): number;
30
+ import { type AskAgenticInput } from './agentic/input.js';
31
+ import { type KnobNames } from './agentic/run.js';
32
+ import { type TextToolResult, type ToolContext, type ToolDefinition } from './registry.js';
33
+ export { resolveToolExecutionConcurrency } from './agentic/dispatch.js';
34
+ export { type AskAgenticInput, askAgenticInputSchema } from './agentic/input.js';
73
35
  export declare const askAgenticTool: ToolDefinition<AskAgenticInput>;
36
+ /**
37
+ * One `ask_agentic` call. `knobNames` are the knobs its timeout messages name: `ask_agentic`'s own, or `ask`'s when
38
+ * the call is `ask`'s fallback (its `timeoutMs` / `stallMs` became this call's `iterationTimeoutMs` / `stallMs`).
39
+ */
40
+ export declare function runAskAgentic(input: AskAgenticInput, ctx: ToolContext, knobNames: KnobNames): Promise<TextToolResult>;
74
41
  //# sourceMappingURL=ask-agentic.tool.d.ts.map
@@ -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;AAmBxB,OAAO,EAAE,KAAK,cAAc,EAA2B,MAAM,eAAe,CAAC;AAiB7E,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"}
1
+ {"version":3,"file":"ask-agentic.tool.d.ts","sourceRoot":"","sources":["../../src/tools/ask-agentic.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAQH,OAAO,EAAE,KAAK,eAAe,EAAyB,MAAM,oBAAoB,CAAC;AAIjF,OAAO,EAGL,KAAK,SAAS,EASf,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,cAAc,EAEpB,MAAM,eAAe,CAAC;AAIvB,OAAO,EAAE,+BAA+B,EAAE,MAAM,uBAAuB,CAAC;AACxE,OAAO,EAAE,KAAK,eAAe,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAMjF,eAAO,MAAM,cAAc,EAAE,cAAc,CAAC,eAAe,CAQ1D,CAAC;AAEF;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,eAAe,EACtB,GAAG,EAAE,WAAW,EAChB,SAAS,EAAE,SAAS,GACnB,OAAO,CAAC,cAAc,CAAC,CAKzB"}