@j0hanz/code-review-analyst-mcp 1.4.3 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -8
- package/dist/lib/gemini.js +80 -19
- package/dist/lib/model-config.d.ts +33 -23
- package/dist/lib/model-config.js +59 -31
- package/dist/lib/tool-contracts.d.ts +32 -15
- package/dist/lib/tool-contracts.js +15 -5
- package/dist/lib/tool-factory.d.ts +10 -3
- package/dist/lib/tool-factory.js +5 -2
- package/dist/lib/types.d.ts +1 -1
- package/dist/prompts/index.js +3 -3
- package/dist/resources/instructions.js +3 -3
- package/dist/resources/server-config.js +4 -4
- package/dist/resources/tool-info.js +4 -4
- package/dist/schemas/outputs.d.ts +7 -7
- package/dist/tools/analyze-complexity.js +6 -3
- package/dist/tools/analyze-pr-impact.js +8 -0
- package/dist/tools/detect-api-breaking.js +7 -1
- package/dist/tools/generate-review-summary.js +8 -0
- package/dist/tools/generate-test-plan.js +7 -2
- package/dist/tools/inspect-code-quality.js +7 -2
- package/dist/tools/suggest-search-replace.js +7 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ This server accepts unified diffs and returns structured JSON results — findin
|
|
|
18
18
|
|
|
19
19
|
- **Impact Analysis** — Objective severity scoring, breaking change detection, and rollback complexity assessment.
|
|
20
20
|
- **Review Summary** — Concise PR digest with merge recommendation and change statistics.
|
|
21
|
-
- **Deep Code Inspection** — Pro model with
|
|
21
|
+
- **Deep Code Inspection** — Pro model with high thinking level for context-aware analysis using full file contents.
|
|
22
22
|
- **Search & Replace Fixes** — Verbatim, copy-paste-ready code fixes tied to specific findings.
|
|
23
23
|
- **Test Plan Generation** — Systematic test case generation with priority ranking and pseudocode.
|
|
24
24
|
- **Async Task Support** — All tools support MCP task lifecycle with progress notifications.
|
|
@@ -385,13 +385,13 @@ Create a test plan covering the changes in the diff using the Flash model with t
|
|
|
385
385
|
|
|
386
386
|
### Models
|
|
387
387
|
|
|
388
|
-
| Tool | Model
|
|
389
|
-
| ------------------------- |
|
|
390
|
-
| `analyze_pr_impact` | `gemini-
|
|
391
|
-
| `generate_review_summary` | `gemini-
|
|
392
|
-
| `inspect_code_quality` | `gemini-
|
|
393
|
-
| `suggest_search_replace` | `gemini-
|
|
394
|
-
| `generate_test_plan` | `gemini-
|
|
388
|
+
| Tool | Model | Thinking Level |
|
|
389
|
+
| ------------------------- | ------------------------ | -------------- |
|
|
390
|
+
| `analyze_pr_impact` | `gemini-3-flash-preview` | `minimal` |
|
|
391
|
+
| `generate_review_summary` | `gemini-3-flash-preview` | `minimal` |
|
|
392
|
+
| `inspect_code_quality` | `gemini-3-pro-preview` | `high` |
|
|
393
|
+
| `suggest_search_replace` | `gemini-3-pro-preview` | `high` |
|
|
394
|
+
| `generate_test_plan` | `gemini-3-flash-preview` | `medium` |
|
|
395
395
|
|
|
396
396
|
## Workflows
|
|
397
397
|
|
package/dist/lib/gemini.js
CHANGED
|
@@ -4,12 +4,12 @@ import { EventEmitter } from 'node:events';
|
|
|
4
4
|
import { performance } from 'node:perf_hooks';
|
|
5
5
|
import { setTimeout as sleep } from 'node:timers/promises';
|
|
6
6
|
import { debuglog } from 'node:util';
|
|
7
|
-
import { FinishReason, GoogleGenAI, HarmBlockThreshold, HarmCategory, } from '@google/genai';
|
|
7
|
+
import { FinishReason, GoogleGenAI, HarmBlockThreshold, HarmCategory, ThinkingLevel, } from '@google/genai';
|
|
8
8
|
import { createCachedEnvInt } from './env-config.js';
|
|
9
9
|
import { getErrorMessage, RETRYABLE_UPSTREAM_ERROR_PATTERN } from './errors.js';
|
|
10
10
|
// Lazy-cached: first call happens after parseCommandLineArgs() sets GEMINI_MODEL.
|
|
11
11
|
let _defaultModel;
|
|
12
|
-
const DEFAULT_MODEL = 'gemini-
|
|
12
|
+
const DEFAULT_MODEL = 'gemini-3-flash-preview';
|
|
13
13
|
const GEMINI_MODEL_ENV_VAR = 'GEMINI_MODEL';
|
|
14
14
|
const GEMINI_HARM_BLOCK_THRESHOLD_ENV_VAR = 'GEMINI_HARM_BLOCK_THRESHOLD';
|
|
15
15
|
const GEMINI_INCLUDE_THOUGHTS_ENV_VAR = 'GEMINI_INCLUDE_THOUGHTS';
|
|
@@ -36,8 +36,8 @@ const DIGITS_ONLY_PATTERN = /^\d+$/;
|
|
|
36
36
|
const SLEEP_UNREF_OPTIONS = { ref: false };
|
|
37
37
|
const maxConcurrentCallsConfig = createCachedEnvInt('MAX_CONCURRENT_CALLS', 10);
|
|
38
38
|
const concurrencyWaitMsConfig = createCachedEnvInt('MAX_CONCURRENT_CALLS_WAIT_MS', 2_000);
|
|
39
|
-
const concurrencyPollMsConfig = createCachedEnvInt('MAX_CONCURRENT_CALLS_POLL_MS', 25);
|
|
40
39
|
let activeCalls = 0;
|
|
40
|
+
const slotWaiters = [];
|
|
41
41
|
const RETRYABLE_TRANSIENT_CODES = new Set([
|
|
42
42
|
'RESOURCE_EXHAUSTED',
|
|
43
43
|
'UNAVAILABLE',
|
|
@@ -91,14 +91,31 @@ function parseSafetyThreshold(threshold) {
|
|
|
91
91
|
}
|
|
92
92
|
return SAFETY_THRESHOLD_BY_NAME[normalizedThreshold];
|
|
93
93
|
}
|
|
94
|
-
function getThinkingConfig(
|
|
95
|
-
if (
|
|
94
|
+
function getThinkingConfig(thinkingLevel, includeThoughts) {
|
|
95
|
+
if (thinkingLevel === undefined && !includeThoughts) {
|
|
96
96
|
return undefined;
|
|
97
97
|
}
|
|
98
|
+
const config = {};
|
|
99
|
+
if (thinkingLevel !== undefined) {
|
|
100
|
+
switch (thinkingLevel) {
|
|
101
|
+
case 'minimal':
|
|
102
|
+
config.thinkingLevel = ThinkingLevel.MINIMAL;
|
|
103
|
+
break;
|
|
104
|
+
case 'low':
|
|
105
|
+
config.thinkingLevel = ThinkingLevel.LOW;
|
|
106
|
+
break;
|
|
107
|
+
case 'medium':
|
|
108
|
+
config.thinkingLevel = ThinkingLevel.MEDIUM;
|
|
109
|
+
break;
|
|
110
|
+
case 'high':
|
|
111
|
+
config.thinkingLevel = ThinkingLevel.HIGH;
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
98
115
|
if (includeThoughts) {
|
|
99
|
-
|
|
116
|
+
config.includeThoughts = true;
|
|
100
117
|
}
|
|
101
|
-
return
|
|
118
|
+
return config;
|
|
102
119
|
}
|
|
103
120
|
function parseBooleanEnv(value) {
|
|
104
121
|
const normalized = value.trim().toLowerCase();
|
|
@@ -300,9 +317,9 @@ function getRetryDelayMs(attempt) {
|
|
|
300
317
|
}
|
|
301
318
|
function buildGenerationConfig(request, abortSignal) {
|
|
302
319
|
const includeThoughts = request.includeThoughts ?? getDefaultIncludeThoughts();
|
|
303
|
-
const thinkingConfig = getThinkingConfig(request.
|
|
320
|
+
const thinkingConfig = getThinkingConfig(request.thinkingLevel, includeThoughts);
|
|
304
321
|
const config = {
|
|
305
|
-
temperature: request.temperature ?? 0
|
|
322
|
+
temperature: request.temperature ?? 1.0,
|
|
306
323
|
maxOutputTokens: request.maxOutputTokens ?? DEFAULT_MAX_OUTPUT_TOKENS,
|
|
307
324
|
responseMimeType: 'application/json',
|
|
308
325
|
responseSchema: request.responseSchema,
|
|
@@ -443,19 +460,62 @@ async function runWithRetries(request, model, timeoutMs, maxRetries, onLog) {
|
|
|
443
460
|
function canRetryAttempt(attempt, maxRetries, error) {
|
|
444
461
|
return attempt < maxRetries && shouldRetry(error);
|
|
445
462
|
}
|
|
463
|
+
function tryWakeNextWaiter() {
|
|
464
|
+
const next = slotWaiters.shift();
|
|
465
|
+
if (next !== undefined) {
|
|
466
|
+
next();
|
|
467
|
+
}
|
|
468
|
+
}
|
|
446
469
|
async function waitForConcurrencySlot(limit, requestSignal) {
|
|
470
|
+
if (activeCalls < limit) {
|
|
471
|
+
return;
|
|
472
|
+
}
|
|
473
|
+
if (requestSignal?.aborted) {
|
|
474
|
+
throw new Error('Gemini request was cancelled.');
|
|
475
|
+
}
|
|
447
476
|
const waitLimitMs = concurrencyWaitMsConfig.get();
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
477
|
+
return new Promise((resolve, reject) => {
|
|
478
|
+
let settled = false;
|
|
479
|
+
const waiter = () => {
|
|
480
|
+
if (settled)
|
|
481
|
+
return;
|
|
482
|
+
settled = true;
|
|
483
|
+
clearTimeout(deadlineTimer);
|
|
484
|
+
if (requestSignal) {
|
|
485
|
+
requestSignal.removeEventListener('abort', onAbort);
|
|
486
|
+
}
|
|
487
|
+
resolve();
|
|
488
|
+
};
|
|
489
|
+
slotWaiters.push(waiter);
|
|
490
|
+
const deadlineTimer = setTimeout(() => {
|
|
491
|
+
if (settled)
|
|
492
|
+
return;
|
|
493
|
+
settled = true;
|
|
494
|
+
const idx = slotWaiters.indexOf(waiter);
|
|
495
|
+
if (idx !== -1) {
|
|
496
|
+
slotWaiters.splice(idx, 1);
|
|
497
|
+
}
|
|
498
|
+
if (requestSignal) {
|
|
499
|
+
requestSignal.removeEventListener('abort', onAbort);
|
|
500
|
+
}
|
|
501
|
+
reject(new Error(formatConcurrencyLimitErrorMessage(limit, waitLimitMs)));
|
|
502
|
+
}, waitLimitMs);
|
|
503
|
+
deadlineTimer.unref();
|
|
504
|
+
const onAbort = () => {
|
|
505
|
+
if (settled)
|
|
506
|
+
return;
|
|
507
|
+
settled = true;
|
|
508
|
+
const idx = slotWaiters.indexOf(waiter);
|
|
509
|
+
if (idx !== -1) {
|
|
510
|
+
slotWaiters.splice(idx, 1);
|
|
511
|
+
}
|
|
512
|
+
clearTimeout(deadlineTimer);
|
|
513
|
+
reject(new Error('Gemini request was cancelled.'));
|
|
514
|
+
};
|
|
515
|
+
if (requestSignal) {
|
|
516
|
+
requestSignal.addEventListener('abort', onAbort, { once: true });
|
|
456
517
|
}
|
|
457
|
-
|
|
458
|
-
}
|
|
518
|
+
});
|
|
459
519
|
}
|
|
460
520
|
export async function generateStructuredJson(request) {
|
|
461
521
|
const model = request.model ?? getDefaultModel();
|
|
@@ -470,5 +530,6 @@ export async function generateStructuredJson(request) {
|
|
|
470
530
|
}
|
|
471
531
|
finally {
|
|
472
532
|
activeCalls -= 1;
|
|
533
|
+
tryWakeNextWaiter();
|
|
473
534
|
}
|
|
474
535
|
}
|
|
@@ -1,29 +1,39 @@
|
|
|
1
1
|
/** Fast, cost-effective model for summarization and light analysis. */
|
|
2
|
-
export declare const FLASH_MODEL = "gemini-
|
|
2
|
+
export declare const FLASH_MODEL = "gemini-3-flash-preview";
|
|
3
3
|
/** High-capability model for deep reasoning, quality inspection, and reliable code generation. */
|
|
4
|
-
export declare const PRO_MODEL = "gemini-
|
|
5
|
-
/**
|
|
6
|
-
export declare const
|
|
7
|
-
/**
|
|
8
|
-
export declare const
|
|
9
|
-
/**
|
|
10
|
-
export declare const FLASH_TRIAGE_MAX_OUTPUT_TOKENS: 4096;
|
|
11
|
-
/** Output cap for API breaking-change detection (migration guidance needs room). */
|
|
12
|
-
export declare const FLASH_API_BREAKING_MAX_OUTPUT_TOKENS: 4096;
|
|
13
|
-
/** Output cap for test-plan generation (includes pseudocode snippets). */
|
|
14
|
-
export declare const FLASH_TEST_PLAN_MAX_OUTPUT_TOKENS: 4096;
|
|
15
|
-
/** Output cap for Pro deep review findings. */
|
|
16
|
-
export declare const PRO_REVIEW_MAX_OUTPUT_TOKENS: 8192;
|
|
17
|
-
/** Output cap for Pro search/replace remediation blocks. */
|
|
18
|
-
export declare const PRO_PATCH_MAX_OUTPUT_TOKENS: 4096;
|
|
19
|
-
/** Output cap for Flash complexity analysis reports. */
|
|
20
|
-
export declare const FLASH_COMPLEXITY_MAX_OUTPUT_TOKENS: 2048;
|
|
21
|
-
/** Extended timeout for Pro model calls (ms). Pro thinks longer than Flash. */
|
|
4
|
+
export declare const PRO_MODEL = "gemini-3-pro-preview";
|
|
5
|
+
/** Default language hint. */
|
|
6
|
+
export declare const DEFAULT_LANGUAGE = "detect";
|
|
7
|
+
/** Default test-framework hint. */
|
|
8
|
+
export declare const DEFAULT_FRAMEWORK = "detect";
|
|
9
|
+
/** Extended timeout for Pro model calls (ms). */
|
|
22
10
|
export declare const DEFAULT_TIMEOUT_PRO_MS = 120000;
|
|
23
11
|
export declare const MODEL_TIMEOUT_MS: {
|
|
24
12
|
readonly defaultPro: 120000;
|
|
25
13
|
};
|
|
26
|
-
/**
|
|
27
|
-
export declare const
|
|
28
|
-
/**
|
|
29
|
-
export declare const
|
|
14
|
+
/** Thinking level for Flash triage. */
|
|
15
|
+
export declare const FLASH_TRIAGE_THINKING_LEVEL: "minimal";
|
|
16
|
+
/** Thinking level for Flash analysis. */
|
|
17
|
+
export declare const FLASH_THINKING_LEVEL: "medium";
|
|
18
|
+
/** Thinking level for Pro deep analysis. */
|
|
19
|
+
export declare const PRO_THINKING_LEVEL: "high";
|
|
20
|
+
/** Output cap for Flash API breaking-change detection. */
|
|
21
|
+
export declare const FLASH_API_BREAKING_MAX_OUTPUT_TOKENS: 4096;
|
|
22
|
+
/** Output cap for Flash complexity analysis. */
|
|
23
|
+
export declare const FLASH_COMPLEXITY_MAX_OUTPUT_TOKENS: 2048;
|
|
24
|
+
/** Output cap for Flash test-plan generation. */
|
|
25
|
+
export declare const FLASH_TEST_PLAN_MAX_OUTPUT_TOKENS: 8192;
|
|
26
|
+
/** Output cap for Flash triage tools. */
|
|
27
|
+
export declare const FLASH_TRIAGE_MAX_OUTPUT_TOKENS: 4096;
|
|
28
|
+
/** Output cap for Pro patch generation. */
|
|
29
|
+
export declare const PRO_PATCH_MAX_OUTPUT_TOKENS: 8192;
|
|
30
|
+
/** Output cap for Pro deep review findings. */
|
|
31
|
+
export declare const PRO_REVIEW_MAX_OUTPUT_TOKENS: 12288;
|
|
32
|
+
/** Temperature for analytical tools. */
|
|
33
|
+
export declare const ANALYSIS_TEMPERATURE: 1;
|
|
34
|
+
/** Temperature for creative synthesis (test plans). */
|
|
35
|
+
export declare const CREATIVE_TEMPERATURE: 1;
|
|
36
|
+
/** Temperature for code patch generation. */
|
|
37
|
+
export declare const PATCH_TEMPERATURE: 1;
|
|
38
|
+
/** Temperature for triage/classification tools. */
|
|
39
|
+
export declare const TRIAGE_TEMPERATURE: 1;
|
package/dist/lib/model-config.js
CHANGED
|
@@ -1,43 +1,71 @@
|
|
|
1
1
|
/** Fast, cost-effective model for summarization and light analysis. */
|
|
2
|
-
export const FLASH_MODEL = 'gemini-
|
|
2
|
+
export const FLASH_MODEL = 'gemini-3-flash-preview';
|
|
3
3
|
/** High-capability model for deep reasoning, quality inspection, and reliable code generation. */
|
|
4
|
-
export const PRO_MODEL = 'gemini-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
export const PRO_MODEL = 'gemini-3-pro-preview';
|
|
5
|
+
/** Default hint for auto-detection. */
|
|
6
|
+
const DEFAULT_DETECT_HINT = 'detect';
|
|
7
|
+
/** Default language hint. */
|
|
8
|
+
export const DEFAULT_LANGUAGE = DEFAULT_DETECT_HINT;
|
|
9
|
+
/** Default test-framework hint. */
|
|
10
|
+
export const DEFAULT_FRAMEWORK = DEFAULT_DETECT_HINT;
|
|
11
|
+
/** Extended timeout for Pro model calls (ms). */
|
|
12
|
+
export const DEFAULT_TIMEOUT_PRO_MS = 120_000;
|
|
13
|
+
export const MODEL_TIMEOUT_MS = {
|
|
14
|
+
defaultPro: DEFAULT_TIMEOUT_PRO_MS,
|
|
8
15
|
};
|
|
16
|
+
Object.freeze(MODEL_TIMEOUT_MS);
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
// Budgets (Thinking & Output)
|
|
19
|
+
// ---------------------------------------------------------------------------
|
|
20
|
+
const THINKING_LEVELS = {
|
|
21
|
+
/** Minimal thinking for triage/classification. */
|
|
22
|
+
flashTriage: 'minimal',
|
|
23
|
+
/** Medium thinking for analysis tasks. */
|
|
24
|
+
flash: 'medium',
|
|
25
|
+
/** High thinking for deep review and patches. */
|
|
26
|
+
pro: 'high',
|
|
27
|
+
};
|
|
28
|
+
// Thinking budget in tokens for Flash and Pro tools. Note that these are not hard limits, but rather guidelines to encourage concise responses and manage latency/cost.
|
|
9
29
|
const OUTPUT_TOKEN_BUDGET = {
|
|
10
|
-
flashTriage: 4_096,
|
|
11
|
-
flashTestPlan: 4_096,
|
|
12
30
|
flashApiBreaking: 4_096,
|
|
13
31
|
flashComplexity: 2_048,
|
|
14
|
-
|
|
15
|
-
|
|
32
|
+
flashTestPlan: 8_192,
|
|
33
|
+
flashTriage: 4_096,
|
|
34
|
+
proPatch: 8_192,
|
|
35
|
+
proReview: 12_288,
|
|
16
36
|
};
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
/** Output cap for API breaking-change detection (migration guidance needs room). */
|
|
37
|
+
/** Thinking level for Flash triage. */
|
|
38
|
+
export const FLASH_TRIAGE_THINKING_LEVEL = THINKING_LEVELS.flashTriage;
|
|
39
|
+
/** Thinking level for Flash analysis. */
|
|
40
|
+
export const FLASH_THINKING_LEVEL = THINKING_LEVELS.flash;
|
|
41
|
+
/** Thinking level for Pro deep analysis. */
|
|
42
|
+
export const PRO_THINKING_LEVEL = THINKING_LEVELS.pro;
|
|
43
|
+
/** Output cap for Flash API breaking-change detection. */
|
|
25
44
|
export const FLASH_API_BREAKING_MAX_OUTPUT_TOKENS = OUTPUT_TOKEN_BUDGET.flashApiBreaking;
|
|
26
|
-
/** Output cap for
|
|
45
|
+
/** Output cap for Flash complexity analysis. */
|
|
46
|
+
export const FLASH_COMPLEXITY_MAX_OUTPUT_TOKENS = OUTPUT_TOKEN_BUDGET.flashComplexity;
|
|
47
|
+
/** Output cap for Flash test-plan generation. */
|
|
27
48
|
export const FLASH_TEST_PLAN_MAX_OUTPUT_TOKENS = OUTPUT_TOKEN_BUDGET.flashTestPlan;
|
|
49
|
+
/** Output cap for Flash triage tools. */
|
|
50
|
+
export const FLASH_TRIAGE_MAX_OUTPUT_TOKENS = OUTPUT_TOKEN_BUDGET.flashTriage;
|
|
51
|
+
/** Output cap for Pro patch generation. */
|
|
52
|
+
export const PRO_PATCH_MAX_OUTPUT_TOKENS = OUTPUT_TOKEN_BUDGET.proPatch;
|
|
28
53
|
/** Output cap for Pro deep review findings. */
|
|
29
54
|
export const PRO_REVIEW_MAX_OUTPUT_TOKENS = OUTPUT_TOKEN_BUDGET.proReview;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
55
|
+
// ---------------------------------------------------------------------------
|
|
56
|
+
// Temperatures
|
|
57
|
+
// ---------------------------------------------------------------------------
|
|
58
|
+
const TOOL_TEMPERATURE = {
|
|
59
|
+
analysis: 1.0, // Gemini 3 recommends 1.0 for all tasks
|
|
60
|
+
creative: 1.0, // Gemini 3 recommends 1.0 for all tasks
|
|
61
|
+
patch: 1.0, // Gemini 3 recommends 1.0 for all tasks
|
|
62
|
+
triage: 1.0, // Gemini 3 recommends 1.0 for all tasks
|
|
38
63
|
};
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
64
|
+
/** Temperature for analytical tools. */
|
|
65
|
+
export const ANALYSIS_TEMPERATURE = TOOL_TEMPERATURE.analysis;
|
|
66
|
+
/** Temperature for creative synthesis (test plans). */
|
|
67
|
+
export const CREATIVE_TEMPERATURE = TOOL_TEMPERATURE.creative;
|
|
68
|
+
/** Temperature for code patch generation. */
|
|
69
|
+
export const PATCH_TEMPERATURE = TOOL_TEMPERATURE.patch;
|
|
70
|
+
/** Temperature for triage/classification tools. */
|
|
71
|
+
export const TRIAGE_TEMPERATURE = TOOL_TEMPERATURE.triage;
|
|
@@ -13,9 +13,16 @@ export interface ToolContract {
|
|
|
13
13
|
model: string;
|
|
14
14
|
/** Set to 0 for synchronous (non-Gemini) tools. */
|
|
15
15
|
timeoutMs: number;
|
|
16
|
-
|
|
16
|
+
thinkingLevel?: 'minimal' | 'low' | 'medium' | 'high';
|
|
17
17
|
/** Set to 0 for synchronous (non-Gemini) tools. */
|
|
18
18
|
maxOutputTokens: number;
|
|
19
|
+
/**
|
|
20
|
+
* Sampling temperature for the Gemini call.
|
|
21
|
+
* Lower values (0.0–0.1) favour deterministic structured output;
|
|
22
|
+
* higher values (0.2) add diversity for creative synthesis tasks.
|
|
23
|
+
* Omit to use the global default (0.2).
|
|
24
|
+
*/
|
|
25
|
+
temperature?: number;
|
|
19
26
|
params: readonly ToolParameterContract[];
|
|
20
27
|
outputShape: string;
|
|
21
28
|
gotchas: readonly string[];
|
|
@@ -41,9 +48,11 @@ export declare const TOOL_CONTRACTS: readonly [{
|
|
|
41
48
|
}, {
|
|
42
49
|
readonly name: "analyze_pr_impact";
|
|
43
50
|
readonly purpose: "Assess severity, categories, breaking changes, and rollback complexity.";
|
|
44
|
-
readonly model: "gemini-
|
|
51
|
+
readonly model: "gemini-3-flash-preview";
|
|
45
52
|
readonly timeoutMs: 90000;
|
|
53
|
+
readonly thinkingLevel: "minimal";
|
|
46
54
|
readonly maxOutputTokens: 4096;
|
|
55
|
+
readonly temperature: 1;
|
|
47
56
|
readonly params: readonly [{
|
|
48
57
|
readonly name: "repository";
|
|
49
58
|
readonly type: "string";
|
|
@@ -63,9 +72,11 @@ export declare const TOOL_CONTRACTS: readonly [{
|
|
|
63
72
|
}, {
|
|
64
73
|
readonly name: "generate_review_summary";
|
|
65
74
|
readonly purpose: "Produce PR summary, risk rating, and merge recommendation.";
|
|
66
|
-
readonly model: "gemini-
|
|
75
|
+
readonly model: "gemini-3-flash-preview";
|
|
67
76
|
readonly timeoutMs: 90000;
|
|
77
|
+
readonly thinkingLevel: "minimal";
|
|
68
78
|
readonly maxOutputTokens: 4096;
|
|
79
|
+
readonly temperature: 1;
|
|
69
80
|
readonly params: readonly [{
|
|
70
81
|
readonly name: "repository";
|
|
71
82
|
readonly type: "string";
|
|
@@ -85,10 +96,11 @@ export declare const TOOL_CONTRACTS: readonly [{
|
|
|
85
96
|
}, {
|
|
86
97
|
readonly name: "inspect_code_quality";
|
|
87
98
|
readonly purpose: "Deep code review with optional full-file context.";
|
|
88
|
-
readonly model: "gemini-
|
|
99
|
+
readonly model: "gemini-3-pro-preview";
|
|
89
100
|
readonly timeoutMs: 120000;
|
|
90
|
-
readonly
|
|
91
|
-
readonly maxOutputTokens:
|
|
101
|
+
readonly thinkingLevel: "high";
|
|
102
|
+
readonly maxOutputTokens: 12288;
|
|
103
|
+
readonly temperature: 1;
|
|
92
104
|
readonly params: readonly [{
|
|
93
105
|
readonly name: "repository";
|
|
94
106
|
readonly type: "string";
|
|
@@ -127,10 +139,11 @@ export declare const TOOL_CONTRACTS: readonly [{
|
|
|
127
139
|
}, {
|
|
128
140
|
readonly name: "suggest_search_replace";
|
|
129
141
|
readonly purpose: "Generate verbatim search/replace fix blocks for one finding.";
|
|
130
|
-
readonly model: "gemini-
|
|
142
|
+
readonly model: "gemini-3-pro-preview";
|
|
131
143
|
readonly timeoutMs: 120000;
|
|
132
|
-
readonly
|
|
133
|
-
readonly maxOutputTokens:
|
|
144
|
+
readonly thinkingLevel: "high";
|
|
145
|
+
readonly maxOutputTokens: 8192;
|
|
146
|
+
readonly temperature: 1;
|
|
134
147
|
readonly params: readonly [{
|
|
135
148
|
readonly name: "findingTitle";
|
|
136
149
|
readonly type: "string";
|
|
@@ -151,10 +164,11 @@ export declare const TOOL_CONTRACTS: readonly [{
|
|
|
151
164
|
}, {
|
|
152
165
|
readonly name: "generate_test_plan";
|
|
153
166
|
readonly purpose: "Generate prioritized test cases and coverage guidance.";
|
|
154
|
-
readonly model: "gemini-
|
|
167
|
+
readonly model: "gemini-3-flash-preview";
|
|
155
168
|
readonly timeoutMs: 90000;
|
|
156
|
-
readonly
|
|
157
|
-
readonly maxOutputTokens:
|
|
169
|
+
readonly thinkingLevel: "medium";
|
|
170
|
+
readonly maxOutputTokens: 8192;
|
|
171
|
+
readonly temperature: 1;
|
|
158
172
|
readonly params: readonly [{
|
|
159
173
|
readonly name: "repository";
|
|
160
174
|
readonly type: "string";
|
|
@@ -186,10 +200,11 @@ export declare const TOOL_CONTRACTS: readonly [{
|
|
|
186
200
|
}, {
|
|
187
201
|
readonly name: "analyze_time_space_complexity";
|
|
188
202
|
readonly purpose: "Analyze Big-O complexity and detect degradations in changed code.";
|
|
189
|
-
readonly model: "gemini-
|
|
203
|
+
readonly model: "gemini-3-flash-preview";
|
|
190
204
|
readonly timeoutMs: 90000;
|
|
191
|
-
readonly
|
|
205
|
+
readonly thinkingLevel: "medium";
|
|
192
206
|
readonly maxOutputTokens: 2048;
|
|
207
|
+
readonly temperature: 1;
|
|
193
208
|
readonly params: readonly [{
|
|
194
209
|
readonly name: "language";
|
|
195
210
|
readonly type: "string";
|
|
@@ -203,9 +218,11 @@ export declare const TOOL_CONTRACTS: readonly [{
|
|
|
203
218
|
}, {
|
|
204
219
|
readonly name: "detect_api_breaking_changes";
|
|
205
220
|
readonly purpose: "Detect breaking API/interface changes in a diff.";
|
|
206
|
-
readonly model: "gemini-
|
|
221
|
+
readonly model: "gemini-3-flash-preview";
|
|
207
222
|
readonly timeoutMs: 90000;
|
|
223
|
+
readonly thinkingLevel: "minimal";
|
|
208
224
|
readonly maxOutputTokens: 4096;
|
|
225
|
+
readonly temperature: 1;
|
|
209
226
|
readonly params: readonly [{
|
|
210
227
|
readonly name: "language";
|
|
211
228
|
readonly type: "string";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DEFAULT_TIMEOUT_PRO_MS, FLASH_API_BREAKING_MAX_OUTPUT_TOKENS, FLASH_COMPLEXITY_MAX_OUTPUT_TOKENS, FLASH_MODEL, FLASH_TEST_PLAN_MAX_OUTPUT_TOKENS,
|
|
1
|
+
import { ANALYSIS_TEMPERATURE, CREATIVE_TEMPERATURE, DEFAULT_TIMEOUT_PRO_MS, FLASH_API_BREAKING_MAX_OUTPUT_TOKENS, FLASH_COMPLEXITY_MAX_OUTPUT_TOKENS, FLASH_MODEL, FLASH_TEST_PLAN_MAX_OUTPUT_TOKENS, FLASH_THINKING_LEVEL, FLASH_TRIAGE_MAX_OUTPUT_TOKENS, FLASH_TRIAGE_THINKING_LEVEL, PATCH_TEMPERATURE, PRO_MODEL, PRO_PATCH_MAX_OUTPUT_TOKENS, PRO_REVIEW_MAX_OUTPUT_TOKENS, PRO_THINKING_LEVEL, TRIAGE_TEMPERATURE, } from './model-config.js';
|
|
2
2
|
const DEFAULT_TIMEOUT_FLASH_MS = 90_000;
|
|
3
3
|
export const INSPECTION_FOCUS_AREAS = [
|
|
4
4
|
'security',
|
|
@@ -40,7 +40,9 @@ export const TOOL_CONTRACTS = [
|
|
|
40
40
|
purpose: 'Assess severity, categories, breaking changes, and rollback complexity.',
|
|
41
41
|
model: FLASH_MODEL,
|
|
42
42
|
timeoutMs: DEFAULT_TIMEOUT_FLASH_MS,
|
|
43
|
+
thinkingLevel: FLASH_TRIAGE_THINKING_LEVEL,
|
|
43
44
|
maxOutputTokens: FLASH_TRIAGE_MAX_OUTPUT_TOKENS,
|
|
45
|
+
temperature: TRIAGE_TEMPERATURE,
|
|
44
46
|
params: [
|
|
45
47
|
{
|
|
46
48
|
name: 'repository',
|
|
@@ -71,7 +73,9 @@ export const TOOL_CONTRACTS = [
|
|
|
71
73
|
purpose: 'Produce PR summary, risk rating, and merge recommendation.',
|
|
72
74
|
model: FLASH_MODEL,
|
|
73
75
|
timeoutMs: DEFAULT_TIMEOUT_FLASH_MS,
|
|
76
|
+
thinkingLevel: FLASH_TRIAGE_THINKING_LEVEL,
|
|
74
77
|
maxOutputTokens: FLASH_TRIAGE_MAX_OUTPUT_TOKENS,
|
|
78
|
+
temperature: TRIAGE_TEMPERATURE,
|
|
75
79
|
params: [
|
|
76
80
|
{
|
|
77
81
|
name: 'repository',
|
|
@@ -102,8 +106,9 @@ export const TOOL_CONTRACTS = [
|
|
|
102
106
|
purpose: 'Deep code review with optional full-file context.',
|
|
103
107
|
model: PRO_MODEL,
|
|
104
108
|
timeoutMs: DEFAULT_TIMEOUT_PRO_MS,
|
|
105
|
-
|
|
109
|
+
thinkingLevel: PRO_THINKING_LEVEL,
|
|
106
110
|
maxOutputTokens: PRO_REVIEW_MAX_OUTPUT_TOKENS,
|
|
111
|
+
temperature: ANALYSIS_TEMPERATURE,
|
|
107
112
|
params: [
|
|
108
113
|
{
|
|
109
114
|
name: 'repository',
|
|
@@ -158,8 +163,9 @@ export const TOOL_CONTRACTS = [
|
|
|
158
163
|
purpose: 'Generate verbatim search/replace fix blocks for one finding.',
|
|
159
164
|
model: PRO_MODEL,
|
|
160
165
|
timeoutMs: DEFAULT_TIMEOUT_PRO_MS,
|
|
161
|
-
|
|
166
|
+
thinkingLevel: PRO_THINKING_LEVEL,
|
|
162
167
|
maxOutputTokens: PRO_PATCH_MAX_OUTPUT_TOKENS,
|
|
168
|
+
temperature: PATCH_TEMPERATURE,
|
|
163
169
|
params: [
|
|
164
170
|
{
|
|
165
171
|
name: 'findingTitle',
|
|
@@ -192,8 +198,9 @@ export const TOOL_CONTRACTS = [
|
|
|
192
198
|
purpose: 'Generate prioritized test cases and coverage guidance.',
|
|
193
199
|
model: FLASH_MODEL,
|
|
194
200
|
timeoutMs: DEFAULT_TIMEOUT_FLASH_MS,
|
|
195
|
-
|
|
201
|
+
thinkingLevel: FLASH_THINKING_LEVEL,
|
|
196
202
|
maxOutputTokens: FLASH_TEST_PLAN_MAX_OUTPUT_TOKENS,
|
|
203
|
+
temperature: CREATIVE_TEMPERATURE,
|
|
197
204
|
params: [
|
|
198
205
|
{
|
|
199
206
|
name: 'repository',
|
|
@@ -238,8 +245,9 @@ export const TOOL_CONTRACTS = [
|
|
|
238
245
|
purpose: 'Analyze Big-O complexity and detect degradations in changed code.',
|
|
239
246
|
model: FLASH_MODEL,
|
|
240
247
|
timeoutMs: DEFAULT_TIMEOUT_FLASH_MS,
|
|
241
|
-
|
|
248
|
+
thinkingLevel: FLASH_THINKING_LEVEL,
|
|
242
249
|
maxOutputTokens: FLASH_COMPLEXITY_MAX_OUTPUT_TOKENS,
|
|
250
|
+
temperature: ANALYSIS_TEMPERATURE,
|
|
243
251
|
params: [
|
|
244
252
|
{
|
|
245
253
|
name: 'language',
|
|
@@ -261,7 +269,9 @@ export const TOOL_CONTRACTS = [
|
|
|
261
269
|
purpose: 'Detect breaking API/interface changes in a diff.',
|
|
262
270
|
model: FLASH_MODEL,
|
|
263
271
|
timeoutMs: DEFAULT_TIMEOUT_FLASH_MS,
|
|
272
|
+
thinkingLevel: FLASH_TRIAGE_THINKING_LEVEL,
|
|
264
273
|
maxOutputTokens: FLASH_API_BREAKING_MAX_OUTPUT_TOKENS,
|
|
274
|
+
temperature: TRIAGE_TEMPERATURE,
|
|
265
275
|
params: [
|
|
266
276
|
{
|
|
267
277
|
name: 'language',
|
|
@@ -55,14 +55,21 @@ export interface StructuredToolTaskConfig<TInput extends object = Record<string,
|
|
|
55
55
|
transformResult?: (input: TInput, result: TResult, ctx: ToolExecutionContext) => TFinal;
|
|
56
56
|
/** Optional validation hook for input parameters. */
|
|
57
57
|
validateInput?: (input: TInput, ctx: ToolExecutionContext) => Promise<ReturnType<typeof createErrorToolResponse> | undefined> | ReturnType<typeof createErrorToolResponse> | undefined;
|
|
58
|
-
/** Optional Gemini model to use (e.g. 'gemini-
|
|
58
|
+
/** Optional Gemini model to use (e.g. 'gemini-3-pro-preview'). */
|
|
59
59
|
model?: string;
|
|
60
|
-
/** Optional thinking
|
|
61
|
-
|
|
60
|
+
/** Optional thinking level. */
|
|
61
|
+
thinkingLevel?: 'minimal' | 'low' | 'medium' | 'high';
|
|
62
62
|
/** Optional timeout in ms for the Gemini call. Defaults to 90,000 ms. Use DEFAULT_TIMEOUT_PRO_MS for Pro model calls. */
|
|
63
63
|
timeoutMs?: number;
|
|
64
64
|
/** Optional max output tokens for Gemini. */
|
|
65
65
|
maxOutputTokens?: number;
|
|
66
|
+
/**
|
|
67
|
+
* Optional sampling temperature for this tool's Gemini call.
|
|
68
|
+
* Lower values (0.0–0.1) favour determinism for structured extraction;
|
|
69
|
+
* higher values (0.2) add useful diversity for creative synthesis tasks.
|
|
70
|
+
* Falls back to the global default (0.2) when omitted.
|
|
71
|
+
*/
|
|
72
|
+
temperature?: number;
|
|
66
73
|
/** Optional opt-in to Gemini thought output. Defaults to false. */
|
|
67
74
|
includeThoughts?: boolean;
|
|
68
75
|
/** Optional formatter for human-readable text output. */
|
package/dist/lib/tool-factory.js
CHANGED
|
@@ -31,8 +31,8 @@ function createGenerationRequest(config, promptParts, responseSchema, onLog, sig
|
|
|
31
31
|
if (config.model !== undefined) {
|
|
32
32
|
request.model = config.model;
|
|
33
33
|
}
|
|
34
|
-
if (config.
|
|
35
|
-
request.
|
|
34
|
+
if (config.thinkingLevel !== undefined) {
|
|
35
|
+
request.thinkingLevel = config.thinkingLevel;
|
|
36
36
|
}
|
|
37
37
|
if (config.timeoutMs !== undefined) {
|
|
38
38
|
request.timeoutMs = config.timeoutMs;
|
|
@@ -40,6 +40,9 @@ function createGenerationRequest(config, promptParts, responseSchema, onLog, sig
|
|
|
40
40
|
if (config.maxOutputTokens !== undefined) {
|
|
41
41
|
request.maxOutputTokens = config.maxOutputTokens;
|
|
42
42
|
}
|
|
43
|
+
if (config.temperature !== undefined) {
|
|
44
|
+
request.temperature = config.temperature;
|
|
45
|
+
}
|
|
43
46
|
if (config.includeThoughts !== undefined) {
|
|
44
47
|
request.includeThoughts = config.includeThoughts;
|
|
45
48
|
}
|
package/dist/lib/types.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export interface GeminiRequestExecutionOptions {
|
|
|
5
5
|
timeoutMs?: number;
|
|
6
6
|
temperature?: number;
|
|
7
7
|
maxOutputTokens?: number;
|
|
8
|
-
|
|
8
|
+
thinkingLevel?: 'minimal' | 'low' | 'medium' | 'high';
|
|
9
9
|
includeThoughts?: boolean;
|
|
10
10
|
signal?: AbortSignal;
|
|
11
11
|
onLog?: GeminiLogHandler;
|
package/dist/prompts/index.js
CHANGED
|
@@ -43,9 +43,9 @@ function getToolGuide(tool) {
|
|
|
43
43
|
if (!contract) {
|
|
44
44
|
return `Use \`${tool}\` to analyze your code changes.`;
|
|
45
45
|
}
|
|
46
|
-
const {
|
|
47
|
-
const modelLine =
|
|
48
|
-
? `Model: ${contract.model} (thinking
|
|
46
|
+
const { thinkingLevel } = contract;
|
|
47
|
+
const modelLine = thinkingLevel !== undefined
|
|
48
|
+
? `Model: ${contract.model} (thinking level ${thinkingLevel}, output cap ${contract.maxOutputTokens}).`
|
|
49
49
|
: `Model: ${contract.model} (output cap ${contract.maxOutputTokens}).`;
|
|
50
50
|
return `Tool: ${contract.name}\n${modelLine}\nOutput: ${contract.outputShape}\nUse: ${contract.purpose}`;
|
|
51
51
|
}
|
|
@@ -23,9 +23,9 @@ function formatToolSection(contract) {
|
|
|
23
23
|
${parameterLines.join('\n')}
|
|
24
24
|
- Output shape: \`${contract.outputShape}\``;
|
|
25
25
|
}
|
|
26
|
-
const thinkingLine = contract.
|
|
27
|
-
? '- Thinking
|
|
28
|
-
: `- Thinking
|
|
26
|
+
const thinkingLine = contract.thinkingLevel === undefined
|
|
27
|
+
? '- Thinking level: disabled'
|
|
28
|
+
: `- Thinking level: ${contract.thinkingLevel}`;
|
|
29
29
|
return `### \`${contract.name}\`
|
|
30
30
|
- Purpose: ${contract.purpose}
|
|
31
31
|
- Model: \`${contract.model}\`
|
|
@@ -24,8 +24,8 @@ function formatNumber(value) {
|
|
|
24
24
|
function formatTimeout(ms) {
|
|
25
25
|
return `${Math.round(ms / 1_000)}s`;
|
|
26
26
|
}
|
|
27
|
-
function
|
|
28
|
-
return
|
|
27
|
+
function formatThinkingLevel(level) {
|
|
28
|
+
return level ?? '—';
|
|
29
29
|
}
|
|
30
30
|
export function buildServerConfig() {
|
|
31
31
|
const maxDiffChars = diffCharsConfig.get();
|
|
@@ -37,7 +37,7 @@ export function buildServerConfig() {
|
|
|
37
37
|
const toolRows = getToolContracts()
|
|
38
38
|
.filter((contract) => contract.model !== 'none')
|
|
39
39
|
.map((contract) => {
|
|
40
|
-
return `| \`${contract.name}\` | \`${contract.model}\` | ${
|
|
40
|
+
return `| \`${contract.name}\` | \`${contract.model}\` | ${formatThinkingLevel(contract.thinkingLevel)} | ${formatTimeout(contract.timeoutMs)} | ${formatNumber(contract.maxOutputTokens)} |`;
|
|
41
41
|
})
|
|
42
42
|
.join('\n');
|
|
43
43
|
return `# Server Configuration
|
|
@@ -55,7 +55,7 @@ export function buildServerConfig() {
|
|
|
55
55
|
|
|
56
56
|
Default model: \`${defaultModel}\` (override with \`GEMINI_MODEL\`)
|
|
57
57
|
|
|
58
|
-
| Tool | Model | Thinking
|
|
58
|
+
| Tool | Model | Thinking Level | Timeout | Max Output Tokens |
|
|
59
59
|
|------|-------|----------------|---------|-------------------|
|
|
60
60
|
${toolRows}
|
|
61
61
|
|
|
@@ -10,8 +10,8 @@ function formatNumber(value) {
|
|
|
10
10
|
function formatTimeout(timeoutMs) {
|
|
11
11
|
return `${Math.round(timeoutMs / 1_000)}s`;
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
return
|
|
13
|
+
function formatThinkingLevel(thinkingLevel) {
|
|
14
|
+
return thinkingLevel ?? '-';
|
|
15
15
|
}
|
|
16
16
|
function formatOutputTokens(maxOutputTokens) {
|
|
17
17
|
return formatNumber(maxOutputTokens);
|
|
@@ -29,7 +29,7 @@ function toToolInfoEntry(contract) {
|
|
|
29
29
|
name: contract.name,
|
|
30
30
|
purpose: contract.purpose,
|
|
31
31
|
model: contract.model,
|
|
32
|
-
|
|
32
|
+
thinkingLevel: formatThinkingLevel(contract.thinkingLevel),
|
|
33
33
|
timeout: formatTimeout(contract.timeoutMs),
|
|
34
34
|
maxOutputTokens: formatOutputTokens(contract.maxOutputTokens),
|
|
35
35
|
params: parameterRows.join('\n'),
|
|
@@ -62,7 +62,7 @@ function formatToolInfo(entry) {
|
|
|
62
62
|
${entry.purpose}
|
|
63
63
|
|
|
64
64
|
## Model
|
|
65
|
-
\`${entry.model}\` (thinking
|
|
65
|
+
\`${entry.model}\` (thinking level: ${entry.thinkingLevel}, timeout: ${entry.timeout}, max output tokens: ${entry.maxOutputTokens})
|
|
66
66
|
|
|
67
67
|
## Parameters
|
|
68
68
|
${entry.params}
|
|
@@ -18,9 +18,9 @@ export declare const DefaultOutputSchema: z.ZodObject<{
|
|
|
18
18
|
}, z.core.$strict>;
|
|
19
19
|
export declare const ReviewFindingSchema: z.ZodObject<{
|
|
20
20
|
severity: z.ZodEnum<{
|
|
21
|
-
low: "low";
|
|
22
21
|
medium: "medium";
|
|
23
22
|
high: "high";
|
|
23
|
+
low: "low";
|
|
24
24
|
critical: "critical";
|
|
25
25
|
}>;
|
|
26
26
|
file: z.ZodString;
|
|
@@ -31,9 +31,9 @@ export declare const ReviewFindingSchema: z.ZodObject<{
|
|
|
31
31
|
}, z.core.$strict>;
|
|
32
32
|
export declare const PrImpactResultSchema: z.ZodObject<{
|
|
33
33
|
severity: z.ZodEnum<{
|
|
34
|
-
low: "low";
|
|
35
34
|
medium: "medium";
|
|
36
35
|
high: "high";
|
|
36
|
+
low: "low";
|
|
37
37
|
critical: "critical";
|
|
38
38
|
}>;
|
|
39
39
|
categories: z.ZodArray<z.ZodEnum<{
|
|
@@ -61,9 +61,9 @@ export declare const PrImpactResultSchema: z.ZodObject<{
|
|
|
61
61
|
export declare const ReviewSummaryResultSchema: z.ZodObject<{
|
|
62
62
|
summary: z.ZodString;
|
|
63
63
|
overallRisk: z.ZodEnum<{
|
|
64
|
-
low: "low";
|
|
65
64
|
medium: "medium";
|
|
66
65
|
high: "high";
|
|
66
|
+
low: "low";
|
|
67
67
|
}>;
|
|
68
68
|
keyChanges: z.ZodArray<z.ZodString>;
|
|
69
69
|
recommendation: z.ZodString;
|
|
@@ -76,16 +76,16 @@ export declare const ReviewSummaryResultSchema: z.ZodObject<{
|
|
|
76
76
|
export declare const CodeQualityResultSchema: z.ZodObject<{
|
|
77
77
|
summary: z.ZodString;
|
|
78
78
|
overallRisk: z.ZodEnum<{
|
|
79
|
-
low: "low";
|
|
80
79
|
medium: "medium";
|
|
81
80
|
high: "high";
|
|
81
|
+
low: "low";
|
|
82
82
|
critical: "critical";
|
|
83
83
|
}>;
|
|
84
84
|
findings: z.ZodArray<z.ZodObject<{
|
|
85
85
|
severity: z.ZodEnum<{
|
|
86
|
-
low: "low";
|
|
87
86
|
medium: "medium";
|
|
88
87
|
high: "high";
|
|
88
|
+
low: "low";
|
|
89
89
|
critical: "critical";
|
|
90
90
|
}>;
|
|
91
91
|
file: z.ZodString;
|
|
@@ -101,16 +101,16 @@ export declare const CodeQualityOutputSchema: z.ZodObject<{
|
|
|
101
101
|
totalFindings: z.ZodOptional<z.ZodNumber>;
|
|
102
102
|
summary: z.ZodString;
|
|
103
103
|
overallRisk: z.ZodEnum<{
|
|
104
|
-
low: "low";
|
|
105
104
|
medium: "medium";
|
|
106
105
|
high: "high";
|
|
106
|
+
low: "low";
|
|
107
107
|
critical: "critical";
|
|
108
108
|
}>;
|
|
109
109
|
findings: z.ZodArray<z.ZodObject<{
|
|
110
110
|
severity: z.ZodEnum<{
|
|
111
|
-
low: "low";
|
|
112
111
|
medium: "medium";
|
|
113
112
|
high: "high";
|
|
113
|
+
low: "low";
|
|
114
114
|
critical: "critical";
|
|
115
115
|
}>;
|
|
116
116
|
file: z.ZodString;
|
|
@@ -23,8 +23,11 @@ export function registerAnalyzeComplexityTool(server) {
|
|
|
23
23
|
model: TOOL_CONTRACT.model,
|
|
24
24
|
timeoutMs: TOOL_CONTRACT.timeoutMs,
|
|
25
25
|
maxOutputTokens: TOOL_CONTRACT.maxOutputTokens,
|
|
26
|
-
...(TOOL_CONTRACT.
|
|
27
|
-
? {
|
|
26
|
+
...(TOOL_CONTRACT.thinkingLevel !== undefined
|
|
27
|
+
? { thinkingLevel: TOOL_CONTRACT.thinkingLevel }
|
|
28
|
+
: undefined),
|
|
29
|
+
...(TOOL_CONTRACT.temperature !== undefined
|
|
30
|
+
? { temperature: TOOL_CONTRACT.temperature }
|
|
28
31
|
: undefined),
|
|
29
32
|
validateInput: (_input, ctx) => {
|
|
30
33
|
const slot = ctx.diffSlot;
|
|
@@ -43,7 +46,7 @@ export function registerAnalyzeComplexityTool(server) {
|
|
|
43
46
|
: '';
|
|
44
47
|
return {
|
|
45
48
|
systemInstruction: SYSTEM_INSTRUCTION,
|
|
46
|
-
prompt: `${languageLine}
|
|
49
|
+
prompt: `${languageLine}\\nDiff:\\n${diff}\\n\\nBased on the diff above, analyze the Big-O time and space complexity.`.trimStart(),
|
|
47
50
|
};
|
|
48
51
|
},
|
|
49
52
|
});
|
|
@@ -27,6 +27,12 @@ export function registerAnalyzePrImpactTool(server) {
|
|
|
27
27
|
model: TOOL_CONTRACT.model,
|
|
28
28
|
timeoutMs: TOOL_CONTRACT.timeoutMs,
|
|
29
29
|
maxOutputTokens: TOOL_CONTRACT.maxOutputTokens,
|
|
30
|
+
...(TOOL_CONTRACT.thinkingLevel !== undefined
|
|
31
|
+
? { thinkingLevel: TOOL_CONTRACT.thinkingLevel }
|
|
32
|
+
: undefined),
|
|
33
|
+
...(TOOL_CONTRACT.temperature !== undefined
|
|
34
|
+
? { temperature: TOOL_CONTRACT.temperature }
|
|
35
|
+
: undefined),
|
|
30
36
|
validateInput: (_input, ctx) => {
|
|
31
37
|
const slot = ctx.diffSlot;
|
|
32
38
|
if (!slot)
|
|
@@ -50,6 +56,8 @@ ${fileSummary}
|
|
|
50
56
|
|
|
51
57
|
Diff:
|
|
52
58
|
${diff}
|
|
59
|
+
|
|
60
|
+
Based on the diff and change stats above, analyze the PR impact.
|
|
53
61
|
`,
|
|
54
62
|
};
|
|
55
63
|
},
|
|
@@ -23,6 +23,12 @@ export function registerDetectApiBreakingTool(server) {
|
|
|
23
23
|
model: TOOL_CONTRACT.model,
|
|
24
24
|
timeoutMs: TOOL_CONTRACT.timeoutMs,
|
|
25
25
|
maxOutputTokens: TOOL_CONTRACT.maxOutputTokens,
|
|
26
|
+
...(TOOL_CONTRACT.thinkingLevel !== undefined
|
|
27
|
+
? { thinkingLevel: TOOL_CONTRACT.thinkingLevel }
|
|
28
|
+
: undefined),
|
|
29
|
+
...(TOOL_CONTRACT.temperature !== undefined
|
|
30
|
+
? { temperature: TOOL_CONTRACT.temperature }
|
|
31
|
+
: undefined),
|
|
26
32
|
validateInput: (_input, ctx) => {
|
|
27
33
|
const slot = ctx.diffSlot;
|
|
28
34
|
if (!slot)
|
|
@@ -40,7 +46,7 @@ export function registerDetectApiBreakingTool(server) {
|
|
|
40
46
|
: '';
|
|
41
47
|
return {
|
|
42
48
|
systemInstruction: SYSTEM_INSTRUCTION,
|
|
43
|
-
prompt: `${languageLine}
|
|
49
|
+
prompt: `${languageLine}\\nDiff:\\n${diff}\\n\\nBased on the diff above, detect any breaking API changes.`.trimStart(),
|
|
44
50
|
};
|
|
45
51
|
},
|
|
46
52
|
});
|
|
@@ -34,6 +34,12 @@ export function registerGenerateReviewSummaryTool(server) {
|
|
|
34
34
|
model: TOOL_CONTRACT.model,
|
|
35
35
|
timeoutMs: TOOL_CONTRACT.timeoutMs,
|
|
36
36
|
maxOutputTokens: TOOL_CONTRACT.maxOutputTokens,
|
|
37
|
+
...(TOOL_CONTRACT.thinkingLevel !== undefined
|
|
38
|
+
? { thinkingLevel: TOOL_CONTRACT.thinkingLevel }
|
|
39
|
+
: undefined),
|
|
40
|
+
...(TOOL_CONTRACT.temperature !== undefined
|
|
41
|
+
? { temperature: TOOL_CONTRACT.temperature }
|
|
42
|
+
: undefined),
|
|
37
43
|
validateInput: (_input, ctx) => {
|
|
38
44
|
const slot = ctx.diffSlot;
|
|
39
45
|
if (!slot)
|
|
@@ -64,6 +70,8 @@ Stats: ${files} files, +${added}, -${deleted}
|
|
|
64
70
|
|
|
65
71
|
Diff:
|
|
66
72
|
${diff}
|
|
73
|
+
|
|
74
|
+
Based on the diff and stats above, summarize the PR and provide a merge recommendation.
|
|
67
75
|
`,
|
|
68
76
|
};
|
|
69
77
|
},
|
|
@@ -27,8 +27,11 @@ export function registerGenerateTestPlanTool(server) {
|
|
|
27
27
|
model: TOOL_CONTRACT.model,
|
|
28
28
|
timeoutMs: TOOL_CONTRACT.timeoutMs,
|
|
29
29
|
maxOutputTokens: TOOL_CONTRACT.maxOutputTokens,
|
|
30
|
-
...(TOOL_CONTRACT.
|
|
31
|
-
? {
|
|
30
|
+
...(TOOL_CONTRACT.thinkingLevel !== undefined
|
|
31
|
+
? { thinkingLevel: TOOL_CONTRACT.thinkingLevel }
|
|
32
|
+
: undefined),
|
|
33
|
+
...(TOOL_CONTRACT.temperature !== undefined
|
|
34
|
+
? { temperature: TOOL_CONTRACT.temperature }
|
|
32
35
|
: undefined),
|
|
33
36
|
validateInput: (_input, ctx) => {
|
|
34
37
|
const slot = ctx.diffSlot;
|
|
@@ -58,6 +61,8 @@ Changed Files: ${paths.join(', ')}
|
|
|
58
61
|
|
|
59
62
|
Diff:
|
|
60
63
|
${diff}
|
|
64
|
+
|
|
65
|
+
Based on the diff and stats above, generate an actionable test plan.
|
|
61
66
|
`,
|
|
62
67
|
};
|
|
63
68
|
},
|
|
@@ -63,8 +63,11 @@ export function registerInspectCodeQualityTool(server) {
|
|
|
63
63
|
model: TOOL_CONTRACT.model,
|
|
64
64
|
timeoutMs: TOOL_CONTRACT.timeoutMs,
|
|
65
65
|
maxOutputTokens: TOOL_CONTRACT.maxOutputTokens,
|
|
66
|
-
...(TOOL_CONTRACT.
|
|
67
|
-
? {
|
|
66
|
+
...(TOOL_CONTRACT.thinkingLevel !== undefined
|
|
67
|
+
? { thinkingLevel: TOOL_CONTRACT.thinkingLevel }
|
|
68
|
+
: undefined),
|
|
69
|
+
...(TOOL_CONTRACT.temperature !== undefined
|
|
70
|
+
? { temperature: TOOL_CONTRACT.temperature }
|
|
68
71
|
: undefined),
|
|
69
72
|
progressContext: (input) => {
|
|
70
73
|
const fileCount = input.files?.length;
|
|
@@ -114,6 +117,8 @@ ${fileSummary}
|
|
|
114
117
|
Diff:
|
|
115
118
|
${diff}
|
|
116
119
|
${fileContext}
|
|
120
|
+
|
|
121
|
+
Based on the diff and file context above, perform a deep code review focusing on the specified areas.
|
|
117
122
|
`,
|
|
118
123
|
};
|
|
119
124
|
},
|
|
@@ -27,8 +27,11 @@ export function registerSuggestSearchReplaceTool(server) {
|
|
|
27
27
|
model: TOOL_CONTRACT.model,
|
|
28
28
|
timeoutMs: TOOL_CONTRACT.timeoutMs,
|
|
29
29
|
maxOutputTokens: TOOL_CONTRACT.maxOutputTokens,
|
|
30
|
-
...(TOOL_CONTRACT.
|
|
31
|
-
? {
|
|
30
|
+
...(TOOL_CONTRACT.thinkingLevel !== undefined
|
|
31
|
+
? { thinkingLevel: TOOL_CONTRACT.thinkingLevel }
|
|
32
|
+
: undefined),
|
|
33
|
+
...(TOOL_CONTRACT.temperature !== undefined
|
|
34
|
+
? { temperature: TOOL_CONTRACT.temperature }
|
|
32
35
|
: undefined),
|
|
33
36
|
validateInput: (_input, ctx) => {
|
|
34
37
|
const slot = ctx.diffSlot;
|
|
@@ -55,6 +58,8 @@ Changed Files: ${paths.join(', ')}
|
|
|
55
58
|
|
|
56
59
|
Diff:
|
|
57
60
|
${diff}
|
|
61
|
+
|
|
62
|
+
Based on the diff and finding details above, generate minimal search-and-replace blocks to fix the issue.
|
|
58
63
|
`,
|
|
59
64
|
};
|
|
60
65
|
},
|