@qmediat.io/gemini-code-context-mcp 1.25.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 (107) hide show
  1. package/CHANGELOG.md +21 -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/run.d.ts.map +1 -1
  22. package/dist/tools/agentic/run.js +3 -6
  23. package/dist/tools/agentic/run.js.map +1 -1
  24. package/dist/tools/ask/answer.d.ts +9 -0
  25. package/dist/tools/ask/answer.d.ts.map +1 -0
  26. package/dist/tools/ask/answer.js +28 -0
  27. package/dist/tools/ask/answer.js.map +1 -0
  28. package/dist/tools/ask/attachments.d.ts +25 -0
  29. package/dist/tools/ask/attachments.d.ts.map +1 -0
  30. package/dist/tools/ask/attachments.js +85 -0
  31. package/dist/tools/ask/attachments.js.map +1 -0
  32. package/dist/tools/ask/call.d.ts +61 -0
  33. package/dist/tools/ask/call.d.ts.map +1 -0
  34. package/dist/tools/ask/call.js +6 -0
  35. package/dist/tools/ask/call.js.map +1 -0
  36. package/dist/tools/ask/guard.d.ts +24 -0
  37. package/dist/tools/ask/guard.d.ts.map +1 -0
  38. package/dist/tools/ask/guard.js +79 -0
  39. package/dist/tools/ask/guard.js.map +1 -0
  40. package/dist/tools/ask/input.d.ts +45 -0
  41. package/dist/tools/ask/input.d.ts.map +1 -0
  42. package/dist/tools/ask/input.js +93 -0
  43. package/dist/tools/ask/input.js.map +1 -0
  44. package/dist/tools/ask/instruction.d.ts +8 -0
  45. package/dist/tools/ask/instruction.d.ts.map +1 -0
  46. package/dist/tools/ask/instruction.js +13 -0
  47. package/dist/tools/ask/instruction.js.map +1 -0
  48. package/dist/tools/ask/request.d.ts +14 -0
  49. package/dist/tools/ask/request.d.ts.map +1 -0
  50. package/dist/tools/ask/request.js +38 -0
  51. package/dist/tools/ask/request.js.map +1 -0
  52. package/dist/tools/ask/results.d.ts +23 -0
  53. package/dist/tools/ask/results.d.ts.map +1 -0
  54. package/dist/tools/ask/results.js +107 -0
  55. package/dist/tools/ask/results.js.map +1 -0
  56. package/dist/tools/ask/setup.d.ts +22 -0
  57. package/dist/tools/ask/setup.d.ts.map +1 -0
  58. package/dist/tools/ask/setup.js +57 -0
  59. package/dist/tools/ask/setup.js.map +1 -0
  60. package/dist/tools/ask/sizing.d.ts +10 -0
  61. package/dist/tools/ask/sizing.d.ts.map +1 -0
  62. package/dist/tools/ask/sizing.js +33 -0
  63. package/dist/tools/ask/sizing.js.map +1 -0
  64. package/dist/tools/ask/thinking.d.ts +54 -0
  65. package/dist/tools/ask/thinking.d.ts.map +1 -0
  66. package/dist/tools/ask/thinking.js +69 -0
  67. package/dist/tools/ask/thinking.js.map +1 -0
  68. package/dist/tools/ask-agentic-fallback.d.ts +1 -1
  69. package/dist/tools/ask-agentic-fallback.d.ts.map +1 -1
  70. package/dist/tools/ask-agentic.tool.d.ts.map +1 -1
  71. package/dist/tools/ask-agentic.tool.js +4 -10
  72. package/dist/tools/ask-agentic.tool.js.map +1 -1
  73. package/dist/tools/ask.tool.d.ts +3 -41
  74. package/dist/tools/ask.tool.d.ts.map +1 -1
  75. package/dist/tools/ask.tool.js +46 -795
  76. package/dist/tools/ask.tool.js.map +1 -1
  77. package/dist/tools/code.tool.d.ts.map +1 -1
  78. package/dist/tools/code.tool.js +375 -502
  79. package/dist/tools/code.tool.js.map +1 -1
  80. package/dist/tools/reindex.tool.d.ts.map +1 -1
  81. package/dist/tools/reindex.tool.js +19 -22
  82. package/dist/tools/reindex.tool.js.map +1 -1
  83. package/dist/tools/shared/eager-answer.d.ts +78 -0
  84. package/dist/tools/shared/eager-answer.d.ts.map +1 -0
  85. package/dist/tools/shared/eager-answer.js +130 -0
  86. package/dist/tools/shared/eager-answer.js.map +1 -0
  87. package/dist/tools/shared/eager-call.d.ts +114 -0
  88. package/dist/tools/shared/eager-call.d.ts.map +1 -0
  89. package/dist/tools/shared/eager-call.js +95 -0
  90. package/dist/tools/shared/eager-call.js.map +1 -0
  91. package/dist/tools/shared/eager-steps.d.ts +114 -0
  92. package/dist/tools/shared/eager-steps.d.ts.map +1 -0
  93. package/dist/tools/shared/eager-steps.js +152 -0
  94. package/dist/tools/shared/eager-steps.js.map +1 -0
  95. package/dist/tools/shared/service-tier.d.ts +9 -0
  96. package/dist/tools/shared/service-tier.d.ts.map +1 -1
  97. package/dist/tools/shared/service-tier.js +15 -0
  98. package/dist/tools/shared/service-tier.js.map +1 -1
  99. package/dist/tools/shared/thinking.d.ts +9 -0
  100. package/dist/tools/shared/thinking.d.ts.map +1 -1
  101. package/dist/tools/shared/thinking.js +10 -0
  102. package/dist/tools/shared/thinking.js.map +1 -1
  103. package/dist/tools/shared/workspace-refusal.d.ts +13 -0
  104. package/dist/tools/shared/workspace-refusal.d.ts.map +1 -0
  105. package/dist/tools/shared/workspace-refusal.js +23 -0
  106. package/dist/tools/shared/workspace-refusal.js.map +1 -0
  107. package/package.json +1 -1
@@ -0,0 +1,61 @@
1
+ /**
2
+ * One `ask` call as it grows: each stage adds what its step produced — nothing optional. A step's outcome
3
+ * (`StepOutcome`, `../shared/eager-call.ts`) says whether the call goes on or ends with a result.
4
+ */
5
+ import type { Part } from '@google/genai';
6
+ import type { Attachment } from '../../attachments.js';
7
+ import type { BoundedOutputCap, OutputCap } from '../../gemini/long-decode.js';
8
+ import type { ScanResult } from '../../indexer/workspace-scanner.js';
9
+ import type { ResolvedModel } from '../../types.js';
10
+ import type { ToolContext } from '../registry.js';
11
+ import type { EagerCall, ModelReached } from '../shared/eager-call.js';
12
+ import type { InputEstimate, PreflightCount } from '../shared/eager-steps.js';
13
+ import type { ServiceTierName } from '../shared/service-tier.js';
14
+ import type { AskInput } from './input.js';
15
+ import type { AskThinking } from './thinking.js';
16
+ /** The call as the entry opened it. */
17
+ export interface AskCall {
18
+ readonly input: AskInput;
19
+ readonly ctx: ToolContext;
20
+ /** The alias or id as asked. */
21
+ readonly model: string;
22
+ readonly eager: EagerCall<ModelReached>;
23
+ }
24
+ /** The model and the tier resolved. */
25
+ export interface AskResolved extends AskCall {
26
+ readonly resolved: ResolvedModel;
27
+ readonly serviceTier: ServiceTierName;
28
+ }
29
+ /** The attachments of one call, inspected, read and counted by Gemini. */
30
+ export interface PreparedAttachments {
31
+ readonly attached: Attachment[];
32
+ readonly parts: Part[];
33
+ /** Raw bytes read. */
34
+ readonly bytes: number;
35
+ /** What Gemini counted for the parts. */
36
+ readonly tokens: number;
37
+ }
38
+ /** The attachments inspected, read and counted. */
39
+ export interface AskAttached extends AskResolved {
40
+ readonly attachments: PreparedAttachments;
41
+ }
42
+ /** The workspace scanned, the output cap asked for, the input estimated; no refusal over them. */
43
+ export interface AskScanned extends AskAttached {
44
+ readonly scan: ScanResult;
45
+ readonly outputCap: OutputCap;
46
+ readonly estimate: InputEstimate;
47
+ }
48
+ /** The input counted and held against the model's window. */
49
+ export interface AskCounted extends AskScanned {
50
+ /** `null`: the model advertises no input limit; the guard did not run. */
51
+ readonly count: PreflightCount | null;
52
+ }
53
+ /**
54
+ * The cap that runs — after the input window's cut — and the thinking under it: the call as the budget reservation,
55
+ * the decode and the settlement read it (`SizedCall`), and as the request and the answer read it.
56
+ */
57
+ export interface AskSized extends AskCounted {
58
+ readonly bounded: BoundedOutputCap;
59
+ readonly thinking: AskThinking;
60
+ }
61
+ //# sourceMappingURL=call.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"call.d.ts","sourceRoot":"","sources":["../../../src/tools/ask/call.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAC/E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC9E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,uCAAuC;AACvC,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;IACzB,QAAQ,CAAC,GAAG,EAAE,WAAW,CAAC;IAC1B,gCAAgC;IAChC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC,YAAY,CAAC,CAAC;CACzC;AAED,uCAAuC;AACvC,MAAM,WAAW,WAAY,SAAQ,OAAO;IAC1C,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;IACjC,QAAQ,CAAC,WAAW,EAAE,eAAe,CAAC;CACvC;AAED,0EAA0E;AAC1E,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,QAAQ,EAAE,UAAU,EAAE,CAAC;IAChC,QAAQ,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC;IACvB,sBAAsB;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,yCAAyC;IACzC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,mDAAmD;AACnD,MAAM,WAAW,WAAY,SAAQ,WAAW;IAC9C,QAAQ,CAAC,WAAW,EAAE,mBAAmB,CAAC;CAC3C;AAED,kGAAkG;AAClG,MAAM,WAAW,UAAW,SAAQ,WAAW;IAC7C,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;CAClC;AAED,6DAA6D;AAC7D,MAAM,WAAW,UAAW,SAAQ,UAAU;IAC5C,0EAA0E;IAC1E,QAAQ,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI,CAAC;CACvC;AAED;;;GAGG;AACH,MAAM,WAAW,QAAS,SAAQ,UAAU;IAC1C,QAAQ,CAAC,OAAO,EAAE,gBAAgB,CAAC;IACnC,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;CAChC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * One `ask` call as it grows: each stage adds what its step produced — nothing optional. A step's outcome
3
+ * (`StepOutcome`, `../shared/eager-call.ts`) says whether the call goes on or ends with a result.
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=call.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"call.js","sourceRoot":"","sources":["../../../src/tools/ask/call.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * `ask`'s workspace guard: the input counted against the model's window and, over it, the refusal or — when the caller
3
+ * asked for it — the `ask_agentic` fallback, handed back still pending.
4
+ */
5
+ import { type TextToolResult } from '../registry.js';
6
+ import type { StepOutcome } from '../shared/eager-call.js';
7
+ import type { AskCounted, AskScanned } from './call.js';
8
+ /** The guard's outcome: a step's, or the `ask_agentic` fallback, still pending, which the entry returns unawaited. */
9
+ type GuardOutcome = StepOutcome<AskCounted> | {
10
+ readonly handOff: Promise<TextToolResult>;
11
+ };
12
+ /**
13
+ * Count the call's input and hold it against the model's window. A workspace the window cannot hold is refused
14
+ * (`WORKSPACE_TOO_LARGE`, not retryable): sent, Gemini would answer 400 "exceeds maximum", which a caller cannot tell
15
+ * from a transient error. With `onWorkspaceTooLarge: 'fallback-to-agentic'` — opt-in, the default stays `'error'`,
16
+ * since the fallback's cost and timing differ — the question goes to `ask_agentic` with this call's model, globs,
17
+ * thinking and workspace, its `timeoutMs` as `iterationTimeoutMs` (a per-iteration cap: the total can be N × that) and
18
+ * its `stallMs` (`ask-agentic-fallback.ts`). The fallback's promise is handed back unawaited: `fallBackToAgentic` has
19
+ * run up to its first await (it disposed this call's controller and started the agentic call), and the entry returns
20
+ * the promise from inside its `try`.
21
+ */
22
+ export declare function guardAsk(call: AskScanned): Promise<GuardOutcome>;
23
+ export {};
24
+ //# sourceMappingURL=guard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guard.d.ts","sourceRoot":"","sources":["../../../src/tools/ask/guard.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,KAAK,cAAc,EAAe,MAAM,gBAAgB,CAAC;AAClE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAG3D,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAExD,sHAAsH;AACtH,KAAK,YAAY,GAAG,WAAW,CAAC,UAAU,CAAC,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,cAAc,CAAC,CAAA;CAAE,CAAC;AAE5F;;;;;;;;;GASG;AACH,wBAAsB,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC,CA0BtE"}
@@ -0,0 +1,79 @@
1
+ /**
2
+ * `ask`'s workspace guard: the input counted against the model's window and, over it, the refusal or — when the caller
3
+ * asked for it — the `ask_agentic` fallback, handed back still pending.
4
+ */
5
+ import { fallBackToAgentic } from '../ask-agentic-fallback.js';
6
+ import { errorResult } from '../registry.js';
7
+ import { countPreflight, overWindow } from '../shared/eager-steps.js';
8
+ import { attachmentMetadata } from './attachments.js';
9
+ /**
10
+ * Count the call's input and hold it against the model's window. A workspace the window cannot hold is refused
11
+ * (`WORKSPACE_TOO_LARGE`, not retryable): sent, Gemini would answer 400 "exceeds maximum", which a caller cannot tell
12
+ * from a transient error. With `onWorkspaceTooLarge: 'fallback-to-agentic'` — opt-in, the default stays `'error'`,
13
+ * since the fallback's cost and timing differ — the question goes to `ask_agentic` with this call's model, globs,
14
+ * thinking and workspace, its `timeoutMs` as `iterationTimeoutMs` (a per-iteration cap: the total can be N × that) and
15
+ * its `stallMs` (`ask-agentic-fallback.ts`). The fallback's promise is handed back unawaited: `fallBackToAgentic` has
16
+ * run up to its first await (it disposed this call's controller and started the agentic call), and the entry returns
17
+ * the promise from inside its `try`.
18
+ */
19
+ export async function guardAsk(call) {
20
+ const { input, ctx, eager } = call;
21
+ const count = await countPreflight(eager, ctx, {
22
+ scan: call.scan,
23
+ prompt: input.prompt,
24
+ resolved: call.resolved,
25
+ mode: input.preflightMode,
26
+ cap: call.outputCap,
27
+ extraTokens: call.attachments.tokens,
28
+ });
29
+ const over = overWindow(count, ctx);
30
+ if (over === null)
31
+ return { next: { ...call, count } };
32
+ if (input.onWorkspaceTooLarge !== 'fallback-to-agentic')
33
+ return { end: tooLargeResult(call, over) };
34
+ if (call.attachments.attached.length > 0)
35
+ return { end: attachmentsCannotFollow(call) };
36
+ return {
37
+ handOff: fallBackToAgentic({
38
+ input,
39
+ ctx,
40
+ emitter: eager.emitter,
41
+ serviceTier: call.serviceTier,
42
+ preflight: over.counted,
43
+ threshold: over.threshold,
44
+ timeout: eager.timeout,
45
+ }),
46
+ };
47
+ }
48
+ /** The fallback sends no inline parts: a call with attachments cannot take it. */
49
+ function attachmentsCannotFollow(call) {
50
+ return errorResult('ask: the workspace is too large for the eager path and `attachments` cannot follow the ask_agentic fallback (it sends no inline parts); drop the attachments or narrow the workspace', {
51
+ errorCode: 'WORKSPACE_TOO_LARGE',
52
+ retryable: false,
53
+ serviceTier: call.serviceTier,
54
+ ...attachmentMetadata(call.attachments),
55
+ });
56
+ }
57
+ /** The refusal of a workspace over the window, with the ways out. */
58
+ function tooLargeResult(call, over) {
59
+ const { counted, threshold, contextWindow } = over;
60
+ const attachmentsNote = call.attachments.attached.length > 0
61
+ ? ' — it carries no attachments: drop them, or narrow the workspace and ask again'
62
+ : '';
63
+ return errorResult(`Workspace too large: ~${counted.effectiveTokens.toLocaleString()} input tokens (${counted.method} count) exceeds ${threshold.toLocaleString()} (${over.pctDisplay}% of ${call.resolved.resolved}'s ${contextWindow.toLocaleString()} context window). Best option: use \`mcp__gemini-code-context__ask_agentic\` — same model, but it reads only the files it needs via sandboxed tool calls (no eager repo upload)${attachmentsNote}. Or set \`onWorkspaceTooLarge: 'fallback-to-agentic'\` on \`ask\` to have the server route automatically. Other options: (a) pass \`excludeGlobs\` to filter large/generated files — supports \`*.ext\` patterns, filenames, and directory paths, (b) narrow with \`includeGlobs\`, (c) switch to a larger-context model, or (d) split the workspace into subdirectories.`, {
64
+ errorCode: 'WORKSPACE_TOO_LARGE',
65
+ serviceTier: call.serviceTier,
66
+ ...attachmentMetadata(call.attachments),
67
+ retryable: false,
68
+ estimatedInputTokens: counted.effectiveTokens,
69
+ tokenCountMethod: counted.method,
70
+ rawTokenCount: counted.rawTokens,
71
+ tokenCountCacheHit: counted.cacheHit,
72
+ contextWindowTokens: contextWindow,
73
+ thresholdTokens: threshold,
74
+ guardRatio: call.ctx.config.workspaceGuardRatio,
75
+ resolvedModel: call.resolved.resolved,
76
+ filesIndexed: call.scan.files.length,
77
+ });
78
+ }
79
+ //# sourceMappingURL=guard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guard.js","sourceRoot":"","sources":["../../../src/tools/ask/guard.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAuB,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElE,OAAO,EAAmB,cAAc,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACvF,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAMtD;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,IAAgB;IAC7C,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;IACnC,MAAM,KAAK,GAAG,MAAM,cAAc,CAAC,KAAK,EAAE,GAAG,EAAE;QAC7C,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,IAAI,EAAE,KAAK,CAAC,aAAa;QACzB,GAAG,EAAE,IAAI,CAAC,SAAS;QACnB,WAAW,EAAE,IAAI,CAAC,WAAW,CAAC,MAAM;KACrC,CAAC,CAAC;IACH,MAAM,IAAI,GAAG,UAAU,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACpC,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO,EAAE,IAAI,EAAE,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;IACvD,IAAI,KAAK,CAAC,mBAAmB,KAAK,qBAAqB;QACrD,OAAO,EAAE,GAAG,EAAE,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,EA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W,EAAE,IAAI,CAAC,WAAW;QAC7B,GAAG,kBAAkB,CAAC,IAAI,CAAC,WAAW,CAAC;QACvC,SAAS,EAAE,KAAK;QAChB,oBAAoB,EAAE,OAAO,CAAC,eAAe;QAC7C,gBAAgB,EAAE,OAAO,CAAC,MAAM;QAChC,aAAa,EAAE,OAAO,CAAC,SAAS;QAChC,kBAAkB,EAAE,OAAO,CAAC,QAAQ;QACpC,mBAAmB,EAAE,aAAa;QAClC,eAAe,EAAE,SAAS;QAC1B,UAAU,EAAE,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,mBAAmB;QAC/C,aAAa,EAAE,IAAI,CAAC,QAAQ,CAAC,QAAQ;QACrC,YAAY,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM;KACrC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * The input of `ask`: its zod schema (what the MCP host sees as the tool's input schema) and the type the call reads it
3
+ * as.
4
+ */
5
+ import { z } from 'zod';
6
+ export declare const askInputSchema: z.ZodObject<{
7
+ prompt: z.ZodString;
8
+ workspace: z.ZodOptional<z.ZodString>;
9
+ model: z.ZodOptional<z.ZodString>;
10
+ includeGlobs: z.ZodOptional<z.ZodArray<z.ZodString>>;
11
+ excludeGlobs: z.ZodOptional<z.ZodArray<z.ZodString>>;
12
+ noCache: z.ZodOptional<z.ZodBoolean>;
13
+ thinkingBudget: z.ZodOptional<z.ZodNumber>;
14
+ thinkingLevel: z.ZodOptional<z.ZodEnum<{
15
+ HIGH: "HIGH";
16
+ LOW: "LOW";
17
+ MEDIUM: "MEDIUM";
18
+ MINIMAL: "MINIMAL";
19
+ XHIGH: "XHIGH";
20
+ }>>;
21
+ maxOutputTokens: z.ZodOptional<z.ZodNumber>;
22
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
23
+ stallMs: z.ZodOptional<z.ZodNumber>;
24
+ preflightMode: z.ZodOptional<z.ZodEnum<{
25
+ auto: "auto";
26
+ exact: "exact";
27
+ heuristic: "heuristic";
28
+ }>>;
29
+ serviceTier: z.ZodOptional<z.ZodEnum<{
30
+ flex: "flex";
31
+ standard: "standard";
32
+ }>>;
33
+ attachments: z.ZodOptional<z.ZodArray<z.ZodString>>;
34
+ cachingMode: z.ZodOptional<z.ZodEnum<{
35
+ explicit: "explicit";
36
+ implicit: "implicit";
37
+ }>>;
38
+ forceRescan: z.ZodOptional<z.ZodBoolean>;
39
+ onWorkspaceTooLarge: z.ZodOptional<z.ZodEnum<{
40
+ error: "error";
41
+ "fallback-to-agentic": "fallback-to-agentic";
42
+ }>>;
43
+ }, z.core.$strip>;
44
+ export type AskInput = z.infer<typeof askInputSchema>;
45
+ //# sourceMappingURL=input.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../src/tools/ask/input.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAYxB,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAuGvB,CAAC;AAEL,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC"}
@@ -0,0 +1,93 @@
1
+ /**
2
+ * The input of `ask`: its zod schema (what the MCP host sees as the tool's input schema) and the type the call reads it
3
+ * as.
4
+ */
5
+ import { z } from 'zod';
6
+ import { MAX_ATTACHMENTS, MAX_ATTACHMENTS_TOTAL_BYTES, MAX_ATTACHMENT_BYTES, } from '../../attachments.js';
7
+ import { CACHING_MODE_FALLBACK_DESCRIPTION } from '../../cache/caching-mode.js';
8
+ import { LONG_DECODE_CAP_DESCRIPTION } from '../shared/continuation.js';
9
+ import { PROMPT_FIELD, WORKSPACE_FIELD } from '../shared/question-fields.js';
10
+ import { SERVICE_TIER_DESCRIPTION } from '../shared/service-tier.js';
11
+ import { THINKING_LEVEL_FIELD } from '../shared/thinking.js';
12
+ export const askInputSchema = z
13
+ .object({
14
+ prompt: PROMPT_FIELD,
15
+ workspace: WORKSPACE_FIELD,
16
+ model: z
17
+ .string()
18
+ .optional()
19
+ .describe("Model alias ('latest-pro', 'latest-pro-thinking', 'latest-flash', 'latest-lite', 'latest-vision') or literal model ID. Defaults to the configured default."),
20
+ includeGlobs: z
21
+ .array(z.string())
22
+ .optional()
23
+ .describe('Additional file extensions or filenames to include.'),
24
+ excludeGlobs: z
25
+ .array(z.string())
26
+ .optional()
27
+ .describe('Additional patterns to exclude. Supports three shapes: (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`, `.map`, `.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 (backslashes → `/`, leading `./` and trailing `/` stripped). Case-insensitive. No mid-string `*` / `**` / `?` — split into dir + extension patterns if needed.'),
28
+ noCache: z
29
+ .boolean()
30
+ .optional()
31
+ .describe('Skip the context cache and embed files inline (slower, more expensive).'),
32
+ thinkingBudget: z
33
+ .number()
34
+ .int()
35
+ .min(-1)
36
+ .max(65_536)
37
+ .optional()
38
+ .describe("Explicit reasoning-token cap. OMIT to use each model's native default — recommended on Gemini 3 (Google flags explicit `thinkingBudget` as 'legacy'). Pass a value only when you need a specific cap: `-1` = legacy dynamic, `0` = disable thinking (rejected by Gemini 3 Pro), positive integer = fixed cap. CAVEAT on Gemini 3 Pro: low positive values (empirically ≤256 with cached content) can cause the API to hang — use `-1` or ≥4096 if you must bound it there. For discrete-tier control on Gemini 3 use `thinkingLevel` instead — the two are mutually exclusive."),
39
+ thinkingLevel: THINKING_LEVEL_FIELD,
40
+ maxOutputTokens: z
41
+ .number()
42
+ .int()
43
+ .min(1)
44
+ .optional()
45
+ .describe([
46
+ "Per-call opt-in cap on response length (tokens). OMIT for the default 'auto' behaviour — Gemini uses its model-default cap (per Google docs, equal to the model's advertised `outputTokenLimit`: 65,536 for Gemini 3.x / 2.5 Pro-tier; see ai.google.dev/gemini-api/docs/models/gemini-2.5-pro). Pass a smaller value when you want a bounded response (e.g. strict summary length, tighter budget per call). On any other model a value larger than the resolved model's limit is clamped down to it. Budget reservation always uses the effective cap (explicit OR model limit) as worst-case, so `GEMINI_DAILY_BUDGET_USD` bounds what a completed call books (a request aborted mid-stream is booked 0: docs/cost-model.md).",
47
+ LONG_DECODE_CAP_DESCRIPTION,
48
+ ].join(' ')),
49
+ timeoutMs: z
50
+ .number()
51
+ .int()
52
+ .min(1_000)
53
+ .max(1_800_000)
54
+ .optional()
55
+ .describe('Per-call wall-clock TOTAL timeout in ms (1s–30min). The cost ceiling — aborts the in-flight `generateContent` request even if it is actively streaming. A request aborted after its stream opened is booked 0; whether Google bills it is not measured (docs/cost-model.md). When omitted, falls back to env var `GEMINI_CODE_CONTEXT_ASK_TIMEOUT_MS`, then to disabled. v1.12.0 RECOMMENDATION: prefer `stallMs` for liveness — `timeoutMs` is the cost cap, `stallMs` is the heartbeat-aware liveness watchdog that does NOT fire while the model is actively thinking. Both can be set simultaneously. Returns `errorCode: "TIMEOUT"` with `timeoutKind: "total"` on abort.'),
56
+ stallMs: z
57
+ .number()
58
+ .int()
59
+ .min(1_000)
60
+ .max(600_000)
61
+ .optional()
62
+ .describe('Per-call HEARTBEAT-AWARE stall watchdog in ms (1s–10min, v1.12.0+). Resets on every chunk (text or thought) — fires ONLY when the stream goes silent for this long. Does NOT fire while the model is actively thinking — the streaming heartbeat (every ~1500ms via `onThoughtChunk`) keeps the watchdog reset. This is the right knob for "kill dead sockets quickly without penalising deep reasoning." Recommended setting: `60_000` (60s) — Gemini Pro can pause 15-30s mid-reasoning between thought chunks under heavy thinking; 60s absorbs jitter while still killing truly dead sockets ~30× faster than the wall-clock alternative. When omitted, falls back to env var `GEMINI_CODE_CONTEXT_ASK_STALL_MS`, then to disabled. Returns `errorCode: "TIMEOUT"` with `timeoutKind: "stall"` on abort. Independent of `timeoutMs` — both can be set; whichever fires first wins.'),
63
+ preflightMode: z
64
+ .enum(['heuristic', 'exact', 'auto'])
65
+ .optional()
66
+ .describe("Token-count strategy for the WORKSPACE_TOO_LARGE preflight (v1.10.0+). `'heuristic'` = bytes/4 fast estimate (skips API call; coarse — undercounts dense Unicode by 30-50%). `'exact'` = always call Gemini's `countTokens` (free, no quota share with `generateContent`; ~hundreds of ms per call; cached per (filesHash + prompt + model) — `filesHash` is post-glob-filter so changing globs that resolve to different files invalidates automatically). `'auto'` (default, recommended) = heuristic when the workspace is well under 50% of the model's input limit; exact when near the cliff where accuracy matters. Use `'exact'` in CI / tests where you want predictable, accurate behaviour regardless of size."),
67
+ serviceTier: z.enum(['standard', 'flex']).optional().describe(SERVICE_TIER_DESCRIPTION),
68
+ attachments: z
69
+ .array(z.string().min(1)) // the count cap is inspectAttachments' (ATTACHMENT_INVALID), not the schema's
70
+ .optional()
71
+ .describe(`Local image or PDF files (png, jpg, jpeg, webp, pdf; up to ${MAX_ATTACHMENTS}, ${MAX_ATTACHMENT_BYTES / 1024 / 1024} MB each, ${MAX_ATTACHMENTS_TOTAL_BYTES / 1024 / 1024} MB together) sent inline before the question — a screenshot of the bug, a diagram, a spec. Paths are inside the workspace (relative to it or absolute; a symlink is refused, the sandbox's secret rules apply, the first bytes must match the type). They belong to THIS question only, never to the workspace cache. Their tokens are counted by Gemini (one free countTokens call) and enter the size preflight, the budget reservation and the TPM throttle; a count that cannot be obtained refuses the call (ATTACHMENT_TOKENS_UNCOUNTED — retryable after a transient failure: no status, 429, 5xx; not after 401/403/404; a 400 means Gemini refused the parts: ATTACHMENT_INVALID). The model must support vision (ATTACHMENTS_UNSUPPORTED otherwise); a bad file is ATTACHMENT_INVALID, never retryable, and costs nothing. Not available with the ask_agentic fallback.`),
72
+ cachingMode: z
73
+ .enum(['explicit', 'implicit'])
74
+ .optional()
75
+ .describe(`Cache strategy for the workspace context. **\`'implicit'\` (default since v1.14.0)** skips \`caches.create\` entirely; file content is sent inline every call and Gemini 2.5+/3 Pro applies its automatic implicit caching on the repeated workspace prefix when prefix matches across calls. Optimised for the review→edit→review workflow — no 60–180 s rebuild wait when files change between queries. **\`'explicit'\`** builds a Gemini Context Cache via \`caches.create\` — guaranteed ~75% discount on cached input tokens, but pays the rebuild cost on every file change. Use explicit when you need predictable per-call costs more than warm-path latency; the trade-off is documented in Gemini's docs as 'no cost saving guarantee' for implicit caching. Hit rate is observable via \`status.structuredContent.caching.implicitHitRate\`. Operator-level override available via env \`GEMINI_CODE_CONTEXT_CACHING_MODE\`.${CACHING_MODE_FALLBACK_DESCRIPTION}`),
76
+ forceRescan: z
77
+ .boolean()
78
+ .optional()
79
+ .describe('Bypass the v1.13.0 scan memo and re-hash every file in the workspace (default `false`). The scan memo skips per-file SHA256 when `mtime_ms` and `size` match the previously-stored values — typically ~95% of files on a warm rescan, cutting scan wall-clock by ≥10× on large workspaces. Set this when you suspect the manifest is stale (e.g. files mutated outside the dev workflow, NTP clock-skew, or you ran `git checkout` on a directory tree). Equivalent to setting env `GEMINI_CODE_CONTEXT_FORCE_RESCAN=true` for a single call.'),
80
+ onWorkspaceTooLarge: z
81
+ .enum(['error', 'fallback-to-agentic'])
82
+ .optional()
83
+ .describe("Behaviour when the v1.5.0 preflight detects the workspace exceeds the model's `inputTokenLimit × workspaceGuardRatio` (v1.11.0+). `'error'` (default — preserves v1.5.0 behaviour) returns a structured `errorCode: 'WORKSPACE_TOO_LARGE'` and lets the caller decide how to recover. `'fallback-to-agentic'` opt-in: the server transparently re-routes through `ask_agentic` (sandboxed file-access loop — no eager upload, scales to arbitrarily large repos), wraps the agentic result, and surfaces `fallbackApplied: 'ask_agentic'` in `structuredContent` so callers can audit the swap. **Semantic divergence:** `ask_agentic` runs as a multi-iteration loop, so `timeoutMs` (ask's wall-clock cap, per call or `GEMINI_CODE_CONTEXT_ASK_TIMEOUT_MS`) translates to `iterationTimeoutMs` (per-iteration cap; total wall-clock can be N × timeoutMs) and `stallMs` (per call or `GEMINI_CODE_CONTEXT_ASK_STALL_MS`) to the loop's `stallMs` (a stream's silence only — a tool batch longer than `stallMs` answers); a phase neither bounds ends at `ask_agentic`'s default (600 s for a request's opening and a silent stream, 120 s without progress in an iteration's tools). The result reports `iterTimeoutMs`, `iterTimeoutSource: 'timeoutMs'` and `stallMs`, and lifts `errorCode`, `retryable`, `timeoutKind`, `timeoutPhase` and `timeoutSource` of a failed agentic call. Cost shape also changes (multiple smaller calls vs one big eager call). Recommended setting for orchestrators that prioritise getting an answer over a single round-trip; default stays `'error'` so existing callers see no behaviour change. **`code` does NOT support this field** — `code`'s OLD/NEW edit format is load-bearing for Claude's Edit pipeline, and `ask_agentic` returns prose only."),
84
+ })
85
+ .refine((data) => !(data.thinkingBudget !== undefined && data.thinkingLevel !== undefined), {
86
+ message: 'Cannot specify both `thinkingBudget` and `thinkingLevel` — they are mutually exclusive. Gemini rejects the combination with 400. Choose one: `thinkingLevel` (recommended for Gemini 3) or `thinkingBudget` (required on Gemini 2.5).',
87
+ // `path: []` (root-level error) reflects that the violation is the
88
+ // RELATION between two fields, not a problem with either field
89
+ // individually. MCP clients that render per-field errors won't
90
+ // misattribute the issue to `thinkingLevel` alone.
91
+ path: [],
92
+ });
93
+ //# sourceMappingURL=input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input.js","sourceRoot":"","sources":["../../../src/tools/ask/input.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,eAAe,EACf,2BAA2B,EAC3B,oBAAoB,GACrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,iCAAiC,EAAE,MAAM,6BAA6B,CAAC;AAChF,OAAO,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,8BAA8B,CA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zO,mEAAmE;IACnE,+DAA+D;IAC/D,+DAA+D;IAC/D,mDAAmD;IACnD,IAAI,EAAE,EAAE;CACT,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ /** `ask`'s system instruction: read by the inline-size refusal of the attachments and by the request. */
2
+ /**
3
+ * `ask`'s system instruction: the shared `SYSTEM_INSTRUCTION_SAFETY_EAGER` first — the data-vs-instruction firewall
4
+ * that keeps the workspace files' content from steering the model — then `ask`'s role statement. Cross-tool security
5
+ * rules live in the shared block; what is particular to answering questions lives in the role statement.
6
+ */
7
+ export declare const SYSTEM_INSTRUCTION_Q_AND_A: string;
8
+ //# sourceMappingURL=instruction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instruction.d.ts","sourceRoot":"","sources":["../../../src/tools/ask/instruction.ts"],"names":[],"mappings":"AAAA,yGAAyG;AAIzG;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,QAI3B,CAAC"}
@@ -0,0 +1,13 @@
1
+ /** `ask`'s system instruction: read by the inline-size refusal of the attachments and by the request. */
2
+ import { SYSTEM_INSTRUCTION_SAFETY_EAGER } from '../shared/system-instruction-safety.js';
3
+ /**
4
+ * `ask`'s system instruction: the shared `SYSTEM_INSTRUCTION_SAFETY_EAGER` first — the data-vs-instruction firewall
5
+ * that keeps the workspace files' content from steering the model — then `ask`'s role statement. Cross-tool security
6
+ * rules live in the shared block; what is particular to answering questions lives in the role statement.
7
+ */
8
+ export const SYSTEM_INSTRUCTION_Q_AND_A = [
9
+ SYSTEM_INSTRUCTION_SAFETY_EAGER,
10
+ '',
11
+ 'You are a senior software engineer analysing a codebase. Be precise, reference specific file paths and line numbers, and cite evidence from the provided files rather than guessing. If the answer is not derivable from the context, say so.',
12
+ ].join('\n');
13
+ //# sourceMappingURL=instruction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instruction.js","sourceRoot":"","sources":["../../../src/tools/ask/instruction.ts"],"names":[],"mappings":"AAAA,yGAAyG;AAEzG,OAAO,EAAE,+BAA+B,EAAE,MAAM,wCAAwC,CAAC;AAEzF;;;;GAIG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,+BAA+B;IAC/B,EAAE;IACF,+OAA+O;CAChP,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * `ask`'s request on a prepared context: with a cached context, or with the files inline on a context without one.
3
+ * The decode calls it for every request, the stale-cache retry on the rebuilt context too.
4
+ */
5
+ import type { RequestBuilder } from '../shared/eager-answer.js';
6
+ import type { AskSized } from './call.js';
7
+ /**
8
+ * The request builder of one call; what a cached context forbids is `RequestBuilder`'s rule
9
+ * (`../shared/eager-answer.ts`). `maxOutputTokens` goes on the wire only when the cap has a wire value (the caller's
10
+ * `maxOutputTokens`, the operator's force-max, or a cap the input window cut); otherwise Gemini applies the model's own
11
+ * default. The user turn carries the attachments first and the question last, with a cache too.
12
+ */
13
+ export declare function askRequest(call: AskSized): RequestBuilder;
14
+ //# sourceMappingURL=request.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../../src/tools/ask/request.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAEhE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAI1C;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,QAAQ,GAAG,cAAc,CAsBzD"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * `ask`'s request on a prepared context: with a cached context, or with the files inline on a context without one.
3
+ * The decode calls it for every request, the stale-cache retry on the rebuilt context too.
4
+ */
5
+ import { serviceTierConfig } from '../shared/service-tier.js';
6
+ import { SYSTEM_INSTRUCTION_Q_AND_A } from './instruction.js';
7
+ import { thinkingConfigOf } from './thinking.js';
8
+ /**
9
+ * The request builder of one call; what a cached context forbids is `RequestBuilder`'s rule
10
+ * (`../shared/eager-answer.ts`). `maxOutputTokens` goes on the wire only when the cap has a wire value (the caller's
11
+ * `maxOutputTokens`, the operator's force-max, or a cap the input window cut); otherwise Gemini applies the model's own
12
+ * default. The user turn carries the attachments first and the question last, with a cache too.
13
+ */
14
+ export function askRequest(call) {
15
+ const { input, attachments } = call;
16
+ const cap = call.bounded.cap;
17
+ const thinkingConfig = thinkingConfigOf(call.thinking);
18
+ const tierField = serviceTierConfig(call.serviceTier);
19
+ const config = (cacheId) => {
20
+ const maxOutputField = cap.wire !== undefined ? { maxOutputTokens: cap.wire } : {};
21
+ return cacheId
22
+ ? { cachedContent: cacheId, thinkingConfig, ...maxOutputField, ...tierField }
23
+ : {
24
+ systemInstruction: SYSTEM_INSTRUCTION_Q_AND_A,
25
+ thinkingConfig,
26
+ ...maxOutputField,
27
+ ...tierField,
28
+ };
29
+ };
30
+ const userTurn = { role: 'user', parts: [...attachments.parts, { text: input.prompt }] };
31
+ const contents = (prep) => {
32
+ if (prep.cacheId)
33
+ return attachments.parts.length === 0 ? input.prompt : [userTurn];
34
+ return [...prep.inlineContents, userTurn];
35
+ };
36
+ return (prep) => ({ contents: contents(prep), config: config(prep.cacheId) });
37
+ }
38
+ //# sourceMappingURL=request.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.js","sourceRoot":"","sources":["../../../src/tools/ask/request.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAE9D,OAAO,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,IAAc;IACvC,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC;IACpC,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC;IAC7B,MAAM,cAAc,GAA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The results an `ask` call returns from its budget reservation on: the refusal over the daily budget, the stop at the
3
+ * output cap, the answer, and the result of a failed call. Each keeps `ask`'s own fields and their order.
4
+ */
5
+ import { type TextToolResult } from '../registry.js';
6
+ import type { ContextDecode } from '../shared/context-decode.js';
7
+ import { type SettledDecode } from '../shared/eager-answer.js';
8
+ import type { FailedEagerCall, ModelReached } from '../shared/eager-call.js';
9
+ import type { OutputCapStop } from '../shared/settle-call.js';
10
+ import type { AskSized } from './call.js';
11
+ /** The daily budget would be exceeded: nothing was reserved. */
12
+ export declare function budgetRejectResult(call: AskSized, message: string): TextToolResult;
13
+ /** Settled and billed: an empty answer at the output cap is a failure the caller can act on, never a success. */
14
+ export declare function outputCapResult(stop: OutputCapStop): TextToolResult;
15
+ /** The answer, its text and what the call ran on, billed and decoded. */
16
+ export declare function answerResult(call: AskSized, decoded: ContextDecode, settledDecode: SettledDecode): TextToolResult;
17
+ /**
18
+ * `ask`'s result of a failed call: the resolved tier, else the one requested. A timeout has its own `errorCode` so a
19
+ * caller can tell "Gemini was slow" from a refusal, and `timeoutKind` (`total` / `stall`) tells the wall-clock cap
20
+ * from the heartbeat-aware stall watchdog (a caller may retry on a stall and not on the total).
21
+ */
22
+ export declare function failedResult(failure: FailedEagerCall<ModelReached>): TextToolResult;
23
+ //# sourceMappingURL=results.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"results.d.ts","sourceRoot":"","sources":["../../../src/tools/ask/results.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,KAAK,cAAc,EAA2B,MAAM,gBAAgB,CAAC;AAC9E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,KAAK,aAAa,EAAc,MAAM,2BAA2B,CAAC;AAC3E,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAE7E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAG1C,gEAAgE;AAChE,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,GAAG,cAAc,CAMlF;AAED,iHAAiH;AACjH,wBAAgB,eAAe,CAAC,IAAI,EAAE,aAAa,GAAG,cAAc,CAEnE;AAED,yEAAyE;AACzE,wBAAgB,YAAY,CAC1B,IAAI,EAAE,QAAQ,EACd,OAAO,EAAE,aAAa,EACtB,aAAa,EAAE,aAAa,GAC3B,cAAc,CAahB;AAqDD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,eAAe,CAAC,YAAY,CAAC,GAAG,cAAc,CAmBnF"}
@@ -0,0 +1,107 @@
1
+ /**
2
+ * The results an `ask` call returns from its budget reservation on: the refusal over the daily budget, the stop at the
3
+ * output cap, the answer, and the result of a failed call. Each keeps `ask`'s own fields and their order.
4
+ */
5
+ import { errorResult, textResult } from '../registry.js';
6
+ import { scanFields } from '../shared/eager-answer.js';
7
+ import { preflightFields } from '../shared/eager-steps.js';
8
+ import { attachmentMetadata } from './attachments.js';
9
+ import { thinkingBudgetField } from './thinking.js';
10
+ /** The daily budget would be exceeded: nothing was reserved. */
11
+ export function budgetRejectResult(call, message) {
12
+ return errorResult(message, {
13
+ errorCode: 'BUDGET_REJECT',
14
+ retryable: false,
15
+ serviceTier: call.serviceTier,
16
+ });
17
+ }
18
+ /** Settled and billed: an empty answer at the output cap is a failure the caller can act on, never a success. */
19
+ export function outputCapResult(stop) {
20
+ return errorResult(`ask: ${stop.message}`, stop.fields);
21
+ }
22
+ /** The answer, its text and what the call ran on, billed and decoded. */
23
+ export function answerResult(call, decoded, settledDecode) {
24
+ const { response } = decoded;
25
+ // `collectStream` aggregated the thought-flagged parts and capped the joined summary at 1200 chars: reused as it
26
+ // is, so the summary never drifts from the thoughts emitted live.
27
+ const thinkingSummary = response.thoughtsSummary;
28
+ return textResult(response.text, {
29
+ ...modelFields(call),
30
+ ...decodeFields(decoded, settledDecode),
31
+ ...workspaceFields(call, decoded.prep),
32
+ ...preflightFields(call.count),
33
+ durationMs: settledDecode.durationMs,
34
+ ...(thinkingSummary ? { thinkingSummary } : {}),
35
+ });
36
+ }
37
+ /** The model, the tier, the attachments and the thinking the call ran with. */
38
+ function modelFields(call) {
39
+ const { resolved } = call;
40
+ return {
41
+ resolvedModel: resolved.resolved,
42
+ requestedModel: resolved.requested,
43
+ serviceTier: call.serviceTier,
44
+ ...attachmentMetadata(call.attachments),
45
+ fallbackApplied: resolved.fallbackApplied,
46
+ modelCategory: resolved.category,
47
+ modelCostTier: resolved.capabilities.costTier,
48
+ contextWindow: resolved.inputTokenLimit,
49
+ thinkingBudget: thinkingBudgetField(call.thinking),
50
+ thinkingLevel: call.input.thinkingLevel ?? null,
51
+ };
52
+ }
53
+ /** What the decode billed, how it ended and the context it ran on. */
54
+ function decodeFields(decoded, settledDecode) {
55
+ const { prep: activePrep, retriedOnStaleCache } = decoded;
56
+ const { settled, ran } = settledDecode;
57
+ return {
58
+ ...settled.usage,
59
+ ...settled.cutFields,
60
+ // `truncated`: the answer stopped at the output cap (MAX_TOKENS, or a long decode at its limits) — it is cut
61
+ finishReason: settled.finish.finishReason,
62
+ truncated: settled.finish.truncated,
63
+ cacheHit: activePrep.reused,
64
+ cacheRebuilt: activePrep.rebuilt || retriedOnStaleCache,
65
+ retriedOnStaleCache,
66
+ inlineOnly: activePrep.inlineOnly,
67
+ cachingMode: ran.mode,
68
+ ...(ran.note !== null ? { cachingModeNote: ran.note } : {}),
69
+ };
70
+ }
71
+ /** What the scan indexed, skipped and dropped, and what the upload could not send. */
72
+ function workspaceFields(call, prep) {
73
+ const { scan } = call;
74
+ return {
75
+ filesIndexed: scan.files.length,
76
+ filesSkippedTooLarge: scan.skippedTooLarge,
77
+ ...scanFields(scan, prep),
78
+ workspaceTruncated: scan.truncated,
79
+ maxFilesCap: call.ctx.config.maxFilesPerWorkspace,
80
+ };
81
+ }
82
+ /**
83
+ * `ask`'s result of a failed call: the resolved tier, else the one requested. A timeout has its own `errorCode` so a
84
+ * caller can tell "Gemini was slow" from a refusal, and `timeoutKind` (`total` / `stall`) tells the wall-clock cap
85
+ * from the heartbeat-aware stall watchdog (a caller may retry on a stall and not on the total).
86
+ */
87
+ export function failedResult(failure) {
88
+ const serviceTier = failure.model?.serviceTier ?? failure.requestedTier;
89
+ if (failure.kind === 'timeout') {
90
+ return errorResult(failure.timedOut.message, {
91
+ errorCode: 'TIMEOUT',
92
+ timeoutKind: failure.timedOut.kind,
93
+ timeoutMs: failure.timeoutMs,
94
+ stallMs: failure.stallMs,
95
+ retryable: true,
96
+ serviceTier,
97
+ ...failure.usage,
98
+ });
99
+ }
100
+ return errorResult(failure.message, {
101
+ ...failure.tierMeta,
102
+ serviceTier,
103
+ ...(failure.httpStatus !== undefined ? { httpStatus: failure.httpStatus } : {}),
104
+ ...failure.usage,
105
+ });
106
+ }
107
+ //# sourceMappingURL=results.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"results.js","sourceRoot":"","sources":["../../../src/tools/ask/results.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAuB,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE9E,OAAO,EAAsB,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE3E,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEpD,gEAAgE;AAChE,MAAM,UAAU,kBAAkB,CAAC,IAAc,EAAE,OAAe;IAChE,OAAO,WAAW,CAAC,OAAO,EAAE;QAC1B,SAAS,EAAE,eAAe;QAC1B,SAAS,EAAE,KAAK;QAChB,WAAW,EAAE,IAAI,CAAC,WAAW;KAC9B,CAAC,CAAC;AACL,CAAC;AAED,iHAA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C,OAAsC;IACjE,MAAM,WAAW,GAAG,OAAO,CAAC,KAAK,EAAE,WAAW,IAAI,OAAO,CAAC,aAAa,CAAC;IACxE,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC/B,OAAO,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,EAAE;YAC3C,SAAS,EAAE,SAAS;YACpB,WAAW,EAAE,OAAO,CAAC,QAAQ,CAAC,IAAI;YAClC,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,SAAS,EAAE,IAAI;YACf,WAAW;YACX,GAAG,OAAO,CAAC,KAAK;SACjB,CAAC,CAAC;IACL,CAAC;IACD,OAAO,WAAW,CAAC,OAAO,CAAC,OAAO,EAAE;QAClC,GAAG,OAAO,CAAC,QAAQ;QACnB,WAAW;QACX,GAAG,CAAC,OAAO,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/E,GAAG,OAAO,CAAC,KAAK;KACjB,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * The steps of an `ask` call before its count: the model and its tier, then the scan and the refusals over it. Nothing
3
+ * is counted by the preflight or reserved yet.
4
+ */
5
+ import type { StepOutcome } from '../shared/eager-call.js';
6
+ import type { AskAttached, AskCall, AskResolved, AskScanned } from './call.js';
7
+ /**
8
+ * Resolve the model asked for and the call's tier. `ask` accepts all three text-generation tiers — the caller picks
9
+ * through an alias (`latest-pro` / `latest-flash` / `latest-lite` / `latest-vision`) or a literal model id; the
10
+ * resolver refuses a category outside them, so an image, audio or agent model never reaches `generateContent`. A tier
11
+ * the backend refuses ends the call (`SERVICE_TIER_UNSUPPORTED`). The model goes into the call's trail at once: from
12
+ * here a failure seeds a 429's retry hint and reports the resolved tier.
13
+ */
14
+ export declare function resolveAsk(call: AskCall): Promise<StepOutcome<AskResolved>>;
15
+ /**
16
+ * Scan the workspace, then the refusals that need the scan and cost nothing: a positive `thinkingBudget` that leaves
17
+ * no answer reserve under the caller's own cap (`thinkingBudgetRefusal`; the budget on the wire is clamped under the
18
+ * cap that runs later), and an inline request over Google's size limit (only with attachments). The input estimate is
19
+ * the one the budget and the TPM reservations both hold.
20
+ */
21
+ export declare function scanAsk(call: AskAttached): Promise<StepOutcome<AskScanned>>;
22
+ //# sourceMappingURL=setup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../../src/tools/ask/setup.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAI3D,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE/E;;;;;;GAMG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,CAmBjF;AAED;;;;;GAKG;AACH,wBAAsB,OAAO,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,CAmBjF"}